summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorRong Zhang <i@rong.moe>2026-09-21 03:40:19 +0800
committerLee Jones <lee@kernel.org>2026-09-24 13:17:32 +0100
commit8e04e5382aa989ae9a36dc0cb3f3c90347d5607f (patch)
tree8fa3ae99bbfbd04d01be50e72b55b693c2b4f91d /include/linux
parent43b83e7462e8e9b96e14262c0b6aa739f01c38f7 (diff)
leds: trigger: Add hw_offloaded() callback and provide trigger_may_offload_to_hw attribute
There are multiple triggers implementing hardware control. However, the LED trigger core doesn't really know the hardware control (offloaded) state since the coordination is done directly between the trigger and the LED driver. It can only assume private triggers as offloaded and generic ones as not offloaded. Add an hw_offloaded() callback so that triggers can report their offloaded states to the LED trigger core. When unimplemented, it defaults to true for private triggers and false for generic ones to keep the current behavior unchanged. With that, provide a new attribute "trigger_may_offload_to_hw", so that userspace can determine: - if the LED device supports hardware control (supported => visible) - which trigger is the hardware control trigger selected by the LED device and offloaded to hardware ("[foo_trigger]") Note: the documentation describes the attribute as "returning a list" despite the LED core currently only supports one hardware control trigger per LED device. This is intentional to make the attribute extensible in the future without breaking userspace. IOW, userspace should parse the new attribute in the same way as /sys/class/leds/<led>/trigger. 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-5-fe3cdb6dec51@rong.moe Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/leds.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h
index d778709f5b1b..9a0bfd985b46 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -485,6 +485,7 @@ struct led_trigger {
const char *name;
int (*activate)(struct led_classdev *led_cdev);
void (*deactivate)(struct led_classdev *led_cdev);
+ bool (*hw_offloaded)(struct led_classdev *led_cdev);
/* Brightness set by led_trigger_event */
enum led_brightness brightness;