]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
usb: chipidea: otg: handling vbus disconnect event occurred during system suspend
authorPeter Chen <peter.chen@nxp.com>
Wed, 19 Feb 2020 09:25:48 +0000 (17:25 +0800)
committerPeter Chen <peter.chen@nxp.com>
Mon, 16 Mar 2020 03:13:47 +0000 (11:13 +0800)
During system suspend, the role switch may occur, eg, from gadget->host.
In this case, the vbus disconnect event is lost, we add this handling
in role switch routine in this commit.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
drivers/usb/chipidea/otg.c

index fbfb02e05c97946f6b3b5622dcfa9da36ebdb2fd..be63924ea82efff1ae8e122ae8d3f1a6c67fee91 100644 (file)
@@ -170,6 +170,13 @@ static void ci_handle_id_switch(struct ci_hdrc *ci)
                dev_dbg(ci->dev, "switching from %s to %s\n",
                        ci_role(ci)->name, ci->roles[role]->name);
 
+               if (ci->vbus_active && ci->role == CI_ROLE_GADGET)
+                       /*
+                        * vbus disconnect event is lost due to role
+                        * switch occurs during system suspend.
+                        */
+                       usb_gadget_vbus_disconnect(&ci->gadget);
+
                ci_role_stop(ci);
 
                if (role == CI_ROLE_GADGET &&