Commit b5366e5e authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: lp8788: Implement list_voltage for lp8788_ldo_voltage_fixed_ops

For fixed voltage, we can just set min_uV and use regulator_list_voltage_linear
for list_voltage callback. Regulator core will call list_voltage(rdev, 0) if
both get_voltage get_voltage_sel are not implemented. Thus we can also remove
lp8788_ldo_fixed_get_voltage() function.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatarMilo Kim <milo.kim@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 80abd60d
...@@ -170,23 +170,6 @@ static int lp8788_ldo_enable_time(struct regulator_dev *rdev) ...@@ -170,23 +170,6 @@ static int lp8788_ldo_enable_time(struct regulator_dev *rdev)
return ENABLE_TIME_USEC * val; return ENABLE_TIME_USEC * val;
} }
static int lp8788_ldo_fixed_get_voltage(struct regulator_dev *rdev)
{
enum lp8788_ldo_id id = rdev_get_id(rdev);
switch (id) {
case ALDO2 ... ALDO5:
return 2850000;
case DLDO12:
case ALDO8 ... ALDO9:
return 2500000;
case ALDO10:
return 1100000;
default:
return -EINVAL;
}
}
static struct regulator_ops lp8788_ldo_voltage_table_ops = { static struct regulator_ops lp8788_ldo_voltage_table_ops = {
.list_voltage = regulator_list_voltage_table, .list_voltage = regulator_list_voltage_table,
.set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
...@@ -198,7 +181,7 @@ static struct regulator_ops lp8788_ldo_voltage_table_ops = { ...@@ -198,7 +181,7 @@ static struct regulator_ops lp8788_ldo_voltage_table_ops = {
}; };
static struct regulator_ops lp8788_ldo_voltage_fixed_ops = { static struct regulator_ops lp8788_ldo_voltage_fixed_ops = {
.get_voltage = lp8788_ldo_fixed_get_voltage, .list_voltage = regulator_list_voltage_linear,
.enable = regulator_enable_regmap, .enable = regulator_enable_regmap,
.disable = regulator_disable_regmap, .disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap, .is_enabled = regulator_is_enabled_regmap,
...@@ -358,6 +341,7 @@ static struct regulator_desc lp8788_dldo_desc[] = { ...@@ -358,6 +341,7 @@ static struct regulator_desc lp8788_dldo_desc[] = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.enable_reg = LP8788_EN_LDO_B, .enable_reg = LP8788_EN_LDO_B,
.enable_mask = LP8788_EN_DLDO12_M, .enable_mask = LP8788_EN_DLDO12_M,
.min_uV = 2500000,
}, },
}; };
...@@ -384,6 +368,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { ...@@ -384,6 +368,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.enable_reg = LP8788_EN_LDO_B, .enable_reg = LP8788_EN_LDO_B,
.enable_mask = LP8788_EN_ALDO2_M, .enable_mask = LP8788_EN_ALDO2_M,
.min_uV = 2850000,
}, },
{ {
.name = "aldo3", .name = "aldo3",
...@@ -394,6 +379,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { ...@@ -394,6 +379,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.enable_reg = LP8788_EN_LDO_B, .enable_reg = LP8788_EN_LDO_B,
.enable_mask = LP8788_EN_ALDO3_M, .enable_mask = LP8788_EN_ALDO3_M,
.min_uV = 2850000,
}, },
{ {
.name = "aldo4", .name = "aldo4",
...@@ -404,6 +390,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { ...@@ -404,6 +390,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.enable_reg = LP8788_EN_LDO_B, .enable_reg = LP8788_EN_LDO_B,
.enable_mask = LP8788_EN_ALDO4_M, .enable_mask = LP8788_EN_ALDO4_M,
.min_uV = 2850000,
}, },
{ {
.name = "aldo5", .name = "aldo5",
...@@ -414,6 +401,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { ...@@ -414,6 +401,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.enable_reg = LP8788_EN_LDO_C, .enable_reg = LP8788_EN_LDO_C,
.enable_mask = LP8788_EN_ALDO5_M, .enable_mask = LP8788_EN_ALDO5_M,
.min_uV = 2850000,
}, },
{ {
.name = "aldo6", .name = "aldo6",
...@@ -450,6 +438,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { ...@@ -450,6 +438,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.enable_reg = LP8788_EN_LDO_C, .enable_reg = LP8788_EN_LDO_C,
.enable_mask = LP8788_EN_ALDO8_M, .enable_mask = LP8788_EN_ALDO8_M,
.min_uV = 2500000,
}, },
{ {
.name = "aldo9", .name = "aldo9",
...@@ -460,6 +449,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { ...@@ -460,6 +449,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.enable_reg = LP8788_EN_LDO_C, .enable_reg = LP8788_EN_LDO_C,
.enable_mask = LP8788_EN_ALDO9_M, .enable_mask = LP8788_EN_ALDO9_M,
.min_uV = 2500000,
}, },
{ {
.name = "aldo10", .name = "aldo10",
...@@ -470,6 +460,7 @@ static struct regulator_desc lp8788_aldo_desc[] = { ...@@ -470,6 +460,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.enable_reg = LP8788_EN_LDO_C, .enable_reg = LP8788_EN_LDO_C,
.enable_mask = LP8788_EN_ALDO10_M, .enable_mask = LP8788_EN_ALDO10_M,
.min_uV = 1100000,
}, },
}; };
......
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