mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Werner Sembach <wse@tuxedocomputers.com>
To: nick42d@gmail.com, "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>
Cc: Armin Wolf <W_Armin@gmx.de>,
	linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 1/4] platform/x86: clevo-laptop: add minimal WMI driver skeleton and Kbuild plumbing
Date: Mon, 23 Nov 2026 15:12:30 +0100	[thread overview]
Message-ID: <b5f96ec9-ee4c-44c8-8451-9f40bed43290@tuxedocomputers.com> (raw)
In-Reply-To: <20261122-clevo-laptop-v1-1-881debf4d4b0@gmail.com>


Am 22.11.26 um 05:35 schrieb Nick Dowsett via B4 Relay:
> From: Nick Dowsett <nick42d@gmail.com>
>
> - Add `drivers/platform/x86/clevo-laptop.rs` with module implementation,
>    DMI board check, and Driver registration.
> - Add Kconfig and MAINTAINERS entries and Makefile wiring.
>
> Signed-off-by: Nick Dowsett <nick42d@gmail.com>
> ---
>   MAINTAINERS                          |  6 +++
>   drivers/platform/x86/Kconfig         | 17 +++++++++
>   drivers/platform/x86/Makefile        |  3 ++
>   drivers/platform/x86/clevo-laptop.rs | 72 ++++++++++++++++++++++++++++++++++++
>   4 files changed, 98 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 44540a1eb2b8..1130c293e84d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -6566,6 +6566,12 @@ F:	scripts/Makefile.clang
>   F:	scripts/clang-tools/
>   K:	\b(?i:clang|llvm)\b
>   
> +CLEVO LAPTOP DRIVER
> +M:	Nick Dowsett <nick42d@gmail.com>
> +L:	platform-driver-x86@vger.kernel.org
> +S:	Maintained
> +F:	drivers/platform/x86/clevo-laptop.rs
> +
>   CLK API
>   M:	Russell King <linux@armlinux.org.uk>
>   L:	linux-clk@vger.kernel.org
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index 9ce384e0475e..18aa4550c9f4 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -1059,6 +1059,23 @@ config OXP_EC
>   
>   source "drivers/platform/x86/tuxedo/Kconfig"
>   
> +config CLEVO_LAPTOP
> +	tristate "Clevo Laptop Platform Driver"
> +	depends on RUST
> +	depends on ACPI_WMI=y
> +	depends on DMI
> +	depends on LEDS_CLASS
> +	help
> +	  This driver provides platform support for Clevo barebones and
> +	  rebranded laptops (Tuxedo, Metabox, Sager, XMG, etc.).
> +	  Currently only Clevo NLx0AU boards (e.g. Metabox Edge NL57AU)
> +	  with a 5-step white keyboard backlight are supported over WMI.
> +	  It is intended to be extended with additional Clevo models and
> +	  EC features over time.
> +
> +	  To compile this driver as a module, choose M here: the module
> +	  will be called clevo-laptop.
> +

TUXEDO is officially all caps.

Technically all clevo barebones are rebranded and it is sometimes more then just 
rebranding.

Maybe just drop everything behind the "and".

>   endif # X86_PLATFORM_DEVICES
>   
>   config P2SB
> diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
> index 229057234d00..070af05a2064 100644
> --- a/drivers/platform/x86/Makefile
> +++ b/drivers/platform/x86/Makefile
> @@ -158,6 +158,9 @@ obj-$(CONFIG_SILICOM_PLATFORM)		+= silicom-platform.o
>   # TUXEDO
>   obj-y					+= tuxedo/
>   
> +# Clevo
> +obj-$(CONFIG_CLEVO_LAPTOP)		+= clevo-laptop.o
> +
>   # Winmate
>   obj-$(CONFIG_WINMATE_FM07_KEYS)		+= winmate-fm07-keys.o
>   
> diff --git a/drivers/platform/x86/clevo-laptop.rs b/drivers/platform/x86/clevo-laptop.rs
> new file mode 100644
> index 000000000000..1d862c57b3fe
> --- /dev/null
> +++ b/drivers/platform/x86/clevo-laptop.rs
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +//! Clevo Laptop Driver.
> +//!
> +//! Currently supports only the 5-step white keyboard backlight on Clevo
> +//! NLx0AU boards (e.g., Metabox Edge NL57AU).
> +//!
> +//! Copyright (C) 2026 Nick Dowsett <nick42d@gmail.com>.
> +//!
> +//! Inspired by Tuxedo Computers' drivers.
> +
> +use kernel::{
> +    device,
> +    dmi,
> +    prelude::*,
> +    wmi, //
> +};
> +
> +/// # Note
> +///
> +/// This GUID is non-unique (shared by Uniwill for example) and cannot be trusted
> +/// to uniquely identify a Clevo device.
> +const CLEVO_WMI_METHOD_GUID: &CStr = c"ABBC0F6D-8EA1-11D1-00A0-C90629100000";
> +/// DMI board name allowlist, restricted to tested boards since the WMI GUID is not
> +/// unique.
> +const SUPPORTED_BOARDS: &[&CStr] = &[c"NLx0AU"];
> +
> +module! {
> +    type: ClevoLaptopModule,
> +    name: "clevo-laptop",
> +    authors: ["Nick Dowsett <nick42d@gmail.com>"],
> +    description: "Clevo Laptop Driver (Keyboard Backlight)",
> +    license: "GPL",
> +}
> +
> +/// RAII guard for Clevo Laptop Module holding all subsystem drivers e.g WMI.
> +#[pin_data]
> +struct ClevoLaptopModule {
> +    #[pin]
> +    _wmi_driver: wmi::Registration<WmiDriver>,
> +}
> +
> +impl kernel::InPlaceModule for ClevoLaptopModule {
> +    fn init(module: &'static ThisModule) -> impl PinInit<Self, Error> {
> +        pin_init::pin_init_scope(move || {
> +            if dmi::get_system_info(dmi::Field::BoardName)
> +                .is_none_or(|board| !SUPPORTED_BOARDS.contains(&board))

We most likely need more complex matching here in the future.

Is dmi_system_id table matching available in rust for the linux kernel?

> +            {
> +                return Err(ENODEV);
> +            }
> +            Ok(try_pin_init!(Self {
> +                _wmi_driver <- wmi::Registration::new(c"clevo-laptop", module),
> +            }))
> +        })
> +    }
> +}
> +
> +/// RAII guard for Clevo WMI driver holding all subsystem devices e.g LED device.
> +#[pin_data]
> +struct WmiDriver {}
> +
> +kernel::wmi_device_table!(WMI_TABLE, [wmi::DeviceId::new(CLEVO_WMI_METHOD_GUID)]);
> +
> +impl wmi::Driver for WmiDriver {
> +    type Data<'bound> = WmiDriver;
> +    const ID_TABLE: wmi::IdTable = &WMI_TABLE;
> +    fn probe<'bound>(
> +        _dev: &'bound wmi::Device<device::Core<'_>>,
> +    ) -> impl PinInit<Self::Data<'bound>, Error> + 'bound {
> +        try_pin_init!(WmiDriver {})
> +    }
> +}
>

  reply	other threads:[~2026-11-23 14:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  4:35 [PATCH 0/4] platform/x86: clevo-laptop: add initial Rust driver for keyboard backlight Nick Dowsett via B4 Relay
2026-11-22  4:35 ` [PATCH 1/4] platform/x86: clevo-laptop: add minimal WMI driver skeleton and Kbuild plumbing Nick Dowsett via B4 Relay
2026-11-23 14:12   ` Werner Sembach [this message]
2026-11-22  4:35 ` [PATCH 2/4] platform/x86: clevo-laptop: add EC WMI query interface and BIOS feature check Nick Dowsett via B4 Relay
2026-11-22  4:35 ` [PATCH 3/4] platform/x86: clevo-laptop: probe keyboard backlight type and detect 5-step white backlight Nick Dowsett via B4 Relay
2026-11-22  4:35 ` [PATCH 4/4] platform/x86: clevo-laptop: register 5-step white keyboard backlight LED device Nick Dowsett via B4 Relay
2026-11-23 13:58 ` [PATCH 0/4] platform/x86: clevo-laptop: add initial Rust driver for keyboard backlight Werner Sembach

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=b5f96ec9-ee4c-44c8-8451-9f40bed43290@tuxedocomputers.com \
    --to=wse@tuxedocomputers.com \
    --cc=W_Armin@gmx.de \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nick42d@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /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®