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

Commit 03737197 authored by Asutosh Das's avatar Asutosh Das
Browse files

scsi: ufs: delay switching off regulators



Don't turn-off regulators immediately in case of errors.
If eMMC is not yet probed, turing off regulators without
sending a PON to eMMC is not a good idea.

Hence, allow upto 10sec for eMMC to be probed. If eMMC is
present it'd vote for the regulators and removing UFS vote
wouldn't cause it to suddenly turn off.

Change-Id: I54f915ef8708919ef1f0a85cc44de42b5df3710a
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
parent 45e3b69a
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -8093,9 +8093,16 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)
	/*
	 * If we failed to initialize the device or the device is not
	 * present, turn off the power/clocks etc.
	 * In cases when there's both ufs and emmc present and regualtors
	 * are shared b/w the two, this shouldn't turn-off the regulators
	 * w/o giving emmc a chance to send PON.
	 * Hence schedule a delayed suspend, thus giving enough time to
	 * emmc to vote for the shared regulator.
	 */
	if (ret && !ufshcd_eh_in_progress(hba) && !hba->pm_op_in_progress)
		pm_runtime_put_sync(hba->dev);
	if (ret && !ufshcd_eh_in_progress(hba) && !hba->pm_op_in_progress) {
		pm_runtime_put_noidle(hba->dev);
		pm_schedule_suspend(hba->dev, MSEC_PER_SEC * 10);
	}

	trace_ufshcd_init(dev_name(hba->dev), ret,
		ktime_to_us(ktime_sub(ktime_get(), start)),