From 2d5b401286f2a3e32b17b6cfd1369504bd86cfce Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Fri, 2 Nov 2018 17:46:17 -0700 Subject: [PATCH] usb: dwc3: request 2mA VBUS current when suspending In case a SUSPEND (L2 or U3) event is detected but the device is not yet enumerated/configured, the device must still follow USB power rules and limit its current draw to ISUSP (2.5mA). Notify the gadget when this happens, which in turn will notify the charger driver. Change-Id: I10d890aabd78d841027b370eb62005d2e35e2a38 Signed-off-by: Jack Pham --- drivers/usb/dwc3/gadget.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 8e577fca954a..d944f17b9998 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -3472,6 +3472,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc, if (dwc->gadget.state >= USB_STATE_CONFIGURED) dwc3_gadget_suspend_interrupt(dwc, event->event_info); + else + usb_gadget_vbus_draw(&dwc->gadget, 2); } break; case DWC3_DEVICE_EVENT_SOF: