1 From 4bbb3598b81eaa329df9c03d9a0cd4d1c70e73a4 Mon Sep 17 00:00:00 2001
2 From: Mason Chang <mason-cw.chang@mediatek.com>
3 Date: Mon, 26 May 2025 18:26:57 +0800
4 Subject: [PATCH 1/3] thermal/drivers/mediatek/lvts_thermal: Change lvts
5 commands array to static const
7 Change the LVTS commands array to static const in preparation for
8 adding different commands.
10 Signed-off-by: Mason Chang <mason-cw.chang@mediatek.com>
11 Link: https://lore.kernel.org/r/20250526102659.30225-2-mason-cw.chang@mediatek.com
12 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
13 (cherry picked from commit c5d5a72c01f7faabe7cc0fd63942c18372101daf)
15 drivers/thermal/mediatek/lvts_thermal.c | 29 +++++++++++++------------
16 1 file changed, 15 insertions(+), 14 deletions(-)
18 --- a/drivers/thermal/mediatek/lvts_thermal.c
19 +++ b/drivers/thermal/mediatek/lvts_thermal.c
22 #define LVTS_MINIMUM_THRESHOLD 20000
24 +static const u32 default_conn_cmds[] = { 0xC103FFFF, 0xC502FF55 };
26 + * Write device mask: 0xC1030000
28 +static const u32 default_init_cmds[] = {
29 + 0xC1030E01, 0xC1030CFC, 0xC1030A8C, 0xC103098D, 0xC10308F1,
30 + 0xC10307A6, 0xC10306B8, 0xC1030500, 0xC1030420, 0xC1030300,
31 + 0xC1030030, 0xC10300F6, 0xC1030050, 0xC1030060, 0xC10300AC,
32 + 0xC10300FC, 0xC103009D, 0xC10300F1, 0xC10300E1
35 static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT;
36 static int golden_temp_offset;
38 @@ -880,7 +891,7 @@ static void lvts_ctrl_monitor_enable(str
39 * each write in the configuration register must be separated by a
42 -static void lvts_write_config(struct lvts_ctrl *lvts_ctrl, u32 *cmds, int nr_cmds)
43 +static void lvts_write_config(struct lvts_ctrl *lvts_ctrl, const u32 *cmds, int nr_cmds)
47 @@ -963,9 +974,9 @@ static int lvts_ctrl_set_enable(struct l
49 static int lvts_ctrl_connect(struct device *dev, struct lvts_ctrl *lvts_ctrl)
51 - u32 id, cmds[] = { 0xC103FFFF, 0xC502FF55 };
54 - lvts_write_config(lvts_ctrl, cmds, ARRAY_SIZE(cmds));
55 + lvts_write_config(lvts_ctrl, default_conn_cmds, ARRAY_SIZE(default_conn_cmds));
58 * LVTS_ID : Get ID and status of the thermal controller
59 @@ -984,17 +995,7 @@ static int lvts_ctrl_connect(struct devi
61 static int lvts_ctrl_initialize(struct device *dev, struct lvts_ctrl *lvts_ctrl)
64 - * Write device mask: 0xC1030000
67 - 0xC1030E01, 0xC1030CFC, 0xC1030A8C, 0xC103098D, 0xC10308F1,
68 - 0xC10307A6, 0xC10306B8, 0xC1030500, 0xC1030420, 0xC1030300,
69 - 0xC1030030, 0xC10300F6, 0xC1030050, 0xC1030060, 0xC10300AC,
70 - 0xC10300FC, 0xC103009D, 0xC10300F1, 0xC10300E1
73 - lvts_write_config(lvts_ctrl, cmds, ARRAY_SIZE(cmds));
74 + lvts_write_config(lvts_ctrl, default_init_cmds, ARRAY_SIZE(default_init_cmds));