[PATCH] platform/x86: hp-wmi: keep platform profile alive on OMEN 16-am2xxx

From: Shuwen Bao

Date: Sun Nov 22 2026 - 08:20:12 EST


The HP OMEN 16-am2xxx (board 8F1C) embedded controller resets the
thermal profile to balanced when its profile timer expires, about
90-120 seconds after the profile was last written. When the
performance profile is active this silently drops the CPU and GPU back
to their default power limits.

The existing omen_timed_thermal_profile_boards[] workaround cannot be
used here because it is only consulted on the is_omen_thermal_profile()
path, while this board is handled through hp_wmi_feature_boards[].

Add a profile_keepalive quirk to the board data in the central DMI
matching table and a generic keepalive that periodically re-applies the
active platform profile, well before the EC timer expires. The
keepalive is stopped when balanced is selected and is restarted after
the initial profile setup.

Set the quirk for board 8F1C.

Fixes: 2cd10a35f3f0 ("platform/x86: hp-wmi: add support for OMEN 16-am2xxx boards")
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
Link: https://lore.kernel.org/platform-driver-x86/f7612110-b309-2c81-690f-0f43e0520ab8@xxxxxxxxxxxxxxx/
Signed-off-by: Shuwen Bao <baoshuwen2013@xxxxxxxxxxx>
---

Hi Ilpo, Hans,

This is a follow-up to the 8F1C support added by 2cd10a35f3f0. As you
suggested, instead of extending omen_timed_thermal_profile_boards[], the
keepalive is now driven by a per-board quirk in the central
hp_wmi_feature_boards[] data and re-applies the active platform profile
every 60 seconds.

Only 8F1C sets the quirk. The work is dispatched through the per-backend
set_ec function, so it is not tied to the omen/victus/victus_s submodel
paths. The existing omen_timed_thermal_profile_boards[] handling is
untouched.

Tested on a HyperX OMEN 16-am2xxx (8F1C) with 7.4.0-rc3: with the
performance profile selected and a 150-second stress-ng run on all 20
CPUs, the maximum CPU frequency stayed at or above 4.3 GHz after the
90-120 second mark (mostly 4.3-4.7 GHz), with no fallback to the
~2.9 GHz balanced cap and no "Failed to refresh platform profile"
messages.

One question: would you prefer that the legacy timed boards
(8A15/8A17/8A42/8BAD) be migrated to this keepalive in the same series,
or is it fine to keep this patch scoped to the central feature-board
table for now? I left them on the existing EC timer workaround to avoid
changing behavior without hardware to test it.

Thanks,
Shuwen

drivers/platform/x86/hp/hp-wmi.c | 80 ++++++++++++++++++++++++++++++--
1 file changed, 77 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index 0069af868..b22108dbd 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -154,6 +154,8 @@ struct hp_wmi_fan_profile_params {
struct hp_wmi_board_params {
const struct thermal_profile_params *thermal_profile;
const struct hp_wmi_fan_profile_params *fan_profile;
+ /* The EC resets the thermal profile to balanced after a timeout. */
+ bool profile_keepalive;
};

static int hp_wmi_get_fan_speed_victus_s(int fan);
@@ -178,6 +180,12 @@ static const struct hp_wmi_board_params omen_v1_legacy_board_params = {
.fan_profile = &victus_s_fan_profile_params,
};

+static const struct hp_wmi_board_params omen_v1_legacy_keepalive_board_params = {
+ .thermal_profile = &omen_v1_legacy_thermal_params,
+ .fan_profile = &victus_s_fan_profile_params,
+ .profile_keepalive = true,
+};
+
static const struct hp_wmi_board_params omen_v1_no_ec_board_params = {
.thermal_profile = &omen_v1_no_ec_thermal_params,
.fan_profile = &victus_s_fan_profile_params,
@@ -193,6 +201,11 @@ static const struct thermal_profile_params *hp_wmi_thermal_profile(void)
return active_board_params->thermal_profile;
}

+static bool hp_wmi_profile_keepalive_supported(void)
+{
+ return active_board_params && active_board_params->profile_keepalive;
+}
+
/* DMI board names of devices that should use the omen specific path for
* thermal profiles.
* This was obtained by taking a look in the windows omen command center
@@ -375,7 +388,7 @@ static const struct dmi_system_id hp_wmi_feature_boards[] __initconst = {
},
{
.matches = { DMI_MATCH(DMI_BOARD_NAME, "8F1C") },
- .driver_data = (void *)&omen_v1_legacy_board_params,
+ .driver_data = (void *)&omen_v1_legacy_keepalive_board_params,
},
{},
};
@@ -581,8 +594,8 @@ static const struct key_entry hp_wmi_keymap[] = {
};

/*
- * Mutex for the active_platform_profile variable,
- * see omen_powersource_event.
+ * Mutex protecting the active_platform_profile variable and serializing
+ * platform profile updates, see omen_powersource_event.
*/
static DEFINE_MUTEX(active_platform_profile_lock);

@@ -594,6 +607,53 @@ static struct notifier_block platform_power_source_nb;
static enum platform_profile_option active_platform_profile;
static bool zero_insize_support;

+/*
+ * Some boards reset the user-selected thermal profile back to balanced when
+ * the EC profile timer expires. Re-apply the active profile periodically to
+ * keep it alive. The timer on the known affected boards expires after 90 to
+ * 120 seconds.
+ */
+#define PROFILE_KEEP_ALIVE_DELAY_SECS 60
+
+static struct delayed_work profile_keep_alive_dwork;
+static int (*hp_wmi_profile_set_ec)(enum platform_profile_option profile);
+
+static void hp_wmi_profile_keepalive_update(void)
+{
+ if (!hp_wmi_profile_keepalive_supported())
+ return;
+
+ /*
+ * The EC only reverts to balanced, so there is nothing to keep
+ * alive once balanced is the active profile.
+ */
+ if (active_platform_profile == PLATFORM_PROFILE_BALANCED) {
+ cancel_delayed_work(&profile_keep_alive_dwork);
+ return;
+ }
+
+ mod_delayed_work(system_dfl_wq, &profile_keep_alive_dwork,
+ secs_to_jiffies(PROFILE_KEEP_ALIVE_DELAY_SECS));
+}
+
+static void hp_wmi_profile_keep_alive_handler(struct work_struct *work)
+{
+ int err;
+
+ guard(mutex)(&active_platform_profile_lock);
+
+ if (!hp_wmi_profile_set_ec ||
+ active_platform_profile == PLATFORM_PROFILE_BALANCED)
+ return;
+
+ err = hp_wmi_profile_set_ec(active_platform_profile);
+ if (err < 0)
+ pr_warn_ratelimited("Failed to refresh platform profile: %d\n",
+ err);
+
+ hp_wmi_profile_keepalive_update();
+}
+
static struct rfkill *wifi_rfkill;
static struct rfkill *bluetooth_rfkill;
static struct rfkill *wwan_rfkill;
@@ -2111,6 +2171,7 @@ static int platform_profile_omen_set(struct device *dev,
return err;

active_platform_profile = profile;
+ hp_wmi_profile_keepalive_update();

return 0;
}
@@ -2492,6 +2553,7 @@ static int platform_profile_victus_s_set(struct device *dev,
return err;

active_platform_profile = profile;
+ hp_wmi_profile_keepalive_update();

return 0;
}
@@ -2508,6 +2570,7 @@ static int platform_profile_victus_set(struct device *dev,
return err;

active_platform_profile = profile;
+ hp_wmi_profile_keepalive_update();

return 0;
}
@@ -2703,6 +2766,12 @@ static int thermal_profile_setup(struct platform_device *device)
const struct thermal_profile_params *params;
int err, tp;

+ err = devm_delayed_work_autocancel(&device->dev,
+ &profile_keep_alive_dwork,
+ hp_wmi_profile_keep_alive_handler);
+ if (err)
+ return err;
+
if (is_omen_thermal_profile()) {
err = platform_profile_omen_get_ec(&active_platform_profile);
if (err < 0)
@@ -2716,6 +2785,7 @@ static int thermal_profile_setup(struct platform_device *device)
if (err < 0)
return err;

+ hp_wmi_profile_set_ec = platform_profile_omen_set_ec;
ops = &platform_profile_omen_ops;
} else if (is_victus_thermal_profile()) {
err = platform_profile_victus_get_ec(&active_platform_profile);
@@ -2730,6 +2800,7 @@ static int thermal_profile_setup(struct platform_device *device)
if (err < 0)
return err;

+ hp_wmi_profile_set_ec = platform_profile_victus_set_ec;
ops = &platform_profile_victus_ops;
} else if (is_victus_s_thermal_profile()) {
params = hp_wmi_thermal_profile();
@@ -2758,6 +2829,7 @@ static int thermal_profile_setup(struct platform_device *device)
if (err < 0)
return err;

+ hp_wmi_profile_set_ec = platform_profile_victus_s_set_ec;
ops = &platform_profile_victus_s_ops;
} else {
tp = thermal_profile_get();
@@ -2776,6 +2848,8 @@ static int thermal_profile_setup(struct platform_device *device)
ops = &hp_wmi_platform_profile_ops;
}

+ hp_wmi_profile_keepalive_update();
+
platform_profile_device = devm_platform_profile_register(&device->dev, "hp-wmi",
NULL, ops);
if (IS_ERR(platform_profile_device))
--
2.53.0