Linux LED subsystem development
 help / color / mirror / Atom feed
* [PATCH net-next v6 0/2] net: pse-pd: add poll path and LED trigger support
@ 2026-11-28 12:15 Carlo Szelinsky
  2026-11-28 12:15 ` [PATCH net-next v6 1/2] net: pse-pd: add pse_poll_helper() Carlo Szelinsky
  2026-11-28 12:15 ` [PATCH net-next v6 2/2] net: pse-pd: add LED trigger support via notification path Carlo Szelinsky
  0 siblings, 2 replies; 3+ messages in thread
From: Carlo Szelinsky @ 2026-11-28 12:15 UTC (permalink / raw)
  To: Oleksij Rempel, Kory Maincent
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Lee Jones, Pavel Machek, Jonas Jelonek, Ross Cawston,
	netdev, linux-leds, linux-kernel

Some PSE controllers have no IRQ line, and boards want to show the PoE
state of each port on an LED. This series adds both.

Patch 1 adds pse_poll_helper(). The core calls the driver's
map_event() from a delayed work and handles the events like the IRQ
path does.

Patch 2 adds two LED triggers per PI, "delivering" and "enabled".
"delivering" needs events, so it exists only on a controller with an
IRQ or polling. "enabled" works on every controller.

The poll helper has no in-tree user yet. The users I know of are out
of tree: the IP804AR driver in OpenWrt and an HS104 driver (S600WP
switch). Patch 2 is also useful without them: "enabled" works on every
controller, and "delivering" on IRQ controllers such as tps23881.

Two questions:

1. The triggers are per PI, as phy_led_triggers.c does it per PHY. That
   is up to 96 triggers on a 48-port controller. Is this fine, or do
   you prefer one trigger with a per-LED port setting, like
   ledtrig-netdev?

2. Kory: with the "disabled" budget strategy, a polled controller keeps
   the power control in hardware. pse_pw_d_is_sw_pw_control() takes it
   over only for an IRQ controller, and polled drivers may not report
   the events that software control needs. Is that what you want, or
   should a driver opt in to software control explicitly?

A polled driver also needs Kory's fix "net: pse-pd: fix bogus budget
evaluation strategy check in IRQ handler", as a poll often reports
DETECTION together with other events. It is not a build dependency:
https://lore.kernel.org/netdev/20261126143012.1595919-1-kory.maincent@bootlin.com/

Testing: on an S600WP switch with the HS104 PSE chip, polled, with
LEDs on both triggers, plugging and unplugging PDs, and unbinding and
binding the driver. Also in QEMU arm64 with fake PSE controllers
(polling every 1 ms, bind/unbind loops, fake LEDs), with KASAN,
kmemleak and lockdep. Kory's fix was applied for the tests.
Lockdep reports one inversion between pcdev->lock and the regulator
supply lock. It is in net-next without this series too.

Changes in v6:
- Rebased on net-next, which now has the teardown fixes that v5
  waited for.
- Poll helper:
  - Renamed devm_pse_poll_helper() to pse_poll_helper(), as it adds no
    devres action.
  - Must be called before the controller registers (-EBUSY and a WARN
    after). The register call allocates the poll buffers once nr_lines
    is final, and starts the work as its last step (Jakub, Oleksij).
  - The work runs on system_freezable_power_efficient_wq.
  - A failing map_event() is logged once when it starts failing and
    once when it works again.
  - d->name is optional. The comments that said events need an IRQ
    now also cover polling.
- LED triggers:
  - Registered before the PI regulators. A failure now fails the
    probe (Jakub, Oleksij).
  - "delivering" only with an IRQ or polling.
  - "enabled" shows the admin state as ethtool reports it, also under
    software power control.
  - Also updated when the core switches a PI for the power budget.
  - The PI state is read only while an LED is bound, and only the
    state that LED shows. Bound LEDs are counted in .activate and
    .deactivate. No hardware reads at probe.

v5: https://lore.kernel.org/all/20260429213224.1747410-1-github@szelinsky.de/

Carlo Szelinsky (2):
  net: pse-pd: add pse_poll_helper()
  net: pse-pd: add LED trigger support via notification path

 drivers/net/pse-pd/pse_core.c | 490 ++++++++++++++++++++++++++++++++--
 include/linux/pse-pd/pse.h    |  31 ++-
 2 files changed, 488 insertions(+), 33 deletions(-)


base-commit: f89726ffabef1b08c52e6163b7ab94b0d5f15503
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-28 12:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 12:15 [PATCH net-next v6 0/2] net: pse-pd: add poll path and LED trigger support Carlo Szelinsky
2026-11-28 12:15 ` [PATCH net-next v6 1/2] net: pse-pd: add pse_poll_helper() Carlo Szelinsky
2026-11-28 12:15 ` [PATCH net-next v6 2/2] net: pse-pd: add LED trigger support via notification path Carlo Szelinsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox