scsi: ufs: host: mediatek: Correct system PM flow

[ Upstream commit 77b96ef70b ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Peter Wang
2025-09-03 10:44:39 +08:00
committed by Greg Kroah-Hartman
parent 70b956be58
commit 10ad4de87f

View File

@@ -1989,27 +1989,38 @@ static int ufs_mtk_system_suspend(struct device *dev)
ret = ufshcd_system_suspend(dev);
if (ret)
return ret;
goto out;
if (pm_runtime_suspended(hba->dev))
goto out;
ufs_mtk_dev_vreg_set_lpm(hba, true);
if (ufs_mtk_is_rtff_mtcmos(hba))
ufs_mtk_mtcmos_ctrl(false, res);
return 0;
out:
return ret;
}
static int ufs_mtk_system_resume(struct device *dev)
{
int ret = 0;
struct ufs_hba *hba = dev_get_drvdata(dev);
struct arm_smccc_res res;
if (pm_runtime_suspended(hba->dev))
goto out;
ufs_mtk_dev_vreg_set_lpm(hba, false);
if (ufs_mtk_is_rtff_mtcmos(hba))
ufs_mtk_mtcmos_ctrl(true, res);
return ufshcd_system_resume(dev);
out:
ret = ufshcd_system_resume(dev);
return ret;
}
#endif