Skip to contentSkip to conversation

platform/x86: hp-wmi: Define known Victus S driver data

PATCH Superseded Suryansh Singh 2 participants 3 messages Sep 27 – Oct 12 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: hp-wmi: Define known Victus S driver data

Currently, Victus S thermal parameters use the Unknown Offset for TP (Thermal Profile) from the EC offsets enum, even though there is a Victus S EC Offset in the same enum.

This was done so because the EC layout is highly
variable across this lineup of laptops. The only place where the 0x59 offset is used is the driver data for Omen V1 models, despite it being labelled as the Victus S TP offset. The name clearly doesn't relate to the use case.

However, after some downstream searching, I have found that there is a Victus S board which does have the expected EC layout corresponding to the very Victus S offset itself.

Add known board parameters for the Victus S models to correctly map the found board (8C99) and any others in the future.

---
 drivers/platform/x86/hp/hp-wmi.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/platform/x86/hp/hp-wmi.c +15 -1
index 7ab81ce5f8d4..6486e0ef8753 100644
@@ -121,6 +121,13 @@ static const struct thermal_profile_params victus_s_thermal_params = {
 	.ec_tp_offset	= HP_EC_OFFSET_UNKNOWN,
 };
+
+static const struct thermal_profile_params victus_s_known_thermal_params = {
+	.performance  = HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE,
+	.balanced     = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT,
+	.low_power    = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT,
+	.ec_tp_offset = HP_VICTUS_S_EC_THERMAL_PROFILE_OFFSET,
+};
+
 static const struct thermal_profile_params omen_v1_thermal_params = {
 	.performance	= HP_OMEN_V1_THERMAL_PROFILE_PERFORMANCE,
 	.balanced	= HP_OMEN_V1_THERMAL_PROFILE_DEFAULT,
@@ -164,6 +171,11 @@ static const struct hp_wmi_board_params victus_s_board_params = {
 	.fan_profile		= &victus_s_fan_profile_params,
 };
+
+static const struct hp_wmi_board_params victus_s_known_board_params = {
+	.thermal_profile	= &victus_s_known_thermal_params,
+	.fan_profile		= &victus_s_fan_profile_params,
+};
+
 static const struct hp_wmi_board_params omen_v1_board_params = {
 	.thermal_profile	= &omen_v1_thermal_params,
 	.fan_profile		= &victus_s_fan_profile_params,
@@ -316,7 +328,7 @@ static const struct dmi_system_id hp_wmi_feature_boards[] __initconst = {
 	},
 	{
 		.matches = { DMI_MATCH(DMI_BOARD_NAME, "8C99") },
-		.driver_data = (void *)&victus_s_board_params,
+		.driver_data = (void *)&victus_s_known_board_params,
 	},
 	{
 		.matches = { DMI_MATCH(DMI_BOARD_NAME, "8C9C") },

---
2.55.0

#1 lore raw

PATCH v2 1/1 platform/x86: hp-wmi: Define known Victus S driver data

Currently, Victus S thermal parameters use the Unknown Offset for TP (Thermal Profile) from the EC offsets enum, even though there is a Victus S EC Offset in the same enum.

This was done so because the EC layout is highly
variable across this lineup of laptops. The only place where the 0x59 offset is used is the driver data for Omen V1 models, despite it being labelled as the Victus S TP offset. The name clearly doesn't relate to the use case.

However, after some downstream searching, I have found that there is a Victus S board which does have the expected EC layout corresponding to the very Victus S offset itself.

Add known board parameters for the Victus S models to correctly map the found board (8C99) and any others in the future, and add required if-statements for platform profile options for the new parameters.

---
 drivers/platform/x86/hp/hp-wmi.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/platform/x86/hp/hp-wmi.c +17 -3
index 7ab81ce5f8d4..7851cb607c74 100644
@@ -121,6 +121,13 @@ static const struct thermal_profile_params victus_s_thermal_params = {
 	.ec_tp_offset	= HP_EC_OFFSET_UNKNOWN,
 };
 
+static const struct thermal_profile_params victus_s_known_thermal_params = {
+	.performance	= HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE,
+	.balanced	= HP_VICTUS_S_THERMAL_PROFILE_DEFAULT,
+	.low_power	= HP_VICTUS_S_THERMAL_PROFILE_DEFAULT,
+	.ec_tp_offset	= HP_VICTUS_S_EC_THERMAL_PROFILE_OFFSET,
+};
+
 static const struct thermal_profile_params omen_v1_thermal_params = {
 	.performance	= HP_OMEN_V1_THERMAL_PROFILE_PERFORMANCE,
 	.balanced	= HP_OMEN_V1_THERMAL_PROFILE_DEFAULT,
@@ -164,6 +171,11 @@ static const struct hp_wmi_board_params victus_s_board_params = {
 	.fan_profile		= &victus_s_fan_profile_params,
 };
 
+static const struct hp_wmi_board_params victus_s_known_board_params = {
+	.thermal_profile	= &victus_s_known_thermal_params,
+	.fan_profile		= &victus_s_fan_profile_params,
+};
+
 static const struct hp_wmi_board_params omen_v1_board_params = {
 	.thermal_profile	= &omen_v1_thermal_params,
 	.fan_profile		= &victus_s_fan_profile_params,
@@ -316,7 +328,7 @@ static const struct dmi_system_id hp_wmi_feature_boards[] __initconst = {
 	},
 	{
 		.matches = { DMI_MATCH(DMI_BOARD_NAME, "8C99") },
-		.driver_data = (void *)&victus_s_board_params,
+		.driver_data = (void *)&victus_s_known_board_params,
 	},
 	{
 		.matches = { DMI_MATCH(DMI_BOARD_NAME, "8C9C") },
@@ -2146,10 +2158,12 @@ static int platform_profile_victus_s_get_ec(enum platform_profile_option *profil
 	 * of these values.
 	 */
 	if (tp == victus_s_thermal_params.performance ||
-	    tp == omen_v1_thermal_params.performance) {
+	    tp == omen_v1_thermal_params.performance ||
+		tp == victus_s_known_thermal_params.performance) {
 		*profile = PLATFORM_PROFILE_PERFORMANCE;
 	} else if (tp == victus_s_thermal_params.balanced ||
-		   tp == omen_v1_thermal_params.balanced) {
+			tp == omen_v1_thermal_params.balanced ||
+			tp == victus_s_known_thermal_params.balanced) {
 		/*
 		 * Since both PLATFORM_PROFILE_LOW_POWER and
 		 * PLATFORM_PROFILE_BALANCED share the same thermal profile
Signature · 1 line
2.55.0
maintainer
#2 lore raw
Quoted 65 lines · Suryansh Singh

Currently, Victus S thermal parameters use the Unknown Offset for TP (Thermal Profile) from the EC offsets enum, even though there is a Victus S EC Offset in the same enum.

This was done so because the EC layout is highly
variable across this lineup of laptops. The only place where the 0x59 offset is used is the driver data for Omen V1 models, despite it being labelled as the Victus S TP offset. The name clearly doesn't relate to the use case.

However, after some downstream searching, I have found that there is a Victus S board which does have the expected EC layout corresponding to the very Victus S offset itself.

Add known board parameters for the Victus S models to correctly map the found board (8C99) and any others in the future, and add required if-statements for platform profile options for the new parameters.

---
 drivers/platform/x86/hp/hp-wmi.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/platform/x86/hp/hp-wmi.c +13 -1
index 7ab81ce5f8d4..7851cb607c74 100644
@@ -121,6 +121,13 @@ static const struct thermal_profile_params victus_s_thermal_params = {
 	.ec_tp_offset	= HP_EC_OFFSET_UNKNOWN,
 };
 
+static const struct thermal_profile_params victus_s_known_thermal_params = {
+	.performance	= HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE,
+	.balanced	= HP_VICTUS_S_THERMAL_PROFILE_DEFAULT,
+	.low_power	= HP_VICTUS_S_THERMAL_PROFILE_DEFAULT,
+	.ec_tp_offset	= HP_VICTUS_S_EC_THERMAL_PROFILE_OFFSET,
+};
+
 static const struct thermal_profile_params omen_v1_thermal_params = {
 	.performance	= HP_OMEN_V1_THERMAL_PROFILE_PERFORMANCE,
 	.balanced	= HP_OMEN_V1_THERMAL_PROFILE_DEFAULT,
@@ -164,6 +171,11 @@ static const struct hp_wmi_board_params victus_s_board_params = {
 	.fan_profile		= &victus_s_fan_profile_params,
 };
 
+static const struct hp_wmi_board_params victus_s_known_board_params = {
+	.thermal_profile	= &victus_s_known_thermal_params,
+	.fan_profile		= &victus_s_fan_profile_params,
+};
+
 static const struct hp_wmi_board_params omen_v1_board_params = {
 	.thermal_profile	= &omen_v1_thermal_params,
 	.fan_profile		= &victus_s_fan_profile_params,
@@ -316,7 +328,7 @@ static const struct dmi_system_id hp_wmi_feature_boards[] __initconst = {
 	},
 	{
 		.matches = { DMI_MATCH(DMI_BOARD_NAME, "8C99") },
-		.driver_data = (void *)&victus_s_board_params,
+		.driver_data = (void *)&victus_s_known_board_params,
 	},
 	{
 		.matches = { DMI_MATCH(DMI_BOARD_NAME, "8C9C") },

drivers/platform/x86/hp/hp-wmi.c static int platform_profile_victus_s_get_ec(enum platform_profile_option *profil · line 2162

Quoted 6 lines
drivers/platform/x86/hp/hp-wmi.c +2 -1
@@ -2146,10 +2158,12 @@ static int platform_profile_victus_s_get_ec(enum platform_profile_option *profil
 	 * of these values.
 	 */
 	if (tp == victus_s_thermal_params.performance ||
-	    tp == omen_v1_thermal_params.performance) {
+	    tp == omen_v1_thermal_params.performance ||
+		tp == victus_s_known_thermal_params.performance) {

Please remind me, why can't we generalize this and have to keep adding numbers even if we should have the params now per board in struct so why cannot we map using those numbers?

This is also misaligned.

drivers/platform/x86/hp/hp-wmi.c static int platform_profile_victus_s_get_ec(enum platform_profile_option *profil · line 2166

Quoted 5 lines
drivers/platform/x86/hp/hp-wmi.c +2 -1
 		*profile = PLATFORM_PROFILE_PERFORMANCE;
 	} else if (tp == victus_s_thermal_params.balanced ||
-		   tp == omen_v1_thermal_params.balanced) {
+			tp == omen_v1_thermal_params.balanced ||
+			tp == victus_s_known_thermal_params.balanced) {

Same comments here.

Quoted 4 lines
drivers/platform/x86/hp/hp-wmi.c +0 -0
 		/*
 		 * Since both PLATFORM_PROFILE_LOW_POWER and
 		 * PLATFORM_PROFILE_BALANCED share the same thermal profile
Signature · 1 line
 i.