aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/isl6271a-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/isl6271a-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/isl6271a-regulator.c')
-rw-r--r--drivers/regulator/isl6271a-regulator.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c
index b8cc6389a541..b5639e82fcc7 100644
--- a/drivers/regulator/isl6271a-regulator.c
+++ b/drivers/regulator/isl6271a-regulator.c
@@ -58,7 +58,9 @@ out:
58 return data; 58 return data;
59} 59}
60 60
61static int isl6271a_set_voltage(struct regulator_dev *dev, int minuV, int maxuV) 61static int isl6271a_set_voltage(struct regulator_dev *dev,
62 int minuV, int maxuV,
63 unsigned *selector)
62{ 64{
63 struct isl_pmic *pmic = rdev_get_drvdata(dev); 65 struct isl_pmic *pmic = rdev_get_drvdata(dev);
64 int vsel, err, data; 66 int vsel, err, data;
@@ -78,6 +80,8 @@ static int isl6271a_set_voltage(struct regulator_dev *dev, int minuV, int maxuV)
78 /* Convert the microvolts to data for the chip */ 80 /* Convert the microvolts to data for the chip */
79 data = (vsel - ISL6271A_VOLTAGE_MIN) / ISL6271A_VOLTAGE_STEP; 81 data = (vsel - ISL6271A_VOLTAGE_MIN) / ISL6271A_VOLTAGE_STEP;
80 82
83 *selector = data;
84
81 mutex_lock(&pmic->mtx); 85 mutex_lock(&pmic->mtx);
82 86
83 err = i2c_smbus_write_byte(pmic->client, data); 87 err = i2c_smbus_write_byte(pmic->client, data);