summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/tps65912-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-03-15 17:17:36 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-01 11:59:25 +0100
commitf72d643e87581cbee49f39c1fd8268b1a9252b80 (patch)
treeeed628595cab77fb2dc0469d2996dc6f6f946a2a /drivers/regulator/tps65912-regulator.c
parentc8237f01db63b458c34222d07f66c5417cfd866b (diff)
downloadblackbird-op-linux-f72d643e87581cbee49f39c1fd8268b1a9252b80.tar.gz
blackbird-op-linux-f72d643e87581cbee49f39c1fd8268b1a9252b80.zip
regulator: Implement tps65912_list_voltage to be shared by both DCDCs and LDOs
Merge tps65912_list_voltage_dcdc and tps65912_list_voltage_ldo to tps65912_list_voltage. This change does not add too much complexity in tps65912_list_voltage function. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/tps65912-regulator.c')
-rw-r--r--drivers/regulator/tps65912-regulator.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/regulator/tps65912-regulator.c b/drivers/regulator/tps65912-regulator.c
index b36799b1f530..46f3c6160fda 100644
--- a/drivers/regulator/tps65912-regulator.c
+++ b/drivers/regulator/tps65912-regulator.c
@@ -372,12 +372,14 @@ static unsigned int tps65912_get_mode(struct regulator_dev *dev)
return mode;
}
-static int tps65912_list_voltage_dcdc(struct regulator_dev *dev,
- unsigned selector)
+static int tps65912_list_voltage(struct regulator_dev *dev, unsigned selector)
{
struct tps65912_reg *pmic = rdev_get_drvdata(dev);
int range, voltage = 0, id = rdev_get_id(dev);
+ if (id >= TPS65912_REG_LDO1 && id <= TPS65912_REG_LDO10)
+ return tps65912_vsel_to_uv_ldo(selector);
+
if (id > TPS65912_REG_DCDC4)
return -EINVAL;
@@ -418,7 +420,7 @@ static int tps65912_get_voltage_dcdc(struct regulator_dev *dev)
vsel = tps65912_reg_read(mfd, reg);
vsel &= 0x3F;
- return tps65912_list_voltage_dcdc(dev, vsel);
+ return tps65912_list_voltage(dev, vsel);
}
static int tps65912_set_voltage_sel(struct regulator_dev *dev,
@@ -451,17 +453,6 @@ static int tps65912_get_voltage_ldo(struct regulator_dev *dev)
return tps65912_vsel_to_uv_ldo(vsel);
}
-static int tps65912_list_voltage_ldo(struct regulator_dev *dev,
- unsigned selector)
-{
- int ldo = rdev_get_id(dev);
-
- if (ldo < TPS65912_REG_LDO1 || ldo > TPS65912_REG_LDO10)
- return -EINVAL;
-
- return tps65912_vsel_to_uv_ldo(selector);
-}
-
/* Operations permitted on DCDCx */
static struct regulator_ops tps65912_ops_dcdc = {
.is_enabled = tps65912_reg_is_enabled,
@@ -471,7 +462,7 @@ static struct regulator_ops tps65912_ops_dcdc = {
.get_mode = tps65912_get_mode,
.get_voltage = tps65912_get_voltage_dcdc,
.set_voltage_sel = tps65912_set_voltage_sel,
- .list_voltage = tps65912_list_voltage_dcdc,
+ .list_voltage = tps65912_list_voltage,
};
/* Operations permitted on LDOx */
@@ -481,7 +472,7 @@ static struct regulator_ops tps65912_ops_ldo = {
.disable = tps65912_reg_disable,
.get_voltage = tps65912_get_voltage_ldo,
.set_voltage_sel = tps65912_set_voltage_sel,
- .list_voltage = tps65912_list_voltage_ldo,
+ .list_voltage = tps65912_list_voltage,
};
static __devinit int tps65912_probe(struct platform_device *pdev)
OpenPOWER on IntegriCloud