aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/wm8400-regulator.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/wm8400-regulator.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/wm8400-regulator.c')
-rw-r--r--drivers/regulator/wm8400-regulator.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/wm8400-regulator.c b/drivers/regulator/wm8400-regulator.c
index 924c7eb29ee9..b42d01cef35a 100644
--- a/drivers/regulator/wm8400-regulator.c
+++ b/drivers/regulator/wm8400-regulator.c
@@ -67,7 +67,7 @@ static int wm8400_ldo_get_voltage(struct regulator_dev *dev)
67} 67}
68 68
69static int wm8400_ldo_set_voltage(struct regulator_dev *dev, 69static int wm8400_ldo_set_voltage(struct regulator_dev *dev,
70 int min_uV, int max_uV) 70 int min_uV, int max_uV, unsigned *selector)
71{ 71{
72 struct wm8400 *wm8400 = rdev_get_drvdata(dev); 72 struct wm8400 *wm8400 = rdev_get_drvdata(dev);
73 u16 val; 73 u16 val;
@@ -93,6 +93,8 @@ static int wm8400_ldo_set_voltage(struct regulator_dev *dev,
93 val += 0xf; 93 val += 0xf;
94 } 94 }
95 95
96 *selector = val;
97
96 return wm8400_set_bits(wm8400, WM8400_LDO1_CONTROL + rdev_get_id(dev), 98 return wm8400_set_bits(wm8400, WM8400_LDO1_CONTROL + rdev_get_id(dev),
97 WM8400_LDO1_VSEL_MASK, val); 99 WM8400_LDO1_VSEL_MASK, val);
98} 100}
@@ -156,7 +158,7 @@ static int wm8400_dcdc_get_voltage(struct regulator_dev *dev)
156} 158}
157 159
158static int wm8400_dcdc_set_voltage(struct regulator_dev *dev, 160static int wm8400_dcdc_set_voltage(struct regulator_dev *dev,
159 int min_uV, int max_uV) 161 int min_uV, int max_uV, unsigned *selector)
160{ 162{
161 struct wm8400 *wm8400 = rdev_get_drvdata(dev); 163 struct wm8400 *wm8400 = rdev_get_drvdata(dev);
162 u16 val; 164 u16 val;
@@ -171,6 +173,8 @@ static int wm8400_dcdc_set_voltage(struct regulator_dev *dev,
171 return -EINVAL; 173 return -EINVAL;
172 BUG_ON(850000 + (25000 * val) < min_uV); 174 BUG_ON(850000 + (25000 * val) < min_uV);
173 175
176 *selector = val;
177
174 return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset, 178 return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset,
175 WM8400_DC1_VSEL_MASK, val); 179 WM8400_DC1_VSEL_MASK, val);
176} 180}