From 865d81a98602c828515fa6ac3c530efc4205f9f6 Mon Sep 17 00:00:00 2001 From: Manuel Fombuena Date: Tue, 15 Sep 2026 13:47:39 +0100 Subject: [PATCH] leds: st1202: Honour max_brightness when blinking st1202_blink_set() drives the channel current register to U8_MAX, the full scale of the part, regardless of the ceiling the board declared. led_classdev_register_ext() takes max_brightness from the device tree max-brightness property. The driver does not implement led-max-microamp, so that is the only way a board can ask for less than 20 mA. The brightness and pattern paths both respect it. Blinking is the one that does not, so a board that declares a lower ceiling holds it until something enables the timer trigger. Program the same value the other paths use, capped at the width of the current register so an out of range property cannot wrap it to zero. Fixes: 35cbd34a6a05 ("leds: st1202: Add hardware-accelerated blink support") Signed-off-by: Manuel Fombuena Assisted-by: LLM Link: https://patch.msgid.link/GV1PR08MB84979A5D536C71D319A06808C5BA2@GV1PR08MB8497.eurprd08.prod.outlook.com Signed-off-by: Lee Jones --- drivers/leds/leds-st1202.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-st1202.c b/drivers/leds/leds-st1202.c index 42989b4fbaf3..39129206b78d 100644 --- a/drivers/leds/leds-st1202.c +++ b/drivers/leds/leds-st1202.c @@ -382,7 +382,8 @@ static int st1202_blink_set(struct led_classdev *led_cdev, if (ret) return ret; - ret = st1202_write_reg(chip, ST1202_ILED_REG0 + led->led_num, U8_MAX); + ret = st1202_write_reg(chip, ST1202_ILED_REG0 + led->led_num, + min_t(unsigned int, led_cdev->max_brightness, U8_MAX)); if (ret) return ret;