scsi: ufs-qcom: disable the UFS PHY reference clock during clock gating

If UFS link is inactive then UFS PHY reference clock can be switched off
to save power. As of now, this clock is turned off only during the suspend
(runtime and system). This change extend support to turn off the PHY
reference clock during clock gating (after pre-defined idle timeout) as
well.

Change-Id: Id1f83a003e228abedf222157691998470c3f7932
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
This commit is contained in:
Subhash Jadavani 2014-10-22 18:18:19 -07:00 committed by David Keitel
parent 89dc95d277
commit f1a31bcee0

View file

@ -956,12 +956,23 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on)
if (err)
goto out;
err = ufs_qcom_phy_enable_ref_clk(host->generic_phy);
if (err) {
dev_err(hba->dev, "%s enable phy ref clock failed, err=%d\n",
__func__, err);
ufs_qcom_phy_disable_iface_clk(host->generic_phy);
goto out;
}
vote = host->bus_vote.saved_vote;
if (vote == host->bus_vote.min_bw_vote)
ufs_qcom_update_bus_bw_vote(host);
} else {
/* M-PHY RMMI interface clocks can be turned off */
ufs_qcom_phy_disable_iface_clk(host->generic_phy);
/* If link is not active, turn off UFS local PHY ref_clk */
if (!ufs_qcom_is_link_active(hba))
ufs_qcom_phy_disable_ref_clk(host->generic_phy);
vote = host->bus_vote.min_bw_vote;
}