Commit 38f8f43c authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: twl: Convert twlsmps_ops to get_voltage_sel and map_voltage

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 78292f4e
...@@ -757,12 +757,11 @@ static int twl6030smps_list_voltage(struct regulator_dev *rdev, unsigned index) ...@@ -757,12 +757,11 @@ static int twl6030smps_list_voltage(struct regulator_dev *rdev, unsigned index)
return voltage; return voltage;
} }
static int static int twl6030smps_map_voltage(struct regulator_dev *rdev, int min_uV,
twl6030smps_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV, int max_uV)
unsigned int *selector)
{ {
struct twlreg_info *info = rdev_get_drvdata(rdev); struct twlreg_info *info = rdev_get_drvdata(rdev);
int vsel = 0, calc_uV; int vsel = 0;
switch (info->flags) { switch (info->flags) {
case 0: case 0:
...@@ -829,14 +828,16 @@ twl6030smps_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV, ...@@ -829,14 +828,16 @@ twl6030smps_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
break; break;
} }
calc_uV = twl6030smps_list_voltage(rdev, vsel); return vsel;
if (calc_uV > max_uV) }
return -EINVAL;
*selector = vsel; static int twl6030smps_set_voltage_sel(struct regulator_dev *rdev,
unsigned int selector)
{
struct twlreg_info *info = rdev_get_drvdata(rdev);
return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE_SMPS, return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE_SMPS,
vsel); selector);
} }
static int twl6030smps_get_voltage_sel(struct regulator_dev *rdev) static int twl6030smps_get_voltage_sel(struct regulator_dev *rdev)
...@@ -848,8 +849,9 @@ static int twl6030smps_get_voltage_sel(struct regulator_dev *rdev) ...@@ -848,8 +849,9 @@ static int twl6030smps_get_voltage_sel(struct regulator_dev *rdev)
static struct regulator_ops twlsmps_ops = { static struct regulator_ops twlsmps_ops = {
.list_voltage = twl6030smps_list_voltage, .list_voltage = twl6030smps_list_voltage,
.map_voltage = twl6030smps_map_voltage,
.set_voltage = twl6030smps_set_voltage, .set_voltage_sel = twl6030smps_set_voltage_sel,
.get_voltage_sel = twl6030smps_get_voltage_sel, .get_voltage_sel = twl6030smps_get_voltage_sel,
.enable = twl6030reg_enable, .enable = twl6030reg_enable,
......
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