mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Cemin <dcemin@nvidia.com>
To: hansg@kernel.org, ilpo.jarvinen@linux.intel.com, W_Armin@gmx.de
Cc: mpearson-lenovo@squebb.ca, derekjohn.clark@gmail.com,
	xy-jackie@139.com, i@rong.moe, marco_giunta@outlook.it,
	ciro.pedrini@gmail.com, ldemarchi@nvidia.com,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v5 0/4] platform: lenovo: architecture independent home for the Lenovo WMI drivers
Date: Wed,  2 Dec 2026 16:02:47 -0800	[thread overview]
Message-ID: <20261203000251.1006053-1-dcemin@nvidia.com> (raw)
In-Reply-To: <20261130043245.758932-1-dcemin@nvidia.com>

Lenovo now ships ACPI based arm64 laptops whose firmware exposes the
same ACPI-WMI interfaces as the x86 IdeaPad and Legion machines: the Fn
key event GUID consumed by ideapad-laptop, the hotkey utility GUID used
for the microphone mute LED, and the GameZone, Other Mode and capability
data GUIDs behind the thermal operation modes. Since 884d53763d30
("platform/wmi: Remove dependency on CONFIG_X86") the ACPI-WMI core
builds on arm64, but the Lenovo WMI drivers still live under
drivers/platform/x86, which is gated by X86_PLATFORM_DEVICES.

This series:
  1. moves the architecture independent Lenovo WMI drivers into a new
     drivers/platform/lenovo directory, following drivers/platform/surface;
     ideapad-laptop, thinkpad_acpi, think-lmi and the Yoga tablet drivers
     stay under x86 because they need i8042, port I/O or x86 only devices;
  2. adds a WMI Fn keys driver that owns the Fn key and Fn+Esc event
     GUIDs on every architecture, reports the keys through the keymap
     taken over from ideapad-laptop, and offers a notifier chain to
     drivers with platform knowledge; ideapad-laptop drops its WMI event
     driver in the same patch and subscribes to that notifier for its
     Fn lock LED and DYTC performance mode handling;
  3. adds the keyboard backlight level events seen on the arm64 Yoga as
     ignored entries;
  4. ignores the full set of Legion keyboard backlight level and lighting
     preset events reported by Marco, not only the three in the keymap
     today.

The series is based on the review-ilpo-next branch of the pdx86 tree
(f09fec5a32d4), which has Rong's lenovo-ymc series and Ciro's "Ignore
keyboard backlight hotkeys" patch.

Rong offered to co-maintain the new driver and is listed in the
MAINTAINERS entry; Rong, please shout if you would rather I drop that
until the driver is in.

Patch 2 was tested on a Lenovo Yoga 9 2-in-1 16 (arm64): microphone
mute, airplane mode, the Smart Key, the Smart Connect key and the Fn+Q
performance key report input events with the same scan codes as before.
v5 was rerun on a second arm64 model, a Lenovo Yoga Pro 9 15: the same
five keys report the same scan codes and key codes, the airplane mode
key toggles rfkill, and the FnLock (0x02), Esc (0x03) and keyboard
backlight (0x41) events are ignored without an unknown key message.
The Fn+Esc GUIDs are not exposed by that firmware, and the ideapad-laptop
side is compile tested on x86_64 only; a test on a Yoga 3 or Yoga 700
(Fn+Esc) and on a machine where ideapad-laptop handles the Fn lock LED
or DYTC would be appreciated.

Patch 4 is not tested, I have no Legion: the codes come from Marco's
report (BYAPR19MB229323713AAFB68EC5D8443EFC402@BYAPR19MB2293.namprd19.prod.outlook.com).
Marco, Ciro: a check on your machines would be welcome, and I am happy
to turn the Suggested-by into a Co-developed-by if you prefer.

Changes in v5:
  - rebased on review-ilpo-next, on top of Rong's lenovo-ymc series and
    Ciro's keyboard backlight hotkey patch (Rong)
  - patch 1: LENOVO_YMC depends on LENOVO_PLATFORMS, so its selects of
    LENOVO_WMI_EVENTS and LENOVO_WMI_HELPERS cannot produce an invalid
    configuration (Rong); lenovo-ymc includes the events and helpers
    headers from drivers/platform/lenovo, which it needs since the
    lenovo-ymc series. I kept lenovo-ymc under x86 to keep the move
    free of functional changes; moving it with ideapad-laptop stubs can
    follow if you prefer that
  - patch 2: the 0x19, 0x1a and 0x21 ignored entries added by Ciro's
    patch are carried into the moved keymap; ideapad-laptop keeps its
    module init and exit functions for the keyboard backlight LED
    trigger and only drops the WMI driver registration from them
  - patch 4 is new: the remaining Legion keyboard backlight level and
    lighting preset events (Marco, Rong)
  - tested on a second arm64 model (Yoga Pro 9 15)
  - Reviewed-by tags on patches 1 and 2 kept, the changes above are
    what the reviews asked for or follow from the rebase; please tell
    me if you want them dropped

Changes in v4:
  - keymap: "WMI ignored events" and "WMI keys" separators as in
    ideapad-laptop, the 0x40 to 0x43 entries grouped with the other
    ignored events (Rong)
  - ideapad-laptop: dropped the duplicate dev_dbg() of the key code, the
    Fn keys driver already prints it (Rong)
  - collected Rong's Reviewed-by on patches 2 and 3

Changes in v3:
  - driver renamed to wmi-fn-keys (LENOVO_WMI_FN_KEYS, lenovo-wmi-fn-keys)
    so it is not confused with wmi-hotkey-utilities (Jackie); header
    moved to include/linux/platform_data/lenovo-wmi-fn-keys.h (Rong)
  - patches 2 and 3 of v2 merged, so both drivers never bind the same
    WMI devices between the two (Rong)
  - lwmi_fn_keys_ prefix, per GUID struct lwmi_fn_keys_info with phys
    name, event size, scan code base and keymap, dedicated keymap for the
    Esc GUIDs, MODULE_AUTHOR (Rong)
  - keymap taken over from ideapad-laptop with its scan codes (Fn keys
    offset by 0x100, Fn+Esc 128) and comments unchanged, so userspace
    and the hwdb mappings see the same events; the new 0x40 to 0x43
    entries moved to their own patch (Rong)
  - notifier: the event type is the action and the Fn key code the
    data, ideapad-laptop keeps its switch statement; the notifier is
    unregistered before the DYTC and LED teardown instead of devm (Rong)
  - ideapad-laptop: imply LENOVO_WMI_FN_KEYS and IS_REACHABLE() instead
    of a depends on, so existing configurations keep the Fn keys (Rong);
    dropped the ACPI_WMI dependency (Armin); #else/#endif comments
  - collected Rong's Reviewed-by on patch 1

Changes in v2:
  - dropped the WMI core Kconfig patch, 884d53763d30 covers it (Armin)
  - notify_new with the wmi_buffer, devm_kzalloc_obj, drvdata set before
    input registration, KEY_PERFORMANCE for 0x3d (Armin)
  - notifier chain called before the keymap lookup, NOTIFY_STOP
    suppresses the key (Hans, Armin); input device named like the
    ideapad-laptop one so the hwdb mappings keep applying (Hans)
  - camera lens cover switch and Fn+Esc GUIDs handled by the new driver
    so ideapad-laptop registers no WMI event driver at all (Armin)
  - 0x48 (Smart Connect) stays KEY_LINK_PHONE as in ideapad-laptop since
    ccc8c8481c1f (Marco Giunta)
  - collected Mark's and Jackie's Reviewed-by on patch 1


David Cemin (4):
  platform: lenovo: move the architecture independent WMI drivers out of
    x86
  platform: lenovo: add WMI Fn keys driver and use it from
    ideapad-laptop
  platform: lenovo: wmi-fn-keys: ignore the keyboard backlight level
    events
  platform: lenovo: wmi-fn-keys: ignore all Legion keyboard backlight
    events

 MAINTAINERS                                   |  11 +-
 drivers/platform/Kconfig                      |   2 +
 drivers/platform/Makefile                     |   1 +
 drivers/platform/lenovo/Kconfig               | 102 ++++++
 drivers/platform/lenovo/Makefile              |  23 ++
 .../platform/{x86 => }/lenovo/wmi-camera.c    |   0
 .../platform/{x86 => }/lenovo/wmi-capdata.c   |   0
 .../platform/{x86 => }/lenovo/wmi-capdata.h   |   0
 .../platform/{x86 => }/lenovo/wmi-events.c    |   0
 .../platform/{x86 => }/lenovo/wmi-events.h    |   0
 drivers/platform/lenovo/wmi-fn-keys.c         | 312 ++++++++++++++++++
 .../platform/{x86 => }/lenovo/wmi-gamezone.c  |   0
 .../platform/{x86 => }/lenovo/wmi-helpers.c   |   0
 .../platform/{x86 => }/lenovo/wmi-helpers.h   |   0
 .../{x86 => }/lenovo/wmi-hotkey-utilities.c   |   0
 drivers/platform/{x86 => }/lenovo/wmi-other.c |   0
 drivers/platform/x86/lenovo/Kconfig           |  70 +---
 drivers/platform/x86/lenovo/Makefile          |   7 -
 drivers/platform/x86/lenovo/ideapad-laptop.c  | 214 +++---------
 drivers/platform/x86/lenovo/ymc.c             |   4 +-
 .../linux/platform_data/lenovo-wmi-fn-keys.h  |  32 ++
 21 files changed, 534 insertions(+), 244 deletions(-)
 create mode 100644 drivers/platform/lenovo/Kconfig
 create mode 100644 drivers/platform/lenovo/Makefile
 rename drivers/platform/{x86 => }/lenovo/wmi-camera.c (100%)
 rename drivers/platform/{x86 => }/lenovo/wmi-capdata.c (100%)
 rename drivers/platform/{x86 => }/lenovo/wmi-capdata.h (100%)
 rename drivers/platform/{x86 => }/lenovo/wmi-events.c (100%)
 rename drivers/platform/{x86 => }/lenovo/wmi-events.h (100%)
 create mode 100644 drivers/platform/lenovo/wmi-fn-keys.c
 rename drivers/platform/{x86 => }/lenovo/wmi-gamezone.c (100%)
 rename drivers/platform/{x86 => }/lenovo/wmi-helpers.c (100%)
 rename drivers/platform/{x86 => }/lenovo/wmi-helpers.h (100%)
 rename drivers/platform/{x86 => }/lenovo/wmi-hotkey-utilities.c (100%)
 rename drivers/platform/{x86 => }/lenovo/wmi-other.c (100%)
 create mode 100644 include/linux/platform_data/lenovo-wmi-fn-keys.h


base-commit: f09fec5a32d43dd3f9e32d531d05422a9f6191d0
-- 
2.56.1


  parent reply	other threads:[~2026-12-03  0:03 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 22:27 [RFC PATCH 0/3] " David Cemin
2026-11-13 22:27 ` [RFC PATCH 1/3] platform: lenovo: move the architecture independent WMI drivers out of x86 David Cemin
2026-11-15 21:50   ` Mark Pearson
2026-11-16  4:42     ` David Cemin
2026-11-16 16:59       ` Mark Pearson
2026-11-17  2:27     ` Jackie Dong
2026-11-13 22:27 ` [RFC PATCH 2/3] platform: lenovo: add WMI hotkeys driver David Cemin
2026-11-15 16:12   ` Armin Wolf
2026-11-16  4:42     ` David Cemin
2026-11-17  1:39       ` Armin Wolf
2026-11-16 10:55   ` Marco Giunta
2026-11-17  3:27   ` Jackie Dong
2026-11-19  2:29   ` David Cemin
2026-11-19 12:12     ` Jackie Dong
2026-11-13 22:27 ` [RFC PATCH 3/3] platform/x86: ideapad-laptop: do not bind the WMI event devices without the VPC David Cemin
2026-11-15 15:33 ` [RFC PATCH 0/3] platform: lenovo: architecture independent home for the Lenovo WMI drivers Hans de Goede
2026-11-15 16:02   ` Armin Wolf
2026-11-15 18:02     ` Hans de Goede
2026-11-15 20:10   ` Hans de Goede
2026-11-15 20:12     ` Hans de Goede
2026-11-15 21:48       ` Mark Pearson
2026-11-16  4:42       ` David Cemin
2026-11-19  2:27 ` [PATCH v2 " David Cemin
2026-11-19  2:27   ` [PATCH v2 1/3] platform: lenovo: move the architecture independent WMI drivers out of x86 David Cemin
2026-11-19 12:49     ` Rong Zhang
2026-11-19  2:27   ` [PATCH v2 2/3] platform: lenovo: add WMI hotkeys driver David Cemin
2026-11-19  6:10     ` Armin Wolf
2026-11-19 12:56     ` Rong Zhang
2026-11-19  2:27   ` [PATCH v2 3/3] platform/x86: ideapad-laptop: consume the Fn key events from the " David Cemin
2026-11-19  6:16     ` Armin Wolf
2026-11-19 13:00     ` Rong Zhang
2026-11-21  3:33   ` [PATCH v3 0/3] platform: lenovo: architecture independent home for the Lenovo WMI drivers David Cemin
2026-11-21  3:33     ` [PATCH v3 1/3] platform: lenovo: move the architecture independent WMI drivers out of x86 David Cemin
2026-11-21  3:33     ` [PATCH v3 2/3] platform: lenovo: add WMI Fn keys driver and use it from ideapad-laptop David Cemin
2026-11-21 10:42       ` Rong Zhang
2026-11-21 20:53         ` Rong Zhang
2026-11-30  4:31         ` David Cemin
2026-11-21  3:33     ` [PATCH v3 3/3] platform: lenovo: wmi-fn-keys: ignore the keyboard backlight level events David Cemin
2026-11-21 10:44       ` Rong Zhang
2026-11-30  4:31         ` David Cemin
2026-11-30  4:32     ` [PATCH v4 0/3] platform: lenovo: architecture independent home for the Lenovo WMI drivers David Cemin
2026-11-30  4:32       ` [PATCH v4 1/3] platform: lenovo: move the architecture independent WMI drivers out of x86 David Cemin
2026-12-02 11:36         ` Rong Zhang
2026-11-30  4:32       ` [PATCH v4 2/3] platform: lenovo: add WMI Fn keys driver and use it from ideapad-laptop David Cemin
2026-11-30  4:32       ` [PATCH v4 3/3] platform: lenovo: wmi-fn-keys: ignore the keyboard backlight level events David Cemin
2026-12-03  0:02       ` David Cemin [this message]
2026-12-03  0:02         ` [PATCH v5 1/4] platform: lenovo: move the architecture independent WMI drivers out of x86 David Cemin
2026-12-03  0:02         ` [PATCH v5 2/4] platform: lenovo: add WMI Fn keys driver and use it from ideapad-laptop David Cemin
2026-12-03  0:02         ` [PATCH v5 3/4] platform: lenovo: wmi-fn-keys: ignore the keyboard backlight level events David Cemin
2026-12-03  0:02         ` [PATCH v5 4/4] platform: lenovo: wmi-fn-keys: ignore all Legion keyboard backlight events David Cemin
2026-12-03 10:29           ` Marco Giunta
2026-12-03 12:09           ` Rong Zhang

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=20261203000251.1006053-1-dcemin@nvidia.com \
    --to=dcemin@nvidia.com \
    --cc=W_Armin@gmx.de \
    --cc=ciro.pedrini@gmail.com \
    --cc=derekjohn.clark@gmail.com \
    --cc=hansg@kernel.org \
    --cc=i@rong.moe \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=ldemarchi@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marco_giunta@outlook.it \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=xy-jackie@139.com \
    /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®