• Home
  • Raw
  • Download

Lines Matching refs:zpc

41 static inline u32 zx_pwm_readl(struct zx_pwm_chip *zpc, unsigned int hwpwm,  in zx_pwm_readl()  argument
44 return readl(zpc->base + (hwpwm + 1) * 0x10 + offset); in zx_pwm_readl()
47 static inline void zx_pwm_writel(struct zx_pwm_chip *zpc, unsigned int hwpwm, in zx_pwm_writel() argument
50 writel(value, zpc->base + (hwpwm + 1) * 0x10 + offset); in zx_pwm_writel()
53 static void zx_pwm_set_mask(struct zx_pwm_chip *zpc, unsigned int hwpwm, in zx_pwm_set_mask() argument
58 data = zx_pwm_readl(zpc, hwpwm, offset); in zx_pwm_set_mask()
61 zx_pwm_writel(zpc, hwpwm, offset, data); in zx_pwm_set_mask()
67 struct zx_pwm_chip *zpc = to_zx_pwm_chip(chip); in zx_pwm_get_state() local
73 value = zx_pwm_readl(zpc, pwm->hwpwm, ZX_PWM_MODE); in zx_pwm_get_state()
86 rate = clk_get_rate(zpc->wclk); in zx_pwm_get_state()
88 tmp = zx_pwm_readl(zpc, pwm->hwpwm, ZX_PWM_PERIOD); in zx_pwm_get_state()
92 tmp = zx_pwm_readl(zpc, pwm->hwpwm, ZX_PWM_DUTY); in zx_pwm_get_state()
100 struct zx_pwm_chip *zpc = to_zx_pwm_chip(chip); in zx_pwm_config() local
107 rate = clk_get_rate(zpc->wclk); in zx_pwm_config()
134 zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, ZX_PWM_EN, 0); in zx_pwm_config()
137 zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, ZX_PWM_CLKDIV_MASK, in zx_pwm_config()
139 zx_pwm_writel(zpc, pwm->hwpwm, ZX_PWM_PERIOD, period_cycles); in zx_pwm_config()
140 zx_pwm_writel(zpc, pwm->hwpwm, ZX_PWM_DUTY, duty_cycles); in zx_pwm_config()
144 zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, in zx_pwm_config()
153 struct zx_pwm_chip *zpc = to_zx_pwm_chip(chip); in zx_pwm_apply() local
160 zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, ZX_PWM_POLAR, in zx_pwm_apply()
174 ret = clk_prepare_enable(zpc->wclk); in zx_pwm_apply()
178 zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, in zx_pwm_apply()
181 zx_pwm_set_mask(zpc, pwm->hwpwm, ZX_PWM_MODE, in zx_pwm_apply()
183 clk_disable_unprepare(zpc->wclk); in zx_pwm_apply()
198 struct zx_pwm_chip *zpc; in zx_pwm_probe() local
203 zpc = devm_kzalloc(&pdev->dev, sizeof(*zpc), GFP_KERNEL); in zx_pwm_probe()
204 if (!zpc) in zx_pwm_probe()
208 zpc->base = devm_ioremap_resource(&pdev->dev, res); in zx_pwm_probe()
209 if (IS_ERR(zpc->base)) in zx_pwm_probe()
210 return PTR_ERR(zpc->base); in zx_pwm_probe()
212 zpc->pclk = devm_clk_get(&pdev->dev, "pclk"); in zx_pwm_probe()
213 if (IS_ERR(zpc->pclk)) in zx_pwm_probe()
214 return PTR_ERR(zpc->pclk); in zx_pwm_probe()
216 zpc->wclk = devm_clk_get(&pdev->dev, "wclk"); in zx_pwm_probe()
217 if (IS_ERR(zpc->wclk)) in zx_pwm_probe()
218 return PTR_ERR(zpc->wclk); in zx_pwm_probe()
220 ret = clk_prepare_enable(zpc->pclk); in zx_pwm_probe()
224 zpc->chip.dev = &pdev->dev; in zx_pwm_probe()
225 zpc->chip.ops = &zx_pwm_ops; in zx_pwm_probe()
226 zpc->chip.base = -1; in zx_pwm_probe()
227 zpc->chip.npwm = 4; in zx_pwm_probe()
228 zpc->chip.of_xlate = of_pwm_xlate_with_flags; in zx_pwm_probe()
229 zpc->chip.of_pwm_n_cells = 3; in zx_pwm_probe()
235 for (i = 0; i < zpc->chip.npwm; i++) in zx_pwm_probe()
236 zx_pwm_set_mask(zpc, i, ZX_PWM_MODE, ZX_PWM_EN, 0); in zx_pwm_probe()
238 ret = pwmchip_add(&zpc->chip); in zx_pwm_probe()
244 platform_set_drvdata(pdev, zpc); in zx_pwm_probe()
251 struct zx_pwm_chip *zpc = platform_get_drvdata(pdev); in zx_pwm_remove() local
254 ret = pwmchip_remove(&zpc->chip); in zx_pwm_remove()
255 clk_disable_unprepare(zpc->pclk); in zx_pwm_remove()