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

Commit 911e6423 authored by Manu Gautam's avatar Manu Gautam Committed by Gerrit - the friendly Code Review server
Browse files

usb: phy-msm: Resume HW early on bus-resume when pm_suspended



During resume host drives resume signalling for at least ~20msec.
At the end of which device should remove DP pullup and move
to HS state by enabling HS terminations.
If due to some reason device continues in FS mode and drives DP
then host could treat that as error and perform reset.
This can happen if PHY lpm-exit gets delayed. One possibility is
with resume in system suspend as driver relies on pm_resume routine
to bring PHY out of low power mode. Avoid this delay by not
deferring lpm_exit for bus-suspend scenario in device mode and
also helps to do lpm_exit only from sm_work and removing same from
pm_resume.

Change-Id: Ie3757af81c73ea0c03d86fa3396be694c579b9f4
Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
parent 8b5bb77c
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -817,7 +817,9 @@ static void msm_otg_kick_sm_work(struct msm_otg *motg)
	if (atomic_read(&motg->in_lpm))
		motg->resume_pending = true;

	if (atomic_read(&motg->pm_suspended)) {
	/* For device mode, resume now. Let pm_resume handle other cases */
	if (atomic_read(&motg->pm_suspended) &&
			motg->phy.state != OTG_STATE_B_SUSPEND) {
		motg->sm_work_pending = true;
	} else if (!motg->sm_work_pending) {
		/* process event only if previous one is not pending */
@@ -5200,13 +5202,8 @@ static int msm_otg_pm_resume(struct device *dev)
	if (motg->resume_pending || motg->phy_irq_pending) {
		msm_otg_dbg_log_event(&motg->phy, "PM RESUME BY USB",
				motg->async_int, motg->resume_pending);
		/* Bring hardware out of LPM asap, sm_work can handle the rest*/
		msm_otg_resume(motg);

		/* sm work will start in pm notify */
		/* sm work if pending will start in pm notify to exit LPM */
	}
	msm_otg_dbg_log_event(&motg->phy, "PM RESUME DONE",
			get_pm_runtime_counter(dev), motg->async_int);

	return ret;
}