[PATCH v3 05/11] leds: rgb: ktd202x: Keep the unlit colors of a blinking LED off
From: Joseph Telaak via B4 Relay
Date: Thu Nov 19 2026 - 19:07:51 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 | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/leds/rgb/leds-ktd202x.c b/drivers/leds/rgb/leds-ktd202x.c
index bfc05f5f02d6..ac7ed7552fb2 100644
--- a/drivers/leds/rgb/leds-ktd202x.c
+++ b/drivers/leds/rgb/leds-ktd202x.c
@@ -285,6 +285,11 @@ 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);
}
@@ -360,6 +365,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)