[PATCH v4 0/5] platform/x86: huawei-wmi: expose native firmware power profiles

From: Fuwei Xie

Date: Mon Nov 30 2026 - 05:13:22 EST


Hi Ilpo, Hans, Eren and Zheng,

This is v4. Thank you for the review of v3 and for the tests from Eren
and Zheng.

1. What this series does

Huawei firmware on some MateBook and HONOR machines has a
balanced/performance mode behind the WMI methods \GTUB (read) and
\STUB (write). This series exposes it through platform_profile, so
the desktop power mode control can switch it. Reads return the
cached mode; writes request a mode change through STUB. The driver
does not write RAPL limits or force a wattage.

2. What changed since v3

2.1 Resume.
The driver now re-reads GTUB on system resume. CREM-WXX9 can
clear Turbo during s2idle and send no WMI event. FMB-P can keep
Turbo on AC. The driver reports whatever the firmware chose.

2.2 Mode events.
All four mode events now re-read GTUB. 0x2a0 and 0x2a1 join the
existing 0x2a5/0x2a6 path. On CREM-WXX9 the same switch can be
reported twice, and a delayed event can describe an earlier
switch. The event code is read from one shared ACPI variable, and
ACPI notifications can arrive out of order. The driver samples
the mode under wmi_lock, updates the cache, and notifies only
when the mode changes. A successful write updates the cache, so
the firmware's echoed event no longer sends a second notification.

2.3 Events and detach.
The profile event codes are handled in the hotkey path. Access
to the method device's profile state is serialized with detach,
so a hotkey cannot touch a removed profile. The notifier chain
stays for legacy keycode lookup. 4/5 handles resume on the
platform device; 5/5 moves it to the method device.

This series is based on c339f4010dea. I will rebase it once the
charge-mode fix lands.

3. What I tested

On NbF-XX (BIOS 3.07), the integrated series passed six rounds of
50 fast balanced/performance write pairs; each round ended with the
cache matching the firmware. Zheng's tests on FMB-P (BIOS 1.16)
also showed no stale profile, with v3 or with v3 plus the changes.

We believe the problem is CREM-WXX9-specific: it can report the
same mode switch twice, a delayed event can describe an earlier
switch, and it can clear Turbo during s2idle without sending an
event.

I tested Eren's charge-mode patch on NbF-XX: writing 75/80 moved the
EC from smart-charge mode 4 to mode 1, the thresholds read back as
75/80, and charging stopped as expected. Eren, could you test the
combined v4 + charge-mode tree on CREM-WXX9?

4. Questions

1. Is it right to keep the platform device for the existing sysfs
ABI while the method, event and data devices are bound on the
WMI bus?
2. Is it acceptable to re-read GTUB for every mode event? It costs
one GTUB query per event, but the event code is not reliable on
CREM-WXX9.

5. AI assistance

OpenAI Codex helped me with the code, test tooling and drafting.

Thanks,
Fuwei

Fuwei Xie (5):
platform/x86: huawei-wmi: scope method responses to each call
platform/x86: huawei-wmi: bind the Huawei method device
platform/x86: huawei-wmi: use the sized WMI method interface
platform/x86: huawei-wmi: expose native firmware power profiles
platform/x86: huawei-wmi: bind hotkeys and key data on the WMI bus

drivers/platform/x86/Kconfig | 1 +
drivers/platform/x86/huawei-wmi.c | 764 ++++++++++++++++++++++----------------
2 files changed, 454 insertions(+), 311 deletions(-)


base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
--
2.55.0