Re: [RFC] HP laptop charge mode control via POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR
From: Navon John Lukose
Date: Tue Apr 28 2026 - 10:35:46 EST
Hi Hans,
Thanks, that was the right hint. The path from the EC to ACPI methods to WMI
has been fun to trace, and I learned quite a bit.
I checked the WMI path, and the charge methods are reachable through the
existing HP BIOS WMI GUID:
5FB7F034-2C63-45E9-BE91-3D44E2C707E4
The _WDG entry exposes object "AA" as a method. In this firmware that maps to:
\_SB.WMID.WMAA
and WMAA calls:
\_SB.WMID.WHCM(Arg1, Arg2)
Inside WHCM, the command dispatch maps the charge-control methods like this:
read commandtype 0x1f -> \GBCC()
read commandtype 0x2b -> \GBCO()
write commandtype 0x1f -> \SBCC(DDWD)
write commandtype 0x2b -> \SBCO(DDWD)
Calling the WMI wrapper for the three modes works as expected:
\SBCC 0x0000 -> normal charging / auto
\SBCO 0x0500 -> inhibit charge
\SBCO 0x0200 -> force discharge while on AC
So the raw ACPI methods do not need to be called directly; the existing HP BIOS
WMI transport reaches them.
Given that, I think the implementation can use hp_wmi_perform_query() with the
existing HPWMI_BIOS_GUID.
I am still unsure about where to put it. The smallest patch would be to add the
power_supply extension code directly to hp-wmi.c, but that file currently does
not have any battery-specific code paths. Should I add it to hp-wmi.c, add a
small HP-specific file under drivers/platform/x86/hp/, or is there another file
I missed?
Thanks,
Navon