Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 745f83fe authored by Chandana Kishori Chiluveru's avatar Chandana Kishori Chiluveru Committed by Gerrit - the friendly Code Review server
Browse files

usb: android: Stop controller before disabling endpoints for USB2



DWC3 controller requires stopping the controller only after removing
the config that disables EPs as well. As this sequence is not recommended
for chipidea USB2 controller, change it accordingly.

Change-Id: I27f805fdf079710adf9149004bd3fc03aed91a88
Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
parent fbfdd7c9
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -532,6 +532,7 @@ static void android_disable(struct android_dev *dev)
	struct android_configuration *conf;

	if (dev->disable_depth++ == 0) {
		if (gadget_is_dwc3(cdev->gadget)) {
			/* Cancel pending control requests */
			usb_ep_dequeue(cdev->gadget->ep0, cdev->req);

@@ -539,6 +540,16 @@ static void android_disable(struct android_dev *dev)
				usb_remove_config(cdev, &conf->usb_config);
			usb_gadget_disconnect(cdev->gadget);
			dev->last_disconnect = ktime_get();
		} else {
			usb_gadget_disconnect(cdev->gadget);
			dev->last_disconnect = ktime_get();

			/* Cancel pnding control requests */
			usb_ep_dequeue(cdev->gadget->ep0, cdev->req);

			list_for_each_entry(conf, &dev->configs, list_item)
				usb_remove_config(cdev, &conf->usb_config);
		}
	}
}