Skip to content

platform: lenovo: architecture independent home for the Lenovo WMI drivers

David Cemin lkml platform-driver-x86 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 3 repliesIn review
  2. v23 patches 5 repliesSuperseded
  3. v1 RFC3 patches 18 repliesSuperseded

Changes in v3 from the cover letter

- 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

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3platform: lenovo: move the architecture independent WMI drivers out of x86MAINTAINERS drivers/platform/Kconfig drivers/platform/Makefile +14 more+114 -750 replies
2/3platform: lenovo: add WMI Fn keys driver and use it from ideapad-laptopMAINTAINERS drivers/platform/lenovo/Kconfig drivers/platform/lenovo/Makefile +4 more+386 -1792 replies
3/3platform: lenovo: wmi-fn-keys: ignore the keyboard backlight level eventsdrivers/platform/lenovo/wmi-fn-keys.c+8 -01 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMark PearsonJackie DongRong Zhang
1/3R-b R-b R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/3] platform: lenovo: architecture independent home for the Lenovo WMI drivers

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.

The series applies on top of Rong Zhang's "platform/x86: ideapad-laptop:
Trigger the EC on YMC events" ([email protected]) because both touch the ideapad-laptop WMI code and that series modernizes the lenovo-wmi-events helper.

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. 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.

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 (3):
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

 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         | 288 ++++++++++++++++++
 .../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           |  69 +----
 drivers/platform/x86/lenovo/Makefile          |   7 -
 drivers/platform/x86/lenovo/ideapad-laptop.c  | 227 +++-----------
 .../linux/platform_data/lenovo-wmi-fn-keys.h  |  32 ++
 20 files changed, 508 insertions(+), 254 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
Signature · 1 line
2.56.1