Skip to content

Rust LED Driver Abstractions and Lenovo SE10 Driver with DMI and I/O Port Support

Fiona Behrens linux-leds lkml rust-for-linux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest5 patches 11 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5rust: dmi: Add abstractions for DMIrust/bindings/bindings_helper.h rust/kernel/dmi.rs rust/kernel/lib.rs+536 -00 replies
2/5rust: leds: Add Rust bindings for LED subsystemMAINTAINERS rust/kernel/leds.rs rust/kernel/lib.rs +1 more+351 -01 reply
3/5rust: leds: Add hardware trigger support for hardware-controlled LEDsMAINTAINERS rust/kernel/leds.rs rust/kernel/leds/triggers.rs+214 -103 replies
4/5rust: add I/O port abstractions with resource managementrust/helpers/helpers.c rust/helpers/ioport.c rust/kernel/ioport.rs +1 more+214 -02 replies
5/5leds: leds_lenovo_se10: LED driver for Lenovo SE10 platformdrivers/leds/Kconfig drivers/leds/Makefile drivers/leds/leds_lenovo_se10.rs+143 -05 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by.

PatchMark Pearson
1/5
2/5
3/5
4/5
5/5T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/5] Rust LED Driver Abstractions and Lenovo SE10 Driver with DMI and I/O Port Support

This patch series introduces Rust LED abstractions and provides a driver for the Lenovo ThinkEdge SE10 using those abstractions.

1. DMI Abstraction:
- Introduced Rust macros and types for DMI-based system matching, providing functionality similar to the MODULE_DEVICE_TABLE(dmi, x) macro in C. This abstraction allows system-specific matching using DMI fields.

2. LED Abstractions:
- Introduced a generic LED abstraction that supports on/off control, brightness levels, and hardware blinking.
- The abstraction is implemented using a vtable, with a struct that holds the generic driver data and is pinned for direct LED registration.

3. I/O Port Abstractions:
- Added abstractions for hardware I/O port memory access, enabling the driver to interact with hardware ports.

4. LED Driver for Lenovo ThinkEdge SE10:
- A driver is implemented for the red LED on the front panel of the Lenovo ThinkEdge SE10, utilizing the previously introduced LED abstractions, I/O port abstractions, and DMI matching.
- The driver supports on/off control and a WWAN hardware trigger.

Additionally, the LED abstraction has been prepared to support multicolor LEDs in the future. While this functionality is planned, it has not yet been implemented, as I do not have a consumer for it at this time.

Would it make sense to add the Rust DMI abstractions to the existing DMI/SMBIOS SUPPORT entry in the MAINTAINERS file?

This series depends on rust: time: Introduce Delta type by FUJITA Tomonori[1].

I send this previously without the SE10 driver as an RFC[2], and now have a driver to consume the APIs.

[1]: https://lore.kernel.org/rust-for-linux/[email protected]/
[2]: https://lore.kernel.org/rust-for-linux/[email protected]/

Fiona Behrens (5):
rust: dmi: Add abstractions for DMI
rust: leds: Add Rust bindings for LED subsystem
rust: leds: Add hardware trigger support for hardware-controlled LEDs
rust: add I/O port abstractions with resource management
leds: leds_lenovo_se10: LED driver for Lenovo SE10 platform

 MAINTAINERS                      |   2 +
 drivers/leds/Kconfig             |  10 +
 drivers/leds/Makefile            |   1 +
 drivers/leds/leds_lenovo_se10.rs | 132 ++++++++
 rust/bindings/bindings_helper.h  |   1 +
 rust/helpers/helpers.c           |   1 +
 rust/helpers/ioport.c            |  42 +++
 rust/kernel/dmi.rs               | 533 +++++++++++++++++++++++++++++++
 rust/kernel/ioport.rs            | 169 ++++++++++
 rust/kernel/leds.rs              | 416 ++++++++++++++++++++++++
 rust/kernel/leds/triggers.rs     | 128 ++++++++
 rust/kernel/lib.rs               |   6 +
 rust/kernel/time.rs              |   7 +
 13 files changed, 1448 insertions(+)
 create mode 100644 drivers/leds/leds_lenovo_se10.rs
 create mode 100644 rust/helpers/ioport.c
 create mode 100644 rust/kernel/dmi.rs
 create mode 100644 rust/kernel/ioport.rs
 create mode 100644 rust/kernel/leds.rs
 create mode 100644 rust/kernel/leds/triggers.rs
Signature · 1 line
2.47.0