aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/tps6524x-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-03-28 07:45:43 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-01 06:59:36 -0400
commitf8ee33936f07d49b8e902920e7a5950ac2118d6a (patch)
tree9db032193bf351c32e19dad053fbd0a5747589b7 /drivers/regulator/tps6524x-regulator.c
parent0df8c96fa1c1adb23c49124685dde77b6560bef2 (diff)
regulator: Convert tps6524x to set_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/tps6524x-regulator.c')
-rw-r--r--drivers/regulator/tps6524x-regulator.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c
index 4a421be6d4f2..3a4a1d550db0 100644
--- a/drivers/regulator/tps6524x-regulator.c
+++ b/drivers/regulator/tps6524x-regulator.c
@@ -458,12 +458,10 @@ static int list_voltage(struct regulator_dev *rdev, unsigned selector)
458 info->voltages[selector] : -EINVAL); 458 info->voltages[selector] : -EINVAL);
459} 459}
460 460
461static int set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV, 461static int set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
462 unsigned *selector)
463{ 462{
464 const struct supply_info *info; 463 const struct supply_info *info;
465 struct tps6524x *hw; 464 struct tps6524x *hw;
466 unsigned i;
467 465
468 hw = rdev_get_drvdata(rdev); 466 hw = rdev_get_drvdata(rdev);
469 info = &supply_info[rdev_get_id(rdev)]; 467 info = &supply_info[rdev_get_id(rdev)];
@@ -471,17 +469,7 @@ static int set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
471 if (info->flags & FIXED_VOLTAGE) 469 if (info->flags & FIXED_VOLTAGE)
472 return -EINVAL; 470 return -EINVAL;
473 471
474 for (i = 0; i < info->n_voltages; i++) 472 return write_field(hw, &info->voltage, selector);
475 if (min_uV <= info->voltages[i] &&
476 max_uV >= info->voltages[i])
477 break;
478
479 if (i >= info->n_voltages)
480 i = info->n_voltages - 1;
481
482 *selector = i;
483
484 return write_field(hw, &info->voltage, i);
485} 473}
486 474
487static int get_voltage(struct regulator_dev *rdev) 475static int get_voltage(struct regulator_dev *rdev)
@@ -588,7 +576,7 @@ static struct regulator_ops regulator_ops = {
588 .enable = enable_supply, 576 .enable = enable_supply,
589 .disable = disable_supply, 577 .disable = disable_supply,
590 .get_voltage = get_voltage, 578 .get_voltage = get_voltage,
591 .set_voltage = set_voltage, 579 .set_voltage_sel = set_voltage_sel,
592 .list_voltage = list_voltage, 580 .list_voltage = list_voltage,
593 .set_current_limit = set_current_limit, 581 .set_current_limit = set_current_limit,
594 .get_current_limit = get_current_limit, 582 .get_current_limit = get_current_limit,