Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v7 0/2] net: pse-pd: add poll path and LED trigger support
@ 2026-12-05 13:37 Carlo Szelinsky
  2026-12-05 13:37 ` [PATCH net-next v7 1/2] net: pse-pd: add devm_pse_poll_helper() Carlo Szelinsky
  2026-12-05 13:37 ` [PATCH net-next v7 2/2] net: pse-pd: add LED triggers for each PI Carlo Szelinsky
  0 siblings, 2 replies; 3+ messages in thread
From: Carlo Szelinsky @ 2026-12-05 13:37 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 devm_pse_poll_helper(). The core calls the driver's
map_event() about every 500 ms and handles the events like the IRQ
path does.

Patch 2 adds two LED triggers per PI, "delivering" and "enabled". Both
work on every controller. As most drivers report no event when the
power comes on, the core reads "delivering" every second while an LED
uses it.

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: both triggers work with
every in-tree driver.

Lee, Pavel: 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, and
"delivering" is read every second while an LED uses it. Is that fine,
or would you prefer one trigger with a per-LED port setting, like
ledtrig-netdev?

Under software power control, a polled driver also needs Kory's fix
"net: pse-pd: fix bogus budget evaluation strategy check in IRQ
handler". A poll often reports a detection together with a
classification. Without the fix, the core then ignores all events of
that PI in this poll, so it does not power the PD. 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 in a test build, bind/unbind loops, fake LEDs, power changes
without events), 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. The IP804AR driver is build-tested only.

Changes in v7:
- Rebased on net-next.
- Poll helper:
  - The poll state is now in struct pse_poll, which only the core
    knows (Kory).
  - Removed poll_interval_ms. The interval is fixed at 500 ms, as no
    driver needs another one yet (Kory).
  - Renamed back to devm_pse_poll_helper(), as it now allocates the
    poll state with devm.
  - Shorter comments (Kory).
  - The map_event() doc says that irq is 0 when polling (Kory), and
    that it must report only new events (sashiko).
  - devm_pse_poll_helper() and devm_pse_irq_helper() now reject a
    second event source (sashiko).
  - Comments that named only pse_isr() now say "the event handler"
    (sashiko).
- LED triggers:
  - Both triggers are registered for every PI, in one place (Kory).
  - New Kconfig option PSE_LED_TRIGGERS, like LED_TRIGGER_PHY.
  - "delivering" now works on every controller: while an LED uses it,
    the core reads the power state every second (sashiko). On a slow
    controller, the pause after a round is at least as long as the
    round took (sashiko).
  - One failed read no longer stops the other trigger of a PI.
  - The "enabled" LEDs are updated once the power domains exist, and
    when the IRQ starts software power control (sashiko).
  - Trigger names use "pi" instead of "port", like the PI regulators.
  - A trigger that fails to register only gives a warning, and only
    its PI is affected.
  - Binding an LED after a failed read shows off, not an old state,
    when no other LED uses the trigger.
  - The triggers are now in struct pse_pi, as a pointer to a struct
    that only the core knows (Kory).
  - "enabled" is now also updated when a PHY first gets a PI that is
    already on, under software power control (sashiko).
  - No inline in the .c file (Kory).
  - pi[].pw_d is now set under pcdev->lock, as an LED can be bound
    before the power domains exist (sashiko).
- Commit messages focus on the why (Kory).

v6: https://lore.kernel.org/all/20261128121525.3909836-1-github@szelinsky.de/

Carlo Szelinsky (2):
  net: pse-pd: add devm_pse_poll_helper()
  net: pse-pd: add LED triggers for each PI

 drivers/net/pse-pd/Kconfig    |  10 +
 drivers/net/pse-pd/pse_core.c | 606 +++++++++++++++++++++++++++++++---
 include/linux/pse-pd/pse.h    |  29 +-
 3 files changed, 598 insertions(+), 47 deletions(-)


base-commit: c1165beb053a652299b1503b2dd7674ced0b1596
-- 
2.43.0


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

end of thread, other threads:[~2026-12-05 13:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 13:37 [PATCH net-next v7 0/2] net: pse-pd: add poll path and LED trigger support Carlo Szelinsky
2026-12-05 13:37 ` [PATCH net-next v7 1/2] net: pse-pd: add devm_pse_poll_helper() Carlo Szelinsky
2026-12-05 13:37 ` [PATCH net-next v7 2/2] net: pse-pd: add LED triggers for each PI Carlo Szelinsky

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