Re: [RFC PATCH v2 2/5] leds: add function to configure offload leds
From: Randy Dunlap <hidden>
Date: 2021-11-08 02:22:33
Also in:
linux-doc, linux-leds, lkml, netdev
On 11/7/21 4:24 PM, Ansuel Smith wrote:
quoted hunk ↗ jump to hunk
diff --git a/Documentation/leds/leds-class.rst b/Documentation/leds/leds-class.rst index 5bf6e5d471ce..0a3bbe71dac7 100644 --- a/Documentation/leds/leds-class.rst +++ b/Documentation/leds/leds-class.rst@@ -190,6 +190,30 @@ If the second argument (enable) to the trigger_offload() method is false, any active HW offloading must be deactivated. In this case errors are not permitted in the trigger_offload() method and the driver will be set to the new trigger. +The offload trigger will use the function configure_offload() provided by the driver +that will configure the offloaded mode for the LED. +This function passes as the first argument (offload_flags) a u32 flag. +The second argument (cmd) of the configure_offload() method can be used to do various +operations for the specific trigger. We currently support ENABLE, DISABLE, READ and +SUPPORTED to enable, disable, read the state of the offload trigger and ask the LED +driver supports the specific offload trigger. + +In ENABLE/DISABLE configure_offload() should configure the LED to enable/disable the +requested trigger (flags). +In READ configure_offload() should return 0 or 1 based on the status of the requested +trigger (flags). +In SUPPORTED configure_offload() should return 0 or 1 if the LED driver supports the +requested trigger (flags) or not. + +The u32 flag is specific to the trigger and change across them. It's in the LED
changes
+driver interest know how to elaborate this flag and to declare support for a
driver's
+particular offload trigger. For this exact reason explicit support for the specific +trigger is mandatory or the driver returns -EOPNOTSUPP if asked to enter offload mode +with a not supported trigger. +If the driver returns -EOPNOTSUPP on configure_offload(), the trigger activation will +fail as the driver doesn't support that specific offload trigger or doesn't know +how to handle the provided flags.
-- ~Randy