Commit 33426e97 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: Use tps65912_get_voltage for both DCDCs and LDOs

Now tps65912_get_voltage_dcdc and tps65912_get_voltage_ldo has exactly the same
implementation. We can merge them to tps65912_get_voltage function.
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent f72d643e
...@@ -406,7 +406,7 @@ static int tps65912_list_voltage(struct regulator_dev *dev, unsigned selector) ...@@ -406,7 +406,7 @@ static int tps65912_list_voltage(struct regulator_dev *dev, unsigned selector)
return voltage; return voltage;
} }
static int tps65912_get_voltage_dcdc(struct regulator_dev *dev) static int tps65912_get_voltage(struct regulator_dev *dev)
{ {
struct tps65912_reg *pmic = rdev_get_drvdata(dev); struct tps65912_reg *pmic = rdev_get_drvdata(dev);
struct tps65912 *mfd = pmic->mfd; struct tps65912 *mfd = pmic->mfd;
...@@ -438,21 +438,6 @@ static int tps65912_set_voltage_sel(struct regulator_dev *dev, ...@@ -438,21 +438,6 @@ static int tps65912_set_voltage_sel(struct regulator_dev *dev,
return tps65912_reg_write(mfd, reg, selector | value); return tps65912_reg_write(mfd, reg, selector | value);
} }
static int tps65912_get_voltage_ldo(struct regulator_dev *dev)
{
struct tps65912_reg *pmic = rdev_get_drvdata(dev);
struct tps65912 *mfd = pmic->mfd;
int id = rdev_get_id(dev);
int vsel = 0;
u8 reg;
reg = tps65912_get_sel_register(pmic, id);
vsel = tps65912_reg_read(mfd, reg);
vsel &= 0x3F;
return tps65912_vsel_to_uv_ldo(vsel);
}
/* Operations permitted on DCDCx */ /* Operations permitted on DCDCx */
static struct regulator_ops tps65912_ops_dcdc = { static struct regulator_ops tps65912_ops_dcdc = {
.is_enabled = tps65912_reg_is_enabled, .is_enabled = tps65912_reg_is_enabled,
...@@ -460,7 +445,7 @@ static struct regulator_ops tps65912_ops_dcdc = { ...@@ -460,7 +445,7 @@ static struct regulator_ops tps65912_ops_dcdc = {
.disable = tps65912_reg_disable, .disable = tps65912_reg_disable,
.set_mode = tps65912_set_mode, .set_mode = tps65912_set_mode,
.get_mode = tps65912_get_mode, .get_mode = tps65912_get_mode,
.get_voltage = tps65912_get_voltage_dcdc, .get_voltage = tps65912_get_voltage,
.set_voltage_sel = tps65912_set_voltage_sel, .set_voltage_sel = tps65912_set_voltage_sel,
.list_voltage = tps65912_list_voltage, .list_voltage = tps65912_list_voltage,
}; };
...@@ -470,7 +455,7 @@ static struct regulator_ops tps65912_ops_ldo = { ...@@ -470,7 +455,7 @@ static struct regulator_ops tps65912_ops_ldo = {
.is_enabled = tps65912_reg_is_enabled, .is_enabled = tps65912_reg_is_enabled,
.enable = tps65912_reg_enable, .enable = tps65912_reg_enable,
.disable = tps65912_reg_disable, .disable = tps65912_reg_disable,
.get_voltage = tps65912_get_voltage_ldo, .get_voltage = tps65912_get_voltage,
.set_voltage_sel = tps65912_set_voltage_sel, .set_voltage_sel = tps65912_set_voltage_sel,
.list_voltage = tps65912_list_voltage, .list_voltage = tps65912_list_voltage,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment