]> git.hungrycats.org Git - linux/commit
thermal/drivers/mediatek/lvts_thermal: Use offset threshold for IRQ
authorNícolas F. R. A. Prado <nfraprado@collabora.com>
Thu, 6 Jul 2023 15:37:34 +0000 (11:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:48:35 +0000 (09:48 +0200)
commit30a642a6b6662f558d085eabd67f605d6048b18d
treef12c317c17ae737d9a74b47355d430eb7dfa3270
parentba01e46105dfd090a3bf58ac2370fce37accf1d5
thermal/drivers/mediatek/lvts_thermal: Use offset threshold for IRQ

[ Upstream commit f79e996c7ed27bb196facbcd1c69ee33631d7051 ]

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: f5f633b18234 ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/mediatek/lvts_thermal.c