linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH leds + devicetree v1 0/2] Parse DT property `trigger-sources` for netdev LED trigger
@ 2020-09-14 23:41 Marek Behún
  2020-09-14 23:41 ` [PATCH leds + devicetree v1 1/2] leds: trigger: add DT `trigger-sources` validating method Marek Behún
  2020-09-14 23:41 ` [PATCH leds + devicetree v1 2/2] leds: trigger: netdev: allow parsing `trigger-sources` from device tree Marek Behún
  0 siblings, 2 replies; 4+ messages in thread
From: Marek Behún @ 2020-09-14 23:41 UTC (permalink / raw)
  To: linux-leds
  Cc: Pavel Machek, Dan Murphy, Ondřej Jirman, Russell King,
	Andrew Lunn, linux-kernel, Matthias Schiffer, Marek Behún

Hi,

the `trigger-sources` LED DT property is currently only implemented
for ledtrig-usbport.

Lets implement it for the netdev LED trigger.

In this proposal the specific netdev LED trigger mode is determined
from the `function` LED DT property.

Example:
  eth0: ethernet@30000 {
    compatible = "xyz";
    #trigger-source-cells = <0>;
  };

  led {
    color = <LED_COLOR_ID_GREEN>;
    function = LED_FUNCTION_LINK;
    trigger-sources = <&eth0>;
  };

When led is registered, the netdev trigger is automatically activated
and set to light the LED on if eth0 is linked.

Please let me know if this binding is OK, or if the binding should
instead of the `function` property determine the trigger settings from
arguments of the `trigger-sources` property :
  led {
    color = <LED_COLOR_ID_GREEN>;
    trigger-sources = <&eth0 (NETDEV_ATTR_LINK | NETDEV_ATTR_RX)>;
  };

I prefer the first binding, since we already have the `function`
property. Multiple modes can be achieved by string array, but this is
not yet implemented:
  led {
    color = <LED_COLOR_ID_GREEN>;
    function = LED_FUNCTION_LINK, LED_FUNCTION_ACTIVITY;
    trigger-sources = <&eth0>;
  };

Marek

Marek Behún (2):
  leds: trigger: add DT `trigger-source` validating method
  leds: trigger: netdev: allow parsing `trigger-sources` from device
    tree

 drivers/leds/led-triggers.c           | 26 +++++---
 drivers/leds/trigger/ledtrig-netdev.c | 91 ++++++++++++++++++++++++++-
 include/dt-bindings/leds/common.h     |  1 +
 include/linux/leds.h                  |  6 ++
 4 files changed, 115 insertions(+), 9 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-15 11:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 23:41 [PATCH leds + devicetree v1 0/2] Parse DT property `trigger-sources` for netdev LED trigger Marek Behún
2020-09-14 23:41 ` [PATCH leds + devicetree v1 1/2] leds: trigger: add DT `trigger-sources` validating method Marek Behún
2020-09-14 23:41 ` [PATCH leds + devicetree v1 2/2] leds: trigger: netdev: allow parsing `trigger-sources` from device tree Marek Behún
2020-09-15 11:04   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).