platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: hp-wmi: add Omen 16-wf0xxx (board 8BAB) fan & perf-profile support
@ 2025-07-31 21:35 noahpro
  2025-08-04  7:58 ` Ilpo Järvinen
  0 siblings, 1 reply; 3+ messages in thread
From: noahpro @ 2025-07-31 21:35 UTC (permalink / raw)
  To: ilpo.jarvinen, hansg; +Cc: platform-driver-x86, noahpro

Recent 2024-era Omen laptops (DMI board 8BAB) use different
thermal-profile commands (0x48 default, 0x31 performance) but are very
similar to those used by the existing Victus-S code paths although
it wasn't in the config.  As a result:

- `/sys/devices/platform/hp-wmi/fan*` reported 0
- `echo 0 | sudo tee /sys/devices/platform/hp-wmi/hwmon/*/pwm1_enable`
  max-fan writes failed
- platform_profile was not registered, so performance/balanced switching
  was not available

I added the new board to victus_s_thermal_profile_boards[] and created
omen_2024_thermal_profile_boards[] with HP_OMEN_2024_THERMAL_PROFILE_*
enums, and switched the Victus-S performance setter to choose the
right wmi commands.

I was was unsure of whether to rename the victus_s_ names to
newer or 2024 boards everywhere becuase this would clutter the commit.

Tested on HP Omen 16-wf0xxx (BIOS F.21):
 * fan RPMs readable
 * performance/balanced switching works (needed nvidiaDynamicBoost to
   see max wattage changes but it does work)
 * "max fans" honoured (firmware reverts after 120 sec, but the existing
   timed board variables don't work when testing. On Windows the
   Omen Command Center simply sends lots of commands to keep this alive
   so this seems fine to me as user applications can write to the
   fan speed every ~100 sec).

Signed-off-by: noahpro <noahpro@gmail.com>
---
 drivers/platform/x86/hp/hp-wmi.c | 41 ++++++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index db5fdee2109c..55c3680724b5 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -92,9 +92,13 @@ static const char * const victus_thermal_profile_boards[] = {
 	"8A25"
 };
 
-/* DMI Board names of Victus 16-s1000 laptops */
+/* DMI Board names of newer 2024+ laptops that have use different wmi commands */
 static const char * const victus_s_thermal_profile_boards[] = {
-	"8C9C"
+	"8C9C", "8BAB"
+};
+
+static const char * const omen_2024_thermal_profile_boards[] = {
+	"8BAB"
 };
 
 enum hp_wmi_radio {
@@ -245,6 +249,11 @@ enum hp_thermal_profile_victus_s {
 	HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE		= 0x01,
 };
 
+enum hp_thermal_profile_omen_2024 {
+	HP_OMEN_2024_THERMAL_PROFILE_DEFAULT	  = 0x48,
+	HP_OMEN_2024_THERMAL_PROFILE_PERFORMANCE  = 0x31,
+};
+
 enum hp_thermal_profile {
 	HP_THERMAL_PROFILE_PERFORMANCE	= 0x00,
 	HP_THERMAL_PROFILE_DEFAULT		= 0x01,
@@ -1580,6 +1589,19 @@ static bool is_victus_s_thermal_profile(void)
 			    board_name) >= 0;
 }
 
+static bool is_omen_2024_thermal_profile(void)
+{
+	const char *board_name;
+
+	board_name = dmi_get_system_info(DMI_BOARD_NAME);
+	if (!board_name)
+		return false;
+
+	return match_string(omen_2024_thermal_profile_boards,
+			    ARRAY_SIZE(omen_2024_thermal_profile_boards),
+			    board_name) >= 0;
+}
+
 static int victus_s_gpu_thermal_profile_get(bool *ctgp_enable,
 					    bool *ppab_enable,
 					    u8 *dstate,
@@ -1666,19 +1688,28 @@ static int platform_profile_victus_s_set_ec(enum platform_profile_option profile
 
 	switch (profile) {
 	case PLATFORM_PROFILE_PERFORMANCE:
-		tp = HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE;
+		if (is_omen_2024_thermal_profile())
+			tp = HP_OMEN_2024_THERMAL_PROFILE_PERFORMANCE;
+		else
+			tp = HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE;
 		gpu_ctgp_enable = true;
 		gpu_ppab_enable = true;
 		gpu_dstate = 1;
 		break;
 	case PLATFORM_PROFILE_BALANCED:
-		tp = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT;
+		if (is_omen_2024_thermal_profile())
+			tp = HP_OMEN_2024_THERMAL_PROFILE_DEFAULT;
+		else
+			tp = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT;
 		gpu_ctgp_enable = false;
 		gpu_ppab_enable = true;
 		gpu_dstate = 1;
 		break;
 	case PLATFORM_PROFILE_LOW_POWER:
-		tp = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT;
+		if (is_omen_2024_thermal_profile())
+			tp = HP_OMEN_2024_THERMAL_PROFILE_DEFAULT;
+		else
+			tp = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT;
 		gpu_ctgp_enable = false;
 		gpu_ppab_enable = false;
 		gpu_dstate = 1;

base-commit: 1798561befd8be1e52feb54f850efcab5a595f43
-- 
2.50.1


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

* Re: [PATCH] platform/x86: hp-wmi: add Omen 16-wf0xxx (board 8BAB) fan & perf-profile support
  2025-07-31 21:35 [PATCH] platform/x86: hp-wmi: add Omen 16-wf0xxx (board 8BAB) fan & perf-profile support noahpro
@ 2025-08-04  7:58 ` Ilpo Järvinen
       [not found]   ` <CALjHL5-tjMkiAYJ1gtehtHMj+gySVthJSnCcM1iUNndRoBxEDg@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Ilpo Järvinen @ 2025-08-04  7:58 UTC (permalink / raw)
  To: noahpro; +Cc: hansg, platform-driver-x86

On Thu, 31 Jul 2025, noahpro wrote:

> Recent 2024-era Omen laptops (DMI board 8BAB) use different
> thermal-profile commands (0x48 default, 0x31 performance) but are very
> similar to those used by the existing Victus-S code paths although
> it wasn't in the config.  As a result:
> 
> - `/sys/devices/platform/hp-wmi/fan*` reported 0
> - `echo 0 | sudo tee /sys/devices/platform/hp-wmi/hwmon/*/pwm1_enable`
>   max-fan writes failed
> - platform_profile was not registered, so performance/balanced switching
>   was not available
> 
> I added the new board to victus_s_thermal_profile_boards[] and created
> omen_2024_thermal_profile_boards[] with HP_OMEN_2024_THERMAL_PROFILE_*
> enums, and switched the Victus-S performance setter to choose the
> right wmi commands.
> 
> I was was unsure of whether to rename the victus_s_ names to
> newer or 2024 boards everywhere becuase this would clutter the commit.
> 
> Tested on HP Omen 16-wf0xxx (BIOS F.21):
>  * fan RPMs readable
>  * performance/balanced switching works (needed nvidiaDynamicBoost to
>    see max wattage changes but it does work)
>  * "max fans" honoured (firmware reverts after 120 sec, but the existing
>    timed board variables don't work when testing. On Windows the
>    Omen Command Center simply sends lots of commands to keep this alive
>    so this seems fine to me as user applications can write to the
>    fan speed every ~100 sec).
> 
> Signed-off-by: noahpro <noahpro@gmail.com>
> ---
>  drivers/platform/x86/hp/hp-wmi.c | 41 ++++++++++++++++++++++++++++----
>  1 file changed, 36 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
> index db5fdee2109c..55c3680724b5 100644
> --- a/drivers/platform/x86/hp/hp-wmi.c
> +++ b/drivers/platform/x86/hp/hp-wmi.c
> @@ -92,9 +92,13 @@ static const char * const victus_thermal_profile_boards[] = {
>  	"8A25"
>  };
>  
> -/* DMI Board names of Victus 16-s1000 laptops */
> +/* DMI Board names of newer 2024+ laptops that have use different wmi commands */
>  static const char * const victus_s_thermal_profile_boards[] = {
> -	"8C9C"
> +	"8C9C", "8BAB"
> +};
> +
> +static const char * const omen_2024_thermal_profile_boards[] = {
> +	"8BAB"
>  };
>  
>  enum hp_wmi_radio {
> @@ -245,6 +249,11 @@ enum hp_thermal_profile_victus_s {
>  	HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE		= 0x01,
>  };
>  
> +enum hp_thermal_profile_omen_2024 {
> +	HP_OMEN_2024_THERMAL_PROFILE_DEFAULT	  = 0x48,
> +	HP_OMEN_2024_THERMAL_PROFILE_PERFORMANCE  = 0x31,
> +};
> +
>  enum hp_thermal_profile {
>  	HP_THERMAL_PROFILE_PERFORMANCE	= 0x00,
>  	HP_THERMAL_PROFILE_DEFAULT		= 0x01,
> @@ -1580,6 +1589,19 @@ static bool is_victus_s_thermal_profile(void)
>  			    board_name) >= 0;
>  }
>  
> +static bool is_omen_2024_thermal_profile(void)
> +{
> +	const char *board_name;
> +
> +	board_name = dmi_get_system_info(DMI_BOARD_NAME);
> +	if (!board_name)
> +		return false;
> +
> +	return match_string(omen_2024_thermal_profile_boards,
> +			    ARRAY_SIZE(omen_2024_thermal_profile_boards),
> +			    board_name) >= 0;
> +}

This feels something that should be done once and then stored into a 
variable. Sadly this driver doesn't seem to rely on using drvdata but 
lots of static vars.

>  static int victus_s_gpu_thermal_profile_get(bool *ctgp_enable,
>  					    bool *ppab_enable,
>  					    u8 *dstate,
> @@ -1666,19 +1688,28 @@ static int platform_profile_victus_s_set_ec(enum platform_profile_option profile
>  
>  	switch (profile) {
>  	case PLATFORM_PROFILE_PERFORMANCE:
> -		tp = HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE;
> +		if (is_omen_2024_thermal_profile())
> +			tp = HP_OMEN_2024_THERMAL_PROFILE_PERFORMANCE;
> +		else
> +			tp = HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE;
>  		gpu_ctgp_enable = true;
>  		gpu_ppab_enable = true;
>  		gpu_dstate = 1;
>  		break;
>  	case PLATFORM_PROFILE_BALANCED:
> -		tp = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT;
> +		if (is_omen_2024_thermal_profile())
> +			tp = HP_OMEN_2024_THERMAL_PROFILE_DEFAULT;
> +		else
> +			tp = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT;
>  		gpu_ctgp_enable = false;
>  		gpu_ppab_enable = true;
>  		gpu_dstate = 1;
>  		break;
>  	case PLATFORM_PROFILE_LOW_POWER:
> -		tp = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT;
> +		if (is_omen_2024_thermal_profile())
> +			tp = HP_OMEN_2024_THERMAL_PROFILE_DEFAULT;
> +		else
> +			tp = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT;
>  		gpu_ctgp_enable = false;
>  		gpu_ppab_enable = false;
>  		gpu_dstate = 1;
> 
> base-commit: 1798561befd8be1e52feb54f850efcab5a595f43
> 

-- 
 i.


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

* Re: [PATCH] platform/x86: hp-wmi: add Omen 16-wf0xxx (board 8BAB) fan & perf-profile support
       [not found]   ` <CALjHL5-tjMkiAYJ1gtehtHMj+gySVthJSnCcM1iUNndRoBxEDg@mail.gmail.com>
@ 2025-08-26 22:56     ` Noah Provenzano
  0 siblings, 0 replies; 3+ messages in thread
From: Noah Provenzano @ 2025-08-26 22:56 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: hansg, platform-driver-x86

I agree the constant checking of env vars does feel suboptimal. I am
not sure of the best way to go about this. Could you give some advice
perhaps or point me toward someone else willing to help with this?
Thanks

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

end of thread, other threads:[~2025-08-26 22:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-31 21:35 [PATCH] platform/x86: hp-wmi: add Omen 16-wf0xxx (board 8BAB) fan & perf-profile support noahpro
2025-08-04  7:58 ` Ilpo Järvinen
     [not found]   ` <CALjHL5-tjMkiAYJ1gtehtHMj+gySVthJSnCcM1iUNndRoBxEDg@mail.gmail.com>
2025-08-26 22:56     ` Noah Provenzano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).