Re: [net-next PATCH v6 12/16] dt-bindings: net: dsa: qca8k: add LEDs definition example

From: Andrew Lunn
Date: Thu Apr 13 2023 - 09:49:27 EST


> > > 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>;
> >
> > Isn't function-enumerator supposed to be unique within a given
> > 'function'?
> >
>
> In the following example the output would be:
> - amber:lan-1
> - white:lan-1
>
> So in theory it's unique for the same color and function. Is it
> acceptable? Seems sane that there may be multiple color for the same
> function (and enum)

But what does the -1 actually mean?

At Pavel's request, i documented 'good' names for these LEDs. I
suggested that if there are multiple LEDs for one MAC/PHY, you use
something like 'left' or 'right' to indicate their position on the
RJ45 socket. That has a clear meaning.

Andrew