linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: musb: omap2430: Fix flakeyness enumerating when connected to a lapdock
@ 2019-08-28 15:11 Tony Lindgren
  2019-08-29 13:14 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Lindgren @ 2019-08-28 15:11 UTC (permalink / raw)
  To: Bin Liu; +Cc: Greg Kroah-Hartman, linux-usb, linux-omap

With commit 594632efbb9a ("usb: musb: Adding musb support for OMAP4430")
we were supposed to call otg_set_vbus() only if enabling session for a
A-device fails. But the conditional test was always true and at some point
commit 10770c5aa0fe ("usb: musb: omap2430.c delete unused variable.")
removed the check.

Looks like always calling otg_set_vbus() causes flakeyness enumerating when
droid4 is connected to a lapdock. In this case lapdock runs in USB carkit
type mode and feeds the VBUS.

Let's fix the issue by adding a flag to call otg_set_vbus() conditionally
only if A-device session fails that probably was the intention originally.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/usb/musb/omap2430.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -52,6 +52,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 
 	if (is_on) {
 		if (musb->xceiv->otg->state == OTG_STATE_A_IDLE) {
+			bool need_otg_set_vbus = true;
 			int loops = 100;
 			/* start the session */
 			devctl |= MUSB_DEVCTL_SESSION;
@@ -72,9 +73,13 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 					"configured as A device timeout");
 					break;
 				}
+
+				/* Session enabled as A-device, we have VBUS */
+				need_otg_set_vbus = false;
 			}
 
-			otg_set_vbus(otg, 1);
+			if (need_otg_set_vbus)
+				otg_set_vbus(otg, 1);
 		} else {
 			musb->is_active = 1;
 			musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
-- 
2.23.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-29 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-28 15:11 [PATCH] usb: musb: omap2430: Fix flakeyness enumerating when connected to a lapdock Tony Lindgren
2019-08-29 13:14 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).