From: Josef Schlehofer <pepe.schlehofer@gmail.com>
To: Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: "Pali Rohár" <pali@kernel.org>, "Marek Behún" <kabel@kernel.org>,
"Andy Shevchenko" <andy@kernel.org>, "Rong Zhang" <i@rong.moe>,
linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 0/2] leds: Add support for CZ.NIC Turris 1.x LEDs
Date: Mon, 28 Sep 2026 13:19:05 +0200 [thread overview]
Message-ID: <20260928111907.72592-1-pepe.schlehofer@gmail.com> (raw)
The CZ.NIC Turris 1.x routers have eight RGB LEDs on the front panel,
driven by the CZ.NIC CPLD firmware. arch/powerpc/boot/dts/turris1x.dts
already describes the LED controller, but there is no driver for it, so
Linux cannot control these LEDs.
Pali posted v1 and v2 in July 2022 [1][2] and a RESEND in December 2022
[3]. The RESEND did not address the review of v2, and Krzysztof NAKed
the binding [4] and objected to the driver [5] for that reason. Lee
asked Pavel whether he was happy with the user-space interface [6] and
later reviewed the driver [7]. Pali answered part of that review [8],
but no new version followed.
I am picking the series up. Most of the driver was reworked for v3;
authorship stays with Pali as the original author. The changelog of
each patch lists the changes and, for the review points that did not
lead to a change, the reason.
On the user-space interface: the global brightness follows the Turris
Omnia driver, which already has /sys/class/leds/<led>/device/brightness
[9]. The Turris 1.x uses the same attribute, documented in the same ABI
entry. Marek asked in the v1 review for the index of the selected level
[10], which is brightness_level, and Lee asked for one value per file
instead of the eight values in one brightness_values file [7], which
are now brightness_levels/<N>.
Marek, patch 2/2 extends the brightness entry in
Documentation/ABI/testing/sysfs-class-led-driver-turris-omnia and adds
that file to the new MAINTAINERS entry. Could you ack that part?
The series is based on leds/for-leds-next (05b4738b0078). The driver
implements hw_offloaded() for its private trigger and sets
hw_control_trigger, as the hardware control changes there require, so
it does not build on mainline yet.
Testing on a Turris 1.1:
- With OpenWrt's 6.18.44 kernel, the driver as it was before that
adaptation, built as a module: colour and brightness, the brightness
level attributes including invalid writes, the timer trigger, the
turris1x-cpld hardware trigger, unbind and bind, and rmmod while
triggers ran and a level file was held open, also watched at the
panel. After a reboot, the CPLD registers read at the U-Boot prompt
still had the WiFi LED's disable bit that the shutdown handler sets,
and after sysrq-b, which skips the shutdown, the bit was clear. With
linux,default-trigger set in the device tree, the driver took those
LEDs over from the CPLD, and the turris1x-cpld trigger gave them back.
- With a kernel built from leds/for-leds-next and this series, the
driver built in: the LEDs except the WiFi LED start under the
turris1x-cpld trigger, which trigger_may_offload_to_hw reports as
offloaded and under which reading brightness returns ENODATA. Writing
a brightness drops the trigger, writing multi_intensity keeps it, the
timer trigger works, and unbind and bind give the LEDs back to the
CPLD. The WiFi LED has no trigger_may_offload_to_hw. The panel showed
the same.
The lines were rewrapped at 100 columns after these runs, which changes
no object code (objdump -dr). Neither kernel had lock debugging.
dt_binding_check with dtschema 2026.9 is clean and rejects a bogus
property added to the example, dtbs_check reports no warning for the LED
controller in turris1x.dtb, and tools/docs/get_abi.py reports no new
warning. checkpatch --strict reports only the MAINTAINERS question on
1/2, answered in its changelog, and a macro argument reuse check on 2/2,
where the argument is always a literal. Built with W=1 and sparse on
leds/for-leds-next (05b4738b0078) for powerpc, as a module and built in
(vmlinux links), and with COMPILE_TEST for x86_64 and arm64 as a module.
[1] https://lore.kernel.org/r/20220705000448.14337-1-pali@kernel.org/
[2] https://lore.kernel.org/r/20220705155929.25565-1-pali@kernel.org/
[3] https://lore.kernel.org/r/20221226123630.6515-1-pali@kernel.org/
[4] https://lore.kernel.org/r/8b829332-5cd7-2910-88db-513716e0919a@kernel.org/
[5] https://lore.kernel.org/r/d8172c80-a3a0-07f6-97ea-9130c49fab18@kernel.org/
[6] https://lore.kernel.org/r/Y9Ozg2O41a2iijMc@google.com/
[7] https://lore.kernel.org/r/Y/iDVlodp9sBkX9D@google.com/
[8] https://lore.kernel.org/r/20230309203526.5hcfa2w47vqzmny6@pali/
[9] https://lore.kernel.org/r/20230202234653.ukwpjntws3roacty@pali/
[10] https://lore.kernel.org/r/20220705143001.7371a256@thinkpad/
Pali Rohár (2):
dt-bindings: leds: Add CZ.NIC Turris 1.x LED controller
leds: Add support for Turris 1.x LEDs
.../sysfs-class-led-driver-turris-omnia | 13 +-
.../testing/sysfs-class-led-driver-turris1x | 23 +
.../bindings/leds/cznic,turris1x-leds.yaml | 132 ++++
MAINTAINERS | 10 +
drivers/leds/Kconfig | 13 +
drivers/leds/Makefile | 1 +
drivers/leds/leds-turris-1x.c | 609 ++++++++++++++++++
7 files changed, 798 insertions(+), 3 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-class-led-driver-turris1x
create mode 100644 Documentation/devicetree/bindings/leds/cznic,turris1x-leds.yaml
create mode 100644 drivers/leds/leds-turris-1x.c
base-commit: 05b4738b0078f7d6f154f68068a11c8a0635e9df
--
2.54.0 (Apple Git-157)
next reply other threads:[~2026-09-28 11:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 11:19 Josef Schlehofer [this message]
2026-09-28 11:19 ` [PATCH v3 1/2] dt-bindings: leds: Add CZ.NIC Turris 1.x LED controller Josef Schlehofer
2026-09-28 11:19 ` [PATCH v3 2/2] leds: Add support for Turris 1.x LEDs Josef Schlehofer
2026-09-28 13:07 ` Andy Shevchenko
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=20260928111907.72592-1-pepe.schlehofer@gmail.com \
--to=pepe.schlehofer@gmail.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=i@rong.moe \
--cc=kabel@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pali@kernel.org \
--cc=pavel@kernel.org \
--cc=robh@kernel.org \
/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
all inboxes | Powered by JetHome®