[PATCH] lp3971: Fix BUCK_VOL_CHANGE_SHIFT logic

Previous thread: [patch] x86: increase CONFIG_NODES_SHIFT max to 10 by David Rientjes on Wednesday, March 10, 2010 - 4:42 pm. (8 messages)

Next thread: linux-next: manual merge of the wireless tree with the wireless-current tree by Stephen Rothwell on Wednesday, March 10, 2010 - 7:15 pm. (3 messages)
From: axel lin
Date: Wednesday, March 10, 2010 - 6:56 pm

From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@gmail.com>
Date: Thu, 11 Mar 2010 09:50:07 +0800
Subject: [PATCH] lp3971: Fix BUCK_VOL_CHANGE_SHIFT logic

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>
---
 drivers/regulator/lp3971.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index a28ae37..1ba61ab 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -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
-- 
1.5.4.3
--

From: Mark Brown
Date: Thursday, March 11, 2010 - 4:04 am

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

with the same comment about ideally wanting someone who worked on the
driver previously to check stuff.
--

From: Liam Girdwood
Date: Thursday, March 11, 2010 - 4:18 am

Marek, Kyungmin, could someone please test/ack this before both are
applied.

Thanks

Liam

-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

--

From: Marek Szyprowski
Date: Sunday, March 14, 2010 - 11:48 pm

Hello,


Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

Axel was right, my bit arithmetic was definitely wrong. Again, thanks for spotting
it and I'm really sorry You had lost some time debugging it.

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

--

From: Liam Girdwood
Date: Wednesday, March 17, 2010 - 4:08 pm

Both Applied with fixes for mailer mangled patches.

Thanks

Liam

-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

--

Previous thread: [patch] x86: increase CONFIG_NODES_SHIFT max to 10 by David Rientjes on Wednesday, March 10, 2010 - 4:42 pm. (8 messages)

Next thread: linux-next: manual merge of the wireless tree with the wireless-current tree by Stephen Rothwell on Wednesday, March 10, 2010 - 7:15 pm. (3 messages)