summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorDevdutt Patnaik <dpatnaik@codeaurora.org>2016-03-11 17:38:51 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-25 16:03:46 -0700
commitacd8ecf80fbfc47a1f0711c0c9921a57e7ad8715 (patch)
tree6069a50b8b599b48497d000dedbc09b5d42575df /drivers/usb
parentf530fae1cbcdd48a4d0e10f30a8c7c3041e12bcf (diff)
usb: gadget: Handle disconnect correctly during composition switch.
If cable is disconnected early during composition switch android_disable calls the gadget pullup op which on clearing run/stop bit does a pm_runtime_put_noidle on the dwc3 device. This decrements the power usage count on the dwc3 device, but the child count of the parent mdwc3 device is not decremented. Upon disconnect handling in the DWC3 state machine, pm_runtime_put_sync on mdwc3 parent returns EBUSY due to child count not being 0. As a result runtime idle does not kick in and prevents low power mode handler being invoked. Fix this by changing the pm_runtime_put_noidle call to pm_runtime_put_autosuspend on dwc3 device so that the child count for the mdwc3 parent is decremented to 0. CRs-Fixed: 980113 Change-Id: Ibb19188c4230a08bbdef72af7de066735e8c2d67 Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc3/gadget.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 377281662cd0..3da70925d565 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1858,7 +1858,8 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
ret = dwc3_gadget_run_stop(dwc, is_on, false);
spin_unlock_irqrestore(&dwc->lock, flags);
- pm_runtime_put_noidle(dwc->dev);
+ pm_runtime_mark_last_busy(dwc->dev);
+ pm_runtime_put_autosuspend(dwc->dev);
dbg_event(0xFF, "Pullup put",
atomic_read(&dwc->dev->power.usage_count));