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/wm8994-regulator.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/wm8994-regulator.c')
-rw-r--r-- | drivers/regulator/wm8994-regulator.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c index 03713bc66e4a..1b162e699368 100644 --- a/drivers/regulator/wm8994-regulator.c +++ b/drivers/regulator/wm8994-regulator.c | |||
@@ -101,7 +101,7 @@ static int wm8994_ldo1_get_voltage(struct regulator_dev *rdev) | |||
101 | } | 101 | } |
102 | 102 | ||
103 | static int wm8994_ldo1_set_voltage(struct regulator_dev *rdev, | 103 | static int wm8994_ldo1_set_voltage(struct regulator_dev *rdev, |
104 | int min_uV, int max_uV) | 104 | int min_uV, int max_uV, unsigned *s) |
105 | { | 105 | { |
106 | struct wm8994_ldo *ldo = rdev_get_drvdata(rdev); | 106 | struct wm8994_ldo *ldo = rdev_get_drvdata(rdev); |
107 | int selector, v; | 107 | int selector, v; |
@@ -111,6 +111,7 @@ static int wm8994_ldo1_set_voltage(struct regulator_dev *rdev, | |||
111 | if (v < 0 || v > max_uV) | 111 | if (v < 0 || v > max_uV) |
112 | return -EINVAL; | 112 | return -EINVAL; |
113 | 113 | ||
114 | *s = selector; | ||
114 | selector <<= WM8994_LDO1_VSEL_SHIFT; | 115 | selector <<= WM8994_LDO1_VSEL_SHIFT; |
115 | 116 | ||
116 | return wm8994_set_bits(ldo->wm8994, WM8994_LDO_1, | 117 | return wm8994_set_bits(ldo->wm8994, WM8994_LDO_1, |
@@ -152,7 +153,7 @@ static int wm8994_ldo2_get_voltage(struct regulator_dev *rdev) | |||
152 | } | 153 | } |
153 | 154 | ||
154 | static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev, | 155 | static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev, |
155 | int min_uV, int max_uV) | 156 | int min_uV, int max_uV, unsigned *s) |
156 | { | 157 | { |
157 | struct wm8994_ldo *ldo = rdev_get_drvdata(rdev); | 158 | struct wm8994_ldo *ldo = rdev_get_drvdata(rdev); |
158 | int selector, v; | 159 | int selector, v; |
@@ -162,6 +163,7 @@ static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev, | |||
162 | if (v < 0 || v > max_uV) | 163 | if (v < 0 || v > max_uV) |
163 | return -EINVAL; | 164 | return -EINVAL; |
164 | 165 | ||
166 | *s = selector; | ||
165 | selector <<= WM8994_LDO2_VSEL_SHIFT; | 167 | selector <<= WM8994_LDO2_VSEL_SHIFT; |
166 | 168 | ||
167 | return wm8994_set_bits(ldo->wm8994, WM8994_LDO_2, | 169 | return wm8994_set_bits(ldo->wm8994, WM8994_LDO_2, |