* [PATCH 0/2] leds: Fix IS31FL3293 reset and leds-group-multicolor overflow
@ 2026-12-02 17:34 Matt Moeller via B4 Relay
2026-12-02 17:34 ` [PATCH 1/2] leds: is31fl32xx: Fix the IS31FL3293 reset register Matt Moeller via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Matt Moeller via B4 Relay @ 2026-12-02 17:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Daniel Mack,
Jean-Jacques Hiblot
Cc: linux-leds, linux-kernel, stable, Matt Moeller
Two fixes found while bringing up an IS31FL3293 RGB status LED grouped
with leds-group-multicolor (three 12-bit channels, max_brightness 4095).
Patch 1: the IS31FL3293 reset register is 0x3f, not 0x3c, so the driver
never reset the chip and a bootloader-configured mode stayed in effect.
Patch 2: leds_gmc_set() overflows unsigned int once LED brightness goes
past 8 bits, sending wrapped values to the LEDs.
Both were tested on an AM335x board on 6.1.182 with the IS31FL3293
support backported; on this tree (for-leds-next) they were build-tested
only (ARM, W=1).
The problems were found and the fixes written with help from Claude
(Anthropic).
---
Matt Moeller (2):
leds: is31fl32xx: Fix the IS31FL3293 reset register
leds: rgb: leds-group-multicolor: Fix overflow with high max_brightness
drivers/leds/leds-is31fl32xx.c | 2 +-
drivers/leds/rgb/leds-group-multicolor.c | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
---
base-commit: 6881bcee6db3a7a3f9ff2b5ff01a1b43ee97bc83
change-id: 20261202-for-upstream-45581d2e8829
Best regards,
--
Matt Moeller <matthew.moeller@kinze.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/2] leds: is31fl32xx: Fix the IS31FL3293 reset register
2026-12-02 17:34 [PATCH 0/2] leds: Fix IS31FL3293 reset and leds-group-multicolor overflow Matt Moeller via B4 Relay
@ 2026-12-02 17:34 ` Matt Moeller via B4 Relay
2026-12-02 17:34 ` [PATCH 2/2] leds: rgb: leds-group-multicolor: Fix overflow with high max_brightness Matt Moeller via B4 Relay
2026-12-02 17:40 ` [PATCH 0/2] leds: Fix IS31FL3293 reset and leds-group-multicolor overflow sashiko-bot
2 siblings, 0 replies; 4+ messages in thread
From: Matt Moeller via B4 Relay @ 2026-12-02 17:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Daniel Mack,
Jean-Jacques Hiblot
Cc: linux-leds, linux-kernel, stable, Matt Moeller
From: Matt Moeller <matthew.moeller@kinze.com>
The IS31FL3293 datasheet (Rev. A, 09/22/2022) lists the Reset Register
at 3Fh; there is no register at 3Ch. Writing the 0xc5 magic to 0x3c
does nothing, so is31fl3293_reset() leaves the chip in whatever state
it was in before probe.
That matters when a bootloader has already set the chip up. On our
board U-Boot turns the status LED on in current-level mode (register
0x02 = 0x2a, current level registers at 0xff); the chip then ignores the
PWM registers this driver writes, and the LED stays white whatever
brightness is set.
Write the magic to 0x3f. On that board, writing 0xc5 to 0x3c leaves
every register as it was, and writing it to 0x3f returns them to their
default values (register 0x02 = 0x00), after which the brightness set
through sysfs reaches the outputs.
The problem was found and this fix written with help from Claude
(Anthropic), and tested on hardware.
Fixes: a18983b95a61 ("leds: is31f132xx: Add support for is31fl3293")
Cc: stable@vger.kernel.org
Signed-off-by: Matt Moeller <matthew.moeller@kinze.com>
---
drivers/leds/leds-is31fl32xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/leds/leds-is31fl32xx.c b/drivers/leds/leds-is31fl32xx.c
index 513ada8445b4..2abc2d2fb29b 100644
--- a/drivers/leds/leds-is31fl32xx.c
+++ b/drivers/leds/leds-is31fl32xx.c
@@ -45,7 +45,7 @@
#define IS31FL3293_CL_REG 0x10
#define IS31FL3293_COLOR_UPDATE_REG 0x27
#define IS31FL3293_COLOR_UPDATE_MAGIC 0xc5
-#define IS31FL3293_RESET_REG 0x3c
+#define IS31FL3293_RESET_REG 0x3f
#define IS31FL3293_RESET_MAGIC 0xc5
#define IS31FL3293_MAX_MICROAMP 20000
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] leds: rgb: leds-group-multicolor: Fix overflow with high max_brightness
2026-12-02 17:34 [PATCH 0/2] leds: Fix IS31FL3293 reset and leds-group-multicolor overflow Matt Moeller via B4 Relay
2026-12-02 17:34 ` [PATCH 1/2] leds: is31fl32xx: Fix the IS31FL3293 reset register Matt Moeller via B4 Relay
@ 2026-12-02 17:34 ` Matt Moeller via B4 Relay
2026-12-02 17:40 ` [PATCH 0/2] leds: Fix IS31FL3293 reset and leds-group-multicolor overflow sashiko-bot
2 siblings, 0 replies; 4+ messages in thread
From: Matt Moeller via B4 Relay @ 2026-12-02 17:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Griffin Kroah-Hartman, Daniel Mack,
Jean-Jacques Hiblot
Cc: linux-leds, linux-kernel, stable, Matt Moeller
From: Matt Moeller <matthew.moeller@kinze.com>
leds_gmc_set() multiplies brightness, intensity and the monochromatic
LED's max_brightness in unsigned int, and DIV_ROUND_CLOSEST() then adds
half the divisor. With 12-bit LEDs (max_brightness 4095, e.g. the
IS31FL3293) the result passes UINT_MAX as soon as brightness *
intensity passes about 2^20, and the LEDs get wrapped values: a group at
4095 with intensities 1605 1284 0 sets red 68 and green 3 instead of
1605 and 1284, and a group brightness of 256 at full intensity sets 0.
Do the calculation in 64 bits.
The problem was found and this fix written with help from Claude
(Anthropic), and tested on hardware.
Fixes: 37d0849ed392 ("leds: rgb: Add a multicolor LED driver to group monochromatic LEDs")
Cc: stable@vger.kernel.org
Signed-off-by: Matt Moeller <matthew.moeller@kinze.com>
---
drivers/leds/rgb/leds-group-multicolor.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/rgb/leds-group-multicolor.c b/drivers/leds/rgb/leds-group-multicolor.c
index a707d51c6a4b..797538f73115 100644
--- a/drivers/leds/rgb/leds-group-multicolor.c
+++ b/drivers/leds/rgb/leds-group-multicolor.c
@@ -15,6 +15,7 @@
#include <linux/leds.h>
#include <linux/led-class-multicolor.h>
#include <linux/math.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/property.h>
@@ -41,8 +42,10 @@ static int leds_gmc_set(struct led_classdev *cdev, enum led_brightness brightnes
* Scale the brightness according to relative intensity of the
* color AND the max brightness of the monochromatic LED.
*/
- mono_brightness = DIV_ROUND_CLOSEST(brightness * intensity * mono_max_brightness,
- group_max_brightness * group_max_brightness);
+ mono_brightness = DIV64_U64_ROUND_CLOSEST((u64)brightness * intensity *
+ mono_max_brightness,
+ (u64)group_max_brightness *
+ group_max_brightness);
led_set_brightness(mono, mono_brightness);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] leds: Fix IS31FL3293 reset and leds-group-multicolor overflow
2026-12-02 17:34 [PATCH 0/2] leds: Fix IS31FL3293 reset and leds-group-multicolor overflow Matt Moeller via B4 Relay
2026-12-02 17:34 ` [PATCH 1/2] leds: is31fl32xx: Fix the IS31FL3293 reset register Matt Moeller via B4 Relay
2026-12-02 17:34 ` [PATCH 2/2] leds: rgb: leds-group-multicolor: Fix overflow with high max_brightness Matt Moeller via B4 Relay
@ 2026-12-02 17:40 ` sashiko-bot
2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-12-02 17:40 UTC (permalink / raw)
To: Matt Moeller; +Cc: linux-leds, lee
Sashiko has reviewed this 2-patch series and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-for-upstream-v1-0-709b6da8706b@kinze.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-02 17:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 17:34 [PATCH 0/2] leds: Fix IS31FL3293 reset and leds-group-multicolor overflow Matt Moeller via B4 Relay
2026-12-02 17:34 ` [PATCH 1/2] leds: is31fl32xx: Fix the IS31FL3293 reset register Matt Moeller via B4 Relay
2026-12-02 17:34 ` [PATCH 2/2] leds: rgb: leds-group-multicolor: Fix overflow with high max_brightness Matt Moeller via B4 Relay
2026-12-02 17:40 ` [PATCH 0/2] leds: Fix IS31FL3293 reset and leds-group-multicolor overflow sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox