[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200915152616.20591-1-marek.behun@nic.cz>
Date: Tue, 15 Sep 2020 17:26:14 +0200
From: Marek Behún <marek.behun@....cz>
To: linux-leds@...r.kernel.org
Cc: Pavel Machek <pavel@....cz>, Dan Murphy <dmurphy@...com>,
Ondřej Jirman <megous@...ous.com>,
Russell King <linux@...linux.org.uk>,
Andrew Lunn <andrew@...n.ch>, linux-kernel@...r.kernel.org,
Matthias Schiffer <matthias.schiffer@...tq-group.com>,
Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org,
Marek Behún <marek.behun@....cz>
Subject: [PATCH leds + devicetree v2 0/2] Parse DT property `trigger-sources` for netdev LED trigger
Hi,
this is v2.
Changes since v1:
- fixed problems with v1 reported by kernel test robot
- created helper functions of_led_count_trigger_sources and
of_led_get_trigger_source
Below is description from v1:
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@...00 {
compatible = "xyz";
#trigger-source-cells = <0>;
};
led {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LINK;
trigger-sources = <ð0>;
};
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 = <ð0 (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 = <ð0>;
};
Marek
Marek Behún (2):
leds: trigger: add trigger sources validating method and helper
functions
leds: trigger: netdev: parse `trigger-sources` from device tree
drivers/leds/led-triggers.c | 68 ++++++++++++++++++++---
drivers/leds/trigger/ledtrig-netdev.c | 80 ++++++++++++++++++++++++++-
include/dt-bindings/leds/common.h | 1 +
include/linux/leds.h | 25 +++++++++
4 files changed, 165 insertions(+), 9 deletions(-)
--
2.26.2
Powered by blists - more mailing lists