Skip to content

Commit b0908e0

Browse files
Wer-Wolfij-intel
authored andcommitted
platform/x86: acer-wmi: Stop using ACPI bitmap for platform profile choices
It turns out that the platform firmware on some models does not return valid data when reading the bitmap of supported platform profiles. This prevents the driver from loading on said models, even when the platform profile interface itself works. Fix this by stop using said bitmap until we have figured out how the OEM software itself detects available platform profiles. Tested-by: Lynne Megido <[email protected]> Reported-by: Lynne Megido <[email protected]> Closes: https://lore.kernel.org/platform-driver-x86/[email protected]/ Fixes: 191e21f ("platform/x86: acer-wmi: use an ACPI bitmap to set the platform profile choices") Signed-off-by: Armin Wolf <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 2340887 commit b0908e0

File tree

1 file changed

+12
-59
lines changed

1 file changed

+12
-59
lines changed

drivers/platform/x86/acer-wmi.c

Lines changed: 12 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ enum acer_wmi_predator_v4_oc {
129129
enum acer_wmi_gaming_misc_setting {
130130
ACER_WMID_MISC_SETTING_OC_1 = 0x0005,
131131
ACER_WMID_MISC_SETTING_OC_2 = 0x0007,
132+
/* Unreliable on some models */
132133
ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES = 0x000A,
133134
ACER_WMID_MISC_SETTING_PLATFORM_PROFILE = 0x000B,
134135
};
@@ -794,9 +795,6 @@ static bool platform_profile_support;
794795
*/
795796
static int last_non_turbo_profile = INT_MIN;
796797

797-
/* The most performant supported profile */
798-
static int acer_predator_v4_max_perf;
799-
800798
enum acer_predator_v4_thermal_profile {
801799
ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET = 0x00,
802800
ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED = 0x01,
@@ -2014,7 +2012,7 @@ acer_predator_v4_platform_profile_set(struct device *dev,
20142012
if (err)
20152013
return err;
20162014

2017-
if (tp != acer_predator_v4_max_perf)
2015+
if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
20182016
last_non_turbo_profile = tp;
20192017

20202018
return 0;
@@ -2023,55 +2021,14 @@ acer_predator_v4_platform_profile_set(struct device *dev,
20232021
static int
20242022
acer_predator_v4_platform_profile_probe(void *drvdata, unsigned long *choices)
20252023
{
2026-
unsigned long supported_profiles;
2027-
int err;
2024+
set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
2025+
set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices);
2026+
set_bit(PLATFORM_PROFILE_BALANCED, choices);
2027+
set_bit(PLATFORM_PROFILE_QUIET, choices);
2028+
set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
20282029

2029-
err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES,
2030-
(u8 *)&supported_profiles);
2031-
if (err)
2032-
return err;
2033-
2034-
/* Iterate through supported profiles in order of increasing performance */
2035-
if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_ECO, &supported_profiles)) {
2036-
set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
2037-
acer_predator_v4_max_perf = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
2038-
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
2039-
}
2040-
2041-
if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET, &supported_profiles)) {
2042-
set_bit(PLATFORM_PROFILE_QUIET, choices);
2043-
acer_predator_v4_max_perf = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
2044-
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
2045-
}
2046-
2047-
if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED, &supported_profiles)) {
2048-
set_bit(PLATFORM_PROFILE_BALANCED, choices);
2049-
acer_predator_v4_max_perf = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
2050-
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
2051-
}
2052-
2053-
if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE, &supported_profiles)) {
2054-
set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices);
2055-
acer_predator_v4_max_perf = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
2056-
2057-
/* We only use this profile as a fallback option in case no prior
2058-
* profile is supported.
2059-
*/
2060-
if (last_non_turbo_profile < 0)
2061-
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
2062-
}
2063-
2064-
if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO, &supported_profiles)) {
2065-
set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
2066-
acer_predator_v4_max_perf = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
2067-
2068-
/* We need to handle the hypothetical case where only the turbo profile
2069-
* is supported. In this case the turbo toggle will essentially be a
2070-
* no-op.
2071-
*/
2072-
if (last_non_turbo_profile < 0)
2073-
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
2074-
}
2030+
/* Set default non-turbo profile */
2031+
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
20752032

20762033
return 0;
20772034
}
@@ -2108,27 +2065,23 @@ static int acer_thermal_profile_change(void)
21082065
if (cycle_gaming_thermal_profile) {
21092066
platform_profile_cycle();
21102067
} else {
2111-
/* Do nothing if no suitable platform profiles where found */
2112-
if (last_non_turbo_profile < 0)
2113-
return 0;
2114-
21152068
err = WMID_gaming_get_misc_setting(
21162069
ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, &current_tp);
21172070
if (err)
21182071
return err;
21192072

2120-
if (current_tp == acer_predator_v4_max_perf)
2073+
if (current_tp == ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
21212074
tp = last_non_turbo_profile;
21222075
else
2123-
tp = acer_predator_v4_max_perf;
2076+
tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
21242077

21252078
err = WMID_gaming_set_misc_setting(
21262079
ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, tp);
21272080
if (err)
21282081
return err;
21292082

21302083
/* Store last profile for toggle */
2131-
if (current_tp != acer_predator_v4_max_perf)
2084+
if (current_tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
21322085
last_non_turbo_profile = current_tp;
21332086

21342087
platform_profile_notify(platform_profile_device);

0 commit comments

Comments
 (0)