WSL2-Linux-Kernel/drivers/thermal/intel/int340x_thermal
Antoine Tenart 8b4bd25667 thermal/drivers/int340x: Do not set a wrong tcc offset on resume
After upgrading to Linux 5.13.3 I noticed my laptop would shutdown due
to overheat (when it should not). It turned out this was due to commit
fe6a6de669 ("thermal/drivers/int340x/processor_thermal: Fix tcc setting").

What happens is this drivers uses a global variable to keep track of the
tcc offset (tcc_offset_save) and uses it on resume. The issue is this
variable is initialized to 0, but is only set in
tcc_offset_degree_celsius_store, i.e. when the tcc offset is explicitly
set by userspace. If that does not happen, the resume path will set the
offset to 0 (in my case the h/w default being 3, the offset would become
too low after a suspend/resume cycle).

The issue did not arise before commit fe6a6de669, as the function
setting the offset would return if the offset was 0. This is no longer
the case (rightfully).

Fix this by not applying the offset if it wasn't saved before, reverting
back to the old logic. A better approach will come later, but this will
be easier to apply to stable kernels.

The logic to restore the offset after a resume was there long before
commit fe6a6de669, but as a value of 0 was considered invalid I'm
referencing the commit that made the issue possible in the Fixes tag
instead.

Fixes: fe6a6de669 ("thermal/drivers/int340x/processor_thermal: Fix tcc setting")
Cc: stable@vger.kernel.org
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tested-by: Srinivas Pandruvada <srinivas.pI andruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20210909085613.5577-2-atenart@kernel.org
2021-09-14 19:53:24 +02:00
..
Kconfig thermal: int340x: processor_thermal: Refactor MMIO interface 2020-12-10 12:29:47 +01:00
Makefile thermal/drivers/int340x/processor_thermal: Add PCI MMIO based thermal driver 2021-07-04 18:28:04 +02:00
acpi_thermal_rel.c acpi: Remove header dependency 2020-03-21 16:00:21 +01:00
acpi_thermal_rel.h drivers: thermal: Move various drivers for intel platforms into a subdir 2018-12-07 16:48:47 +08:00
int340x_thermal_zone.c thermal/drivers/intel: Initialize RW trip to THERMAL_TEMP_INVALID 2021-05-14 09:37:27 +02:00
int340x_thermal_zone.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
int3400_thermal.c thermal/drivers/int340x: Use IMOK independently 2021-08-14 15:39:13 +02:00
int3401_thermal.c thermal/drivers/int340x/processor_thermal: Split enumeration and processing part 2021-07-04 18:28:04 +02:00
int3402_thermal.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
int3403_thermal.c thermal: int340x: Support Alder Lake 2020-12-17 15:29:30 +01:00
int3406_thermal.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
processor_thermal_device.c thermal/drivers/int340x: Do not set a wrong tcc offset on resume 2021-09-14 19:53:24 +02:00
processor_thermal_device.h thermal/drivers/int340x/processor_thermal: Add PCI MMIO based thermal driver 2021-07-04 18:28:04 +02:00
processor_thermal_device_pci.c thermal/drivers/int340x/processor_thermal: Fix warning for return value 2021-07-04 18:28:04 +02:00
processor_thermal_device_pci_legacy.c thermal/drivers/int340x/processor_thermal: Add PCI MMIO based thermal driver 2021-07-04 18:28:04 +02:00
processor_thermal_mbox.c thermal/drivers/int340x: processor_thermal: Export mailbox interface 2021-06-11 11:54:42 +02:00
processor_thermal_rapl.c thermal: int340x: processor_thermal: Refactor MMIO interface 2020-12-10 12:29:47 +01:00
processor_thermal_rfim.c thermal/drivers/int340x: processor_thermal: Export additional attributes 2021-06-11 11:55:47 +02:00