Commit 1bc5d819 authored by Mark Pearson's avatar Mark Pearson Committed by Hans de Goede

platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms

My last commit to fix profile mode displays on AMD platforms caused
an issue on Intel platforms - sorry!

In it I was reading the current functional mode (MMC, PSC, AMT) from
the BIOS but didn't account for the fact that on some of our Intel
platforms I use a different API which returns just the profile and not
the functional mode.

This commit fixes it so that on Intel platforms it knows the functional
mode is always MMC.

I also fixed a potential problem that a platform may try to set the mode
for both MMC and PSC - which was incorrect.

Tested on X1 Carbon 9 (Intel) and Z13 (AMD).

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216963
Fixes: fde5f74c ("platform/x86: thinkpad_acpi: Fix profile mode display in AMT mode")
Cc: stable@vger.kernel.org
Reviewed-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarMark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20230124153623.145188-1-mpearson-lenovo@squebb.caReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent b0935f11
...@@ -10496,8 +10496,7 @@ static int dytc_profile_set(struct platform_profile_handler *pprof, ...@@ -10496,8 +10496,7 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
if (err) if (err)
goto unlock; goto unlock;
} }
} } else if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
err = dytc_command(DYTC_SET_COMMAND(DYTC_FUNCTION_PSC, perfmode, 1), &output); err = dytc_command(DYTC_SET_COMMAND(DYTC_FUNCTION_PSC, perfmode, 1), &output);
if (err) if (err)
goto unlock; goto unlock;
...@@ -10525,14 +10524,16 @@ static void dytc_profile_refresh(void) ...@@ -10525,14 +10524,16 @@ static void dytc_profile_refresh(void)
err = dytc_command(DYTC_CMD_MMC_GET, &output); err = dytc_command(DYTC_CMD_MMC_GET, &output);
else else
err = dytc_cql_command(DYTC_CMD_GET, &output); err = dytc_cql_command(DYTC_CMD_GET, &output);
} else if (dytc_capabilities & BIT(DYTC_FC_PSC)) funcmode = DYTC_FUNCTION_MMC;
} else if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
err = dytc_command(DYTC_CMD_GET, &output); err = dytc_command(DYTC_CMD_GET, &output);
/* Check if we are PSC mode, or have AMT enabled */
funcmode = (output >> DYTC_GET_FUNCTION_BIT) & 0xF;
}
mutex_unlock(&dytc_mutex); mutex_unlock(&dytc_mutex);
if (err) if (err)
return; return;
funcmode = (output >> DYTC_GET_FUNCTION_BIT) & 0xF;
perfmode = (output >> DYTC_GET_MODE_BIT) & 0xF; perfmode = (output >> DYTC_GET_MODE_BIT) & 0xF;
convert_dytc_to_profile(funcmode, perfmode, &profile); convert_dytc_to_profile(funcmode, perfmode, &profile);
if (profile != dytc_current_profile) { if (profile != dytc_current_profile) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment