Skip to content

Commit 81c9379

Browse files
eliadevitojwrdegoede
authored andcommitted
platform/x86: hp-wmi: add support for thermal policy
HP Spectre notebooks (and probably other model as well) support up to 4 thermal policy: - HP Recommended - Performance - Cool - Quiet at least on HP Spectre x360 Convertible 15-df0xxx the firmware sets the thermal policy to default but hardcode the odvp0 variable to 1, this causes thermald to choose the wrong DPTF profile witch result in low performance when notebook is on AC, calling thermal policy write command allow firmware to correctly set the odvp0 variable. Signed-off-by: Elia Devito <eliadevito@gmail.com> Link: https://lore.kernel.org/r/20201004211305.11628-1-eliadevito@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 1797d58 commit 81c9379

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

drivers/platform/x86/hp-wmi.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ enum hp_wmi_commandtype {
8181
HPWMI_FEATURE2_QUERY = 0x0d,
8282
HPWMI_WIRELESS2_QUERY = 0x1b,
8383
HPWMI_POSTCODEERROR_QUERY = 0x2a,
84+
HPWMI_THERMAL_POLICY_QUERY = 0x4c,
8485
};
8586

8687
enum hp_wmi_command {
@@ -861,6 +862,26 @@ static int __init hp_wmi_rfkill2_setup(struct platform_device *device)
861862
return err;
862863
}
863864

865+
static int thermal_policy_setup(struct platform_device *device)
866+
{
867+
int err, tp;
868+
869+
tp = hp_wmi_read_int(HPWMI_THERMAL_POLICY_QUERY);
870+
if (tp < 0)
871+
return tp;
872+
873+
/*
874+
* call thermal policy write command to ensure that the firmware correctly
875+
* sets the OEM variables for the DPTF
876+
*/
877+
err = hp_wmi_perform_query(HPWMI_THERMAL_POLICY_QUERY, HPWMI_WRITE, &tp,
878+
sizeof(tp), 0);
879+
if (err)
880+
return err;
881+
882+
return 0;
883+
}
884+
864885
static int __init hp_wmi_bios_setup(struct platform_device *device)
865886
{
866887
/* clear detected rfkill devices */
@@ -872,6 +893,8 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
872893
if (hp_wmi_rfkill_setup(device))
873894
hp_wmi_rfkill2_setup(device);
874895

896+
thermal_policy_setup(device);
897+
875898
return 0;
876899
}
877900

0 commit comments

Comments
 (0)