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

Commit 5645285c authored by Nitin Rawat's avatar Nitin Rawat Committed by Gerrit - the friendly Code Review server
Browse files

phy: ufs: put regulator to LPM mode



If regulator is marked as always on then we should atleast put
it in LPM mode as we can't disabled it.

Change-Id: I1c2f398d4a3b62d9e641ae53b7c4806b69c4862b
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: default avatarNitin Rawat <nitirawa@codeaurora.org>
parent 2aef1c3d
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -496,9 +496,25 @@ int ufs_qcom_phy_disable_vreg(struct phy *phy,
	struct device *dev = ufs_qcom_phy->dev;
	int ret = 0;

	if (!vreg || !vreg->enabled || vreg->is_always_on)
	if (!vreg || !vreg->enabled)
		goto out;

	if (vreg->is_always_on) {
		/* voting 0 uA load will keep regulator in LPM mode */
		ret = regulator_set_load(vreg->reg, 0);
		if (ret >= 0) {
			/*
			 * regulator_set_load() returns new regulator
			 * mode upon success
			 */
			ret = 0;
		} else {
			dev_err(dev, "%s: %s set optimum mode(uA_load=0) failed, err=%d\n",
					__func__, vreg->name, ret);
		}
		goto out;
	}

	ret = regulator_disable(vreg->reg);

	if (!ret) {