Skip to content

Commit 585e92e

Browse files
frank-wdlezcano
authored andcommitted
thermal/drivers/mediatek/lvts_thermal: Add mt7988 support
Add Support for Mediatek Filogic 880/MT7988 LVTS. Signed-off-by: Frank Wunderlich <[email protected]> Tested-by: Daniel Golle <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6725a29 commit 585e92e

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

drivers/thermal/mediatek/lvts_thermal.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,16 @@
8282
#define LVTS_GOLDEN_TEMP_DEFAULT 50
8383
#define LVTS_COEFF_A_MT8195 -250460
8484
#define LVTS_COEFF_B_MT8195 250460
85+
#define LVTS_COEFF_A_MT7988 -204650
86+
#define LVTS_COEFF_B_MT7988 204650
8587

8688
#define LVTS_MSR_IMMEDIATE_MODE 0
8789
#define LVTS_MSR_FILTERED_MODE 1
8890

8991
#define LVTS_MSR_READ_TIMEOUT_US 400
9092
#define LVTS_MSR_READ_WAIT_US (LVTS_MSR_READ_TIMEOUT_US / 2)
9193

94+
#define LVTS_HW_SHUTDOWN_MT7988 105000
9295
#define LVTS_HW_SHUTDOWN_MT8195 105000
9396

9497
#define LVTS_MINIMUM_THRESHOLD 20000
@@ -1267,6 +1270,33 @@ static void lvts_remove(struct platform_device *pdev)
12671270
lvts_debugfs_exit(lvts_td);
12681271
}
12691272

1273+
static const struct lvts_ctrl_data mt7988_lvts_ap_data_ctrl[] = {
1274+
{
1275+
.cal_offset = { 0x00, 0x04, 0x08, 0x0c },
1276+
.lvts_sensor = {
1277+
{ .dt_id = MT7988_CPU_0 },
1278+
{ .dt_id = MT7988_CPU_1 },
1279+
{ .dt_id = MT7988_ETH2P5G_0 },
1280+
{ .dt_id = MT7988_ETH2P5G_1 }
1281+
},
1282+
.num_lvts_sensor = 4,
1283+
.offset = 0x0,
1284+
.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT7988,
1285+
},
1286+
{
1287+
.cal_offset = { 0x14, 0x18, 0x1c, 0x20 },
1288+
.lvts_sensor = {
1289+
{ .dt_id = MT7988_TOPS_0},
1290+
{ .dt_id = MT7988_TOPS_1},
1291+
{ .dt_id = MT7988_ETHWARP_0},
1292+
{ .dt_id = MT7988_ETHWARP_1}
1293+
},
1294+
.num_lvts_sensor = 4,
1295+
.offset = 0x100,
1296+
.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT7988,
1297+
}
1298+
};
1299+
12701300
static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
12711301
{
12721302
.cal_offset = { 0x04, 0x07 },
@@ -1346,6 +1376,13 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = {
13461376
}
13471377
};
13481378

1379+
static const struct lvts_data mt7988_lvts_ap_data = {
1380+
.lvts_ctrl = mt7988_lvts_ap_data_ctrl,
1381+
.num_lvts_ctrl = ARRAY_SIZE(mt7988_lvts_ap_data_ctrl),
1382+
.temp_factor = LVTS_COEFF_A_MT7988,
1383+
.temp_offset = LVTS_COEFF_B_MT7988,
1384+
};
1385+
13491386
static const struct lvts_data mt8195_lvts_mcu_data = {
13501387
.lvts_ctrl = mt8195_lvts_mcu_data_ctrl,
13511388
.num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl),
@@ -1361,6 +1398,7 @@ static const struct lvts_data mt8195_lvts_ap_data = {
13611398
};
13621399

13631400
static const struct of_device_id lvts_of_match[] = {
1401+
{ .compatible = "mediatek,mt7988-lvts-ap", .data = &mt7988_lvts_ap_data },
13641402
{ .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data },
13651403
{ .compatible = "mediatek,mt8195-lvts-ap", .data = &mt8195_lvts_ap_data },
13661404
{},

0 commit comments

Comments
 (0)