Skip to contentSkip to conversation

hp-wmi: Setting thermal profile fails with 0x06

PATCH Superseded Jorge Lopez 2 participants 3 messages Sep 6, 2022 – Sep 12, 2022 x86 platform drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hp-wmi: Setting thermal profile fails with 0x06

Error 0x06 (invalid command parameter) is reported by hp-wmi module when reading the current thermal profile and then proceed to set it back. The failing condition occurs in Linux NixOS after user configures the thermal profile to ‘quiet mode’ in Windows. Quiet Fan Mode is supported in Windows but was not supported in hp-wmi module.

This fix adds support for PLATFORM_PROFILE_QUIET in hp-wmi module for HP notebooks other than HP Omen series. Quiet thermal profile is not supported in HP Omen series notebooks.

---
Based on the latest platform-drivers-x86.git/for-next

---
 drivers/platform/x86/hp-wmi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +10 -1
index bc7020e9df9e..f5c13df35af0 100644
@@ -177,7 +177,8 @@ enum hp_thermal_profile_omen_v1 {
 enum hp_thermal_profile {
 	HP_THERMAL_PROFILE_PERFORMANCE	= 0x00,
 	HP_THERMAL_PROFILE_DEFAULT		= 0x01,
-	HP_THERMAL_PROFILE_COOL			= 0x02
+	HP_THERMAL_PROFILE_COOL			= 0x02,
+	HP_THERMAL_PROFILE_QUIET		= 0x03,
 };
 
 #define IS_HWBLOCKED(x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW)
@@ -1194,6 +1195,9 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof,
 	case HP_THERMAL_PROFILE_COOL:
 		*profile =  PLATFORM_PROFILE_COOL;
 		break;
+	case HP_THERMAL_PROFILE_QUIET:
+		*profile = PLATFORM_PROFILE_QUIET;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -1216,6 +1220,10 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof,
 	case PLATFORM_PROFILE_COOL:
 		tp =  HP_THERMAL_PROFILE_COOL;
 		break;
+	case PLATFORM_PROFILE_QUIET:
+		tp = HP_THERMAL_PROFILE_QUIET;
+		break;
+
 	default:
 		return -EOPNOTSUPP;
 	}
@@ -1266,6 +1274,7 @@ static int thermal_profile_setup(void)
 	}
 
 	set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices);
+	set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices);
 	set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices);
 	set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices);
 
Signature · 1 line
2.34.1
#1 lore raw

Hi Jorge,

Quoted 11 lines · Jorge Lopez

Error 0x06 (invalid command parameter) is reported by hp-wmi module when reading the current thermal profile and then proceed to set it back. The failing condition occurs in Linux NixOS after user configures the thermal profile to ‘quiet mode’ in Windows. Quiet Fan Mode is supported in Windows but was not supported in hp-wmi module.

This fix adds support for PLATFORM_PROFILE_QUIET in hp-wmi module for HP notebooks other than HP Omen series. Quiet thermal profile is not supported in HP Omen series notebooks.

Thank you for looking into this!

Quoted 43 lines

---
Based on the latest platform-drivers-x86.git/for-next

---
 drivers/platform/x86/hp-wmi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +9 -1
index bc7020e9df9e..f5c13df35af0 100644
@@ -177,7 +177,8 @@ enum hp_thermal_profile_omen_v1 {
 enum hp_thermal_profile {
 	HP_THERMAL_PROFILE_PERFORMANCE	= 0x00,
 	HP_THERMAL_PROFILE_DEFAULT		= 0x01,
-	HP_THERMAL_PROFILE_COOL			= 0x02
+	HP_THERMAL_PROFILE_COOL			= 0x02,
+	HP_THERMAL_PROFILE_QUIET		= 0x03,
 };
 
 #define IS_HWBLOCKED(x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW)
@@ -1194,6 +1195,9 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof,
 	case HP_THERMAL_PROFILE_COOL:
 		*profile =  PLATFORM_PROFILE_COOL;
 		break;
+	case HP_THERMAL_PROFILE_QUIET:
+		*profile = PLATFORM_PROFILE_QUIET;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -1216,6 +1220,10 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof,
 	case PLATFORM_PROFILE_COOL:
 		tp =  HP_THERMAL_PROFILE_COOL;
 		break;
+	case PLATFORM_PROFILE_QUIET:
+		tp = HP_THERMAL_PROFILE_QUIET;
+		break;
+
 	default:
 		return -EOPNOTSUPP;
 	}

drivers/platform/x86/hp-wmi.c static int thermal_profile_setup(void) · line 1277

Quoted 4 lines
drivers/platform/x86/hp-wmi.c +1 -0
@@ -1266,6 +1274,7 @@ static int thermal_profile_setup(void)
 	}
 
 	set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices);
+	set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices);

In the commit msg you say that quiet profile is only supported on the non Omen models, should this then not be inside the else branch of the:

if (is_omen_thermal_profile()) { ... } else { ... }

just above this code block ?

drivers/platform/x86/hp-wmi.c static int thermal_profile_setup(void) · line 1280

Quoted 3 lines
drivers/platform/x86/hp-wmi.c +0 -0
 	set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices);
 	set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices);
 

Regards,

Hans

#2 lore raw

Hi Hans,

Quoted 71 lines · Hans de Goede

Hi Jorge,

Quoted 11 lines · Jorge Lopez

Error 0x06 (invalid command parameter) is reported by hp-wmi module when reading the current thermal profile and then proceed to set it back. The failing condition occurs in Linux NixOS after user configures the thermal profile to ‘quiet mode’ in Windows. Quiet Fan Mode is supported in Windows but was not supported in hp-wmi module.

This fix adds support for PLATFORM_PROFILE_QUIET in hp-wmi module for HP notebooks other than HP Omen series. Quiet thermal profile is not supported in HP Omen series notebooks.

Thank you for looking into this!

Quoted 43 lines

---
Based on the latest platform-drivers-x86.git/for-next

---
 drivers/platform/x86/hp-wmi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +9 -1
index bc7020e9df9e..f5c13df35af0 100644
@@ -177,7 +177,8 @@ enum hp_thermal_profile_omen_v1 {
 enum hp_thermal_profile {
      HP_THERMAL_PROFILE_PERFORMANCE  = 0x00,
      HP_THERMAL_PROFILE_DEFAULT              = 0x01,
-     HP_THERMAL_PROFILE_COOL                 = 0x02
+     HP_THERMAL_PROFILE_COOL                 = 0x02,
+     HP_THERMAL_PROFILE_QUIET                = 0x03,
 };
 
 #define IS_HWBLOCKED(x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW)
@@ -1194,6 +1195,9 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof,
      case HP_THERMAL_PROFILE_COOL:
              *profile =  PLATFORM_PROFILE_COOL;
              break;
+     case HP_THERMAL_PROFILE_QUIET:
+             *profile = PLATFORM_PROFILE_QUIET;
+             break;
      default:
              return -EINVAL;
      }
@@ -1216,6 +1220,10 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof,
      case PLATFORM_PROFILE_COOL:
              tp =  HP_THERMAL_PROFILE_COOL;
              break;
+     case PLATFORM_PROFILE_QUIET:
+             tp = HP_THERMAL_PROFILE_QUIET;
+             break;
+
      default:
              return -EOPNOTSUPP;
      }

drivers/platform/x86/hp-wmi.c static int thermal_profile_setup(void) · line 1277

Quoted 4 lines
drivers/platform/x86/hp-wmi.c +1 -0
@@ -1266,6 +1274,7 @@ static int thermal_profile_setup(void)
      }
 
      set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices);
+     set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices);

In the commit msg you say that quiet profile is only supported on the non Omen models, should this then not be inside the else branch of the:

Quoted 7 lines

if (is_omen_thermal_profile()) { ... } else { ... }

just above this code block ?

Quoted 3 lines
drivers/platform/x86/hp-wmi.c +0 -0
      set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices);
      set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices);
 

You are correct. I will submit a new patch shortly.

Quoted 6 lines

Regards,

Hans