[PATCH 6/9] regulator: hi6421: move to set_optimum_mode

From: Bjorn Andersson
Date: Tue Jan 27 2015 - 21:47:58 EST


Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxxxxxx>
---
drivers/regulator/hi6421-regulator.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/hi6421-regulator.c b/drivers/regulator/hi6421-regulator.c
index 42dc5fb..42b362d 100644
--- a/drivers/regulator/hi6421-regulator.c
+++ b/drivers/regulator/hi6421-regulator.c
@@ -477,15 +477,18 @@ static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev,
return 0;
}

-unsigned int hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev,
+static int hi6421_regulator_ldo_set_optimum_mode(struct regulator_dev *rdev,
int input_uV, int output_uV, int load_uA)
{
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
+ unsigned int mode;

if (load_uA > info->eco_microamp)
- return REGULATOR_MODE_NORMAL;
+ mode = REGULATOR_MODE_NORMAL;
+ else
+ mode = REGULATOR_MODE_IDLE;

- return REGULATOR_MODE_IDLE;
+ return hi6421_regulator_ldo_set_mode(rdev, mode);
}

static const struct regulator_ops hi6421_ldo_ops = {
@@ -498,7 +501,7 @@ static const struct regulator_ops hi6421_ldo_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_mode = hi6421_regulator_ldo_get_mode,
.set_mode = hi6421_regulator_ldo_set_mode,
- .get_optimum_mode = hi6421_regulator_ldo_get_optimum_mode,
+ .set_optimum_mode = hi6421_regulator_ldo_set_optimum_mode,
};

static const struct regulator_ops hi6421_ldo_linear_ops = {
@@ -511,7 +514,7 @@ static const struct regulator_ops hi6421_ldo_linear_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_mode = hi6421_regulator_ldo_get_mode,
.set_mode = hi6421_regulator_ldo_set_mode,
- .get_optimum_mode = hi6421_regulator_ldo_get_optimum_mode,
+ .set_optimum_mode = hi6421_regulator_ldo_set_optimum_mode,
};

static const struct regulator_ops hi6421_ldo_linear_range_ops = {
@@ -524,7 +527,7 @@ static const struct regulator_ops hi6421_ldo_linear_range_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_mode = hi6421_regulator_ldo_get_mode,
.set_mode = hi6421_regulator_ldo_set_mode,
- .get_optimum_mode = hi6421_regulator_ldo_get_optimum_mode,
+ .set_optimum_mode = hi6421_regulator_ldo_set_optimum_mode,
};

static const struct regulator_ops hi6421_buck012_ops = {
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/