Skip to content

Commit 2f23e31

Browse files
ppailletdlezcano
authored andcommitted
thermal: stm32: Fix low threshold interrupt flood
With the STM32 thermal peripheral, it is not possible to dump the temperature that has caused the interrupt. When the temperature reaches the low threshold, we generally read a temperature that is a little bit higher than the low threshold. This maybe due to sampling precision, and also because the CPU becomes hotter when it quits WFI mode. In that case, the framework does not change the trip points. This leads to a lot of low threshold interrupts. The fix is to set the low threshold value 0.5 degrees Celsius below the actual request. The problem is not so frequent with the high threshold and it would no be a good idea to set the threshold value higher than the request. Signed-off-by: Pascal Paillet <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9d8593f commit 2f23e31

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/thermal/st/stm_thermal.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ static int stm_thermal_set_trips(void *data, int low, int high)
321321

322322
if (low > -INT_MAX) {
323323
sensor->low_temp_enabled = 1;
324-
ret = stm_thermal_calculate_threshold(sensor, low, &th);
324+
/* add 0.5 of hysteresis due to measurement error */
325+
ret = stm_thermal_calculate_threshold(sensor, low - 500, &th);
325326
if (ret)
326327
return ret;
327328

0 commit comments

Comments
 (0)