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

Commit 2cc58dce authored by Sriharsha Allenki's avatar Sriharsha Allenki Committed by Jack Pham
Browse files

usb: pd: Ensure disconnect is processed when hard reset in progress



When hard reset is in progress, the pd state machine restarts
from PE_UNKNOWN state. If a Type-C disconnect notification
is received during the same time, the current_pr is set to
PR_NONE. Because of this we bail out of the usbpd_sm
assuming it is in disconnected state even though the
disconnect was not processed.
Fix this by validating the current_dr as well to confirm
that the state machine is actually in disconnected state.

Change-Id: Iea59a857c6826f65fef8b0c9a8ee6e2488683864
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
parent 8aec0d07
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -3186,7 +3186,8 @@ static void usbpd_sm(struct work_struct *w)


	/* Disconnect? */
	/* Disconnect? */
	if (pd->current_pr == PR_NONE) {
	if (pd->current_pr == PR_NONE) {
		if (pd->current_state == PE_UNKNOWN)
		if (pd->current_state == PE_UNKNOWN &&
				pd->current_dr == DR_NONE)
			goto sm_done;
			goto sm_done;


		handle_disconnect(pd);
		handle_disconnect(pd);