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/tps65023-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/tps65023-regulator.c')
-rw-r--r-- | drivers/regulator/tps65023-regulator.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c index cd6d4fc9d74f..60a7ca5409e9 100644 --- a/drivers/regulator/tps65023-regulator.c +++ b/drivers/regulator/tps65023-regulator.c | |||
@@ -321,7 +321,8 @@ static int tps65023_dcdc_get_voltage(struct regulator_dev *dev) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | static int tps65023_dcdc_set_voltage(struct regulator_dev *dev, | 323 | static int tps65023_dcdc_set_voltage(struct regulator_dev *dev, |
324 | int min_uV, int max_uV) | 324 | int min_uV, int max_uV, |
325 | unsigned *selector) | ||
325 | { | 326 | { |
326 | struct tps_pmic *tps = rdev_get_drvdata(dev); | 327 | struct tps_pmic *tps = rdev_get_drvdata(dev); |
327 | int dcdc = rdev_get_id(dev); | 328 | int dcdc = rdev_get_id(dev); |
@@ -346,6 +347,8 @@ static int tps65023_dcdc_set_voltage(struct regulator_dev *dev, | |||
346 | break; | 347 | break; |
347 | } | 348 | } |
348 | 349 | ||
350 | *selector = vsel; | ||
351 | |||
349 | /* write to the register in case we found a match */ | 352 | /* write to the register in case we found a match */ |
350 | if (vsel == tps->info[dcdc]->table_len) | 353 | if (vsel == tps->info[dcdc]->table_len) |
351 | return -EINVAL; | 354 | return -EINVAL; |
@@ -371,7 +374,7 @@ static int tps65023_ldo_get_voltage(struct regulator_dev *dev) | |||
371 | } | 374 | } |
372 | 375 | ||
373 | static int tps65023_ldo_set_voltage(struct regulator_dev *dev, | 376 | static int tps65023_ldo_set_voltage(struct regulator_dev *dev, |
374 | int min_uV, int max_uV) | 377 | int min_uV, int max_uV, unsigned *selector) |
375 | { | 378 | { |
376 | struct tps_pmic *tps = rdev_get_drvdata(dev); | 379 | struct tps_pmic *tps = rdev_get_drvdata(dev); |
377 | int data, vsel, ldo = rdev_get_id(dev); | 380 | int data, vsel, ldo = rdev_get_id(dev); |
@@ -396,6 +399,8 @@ static int tps65023_ldo_set_voltage(struct regulator_dev *dev, | |||
396 | if (vsel == tps->info[ldo]->table_len) | 399 | if (vsel == tps->info[ldo]->table_len) |
397 | return -EINVAL; | 400 | return -EINVAL; |
398 | 401 | ||
402 | *selector = vsel; | ||
403 | |||
399 | data = tps_65023_reg_read(tps, TPS65023_REG_LDO_CTRL); | 404 | data = tps_65023_reg_read(tps, TPS65023_REG_LDO_CTRL); |
400 | if (data < 0) | 405 | if (data < 0) |
401 | return data; | 406 | return data; |