[LED bug fix] leds-da903x (da9030 only) led brightness reversed. - Kernel

This is a discussion on [LED bug fix] leds-da903x (da9030 only) led brightness reversed. - Kernel ; The brightness control register calculation (for the pwm) is effectively the reverse of what would be expected. 1 is maximum brightness, 255 minimum. This patch inverts this. Signed-off-by: Jonathan Cameron --- diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c index f1fddb1..ab632e9 100644 --- a/drivers/leds/leds-da903x.c ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [LED bug fix] leds-da903x (da9030 only) led brightness reversed.

  1. [LED bug fix] leds-da903x (da9030 only) led brightness reversed.

    The brightness control register calculation (for the pwm) is
    effectively the reverse of what would be expected.
    1 is maximum brightness, 255 minimum.

    This patch inverts this.

    Signed-off-by: Jonathan Cameron

    ---
    diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c
    index f1fddb1..ab632e9 100644
    --- a/drivers/leds/leds-da903x.c
    +++ b/drivers/leds/leds-da903x.c
    @@ -57,7 +57,7 @@ static void da903x_led_work(struct work_struct *work)
    offset = DA9030_LED_OFFSET(led->id);
    val = led->flags & ~0x87;
    val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */
    - val |= (led->new_brightness >> 5) & 0x7; /* PWM<2:0> */
    + val |= (0x7 - (led->new_brightness >> 5)) & 0x7; /* PWM<2:0> */
    da903x_write(led->master, DA9030_LED1_CONTROL + offset, val);
    break;
    case DA9030_ID_VIBRA:
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: [LED bug fix] leds-da903x (da9030 only) led brightness reversed.



    Jonathan Cameron wrote:
    > The brightness control register calculation (for the pwm) is
    > effectively the reverse of what would be expected.
    > 1 is maximum brightness, 255 minimum.
    >
    > This patch inverts this.
    >
    > Signed-off-by: Jonathan Cameron


    Acked-by: Mike Rapoport

    > ---
    > diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c
    > index f1fddb1..ab632e9 100644
    > --- a/drivers/leds/leds-da903x.c
    > +++ b/drivers/leds/leds-da903x.c
    > @@ -57,7 +57,7 @@ static void da903x_led_work(struct work_struct *work)
    > offset = DA9030_LED_OFFSET(led->id);
    > val = led->flags & ~0x87;
    > val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */
    > - val |= (led->new_brightness >> 5) & 0x7; /* PWM<2:0> */
    > + val |= (0x7 - (led->new_brightness >> 5)) & 0x7; /* PWM<2:0> */
    > da903x_write(led->master, DA9030_LED1_CONTROL + offset, val);
    > break;
    > case DA9030_ID_VIBRA:
    >


    --
    Sincerely yours,
    Mike.

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  3. Re: [LED bug fix] leds-da903x (da9030 only) led brightness reversed.

    On Thu, Oct 30, 2008 at 7:53 PM, Mike Rapoport wrote:
    >
    >
    > Jonathan Cameron wrote:
    >> The brightness control register calculation (for the pwm) is
    >> effectively the reverse of what would be expected.
    >> 1 is maximum brightness, 255 minimum.
    >>
    >> This patch inverts this.
    >>
    >> Signed-off-by: Jonathan Cameron

    >
    > Acked-by: Mike Rapoport
    >


    OK, queued.

    Richard, I'm taking this patch along with some of my other
    fixes to be pushed out tonight, thanks.
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread