diff options
author | Felipe Balbi <balbi@ti.com> | 2012-03-15 16:37:18 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-04-10 12:21:32 +0300 |
commit | 6d258a4c42089229b855fd706622029decf316d6 (patch) | |
tree | b29c8fd7c2aa60afa419161e433140cde4a389bb /drivers/usb/gadget/udc-core.c | |
parent | 0034102808e0dbbf3a2394b82b1bb40b5778de9e (diff) | |
download | linux-6d258a4c42089229b855fd706622029decf316d6.tar.gz linux-6d258a4c42089229b855fd706622029decf316d6.tar.bz2 linux-6d258a4c42089229b855fd706622029decf316d6.zip |
usb: gadget: udc-core: stop UDC on device-initiated disconnect
When we want to do device-initiated disconnect,
let's make sure we stop the UDC in order to
e.g. allow lower power states to be achieved by
turning off unnecessary clocks and/or stoping
PHYs.
When reconnecting, call ->udc_start() again to
make sure UDC is reinitialized.
Cc: stable@vger.kernel.org
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/udc-core.c')
-rw-r--r-- | drivers/usb/gadget/udc-core.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 56da49f31d6c..c261887e05ae 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c @@ -411,8 +411,12 @@ static ssize_t usb_udc_softconn_store(struct device *dev, struct usb_udc *udc = container_of(dev, struct usb_udc, dev); if (sysfs_streq(buf, "connect")) { + if (udc_is_newstyle(udc)) + usb_gadget_udc_start(udc->gadget, udc->driver); usb_gadget_connect(udc->gadget); } else if (sysfs_streq(buf, "disconnect")) { + if (udc_is_newstyle(udc)) + usb_gadget_udc_stop(udc->gadget, udc->driver); usb_gadget_disconnect(udc->gadget); } else { dev_err(dev, "unsupported command '%s'\n", buf); |