Skip to content

Commit d1f4b09

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 79f6a64 commit d1f4b09

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

drivers/thermal/mediatek/lvts_thermal.c

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

9393
#define LVTS_MINIMUM_THRESHOLD 20000
9494

95+
static const u32 default_conn_cmds[] = { 0xC103FFFF, 0xC502FF55 };
96+
/*
97+
* Write device mask: 0xC1030000
98+
*/
99+
static const u32 default_init_cmds[] = {
100+
0xC1030E01, 0xC1030CFC, 0xC1030A8C, 0xC103098D, 0xC10308F1,
101+
0xC10307A6, 0xC10306B8, 0xC1030500, 0xC1030420, 0xC1030300,
102+
0xC1030030, 0xC10300F6, 0xC1030050, 0xC1030060, 0xC10300AC,
103+
0xC10300FC, 0xC103009D, 0xC10300F1, 0xC10300E1
104+
};
105+
95106
static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT;
96107
static int golden_temp_offset;
97108

@@ -880,7 +891,7 @@ static void lvts_ctrl_monitor_enable(struct device *dev, struct lvts_ctrl *lvts_
880891
* each write in the configuration register must be separated by a
881892
* delay of 2 us.
882893
*/
883-
static void lvts_write_config(struct lvts_ctrl *lvts_ctrl, u32 *cmds, int nr_cmds)
894+
static void lvts_write_config(struct lvts_ctrl *lvts_ctrl, const u32 *cmds, int nr_cmds)
884895
{
885896
int i;
886897

@@ -963,9 +974,9 @@ static int lvts_ctrl_set_enable(struct lvts_ctrl *lvts_ctrl, int enable)
963974

964975
static int lvts_ctrl_connect(struct device *dev, struct lvts_ctrl *lvts_ctrl)
965976
{
966-
u32 id, cmds[] = { 0xC103FFFF, 0xC502FF55 };
977+
u32 id;
967978

968-
lvts_write_config(lvts_ctrl, cmds, ARRAY_SIZE(cmds));
979+
lvts_write_config(lvts_ctrl, default_conn_cmds, ARRAY_SIZE(default_conn_cmds));
969980

970981
/*
971982
* LVTS_ID : Get ID and status of the thermal controller
@@ -984,17 +995,7 @@ static int lvts_ctrl_connect(struct device *dev, struct lvts_ctrl *lvts_ctrl)
984995

985996
static int lvts_ctrl_initialize(struct device *dev, struct lvts_ctrl *lvts_ctrl)
986997
{
987-
/*
988-
* Write device mask: 0xC1030000
989-
*/
990-
u32 cmds[] = {
991-
0xC1030E01, 0xC1030CFC, 0xC1030A8C, 0xC103098D, 0xC10308F1,
992-
0xC10307A6, 0xC10306B8, 0xC1030500, 0xC1030420, 0xC1030300,
993-
0xC1030030, 0xC10300F6, 0xC1030050, 0xC1030060, 0xC10300AC,
994-
0xC10300FC, 0xC103009D, 0xC10300F1, 0xC10300E1
995-
};
996-
997-
lvts_write_config(lvts_ctrl, cmds, ARRAY_SIZE(cmds));
998+
lvts_write_config(lvts_ctrl, default_init_cmds, ARRAY_SIZE(default_init_cmds));
998999

9991000
return 0;
10001001
}

0 commit comments

Comments
 (0)