usb: dwc2: gadget: set op_state in vbus_session call
authorGregory Herrero <gregory.herrero@intel.com>
Tue, 29 Sep 2015 10:08:20 +0000 (12:08 +0200)
committerFelipe Balbi <balbi@ti.com>
Thu, 1 Oct 2015 17:40:24 +0000 (12:40 -0500)
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 <gregory.herrero@intel.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Tested-by: John Youn <johnyoun@synopsys.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc2/gadget.c

index 61d102185bf1b3f88e5130174e873b903a97fe3c..1a216c51bbe4e20b41e2f89de8155cf768a29b82 100644 (file)
@@ -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