mediatek: backport a hell of thermal commits
[openwrt/staging/dangole.git] / target / linux / mediatek / patches-6.1 / 830-v6.4-32-thermal-drivers-mediatek-lvts_thermal-Disable-undesi.patch
1 From 8f8cab9d3e90acf1db278ef44ad05f10aefb973f Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?=
3 <nfraprado@collabora.com>
4 Date: Thu, 6 Jul 2023 11:37:35 -0400
5 Subject: [PATCH 28/42] thermal/drivers/mediatek/lvts_thermal: Disable
6 undesired interrupts
7 MIME-Version: 1.0
8 Content-Type: text/plain; charset=UTF-8
9 Content-Transfer-Encoding: 8bit
10
11 Out of the many interrupts supported by the hardware, the only ones of
12 interest to the driver currently are:
13 * The temperature went over the high offset threshold, for any of the
14 sensors
15 * The temperature went below the low offset threshold, for any of the
16 sensors
17 * The temperature went over the stage3 threshold
18
19 These are the only thresholds configured by the driver through the
20 OFFSETH, OFFSETL, and PROTTC registers, respectively.
21
22 The current interrupt mask in LVTS_MONINT_CONF, enables many more
23 interrupts, including data ready on sensors for both filtered and
24 immediate mode. These are not only not handled by the driver, but they
25 are also triggered too often, causing unneeded overhead. Disable these
26 unnecessary interrupts.
27
28 The meaning of each bit can be seen in the comment describing
29 LVTS_MONINTST in the IRQ handler.
30
31 Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver")
32 Signed-off-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com>
33 Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
34 Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
35 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
36 Link: https://lore.kernel.org/r/20230706153823.201943-5-nfraprado@collabora.com
37 ---
38 drivers/thermal/mediatek/lvts_thermal.c | 2 +-
39 1 file changed, 1 insertion(+), 1 deletion(-)
40
41 --- a/drivers/thermal/mediatek/lvts_thermal.c
42 +++ b/drivers/thermal/mediatek/lvts_thermal.c
43 @@ -65,7 +65,7 @@
44 #define LVTS_HW_FILTER 0x2
45 #define LVTS_TSSEL_CONF 0x13121110
46 #define LVTS_CALSCALE_CONF 0x300
47 -#define LVTS_MONINT_CONF 0x9FBF7BDE
48 +#define LVTS_MONINT_CONF 0x8300318C
49
50 #define LVTS_INT_SENSOR0 0x0009001F
51 #define LVTS_INT_SENSOR1 0x001203E0