lp3971: Fix BUCK_VOL_CHANGE_SHIFT logic
authorAxel Lin <axel.lin@gmail.com>
Thu, 11 Mar 2010 01:50:07 +0000 (09:50 +0800)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Mon, 22 Mar 2010 19:44:45 +0000 (19:44 +0000)
Given x=0,1,2, current implementation of BUCK_VOL_CHANGE_SHIFT(x) returns 0,4,8.
The correct return value should be 0,4,6.
This patch fix the logic.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/lp3971.c

index 8bdcf41ab68c62634e4529afd4419499bf80a8b5..b20b3e1d821a4bf679c82394199ce11e78ad8cd3 100644 (file)
@@ -45,7 +45,7 @@ static int lp3971_set_bits(struct lp3971 *lp3971, u8 reg, u16 mask, u16 val);
        LP3971_BUCK2 -> 4
        LP3971_BUCK3 -> 6
 */
-#define BUCK_VOL_CHANGE_SHIFT(x) (((1 << x) & ~0x01) << 1)
+#define BUCK_VOL_CHANGE_SHIFT(x) (((!!x) << 2) | (x & ~0x01))
 #define BUCK_VOL_CHANGE_FLAG_GO 0x01
 #define BUCK_VOL_CHANGE_FLAG_TARGET 0x02
 #define BUCK_VOL_CHANGE_FLAG_MASK 0x03