Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] lp3971: Fix BUCK_VOL_CHANGE_SHIFT logic

0 views
Skip to first unread message

axel lin

unread,
Mar 10, 2010, 9:00:02 PM3/10/10
to
From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001
From: Axel Lin <axel...@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...@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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Mark Brown

unread,
Mar 11, 2010, 6:10:02 AM3/11/10
to
On Thu, Mar 11, 2010 at 09:56:34AM +0800, axel lin wrote:
> From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001
> From: Axel Lin <axel...@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...@gmail.com>

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

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

Liam Girdwood

unread,
Mar 11, 2010, 6:20:02 AM3/11/10
to
On Thu, 2010-03-11 at 11:04 +0000, Mark Brown wrote:
> On Thu, Mar 11, 2010 at 09:56:34AM +0800, axel lin wrote:
> > From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001
> > From: Axel Lin <axel...@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...@gmail.com>
>
> Acked-by: Mark Brown <bro...@opensource.wolfsonmicro.com>
>
> 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

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

Marek Szyprowski

unread,
Mar 15, 2010, 3:00:01 AM3/15/10
to
Hello,

On Thursday, March 11, 2010 12:18 PM Liam Girdwood wrote:

> On Thu, 2010-03-11 at 11:04 +0000, Mark Brown wrote:
> > On Thu, Mar 11, 2010 at 09:56:34AM +0800, axel lin wrote:
> > > From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001
> > > From: Axel Lin <axel...@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...@gmail.com>
> >
> > Acked-by: Mark Brown <bro...@opensource.wolfsonmicro.com>
> >
> > 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.

Acked-by: Marek Szyprowski <m.szyp...@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

Liam Girdwood

unread,
Mar 17, 2010, 7:10:02 PM3/17/10
to
On Thu, 2010-03-11 at 09:56 +0800, axel lin wrote:
> >From 99175ed0f281d54efdaf8eef548077a8f0b4924a Mon Sep 17 00:00:00 2001
> From: Axel Lin <axel...@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...@gmail.com>

Both Applied with fixes for mailer mangled patches.

Thanks

Liam

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

--

0 new messages