Commit 4f02b50e authored by Jonas Gorski's avatar Jonas Gorski Committed by Jacek Anaszewski

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: fd7b025a ("leds: add BCM6328 LED driver")
Signed-off-by: default avatarJonas Gorski <jonas.gorski@gmail.com>
Acked-by: default avatarÁlvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
parent 2ea659a9
...@@ -242,7 +242,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg, ...@@ -242,7 +242,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg,
spin_lock_irqsave(lock, flags); spin_lock_irqsave(lock, flags);
val = bcm6328_led_read(addr); 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); bcm6328_led_write(addr, val);
spin_unlock_irqrestore(lock, flags); spin_unlock_irqrestore(lock, flags);
} }
...@@ -269,7 +269,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg, ...@@ -269,7 +269,7 @@ static int bcm6328_hwled(struct device *dev, struct device_node *nc, u32 reg,
spin_lock_irqsave(lock, flags); spin_lock_irqsave(lock, flags);
val = bcm6328_led_read(addr); val = bcm6328_led_read(addr);
val |= (BIT(reg) << ((sel % 4) * 4)); val |= (BIT(reg % 4) << ((sel % 4) * 4));
bcm6328_led_write(addr, val); bcm6328_led_write(addr, val);
spin_unlock_irqrestore(lock, flags); spin_unlock_irqrestore(lock, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment