]> git.hungrycats.org Git - linux/commit
thermal/drivers/mediatek/lvts_thermal: Manage threshold between sensors
authorNícolas F. R. A. Prado <nfraprado@collabora.com>
Thu, 6 Jul 2023 15:37:37 +0000 (11:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:48:35 +0000 (09:48 +0200)
commitdb478bcb3161894c15f9f17d19be8bc4d30946a5
treed9812db06f7e9b15319e87bade262bea76bcb098
parent8e382e9470c01e209c5b89a67e64614583bdb371
thermal/drivers/mediatek/lvts_thermal: Manage threshold between sensors

[ Upstream commit 2bba1acf7a4cbe62abbb4c686e0414209ec5943b ]

Each LVTS thermal controller can have up to four sensors, each capable
of triggering its own interrupt when its measured temperature crosses
the configured threshold. The threshold for each sensor is handled
separately by the thermal framework, since each one is registered with
its own thermal zone and trips. However, the temperature thresholds are
configured on the controller, and therefore are shared between all
sensors on that controller.

When the temperature measured by the sensors is different enough to
cause the thermal framework to configure different thresholds for each
one, interrupts start triggering on sensors outside the last threshold
configured.

To address the issue, track the thresholds required by each sensor and
only actually set the highest one in the hardware, and disable
interrupts for all sensors outside the current configured range.

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