Skip to content

Commit 77b96ef

Browse files
ptr324martinkpetersen
authored andcommitted
scsi: ufs: host: mediatek: Correct system PM flow
Refine the system power management (PM) flow by skipping low power mode (LPM) and MTCMOS settings if runtime PM is already applied. Prevent redundant operations to ensure a more efficient PM process. Signed-off-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 15ef3f5 commit 77b96ef

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

drivers/ufs/host/ufs-mediatek.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,27 +2304,38 @@ static int ufs_mtk_system_suspend(struct device *dev)
23042304

23052305
ret = ufshcd_system_suspend(dev);
23062306
if (ret)
2307-
return ret;
2307+
goto out;
2308+
2309+
if (pm_runtime_suspended(hba->dev))
2310+
goto out;
23082311

23092312
ufs_mtk_dev_vreg_set_lpm(hba, true);
23102313

23112314
if (ufs_mtk_is_rtff_mtcmos(hba))
23122315
ufs_mtk_mtcmos_ctrl(false, res);
23132316

2314-
return 0;
2317+
out:
2318+
return ret;
23152319
}
23162320

23172321
static int ufs_mtk_system_resume(struct device *dev)
23182322
{
2323+
int ret = 0;
23192324
struct ufs_hba *hba = dev_get_drvdata(dev);
23202325
struct arm_smccc_res res;
23212326

2327+
if (pm_runtime_suspended(hba->dev))
2328+
goto out;
2329+
23222330
ufs_mtk_dev_vreg_set_lpm(hba, false);
23232331

23242332
if (ufs_mtk_is_rtff_mtcmos(hba))
23252333
ufs_mtk_mtcmos_ctrl(true, res);
23262334

2327-
return ufshcd_system_resume(dev);
2335+
out:
2336+
ret = ufshcd_system_resume(dev);
2337+
2338+
return ret;
23282339
}
23292340
#endif
23302341

0 commit comments

Comments
 (0)