Linux LED subsystem development
 help / color / mirror / Atom feed
From: Fiona Behrens <me@kloenk.dev>
To: Miguel Ojeda <ojeda@kernel.org>,
	Alex Gaynor <alex.gaynor@gmail.com>, Pavel Machek <pavel@ucw.cz>,
	Lee Jones <lee@kernel.org>, Jean Delvare <jdelvare@suse.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Fiona Behrens" <me@kloenk.dev>,
	"Mark Pearson" <mpearson-lenovo@squebb.ca>,
	"Peter Koch" <pkoch@lenovo.com>,
	rust-for-linux@vger.kernel.org, linux-leds@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/5] Rust LED Driver Abstractions and Lenovo SE10 Driver with DMI and I/O Port Support
Date: Mon, 13 Jan 2025 13:16:15 +0100	[thread overview]
Message-ID: <20250113121620.21598-1-me@kloenk.dev> (raw)

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/20241220061853.2782878-3-fujita.tomonori@gmail.com/
[2]: https://lore.kernel.org/rust-for-linux/20241009105759.579579-1-me@kloenk.dev/

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

-- 
2.47.0


             reply	other threads:[~2025-01-13 12:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 12:16 Fiona Behrens [this message]
2025-01-13 12:16 ` [PATCH v2 1/5] rust: dmi: Add abstractions for DMI Fiona Behrens
2025-01-13 12:16 ` [PATCH v2 2/5] rust: leds: Add Rust bindings for LED subsystem Fiona Behrens
2025-01-13 13:10   ` Miguel Ojeda
2025-01-13 12:16 ` [PATCH v2 3/5] rust: leds: Add hardware trigger support for hardware-controlled LEDs Fiona Behrens
2025-01-20 10:35   ` Marek Behún
2025-01-20 10:59     ` Fiona Behrens
2025-01-20 14:18       ` Marek Behún
2025-01-13 12:16 ` [PATCH v2 4/5] rust: add I/O port abstractions with resource management Fiona Behrens
2025-01-13 13:15   ` Daniel Almeida
2025-01-13 13:28     ` Fiona Behrens
2025-01-13 12:16 ` [PATCH v2 5/5] leds: leds_lenovo_se10: LED driver for Lenovo SE10 platform Fiona Behrens
2025-01-17 17:21   ` Mark Pearson
2025-01-17 17:31     ` Fiona Behrens
2025-01-17 18:02       ` Mark Pearson
2025-01-17 17:43     ` Miguel Ojeda
2025-01-20 10:47   ` Marek Behún

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=20250113121620.21598-1-me@kloenk.dev \
    --to=me@kloenk.dev \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=jdelvare@suse.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=ojeda@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=pkoch@lenovo.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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