[PATCH v3 0/4] platform/x86: Add Lenovo Gaming Series WMI Drivers

Derek J. Clark
2025-02-25T22:00:47Z

Adds support for the Lenovo "Gaming Series" of laptop hardware that use
WMI interfaces that control various power settings. There are multiple WMI
interfaces that work in concert to provide getting and setting values as
well as validation of input. Currently only the "Gamezone", "Other
Mode", and "LENOVO_CAPABILITY_DATA_01" interfaces are implemented, but
I attempted to structure the driver so that adding the "Custom Mode",
"Lighting", and other data block interfaces would be trivial in a later
patches.

This driver is distinct from, but should be considered a replacement for
this patch:
https://lore.kernel.org/all/20241118100503.14228-1-jonmail@163.com/

This driver attempts to standardize the exposed sysfs by mirroring the
asus-armoury driver currently under review. As such, a lot of
inspiration has been drawn from that driver.
https://lore.kernel.org/all/20240930000046.51388-1-luke@ljones.dev/

The drivers have been tested by me on the Lenovo Legion Go and Legion Go
S.

v3:
- Added notifier chain to Gamezone and Other Mode drivers.
- Added component framework to lenovo-wmi-other driver with
lenovo-wmi-capdata01 acting as a component.
- Completed all suggestions from v2.
- Checkpatch produces CHECK complaints about the Other Mode macros
reusing some variable names. This don't appear to create the condition
it highlights in my testing.

v2:
https://lore.kernel.org/platform-driver-x86/20250102004854.14874-1-derekjohn.clark@gmail.com/t/#m9682cee65783ff3a9e927f2ad1f55c4cbfc37615
v1:
https://lore.kernel.org/platform-driver-x86/CAFqHKTna+kJpHLo5s4Fm1TmHcSSqSTr96JHDm0DJ0dxsZMkixA@mail.gmail.com/T/#t

Suggested-by: Mario Limonciello <superm1@kernel.org>
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Derek J. Clark (4):
platform/x86: Add lenovo-wmi drivers Documentation
platform/x86: Add Lenovo Gamezone WMI Driver
platform/x86: Add Lenovo Capability Data 01 WMI Driver
platform/x86: Add Lenovo Other Mode WMI Driver

.../wmi/devices/lenovo-wmi-gamezone.rst | 355 +++++++++++
.../wmi/devices/lenovo-wmi-other-method.rst | 142 +++++
MAINTAINERS | 12 +
drivers/platform/x86/Kconfig | 35 ++
drivers/platform/x86/Makefile | 4 +
drivers/platform/x86/lenovo-wmi-capdata01.c | 140 +++++
drivers/platform/x86/lenovo-wmi-gamezone.c | 374 ++++++++++++
drivers/platform/x86/lenovo-wmi-other.c | 549 ++++++++++++++++++
drivers/platform/x86/lenovo-wmi.c | 77 +++
drivers/platform/x86/lenovo-wmi.h | 94 +++
10 files changed, 1782 insertions(+)
create mode 100644 Documentation/wmi/devices/lenovo-wmi-gamezone.rst
create mode 100644 Documentation/wmi/devices/lenovo-wmi-other-method.rst
create mode 100644 drivers/platform/x86/lenovo-wmi-capdata01.c
create mode 100644 drivers/platform/x86/lenovo-wmi-gamezone.c
create mode 100644 drivers/platform/x86/lenovo-wmi-other.c
create mode 100644 drivers/platform/x86/lenovo-wmi.c
create mode 100644 drivers/platform/x86/lenovo-wmi.h

--
2.48.1