Skip to content

Commit 8137bb9

Browse files
bchihiBLdlezcano
authored andcommitted
thermal/drivers/mediatek/lvts_thermal: Add suspend and resume
Add suspend and resume support to LVTS driver. Signed-off-by: Balsam CHIHI <[email protected]> [[email protected]: suspend/resume in noirq phase] Co-developed-by: Bernhard Rosenkränzer <[email protected]> Signed-off-by: Bernhard Rosenkränzer <[email protected]> Reviewed-by: Matthias Brugger <[email protected]> Reviewed-by: Alexandre Mergnat <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0bb4937 commit 8137bb9

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

drivers/thermal/mediatek/lvts_thermal.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,38 @@ static const struct lvts_ctrl_data mt7988_lvts_ap_data_ctrl[] = {
12971297
}
12981298
};
12991299

1300+
static int lvts_suspend(struct device *dev)
1301+
{
1302+
struct lvts_domain *lvts_td;
1303+
int i;
1304+
1305+
lvts_td = dev_get_drvdata(dev);
1306+
1307+
for (i = 0; i < lvts_td->num_lvts_ctrl; i++)
1308+
lvts_ctrl_set_enable(&lvts_td->lvts_ctrl[i], false);
1309+
1310+
clk_disable_unprepare(lvts_td->clk);
1311+
1312+
return 0;
1313+
}
1314+
1315+
static int lvts_resume(struct device *dev)
1316+
{
1317+
struct lvts_domain *lvts_td;
1318+
int i, ret;
1319+
1320+
lvts_td = dev_get_drvdata(dev);
1321+
1322+
ret = clk_prepare_enable(lvts_td->clk);
1323+
if (ret)
1324+
return ret;
1325+
1326+
for (i = 0; i < lvts_td->num_lvts_ctrl; i++)
1327+
lvts_ctrl_set_enable(&lvts_td->lvts_ctrl[i], true);
1328+
1329+
return 0;
1330+
}
1331+
13001332
static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
13011333
{
13021334
.cal_offset = { 0x04, 0x07 },
@@ -1405,12 +1437,17 @@ static const struct of_device_id lvts_of_match[] = {
14051437
};
14061438
MODULE_DEVICE_TABLE(of, lvts_of_match);
14071439

1440+
static const struct dev_pm_ops lvts_pm_ops = {
1441+
NOIRQ_SYSTEM_SLEEP_PM_OPS(lvts_suspend, lvts_resume)
1442+
};
1443+
14081444
static struct platform_driver lvts_driver = {
14091445
.probe = lvts_probe,
14101446
.remove_new = lvts_remove,
14111447
.driver = {
14121448
.name = "mtk-lvts-thermal",
14131449
.of_match_table = lvts_of_match,
1450+
.pm = &lvts_pm_ops,
14141451
},
14151452
};
14161453
module_platform_driver(lvts_driver);

0 commit comments

Comments
 (0)