WSL2-Linux-Kernel/drivers/thermal
Daniel Lezcano 5431aef936 thermal/drivers/hisi: Fix multiple alarm interrupts firing
commit db2b033260 upstream.

The DT specifies a threshold of 65000, we setup the register with a value in
the temperature resolution for the controller, 64656.

When we reach 64656, the interrupt fires, the interrupt is disabled. Then the
irq thread runs and calls thermal_zone_device_update() which will call in turn
hisi_thermal_get_temp().

The function will look if the temperature decreased, assuming it was more than
65000, but that is not the case because the current temperature is 64656
(because of the rounding when setting the threshold). This condition being
true, we re-enable the interrupt which fires immediately after exiting the irq
thread. That happens again and again until the temperature goes to more than
65000.

Potentially, there is here an interrupt storm if the temperature stabilizes at
this temperature. A very unlikely case but possible.

In any case, it does not make sense to handle dozens of alarm interrupt for
nothing.

Fix this by rounding the threshold value to the controller resolution so the
check against the threshold is consistent with the one set in the controller.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Kevin Wangtao <kevin.wangtao@hisilicon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-25 14:26:31 +01:00
..
broadcom thermal: bcm2835: constify thermal_zone_of_device_ops structures 2017-08-11 11:38:30 +08:00
int340x_thermal License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
qcom
samsung thermal: exynos: constify thermal_zone_of_device_ops structures 2017-08-11 11:38:30 +08:00
st
tegra License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ti-soc-thermal License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig Merge branches 'thermal-core', 'thermal-soc', 'thermal-intel' and 'const-thermal-zone-structure' into next 2017-09-08 11:20:04 +08:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
armada_thermal.c
clock_cooling.c
cpu_cooling.c thermal: cpu_cooling: Replace kmalloc with kmalloc_array 2017-05-27 17:33:04 -07:00
da9062-thermal.c thermal: da9062/61: Thermal junction temperature monitoring driver 2017-04-06 21:48:03 -07:00
db8500_thermal.c
devfreq_cooling.c trace: thermal: add another parameter 'power' to the tracing function 2017-05-05 15:54:45 +08:00
dove_thermal.c
fair_share.c thermal: fix source code documentation for parameters 2017-06-29 10:46:31 +08:00
gov_bang_bang.c
hisi_thermal.c thermal/drivers/hisi: Fix multiple alarm interrupts firing 2017-12-25 14:26:31 +01:00
imx_thermal.c thermal: imx: Handle return value of clk_prepare_enable 2017-06-30 16:41:55 -07:00
intel_bxt_pmic_thermal.c mfd: intel_soc_pmic_bxtwc: Remove thermal second level IRQs 2017-06-19 15:44:29 +01:00
intel_pch_thermal.c thermal: intel_pch_thermal: Fix enable check on Broadwell-DE 2017-08-15 14:32:58 +08:00
intel_powerclamp.c sched/headers: Prepare for new header dependencies before moving code to <uapi/linux/sched/types.h> 2017-03-02 08:42:27 +01:00
intel_quark_dts_thermal.c
intel_soc_dts_iosf.c
intel_soc_dts_iosf.h
intel_soc_dts_thermal.c Thermal: Intel SoC DTS: Change interrupt request behavior 2017-05-05 16:00:10 +08:00
kirkwood_thermal.c
max77620_thermal.c thermal: max77620: fix pinmux conflict on reprobe 2017-06-13 11:07:32 +02:00
mtk_thermal.c thermal: mediatek: minor mtk_thermal.c cleanups 2017-08-31 21:13:53 +08:00
of-thermal.c
power_allocator.c
qcom-spmi-temp-alarm.c
qoriq_thermal.c thermal: qoriq: constify thermal_zone_of_device_ops structures 2017-08-11 11:38:29 +08:00
rcar_gen3_thermal.c thermal: rcar_gen3_thermal: constify thermal_zone_of_device_ops structures 2017-08-11 11:38:29 +08:00
rcar_thermal.c
rockchip_thermal.c thermal: rockchip: Support the RK3328 SOC in thermal driver 2017-08-11 16:21:38 +08:00
spear_thermal.c
step_wise.c thermal/drivers/step_wise: Fix temperature regulation misbehavior 2017-12-20 10:10:28 +01:00
tango_thermal.c
thermal-generic-adc.c
thermal_core.c thermal: core: Fix resources release in error paths in thermal_zone_device_register() 2017-08-11 11:34:07 +08:00
thermal_core.h thermal: core: Add some new helper functions to free resources 2017-08-11 11:33:49 +08:00
thermal_helpers.c
thermal_hwmon.c
thermal_hwmon.h
thermal_sysfs.c thermal: core: Add some new helper functions to free resources 2017-08-11 11:33:49 +08:00
uniphier_thermal.c thermal: uniphier: add UniPhier thermal driver 2017-08-11 10:49:52 +08:00
user_space.c thermal: fix source code documentation for parameters 2017-06-29 10:46:31 +08:00
x86_pkg_temp_thermal.c
zx2967_thermal.c thermal: zx2967: constify thermal_zone_of_device_ops structures 2017-08-11 11:38:30 +08:00