Signed-off-by: Bjorn Andersson <bjorn.anders...@sonymobile.com>
---
 drivers/regulator/wm831x-ldo.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index 7ae2dc8..40d391e 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -186,15 +186,20 @@ static int wm831x_gp_ldo_get_status(struct regulator_dev 
*rdev)
                return regulator_mode_to_status(ret);
 }
 
-static unsigned int wm831x_gp_ldo_get_optimum_mode(struct regulator_dev *rdev,
-                                                  int input_uV,
-                                                  int output_uV, int load_uA)
+static int wm831x_gp_ldo_set_optimum_mode(struct regulator_dev *rdev,
+                                         int input_uV,
+                                         int output_uV, int load_uA)
 {
+       unsigned int mode;
+
        if (load_uA < 20000)
-               return REGULATOR_MODE_STANDBY;
-       if (load_uA < 50000)
-               return REGULATOR_MODE_IDLE;
-       return REGULATOR_MODE_NORMAL;
+               mode = REGULATOR_MODE_STANDBY;
+       else if (load_uA < 50000)
+               mode = REGULATOR_MODE_IDLE;
+       else
+               mode = REGULATOR_MODE_NORMAL;
+
+       return wm831x_gp_ldo_set_mode(rdev, mode);
 }
 
 
@@ -207,7 +212,7 @@ static struct regulator_ops wm831x_gp_ldo_ops = {
        .get_mode = wm831x_gp_ldo_get_mode,
        .set_mode = wm831x_gp_ldo_set_mode,
        .get_status = wm831x_gp_ldo_get_status,
-       .get_optimum_mode = wm831x_gp_ldo_get_optimum_mode,
+       .set_optimum_mode = wm831x_gp_ldo_set_optimum_mode,
        .get_bypass = regulator_get_bypass_regmap,
        .set_bypass = regulator_set_bypass_regmap,
 
-- 
1.9.1

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

Reply via email to