platform/x86: hp-wmi: HP OmniBook Ultra 14-kd0xxx (8EB4) fixes
cover platform/x86: hp-wmi: HP OmniBook Ultra 14-kd0xxx (8EB4) fixes
Two small hp-wmi changes for the HP OmniBook Ultra Laptop 14-kd0xxx (board 8EB4, BIOS F.06, Panther Lake):
1. The thermal profile query returns status flags in its upper bytes, so reading the platform profile always fails with -EINVAL. Use only the low byte.
2. The laptop has the same battery charge mode interface as the Spectre 8C15/8C17. Add it to the charge_behaviour quirk list.
Both were tested on the laptop with the same code changes applied to the hp-wmi of a 7.2.15-based distribution kernel. The patches themselves are against pdx86 for-next and build there with W=1 without warnings; checkpatch --strict is clean.
Patch 2 touches the same quirk table as the pending "platform/x86:
hp-wmi: Add OmniBook 7 14-fr0xxx to charge_behaviour quirks"
(https://lore.kernel.org/r/[email protected]),
so whichever is applied second will need a trivial rebase.
The ACPI analysis, the changes and these descriptions were prepared with an AI coding assistant (Claude, by Anthropic), as described in each patch. I reviewed them and ran the tests myself.
---
Samuel Wheeler (2):
platform/x86: hp-wmi: Only use the low byte of the thermal profile platform/x86: hp-wmi: Add charge_behaviour quirk for OmniBook Ultra 14
drivers/platform/x86/hp/hp-wmi.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
---
base-commit: a514d723595bd8e5ce926a7fea148ceb3c26915c
change-id: 20261111-omnibook-8eb4-78891e074a1f
Best regards,
Signature · 1 line
Samuel Wheeler <[email protected]>
PATCH 1/2 platform/x86: hp-wmi: Only use the low byte of the thermal profile
On the HP OmniBook Ultra Laptop 14-kd0xxx (board 8EB4, BIOS F.06), the HPWMI_THERMAL_PROFILE_QUERY read returns the active profile in byte 0, followed by status flags and a constant. With the "default" profile active the four bytes are 01 11 04 00. thermal_profile_get() returns the whole 32-bit value (0x041101), which matches none of the HP_THERMAL_PROFILE_* values, so reading the platform profile always fails with -EINVAL:
platform_profile: Failed to get profile for handler hp-wmi
and /sys/firmware/acpi/platform_profile returns "Invalid argument".
The firmware's GTPS method (in the SSDT that defines \_SB.WMID) fills byte 0 from the EC field GFCM (0-5), byte 1 with status flags (ONTB, INBG, DPIN, PWDN, IBGE, MSFG) and byte 2 with 0x04. Setting a profile already works: GFCM becomes 0, 1, 2 and 3 for performance, default, cool and quiet.
Mask the value to its low byte. This also stops thermal_profile_setup() from writing the status bytes back through thermal_profile_set(tp) at probe time. That write was harmless on this firmware, whose STPS method only reads byte 0, but it was not intended. On firmware that already returns a zero-extended value the mask changes nothing.
Tested on the OmniBook Ultra 14-kd0xxx: platform_profile reads "balanced" instead of failing, and each profile reads back after being set.
This patch was prepared with an AI coding assistant (Claude, by Anthropic). It decompiled the ACPI tables, traced the WMI query, wrote the change and this description, and ran the tests on my laptop under my direction. I reviewed the change and the test results.
--- drivers/platform/x86/hp/hp-wmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/hp/hp-wmi.c +10 -1
@@ -2117,7 +2117,16 @@ 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 =hp_wmi_read_int (HPWMI_THERMAL_PROFILE_QUERY ); + +if (tp <0 ) +return tp; + +/* +* The profile is in the low byte. Some firmware (e.g. board 8EB4) +* returns status flags and a constant in the upper bytes. +*/ +return tp &0xff ; }static int thermal_profile_set (int thermal_profile)
Signature · 1 line
2.56.0
Re: [PATCH 1/2] platform/x86: hp-wmi: Only use the low byte of the thermal profile
Hi Samuel, Akhil, Hans, and Ilpo,
Corroborating this on an HP OmniBook X Flip Laptop 16-cc0xxx (board HP 8EA2, BIOS Insyde F.07):
- Disassembling SSDT4 shows the same GTPS/STPS layout: GTPS packs the active thermal profile in byte 0 ((RDMB(0xC3) & 0x0F) - 1), EC status flags in byte 1, and the posture/SAR byte RDMB(0x3D) (clamped to 0x04) in byte 2; STPS writes only byte 0 back to EC 0xC3 and calls WPMF().
- On stock 7.2.15, HPWMI_THERMAL_PROFILE_QUERY (0x4c) returns 0x00041101 in balanced mode, causing /sys/class/platform-profile/platform-profile-1/profile to fail with -EINVAL ("platform_profile: Failed to get profile for handler hp-wmi").
- Masking to the low byte fixes platform_profile on 8EA2: initial read returns "balanced" and round-tripping cool, quiet, performance, and balanced all read back cleanly.
Also cross-referencing Akhil Boyapati's earlier patch for board 8C15 (<[email protected]>) and Ilpo's Nov 9 review requesting a named mask with FIELD_GET() and standard if (tp < 0) error handling (<[email protected]>):
I verified the FIELD_GET(HP_THERMAL_PROFILE_MASK, tp) variant on 8EA2 as well.
Thanks,
Shan Rizvi
PATCH 2/2 platform/x86: hp-wmi: Add charge_behaviour quirk for OmniBook Ultra 14
In reply to Samuel WheelerThe HP OmniBook Ultra Laptop 14-kd0xxx (board 8EB4) implements the same battery charge mode interface as the Spectre x360 boards supported since commit 929433336e0a ("platform/x86: hp-wmi: add charge_behaviour support for Spectre 8C15/8C17").
Reading HPWMI_BATTERY_CHARGE_MODE returns the mode in byte 0 (00 ff 01 ff with automatic charging). The write handler (SBCC in the SSDT that defines \_SB.WMID) takes the mode from byte 1, accepts values 0-7 and passes it to EC command 0xbb. That matches the layout the driver already uses.
Add the board to hp_wmi_charge_control_quirks.
Tested on the OmniBook Ultra 14-kd0xxx (BIOS F.06) with AC connected:
writing inhibit-charge to charge_behaviour changes the battery status to "Not charging" with zero current, and writing auto resumes charging. force-discharge was not tested.
This patch was prepared with an AI coding assistant (Claude, by Anthropic). It read the firmware's WMI methods, wrote the change and this description, and ran the tests on my laptop under my direction. I reviewed the change and the test results.
--- drivers/platform/x86/hp/hp-wmi.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/hp/hp-wmi.c +7 -0
@@ -634,6 +634,13 @@ static const struct dmi_system_id hp_wmi_charge_control_quirks[] __initconst = { DMI_MATCH(DMI_BOARD_NAME, "8C15"), }, }, + { +/* HP OmniBook Ultra Laptop 14-kd0xxx */ + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"HP" ), + DMI_MATCH(DMI_BOARD_NAME, "8EB4"), + }, + }, {} };#endif
Signature · 1 line
2.56.0