0767933253f867b976a2e24b6584c91b4e4ebbbb
[openwrt/staging/nbd.git] /
1 From 744e2e82b28cb28f8cd2cc4ee788a5c950b12aa2 Mon Sep 17 00:00:00 2001
2 From: Mason Chang <mason-cw.chang@mediatek.com>
3 Date: Mon, 26 May 2025 18:26:59 +0800
4 Subject: [PATCH 3/3] thermal/drivers/mediatek/lvts_thermal: Add mt7988 lvts
5 commands
6
7 These commands are necessary to avoid severely abnormal and inaccurate
8 temperature readings that are caused by using the default commands.
9
10 Signed-off-by: Mason Chang <mason-cw.chang@mediatek.com>
11 Link: https://lore.kernel.org/r/20250526102659.30225-4-mason-cw.chang@mediatek.com
12 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
13 (cherry picked from commit 685a755089f95b7e205c0202567d9a647f9de096)
14 ---
15 drivers/thermal/mediatek/lvts_thermal.c | 16 ++++++++++++----
16 1 file changed, 12 insertions(+), 4 deletions(-)
17
18 --- a/drivers/thermal/mediatek/lvts_thermal.c
19 +++ b/drivers/thermal/mediatek/lvts_thermal.c
20 @@ -1421,6 +1421,8 @@ static int lvts_resume(struct device *de
21 }
22
23 static const u32 default_conn_cmds[] = { 0xC103FFFF, 0xC502FF55 };
24 +static const u32 mt7988_conn_cmds[] = { 0xC103FFFF, 0xC502FC55 };
25 +
26 /*
27 * Write device mask: 0xC1030000
28 */
29 @@ -1431,6 +1433,12 @@ static const u32 default_init_cmds[] = {
30 0xC10300FC, 0xC103009D, 0xC10300F1, 0xC10300E1
31 };
32
33 +static const u32 mt7988_init_cmds[] = {
34 + 0xC1030300, 0xC1030420, 0xC1030500, 0xC10307A6, 0xC1030CFC,
35 + 0xC1030A8C, 0xC103098D, 0xC10308F1, 0xC1030B04, 0xC1030E01,
36 + 0xC10306B8
37 +};
38 +
39 /*
40 * The MT8186 calibration data is stored as packed 3-byte little-endian
41 * values using a weird layout that makes sense only when viewed as a 32-bit
42 @@ -1725,11 +1733,11 @@ static const struct lvts_ctrl_data mt819
43
44 static const struct lvts_data mt7988_lvts_ap_data = {
45 .lvts_ctrl = mt7988_lvts_ap_data_ctrl,
46 - .conn_cmd = default_conn_cmds,
47 - .init_cmd = default_init_cmds,
48 + .conn_cmd = mt7988_conn_cmds,
49 + .init_cmd = mt7988_init_cmds,
50 .num_lvts_ctrl = ARRAY_SIZE(mt7988_lvts_ap_data_ctrl),
51 - .num_conn_cmd = ARRAY_SIZE(default_conn_cmds),
52 - .num_init_cmd = ARRAY_SIZE(default_init_cmds),
53 + .num_conn_cmd = ARRAY_SIZE(mt7988_conn_cmds),
54 + .num_init_cmd = ARRAY_SIZE(mt7988_init_cmds),
55 .temp_factor = LVTS_COEFF_A_MT7988,
56 .temp_offset = LVTS_COEFF_B_MT7988,
57 .gt_calib_bit_offset = 24,