Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d1dfe17 authored by Subhash Jadavani's avatar Subhash Jadavani
Browse files

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: default avatarSubhash Jadavani <subhashj@codeaurora.org>
parent 2dafc2a8
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -864,12 +864,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;
	}