From: Christian Marangi <ansuelsmth@gmail.com>
To: "Marek Behún" <kabel@kernel.org>
Cc: Andrew Lunn <andrew@lunn.ch>, Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, Lee Jones <lee@kernel.org>,
linux-leds@vger.kernel.org, pavel@ucw.cz,
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>,
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, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org
Subject: Re: [net-next PATCH v4 10/14] dt-bindings: net: dsa: qca8k: add LEDs definition example
Date: Fri, 17 Mar 2023 15:09:09 +0100 [thread overview]
Message-ID: <64147488.df0a0220.5d091.cce2@mx.google.com> (raw)
In-Reply-To: <20230317091410.58787646@dellmb>
On Fri, Mar 17, 2023 at 09:14:10AM +0100, Marek Behún wrote:
> Hello Christian, also Rob Herring, Andrew Lunn and Pavel Machek,
>
> On Fri, 17 Mar 2023 03:31:21 +0100
> Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> > Add LEDs definition example for qca8k Switch Family to describe how they
> > should be defined for a correct usage.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> > .../devicetree/bindings/net/dsa/qca8k.yaml | 24 +++++++++++++++++++
> > 1 file changed, 24 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> > index 389892592aac..2e9c14af0223 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> > @@ -18,6 +18,8 @@ description:
> > PHY it is connected to. In this config, an internal mdio-bus is registered and
> > the MDIO master is used for communication. Mixed external and internal
> > mdio-bus configurations are not supported by the hardware.
> > + Each phy has at least 3 LEDs connected and can be declared
> > + using the standard LEDs structure.
> >
> > properties:
> > compatible:
> > @@ -117,6 +119,7 @@ unevaluatedProperties: false
> > examples:
> > - |
> > #include <dt-bindings/gpio/gpio.h>
> > + #include <dt-bindings/leds/common.h>
> >
> > mdio {
> > #address-cells = <1>;
> > @@ -226,6 +229,27 @@ examples:
> > label = "lan1";
> > phy-mode = "internal";
> > phy-handle = <&internal_phy_port1>;
> > +
> > + leds {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > +
> > + led@0 {
> > + reg = <0>;
> > + color = <LED_COLOR_ID_WHITE>;
> > + function = LED_FUNCTION_LAN;
> > + function-enumerator = <1>;
> > + default-state = "keep";
> > + };
> > +
> > + led@1 {
> > + reg = <1>;
> > + color = <LED_COLOR_ID_AMBER>;
> > + function = LED_FUNCTION_LAN;
> > + function-enumerator = <1>;
> > + default-state = "keep";
> > + };
> > + };
> > };
>
> I have nothing against this, but I would like to point out the
> existence of the trigger-sources DT property, and I would like to
> discuss how this property should be used by the LED subsystem to choose
> default behaviour of a LED.
>
> Consider that we want to specify in device-tree that a PHY LED (or any
> other LED) should blink on network activity of the network device
> connected to this PHY (let's say the attached network device is eth0).
> (Why would we want to specify this in devicetree? Because currently the
> drivers either keep the behaviour from boot or change it to something
> specific that is not configurable.)
>
> We could specify in DT something like:
> eth0: ethernet-controller {
> ...
> }
>
> ethernet-phy {
> leds {
> led@0 {
> reg = <0>;
> color = <LED_COLOR_ID_GREEN>;
> trigger-sources = <ð0>;
> function = LED_FUNCTION_ ?????? ;
> }
> }
> }
>
> The above example specifies that the LED has a trigger source (eth0),
> but we still need to specify the trigger itself (for example that
> the LED should blink on activity, or the different kinds of link). In my
> opinion, this should be specified by the function property, but this
> property is currently used in other way: it is filled in with something
> like "wan" or "lan" or "wlan", an information which, IMO,
> should instead come from the devicename part of the LED, not the
> function part.
>
> Recall that the LED names are of the form
> devicename:color:function
> where the devicename part is supposed to be something like mmc0 or
> sda1. With LEDs that are associated with network devices I think the
> corresponding name should be the name of the network device (like eth0),
> but there is the problem of network namespaces and also that network
> devices can be renamed :(.
>
> So one option how to specify the behaviour of the LED to blink on
> activity would be to set
> function = LED_FUNCTION_ACTIVITY;
> but this would conflict with how currently some devicetrees use "lan",
> "wlan" or "wan" as the function (which is IMO incorrect, as I said
> above).
>
> Another option would be to ignore the function and instead use
> additional argument in the trigger-source property, something like
> trigger-sources = <ð0 TRIGGER_SOURCE_ACTIVITY>;
>
> I would like to start a discussion on this and hear about your opinions,
> because I think that the trigger-sources and function properties were
> proposed in good faith, but currently the implementation and usage is a
> mess.
>
I think we should continue and make this discussion when we start
implementing the hw contro for these LEDs to configure them in DT.
Currently we are implementing very basic support so everything will be
in sw.
Anyway just to give some ideas. Yes it sound a good idea to use the
trigger-sources binding. My idea would be that trigger needs to have
specific support for them.
If this in mind netdev can be configured in DT and setup hw control to
offload blink with the required interface passed.
The current implementation still didn't include a way to configure the
blink in DT as the series are already a bit big... (currently we have 3:
- This series that already grow from 10 patch to 14
- A cleanup series for netdev trigger that is already 7 patch
- hw control that is another big boy with 12 patch
)
So our idea was to first implement the minor things and then polish and
improve it. (to make it easier to review)
But agree with you that it would be a nice idea to have a correct and
good implementation for trigger-sources.
--
Ansuel
next prev parent reply other threads:[~2023-03-17 14:09 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
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 [this message]
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=64147488.df0a0220.5d091.cce2@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=andrew@lunn.ch \
--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=kabel@kernel.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=pavel@ucw.cz \
--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).