summaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-ab8500.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pwm/pwm-ab8500.c')
-rw-r--r--drivers/pwm/pwm-ab8500.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/pwm/pwm-ab8500.c b/drivers/pwm/pwm-ab8500.c
index 1d07a6f99375..4c07a8420b37 100644
--- a/drivers/pwm/pwm-ab8500.c
+++ b/drivers/pwm/pwm-ab8500.c
@@ -20,10 +20,6 @@
20#define AB8500_PWM_OUT_CTRL2_REG 0x61 20#define AB8500_PWM_OUT_CTRL2_REG 0x61
21#define AB8500_PWM_OUT_CTRL7_REG 0x66 21#define AB8500_PWM_OUT_CTRL7_REG 0x66
22 22
23/* backlight driver constants */
24#define ENABLE_PWM 1
25#define DISABLE_PWM 0
26
27struct ab8500_pwm_chip { 23struct ab8500_pwm_chip {
28 struct pwm_chip chip; 24 struct pwm_chip chip;
29}; 25};
@@ -64,7 +60,7 @@ static int ab8500_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
64 60
65 ret = abx500_mask_and_set_register_interruptible(chip->dev, 61 ret = abx500_mask_and_set_register_interruptible(chip->dev,
66 AB8500_MISC, AB8500_PWM_OUT_CTRL7_REG, 62 AB8500_MISC, AB8500_PWM_OUT_CTRL7_REG,
67 1 << (chip->base - 1), ENABLE_PWM); 63 1 << (chip->base - 1), 1 << (chip->base - 1));
68 if (ret < 0) 64 if (ret < 0)
69 dev_err(chip->dev, "%s: Failed to enable PWM, Error %d\n", 65 dev_err(chip->dev, "%s: Failed to enable PWM, Error %d\n",
70 pwm->label, ret); 66 pwm->label, ret);
@@ -77,11 +73,10 @@ static void ab8500_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
77 73
78 ret = abx500_mask_and_set_register_interruptible(chip->dev, 74 ret = abx500_mask_and_set_register_interruptible(chip->dev,
79 AB8500_MISC, AB8500_PWM_OUT_CTRL7_REG, 75 AB8500_MISC, AB8500_PWM_OUT_CTRL7_REG,
80 1 << (chip->base - 1), DISABLE_PWM); 76 1 << (chip->base - 1), 0);
81 if (ret < 0) 77 if (ret < 0)
82 dev_err(chip->dev, "%s: Failed to disable PWM, Error %d\n", 78 dev_err(chip->dev, "%s: Failed to disable PWM, Error %d\n",
83 pwm->label, ret); 79 pwm->label, ret);
84 return;
85} 80}
86 81
87static const struct pwm_ops ab8500_pwm_ops = { 82static const struct pwm_ops ab8500_pwm_ops = {
@@ -101,10 +96,8 @@ static int ab8500_pwm_probe(struct platform_device *pdev)
101 * device which is required for ab8500 read and write 96 * device which is required for ab8500 read and write
102 */ 97 */
103 ab8500 = devm_kzalloc(&pdev->dev, sizeof(*ab8500), GFP_KERNEL); 98 ab8500 = devm_kzalloc(&pdev->dev, sizeof(*ab8500), GFP_KERNEL);
104 if (ab8500 == NULL) { 99 if (ab8500 == NULL)
105 dev_err(&pdev->dev, "failed to allocate memory\n");
106 return -ENOMEM; 100 return -ENOMEM;
107 }
108 101
109 ab8500->chip.dev = &pdev->dev; 102 ab8500->chip.dev = &pdev->dev;
110 ab8500->chip.ops = &ab8500_pwm_ops; 103 ab8500->chip.ops = &ab8500_pwm_ops;