usb: pd: Re-check for disconnect after PR swap

During SNK->SRC PR Swap, the in_pr_swap flag is set and is used
to ignore the Type-C disconnect notification from the charger
since that is expected to happen. However, if the "sink connect"
notification never arrives, the swap operation is incomplete,
indicating the port partner has either disconnected or is
unresponsive. But since the state machine ignored the disconnect,
it continues until reaching SRC_DISABLED due to no response, and
that is a dead-end state. Add one more check here to see if the
CC state is still disconnected and set current_pr PR_NONE to
get the state machine to process the disconnect.

Similarly do this for PE_SRC_HARD_RESET as that is an extension
of the above if a physical disconnect occurred after successful
sending of capabilities but before receiving a request and the
response timer times out. Again the disconnect notification during
the previous swap was ignored and no new CC state change arrived.

Change-Id: Ib28c541cff36a895f9a75cb67161dd116f3eb47f
Signed-off-by: Jack Pham <jackp@codeaurora.org>
1 file changed