Lines Matching full:pc

53 	struct ecap_pwm_chip *pc = to_ecap_pwm_chip(chip);  in ecap_pwm_config()  local
58 c = pc->clk_rate; in ecap_pwm_config()
67 c = pc->clk_rate; in ecap_pwm_config()
73 pm_runtime_get_sync(pc->chip.dev); in ecap_pwm_config()
75 value = readw(pc->mmio_base + ECCTL2); in ecap_pwm_config()
80 writew(value, pc->mmio_base + ECCTL2); in ecap_pwm_config()
84 writel(duty_cycles, pc->mmio_base + CAP2); in ecap_pwm_config()
85 writel(period_cycles, pc->mmio_base + CAP1); in ecap_pwm_config()
92 writel(duty_cycles, pc->mmio_base + CAP4); in ecap_pwm_config()
93 writel(period_cycles, pc->mmio_base + CAP3); in ecap_pwm_config()
97 value = readw(pc->mmio_base + ECCTL2); in ecap_pwm_config()
100 writew(value, pc->mmio_base + ECCTL2); in ecap_pwm_config()
103 pm_runtime_put_sync(pc->chip.dev); in ecap_pwm_config()
111 struct ecap_pwm_chip *pc = to_ecap_pwm_chip(chip); in ecap_pwm_set_polarity() local
114 pm_runtime_get_sync(pc->chip.dev); in ecap_pwm_set_polarity()
116 value = readw(pc->mmio_base + ECCTL2); in ecap_pwm_set_polarity()
125 writew(value, pc->mmio_base + ECCTL2); in ecap_pwm_set_polarity()
127 pm_runtime_put_sync(pc->chip.dev); in ecap_pwm_set_polarity()
134 struct ecap_pwm_chip *pc = to_ecap_pwm_chip(chip); in ecap_pwm_enable() local
138 pm_runtime_get_sync(pc->chip.dev); in ecap_pwm_enable()
144 value = readw(pc->mmio_base + ECCTL2); in ecap_pwm_enable()
146 writew(value, pc->mmio_base + ECCTL2); in ecap_pwm_enable()
153 struct ecap_pwm_chip *pc = to_ecap_pwm_chip(chip); in ecap_pwm_disable() local
160 value = readw(pc->mmio_base + ECCTL2); in ecap_pwm_disable()
162 writew(value, pc->mmio_base + ECCTL2); in ecap_pwm_disable()
165 pm_runtime_put_sync(pc->chip.dev); in ecap_pwm_disable()
221 struct ecap_pwm_chip *pc; in ecap_pwm_probe() local
225 pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL); in ecap_pwm_probe()
226 if (!pc) in ecap_pwm_probe()
242 pc->clk_rate = clk_get_rate(clk); in ecap_pwm_probe()
243 if (!pc->clk_rate) { in ecap_pwm_probe()
248 pc->chip.dev = &pdev->dev; in ecap_pwm_probe()
249 pc->chip.ops = &ecap_pwm_ops; in ecap_pwm_probe()
250 pc->chip.npwm = 1; in ecap_pwm_probe()
252 pc->mmio_base = devm_platform_ioremap_resource(pdev, 0); in ecap_pwm_probe()
253 if (IS_ERR(pc->mmio_base)) in ecap_pwm_probe()
254 return PTR_ERR(pc->mmio_base); in ecap_pwm_probe()
256 ret = devm_pwmchip_add(&pdev->dev, &pc->chip); in ecap_pwm_probe()
262 platform_set_drvdata(pdev, pc); in ecap_pwm_probe()
274 static void ecap_pwm_save_context(struct ecap_pwm_chip *pc) in ecap_pwm_save_context() argument
276 pm_runtime_get_sync(pc->chip.dev); in ecap_pwm_save_context()
277 pc->ctx.ecctl2 = readw(pc->mmio_base + ECCTL2); in ecap_pwm_save_context()
278 pc->ctx.cap4 = readl(pc->mmio_base + CAP4); in ecap_pwm_save_context()
279 pc->ctx.cap3 = readl(pc->mmio_base + CAP3); in ecap_pwm_save_context()
280 pm_runtime_put_sync(pc->chip.dev); in ecap_pwm_save_context()
283 static void ecap_pwm_restore_context(struct ecap_pwm_chip *pc) in ecap_pwm_restore_context() argument
285 writel(pc->ctx.cap3, pc->mmio_base + CAP3); in ecap_pwm_restore_context()
286 writel(pc->ctx.cap4, pc->mmio_base + CAP4); in ecap_pwm_restore_context()
287 writew(pc->ctx.ecctl2, pc->mmio_base + ECCTL2); in ecap_pwm_restore_context()
292 struct ecap_pwm_chip *pc = dev_get_drvdata(dev); in ecap_pwm_suspend() local
293 struct pwm_device *pwm = pc->chip.pwms; in ecap_pwm_suspend()
295 ecap_pwm_save_context(pc); in ecap_pwm_suspend()
306 struct ecap_pwm_chip *pc = dev_get_drvdata(dev); in ecap_pwm_resume() local
307 struct pwm_device *pwm = pc->chip.pwms; in ecap_pwm_resume()
313 ecap_pwm_restore_context(pc); in ecap_pwm_resume()