Skip to contentSkip to conversation

lp3971: Fix BUCK_VOL_CHANGE_SHIFT logic

PATCH In review axel lin 4 participants 5 messages Mar 11, 2010 – Mar 17, 2010 Voltage and current regulator framework

lore
Share & tools
lore

axel lin

author
#0 lore raw

PATCH 1/1 lp3971: Fix BUCK_VOL_CHANGE_SHIFT logic

Quoted 1 line

From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001

From: Axel Lin <[email protected]>
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.

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

Signature · 1 line
1.5.4.3
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · axel lin

From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001
From: Axel Lin <[email protected]>
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.

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

#2 lore raw
Quoted 10 lines · Mark Brown
Quoted 9 lines · axel lin

From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001
From: Axel Lin <[email protected]>
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.

Quoted 6 lines
Quoted 1 line

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

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

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
#3 lore raw

Hello,

Quoted 13 lines · Liam Girdwood
Quoted 12 lines · Mark Brown
Quoted 10 lines · axel lin

From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001
From: Axel Lin <[email protected]>
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.

Quoted 7 lines
Quoted 4 lines

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

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

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

#4 lore raw
In reply to axel lin
Quoted 10 lines · axel lin
Quoted 1 line

From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001

From: Axel Lin <[email protected]>
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.

Both Applied with fixes for mailer mangled patches.

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk