fc173646e053f7f0c0fb925bbcd99d88f1bdcf74
[openwrt/staging/linusw.git] /
1 From patchwork Thu Sep 7 11:20:18 2023
2 Content-Type: text/plain; charset="utf-8"
3 MIME-Version: 1.0
4 Content-Transfer-Encoding: 7bit
5 X-Patchwork-Submitter: Frank Wunderlich <linux@fw-web.de>
6 X-Patchwork-Id: 13376356
7 From: Frank Wunderlich <linux@fw-web.de>
8 To: linux-mediatek@lists.infradead.org
9 Subject: [PATCH] thermal/drivers/mediatek: Fix control buffer enablement on
10 MT7896
11 Date: Thu, 7 Sep 2023 13:20:18 +0200
12 Message-Id: <20230907112018.52811-1-linux@fw-web.de>
13 X-Mailer: git-send-email 2.34.1
14 MIME-Version: 1.0
15 X-Mail-ID: e7eeb8e1-00de-41f6-a5df-ce2e9164136e
16 X-BeenThere: linux-mediatek@lists.infradead.org
17 X-Mailman-Version: 2.1.34
18 Precedence: list
19 List-Id: <linux-mediatek.lists.infradead.org>
20 Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
21 "Rafael J. Wysocki" <rafael@kernel.org>, linux-pm@vger.kernel.org,
22 Amit Kucheria <amitk@kernel.org>, Daniel Golle <daniel@makrotopia.org>,
23 stable@vger.kernel.org, linux-kernel@vger.kernel.org,
24 Matthias Brugger <matthias.bgg@gmail.com>, Zhang Rui <rui.zhang@intel.com>,
25 linux-arm-kernel@lists.infradead.org,
26 AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
27 Sender: "Linux-mediatek" <linux-mediatek-bounces@lists.infradead.org>
28
29 From: Frank Wunderlich <frank-w@public-files.de>
30
31 Reading thermal sensor on mt7986 devices returns invalid temperature:
32
33 bpi-r3 ~ # cat /sys/class/thermal/thermal_zone0/temp
34 -274000
35
36 Fix this by adding missing members in mtk_thermal_data struct which were
37 used in mtk_thermal_turn_on_buffer after commit 33140e668b10.
38
39 Cc: stable@vger.kernel.org
40 Fixes: 33140e668b10 ("thermal/drivers/mediatek: Control buffer enablement tweaks")
41 Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
42 Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
43 Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
44 ---
45 drivers/thermal/mediatek/auxadc_thermal.c | 3 +++
46 1 file changed, 3 insertions(+)
47
48 --- a/drivers/thermal/mediatek/auxadc_thermal.c
49 +++ b/drivers/thermal/mediatek/auxadc_thermal.c
50 @@ -691,6 +691,9 @@ static const struct mtk_thermal_data mt7
51 .adcpnp = mt7986_adcpnp,
52 .sensor_mux_values = mt7986_mux_values,
53 .version = MTK_THERMAL_V3,
54 + .apmixed_buffer_ctl_reg = APMIXED_SYS_TS_CON1,
55 + .apmixed_buffer_ctl_mask = GENMASK(31, 6) | BIT(3),
56 + .apmixed_buffer_ctl_set = BIT(0),
57 };
58
59 static bool mtk_thermal_temp_is_valid(int temp)