usb: dwc2: gadget: don't modify pullup state in host mode
authorGregory Herrero <gregory.herrero@intel.com>
Tue, 29 Sep 2015 10:08:19 +0000 (12:08 +0200)
committerFelipe Balbi <balbi@ti.com>
Thu, 1 Oct 2015 17:40:24 +0000 (12:40 -0500)
Modifying the pullup state during host mode trig a new enumeration
of attached device. Thus, avoid modifying pullup in host mode.

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 36345ab05f7e0d1e5a9f27289282ca5dfa65a4e2..61d102185bf1b3f88e5130174e873b903a97fe3c 100644 (file)
@@ -3170,7 +3170,14 @@ static int dwc2_hsotg_pullup(struct usb_gadget *gadget, int is_on)
        struct dwc2_hsotg *hsotg = to_hsotg(gadget);
        unsigned long flags = 0;
 
-       dev_dbg(hsotg->dev, "%s: is_on: %d\n", __func__, is_on);
+       dev_dbg(hsotg->dev, "%s: is_on: %d op_state: %d\n", __func__, is_on,
+                       hsotg->op_state);
+
+       /* Don't modify pullup state while in host mode */
+       if (hsotg->op_state != OTG_STATE_B_PERIPHERAL) {
+               hsotg->enabled = is_on;
+               return 0;
+       }
 
        mutex_lock(&hsotg->init_mutex);
        spin_lock_irqsave(&hsotg->lock, flags);
This page took 0.026504 seconds and 5 git commands to generate.