Part of commit d44455a0b838b1d691e63913f0b159552ac01803 introduced a regression affecting resume behavior in that the controller's system resume callback is being followed by an immediate runtime suspend; if the system resume was caused by an OTG event, there would be a pending runtime resume in the state machine function, which might fail due to this race, causing the PHY to be unnecessarily reset. This patch limits the actual hardware resumes to happen only when needed. If a possible wakeup event such as VBUS or ID interrupt occurs while in system suspend, don't allow runtime resume to execute in the wakeup handler but rather defer the resuming to the system resume callback. Also by incrementing the PM runtime usage counter within the system resume, it may help prevent the premature runtime suspend from happening immediately afterward. Otherwise, if there is no such OTG event, and the controller is not a suspended host, do nothing. If the bus is instead runtime suspended (and not system suspended) when a wakeup event occurs, then normal runtime resume will bring the hardware out of low power mode. CRs-fixed: 358761 Change-Id: I4249690485949ecb3072e258859608ecea52ec9b Signed-off-by: Jack Pham <jackp@codeaurora.org>