mbox series

[net-next,v7,00/16] net: Add basic LED support for switch/phy

Message ID 20230417151738.19426-1-ansuelsmth@gmail.com (mailing list archive)
Headers show
Series net: Add basic LED support for switch/phy | expand

Message

Christian Marangi April 17, 2023, 3:17 p.m. UTC
This is a continue of [1]. It was decided to take a more gradual
approach to implement LEDs support for switch and phy starting with
basic support and then implementing the hw control part when we have all
the prereq done.

This series implements only the brightness_set() and blink_set() ops.
An example of switch implementation is done with qca8k.

For PHY a more generic approach is used with implementing the LED
support in PHY core and with the user (in this case marvell) adding all
the required functions.

Currently we set the default-state as "keep" to not change the default
configuration of the declared LEDs since almost every switch have a
default configuration.

[1] https://lore.kernel.org/lkml/20230216013230.22978-1-ansuelsmth@gmail.com/

Changes in new series v7:
- Drop ethernet-leds schema and add unevaluatedProperties to
  ethernet-controller and ethernet-phy schema
- Drop function-enumerator binding from schema example and DT
- Set devname_mandatory for qca8k leds and assign better name to LEDs
  using the format {slave_mii_bus id}:0{port number}:{color}:{function}
- Add Documentation patch for Correct LEDs naming from Andrew
- Changes in Andrew patch:
  - net: phy: Add a binding for PHY LEDs
    - Convert index from u32 to u8
  - net: phy: phy_device: Call into the PHY driver to set LED brightness
    - Fixup kernel doc
    - Convert index from u32 to u8
  - net: phy: marvell: Add software control of the LEDs
    - Convert index from u32 to u8
  - net: phy: phy_device: Call into the PHY driver to set LED blinking
    - Kernel doc fix
    - Convert index from u32 to u8
  - net: phy: marvell: Implement led_blink_set()
    - Convert index from u32 to u8
Changes in new series v6:
- Add leds-ethernet.yaml to document reg in led node
- Update ethernet-controller and ethernet-phy to follow new leds-ethernet schema
- Fix comments in qca8k-leds.c (at least -> at most)
  (wrong GENMASK for led phy 0 and 4)
- Add review and ack tag from Pavel Machek
- Changes in Andrew patch:
  - leds: Provide stubs for when CLASS_LED & NEW_LEDS are disabled
    - Change LED_CLASS to NEW_LEDS for led_init_default_state_get()
  - net: phy: Add a binding for PHY LEDs
    - Add dependency on LED_CLASS
    - Drop review tag from Michal Kubiak (patch modified)
Changes in new series v5:
- Rebase everything on top of net-next/main
- Add more info on LED probe fail for qca8k
- Drop some additional raw number and move to define in qca8k header
- Add additional info on LED mapping on qca8k regs
- Checks port number in qca8k switch port parse
- Changes in Andrew patch:
  - Add additional patch for stubs when CLASS_LED disabled
  - Drop CLASS_LED dependency for PHYLIB (to fix kbot errors reported)
Changes in new series v4:
- Changes in Andrew patch:
  - net: phy: Add a binding for PHY LEDs:
    - Rename phy_led: led_list to list
    - Rename phy_device: led_list to leds
    - Remove phy_leds_remove() since devm_ should do what is needed
    - Fixup documentation for struct phy_led
    - Fail probe on LED errors
  - net: phy: phy_device: Call into the PHY driver to set LED brightness
    - Moved phy_led::phydev from previous patch to here since it is first
      used here.
  - net: phy: marvell: Implement led_blink_set() 
    - Use int instead of unsigned
  - net: phy: marvell: Add software control of the LEDs
    - Use int instead of unsigned
- Add depends on LED_CLASS for qca8k Kconfig
- Fix Makefile for qca8k as suggested
- Move qca8k_setup_led_ctrl to separate header
- Move Documentation from dsa-port to ethernet-controller
- Drop trailing . from Andrew patch fro consistency
Changes in new series v3:
- Move QCA8K_LEDS Kconfig option from tristate to bool
- Use new helper led_init_default_state_get for default-state in qca8k
- Drop cled_qca8k_brightness_get() as there isn't a good way to describe
  the mode the led is currently in
- Rework qca8k_led_brightness_get() to return true only when LED is set
  to always ON
Changes in new series v2:
- Add LEDs node for rb3011
- Fix rb3011 switch node unevaluated properties while running 
  make dtbs_check
- Fix a copypaste error in qca8k-leds.c for port 4 required shift
- Drop phy-handle usage for qca8k and use qca8k_port_to_phy()
- Add review tag from Andrew
- Add Christian Marangi SOB in each Andrew patch
- Add extra description for dsa-port stressing that PHY have no access
  and LED are controlled by the related MAC
- Add missing additionalProperties for dsa-port.yaml and ethernet-phy.yaml

Changes from the old v8 series:
- Drop linux,default-trigger set to netdev.
- Dropped every hw control related patch and implement only
  blink_set and brightness_set
- Add default-state to "keep" for each LED node example

Andrew Lunn (8):
  leds: Provide stubs for when CLASS_LED & NEW_LEDS are disabled
  net: phy: Add a binding for PHY LEDs
  net: phy: phy_device: Call into the PHY driver to set LED brightness
  net: phy: marvell: Add software control of the LEDs
  net: phy: phy_device: Call into the PHY driver to set LED blinking
  net: phy: marvell: Implement led_blink_set()
  arm: mvebu: dt: Add PHY LED support for 370-rd WAN port
  Documentation: LEDs: Describe good names for network LEDs

Christian Marangi (8):
  net: dsa: qca8k: move qca8k_port_to_phy() to header
  net: dsa: qca8k: add LEDs basic support
  net: dsa: qca8k: add LEDs blink_set() support
  dt-bindings: net: ethernet-controller: Document support for LEDs node
  dt-bindings: net: dsa: qca8k: add LEDs definition example
  ARM: dts: qcom: ipq8064-rb3011: Drop unevaluated properties in switch
    nodes
  ARM: dts: qcom: ipq8064-rb3011: Add Switch LED for each port
  dt-bindings: net: phy: Document support for LEDs node

 .../devicetree/bindings/net/dsa/qca8k.yaml    |  22 ++
 .../bindings/net/ethernet-controller.yaml     |  35 +++
 .../devicetree/bindings/net/ethernet-phy.yaml |  43 +++
 Documentation/leds/well-known-leds.txt        |  30 ++
 arch/arm/boot/dts/armada-370-rd.dts           |  12 +
 arch/arm/boot/dts/qcom-ipq8064-rb3011.dts     | 124 +++++++-
 drivers/net/dsa/qca/Kconfig                   |   8 +
 drivers/net/dsa/qca/Makefile                  |   3 +
 drivers/net/dsa/qca/qca8k-8xxx.c              |  20 +-
 drivers/net/dsa/qca/qca8k-leds.c              | 277 ++++++++++++++++++
 drivers/net/dsa/qca/qca8k.h                   |  74 +++++
 drivers/net/dsa/qca/qca8k_leds.h              |  16 +
 drivers/net/phy/Kconfig                       |   1 +
 drivers/net/phy/marvell.c                     |  81 ++++-
 drivers/net/phy/phy_device.c                  | 103 +++++++
 include/linux/leds.h                          |  18 ++
 include/linux/phy.h                           |  41 +++
 17 files changed, 884 insertions(+), 24 deletions(-)
 create mode 100644 drivers/net/dsa/qca/qca8k-leds.c
 create mode 100644 drivers/net/dsa/qca/qca8k_leds.h

Comments

Jakub Kicinski April 19, 2023, 4:27 a.m. UTC | #1
On Mon, 17 Apr 2023 17:17:22 +0200 Christian Marangi wrote:
> This is a continue of [1]. It was decided to take a more gradual
> approach to implement LEDs support for switch and phy starting with
> basic support and then implementing the hw control part when we have all
> the prereq done.
> 
> This series implements only the brightness_set() and blink_set() ops.
> An example of switch implementation is done with qca8k.
> 
> For PHY a more generic approach is used with implementing the LED
> support in PHY core and with the user (in this case marvell) adding all
> the required functions.
> 
> Currently we set the default-state as "keep" to not change the default
> configuration of the declared LEDs since almost every switch have a
> default configuration.

IIRC we were supposed to take these via netdev with acks from Pavel/Lee.
So we need acks on patches 4/5/16 ? If there is a repost, could you
take out the arch/arm patches? They should not go via netdev, we'll try
to filter them out when applying but mistakes happen.
patchwork-bot+netdevbpf@kernel.org April 19, 2023, noon UTC | #2
Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Mon, 17 Apr 2023 17:17:22 +0200 you wrote:
> This is a continue of [1]. It was decided to take a more gradual
> approach to implement LEDs support for switch and phy starting with
> basic support and then implementing the hw control part when we have all
> the prereq done.
> 
> This series implements only the brightness_set() and blink_set() ops.
> An example of switch implementation is done with qca8k.
> 
> [...]

Here is the summary with links:
  - [net-next,v7,01/16] net: dsa: qca8k: move qca8k_port_to_phy() to header
    https://git.kernel.org/netdev/net-next/c/3e8b4d6277fd
  - [net-next,v7,02/16] net: dsa: qca8k: add LEDs basic support
    https://git.kernel.org/netdev/net-next/c/1e264f9d2918
  - [net-next,v7,03/16] net: dsa: qca8k: add LEDs blink_set() support
    https://git.kernel.org/netdev/net-next/c/91acadcc6e59
  - [net-next,v7,04/16] leds: Provide stubs for when CLASS_LED & NEW_LEDS are disabled
    https://git.kernel.org/netdev/net-next/c/e5029edd5393
  - [net-next,v7,05/16] net: phy: Add a binding for PHY LEDs
    https://git.kernel.org/netdev/net-next/c/01e5b728e9e4
  - [net-next,v7,06/16] net: phy: phy_device: Call into the PHY driver to set LED brightness
    https://git.kernel.org/netdev/net-next/c/684818189b04
  - [net-next,v7,07/16] net: phy: marvell: Add software control of the LEDs
    https://git.kernel.org/netdev/net-next/c/2d3960e58ef7
  - [net-next,v7,08/16] net: phy: phy_device: Call into the PHY driver to set LED blinking
    https://git.kernel.org/netdev/net-next/c/4e901018432e
  - [net-next,v7,09/16] net: phy: marvell: Implement led_blink_set()
    https://git.kernel.org/netdev/net-next/c/ea9e86485dec
  - [net-next,v7,10/16] dt-bindings: net: ethernet-controller: Document support for LEDs node
    https://git.kernel.org/netdev/net-next/c/57b6c752c5c0
  - [net-next,v7,11/16] dt-bindings: net: dsa: qca8k: add LEDs definition example
    https://git.kernel.org/netdev/net-next/c/ed617bc022f4
  - [net-next,v7,12/16] ARM: dts: qcom: ipq8064-rb3011: Drop unevaluated properties in switch nodes
    https://git.kernel.org/netdev/net-next/c/939595c79d12
  - [net-next,v7,13/16] ARM: dts: qcom: ipq8064-rb3011: Add Switch LED for each port
    https://git.kernel.org/netdev/net-next/c/09930f1fb875
  - [net-next,v7,14/16] dt-bindings: net: phy: Document support for LEDs node
    https://git.kernel.org/netdev/net-next/c/18a24b694a2b
  - [net-next,v7,15/16] arm: mvebu: dt: Add PHY LED support for 370-rd WAN port
    https://git.kernel.org/netdev/net-next/c/380a8fe1b2f4
  - [net-next,v7,16/16] Documentation: LEDs: Describe good names for network LEDs
    https://git.kernel.org/netdev/net-next/c/c693ea2fd6e3

You are awesome, thank you!
Andrew Lunn April 19, 2023, 12:20 p.m. UTC | #3
> IIRC we were supposed to take these via netdev with acks from Pavel/Lee.
> So we need acks on patches 4/5/16 ? If there is a repost, could you
> take out the arch/arm patches? They should not go via netdev, we'll try
> to filter them out when applying but mistakes happen.

The 370rd patch could in theory go via netdev. I maintain it, both at
the board and mvebu SoC level, so can give my Acked-by:, in addition
to my Signed-off-by:. It is very unlikely there will be any sort of
merge conflict.

      Andrew
Andrew Lunn April 19, 2023, 12:21 p.m. UTC | #4
> IIRC we were supposed to take these via netdev with acks from Pavel/Lee.
> So we need acks on patches 4/5/16 ? If there is a repost, could you
> take out the arch/arm patches? They should not go via netdev, we'll try
> to filter them out when applying but mistakes happen.

Ah, mute point now, the whole patchset has been merged.

    Andrew