Skip to content

Commit 277c236

Browse files
Mason Changgregkh
authored andcommitted
thermal/drivers/mediatek/lvts_thermal: Change lvts commands array to static const
commit c5d5a72 upstream. Change the LVTS commands array to static const in preparation for adding different commands. Signed-off-by: Mason Chang <mason-cw.chang@mediatek.com> Link: https://lore.kernel.org/r/20250526102659.30225-2-mason-cw.chang@mediatek.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0598123 commit 277c236

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

drivers/thermal/mediatek/lvts_thermal.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@
9696

9797
#define LVTS_MINIMUM_THRESHOLD 20000
9898

99+
static const u32 default_conn_cmds[] = { 0xC103FFFF, 0xC502FF55 };
100+
/*
101+
* Write device mask: 0xC1030000
102+
*/
103+
static const u32 default_init_cmds[] = {
104+
0xC1030E01, 0xC1030CFC, 0xC1030A8C, 0xC103098D, 0xC10308F1,
105+
0xC10307A6, 0xC10306B8, 0xC1030500, 0xC1030420, 0xC1030300,
106+
0xC1030030, 0xC10300F6, 0xC1030050, 0xC1030060, 0xC10300AC,
107+
0xC10300FC, 0xC103009D, 0xC10300F1, 0xC10300E1
108+
};
109+
99110
static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT;
100111
static int golden_temp_offset;
101112

@@ -902,7 +913,7 @@ static void lvts_ctrl_monitor_enable(struct device *dev, struct lvts_ctrl *lvts_
902913
* each write in the configuration register must be separated by a
903914
* delay of 2 us.
904915
*/
905-
static void lvts_write_config(struct lvts_ctrl *lvts_ctrl, u32 *cmds, int nr_cmds)
916+
static void lvts_write_config(struct lvts_ctrl *lvts_ctrl, const u32 *cmds, int nr_cmds)
906917
{
907918
int i;
908919

@@ -985,9 +996,9 @@ static int lvts_ctrl_set_enable(struct lvts_ctrl *lvts_ctrl, int enable)
985996

986997
static int lvts_ctrl_connect(struct device *dev, struct lvts_ctrl *lvts_ctrl)
987998
{
988-
u32 id, cmds[] = { 0xC103FFFF, 0xC502FF55 };
999+
u32 id;
9891000

990-
lvts_write_config(lvts_ctrl, cmds, ARRAY_SIZE(cmds));
1001+
lvts_write_config(lvts_ctrl, default_conn_cmds, ARRAY_SIZE(default_conn_cmds));
9911002

9921003
/*
9931004
* LVTS_ID : Get ID and status of the thermal controller
@@ -1006,17 +1017,7 @@ static int lvts_ctrl_connect(struct device *dev, struct lvts_ctrl *lvts_ctrl)
10061017

10071018
static int lvts_ctrl_initialize(struct device *dev, struct lvts_ctrl *lvts_ctrl)
10081019
{
1009-
/*
1010-
* Write device mask: 0xC1030000
1011-
*/
1012-
u32 cmds[] = {
1013-
0xC1030E01, 0xC1030CFC, 0xC1030A8C, 0xC103098D, 0xC10308F1,
1014-
0xC10307A6, 0xC10306B8, 0xC1030500, 0xC1030420, 0xC1030300,
1015-
0xC1030030, 0xC10300F6, 0xC1030050, 0xC1030060, 0xC10300AC,
1016-
0xC10300FC, 0xC103009D, 0xC10300F1, 0xC10300E1
1017-
};
1018-
1019-
lvts_write_config(lvts_ctrl, cmds, ARRAY_SIZE(cmds));
1020+
lvts_write_config(lvts_ctrl, default_init_cmds, ARRAY_SIZE(default_init_cmds));
10201021

10211022
return 0;
10221023
}

0 commit comments

Comments
 (0)