summaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@nxp.com>2020-02-19 17:25:48 +0800
committerPeter Chen <peter.chen@nxp.com>2020-03-16 11:13:47 +0800
commit3ac82cf3f80c2ddc1964408a213f84ac538875dc (patch)
tree2b3dcba2f9effefae9fd1b2326bcc1898dfad7ef /drivers/usb/chipidea
parent7fd87c956c0ab5633f20597cb828713f9c03aa5b (diff)
downloadlinux-stable-3ac82cf3f80c2ddc1964408a213f84ac538875dc.tar.gz
linux-stable-3ac82cf3f80c2ddc1964408a213f84ac538875dc.tar.bz2
linux-stable-3ac82cf3f80c2ddc1964408a213f84ac538875dc.zip
usb: chipidea: otg: handling vbus disconnect event occurred during system suspend
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>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/otg.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
index fbfb02e05c97..be63924ea82e 100644
--- a/drivers/usb/chipidea/otg.c
+++ b/drivers/usb/chipidea/otg.c
@@ -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 &&