From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=85.214.127.56 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796477894; b=NFkSI5Z3JiyWfUtOn/xcEQTWocoC/qNQLAfX12nGksDKZVhkceBDONUffBuXOKBAL9Mz KBvshPnpJyS3q9/JDJLX+KS3p7+YcoG2a0fSPthZEn1erbgAkD/Ta59fzuAH3EqQ3SMSS 0p5CQ90JWh7B+PghMmCJvRBWWoRxOxuwHoeQtnVzXB+MieeTuCeYUXD1Q9mCbdL2Gn3Eb HEjMma7yHKWYTh3gz9d66VwZPil838a8Y3uuutq/+f9mZn+vKokxjVV81I3t5sdyEaxZt UB6N5pWu2gR0wOKQDQK8lD1fUxm4+DY0/AcXKvdIGNpKI/vlYkXUB9rrn9WGqfOVTpA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796477894; h=DMARC-Filter:Received:DKIM-Signature:X-Virus-Scanned:Received: Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=3nPH6IlZON+ywJ0FQ6qp3xWf7qkenPOZ6hqjxUES6vM=; b=01gqLWTTRaw98k5MRThIEXGpyCpBHuwRPBaZxaslcpMJKf/8t1JJHBDUmox+tf1ZT30T 9v8BBSPNHjPVbMIVwG5T0ZtCKkvlQirWrz7Mfpxmr2IyrATBOCGBYDMaf1alFeoajCIkA rYDgRsUdQqH0gP67Pb9ut72URJHRGVZRmXsXWTaavfDtqXaFti+f5NCViLRxPmD6e0nWh 1fePqtmMjVGJD0oYfsxYBhnKu3m4/7O6sx7grRLLA67JTbLlUntahu4bzeu67iECdgHAa gWzk28yL0PjLEGRu7Tle/2cPOrvOLeZ8A+fgFeat93Ed0NbVvQLHLfWYCtIRbmh0QGg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=szelinsky.de; spf=pass smtp.mailfrom=szelinsky.de; dkim=temperror header.d=szelinsky.de header.i=@szelinsky.de header.a=rsa-sha256 header.s=mail header.b=b3aza46u; arc=none smtp.remote-ip=85.214.127.56 Received: from szelinsky.de (szelinsky.de [85.214.127.56]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E060606A32F; Sat, 5 Dec 2026 13:38:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3E060606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=szelinsky.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=szelinsky.de Authentication-Results: smtp.subspace.kernel.org; dkim=temperror header.d=szelinsky.de header.i=@szelinsky.de header.a=rsa-sha256 header.s=mail header.b=b3aza46u Received: from localhost (localhost [127.0.0.1]) by szelinsky.de (Postfix) with ESMTP id EA714E83135; Sat, 05 Dec 2026 14:38:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szelinsky.de; s=mail; t=1796477884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3nPH6IlZON+ywJ0FQ6qp3xWf7qkenPOZ6hqjxUES6vM=; b=b3aza46uYIbpWPcH3Gx+QhjZyYs1fsAxg1dT8rxAB87QdMzLQlb82CFQ1QNU3i7ti89xvD LUdFtn2HkbrlhiG4NL7whHHiRPRg71/ymlOpbld4SgvSO8ZHWh704/M42+CR7n5VxaDqaI ibfp7mUGNKAcnz46WUpvcopj7lIxo5bPKFs5rpBJRycllzKdb7FgmICQyK9MNo/EN/AqP7 RwNbsfv4mCrimXiqqwuP73+PD4okqg1yvviuEUENgFI7u6L3yRpy89sqTYmvVxXZjDm8+6 xGy/1ai7GyS6V0HtfVYI7YUZGgfKOGmffntD1DO0jDtxs0upbTPEyTgyMtP0Ow== X-Virus-Scanned: Debian amavis at szelinsky.de Received: from szelinsky.de ([127.0.0.1]) by localhost (szelinsky.de [127.0.0.1]) (amavis, port 10025) with ESMTP id jkDTyHvBuZWY; Sat, 5 Dec 2026 14:38:04 +0100 (CET) Received: from p14sgen5.netbird.selfhosted (dslb-088-070-183-026.088.070.pools.vodafone-ip.de [88.70.183.26]) by szelinsky.de (Postfix) with ESMTPSA; Sat, 05 Dec 2026 14:38:04 +0100 (CET) From: Carlo Szelinsky 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@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 Message-ID: <20261205133742.905114-1-github@szelinsky.de> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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