[PATCH] platform/x86: hp-wmi: Ignore status bits in thermal profile query

From: Alireza Ahani

Date: Wed Oct 21 2026 - 18:35:40 EST


On the HP OmniBook X Flip 14-fm0xxx (board 8D9F, BIOS F.20) every read of
the platform profile fails:

platform_profile: Failed to get profile for handler hp-wmi

and /sys/firmware/acpi/platform_profile returns -EINVAL.

The firmware handler for HPWMI_THERMAL_PROFILE_QUERY (\_SB.WMID.GTPS)
returns a 4-byte buffer: byte 0 is the thermal profile (EC HPTP - 1),
byte 1 is a set of status flags and byte 2 is derived from the EC MODE
register, which defaults to 4. hp_wmi_read_int() returns all four bytes
as one integer, so the value never matches HP_THERMAL_PROFILE_*. On this
machine the query returns 0x00041000, 0x00041001, 0x00041002 and
0x00041003 for performance, balanced, cool and quiet.

The same value is passed back to thermal_profile_set() by
thermal_profile_setup() to sync the firmware's OEM variables. The
firmware's set handler (\_SB.WMID.STPS) only accepts 0-5; an ACPI method
trace of STPS during probe shows none of its cases matching, so that
write is silently ignored.

Only use bits 7:0 of the query result as the thermal profile.

Tested on the machine above: /sys/firmware/acpi/platform_profile now
reads back each of performance, cool, quiet and balanced after it is
written, the "Failed to get profile" errors are gone, and the STPS trace
during probe now shows the matching case updating the EC.

Fixes: 4296f679ca50 ("platform/x86: hp-wmi: add platform profile support")
Signed-off-by: Alireza Ahani <alirezaahani1386@xxxxxxxxx>
---
drivers/platform/x86/hp/hp-wmi.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index 0eac5e1d9..8f8a1165f 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -110,6 +110,11 @@ enum hp_thermal_profile {
HP_THERMAL_PROFILE_QUIET = 0x03,
};

+/*
+ * Some firmware returns status flags in bits 31:8 of the thermal profile
+ * query; only bits 7:0 hold the profile.
+ */
+#define HP_THERMAL_PROFILE_MASK GENMASK(7, 0)

struct thermal_profile_params {
u8 performance;
@@ -2116,7 +2121,13 @@ static int platform_profile_omen_set(struct device *dev,

static int thermal_profile_get(void)
{
- return hp_wmi_read_int(HPWMI_THERMAL_PROFILE_QUERY);
+ int tp;
+
+ tp = hp_wmi_read_int(HPWMI_THERMAL_PROFILE_QUERY);
+ if (tp < 0)
+ return tp;
+
+ return tp & HP_THERMAL_PROFILE_MASK;
}

static int thermal_profile_set(int thermal_profile)
--
2.53.0