Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

leds: multicolor: Fix intensity setting while SW blinking

When writing to the multi_intensity file, don't unconditionally call
led_set_brightness. By only doing this if blinking is inactive we
prevent blinking from stopping if the blinking is in its off phase while
the file is written.

Instead, if blinking is active, the changed intensity values are applied
upon the next blink. This is consistent with changing the brightness on
monochrome LEDs with active blinking.

Suggested-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Tobias Deiminger <tobias.deiminger@linutronix.de>
Tested-by: Sven Schuchmann <schuchmann@schleissheimer.de>
Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
Link: https://lore.kernel.org/r/20250404184043.227116-1-sven@svenschwermer.de
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Sven Schwermer and committed by
Lee Jones
e35ca991 b2661df9

+2 -1
+2 -1
drivers/leds/led-class-multicolor.c
··· 59 59 for (i = 0; i < mcled_cdev->num_colors; i++) 60 60 mcled_cdev->subled_info[i].intensity = intensity_value[i]; 61 61 62 - led_set_brightness(led_cdev, led_cdev->brightness); 62 + if (!test_bit(LED_BLINK_SW, &led_cdev->work_flags)) 63 + led_set_brightness(led_cdev, led_cdev->brightness); 63 64 ret = size; 64 65 err_out: 65 66 mutex_unlock(&led_cdev->led_access);