diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-10 09:38:29 -0500 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-01-12 09:32:59 -0500 |
commit | 3a93f2a9f4d8f73d74c0e552feb68a10f778a219 (patch) | |
tree | 8a9f503f2f061ad3fe9712b0986b0da346f4c8d2 /drivers/regulator/88pm8607.c | |
parent | 63cee946148821bca42be10130b061c2d0f5af7e (diff) |
regulator: Report actual configured voltage to set_voltage()
Change the interface used by set_voltage() to report the selected value
to the regulator core in terms of a selector used by list_voltage().
This allows the regulator core to know the voltage that was chosen
without having to do an explict get_voltage(), which would be much more
expensive as it will generally access hardware.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator/88pm8607.c')
-rw-r--r-- | drivers/regulator/88pm8607.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index 2ce2eb71d0f5..dd6308499bd4 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c | |||
@@ -249,7 +249,7 @@ static int choose_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) | |||
249 | } | 249 | } |
250 | 250 | ||
251 | static int pm8607_set_voltage(struct regulator_dev *rdev, | 251 | static int pm8607_set_voltage(struct regulator_dev *rdev, |
252 | int min_uV, int max_uV) | 252 | int min_uV, int max_uV, unsigned *selector) |
253 | { | 253 | { |
254 | struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); | 254 | struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); |
255 | uint8_t val, mask; | 255 | uint8_t val, mask; |
@@ -263,6 +263,7 @@ static int pm8607_set_voltage(struct regulator_dev *rdev, | |||
263 | ret = choose_voltage(rdev, min_uV, max_uV); | 263 | ret = choose_voltage(rdev, min_uV, max_uV); |
264 | if (ret < 0) | 264 | if (ret < 0) |
265 | return -EINVAL; | 265 | return -EINVAL; |
266 | *selector = ret; | ||
266 | val = (uint8_t)(ret << info->vol_shift); | 267 | val = (uint8_t)(ret << info->vol_shift); |
267 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; | 268 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; |
268 | 269 | ||