Commit d6fcf81a authored by Subhash Jadavani's avatar Subhash Jadavani Committed by Martin K. Petersen

scsi: ufs: suspend clock scaling at the start of suspend

Currently clock scaling is suspended only after the host and device are
put in low power mode but we should avoid clock scaling running after
UFS link is put in low power mode (hibern8). This change suspends clock
scaling before putting host/device in low power mode.
Reviewed-by: default avatarSahitya Tummala <stummala@codeaurora.org>
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent afa3dfd4
...@@ -5892,6 +5892,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) ...@@ -5892,6 +5892,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
ufshcd_hold(hba, false); ufshcd_hold(hba, false);
hba->clk_gating.is_suspended = true; hba->clk_gating.is_suspended = true;
ufshcd_suspend_clkscaling(hba);
if (req_dev_pwr_mode == UFS_ACTIVE_PWR_MODE && if (req_dev_pwr_mode == UFS_ACTIVE_PWR_MODE &&
req_link_state == UIC_LINK_ACTIVE_STATE) { req_link_state == UIC_LINK_ACTIVE_STATE) {
goto disable_clks; goto disable_clks;
...@@ -5899,12 +5901,12 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) ...@@ -5899,12 +5901,12 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
if ((req_dev_pwr_mode == hba->curr_dev_pwr_mode) && if ((req_dev_pwr_mode == hba->curr_dev_pwr_mode) &&
(req_link_state == hba->uic_link_state)) (req_link_state == hba->uic_link_state))
goto out; goto enable_gating;
/* UFS device & link must be active before we enter in this function */ /* UFS device & link must be active before we enter in this function */
if (!ufshcd_is_ufs_dev_active(hba) || !ufshcd_is_link_active(hba)) { if (!ufshcd_is_ufs_dev_active(hba) || !ufshcd_is_link_active(hba)) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto enable_gating;
} }
if (ufshcd_is_runtime_pm(pm_op)) { if (ufshcd_is_runtime_pm(pm_op)) {
...@@ -5940,13 +5942,6 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) ...@@ -5940,13 +5942,6 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
ufshcd_vreg_set_lpm(hba); ufshcd_vreg_set_lpm(hba);
disable_clks: disable_clks:
/*
* The clock scaling needs access to controller registers. Hence, Wait
* for pending clock scaling work to be done before clocks are
* turned off.
*/
ufshcd_suspend_clkscaling(hba);
/* /*
* Call vendor specific suspend callback. As these callbacks may access * Call vendor specific suspend callback. As these callbacks may access
* vendor specific host controller register space call them before the * vendor specific host controller register space call them before the
...@@ -5983,6 +5978,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) ...@@ -5983,6 +5978,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
if (!ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE)) if (!ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE))
ufshcd_disable_auto_bkops(hba); ufshcd_disable_auto_bkops(hba);
enable_gating: enable_gating:
ufshcd_resume_clkscaling(hba);
hba->clk_gating.is_suspended = false; hba->clk_gating.is_suspended = false;
ufshcd_release(hba); ufshcd_release(hba);
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment