mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David William Richmond Davies-Jones <david@exultantmonkey.co.uk>
To: platform-driver-x86@vger.kernel.org,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Hans de Goede <hansg@kernel.org>,
	Krishna Chomal <krishna.chomal108@gmail.com>,
	linux-kernel@vger.kernel.org,
	David William Richmond Davies-Jones <david@exultantmonkey.co.uk>,
	stable@vger.kernel.org
Subject: [PATCH] platform/x86: hp-wmi: Enable cTGP in performance mode on OMEN 15-en1xxx
Date: Fri, 30 Oct 2026 00:57:24 +0000	[thread overview]
Message-ID: <20261030005724.84507-1-david@exultantmonkey.co.uk> (raw)

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

The firmware's SET_PERFORMANCE_MODE handler (GM1A in the DSDT) stores
the mode byte in EC register 0x95 (HPCM) and enables NVIDIA cTGP through
the NPCF device only when that byte is 0x01:

	If ((HPCM == One)) { NPCF.CTGP = One ... }
	Else { NPCF.CTGP = Zero ... }

0x01 is the thermal policy v0 performance value. This board reports
policy v1 (byte 3 of GET_SYSTEM_DESIGN_DATA is 1), so the driver sends
0x31 for performance and cTGP is never enabled. NPCF only reports the
cTGP offset to nvidia-powerd (ACBT = 0xA0, i.e. +20 W) when CTGP is set.

For boards in a new omen_ctgp_boards[] list, set cTGP explicitly with
SET_GPU_THERMAL_MODES after setting the profile: enabled in performance,
disabled otherwise, with Dynamic Boost (PPAB) left enabled. The Victus S
code already uses this command. platform_profile_omen_set_ec() is also
called at probe time and when AC power returns, so cTGP follows the
profile in those cases too.

A report for the Victus 16 board 8934 shows the same HPCM check in its
GM1A method, so other v1 boards may be affected. Only 88D2 has been
tested, hence the list.

Tested on an OMEN Laptop 15-en1xxx (board 88D2, BIOS F.20, RTX 3070
Laptop GPU) on AC: nvidia-smi reports a 100 W power limit in
performance and 80 W in balanced and cool. Without this change it
reports 80 W in every profile.

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 | 34 ++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index 52077833ac89..e09a6d261144 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -235,6 +235,14 @@ static const char * const omen_timed_thermal_profile_boards[] = {
 	"8BAD",
 };
 
+/* DMI board names of Omen laptops whose firmware only enables NVIDIA cTGP
+ * from SET_PERFORMANCE_MODE for the v0 performance value. With v1 values cTGP
+ * stays disabled, so it has to be set with SET_GPU_THERMAL_MODES instead.
+ */
+static const char * const omen_ctgp_boards[] = {
+	"88D2",
+};
+
 /* DMI Board names of Victus 16-d and 16-e laptops */
 static const char * const victus_thermal_profile_boards[] = {
 	"88EE",
@@ -2035,6 +2043,17 @@ static bool has_omen_thermal_profile_ec_timer(void)
 			    board_name) >= 0;
 }
 
+static bool has_omen_ctgp_control(void)
+{
+	const char *board_name = dmi_get_system_info(DMI_BOARD_NAME);
+
+	if (!board_name)
+		return false;
+
+	return match_string(omen_ctgp_boards, ARRAY_SIZE(omen_ctgp_boards),
+			    board_name) >= 0;
+}
+
 inline int omen_thermal_profile_ec_flags_set(enum hp_thermal_profile_omen_flags flags)
 {
 	return ec_write(HP_OMEN_EC_THERMAL_PROFILE_FLAGS_OFFSET, flags);
@@ -2045,6 +2064,10 @@ inline int omen_thermal_profile_ec_timer_set(u8 value)
 	return ec_write(HP_OMEN_EC_THERMAL_PROFILE_TIMER_OFFSET, value);
 }
 
+static int victus_s_gpu_thermal_profile_set(bool ctgp_enable,
+					    bool ppab_enable,
+					    u8 dstate);
+
 static int platform_profile_omen_set_ec(enum platform_profile_option profile)
 {
 	int err, tp, tp_version;
@@ -2096,6 +2119,17 @@ static int platform_profile_omen_set_ec(enum platform_profile_option profile)
 			return err;
 	}
 
+	/*
+	 * Enable cTGP only in performance mode and keep Dynamic Boost enabled.
+	 * dstate 1 means 100%, as on Victus S.
+	 */
+	if (has_omen_ctgp_control()) {
+		err = victus_s_gpu_thermal_profile_set(profile == PLATFORM_PROFILE_PERFORMANCE,
+						       true, 1);
+		if (err)
+			pr_warn("Failed to set GPU cTGP state: %d\n", err);
+	}
+
 	return 0;
 }
 

base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
-- 
2.56.0


                 reply	other threads:[~2026-10-30  0:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261030005724.84507-1-david@exultantmonkey.co.uk \
    --to=david@exultantmonkey.co.uk \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=krishna.chomal108@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=stable@vger.kernel.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

all inboxes | Powered by JetHome®