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

Commit e281446b authored by Veerabhadrarao Badiganti's avatar Veerabhadrarao Badiganti
Browse files

scsi : ufs-qcom: Add provision to set qcom specific supplies in LPM



While UFS is configured for sleep mode during APSS power collapse
(with spm_lvl=3), UFS driver votes-on for PX10 supply (which drives
IO Pads and Reset line) even during suspend. Usually it votes PX10
with 100uA load all the time. On most of the targets, this load
(100uA) is sufficient to keep the supply in LPM mode.

But on some targets any load value other than 0, forces the supply to
HMP mode, On such targets PX10 supply may cause more power leakage in
RBSC scenario.

So add provision to supply minimum load from device-tree, and set
explicit load during suspend/resume. On targets where explicit 0 load
is needed, it can be supplied from device tree.

This logic is present for regular UFS supplies. Same logic is being
extended to qcom specific supplies.

Change-Id: Ic81582e9add10864f81181af5f84701febb97aef
Signed-off-by: default avatarVeerabhadrarao Badiganti <vbadigan@codeaurora.org>
parent 41539720
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -745,6 +745,17 @@ static int ufs_qcom_link_startup_notify(struct ufs_hba *hba,
	return err;
}

static int ufshcd_qcom_set_vreg_load(struct ufs_vreg *vreg, int ua)
{
	if (!vreg)
		return 0;
	else if (vreg->unused)
		return 0;
	else
		return regulator_set_load(vreg->reg, ua);

}

static int ufs_qcom_config_vreg(struct device *dev,
		struct ufs_vreg *vreg, bool on)
{
@@ -838,6 +849,9 @@ static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
		if (host->vddp_ref_clk && ufs_qcom_is_link_off(hba))
			ret = ufs_qcom_disable_vreg(hba->dev,
					host->vddp_ref_clk);
		else if (host->vddp_ref_clk && ufs_qcom_is_link_hibern8(hba))
			ret = ufshcd_qcom_set_vreg_load(host->vddp_ref_clk,
						host->vddp_ref_clk->min_uA);

		if (host->vccq_parent && !hba->auto_bkops_enabled)
			ufs_qcom_config_vreg(hba->dev,
@@ -875,6 +889,10 @@ static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
				   hba->spm_lvl > UFS_PM_LVL_3))
		ufs_qcom_enable_vreg(hba->dev,
				      host->vddp_ref_clk);
	else if (host->vddp_ref_clk && ufs_qcom_is_link_hibern8(hba))
		ufshcd_qcom_set_vreg_load(host->vddp_ref_clk,
					host->vddp_ref_clk->max_uA);

	if (host->vccq_parent)
		ufs_qcom_config_vreg(hba->dev, host->vccq_parent, true);

@@ -2033,6 +2051,10 @@ static int ufs_qcom_parse_reg_info(struct ufs_qcom_host *host, char *name,
		goto out;
	}

	snprintf(prop_name, MAX_PROP_SIZE, "%s-min-microamp", name);
	if (of_property_read_u32(np, prop_name, &vreg->min_uA))
		vreg->min_uA = UFS_VREG_LPM_LOAD_UA;

	vreg->reg = devm_regulator_get(dev, vreg->name);
	if (IS_ERR(vreg->reg)) {
		ret = PTR_ERR(vreg->reg);