usb: dwc3: Prevent deadlock when wakeup happens through pwr event irq

Consider a scenario when a device which supports auto suspend is
connected to DUT and auto suspend happened. Now, as the device is
disconnected to DUT. Resume_work is called due to extcon notification
of disconnect and then again suspend is expected to schedule. As
a part of disconnect, pwr event irq and DP_HS_PHY_IRQ also got
triggered and now since usb is in lpm, resume work got scheduled
twice. This resume work flushed sm_work which is stuck because
disable_irq call is waiting for pwr_irq call which called resume_work
to complete. This is clearly a circular dependency because
resume work will flush sm_work which is waiting for pwr_irq_thread
to be complete because disable_irq in msm_suspend waits for
pwr_irq_handler to complete.

Solve this by replacing disable_irq api with disable_irq_nosync
so that it doesn't block control suspend.

Below are the sequence of events.

	usb is auto suspended with device connected to DUT.

	Now device is disconnected from DUT and hence resume
	hanppens first and then suspend.

	dwc3_resume_work is called due to extcon as a part of
	disconnect then suspend will be scheduled.

	When dwc3 is still in lpm, i.e dwc3_resume_work did
	not take effect yet.

	Now power event irq is fired because of which resume
	work runs.

	This resume work flushes sm work. Which is currently
	executing msm_suspend where disable_irq is waiting
	for power_irq call to finish which is waiting for
	sm_work to finish.

Change-Id: Ibf6e73663d4acaf997291e7eff6577adeaad6e8a
Signed-off-by: Rohith Kollalsi <quic_rkollals@quicinc.com>
1 file changed