[PATCH v2 05/11] leds: rgb: ktd202x: Keep the unlit colors of a blinking LED off
From: Joseph Telaak via B4 Relay
Date: Mon Nov 09 2026 - 14:08:00 EST
From: Joseph Telaak <joseph@xxxxxxxxxx>
blink_set() switches every channel of a multicolor LED to the flash
timer, or to always on when delay_off is 0, including the colors whose
brightness is 0. Their current register still holds the last brightness
they had, or the 10 mA default, so for example a red blink set with a
multi_intensity of "255 0 0" also blinks green and blue.
Leave the channels of the colors with no brightness off, as
brightness_set() does. A single color LED now passes its brightness too.
Fixes: 0ebdb7210943 ("leds: Add ktd202x driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Joseph Telaak <joseph@xxxxxxxxxx>
---
drivers/leds/rgb/leds-ktd202x.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/leds/rgb/leds-ktd202x.c b/drivers/leds/rgb/leds-ktd202x.c
index feea33b7e885..042de16c28bc 100644
--- a/drivers/leds/rgb/leds-ktd202x.c
+++ b/drivers/leds/rgb/leds-ktd202x.c
@@ -284,6 +284,10 @@ static int ktd202x_blink_set(struct ktd202x_led *led, unsigned long *delay_on,
int channel = subleds[i].channel;
ctrl_mask |= KTD202X_CHANNEL_CTRL_MASK(channel);
+ /* A color with no brightness stays off */
+ if (!subleds[i].brightness)
+ continue;
+
ctrl_on |= KTD202X_CHANNEL_CTRL_ON(channel);
ctrl_pwm1 |= KTD202X_CHANNEL_CTRL_PWM1(channel);
}
@@ -359,6 +363,7 @@ static int ktd202x_blink_single_set(struct led_classdev *cdev,
if (!*delay_on)
return ktd202x_brightness_single_set(cdev, LED_OFF);
+ info.brightness = cdev->brightness;
info.channel = led->index;
return ktd202x_blink_set(led, delay_on, delay_off, &info, 1);
--
Git-155)