X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH] platform/x86/dell: Set USTT mode according to BIOS after reboot
@ 2025-09-15  9:41 Shyam Sundar S K
  2025-09-15 18:54 ` Lyndon Sanche
  2025-09-15 19:00 ` Mario Limonciello
  0 siblings, 2 replies; 5+ messages in thread
From: Shyam Sundar S K @ 2025-09-15  9:41 UTC (permalink / raw)
  To: lsanche, hdegoede, ilpo.jarvinen
  Cc: platform-driver-x86, Patil.Reddy, mario.limonciello,
	Shyam Sundar S K, Yijun Shen

After a reboot, if the user changes the thermal setting in the BIOS, the
BIOS applies this change. However, the current `dell-pc` driver does not
recognize the updated USTT value, resulting in inconsistent thermal
profiles between Windows and Linux.

To ensure alignment with Windows behavior, the proposed change involves
reading the current USTT setting during driver initialization and updating
the dell-pc USTT profile accordingly whenever a change is detected.

Cc: Yijun Shen <Yijun.Shen@Dell.com>
Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 drivers/platform/x86/dell/dell-pc.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c
index 48cc7511905a..22248cfe21c5 100644
--- a/drivers/platform/x86/dell/dell-pc.c
+++ b/drivers/platform/x86/dell/dell-pc.c
@@ -228,6 +228,8 @@ static int thermal_platform_profile_get(struct device *dev,
 
 static int thermal_platform_profile_probe(void *drvdata, unsigned long *choices)
 {
+	int current_mode;
+
 	if (supported_modes & DELL_QUIET)
 		__set_bit(PLATFORM_PROFILE_QUIET, choices);
 	if (supported_modes & DELL_COOL_BOTTOM)
@@ -237,6 +239,28 @@ static int thermal_platform_profile_probe(void *drvdata, unsigned long *choices)
 	if (supported_modes & DELL_PERFORMANCE)
 		__set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
 
+	/* Read current thermal mode from the BIOS and set the mode explicitly */
+	current_mode = thermal_get_mode();
+	if (current_mode < 0)
+		return current_mode;
+
+	switch (current_mode) {
+	case DELL_BALANCED:
+		thermal_set_mode(DELL_BALANCED);
+		break;
+	case DELL_PERFORMANCE:
+		thermal_set_mode(DELL_PERFORMANCE);
+		break;
+	case DELL_COOL_BOTTOM:
+		thermal_set_mode(DELL_COOL_BOTTOM);
+		break;
+	case DELL_QUIET:
+		thermal_set_mode(DELL_QUIET);
+		break;
+	default:
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
-- 
2.34.1


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

end of thread, other threads:[~2025-09-16  9:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-15  9:41 [PATCH] platform/x86/dell: Set USTT mode according to BIOS after reboot Shyam Sundar S K
2025-09-15 18:54 ` Lyndon Sanche
2025-09-16  9:58   ` Shyam Sundar S K
2025-09-15 19:00 ` Mario Limonciello
2025-09-16  9:59   ` Shyam Sundar S K

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