diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-02-26 14:24:20 -0500 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2009-03-31 04:56:24 -0400 |
commit | 33f301af0c56971e3c0f4a4eb4b92f7e80230f49 (patch) | |
tree | 85235e51a9fc329e9cff8de9ac26cc053ac42a98 /drivers/regulator | |
parent | a308466c24b4f42bab6945026e938874d22cde50 (diff) |
regulator: Fix get_mode() for WM835x DCDCs
The WM835x regulators need a different register checking for force
mode on each DCDC. Previously the force mode status for DCDC1 was
checked.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/wm8350-regulator.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index 93e0ce5a5c23..261db94e0e7b 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c | |||
@@ -1031,18 +1031,30 @@ static unsigned int wm8350_dcdc_get_mode(struct regulator_dev *rdev) | |||
1031 | int dcdc = rdev_get_id(rdev); | 1031 | int dcdc = rdev_get_id(rdev); |
1032 | u16 mask, sleep, active, force; | 1032 | u16 mask, sleep, active, force; |
1033 | int mode = REGULATOR_MODE_NORMAL; | 1033 | int mode = REGULATOR_MODE_NORMAL; |
1034 | int reg; | ||
1034 | 1035 | ||
1035 | if (dcdc < WM8350_DCDC_1 || dcdc > WM8350_DCDC_6) | 1036 | switch (dcdc) { |
1036 | return -EINVAL; | 1037 | case WM8350_DCDC_1: |
1037 | 1038 | reg = WM8350_DCDC1_FORCE_PWM; | |
1038 | if (dcdc == WM8350_DCDC_2 || dcdc == WM8350_DCDC_5) | 1039 | break; |
1040 | case WM8350_DCDC_3: | ||
1041 | reg = WM8350_DCDC3_FORCE_PWM; | ||
1042 | break; | ||
1043 | case WM8350_DCDC_4: | ||
1044 | reg = WM8350_DCDC4_FORCE_PWM; | ||
1045 | break; | ||
1046 | case WM8350_DCDC_6: | ||
1047 | reg = WM8350_DCDC6_FORCE_PWM; | ||
1048 | break; | ||
1049 | default: | ||
1039 | return -EINVAL; | 1050 | return -EINVAL; |
1051 | } | ||
1040 | 1052 | ||
1041 | mask = 1 << (dcdc - WM8350_DCDC_1); | 1053 | mask = 1 << (dcdc - WM8350_DCDC_1); |
1042 | active = wm8350_reg_read(wm8350, WM8350_DCDC_ACTIVE_OPTIONS) & mask; | 1054 | active = wm8350_reg_read(wm8350, WM8350_DCDC_ACTIVE_OPTIONS) & mask; |
1055 | force = wm8350_reg_read(wm8350, reg) & WM8350_DCDC1_FORCE_PWM_ENA; | ||
1043 | sleep = wm8350_reg_read(wm8350, WM8350_DCDC_SLEEP_OPTIONS) & mask; | 1056 | sleep = wm8350_reg_read(wm8350, WM8350_DCDC_SLEEP_OPTIONS) & mask; |
1044 | force = wm8350_reg_read(wm8350, WM8350_DCDC1_FORCE_PWM) | 1057 | |
1045 | & WM8350_DCDC1_FORCE_PWM_ENA; | ||
1046 | dev_dbg(wm8350->dev, "mask %x active %x sleep %x force %x", | 1058 | dev_dbg(wm8350->dev, "mask %x active %x sleep %x force %x", |
1047 | mask, active, sleep, force); | 1059 | mask, active, sleep, force); |
1048 | 1060 | ||