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

Skip to content
Commit 592dc3b1 authored by Sriharsha Allenki's avatar Sriharsha Allenki Committed by Pratham Pratap
Browse files

usb: dwc3: Handle race between composition switch and cable disconnect



The current implementation of handling run/~stop of DCTL based
on state of VBUS or the pullup call from the udc core can
result in a below race condition where the run/~stop is cleared
twice leading to an invalid state of controller.

	Thread -1			Thread-2
	vbus_session (1)

	   spin_lock
	   no run_stop(1) call		pullup(1)
	   spin_unlock			  softconnect = 1
					  vbus_active checked

	vbus_session (0)
	   spin_lock
	   run_stop(0) called
	   spin_unlock

Prevent this by ensuring a proper state transitions and clear
run/~stop only when when there is a transition from ACTIVE
and there is an pullup(0) event or vbus_session(0) call.

Change-Id: I03c4acfc2c6697e02c510d079c7d48d9a82bb322
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
Signed-off-by: default avatarPratham Pratap <prathampratap@codeaurora.org>
parent 1e18bf1c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment