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

Commit c0044191 authored by Subhash Jadavani's avatar Subhash Jadavani
Browse files

scsi: ufs: add support to power collapse UFS host controller



If UFS link is in OFF state then UFS host controller can be power collapsed
to avoid leakage current from it. Note that if UFS host controller is power
collapsed, full UFS reinitialization will be required on resume to
re-establish the link between host and device.

Change-Id: I7b96c65360f170eed5f063b1645bed149b363997
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
parent 6f818221
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -5645,6 +5645,18 @@ out:
	return ret;
}

static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba)
{
	if (ufshcd_is_link_off(hba))
		ufshcd_setup_hba_vreg(hba, false);
}

static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba)
{
	if (ufshcd_is_link_off(hba))
		ufshcd_setup_hba_vreg(hba, true);
}

/**
 * ufshcd_suspend - helper function for suspend operations
 * @hba: per adapter instance
@@ -5770,7 +5782,8 @@ disable_clks:
	 * host controller trasanction expected till resume.
	 */
	ufshcd_disable_irq(hba);

	/* Put the host controller in low power mode if possible */
	ufshcd_hba_vreg_set_lpm(hba);
	goto out;

vops_resume:
@@ -5816,6 +5829,8 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)

	hba->pm_op_in_progress = 1;
	old_link_state = hba->uic_link_state;

	ufshcd_hba_vreg_set_hpm(hba);
	/* Make sure clocks are enabled before accessing controller */
	ret = ufshcd_setup_clocks(hba, true);
	if (ret)