usb: msm_otg: schedule state machine only when state changes
While an asynchronous interrupt may wake up the system from low
power mode, the OTG PHY and controller must first be resumed and
then the IRQ enabled. If during this time the state machine is
scheduled, it may prematurely run before the interrupt handler has
a chance to fire and effect a state transition, and may erroneously
lead down the "chg_work cancel" path, which will reset the PHY
right after resuming. After this reset, the system will go back into
suspend thinking nothing happened.
Instead, since the "in LPM" part of the interrupt handler isn't
actually changing state, don't schedule any work just yet. Later,
when the resume callback enables the IRQ, and the interrupt can
occur naturally, any state change that happens as a result will
appropriately schedule the sm_work.
Change-Id: I6cf4223b22dddd329a1831264babdabf4e07d1de
CRs-Fixed: 387377
Signed-off-by: Jack Pham <jackp@codeaurora.org>
1 file changed