Commit 1f793ff2 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: Convert ab3100 to set_voltage_sel

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Tested-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent ae713d39
...@@ -338,20 +338,12 @@ static int ab3100_get_best_voltage_index(struct regulator_dev *reg, ...@@ -338,20 +338,12 @@ static int ab3100_get_best_voltage_index(struct regulator_dev *reg,
return bestindex; return bestindex;
} }
static int ab3100_set_voltage_regulator(struct regulator_dev *reg, static int ab3100_set_voltage_regulator_sel(struct regulator_dev *reg,
int min_uV, int max_uV, unsigned selector)
unsigned *selector)
{ {
struct ab3100_regulator *abreg = reg->reg_data; struct ab3100_regulator *abreg = reg->reg_data;
u8 regval; u8 regval;
int err; int err;
int bestindex;
bestindex = ab3100_get_best_voltage_index(reg, min_uV, max_uV);
if (bestindex < 0)
return bestindex;
*selector = bestindex;
err = abx500_get_register_interruptible(abreg->dev, 0, err = abx500_get_register_interruptible(abreg->dev, 0,
abreg->regreg, &regval); abreg->regreg, &regval);
...@@ -364,7 +356,7 @@ static int ab3100_set_voltage_regulator(struct regulator_dev *reg, ...@@ -364,7 +356,7 @@ static int ab3100_set_voltage_regulator(struct regulator_dev *reg,
/* The highest three bits control the variable regulators */ /* The highest three bits control the variable regulators */
regval &= ~0xE0; regval &= ~0xE0;
regval |= (bestindex << 5); regval |= (selector << 5);
err = abx500_set_register_interruptible(abreg->dev, 0, err = abx500_set_register_interruptible(abreg->dev, 0,
abreg->regreg, regval); abreg->regreg, regval);
...@@ -464,7 +456,7 @@ static struct regulator_ops regulator_ops_variable = { ...@@ -464,7 +456,7 @@ static struct regulator_ops regulator_ops_variable = {
.disable = ab3100_disable_regulator, .disable = ab3100_disable_regulator,
.is_enabled = ab3100_is_enabled_regulator, .is_enabled = ab3100_is_enabled_regulator,
.get_voltage = ab3100_get_voltage_regulator, .get_voltage = ab3100_get_voltage_regulator,
.set_voltage = ab3100_set_voltage_regulator, .set_voltage_sel = ab3100_set_voltage_regulator_sel,
.list_voltage = ab3100_list_voltage_regulator, .list_voltage = ab3100_list_voltage_regulator,
.enable_time = ab3100_enable_time_regulator, .enable_time = ab3100_enable_time_regulator,
}; };
...@@ -474,7 +466,7 @@ static struct regulator_ops regulator_ops_variable_sleepable = { ...@@ -474,7 +466,7 @@ static struct regulator_ops regulator_ops_variable_sleepable = {
.disable = ab3100_disable_regulator, .disable = ab3100_disable_regulator,
.is_enabled = ab3100_is_enabled_regulator, .is_enabled = ab3100_is_enabled_regulator,
.get_voltage = ab3100_get_voltage_regulator, .get_voltage = ab3100_get_voltage_regulator,
.set_voltage = ab3100_set_voltage_regulator, .set_voltage_sel = ab3100_set_voltage_regulator_sel,
.set_suspend_voltage = ab3100_set_suspend_voltage_regulator, .set_suspend_voltage = ab3100_set_suspend_voltage_regulator,
.list_voltage = ab3100_list_voltage_regulator, .list_voltage = ab3100_list_voltage_regulator,
.enable_time = ab3100_enable_time_regulator, .enable_time = ab3100_enable_time_regulator,
......
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