summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2017-06-02 14:17:05 +0200
committerJacek Anaszewski <jacek.anaszewski@gmail.com>2017-06-13 20:36:56 +0200
commit4f02b50ece11dcf75263fb7a4cfe8a5df1cfabea (patch)
treeeb121bfbeefaebf892c405f14894d3b958faaab9 /drivers/leds
parentLinux 4.12-rc1 (diff)
downloadlinux-4f02b50ece11dcf75263fb7a4cfe8a5df1cfabea.tar.xz
linux-4f02b50ece11dcf75263fb7a4cfe8a5df1cfabea.zip
leds: bcm6328: fix signal source assignment for leds 4 to 7
Each nibble represents 4 LEDs, and in case of the higher register, bit 0 represents LED 4, so we need to use modulus for the LED number as well. Fixes: fd7b025a238d0a5440bfa26c585eb78097bf48dc ("leds: add BCM6328 LED driver") Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Acked-by: Álvaro Fernández Rojas <noltari@gmail.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-bcm6328.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c
index 1548259297c1..2cfd9389ee96 100644
--- a/drivers/leds/leds-bcm6328.c
+++ b/drivers/leds/leds-bcm6328.c
@@ -242,7 +242,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg,
spin_lock_irqsave(lock, flags);
val = bcm6328_led_read(addr);
- val |= (BIT(reg) << (((sel % 4) * 4) + 16));
+ val |= (BIT(reg % 4) << (((sel % 4) * 4) + 16));
bcm6328_led_write(addr, val);
spin_unlock_irqrestore(lock, flags);
}
@@ -269,7 +269,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg,
spin_lock_irqsave(lock, flags);
val = bcm6328_led_read(addr);
- val |= (BIT(reg) << ((sel % 4) * 4));
+ val |= (BIT(reg % 4) << ((sel % 4) * 4));
bcm6328_led_write(addr, val);
spin_unlock_irqrestore(lock, flags);
}