Skip to content

Commit aa2fef6

Browse files
mrhpearsonjwrdegoede
authored andcommitted
platform/x86: thinkpad_acpi: Correct dual fan probe
There was an issue with the dual fan probe whereby the probe was failing as it assuming that second_fan support was not available. Corrected the logic so the probe works correctly. Cleaned up so quirks only used if 2nd fan not detected. Tested on X1 Carbon 10 (2 fans), X1 Carbon 9 (2 fans) and T490 (1 fan) Signed-off-by: Mark Pearson <markpearson@lenovo.com> Link: https://lore.kernel.org/r/20220502191200.63470-1-markpearson@lenovo.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 455cd86 commit aa2fef6

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8880,24 +8880,27 @@ static int __init fan_init(struct ibm_init_struct *iibm)
88808880
fan_status_access_mode = TPACPI_FAN_RD_TPEC;
88818881
if (quirks & TPACPI_FAN_Q1)
88828882
fan_quirk1_setup();
8883-
if (quirks & TPACPI_FAN_2FAN) {
8884-
tp_features.second_fan = 1;
8885-
pr_info("secondary fan support enabled\n");
8886-
}
8887-
if (quirks & TPACPI_FAN_2CTL) {
8888-
tp_features.second_fan = 1;
8889-
tp_features.second_fan_ctl = 1;
8890-
pr_info("secondary fan control enabled\n");
8891-
}
88928883
/* Try and probe the 2nd fan */
8884+
tp_features.second_fan = 1; /* needed for get_speed to work */
88938885
res = fan2_get_speed(&speed);
88948886
if (res >= 0) {
88958887
/* It responded - so let's assume it's there */
88968888
tp_features.second_fan = 1;
88978889
tp_features.second_fan_ctl = 1;
88988890
pr_info("secondary fan control detected & enabled\n");
8891+
} else {
8892+
/* Fan not auto-detected */
8893+
tp_features.second_fan = 0;
8894+
if (quirks & TPACPI_FAN_2FAN) {
8895+
tp_features.second_fan = 1;
8896+
pr_info("secondary fan support enabled\n");
8897+
}
8898+
if (quirks & TPACPI_FAN_2CTL) {
8899+
tp_features.second_fan = 1;
8900+
tp_features.second_fan_ctl = 1;
8901+
pr_info("secondary fan control enabled\n");
8902+
}
88998903
}
8900-
89018904
} else {
89028905
pr_err("ThinkPad ACPI EC access misbehaving, fan status and control unavailable\n");
89038906
return -ENODEV;

0 commit comments

Comments
 (0)