aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/mc13783-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/mc13783-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/mc13783-regulator.c')
-rw-r--r--drivers/regulator/mc13783-regulator.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
index ecd99f59dba8..47ea99949798 100644
--- a/drivers/regulator/mc13783-regulator.c
+++ b/drivers/regulator/mc13783-regulator.c
@@ -373,7 +373,8 @@ static int mc13783_get_best_voltage_index(struct regulator_dev *rdev,
373} 373}
374 374
375static int mc13783_regulator_set_voltage(struct regulator_dev *rdev, 375static int mc13783_regulator_set_voltage(struct regulator_dev *rdev,
376 int min_uV, int max_uV) 376 int min_uV, int max_uV,
377 unsigned *selector)
377{ 378{
378 struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev); 379 struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
379 int value, id = rdev_get_id(rdev); 380 int value, id = rdev_get_id(rdev);
@@ -388,6 +389,8 @@ static int mc13783_regulator_set_voltage(struct regulator_dev *rdev,
388 if (value < 0) 389 if (value < 0)
389 return value; 390 return value;
390 391
392 *selector = value;
393
391 mc13783_lock(priv->mc13783); 394 mc13783_lock(priv->mc13783);
392 ret = mc13783_reg_rmw(priv->mc13783, mc13783_regulators[id].vsel_reg, 395 ret = mc13783_reg_rmw(priv->mc13783, mc13783_regulators[id].vsel_reg,
393 mc13783_regulators[id].vsel_mask, 396 mc13783_regulators[id].vsel_mask,
@@ -433,13 +436,16 @@ static struct regulator_ops mc13783_regulator_ops = {
433}; 436};
434 437
435static int mc13783_fixed_regulator_set_voltage(struct regulator_dev *rdev, 438static int mc13783_fixed_regulator_set_voltage(struct regulator_dev *rdev,
436 int min_uV, int max_uV) 439 int min_uV, int max_uV,
440 unsigned int *selector)
437{ 441{
438 int id = rdev_get_id(rdev); 442 int id = rdev_get_id(rdev);
439 443
440 dev_dbg(rdev_get_dev(rdev), "%s id: %d min_uV: %d max_uV: %d\n", 444 dev_dbg(rdev_get_dev(rdev), "%s id: %d min_uV: %d max_uV: %d\n",
441 __func__, id, min_uV, max_uV); 445 __func__, id, min_uV, max_uV);
442 446
447 *selector = 0;
448
443 if (min_uV >= mc13783_regulators[id].voltages[0] && 449 if (min_uV >= mc13783_regulators[id].voltages[0] &&
444 max_uV <= mc13783_regulators[id].voltages[0]) 450 max_uV <= mc13783_regulators[id].voltages[0])
445 return 0; 451 return 0;