]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
thermal/drivers/mediatek/lvts_thermal: Add mt7988 lvts commands
authorMason Chang <mason-cw.chang@mediatek.com>
Mon, 26 May 2025 10:26:59 +0000 (18:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Sep 2025 13:31:56 +0000 (15:31 +0200)
commit 685a755089f95b7e205c0202567d9a647f9de096 upstream.

These commands are necessary to avoid severely abnormal and inaccurate
temperature readings that are caused by using the default commands.

Signed-off-by: Mason Chang <mason-cw.chang@mediatek.com>
Link: https://lore.kernel.org/r/20250526102659.30225-4-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>
drivers/thermal/mediatek/lvts_thermal.c

index 239476152bab104e633721b7a3c2d6117108e6e1..017191b9f8645f3e738049764ec050d4bd8a1823 100644 (file)
@@ -1421,6 +1421,8 @@ static int lvts_resume(struct device *dev)
 }
 
 static const u32 default_conn_cmds[] = { 0xC103FFFF, 0xC502FF55 };
+static const u32 mt7988_conn_cmds[] = { 0xC103FFFF, 0xC502FC55 };
+
 /*
  * Write device mask: 0xC1030000
  */
@@ -1431,6 +1433,12 @@ static const u32 default_init_cmds[] = {
        0xC10300FC, 0xC103009D, 0xC10300F1, 0xC10300E1
 };
 
+static const u32 mt7988_init_cmds[] = {
+       0xC1030300, 0xC1030420, 0xC1030500, 0xC10307A6, 0xC1030CFC,
+       0xC1030A8C, 0xC103098D, 0xC10308F1, 0xC1030B04, 0xC1030E01,
+       0xC10306B8
+};
+
 /*
  * The MT8186 calibration data is stored as packed 3-byte little-endian
  * values using a weird layout that makes sense only when viewed as a 32-bit
@@ -1725,11 +1733,11 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = {
 
 static const struct lvts_data mt7988_lvts_ap_data = {
        .lvts_ctrl      = mt7988_lvts_ap_data_ctrl,
-       .conn_cmd       = default_conn_cmds,
-       .init_cmd       = default_init_cmds,
+       .conn_cmd       = mt7988_conn_cmds,
+       .init_cmd       = mt7988_init_cmds,
        .num_lvts_ctrl  = ARRAY_SIZE(mt7988_lvts_ap_data_ctrl),
-       .num_conn_cmd   = ARRAY_SIZE(default_conn_cmds),
-       .num_init_cmd   = ARRAY_SIZE(default_init_cmds),
+       .num_conn_cmd   = ARRAY_SIZE(mt7988_conn_cmds),
+       .num_init_cmd   = ARRAY_SIZE(mt7988_init_cmds),
        .temp_factor    = LVTS_COEFF_A_MT7988,
        .temp_offset    = LVTS_COEFF_B_MT7988,
        .gt_calib_bit_offset = 24,