[RFC PATCH 0/2] platform/x86: huawei-wmi: native Turbo mode as platform_profile
From: Fuwei Xie
Date: Sat Nov 07 2026 - 23:18:47 EST
Hello Hans, Ilpo and everyone on the list,
This is an RFC patch series. It is not ready to merge.
I am sending code in the first round on purpose. The interface question is
easier to settle with the diff in front of us than in the abstract.
Short version: on my laptop the firmware already has a Turbo mode, and the
driver already receives its change notifications, but the driver never
connects that mode to platform_profile. So the desktop power mode control
has nothing to switch.
Everything below comes from one machine:
HUAWEI NbF-XX, BIOS 3.07, Intel Core i5-1240P
Ubuntu kernel 7.0.0-42.42, power-profiles-daemon 0.30, thermald
The problem
Two things are missing in the current driver:
1. It cannot read or set the firmware's Turbo state.
2. It does not register platform_profile, so PPD falls back to its
placeholder driver and the desktop switch does nothing.
There is also a smaller gap. The firmware announces Turbo changes through
WMI events 0x2a0 and 0x2a1. The driver has no mapping for them, so they
appear in dmesg as "Unknown key pressed, code: 0x02a0". By the time those
events arrive the hardware mode has probably already changed; only the
reporting is missing.
What the firmware provides
I decompiled this machine's DSDT and SSDTs. They define two ACPI methods
behind WMI commands:
0x00000e04 -> GTUB, read the Turbo state
0x00000f04 -> STUB, set the Turbo state (requested value in input byte 2)
The mapping used by patch 2 is:
Turbo off -> PLATFORM_PROFILE_BALANCED
Turbo on -> PLATFORM_PROFILE_PERFORMANCE
STUB itself requires AC power and a battery charge of at least 21%, and it
applies that check to both enabling and disabling. The driver keeps that
behaviour and reports the firmware refusal as an error instead of working
around it. I have not tested the 21% boundary.
What the two patches do
1/2 - transport only. Keeps the two-call WMI handshake under the driver
mutex, frees each response before a retry, validates the payload shape and
rejects short responses. This does not depend on the profile feature.
2/2 - the feature. Adds Turbo get/set helpers, registers platform_profile
with balanced and performance, re-reads the state after a set and reports
a mismatch instead of claiming success, and refreshes the reported state on
WMI mode events, power supply changes and resume via a workqueue. It also
adds "select ACPI_PLATFORM_PROFILE" to Kconfig.
There is no polling timer, no kernel thread, no userspace daemon, no direct
EC or MMIO power limit write, and no custom fan curve. Real power and fan
behaviour stays with the firmware and the existing thermal stack.
What I tested
The series applies and builds cleanly against platform-drivers-x86
for-next (c339f4010, v7.3), including with W=1, and checkpatch --strict
reports no problems.
The hardware results below were measured with a DKMS build based on the
v7.0 driver source, which carries the same change set. The for-next
series has not been loaded on hardware yet; it differs only in
whitespace and in the surrounding upstream code.
On the machine above, with the driver built as a DKMS module signed by a
locally enrolled MOK and Secure Boot enabled:
- balanced <-> performance round trips worked through both the desktop
control and the native sysfs interface
- Fn+P changed the mode, and PPD followed it in both directions
- AC unplug and replug worked; the firmware went back to balanced on
unplug and PPD followed
- one s2idle cycle of about 11 seconds worked, including a mode change
after resume
- a normal reboot loaded the module automatically; mode switching still
worked afterwards
- two 60 second runs with 16 SHA256 workers each gave final-window mean
package power of 19.99 W in balanced and 27.98 W in performance, with
PL1 reading back as 20 W and 28 W
- a full kernel build in performance mode ran with PL1 at 28 W, the
package steady at 86 C, and no new thermal-throttle events over a six
second sample
What I did not test
- any other model, BIOS version or kernel
- long runs or stability over hours
- the 21% battery boundary
- fan RPM. This machine exposes no fan sensor, so "the fan is louder in
performance" is what I heard, not a measurement
The two load runs started at different temperatures, so the numbers are not
a controlled benchmark. On one later switch back to balanced I briefly saw
29.5 W before it settled at 20 W. The driver does not promise a fixed
wattage at any point.
Questions
1. Is platform_profile the right place for this mode in huawei-wmi, or
would you rather see a separate attribute first? Is anyone else already
working on it?
2. Is an exact model and BIOS restriction acceptable for a first series,
or would you prefer a capability check only? I restricted it because I
can only test this one firmware, and because a wrong guess on a
different model could drive it into a power state it does not expect.
3. This series uses platform_profile_register() with explicit removal,
while several other platform/x86 drivers use
devm_platform_profile_register(). Would you prefer the devm variant?
4. The driver re-queries on 0x2a0, 0x2a1 and 0x2a6. I do not know what
0x2a6 means yet. Should the first version leave it out until I do?
Tooling disclosure
OpenAI Codex assisted with the firmware analysis, the driver changes, the
test scripts and this email. I set the direction and the constraints, and I
ran all of the hardware tests myself; the observations above are mine. The
code has not had human upstream review, which is what this series is asking
for.
Thanks for your time.
Fuwei Xie
Fuwei Xie (2):
platform/x86: huawei-wmi: serialize WMI retries and validate responses
platform/x86: huawei-wmi: expose native Turbo mode as platform_profile
drivers/platform/x86/Kconfig | 1 +
drivers/platform/x86/huawei-wmi.c | 290 ++++++++++++++++++++++++------
2 files changed, 233 insertions(+), 58 deletions(-)
--
2.53.0