Re: [RFC PATCH v2 1/5] leds: trigger: add API for HW offloading of triggers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/7/21 4:24 PM, Ansuel Smith wrote:
From: Marek Behún <kabel@xxxxxxxxxx>


---
  Documentation/leds/leds-class.rst | 20 +++++++++++++++++++
  drivers/leds/led-triggers.c       |  1 +
  drivers/leds/trigger/Kconfig      | 10 ++++++++++
  include/linux/leds.h              | 33 +++++++++++++++++++++++++++++++
  4 files changed, 64 insertions(+)

diff --git a/Documentation/leds/leds-class.rst b/Documentation/leds/leds-class.rst
index cd155ead8703..5bf6e5d471ce 100644
--- a/Documentation/leds/leds-class.rst
+++ b/Documentation/leds/leds-class.rst
@@ -169,6 +169,26 @@ Setting the brightness to zero with brightness_set() callback function
  should completely turn off the LED and cancel the previously programmed
  hardware blinking function, if any.
+Hardware offloading of LED triggers
+===================================
+
+Some LEDs can be driven by hardware triggers (for example a LED connected to
+an ethernet PHY or an ethernet switch can be configured to blink on activity on
+the network, which in software is done by the netdev trigger).
+
+To do such offloading, LED driver must support this and a deficated offload

                                                             dedicated

+trigger must be used. The LED must implement the trigger_offload() method and
+the trigger code must try to call this method (via led_trigger_offload()
+function) to set the LED to this particular mode. (and disable any software
+blinking)
+
+The implementation of the trigger_offload() method by the LED driver must return
+0 if the offload is successful and -EOPNOTSUPP if the requested trigger
+configuration is not supported.
+
+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

Preferably s/HW/hardware/ and s/SW/software/ throughout documentation and Kconfig
files.

+in the trigger_offload() method and the driver will be set to the new trigger.
Known Issues
  ============


diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig
index dc6816d36d06..33aba8defeab 100644
--- a/drivers/leds/trigger/Kconfig
+++ b/drivers/leds/trigger/Kconfig
@@ -9,6 +9,16 @@ menuconfig LEDS_TRIGGERS
if LEDS_TRIGGERS +config LEDS_OFFLOAD_TRIGGERS
+	bool "LED Offload Trigger support"
+	help
+	  This option enabled offload triggers support used by leds that

	              enables                                  LEDs

+	  can be driven in hardware by declaring some specific triggers.
+	  A offload trigger will expose a sysfs dir to configure the
+	  different blinking trigger and the available hardware triggers.
+
+	  If unsure, say Y.


--
~Randy



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux