[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfbK226a-SsNj=Bnpfc3wWyT9K_D4XzAMOu9of1_g+8-A@mail.gmail.com>
Date: Mon, 5 Oct 2020 11:57:07 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Elia Devito <eliadevito@...il.com>
Cc: Mark Gross <mgross@...ux.intel.com>,
Darren Hart <dvhart@...radead.org>,
Andy Shevchenko <andy@...radead.org>,
Hans de Goede <hdegoede@...hat.com>,
Platform Driver <platform-driver-x86@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] platform/x86: hp-wmi: add support for thermal policy
On Mon, Oct 5, 2020 at 12:14 AM Elia Devito <eliadevito@...il.com> wrote:
>
> 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@...il.com>
> ---
> drivers/platform/x86/hp-wmi.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index 1762f335bac9..6e448a79caee 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -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
Usually we leave a comma that next change won't add any unnecessary churn.
I don't think this comment requires a v2 right now (may be satisfied
when applied), but if any other comments come and need to be
addressed, then this should be included as well.
> };
>
> 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;
> }
>
> --
> 2.26.2
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists