]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
leds: multicolor: Fix intensity setting while SW blinking
authorSven Schwermer <sven.schwermer@disruptive-technologies.com>
Fri, 4 Apr 2025 18:40:36 +0000 (20:40 +0200)
committerLee Jones <lee@kernel.org>
Wed, 14 May 2025 08:24:45 +0000 (09:24 +0100)
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>
drivers/leds/led-class-multicolor.c

index b2a87c9948165e268574a1071b1fcc405c2502fa..fd66d2bdeace8eeb254fc3fce2d1c8f0239bc063 100644 (file)
@@ -59,7 +59,8 @@ static ssize_t multi_intensity_store(struct device *dev,
        for (i = 0; i < mcled_cdev->num_colors; i++)
                mcled_cdev->subled_info[i].intensity = intensity_value[i];
 
-       led_set_brightness(led_cdev, led_cdev->brightness);
+       if (!test_bit(LED_BLINK_SW, &led_cdev->work_flags))
+               led_set_brightness(led_cdev, led_cdev->brightness);
        ret = size;
 err_out:
        mutex_unlock(&led_cdev->led_access);