Skip to content

Commit f79e996

Browse files
nfrapradodlezcano
authored andcommitted
thermal/drivers/mediatek/lvts_thermal: Use offset threshold for IRQ
There are two kinds of temperature monitoring interrupts available: * High Offset, Low Offset * Hot, Hot to normal, Cold The code currently uses the hot/h2n/cold interrupts, however in a way that doesn't work: the cold threshold is left uninitialized, which prevents the other thresholds from ever triggering, and the h2n interrupt is used as the lower threshold, which prevents the hot interrupt from triggering again after the thresholds are updated by the thermal framework, since a hot interrupt can only trigger again after the hot to normal interrupt has been triggered. But better yet than addressing those issues, is to use the high/low offset interrupts instead. This way only two thresholds need to be managed, which have a simpler state machine, making them a better match to the thermal framework's high and low thresholds. Fixes: f5f633b ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20230706153823.201943-4-nfraprado@collabora.com
1 parent 64de162 commit f79e996

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/thermal/mediatek/lvts_thermal.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,9 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
298298
u32 raw_high = lvts_temp_to_raw(high);
299299

300300
/*
301-
* Hot to normal temperature threshold
301+
* Low offset temperature threshold
302302
*
303-
* LVTS_H2NTHRE
303+
* LVTS_OFFSETL
304304
*
305305
* Bits:
306306
*
@@ -309,21 +309,21 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
309309
if (low != -INT_MAX) {
310310
pr_debug("%s: Setting low limit temperature interrupt: %d\n",
311311
thermal_zone_device_type(tz), low);
312-
writel(raw_low, LVTS_H2NTHRE(base));
312+
writel(raw_low, LVTS_OFFSETL(base));
313313
}
314314

315315
/*
316-
* Hot temperature threshold
316+
* High offset temperature threshold
317317
*
318-
* LVTS_HTHRE
318+
* LVTS_OFFSETH
319319
*
320320
* Bits:
321321
*
322322
* 14-0 : Raw temperature for threshold
323323
*/
324324
pr_debug("%s: Setting high limit temperature interrupt: %d\n",
325325
thermal_zone_device_type(tz), high);
326-
writel(raw_high, LVTS_HTHRE(base));
326+
writel(raw_high, LVTS_OFFSETH(base));
327327

328328
return 0;
329329
}

0 commit comments

Comments
 (0)