diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-09-06 04:48:13 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-09-06 06:14:47 -0400 |
commit | e260999c66768c2fccd9da8c3918b4e0e5121b3a (patch) | |
tree | 008282c9827755d9b2fb493422e00c8a4d3ae0d4 /drivers/regulator/wm831x-ldo.c | |
parent | 49990e6efe576b8707584398f93198b5aa182ab7 (diff) |
regulator: wm831x-ldo - fix the logic to set REGULATOR_MODE_IDLE and REGULATOR_MODE_STANDBY modes
Problem description in current implementation:
When setting REGULATOR_MODE_IDLE mode, current implementation set
WM831X_LDO1_LP_MODE bit of ctrl_reg (which is wrong, it should clear the bit).
But due to a missing break statement for case REGULATOR_MODE_IDLE, the code
fall through to case REGULATOR_MODE_STANDBY and then clear
WM831X_LDO1_LP_MODE bit. So it still looks OK when checking the status
by wm831x_gp_ldo_get_mode().
When setting REGULATOR_MODE_STANDBY mode, it just does not work.
wm831x_gp_ldo_get_mode() will still return REGULATOR_MODE_IDLE because
the accordingly WM831X_LDO1_LP_MODE bit is clear.
Correct behavior should be:
Clear WM831X_LDO1_LP_MODE bit of ctrl_reg for REGULATOR_MODE_IDLE mode.
Set WM831X_LDO1_LP_MODE bit of ctrl_reg for REGULATOR_MODE_STANDBY mode.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator/wm831x-ldo.c')
-rw-r--r-- | drivers/regulator/wm831x-ldo.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index e686cdb61b97..9edf8f692341 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c | |||
@@ -215,8 +215,7 @@ static int wm831x_gp_ldo_set_mode(struct regulator_dev *rdev, | |||
215 | 215 | ||
216 | case REGULATOR_MODE_IDLE: | 216 | case REGULATOR_MODE_IDLE: |
217 | ret = wm831x_set_bits(wm831x, ctrl_reg, | 217 | ret = wm831x_set_bits(wm831x, ctrl_reg, |
218 | WM831X_LDO1_LP_MODE, | 218 | WM831X_LDO1_LP_MODE, 0); |
219 | WM831X_LDO1_LP_MODE); | ||
220 | if (ret < 0) | 219 | if (ret < 0) |
221 | return ret; | 220 | return ret; |
222 | 221 | ||
@@ -225,10 +224,12 @@ static int wm831x_gp_ldo_set_mode(struct regulator_dev *rdev, | |||
225 | WM831X_LDO1_ON_MODE); | 224 | WM831X_LDO1_ON_MODE); |
226 | if (ret < 0) | 225 | if (ret < 0) |
227 | return ret; | 226 | return ret; |
227 | break; | ||
228 | 228 | ||
229 | case REGULATOR_MODE_STANDBY: | 229 | case REGULATOR_MODE_STANDBY: |
230 | ret = wm831x_set_bits(wm831x, ctrl_reg, | 230 | ret = wm831x_set_bits(wm831x, ctrl_reg, |
231 | WM831X_LDO1_LP_MODE, 0); | 231 | WM831X_LDO1_LP_MODE, |
232 | WM831X_LDO1_LP_MODE); | ||
232 | if (ret < 0) | 233 | if (ret < 0) |
233 | return ret; | 234 | return ret; |
234 | 235 | ||