9 #include <linux/slab.h>
13 #include <linux/module.h>
19 #define AB8500_PWM_OUT_CTRL1_REG 0x60
20 #define AB8500_PWM_OUT_CTRL2_REG 0x61
21 #define AB8500_PWM_OUT_CTRL7_REG 0x66
32 int duty_ns,
int period_ns)
35 unsigned int higher_val, lower_val;
42 lower_val = duty_ns & 0x00FF;
47 higher_val = ((duty_ns & 0x0300) >> 8);
56 (
reg + 1), (
u8)higher_val);
69 dev_err(chip->
dev,
"%s: Failed to disable PWM, Error %d\n",
82 dev_err(chip->
dev,
"%s: Failed to disable PWM, Error %d\n",
87 static const struct pwm_ops ab8500_pwm_ops = {
88 .config = ab8500_pwm_config,
89 .enable = ab8500_pwm_enable,
90 .disable = ab8500_pwm_disable,
102 ab8500 = kzalloc(
sizeof(*ab8500),
GFP_KERNEL);
103 if (ab8500 ==
NULL) {
104 dev_err(&pdev->
dev,
"failed to allocate memory\n");
109 ab8500->
chip.ops = &ab8500_pwm_ops;
110 ab8500->
chip.base = pdev->
id;
111 ab8500->
chip.npwm = 1;
119 dev_dbg(&pdev->
dev,
"pwm probe successful\n");
120 platform_set_drvdata(pdev, ab8500);
142 .name =
"ab8500-pwm",
145 .probe = ab8500_pwm_probe,