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

Commit 67c5330f authored by Subhash Jadavani's avatar Subhash Jadavani
Browse files

scsi: ufs: prevent auto-hibern8 trigger during clock frequency scaling



If auto hibern8 is supported then we should manually put the link in
hibern8 before clock frequency scaling sequence to avoid auto hibern8
racing during clock frequency scaling sequence. Othewise, we may
see UFS command or hibern8 issues after the scaling sequence completion.

Change-Id: I6a126029be6fb03ba4b387fbdfa89e068882a54f
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
parent 79d42bd7
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -9455,10 +9455,29 @@ static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up)
			goto clk_scaling_unprepare;
	}

	/*
	 * If auto hibern8 is supported then put the link in
	 * hibern8 manually, this is to avoid auto hibern8
	 * racing during clock frequency scaling sequence.
	 */
	if (ufshcd_is_auto_hibern8_supported(hba)) {
		ret = ufshcd_uic_hibern8_enter(hba);
		if (ret)
			/* link will be bad state so no need to scale_up_gear */
			return ret;
	}

	ret = ufshcd_scale_clks(hba, scale_up);
	if (ret)
		goto scale_up_gear;

	if (ufshcd_is_auto_hibern8_supported(hba)) {
		ret = ufshcd_uic_hibern8_exit(hba);
		if (ret)
			/* link will be bad state so no need to scale_up_gear */
			return ret;
	}

	/* scale up the gear after scaling up clocks */
	if (scale_up) {
		ret = ufshcd_scale_gear(hba, true);