13 #include <linux/kernel.h>
14 #include <linux/module.h>
19 #include <linux/slab.h>
27 #define PWM_ENABLE (1 << 31)
28 #define PWM_RELOADV(x) (((x) & 0xFF) << 8)
29 #define PWM_DUTY(x) ((x) & 0xFF)
31 #define to_lpc32xx_pwm_chip(_chip) \
32 container_of(_chip, struct lpc32xx_pwm_chip, chip)
35 int duty_ns,
int period_ns)
39 int period_cycles, duty_cycles;
77 static const struct pwm_ops lpc32xx_pwm_ops = {
78 .config = lpc32xx_pwm_config,
79 .enable = lpc32xx_pwm_enable,
80 .disable = lpc32xx_pwm_disable,
103 if (IS_ERR(lpc32xx->
clk))
104 return PTR_ERR(lpc32xx->
clk);
106 lpc32xx->
chip.dev = &pdev->
dev;
107 lpc32xx->
chip.ops = &lpc32xx_pwm_ops;
108 lpc32xx->
chip.npwm = 2;
112 dev_err(&pdev->
dev,
"failed to add PWM chip, error %d\n", ret);
116 platform_set_drvdata(pdev, lpc32xx);
130 { .compatible =
"nxp,lpc3220-pwm", },
137 .name =
"lpc32xx-pwm",
140 .probe = lpc32xx_pwm_probe,