summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorRong Zhang <i@rong.moe>2026-09-21 03:40:17 +0800
committerLee Jones <lee@kernel.org>2026-09-24 13:17:32 +0100
commit96b4ddd6d2d8c645d672f1f26130685d9f40cf2f (patch)
tree929306af8a4336f077fdefc00bf384b146227116 /include/linux
parent7879d6277485697cf37eb3c1b89ce260d8c67e4f (diff)
leds: class: Remove hardware control trigger when writing brightness
Since commit b819dc7d8fb2 ("leds: core: Report ENODATA for brightness of hardware controlled LED"), the brightness attribute becomes write-only when the LED is controlled fully by the hardware. A write-only attribute is very confusing. Moreover, most LED drivers set hardware brightness innocently with the side effect of disabling hardware control, but the hardware control trigger remains active, resulting in the software and hardware being out of sync. Fix it by removing the hardware control trigger when writing the brightness attribute. This should also match the semantics of hardware control: When the LED is in hw control, no software blink is possible and doing so will effectively disable hw control. Fixes: b819dc7d8fb2 ("leds: core: Report ENODATA for brightness of hardware controlled LED") Acked-by: Ike Panhc <ikepanhc@gmail.com> Signed-off-by: Rong Zhang <i@rong.moe> Link: https://patch.msgid.link/20260921-leds-trigger-hw-changed-v7-3-fe3cdb6dec51@rong.moe Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/leds.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 46ad2e03e1c6..d778709f5b1b 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -533,6 +533,7 @@ void led_trigger_blink_oneshot(struct led_trigger *trigger,
void led_trigger_set_default(struct led_classdev *led_cdev);
int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger);
void led_trigger_remove(struct led_classdev *led_cdev);
+void led_trigger_remove_hw_control(struct led_classdev *led_cdev);
bool led_trigger_is_hw_controlled(struct led_classdev *led_cdev);
@@ -586,6 +587,7 @@ static inline int led_trigger_set(struct led_classdev *led_cdev,
}
static inline void led_trigger_remove(struct led_classdev *led_cdev) {}
+static inline void led_trigger_remove_hw_control(struct led_classdev *led_cdev) {}
static inline bool led_trigger_is_hw_controlled(struct led_classdev *led_cdev)
{