21 #include <linux/module.h>
35 #define ECCTL2_APWM_POL_LOW BIT(10)
36 #define ECCTL2_APWM_MODE BIT(9)
37 #define ECCTL2_SYNC_SEL_DISA (BIT(7) | BIT(6))
38 #define ECCTL2_TSCTR_FREERUN BIT(4)
56 int duty_ns,
int period_ns)
60 unsigned long period_cycles, duty_cycles;
69 period_cycles = (
unsigned long)c;
71 if (period_cycles < 1) {
78 duty_cycles = (
unsigned long)c;
81 pm_runtime_get_sync(pc->
chip.dev);
111 pm_runtime_put_sync(pc->
chip.dev);
121 pm_runtime_get_sync(pc->
chip.dev);
131 pm_runtime_put_sync(pc->
chip.dev);
141 pm_runtime_get_sync(pc->
chip.dev);
167 pm_runtime_put_sync(pc->
chip.dev);
173 dev_warn(chip->
dev,
"Removing PWM device without disabling\n");
174 pm_runtime_put_sync(chip->
dev);
178 static const struct pwm_ops ecap_pwm_ops = {
179 .free = ecap_pwm_free,
180 .config = ecap_pwm_config,
181 .set_polarity = ecap_pwm_set_polarity,
182 .enable = ecap_pwm_enable,
183 .disable = ecap_pwm_disable,
196 dev_err(&pdev->
dev,
"failed to allocate memory\n");
208 dev_err(&pdev->
dev,
"failed to get clock rate\n");
213 pc->
chip.ops = &ecap_pwm_ops;
219 dev_err(&pdev->
dev,
"no memory resource defined\n");
229 dev_err(&pdev->
dev,
"pwmchip_add() failed: %d\n", ret);
234 platform_set_drvdata(pdev, pc);
242 pm_runtime_put_sync(&pdev->
dev);
243 pm_runtime_disable(&pdev->
dev);
251 .probe = ecap_pwm_probe,