From: Carlo Szelinsky <github@szelinsky.de>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
Kory Maincent <kory.maincent@bootlin.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>,
Jonas Jelonek <jelonek.jonas@gmail.com>,
Ross Cawston <ross@r-sc.ca>,
netdev@vger.kernel.org, linux-leds@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH net-next v7 0/2] net: pse-pd: add poll path and LED trigger support
Date: Sat, 5 Dec 2026 14:37:40 +0100 [thread overview]
Message-ID: <20261205133742.905114-1-github@szelinsky.de> (raw)
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
next reply other threads:[~2026-12-05 13:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 13:37 Carlo Szelinsky [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261205133742.905114-1-github@szelinsky.de \
--to=github@szelinsky.de \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=jelonek.jonas@gmail.com \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=pavel@kernel.org \
--cc=ross@r-sc.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox