diff options
author | Johan Hovold <jhovold@gmail.com> | 2012-05-10 08:11:28 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-05-20 11:27:01 -0400 |
commit | d9055dc501da6734e3cfea1ef236173bd8b645b1 (patch) | |
tree | 46e93c758bbe5321f901f91880b0909a738bc16d /drivers/mfd | |
parent | 879eed68265c8dcb2f2856ec96820fc93b7038c9 (diff) |
mfd: Add boost frequency and ovp to lm3533 platform data
Add boost-frequency and over-voltage-protection settings to platform
data.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/lm3533-core.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c index 75f4b7f5a4fd..053438cff10a 100644 --- a/drivers/mfd/lm3533-core.c +++ b/drivers/mfd/lm3533-core.c | |||
@@ -138,6 +138,35 @@ int lm3533_update(struct lm3533 *lm3533, u8 reg, u8 val, u8 mask) | |||
138 | } | 138 | } |
139 | EXPORT_SYMBOL_GPL(lm3533_update); | 139 | EXPORT_SYMBOL_GPL(lm3533_update); |
140 | 140 | ||
141 | static int lm3533_set_boost_freq(struct lm3533 *lm3533, | ||
142 | enum lm3533_boost_freq freq) | ||
143 | { | ||
144 | int ret; | ||
145 | |||
146 | ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM, | ||
147 | freq << LM3533_BOOST_FREQ_SHIFT, | ||
148 | LM3533_BOOST_FREQ_MASK); | ||
149 | if (ret) | ||
150 | dev_err(lm3533->dev, "failed to set boost frequency\n"); | ||
151 | |||
152 | return ret; | ||
153 | } | ||
154 | |||
155 | |||
156 | static int lm3533_set_boost_ovp(struct lm3533 *lm3533, | ||
157 | enum lm3533_boost_ovp ovp) | ||
158 | { | ||
159 | int ret; | ||
160 | |||
161 | ret = lm3533_update(lm3533, LM3533_REG_BOOST_PWM, | ||
162 | ovp << LM3533_BOOST_OVP_SHIFT, | ||
163 | LM3533_BOOST_OVP_MASK); | ||
164 | if (ret) | ||
165 | dev_err(lm3533->dev, "failed to set boost ovp\n"); | ||
166 | |||
167 | return ret; | ||
168 | } | ||
169 | |||
141 | /* | 170 | /* |
142 | * HVLED output config -- output hvled controlled by backlight bl | 171 | * HVLED output config -- output hvled controlled by backlight bl |
143 | */ | 172 | */ |
@@ -521,6 +550,22 @@ static int __devinit lm3533_device_led_init(struct lm3533 *lm3533) | |||
521 | return 0; | 550 | return 0; |
522 | } | 551 | } |
523 | 552 | ||
553 | static int __devinit lm3533_device_setup(struct lm3533 *lm3533, | ||
554 | struct lm3533_platform_data *pdata) | ||
555 | { | ||
556 | int ret; | ||
557 | |||
558 | ret = lm3533_set_boost_freq(lm3533, pdata->boost_freq); | ||
559 | if (ret) | ||
560 | return ret; | ||
561 | |||
562 | ret = lm3533_set_boost_ovp(lm3533, pdata->boost_ovp); | ||
563 | if (ret) | ||
564 | return ret; | ||
565 | |||
566 | return 0; | ||
567 | } | ||
568 | |||
524 | static int __devinit lm3533_device_init(struct lm3533 *lm3533) | 569 | static int __devinit lm3533_device_init(struct lm3533 *lm3533) |
525 | { | 570 | { |
526 | struct lm3533_platform_data *pdata = lm3533->dev->platform_data; | 571 | struct lm3533_platform_data *pdata = lm3533->dev->platform_data; |
@@ -550,6 +595,10 @@ static int __devinit lm3533_device_init(struct lm3533 *lm3533) | |||
550 | 595 | ||
551 | lm3533_enable(lm3533); | 596 | lm3533_enable(lm3533); |
552 | 597 | ||
598 | ret = lm3533_device_setup(lm3533, pdata); | ||
599 | if (ret) | ||
600 | goto err_disable; | ||
601 | |||
553 | lm3533_device_als_init(lm3533); | 602 | lm3533_device_als_init(lm3533); |
554 | lm3533_device_bl_init(lm3533); | 603 | lm3533_device_bl_init(lm3533); |
555 | lm3533_device_led_init(lm3533); | 604 | lm3533_device_led_init(lm3533); |
@@ -564,6 +613,7 @@ static int __devinit lm3533_device_init(struct lm3533 *lm3533) | |||
564 | 613 | ||
565 | err_unregister: | 614 | err_unregister: |
566 | mfd_remove_devices(lm3533->dev); | 615 | mfd_remove_devices(lm3533->dev); |
616 | err_disable: | ||
567 | lm3533_disable(lm3533); | 617 | lm3533_disable(lm3533); |
568 | if (gpio_is_valid(lm3533->gpio_hwen)) | 618 | if (gpio_is_valid(lm3533->gpio_hwen)) |
569 | gpio_free(lm3533->gpio_hwen); | 619 | gpio_free(lm3533->gpio_hwen); |