usb: musb: Fix PM runtime for disconnect after unconfigure
authorTony Lindgren <tony@atomide.com>
Thu, 22 Sep 2016 20:58:29 +0000 (15:58 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Sep 2016 10:26:07 +0000 (12:26 +0200)
If we unconfigure musb as a USB peripheral with cable connected,
and then remove the cable, no interrupts will happen. And musb
thinks we're still connected keeping the device active.

Now with the session bit based PM runtime working for musb, we
can fix this issue by calling musb irq_work. That rechecks the
devctl register and reconfigures PM runtime based on the devctl.

Fixes: 467d5c980709 ("usb: musb: Implement session bit based runtime PM for musb-core")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/musb_gadget.c

index 6d1e975e9605cf845a8a656747beb0269b2a53c4..bff4869a57cd193072215662e984e367eb551cdb 100644 (file)
@@ -1964,6 +1964,9 @@ static int musb_gadget_stop(struct usb_gadget *g)
         * that currently misbehaves.
         */
 
+       /* Force check of devctl register for PM runtime */
+       schedule_work(&musb->irq_work);
+
        pm_runtime_mark_last_busy(musb->controller);
        pm_runtime_put_autosuspend(musb->controller);