mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-28 09:39:00 +00:00
c36de2e73a
Backport almost 50 commits from upstream Linux to improve thermal drivers for MediaTek SoCs and add new LVTS driver for MT7988. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
78 lines
2.7 KiB
Diff
78 lines
2.7 KiB
Diff
From 93bb11dd19bdcc1fc97c7ceababd0db9fde128ad Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?=
|
|
<nfraprado@collabora.com>
|
|
Date: Thu, 6 Jul 2023 11:37:34 -0400
|
|
Subject: [PATCH 27/42] thermal/drivers/mediatek/lvts_thermal: Use offset
|
|
threshold for IRQ
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
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
|
|
---
|
|
drivers/thermal/mediatek/lvts_thermal.c | 12 ++++++------
|
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
|
--- a/drivers/thermal/mediatek/lvts_thermal.c
|
|
+++ b/drivers/thermal/mediatek/lvts_thermal.c
|
|
@@ -298,9 +298,9 @@ static int lvts_set_trips(struct thermal
|
|
u32 raw_high = lvts_temp_to_raw(high);
|
|
|
|
/*
|
|
- * Hot to normal temperature threshold
|
|
+ * Low offset temperature threshold
|
|
*
|
|
- * LVTS_H2NTHRE
|
|
+ * LVTS_OFFSETL
|
|
*
|
|
* Bits:
|
|
*
|
|
@@ -309,13 +309,13 @@ static int lvts_set_trips(struct thermal
|
|
if (low != -INT_MAX) {
|
|
pr_debug("%s: Setting low limit temperature interrupt: %d\n",
|
|
thermal_zone_device_type(tz), low);
|
|
- writel(raw_low, LVTS_H2NTHRE(base));
|
|
+ writel(raw_low, LVTS_OFFSETL(base));
|
|
}
|
|
|
|
/*
|
|
- * Hot temperature threshold
|
|
+ * High offset temperature threshold
|
|
*
|
|
- * LVTS_HTHRE
|
|
+ * LVTS_OFFSETH
|
|
*
|
|
* Bits:
|
|
*
|
|
@@ -323,7 +323,7 @@ static int lvts_set_trips(struct thermal
|
|
*/
|
|
pr_debug("%s: Setting high limit temperature interrupt: %d\n",
|
|
thermal_zone_device_type(tz), high);
|
|
- writel(raw_high, LVTS_HTHRE(base));
|
|
+ writel(raw_high, LVTS_OFFSETH(base));
|
|
|
|
return 0;
|
|
}
|