Skip to contentSkip to conversation

platform/x86: thinkpad_acpi: Disable DYTC CQL mode around switching to balanced mode

PATCH In review Hans de Goede 1 participant 2 messages Mar 21, 2021 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: thinkpad_acpi: Disable DYTC CQL mode around switching to balanced mode

Testing has shown that setting /sys/firmware/acpi/platform_profile to "balanced" when /sys/bus/platform/devices/thinkpad_acpi/dytc_lapmode reports 1, causes dytc_lapmode to get reset to 0 and then it becomes stuck at 0 for aprox. 30 minutes even if the laptop is used on a lap.

Disabling CQL (when enabled) before issuing the DYTC_CMD_RESET to get back to balanced mode and re-enabling it afterwards again, like the code already does when switching to low-power / performance mode fixes this.

Fixes c3bfcd4c6762 ("platform/x86: thinkpad_acpi: Add platform profile support")
---
 drivers/platform/x86/thinkpad_acpi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +7 -2
index ab5155bec22e..a5df44bbb498 100644
@@ -10249,8 +10249,13 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
 		return err;
 
 	if (profile == PLATFORM_PROFILE_BALANCED) {
-		/* To get back to balanced mode we just issue a reset command */
-		err = dytc_command(DYTC_CMD_RESET, &output);
+		/*
+		 * To get back to balanced mode we need to issue a reset command.
+		 * Note we still need to disable CQL mode before hand and re-enable
+		 * it afterwards, otherwise dytc_lapmode gets reset to 0 and stays
+		 * stuck at 0 for aprox. 30 minutes.
+		 */
+		err = dytc_cql_command(DYTC_CMD_RESET, &output);
 		if (err)
 			goto unlock;
 	} else {
Signature · 1 line
2.30.2
#1 lore raw

Hi,

Quoted 5 lines · Hans de Goede

Testing has shown that setting /sys/firmware/acpi/platform_profile to "balanced" when /sys/bus/platform/devices/thinkpad_acpi/dytc_lapmode reports 1, causes dytc_lapmode to get reset to 0 and then it becomes stuck at 0 for aprox. 30 minutes even if the laptop is used on a lap.

Quoted 8 lines

Disabling CQL (when enabled) before issuing the DYTC_CMD_RESET to get back to balanced mode and re-enabling it afterwards again, like the code already does when switching to low-power / performance mode fixes this.

Fixes c3bfcd4c6762 ("platform/x86: thinkpad_acpi: Add platform profile support")

I've added this patch to the pdx86/review-hans and pdx86/fixes branches, so it should show up in linux-next soon and it will also be included in my next pull-req to Linus for 5.12.

Regards,

Hans

Quoted 25 lines
---
 drivers/platform/x86/thinkpad_acpi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +7 -2
index ab5155bec22e..a5df44bbb498 100644
@@ -10249,8 +10249,13 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
 		return err;
 
 	if (profile == PLATFORM_PROFILE_BALANCED) {
-		/* To get back to balanced mode we just issue a reset command */
-		err = dytc_command(DYTC_CMD_RESET, &output);
+		/*
+		 * To get back to balanced mode we need to issue a reset command.
+		 * Note we still need to disable CQL mode before hand and re-enable
+		 * it afterwards, otherwise dytc_lapmode gets reset to 0 and stays
+		 * stuck at 0 for aprox. 30 minutes.
+		 */
+		err = dytc_cql_command(DYTC_CMD_RESET, &output);
 		if (err)
 			goto unlock;
 	} else {