2012-08-01 12:40:45

by Axel Lin

[permalink] [raw]
Subject: [PATCH RFT] leds: lp8788: Fix updating scale configuration bits

We need to do left shift (cfg->num + LP8788_ISINK_SCALE_OFFSET) bits for
updating scale configuration.

Signed-off-by: Axel Lin <[email protected]>
---
Hi Milo,
Current code of updating scale configuration bits looks wrong to me
because the mask does not match the val.
I don't have this hardware, can you test this patch?

Thanks,
Axel
drivers/leds/leds-lp8788.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-lp8788.c b/drivers/leds/leds-lp8788.c
index 53bd136..0ade6eb 100644
--- a/drivers/leds/leds-lp8788.c
+++ b/drivers/leds/leds-lp8788.c
@@ -63,7 +63,7 @@ static int lp8788_led_init_device(struct lp8788_led *led,
/* scale configuration */
addr = LP8788_ISINK_CTRL;
mask = 1 << (cfg->num + LP8788_ISINK_SCALE_OFFSET);
- val = cfg->scale << cfg->num;
+ val = cfg->scale << (cfg->num + LP8788_ISINK_SCALE_OFFSET);
ret = lp8788_update_bits(led->lp, addr, mask, val);
if (ret)
return ret;
--
1.7.9.5



2012-08-07 02:07:50

by Bryan Wu

[permalink] [raw]
Subject: Re: [PATCH RFT] leds: lp8788: Fix updating scale configuration bits

On Wed, Aug 1, 2012 at 8:40 PM, Axel Lin <[email protected]> wrote:
> We need to do left shift (cfg->num + LP8788_ISINK_SCALE_OFFSET) bits for
> updating scale configuration.
>
> Signed-off-by: Axel Lin <[email protected]>
> ---
> Hi Milo,
> Current code of updating scale configuration bits looks wrong to me
> because the mask does not match the val.
> I don't have this hardware, can you test this patch?
>

Milo, I think this patch from Axel is reasonable. could you please
take a look at this?

-Bryan

> Thanks,
> Axel
> drivers/leds/leds-lp8788.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/leds/leds-lp8788.c b/drivers/leds/leds-lp8788.c
> index 53bd136..0ade6eb 100644
> --- a/drivers/leds/leds-lp8788.c
> +++ b/drivers/leds/leds-lp8788.c
> @@ -63,7 +63,7 @@ static int lp8788_led_init_device(struct lp8788_led *led,
> /* scale configuration */
> addr = LP8788_ISINK_CTRL;
> mask = 1 << (cfg->num + LP8788_ISINK_SCALE_OFFSET);
> - val = cfg->scale << cfg->num;
> + val = cfg->scale << (cfg->num + LP8788_ISINK_SCALE_OFFSET);
> ret = lp8788_update_bits(led->lp, addr, mask, val);
> if (ret)
> return ret;
> --
> 1.7.9.5
>
>
>



--
Bryan Wu <[email protected]>
Kernel Developer +86.186-168-78255 Mobile
Canonical Ltd. http://www.canonical.com
Ubuntu - Linux for human beings | http://www.ubuntu.com

2012-08-07 08:04:12

by Kim, Milo

[permalink] [raw]
Subject: RE: [PATCH RFT] leds: lp8788: Fix updating scale configuration bits

> We need to do left shift (cfg->num + LP8788_ISINK_SCALE_OFFSET) bits
> for
> updating scale configuration.
>
> Signed-off-by: Axel Lin <[email protected]>
> ---
> Hi Milo,
> Current code of updating scale configuration bits looks wrong to me
> because the mask does not match the val.
> I don't have this hardware, can you test this patch?
>
> Thanks,

The scale bits can be never updated without this patch.
This patch should be applied.

Thanks for fixing this bug !

Best Regards,
Milo



????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2012-08-07 08:10:12

by Kim, Milo

[permalink] [raw]
Subject: RE: [PATCH RFT] leds: lp8788: Fix updating scale configuration bits

> > We need to do left shift (cfg->num + LP8788_ISINK_SCALE_OFFSET) bits
> for
> > updating scale configuration.
> >
> > Signed-off-by: Axel Lin <[email protected]>
> > ---
>
> Milo, I think this patch from Axel is reasonable. could you please
> take a look at this?
>
> -Bryan

Acked-by: Milo(Woogyom) Kim <[email protected]>
Tested-by: Milo(Woogyom) Kim <[email protected]>

Thanks,
Milo -

2012-08-08 01:43:18

by Bryan Wu

[permalink] [raw]
Subject: Re: [PATCH RFT] leds: lp8788: Fix updating scale configuration bits

On Tue, Aug 7, 2012 at 4:09 PM, Kim, Milo <[email protected]> wrote:
>> > We need to do left shift (cfg->num + LP8788_ISINK_SCALE_OFFSET) bits
>> for
>> > updating scale configuration.
>> >
>> > Signed-off-by: Axel Lin <[email protected]>
>> > ---
>>
>> Milo, I think this patch from Axel is reasonable. could you please
>> take a look at this?
>>
>> -Bryan
>
> Acked-by: Milo(Woogyom) Kim <[email protected]>
> Tested-by: Milo(Woogyom) Kim <[email protected]>
>
> Thanks,
> Milo -

Great, Applied

Thanks,
--
Bryan Wu <[email protected]>
Kernel Developer +86.186-168-78255 Mobile
Canonical Ltd. http://www.canonical.com
Ubuntu - Linux for human beings | http://www.ubuntu.com