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

Commit e5ccb29b authored by Jack Pham's avatar Jack Pham
Browse files

usb: pd: Update PE_SNK_WAIT_FOR_CAPABILITIES state correctly



In PE_SNK_DISCOVERY, if a message is received make sure to update
the current state to PE_SNK_WAIT_FOR_CAPABILITIES before falling
through the switch case to handle it. Otherwise, when psy_changed()
is notified that vbus_present rises it may end up queuing the
state machine if it thinks it is still in PE_SNK_DISCOVERY. This
would cause the state machine to be reinvoked immediately when
it needs to instead wait for the Accept response. As a result,
it would prematurely send a hard reset.

Change-Id: Ib28c1da88324d2ab64cc943476f050f163112801
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent c551cf8f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2532,6 +2532,7 @@ static void handle_state_snk_discovery(struct usbpd *pd, struct rx_msg *rx_msg)
		return;
	}

	pd->current_state = PE_SNK_WAIT_FOR_CAPABILITIES;
	handle_state_snk_wait_for_capabilities(pd, rx_msg);
}