Skip to contentSkip to conversation

usb: chipidea: otg: handling vbus disconnect event occurred during system suspend

PATCH New Peter Chen 1 participant 1 message Feb 19, 2020

Subsystems (2)
lore
Share & tools
lore

Peter Chen

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/usb/chipidea/otg.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/usb/chipidea/otg.c +7 -0
index fbfb02e05c97..be63924ea82e 100644
@@ -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 &&
Signature · 1 line
2.17.1