usb: dwc3: gadget: Ignore L1 RESUME events
Events may get generated for Link Power Management L1
Suspend and Resume. The suspend case currently ignores
L1 and only proceeds to call the gadget driver suspend
routines if it is for L2/U3 entry. However, the resume
callback doesn't make this distinction, which will
result in the gadget layer resume getting called for
which there had not been a previous suspend.
CRs-Fixed: 739812
Change-Id: Ib38e8949ce78ab40bd4f78041de92103869081b6
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 0f86879..c6974cc 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2610,13 +2610,13 @@
{
dev_vdbg(dwc->dev, "%s\n", __func__);
- /*
- * TODO take core out of low power mode when that's
- * implemented.
- */
+ /* Only perform resume from L2 or Early suspend states */
+ if (dwc->link_state == DWC3_LINK_STATE_U3) {
+ dbg_event(0xFF, "WAKEUP", 0);
+ dwc->gadget_driver->resume(&dwc->gadget);
+ }
- dbg_event(0xFF, "WAKEUP", 0);
- dwc->gadget_driver->resume(&dwc->gadget);
+ dwc->link_state = DWC3_LINK_STATE_U0;
}
static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc,