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

Commit a68a355c authored by Subhash Jadavani's avatar Subhash Jadavani Committed by Can Guo
Browse files

scsi: ufs: add UFS power collapse support during hibern8



UFS host controller hardware may allow the host controller
to be power collapsed when UFS link is hibern8 state, this
change allows the UFS host controller to be power collapsed
during hibern8.

Change-Id: I42f962484b9d6635be1139b1fc6447dd2ca2200c
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
[subhashj@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: default avatarVenkat Gopalakrishnan <venkatg@codeaurora.org>
[cang@codeaurora.org: Resolved trivial merge conflicts]
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
parent 8679ac97
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -8181,13 +8181,17 @@ static int ufshcd_vreg_set_hpm(struct ufs_hba *hba)

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

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

+12 −1
Original line number Diff line number Diff line
@@ -849,7 +849,12 @@ struct ufs_hba {
	 * to do background operation when it's active but it might degrade
	 * the performance of ongoing read/write operations.
	 */
#define UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND (1 << 5)
#define UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND (1 << 6)
	/*
	 * If host controller hardware can be power collapsed when UFS link is
	 * in hibern8 then enable this cap.
	 */
#define UFSHCD_CAP_POWER_COLLAPSE_DURING_HIBERN8 (1 << 7)

	struct devfreq *devfreq;
	struct ufs_clk_scaling clk_scaling;
@@ -884,6 +889,12 @@ static inline bool ufshcd_is_hibern8_on_idle_allowed(struct ufs_hba *hba)
	return hba->caps & UFSHCD_CAP_HIBERN8_ENTER_ON_IDLE;
}

static inline bool ufshcd_is_power_collapse_during_hibern8_allowed(
						struct ufs_hba *hba)
{
	return !!(hba->caps & UFSHCD_CAP_POWER_COLLAPSE_DURING_HIBERN8);
}

static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba)
{
/* DWC UFS Core has the Interrupt aggregation feature but is not detectable*/