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 v6 0/2] net: pse-pd: add poll path and LED trigger support
Date: Sat, 28 Nov 2026 13:15:22 +0100 [thread overview]
Message-ID: <20261128121525.3909836-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 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
next reply other threads:[~2026-11-28 12:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 12:15 Carlo Szelinsky [this message]
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
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=20261128121525.3909836-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