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

Commit d4e5b324 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB: android: Call PM APIs if configured and suspended are true



Currently android driver is calling PM APIs in android_disbable()
without having proper check. This leads calling PM APIs when wall charger/
quick charger is conneced, which impacts charging. Hence have a check
to allow calling PM APIs only if cdev->configured and  cdev->suspended
is true to avoid the issue of charging affected.

Change-Id: I8f24497432650e01756b635671927da2ddb002fa
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 4fa286af
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -530,9 +530,13 @@ static void android_disable(struct android_dev *dev)
{
	struct usb_composite_dev *cdev = dev->cdev;
	struct android_configuration *conf;
	bool do_put = false;

	if (dev->disable_depth++ == 0) {
		if (cdev->suspended && cdev->config) {
			usb_gadget_autopm_get(cdev->gadget);
			do_put = true;
		}
		if (gadget_is_dwc3(cdev->gadget)) {
			/* Cancel pending control requests */
			usb_ep_dequeue(cdev->gadget->ep0, cdev->req);
@@ -551,6 +555,7 @@ static void android_disable(struct android_dev *dev)
			list_for_each_entry(conf, &dev->configs, list_item)
				usb_remove_config(cdev, &conf->usb_config);
		}
		if (do_put)
			usb_gadget_autopm_put_async(cdev->gadget);
	}
}