regulator: mc13892: Fix MC13892_SWITCHERS0_SWxHI bit in set_voltage_sel
authorAxel Lin <axel.lin@ingics.com>
Wed, 24 Apr 2013 03:51:12 +0000 (11:51 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 25 Apr 2013 10:48:14 +0000 (11:48 +0100)
It is necessary to clear MC13892_SWITCHERS0_SWxHI bit when set voltage to the
voltage range from 1100000 to 1375000. Leaving MC13892_SWITCHERS0_SWxHI bit
untouched may result in wrong voltage setting.

For example, currently switch voltage from 1400000 to 1300000 will set the
voltage to 1800000 because the HI bit is still set.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/mc13892-regulator.c

index 9891aec..cc76c52 100644 (file)
@@ -465,13 +465,13 @@ static int mc13892_sw_regulator_set_voltage_sel(struct regulator_dev *rdev,
         */
 
        if (mc13892_regulators[id].vsel_reg != MC13892_SWITCHERS0) {
+               mask |= MC13892_SWITCHERS0_SWxHI;
+
                if (volt > 1375000) {
                        reg_value -= MC13892_SWxHI_SEL_OFFSET;
                        reg_value |= MC13892_SWITCHERS0_SWxHI;
-                       mask |= MC13892_SWITCHERS0_SWxHI;
-               } else if (volt < 1100000) {
+               } else {
                        reg_value &= ~MC13892_SWITCHERS0_SWxHI;
-                       mask |= MC13892_SWITCHERS0_SWxHI;
                }
        }