[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190314102911.GA15173@amd>
Date: Thu, 14 Mar 2019 11:29:11 +0100
From: Pavel Machek <pavel@....cz>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
LKML <linux-kernel@...r.kernel.org>, linux-leds@...r.kernel.org,
devicetree@...r.kernel.org, linux-can@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH 4/4] leds: netdev trigger: allow setting initial values
in device tree
On Wed 2019-03-13 21:26:15, Rasmus Villemoes wrote:
> It can be quite convenient to initialize a netdev-triggered LED with a
> device name and setting the rx,tx,link properties from device tree,
> instead of having to do that in an init script in userspace.
>
> My main motivation for this is to be able to switch away from the
> deprecated CONFIG_CAN_LEDS, so add an example based on that and add a
> pointer in the net/can/Kconfig file.
>
> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
> ---
> .../devicetree/bindings/leds/common.txt | 17 ++++++++++
> drivers/leds/trigger/ledtrig-netdev.c | 31 +++++++++++++++++++
> drivers/net/can/Kconfig | 3 +-
> 3 files changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/leds/common.txt b/Documentation/devicetree/bindings/leds/common.txt
> index 7cb88460a47c..4f3a97e73417 100644
> --- a/Documentation/devicetree/bindings/leds/common.txt
> +++ b/Documentation/devicetree/bindings/leds/common.txt
> @@ -43,6 +43,23 @@ Optional properties for child nodes:
> Documentation/ABI/testing/sysfs-class-led-trigger-netdev)
> to reflect the state and activity of a net device.
>
> + The optional child node netdev can be used to
> + configure initial values for the link, rx, tx and
> + device_name properties. For example, setting
> + linux,default-trigger = "netdev" and adding the child
> + node
> +
> + netdev {
> + rx;
> + tx;
> + link;
> + device-name = "can0";
> + };
> +
> + can be used to replace 'linux,default-trigger =
> + "can0-rxtx"' that relies on the deprecated
> + CONFIG_CAN_LEDS.
I'm sorry, but no, not like this. I see it works for you, only having
single can device, but it would quickly break with two of them and two
ethernets are rather common.
So this will need to be device = <&phandle_of_ethernet_device> or
something like that. There may be example with usb port triggers.
Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists