From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Marco Scardovi <scardracs@disroot.org>
Cc: krishna.chomal108@gmail.com, eliadevito@gmail.com,
emreleno@gmail.com, Hans de Goede <hansg@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
moravec@ukf.sk, platform-driver-x86@vger.kernel.org,
"Rafael J. Wysocki" <rafael@kernel.org>,
regressions@leemhuis.info, regressions@lists.linux
Subject: Re: [PATCH v2 1/1] platform/x86: hp-wmi: fix platform profile issues on generic HP laptops
Date: Tue, 7 Jul 2026 19:40:39 +0300 (EEST) [thread overview]
Message-ID: <358d9315-e974-3180-8919-3451c982fc44@linux.intel.com> (raw)
In-Reply-To: <20260623164603.10322-2-scardracs@disroot.org>
On Tue, 23 Jun 2026, Marco Scardovi wrote:
> On generic (non-Omen/non-Victus) HP laptops supported by the
> hp-wmi driver, the platform_profile sysfs operations could fail,
> leading to 'platform_profile: Failed to get profile for handler hp-wmi'
> errors and preventing userspace power profile management from working
> correctly.
>
> The driver was blindly registering all 4 profiles (quiet, cool,
> balanced, performance) without checking which ones were actually
> supported by the BIOS. Furthermore, when userspace switched profiles,
> hp_wmi_platform_profile_get() was called, which queried the BIOS
> using thermal_profile_get(). If the BIOS query returned an error or
> returned a value not in the recognized cases, the get call failed,
> throwing an error.
>
> Fix this by dynamically probing which thermal profiles are supported
> by the BIOS during driver registration. This is done by temporarily
> setting each profile and checking the return code, then restoring the
> original profile. Restructure the probe function to explicitly populate
> choices for each laptop type, avoiding confusing fall-through behavior.
>
> There are no expected negative side effects, as the active profile is
> restored to its original state during probe time, and only validated
> profiles are exposed.
>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220008
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221569
> Closes: https://lore.kernel.org/platform-driver-x86/a3b137df-1b21-4460-b003-58c5ca2d59d4@ukf.sk/
> Fixes: 4296f679ca50 ("platform/x86: hp-wmi: add platform profile support")
> Assisted-by: Antigravity:gemini-3.5-flash
> Signed-off-by: Marco Scardovi <scardracs@disroot.org>
> ---
> drivers/platform/x86/hp/hp-wmi.c | 37 ++++++++++++++++++++++++++------
> 1 file changed, 30 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
> index 8ba286ed8721..82fdfaa169ec 100644
> --- a/drivers/platform/x86/hp/hp-wmi.c
> +++ b/drivers/platform/x86/hp/hp-wmi.c
> @@ -2011,19 +2011,42 @@ static int hp_wmi_platform_profile_probe(void *drvdata, unsigned long *choices)
> {
> if (is_omen_thermal_profile()) {
> set_bit(PLATFORM_PROFILE_COOL, choices);
> - } else if (is_victus_thermal_profile()) {
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
> + return 0;
> + }
> +
> + if (is_victus_thermal_profile()) {
> set_bit(PLATFORM_PROFILE_QUIET, choices);
> - } else if (is_victus_s_thermal_profile()) {
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
> + return 0;
> + }
> +
> + if (is_victus_s_thermal_profile()) {
> /* Adding an equivalent to HP Omen software ECO mode: */
> set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
> - } else {
> - set_bit(PLATFORM_PROFILE_QUIET, choices);
> - set_bit(PLATFORM_PROFILE_COOL, choices);
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
> + return 0;
> }
You'll need to write a better justification into the changelog if you want
to have these above included. It also looks largely unrelated to what
you're doing according to changelog so it might actually belong to
another patch but without proper explanation, I'm pretty much in dark
why you're doing these in the first place.
> - set_bit(PLATFORM_PROFILE_BALANCED, choices);
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
> + /* Generic HP laptops supported by hp-wmi: probe dynamically */
> + int current_tp = thermal_profile_get();
> + if (current_tp < 0)
> + return current_tp;
> +
> + if (thermal_profile_set(HP_THERMAL_PROFILE_QUIET) == 0)
> + set_bit(PLATFORM_PROFILE_QUIET, choices);
> + if (thermal_profile_set(HP_THERMAL_PROFILE_COOL) == 0)
> + set_bit(PLATFORM_PROFILE_COOL, choices);
> + if (thermal_profile_set(HP_THERMAL_PROFILE_DEFAULT) == 0)
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + if (thermal_profile_set(HP_THERMAL_PROFILE_PERFORMANCE) == 0)
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
>
> + /* Restore original thermal profile */
> + thermal_profile_set(current_tp);
> return 0;
> }
>
>
--
i.
next prev parent reply other threads:[~2026-07-07 16:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 22:09 [PATCH 0/1] platform/x86: hp-wmi: fix platform profile issues on generic HP laptops Marco Scardovi
2026-06-19 22:09 ` [PATCH 1/1] " Marco Scardovi
2026-06-20 9:36 ` Milan Oravec
2026-06-23 15:52 ` Krishna Chomal
2026-06-23 16:45 ` [PATCH v2 0/1] " Marco Scardovi
2026-06-23 16:45 ` [PATCH v2 1/1] " Marco Scardovi
2026-07-07 16:40 ` Ilpo Järvinen [this message]
2026-07-07 21:24 ` Marco Scardovi
2026-07-08 9:59 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=358d9315-e974-3180-8919-3451c982fc44@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=eliadevito@gmail.com \
--cc=emreleno@gmail.com \
--cc=hansg@kernel.org \
--cc=krishna.chomal108@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=moravec@ukf.sk \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=regressions@leemhuis.info \
--cc=regressions@lists.linux \
--cc=scardracs@disroot.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox