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: 35cbd34a6a ("leds: st1202: Add hardware-accelerated blink support")
Signed-off-by: Manuel Fombuena <fombuena@outlook.com>
Assisted-by: LLM
Link: https://patch.msgid.link/GV1PR08MB84979A5D536C71D319A06808C5BA2@GV1PR08MB8497.eurprd08.prod.outlook.com
Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
Manuel Fombuena 2026-09-15 13:47:39 +01:00 committed by Lee Jones
parent 3268b9e91d
commit 865d81a986

View File

@ -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;