mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] platform/x86: hp-wmi: Fix cTGP and power limits on OMEN 15-en1xxx (88D2)
@ 2026-11-22 23:43 David William Richmond Davies-Jones
  2026-11-22 23:43 ` [PATCH v2 1/2] platform/x86: hp-wmi: Allow boards to skip the power limit refresh David William Richmond Davies-Jones
  2026-11-22 23:43 ` [PATCH v2 2/2] platform/x86: hp-wmi: Move OMEN 15-en1xxx (board 88D2) to feature board list David William Richmond Davies-Jones
  0 siblings, 2 replies; 3+ messages in thread
From: David William Richmond Davies-Jones @ 2026-11-22 23:43 UTC (permalink / raw)
  To: Hans de Goede, Ilpo Järvinen
  Cc: Krishna Chomal, Julien ROBIN, platform-driver-x86, linux-kernel,
	David William Richmond Davies-Jones

On the OMEN 15-en1xxx (board 88D2) the GPU stays at its 80 W default in
every platform profile because the board is handled by the Omen profile
path, which never enables cTGP on thermal policy v1 firmware.

Patch 2 moves the board to hp_wmi_feature_boards[] so it uses the
Victus S path, which sets cTGP and Dynamic Boost per profile and enables
fan control. On this firmware the power-limit refresh that path does on
power source changes sets the CPU limits to 0 W, so patch 1 adds a
per-board flag to skip it.

Other AMD boards in hp_wmi_feature_boards[] may have the same
SET_POWER_LIMITS handler. Only 88D2 has been tested, so the flag is set
for it alone.

Changes in v2:
- Drop the omen_ctgp_boards[] list and the extra cTGP call. Move 88D2
  from omen_thermal_profile_boards[] to hp_wmi_feature_boards[] and
  reuse the existing Victus S path instead (suggested in review).
- Dynamic Boost (PPAB) now follows the profile.
- Manual fan control and fan table support are enabled as a result.
- New patch 1: skip the power limit refresh on AC changes, which set
  0 W CPU limits on this board.
- Rebased on pdx86/fixes.

v1: https://lore.kernel.org/platform-driver-x86/20261030005724.84507-1-david@exultantmonkey.co.uk/

David William Richmond Davies-Jones (2):
  platform/x86: hp-wmi: Allow boards to skip the power limit refresh
  platform/x86: hp-wmi: Move OMEN 15-en1xxx (board 88D2) to feature
    board list

 drivers/platform/x86/hp/hp-wmi.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

-- 
2.56.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] platform/x86: hp-wmi: Allow boards to skip the power limit refresh
  2026-11-22 23:43 [PATCH v2 0/2] platform/x86: hp-wmi: Fix cTGP and power limits on OMEN 15-en1xxx (88D2) David William Richmond Davies-Jones
@ 2026-11-22 23:43 ` David William Richmond Davies-Jones
  2026-11-22 23:43 ` [PATCH v2 2/2] platform/x86: hp-wmi: Move OMEN 15-en1xxx (board 88D2) to feature board list David William Richmond Davies-Jones
  1 sibling, 0 replies; 3+ messages in thread
From: David William Richmond Davies-Jones @ 2026-11-22 23:43 UTC (permalink / raw)
  To: Hans de Goede, Ilpo Järvinen
  Cc: Krishna Chomal, Julien ROBIN, platform-driver-x86, linux-kernel,
	David William Richmond Davies-Jones, stable

When the power source changes while the performance profile is active,
victus_s_powersource_event() refreshes the CPU power limits by sending
SET_POWER_LIMITS with PL1 and PL2 set to HP_POWER_LIMIT_DEFAULT (0).
This was added for the Victus 16-s1034nf (board 8C9C), whose firmware
treats 0 as "restore the defaults".

Not all firmware does. On the OMEN 15-en1xxx (board 88D2, AMD Ryzen 7
5800H) the SET_POWER_LIMITS handler (GM29) multiplies both values by
1000 and passes them to ALIB function 0x0C as the SPPT and FPPT limits
whenever the EC power level (OCPC) is 0, the highest level:

	Local2 *= 0x03E8
	Local3 *= 0x03E8
	If ((^^PCI0.SBRG.EC0.OCPC == Zero))
	{
		DPTC (0x05, Local2)
		DPTC (0x07, Local3)
	}

Under full load in the performance profile on battery this holds the
CPU at 399 MHz and below 5 W.

This firmware already sets these limits itself on power source changes.
The EC query handler that notifies the AC device (_Q20) also applies
them according to the adapter state and the EC power level: 25 W on
battery and up to 54 W on AC. On such boards the refresh is unnecessary
as well as harmful.

Add a no_power_limit_reset flag to struct hp_wmi_board_params so such
boards can skip the refresh. No board sets it yet.

The firmware analysis and this patch were prepared with the help of an
AI coding assistant (Claude Opus 5.5 in Claude Code). The result was
reviewed and tested on the hardware by the submitter.

Cc: stable@vger.kernel.org
Signed-off-by: David William Richmond Davies-Jones <david@exultantmonkey.co.uk>
---
 drivers/platform/x86/hp/hp-wmi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index 0069af86800e..c7960de7ac0f 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -154,6 +154,12 @@ 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;
+	/*
+	 * Set when SET_POWER_LIMITS applies HP_POWER_LIMIT_DEFAULT as a literal
+	 * 0 W CPU limit instead of restoring the defaults, so the power limits
+	 * must not be refreshed on power source changes.
+	 */
+	bool no_power_limit_reset;
 };
 
 static int hp_wmi_get_fan_speed_victus_s(int fan);
@@ -2621,7 +2627,8 @@ static int victus_s_powersource_event(struct notifier_block *nb,
 	 * Seen on HP 16-s1034nf (board 8C9C) with F.11 and F.13 BIOS versions.
 	 */
 
-	if (actual_profile == PLATFORM_PROFILE_PERFORMANCE) {
+	if (actual_profile == PLATFORM_PROFILE_PERFORMANCE &&
+	    !active_board_params->no_power_limit_reset) {
 		pr_debug("Triggering CPU PL1/PL2 actualization\n");
 		err = victus_s_set_cpu_pl1_pl2(HP_POWER_LIMIT_DEFAULT,
 					       HP_POWER_LIMIT_DEFAULT);
-- 
2.56.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] platform/x86: hp-wmi: Move OMEN 15-en1xxx (board 88D2) to feature board list
  2026-11-22 23:43 [PATCH v2 0/2] platform/x86: hp-wmi: Fix cTGP and power limits on OMEN 15-en1xxx (88D2) David William Richmond Davies-Jones
  2026-11-22 23:43 ` [PATCH v2 1/2] platform/x86: hp-wmi: Allow boards to skip the power limit refresh David William Richmond Davies-Jones
@ 2026-11-22 23:43 ` David William Richmond Davies-Jones
  1 sibling, 0 replies; 3+ messages in thread
From: David William Richmond Davies-Jones @ 2026-11-22 23:43 UTC (permalink / raw)
  To: Hans de Goede, Ilpo Järvinen
  Cc: Krishna Chomal, Julien ROBIN, platform-driver-x86, linux-kernel,
	David William Richmond Davies-Jones, stable

On the OMEN 15-en1xxx (board 88D2) the GPU power limit stays at its
80 W default in every platform profile, including performance, and
manual fan control is not available.

The board is only listed in omen_thermal_profile_boards[], so the
driver uses the Omen path and sets the profile with SET_PERFORMANCE_MODE
alone. The firmware's handler for that (GM1A) stores the mode byte in
EC register 0x95 (HPCM) and enables NVIDIA cTGP only for the v0
performance value 0x01. The board reports thermal policy v1, so the
driver sends 0x31 and cTGP stays off.

HPCM has no other consumer in the DSDT or the SSDTs. On v1 the firmware
expects cTGP and Dynamic Boost to be set with SET_GPU_THERMAL_MODES
(GM22), which writes NPCF.CTGP and NPCF.DTGP directly. NPCF only
reports the cTGP offset (ACBT = 0xA0, i.e. +20 W) when CTGP is set, and
Dynamic Boost only when DTGP is set. The firmware also implements the
fan speed get/set and fan table methods (GM2D, GM2E, GM2F).

Drop 88D2 from omen_thermal_profile_boards[] and add it to
hp_wmi_feature_boards[] with the omen_v1_legacy thermal parameters,
matching the HPCM offset at 0x95. The board then uses the Victus S
profile path, which sets cTGP and Dynamic Boost according to the
profile, reads the profile back from the EC, and enables manual fan
control and the fan table.

The firmware's SET_POWER_LIMITS handler applies HP_POWER_LIMIT_DEFAULT
as a 0 W CPU limit, which held the CPU at its minimum clock on battery
in the performance profile, so set no_power_limit_reset for this board.

As on the other feature boards, the available profiles change from
cool/balanced/performance to low-power/balanced/performance.

Tested on an OMEN Laptop 15-en1xxx (board 88D2, BIOS F.20, Ryzen 7
5800H, RTX 3070 Laptop GPU). On AC, nvidia-smi reports a 100 W power
limit in performance and 80 W in balanced and low-power, and each
profile reads back correctly. Manual PWM, maximum and automatic fan
modes work through hwmon. Under full CPU load in performance, package
power is about 25 W on battery and returns to about 50 W on AC. Without
no_power_limit_reset it drops below 5 W at 399 MHz on battery.

The firmware analysis and this patch were prepared with the help of an
AI coding assistant (Claude Opus 5.5 in Claude Code). The result was
reviewed and tested on the hardware by the submitter.

Link: https://lore.kernel.org/platform-driver-x86/CA+LW3S2g4E971by7WhfFZGuyLT47141_Zn+eJ=wyqxB_+4G95A@mail.gmail.com/
Fixes: 286e937efbc7 ("platform/x86: hp-wmi: support omen thermal profile policy v1")
Cc: stable@vger.kernel.org
Signed-off-by: David William Richmond Davies-Jones <david@exultantmonkey.co.uk>
---
 drivers/platform/x86/hp/hp-wmi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index c7960de7ac0f..f29bdf9639b7 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -184,6 +184,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_no_pl_reset_board_params = {
+	.thermal_profile	= &omen_v1_legacy_thermal_params,
+	.fan_profile		= &victus_s_fan_profile_params,
+	.no_power_limit_reset	= 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,
@@ -214,7 +220,7 @@ static const char * const omen_thermal_profile_boards[] = {
 	"8600", "8601", "8602", "8603", "8604", "8605", "8606", "8607", "860A",
 	"8746", "8747", "8748", "8749", "874A", "8786", "8787", "8788", "878A",
 	"878B", "878C", "87B5",
-	"886B", "886C", "88C8", "88CB", "88D1", "88D2", "88F4", "88F5", "88F6",
+	"886B", "886C", "88C8", "88CB", "88D1", "88F4", "88F5", "88F6",
 	"88F7", "88FD", "88FE", "88FF",
 	"8900", "8901", "8902", "8912", "8917", "8918", "8949", "894A", "89EB",
 	"8A15", "8A17", "8A18", "8A42", "8A43",
@@ -251,6 +257,10 @@ static const char * const victus_thermal_profile_boards[] = {
 
 /* DMI board-specific feature data for Omen and Victus laptops. */
 static const struct dmi_system_id hp_wmi_feature_boards[] __initconst = {
+	{
+		.matches = { DMI_MATCH(DMI_BOARD_NAME, "88D2") },
+		.driver_data = (void *)&omen_v1_legacy_no_pl_reset_board_params,
+	},
 	{
 		.matches = { DMI_MATCH(DMI_BOARD_NAME, "8902") },
 		.driver_data = (void *)&omen_v1_legacy_board_params,
-- 
2.56.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-22 23:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-22 23:43 [PATCH v2 0/2] platform/x86: hp-wmi: Fix cTGP and power limits on OMEN 15-en1xxx (88D2) David William Richmond Davies-Jones
2026-11-22 23:43 ` [PATCH v2 1/2] platform/x86: hp-wmi: Allow boards to skip the power limit refresh David William Richmond Davies-Jones
2026-11-22 23:43 ` [PATCH v2 2/2] platform/x86: hp-wmi: Move OMEN 15-en1xxx (board 88D2) to feature board list David William Richmond Davies-Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®