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/lp3971.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/lp3971.c')
-rw-r--r-- | drivers/regulator/lp3971.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c index 3bb82b624e19..0f22ef12601c 100644 --- a/drivers/regulator/lp3971.c +++ b/drivers/regulator/lp3971.c | |||
@@ -168,7 +168,8 @@ static int lp3971_ldo_get_voltage(struct regulator_dev *dev) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | static int lp3971_ldo_set_voltage(struct regulator_dev *dev, | 170 | static int lp3971_ldo_set_voltage(struct regulator_dev *dev, |
171 | int min_uV, int max_uV) | 171 | int min_uV, int max_uV, |
172 | unsigned int *selector) | ||
172 | { | 173 | { |
173 | struct lp3971 *lp3971 = rdev_get_drvdata(dev); | 174 | struct lp3971 *lp3971 = rdev_get_drvdata(dev); |
174 | int ldo = rdev_get_id(dev) - LP3971_LDO1; | 175 | int ldo = rdev_get_id(dev) - LP3971_LDO1; |
@@ -187,6 +188,8 @@ static int lp3971_ldo_set_voltage(struct regulator_dev *dev, | |||
187 | if (val > LDO_VOL_MAX_IDX || vol_map[val] > max_vol) | 188 | if (val > LDO_VOL_MAX_IDX || vol_map[val] > max_vol) |
188 | return -EINVAL; | 189 | return -EINVAL; |
189 | 190 | ||
191 | *selector = val; | ||
192 | |||
190 | return lp3971_set_bits(lp3971, LP3971_LDO_VOL_CONTR_REG(ldo), | 193 | return lp3971_set_bits(lp3971, LP3971_LDO_VOL_CONTR_REG(ldo), |
191 | LDO_VOL_CONTR_MASK << LDO_VOL_CONTR_SHIFT(ldo), | 194 | LDO_VOL_CONTR_MASK << LDO_VOL_CONTR_SHIFT(ldo), |
192 | val << LDO_VOL_CONTR_SHIFT(ldo)); | 195 | val << LDO_VOL_CONTR_SHIFT(ldo)); |
@@ -256,7 +259,8 @@ static int lp3971_dcdc_get_voltage(struct regulator_dev *dev) | |||
256 | } | 259 | } |
257 | 260 | ||
258 | static int lp3971_dcdc_set_voltage(struct regulator_dev *dev, | 261 | static int lp3971_dcdc_set_voltage(struct regulator_dev *dev, |
259 | int min_uV, int max_uV) | 262 | int min_uV, int max_uV, |
263 | unsigned int *selector) | ||
260 | { | 264 | { |
261 | struct lp3971 *lp3971 = rdev_get_drvdata(dev); | 265 | struct lp3971 *lp3971 = rdev_get_drvdata(dev); |
262 | int buck = rdev_get_id(dev) - LP3971_DCDC1; | 266 | int buck = rdev_get_id(dev) - LP3971_DCDC1; |
@@ -277,6 +281,8 @@ static int lp3971_dcdc_set_voltage(struct regulator_dev *dev, | |||
277 | if (val > BUCK_TARGET_VOL_MAX_IDX || vol_map[val] > max_vol) | 281 | if (val > BUCK_TARGET_VOL_MAX_IDX || vol_map[val] > max_vol) |
278 | return -EINVAL; | 282 | return -EINVAL; |
279 | 283 | ||
284 | *selector = val; | ||
285 | |||
280 | ret = lp3971_set_bits(lp3971, LP3971_BUCK_TARGET_VOL1_REG(buck), | 286 | ret = lp3971_set_bits(lp3971, LP3971_BUCK_TARGET_VOL1_REG(buck), |
281 | BUCK_TARGET_VOL_MASK, val); | 287 | BUCK_TARGET_VOL_MASK, val); |
282 | if (ret) | 288 | if (ret) |