mbox series

[0/2] net: phy: dp83867: Configure LED modes via device tree

Message ID 20210319155710.2793637-1-m.tretter@pengutronix.de (mailing list archive)
Headers show
Series net: phy: dp83867: Configure LED modes via device tree | expand

Message

Michael Tretter March 19, 2021, 3:57 p.m. UTC
Hello,

The dp83867 has 4 LED pins, which can be multiplexed with different functions
of the phy.

This series adds a device tree binding to describe the multiplexing of the
functions to the LEDs and implements the binding for the dp83867 phy.

I found existing bindings for configuring the LED modes for other phys:

In Documentation/devicetree/bindings/net/micrel.txt, the binding is not
flexible enough for the use case in the dp83867, because there is a value for
each LED configuration, which would be a lot of values for the dp83867.

In Documentation/devicetree/bindings/net/mscc-phy-vsc8532.txt, there is a
separate property for each LED, which would work, but I found rather
unintuitive compared to how clock bindings etc. work.

The new binding defines two properties: one for the led names and another
property for the modes of the LEDs with defined values in the same order.
Currently, the binding is specific to the dp83867, but I guess that the
binding could be made more generic and used for other phys, too.

Let me know, what you think.

Michael

Michael Tretter (1):
  dt-bindings: dp83867: Add binding for LED mode configuration

Thomas Haemmerle (1):
  net: phy: dp83867: add support for changing LED modes

 .../devicetree/bindings/net/ti,dp83867.yaml   | 24 ++++++++
 drivers/net/phy/dp83867.c                     | 57 +++++++++++++++++++
 include/dt-bindings/net/ti-dp83867.h          | 16 ++++++
 3 files changed, 97 insertions(+)

Comments

Andrew Lunn March 19, 2021, 9:19 p.m. UTC | #1
On Fri, Mar 19, 2021 at 04:57:08PM +0100, Michael Tretter wrote:
> Hello,
> 
> The dp83867 has 4 LED pins, which can be multiplexed with different functions
> of the phy.
> 
> This series adds a device tree binding to describe the multiplexing of the
> functions to the LEDs and implements the binding for the dp83867 phy.
> 
> I found existing bindings for configuring the LED modes for other phys:
> 
> In Documentation/devicetree/bindings/net/micrel.txt, the binding is not
> flexible enough for the use case in the dp83867, because there is a value for
> each LED configuration, which would be a lot of values for the dp83867.
> 
> In Documentation/devicetree/bindings/net/mscc-phy-vsc8532.txt, there is a
> separate property for each LED, which would work, but I found rather
> unintuitive compared to how clock bindings etc. work.
> 
> The new binding defines two properties: one for the led names and another
> property for the modes of the LEDs with defined values in the same order.
> Currently, the binding is specific to the dp83867, but I guess that the
> binding could be made more generic and used for other phys, too.

There is some work going on to manage PHY LEDs just like other LEDs in
Linux, using /sys/class/leds.

Please try to help out with that work, rather than adding yet another
DT binding.

   Andrew
Michael Tretter March 22, 2021, 7:39 a.m. UTC | #2
On Fri, 19 Mar 2021 22:19:44 +0100, Andrew Lunn wrote:
> On Fri, Mar 19, 2021 at 04:57:08PM +0100, Michael Tretter wrote:
> > The dp83867 has 4 LED pins, which can be multiplexed with different functions
> > of the phy.
> > 
> > This series adds a device tree binding to describe the multiplexing of the
> > functions to the LEDs and implements the binding for the dp83867 phy.
> > 
> > I found existing bindings for configuring the LED modes for other phys:
> > 
> > In Documentation/devicetree/bindings/net/micrel.txt, the binding is not
> > flexible enough for the use case in the dp83867, because there is a value for
> > each LED configuration, which would be a lot of values for the dp83867.
> > 
> > In Documentation/devicetree/bindings/net/mscc-phy-vsc8532.txt, there is a
> > separate property for each LED, which would work, but I found rather
> > unintuitive compared to how clock bindings etc. work.
> > 
> > The new binding defines two properties: one for the led names and another
> > property for the modes of the LEDs with defined values in the same order.
> > Currently, the binding is specific to the dp83867, but I guess that the
> > binding could be made more generic and used for other phys, too.
> 
> There is some work going on to manage PHY LEDs just like other LEDs in
> Linux, using /sys/class/leds.
> 
> Please try to help out with that work, rather than adding yet another
> DT binding.

Oh, thanks. That's even better.

For reference: https://lore.kernel.org/netdev/20190813191147.19936-1-mka@chromium.org/

Michael