5280baff2b7a18a62e29f54e45b8de5aaf4bdbbb
[openwrt/staging/thess.git] /
1 From dc90895d776d7b8017bc3b14f588d569d8edbe1f Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Thu, 11 May 2017 13:36:52 +0200
4 Subject: [PATCH] leds: bcm6328: fix signal source assignment for high leds
5
6 Each nibble represents 4 LEDs, and in case of the higher register, bit 0
7 represents LED 4, so we need to use modulus for the LED number as well.
8
9 Fixes: fd7b025a238d0a5440bfa26c585eb78097bf48dc ("leds: add BCM6328 LED driver")
10 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
11 ---
12 drivers/leds/leds-bcm6328.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15 --- a/drivers/leds/leds-bcm6328.c
16 +++ b/drivers/leds/leds-bcm6328.c
17 @@ -242,7 +242,7 @@ static int bcm6328_hwled(struct device *
18
19 spin_lock_irqsave(lock, flags);
20 val = bcm6328_led_read(addr);
21 - val |= (BIT(reg) << (((sel % 4) * 4) + 16));
22 + val |= (BIT(reg % 4) << (((sel % 4) * 4) + 16));
23 bcm6328_led_write(addr, val);
24 spin_unlock_irqrestore(lock, flags);
25 }
26 @@ -269,7 +269,7 @@ static int bcm6328_hwled(struct device *
27
28 spin_lock_irqsave(lock, flags);
29 val = bcm6328_led_read(addr);
30 - val |= (BIT(reg) << ((sel % 4) * 4));
31 + val |= (BIT(reg % 4) << ((sel % 4) * 4));
32 bcm6328_led_write(addr, val);
33 spin_unlock_irqrestore(lock, flags);
34 }