linux-stable/drivers/thermal/intel
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
..
int340x_thermal thermal/drivers/int340x: Do not set a wrong tcc offset on resume 2021-09-14 19:53:24 +02:00
intel_bxt_pmic_thermal.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
intel_menlow.c thermal/drivers/intel: Move intel_menlow to thermal drivers 2021-08-17 14:11:48 +02:00
intel_pch_thermal.c thermal: intel: pch: Fix unexpected shutdown at critical temperature 2021-01-19 22:30:25 +01:00
intel_powerclamp.c thermal/drivers/intel_powerclamp: Replace deprecated CPU-hotplug functions. 2021-08-14 12:51:42 +02:00
intel_quark_dts_thermal.c thermal: Rename set_mode() to change_mode() 2020-06-29 20:26:39 +02:00
intel_soc_dts_iosf.c thermal/drivers/intel/intel_soc_dts_iosf: Switch to use find_first_zero_bit() 2021-07-04 18:28:04 +02:00
intel_soc_dts_iosf.h thermal: intel: intel_soc_dts_iosf: Utilize for_each_set_clump8 macro 2019-12-04 19:44:12 -08:00
intel_soc_dts_thermal.c thermal: Convert to new X86 CPU match macros 2020-03-24 21:33:53 +01:00
intel_tcc_cooling.c drivers/thermal/intel: Add TCC cooling support for AlderLake platform 2021-08-14 12:41:36 +02:00
Kconfig thermal/drivers/intel: Move intel_menlow to thermal drivers 2021-08-17 14:11:48 +02:00
Makefile thermal/drivers/intel: Move intel_menlow to thermal drivers 2021-08-17 14:11:48 +02:00
therm_throt.c thermal/drivers/intel: Allow processing of HWP interrupt 2021-09-09 16:33:20 +02:00
thermal_interrupt.h thermal/drivers/intel: Allow processing of HWP interrupt 2021-09-09 16:33:20 +02:00
x86_pkg_temp_thermal.c thermal/drivers/intel: Initialize RW trip to THERMAL_TEMP_INVALID 2021-05-14 09:37:27 +02:00