UPSTREAM: scsi: ufs: ufs-mediatek: Refactor performance scaling functions

Refactor performance scaling related functions in MediaTek UFS driver.

Link: https://lore.kernel.org/r/20201116065054.7658-2-stanley.chu@mediatek.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 54770cbebe)
Bug: 204438323
Change-Id: I6a3ffc145bd404985a8d55680fb70ec7ad96b945
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Stanley Chu
2020-11-16 14:50:46 +08:00
committed by Bart Van Assche
parent 21c587653b
commit 925faada23

View File

@@ -527,6 +527,19 @@ static void ufs_mtk_init_host_caps(struct ufs_hba *hba)
dev_info(hba->dev, "caps: 0x%x", host->caps);
}
static void ufs_mtk_scale_perf(struct ufs_hba *hba, bool up)
{
struct ufs_mtk_host *host = ufshcd_get_variant(hba);
ufs_mtk_boost_crypt(hba, up);
ufs_mtk_setup_ref_clk(hba, up);
if (up)
phy_power_on(host->mphy);
else
phy_power_off(host->mphy);
}
/**
* ufs_mtk_setup_clocks - enables/disable clocks
* @hba: host controller instance
@@ -568,15 +581,10 @@ static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on,
clk_pwr_off = true;
}
if (clk_pwr_off) {
ufs_mtk_boost_crypt(hba, on);
ufs_mtk_setup_ref_clk(hba, on);
phy_power_off(host->mphy);
}
if (clk_pwr_off)
ufs_mtk_scale_perf(hba, false);
} else if (on && status == POST_CHANGE) {
phy_power_on(host->mphy);
ufs_mtk_setup_ref_clk(hba, on);
ufs_mtk_boost_crypt(hba, on);
ufs_mtk_scale_perf(hba, true);
}
return ret;