aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max8649.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-10 09:38:29 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-01-12 09:32:59 -0500
commit3a93f2a9f4d8f73d74c0e552feb68a10f778a219 (patch)
tree8a9f503f2f061ad3fe9712b0986b0da346f4c8d2 /drivers/regulator/max8649.c
parent63cee946148821bca42be10130b061c2d0f5af7e (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/max8649.c')
-rw-r--r--drivers/regulator/max8649.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index 6b60a9c0366b..30eb9e54f7ec 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -155,7 +155,7 @@ static int max8649_get_voltage(struct regulator_dev *rdev)
155} 155}
156 156
157static int max8649_set_voltage(struct regulator_dev *rdev, 157static int max8649_set_voltage(struct regulator_dev *rdev,
158 int min_uV, int max_uV) 158 int min_uV, int max_uV, unsigned *selector)
159{ 159{
160 struct max8649_regulator_info *info = rdev_get_drvdata(rdev); 160 struct max8649_regulator_info *info = rdev_get_drvdata(rdev);
161 unsigned char data, mask; 161 unsigned char data, mask;
@@ -168,6 +168,7 @@ static int max8649_set_voltage(struct regulator_dev *rdev,
168 data = (min_uV - MAX8649_DCDC_VMIN + MAX8649_DCDC_STEP - 1) 168 data = (min_uV - MAX8649_DCDC_VMIN + MAX8649_DCDC_STEP - 1)
169 / MAX8649_DCDC_STEP; 169 / MAX8649_DCDC_STEP;
170 mask = MAX8649_VOL_MASK; 170 mask = MAX8649_VOL_MASK;
171 *selector = data & mask;
171 172
172 return max8649_set_bits(info->i2c, info->vol_reg, mask, data); 173 return max8649_set_bits(info->i2c, info->vol_reg, mask, data);
173} 174}