diff options
author | Meng Dongyang <daniel.meng@rock-chips.com> | 2017-08-09 10:34:09 +0800 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2017-08-15 14:18:55 +0300 |
commit | f367b72c4e08aafacc5267c73299a62ca79635ec (patch) | |
tree | 206517d2184a19aea83a8efb4a04f43f93235397 /drivers/usb/dwc2 | |
parent | 14a8d4bfc2102f85ce097563d151370c91c1898a (diff) | |
download | linux-stable-f367b72c4e08aafacc5267c73299a62ca79635ec.tar.gz linux-stable-f367b72c4e08aafacc5267c73299a62ca79635ec.tar.bz2 linux-stable-f367b72c4e08aafacc5267c73299a62ca79635ec.zip |
usb: dwc2: skip L2 state of hcd if controller work in device mode
In the case hcd autosuspend is enabled, the hcd will enter L2 state
if no device connected. But if the controller works in otg mode, the
gadget driver still works in L0 state if connected with host. This
may result in transfer fail when gadget enqueue new request but the
hcd driver has set the global state into L2. This patch prevent the
hcd enter L2 state if the controller work in device mode.
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc2')
-rw-r--r-- | drivers/usb/dwc2/hcd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 740c7e86d31b..c2631145f404 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4388,6 +4388,9 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd) spin_lock_irqsave(&hsotg->lock, flags); + if (dwc2_is_device_mode(hsotg)) + goto unlock; + if (hsotg->lx_state != DWC2_L0) goto unlock; @@ -4446,6 +4449,9 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd) spin_lock_irqsave(&hsotg->lock, flags); + if (dwc2_is_device_mode(hsotg)) + goto unlock; + if (hsotg->lx_state != DWC2_L2) goto unlock; |