From: "Marek Behún" <kabel@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Christian Marangi <ansuelsmth@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Gregory Clement <gregory.clement@bootlin.com>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
John Crispin <john@phrozen.org>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, Lee Jones <lee@kernel.org>,
linux-leds@vger.kernel.org
Subject: Re: [net-next PATCH v4 04/14] net: phy: Add a binding for PHY LEDs
Date: Fri, 17 Mar 2023 15:29:03 +0100 [thread overview]
Message-ID: <20230317152903.5103f2c4@dellmb> (raw)
In-Reply-To: <6cf03603-2a8e-4c08-a61b-aef164a0f5d9@lunn.ch>
On Fri, 17 Mar 2023 14:55:11 +0100
Andrew Lunn <andrew@lunn.ch> wrote:
> On Fri, Mar 17, 2023 at 08:45:19AM +0100, Marek Behún wrote:
> > On Fri, 17 Mar 2023 03:31:15 +0100
> > Christian Marangi <ansuelsmth@gmail.com> wrote:
> >
> > > + cdev->brightness_set_blocking = phy_led_set_brightness;
> > > + cdev->max_brightness = 1;
> > > + init_data.devicename = dev_name(&phydev->mdio.dev);
> > > + init_data.fwnode = of_fwnode_handle(led);
> > > +
> > > + err = devm_led_classdev_register_ext(dev, cdev, &init_data);
> >
> > Since init_data.devname_mandatory is false, devicename is ignored.
> > Which is probably good, becuse the device name of a mdio device is
> > often ugly, taken from devicetree or switch drivers, for example:
> > f1072004.mdio-mii
> > fixed-0
> > mv88e6xxx-1
> > So either don't fill devicename or use devname_mandatory (and maybe
> > fill devicename with something less ugly, but I guess if we don't have
> > much choice if we want to keep persistent names).
> >
> > Without devname_mandatory, the name of the LED classdev will be of the
> > form
> > color:function[-function-enumerator],
> > i.e.
> > green:lan
> > amber:lan-1
> >
> > With multiple switch ethenret ports all having LAN function, it is
> > worth noting that the function enumerator must be explicitly used in the
> > devicetree, otherwise multiple LEDs will be registered under the same
> > name, and the LED subsystem will add a number at the and of the name
> > (function led_classdev_next_name), resulting in names
> > green:lan
> > green:lan_1
> > green:lan_2
> > ...
>
> I'm testing on a Marvell RDK, with limited LEDs. It has one LED on the
> front port to represent the WAN port. The DT patch is at the end of
> the series. With that, i end up with:
>
> root@370rd:/sys/class/leds# ls -l
> total 0
> lrwxrwxrwx 1 root root 0 Mar 17 01:10 f1072004.mdio-mii:00:WAN -> ../../devices/platform/soc/soc:interna
> l-regs/f1072004.mdio/mdio_bus/f1072004.mdio-mii/f1072004.mdio-mii:00/leds/f1072004.mdio-mii:00:WAN
>
> I also have:
>
> root@370rd:/sys/class/net/eth0/phydev/leds# ls
> f1072004.mdio-mii:00:WAN
Hmm, yes I see. If label is specified, devicename is used even if
devname_mandatory is false.
> f1072004.mdio-mii:00: is not nice, but it is unique to a netdev. The
> last part then comes from the label property. Since there is only one
> LED, i went with what the port is intended to be used as. If there had
> been more LEDs, i would of probably used labels like "LINK" and
> "ACTIVITY", since that is often what they reset default
> to. Alternatively, you could names the "Left" and "Right", which does
> suggest they can be given any function.
>
> I don't actually think the name is too important, so long as it is
> unique. You are going to find it via /sys/class/net. MAC LEDs should
> be /sys/class/net/eth42/leds, and PHY LEDs will be
> /sys/class/net/phydev/leds.
Maybe the name may not be that important from the perspective of a user
who just wants to find the LED for a given phy, yes, but the
proposal of how LED classdev should be named was done in good faith
and accepted years ago. The documentation still defines the name format
and until that part of documenation is changed, I think we should at
least try to follow it.
Also, the label DT property has been deprecated for LEDs. IMO it should
be removed from that last patch of this series.
> It has been discussed in the past to either extend ethtool to
> understand this, or write a new little tool to make it easier to
> manipulate these LEDs.
Yes, and this would solve the problem for a user who wants to change
the behaviour of a LED for a given PHY. But a user who wants to list
all available LEDs by listing /sys/class/leds can also retrieve a nice
list of names that make sense, if the documented format is followed.
Marek
next prev parent reply other threads:[~2023-03-17 14:29 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 2:31 [net-next PATCH v4 00/14] net: Add basic LED support for switch/phy Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 01/14] net: dsa: qca8k: move qca8k_port_to_phy() to header Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 02/14] net: dsa: qca8k: add LEDs basic support Christian Marangi
2023-03-17 11:24 ` Michal Kubiak
2023-03-17 13:34 ` Andrew Lunn
2023-03-17 14:01 ` Christian Marangi
2023-03-17 18:05 ` Michal Kubiak
2023-03-18 18:54 ` Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 03/14] net: dsa: qca8k: add LEDs blink_set() support Christian Marangi
2023-03-17 11:54 ` Michal Kubiak
2023-03-17 14:03 ` Christian Marangi
2023-03-18 19:14 ` Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 04/14] net: phy: Add a binding for PHY LEDs Christian Marangi
2023-03-17 7:45 ` Marek Behún
2023-03-17 13:55 ` Andrew Lunn
2023-03-17 14:29 ` Marek Behún [this message]
2023-03-17 15:31 ` Andrew Lunn
2023-03-17 13:38 ` Michal Kubiak
2023-03-17 14:03 ` Andrew Lunn
2023-03-17 15:12 ` Michal Kubiak
2023-03-17 2:31 ` [net-next PATCH v4 05/14] net: phy: phy_device: Call into the PHY driver to set LED brightness Christian Marangi
2023-03-17 14:01 ` Michal Kubiak
2023-03-17 2:31 ` [net-next PATCH v4 06/14] net: phy: marvell: Add software control of the LEDs Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 07/14] net: phy: phy_device: Call into the PHY driver to set LED blinking Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 08/14] net: phy: marvell: Implement led_blink_set() Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 09/14] dt-bindings: net: ethernet-controller: Document support for LEDs node Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 10/14] dt-bindings: net: dsa: qca8k: add LEDs definition example Christian Marangi
2023-03-17 8:14 ` Marek Behún
2023-03-17 14:09 ` Christian Marangi
2023-03-17 14:22 ` Andrew Lunn
2023-03-17 16:02 ` Andrew Lunn
2023-03-17 2:31 ` [net-next PATCH v4 11/14] arm: qcom: dt: Drop unevaluated properties in switch nodes for rb3011 Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 12/14] arm: qcom: dt: Add Switch LED for each port " Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 13/14] dt-bindings: net: phy: Document support for LEDs node Christian Marangi
2023-03-17 2:31 ` [net-next PATCH v4 14/14] arm: mvebu: dt: Add PHY LED support for 370-rd WAN port Christian Marangi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230317152903.5103f2c4@dellmb \
--to=kabel@kernel.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=gregory.clement@bootlin.com \
--cc=hkallweit1@gmail.com \
--cc=john@phrozen.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).