1
0

scsi: ufs: host: mediatek: Adjust clock scaling for PM flow

Adjust clock scaling during suspend and resume in the UFS Mediatek
driver. Ensure that the clock scales down during suspend if it was
scaled up, and scales up again after resume.  This adjustment maintains
proper power management.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Acked-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Link: https://patch.msgid.link/20250924094527.2992256-3-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Peter Wang
2025-09-24 17:43:24 +08:00
committed by Martin K. Petersen
parent 7162536410
commit 55ce691dc7

View File

@@ -1774,9 +1774,11 @@ static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,
ufs_mtk_sram_pwr_ctrl(false, res);
/* Release pm_qos if in scale-up mode during suspend */
if (ufshcd_is_clkscaling_supported(hba) && (host->clk_scale_up))
/* Release pm_qos/clk if in scale-up mode during suspend */
if (ufshcd_is_clkscaling_supported(hba) && (host->clk_scale_up)) {
ufshcd_pm_qos_update(hba, false);
_ufs_mtk_clk_scale(hba, false);
}
return 0;
fail:
@@ -1804,9 +1806,11 @@ static int ufs_mtk_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
if (err)
goto fail;
/* Request pm_qos if in scale-up mode after resume */
if (ufshcd_is_clkscaling_supported(hba) && (host->clk_scale_up))
/* Request pm_qos/clk if in scale-up mode after resume */
if (ufshcd_is_clkscaling_supported(hba) && (host->clk_scale_up)) {
ufshcd_pm_qos_update(hba, true);
_ufs_mtk_clk_scale(hba, true);
}
if (ufshcd_is_link_hibern8(hba)) {
err = ufs_mtk_link_set_hpm(hba);