From c5d9f0a5a01812b735b53037e90f4b12adfa7439 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Wed, 15 Aug 2007 12:12:20 +0300 Subject: [PATCH] musb_hdrc: Stop VBUS draw on usb_gadget_unregister_driver If musb_gadget_vbus_draw() also toggles a clock like tusb does, USB clock will stay on after rmmoding a gadget driver. This can block omap idle states. Also handle disconnect as b_idle so that musb_gadget_vbus_draw() gets called. Signed-off-by: Tony Lindgren --- drivers/usb/musb/musb_gadget.c | 3 +++ drivers/usb/musb/plat_uds.c | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 8aef3931935..4aa82fe0824 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -1842,6 +1842,9 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) #endif if (musb->gadget_driver == driver) { + + (void) musb_gadget_vbus_draw(&musb->g, 0); + musb->xceiv.state = OTG_STATE_UNDEFINED; stop_activity(musb, driver); diff --git a/drivers/usb/musb/plat_uds.c b/drivers/usb/musb/plat_uds.c index e8e41bba126..b87c587c684 100644 --- a/drivers/usb/musb/plat_uds.c +++ b/drivers/usb/musb/plat_uds.c @@ -718,6 +718,7 @@ static irqreturn_t musb_stage2_irq(struct musb * musb, u8 bIntrUSB, #endif /* OTG */ #ifdef CONFIG_USB_GADGET_MUSB_HDRC case OTG_STATE_B_PERIPHERAL: + case OTG_STATE_B_IDLE: musb_g_disconnect(musb); break; #endif /* GADGET */ -- 2.41.1