diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-05-08 07:46:10 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-12 06:12:41 -0400 |
commit | d4eb56a16273a04f10eb7f959e1bb59b6f88d8c9 (patch) | |
tree | fdcfd0d808c9bb418ad068689cc158209e256fef /drivers/regulator | |
parent | 5ceba7bab02df45260452e06f3b9c391ad1d776e (diff) |
regulator: da903x: Fix list voltage for da9030 ldo14
da903x_list_voltage does not return correct voltage for da9030 ldo14.
Implement da9030_list_ldo14_voltage to return correct voltage for da9030 ldo14.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/da903x.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c index 682bdb391abd..a9c4590061c1 100644 --- a/drivers/regulator/da903x.c +++ b/drivers/regulator/da903x.c | |||
@@ -267,6 +267,24 @@ static int da9030_get_ldo14_voltage(struct regulator_dev *rdev) | |||
267 | info->step_uV * (val & ~0x4); | 267 | info->step_uV * (val & ~0x4); |
268 | } | 268 | } |
269 | 269 | ||
270 | static int da9030_list_ldo14_voltage(struct regulator_dev *rdev, | ||
271 | unsigned selector) | ||
272 | { | ||
273 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | ||
274 | int volt; | ||
275 | |||
276 | if (selector & 0x4) | ||
277 | volt = info->min_uV + info->step_uV * (3 - (selector & ~0x4)); | ||
278 | else | ||
279 | volt = (info->max_uV + info->min_uV) / 2 + | ||
280 | info->step_uV * (selector & ~0x4); | ||
281 | |||
282 | if (volt > info->max_uV) | ||
283 | return -EINVAL; | ||
284 | |||
285 | return volt; | ||
286 | } | ||
287 | |||
270 | /* DA9034 specific operations */ | 288 | /* DA9034 specific operations */ |
271 | static int da9034_set_dvc_voltage(struct regulator_dev *rdev, | 289 | static int da9034_set_dvc_voltage(struct regulator_dev *rdev, |
272 | int min_uV, int max_uV, unsigned *selector) | 290 | int min_uV, int max_uV, unsigned *selector) |
@@ -357,7 +375,7 @@ static struct regulator_ops da903x_regulator_ldo_ops = { | |||
357 | static struct regulator_ops da9030_regulator_ldo14_ops = { | 375 | static struct regulator_ops da9030_regulator_ldo14_ops = { |
358 | .set_voltage = da9030_set_ldo14_voltage, | 376 | .set_voltage = da9030_set_ldo14_voltage, |
359 | .get_voltage = da9030_get_ldo14_voltage, | 377 | .get_voltage = da9030_get_ldo14_voltage, |
360 | .list_voltage = da903x_list_voltage, | 378 | .list_voltage = da9030_list_ldo14_voltage, |
361 | .enable = da903x_enable, | 379 | .enable = da903x_enable, |
362 | .disable = da903x_disable, | 380 | .disable = da903x_disable, |
363 | .is_enabled = da903x_is_enabled, | 381 | .is_enabled = da903x_is_enabled, |