From: Gregory Herrero Date: Tue, 29 Sep 2015 10:08:20 +0000 (+0200) Subject: usb: dwc2: gadget: set op_state in vbus_session call X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=cd0e641c8da3c763f1f4b838a9bc30f1297f68d0;p=deliverable%2Flinux.git usb: dwc2: gadget: set op_state in vbus_session call Some device may have external id pin control enabled, so op_state will not be set on id pin interrupt change. Thus, ensure op_state is set to peripheral during vbus detection. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 61d102185bf1..1a216c51bbe4 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3209,6 +3209,7 @@ static int dwc2_hsotg_vbus_session(struct usb_gadget *gadget, int is_active) spin_lock_irqsave(&hsotg->lock, flags); if (is_active) { + hsotg->op_state = OTG_STATE_B_PERIPHERAL; /* * If controller is hibernated, it must exit from hibernation * before being initialized