Commit 6d258a4c authored by Felipe Balbi's avatar Felipe Balbi

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: default avatarFelipe Balbi <balbi@ti.com>
parent 00341028
...@@ -411,8 +411,12 @@ static ssize_t usb_udc_softconn_store(struct device *dev, ...@@ -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); struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
if (sysfs_streq(buf, "connect")) { if (sysfs_streq(buf, "connect")) {
if (udc_is_newstyle(udc))
usb_gadget_udc_start(udc->gadget, udc->driver);
usb_gadget_connect(udc->gadget); usb_gadget_connect(udc->gadget);
} else if (sysfs_streq(buf, "disconnect")) { } else if (sysfs_streq(buf, "disconnect")) {
if (udc_is_newstyle(udc))
usb_gadget_udc_stop(udc->gadget, udc->driver);
usb_gadget_disconnect(udc->gadget); usb_gadget_disconnect(udc->gadget);
} else { } else {
dev_err(dev, "unsupported command '%s'\n", buf); dev_err(dev, "unsupported command '%s'\n", buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment