kernel_optimize_test/drivers/thermal
Antoine Tenart 67cdb51ab5 thermal/drivers/int340x: Do not set a wrong tcc offset on resume
commit 8b4bd256674720709a9d858a219fcac6f2f253b5 upstream.

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
fe6a6de6692e ("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 fe6a6de6692e, 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 fe6a6de6692e, 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: fe6a6de6692e ("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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-30 10:11:08 +02:00
..
broadcom
intel thermal/drivers/int340x: Do not set a wrong tcc offset on resume 2021-09-30 10:11:08 +02:00
qcom thermal/drivers/tsens: Fix missing put_device error 2021-05-19 10:13:03 +02:00
samsung thermal/drivers/exynos: Fix an error code in exynos_tmu_probe() 2021-09-26 14:08:57 +02:00
st
tegra
ti-soc-thermal
amlogic_thermal.c
armada_thermal.c
cpufreq_cooling.c thermal/cpufreq_cooling: Update offline CPUs per-cpu thermal_pressure 2021-07-14 16:55:47 +02:00
cpuidle_cooling.c
da9062-thermal.c
db8500_thermal.c
devfreq_cooling.c
dove_thermal.c
gov_bang_bang.c
gov_fair_share.c thermal/core/fair share: Lock the thermal zone while looping over instances 2021-05-11 14:47:41 +02:00
gov_power_allocator.c
gov_step_wise.c
gov_user_space.c
hisi_thermal.c
imx_sc_thermal.c thermal/drivers/imx_sc: Add missing of_node_put for loop iteration 2021-07-25 14:36:16 +02:00
imx_thermal.c
imx8mm_thermal.c
k3_bandgap.c
Kconfig
khadas_mcu_fan.c
kirkwood_thermal.c
Makefile
max77620_thermal.c
mtk_thermal.c
qoriq_thermal.c
rcar_gen3_thermal.c thermal/drivers/rcar_gen3_thermal: Do not shadow rcar_gen3_ths_tj_1 2021-07-25 14:36:16 +02:00
rcar_thermal.c
rockchip_thermal.c
spear_thermal.c
sprd_thermal.c thermal/drivers/sprd: Add missing of_node_put for loop iteration 2021-07-25 14:36:16 +02:00
sun8i_thermal.c
tango_thermal.c
thermal_core.c thermal/core: Potential buffer overflow in thermal_build_list_of_policies() 2021-09-30 10:11:04 +02:00
thermal_core.h
thermal_helpers.c
thermal_hwmon.c
thermal_hwmon.h
thermal_mmio.c
thermal_netlink.c
thermal_netlink.h
thermal_of.c thermal/core/thermal_of: Stop zone device before unregistering it 2021-07-25 14:36:17 +02:00
thermal_sysfs.c
thermal-generic-adc.c
uniphier_thermal.c
zx2967_thermal.c