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/max8952.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/max8952.c')
-rw-r--r-- | drivers/regulator/max8952.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index 0d5dda4fd911..a8f4ecfb0843 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c | |||
@@ -133,7 +133,7 @@ static int max8952_get_voltage(struct regulator_dev *rdev) | |||
133 | } | 133 | } |
134 | 134 | ||
135 | static int max8952_set_voltage(struct regulator_dev *rdev, | 135 | static int max8952_set_voltage(struct regulator_dev *rdev, |
136 | int min_uV, int max_uV) | 136 | int min_uV, int max_uV, unsigned *selector) |
137 | { | 137 | { |
138 | struct max8952_data *max8952 = rdev_get_drvdata(rdev); | 138 | struct max8952_data *max8952 = rdev_get_drvdata(rdev); |
139 | s8 vid = -1, i; | 139 | s8 vid = -1, i; |
@@ -156,6 +156,7 @@ static int max8952_set_voltage(struct regulator_dev *rdev, | |||
156 | if (vid >= 0 && vid < MAX8952_NUM_DVS_MODE) { | 156 | if (vid >= 0 && vid < MAX8952_NUM_DVS_MODE) { |
157 | max8952->vid0 = (vid % 2 == 1); | 157 | max8952->vid0 = (vid % 2 == 1); |
158 | max8952->vid1 = (((vid >> 1) % 2) == 1); | 158 | max8952->vid1 = (((vid >> 1) % 2) == 1); |
159 | *selector = vid; | ||
159 | gpio_set_value(max8952->pdata->gpio_vid0, max8952->vid0); | 160 | gpio_set_value(max8952->pdata->gpio_vid0, max8952->vid0); |
160 | gpio_set_value(max8952->pdata->gpio_vid1, max8952->vid1); | 161 | gpio_set_value(max8952->pdata->gpio_vid1, max8952->vid1); |
161 | } else | 162 | } else |