Commit 81c93798 authored by Elia Devito's avatar Elia Devito Committed by Hans de Goede

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: default avatarElia Devito <eliadevito@gmail.com>
Link: https://lore.kernel.org/r/20201004211305.11628-1-eliadevito@gmail.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 1797d588
......@@ -81,6 +81,7 @@ enum hp_wmi_commandtype {
HPWMI_FEATURE2_QUERY = 0x0d,
HPWMI_WIRELESS2_QUERY = 0x1b,
HPWMI_POSTCODEERROR_QUERY = 0x2a,
HPWMI_THERMAL_POLICY_QUERY = 0x4c,
};
enum hp_wmi_command {
......@@ -861,6 +862,26 @@ static int __init hp_wmi_rfkill2_setup(struct platform_device *device)
return err;
}
static int thermal_policy_setup(struct platform_device *device)
{
int err, tp;
tp = hp_wmi_read_int(HPWMI_THERMAL_POLICY_QUERY);
if (tp < 0)
return tp;
/*
* call thermal policy write command to ensure that the firmware correctly
* sets the OEM variables for the DPTF
*/
err = hp_wmi_perform_query(HPWMI_THERMAL_POLICY_QUERY, HPWMI_WRITE, &tp,
sizeof(tp), 0);
if (err)
return err;
return 0;
}
static int __init hp_wmi_bios_setup(struct platform_device *device)
{
/* clear detected rfkill devices */
......@@ -872,6 +893,8 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
if (hp_wmi_rfkill_setup(device))
hp_wmi_rfkill2_setup(device);
thermal_policy_setup(device);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment