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/wm8350-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/wm8350-regulator.c')
-rw-r--r-- | drivers/regulator/wm8350-regulator.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index fe4b8a8a9dfd..7e45b0ddd710 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c | |||
@@ -360,7 +360,7 @@ int wm8350_isink_set_flash(struct wm8350 *wm8350, int isink, u16 mode, | |||
360 | EXPORT_SYMBOL_GPL(wm8350_isink_set_flash); | 360 | EXPORT_SYMBOL_GPL(wm8350_isink_set_flash); |
361 | 361 | ||
362 | static int wm8350_dcdc_set_voltage(struct regulator_dev *rdev, int min_uV, | 362 | static int wm8350_dcdc_set_voltage(struct regulator_dev *rdev, int min_uV, |
363 | int max_uV) | 363 | int max_uV, unsigned *selector) |
364 | { | 364 | { |
365 | struct wm8350 *wm8350 = rdev_get_drvdata(rdev); | 365 | struct wm8350 *wm8350 = rdev_get_drvdata(rdev); |
366 | int volt_reg, dcdc = rdev_get_id(rdev), mV, | 366 | int volt_reg, dcdc = rdev_get_id(rdev), mV, |
@@ -397,6 +397,8 @@ static int wm8350_dcdc_set_voltage(struct regulator_dev *rdev, int min_uV, | |||
397 | return -EINVAL; | 397 | return -EINVAL; |
398 | } | 398 | } |
399 | 399 | ||
400 | *selector = mV; | ||
401 | |||
400 | /* all DCDCs have same mV bits */ | 402 | /* all DCDCs have same mV bits */ |
401 | val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_DC1_VSEL_MASK; | 403 | val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_DC1_VSEL_MASK; |
402 | wm8350_reg_write(wm8350, volt_reg, val | mV); | 404 | wm8350_reg_write(wm8350, volt_reg, val | mV); |
@@ -754,7 +756,7 @@ static int wm8350_ldo_set_suspend_disable(struct regulator_dev *rdev) | |||
754 | } | 756 | } |
755 | 757 | ||
756 | static int wm8350_ldo_set_voltage(struct regulator_dev *rdev, int min_uV, | 758 | static int wm8350_ldo_set_voltage(struct regulator_dev *rdev, int min_uV, |
757 | int max_uV) | 759 | int max_uV, unsigned *selector) |
758 | { | 760 | { |
759 | struct wm8350 *wm8350 = rdev_get_drvdata(rdev); | 761 | struct wm8350 *wm8350 = rdev_get_drvdata(rdev); |
760 | int volt_reg, ldo = rdev_get_id(rdev), mV, min_mV = min_uV / 1000, | 762 | int volt_reg, ldo = rdev_get_id(rdev), mV, min_mV = min_uV / 1000, |
@@ -797,6 +799,8 @@ static int wm8350_ldo_set_voltage(struct regulator_dev *rdev, int min_uV, | |||
797 | return -EINVAL; | 799 | return -EINVAL; |
798 | } | 800 | } |
799 | 801 | ||
802 | *selector = mV; | ||
803 | |||
800 | /* all LDOs have same mV bits */ | 804 | /* all LDOs have same mV bits */ |
801 | val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_LDO1_VSEL_MASK; | 805 | val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_LDO1_VSEL_MASK; |
802 | wm8350_reg_write(wm8350, volt_reg, val | mV); | 806 | wm8350_reg_write(wm8350, volt_reg, val | mV); |