From 50407523c0c969e1dc0f75a1ee2d972a5b1dc3c1 Mon Sep 17 00:00:00 2001 From: Denis Brockus Date: Tue, 6 Oct 2020 18:12:28 -0600 Subject: TCPMv2: Select Capability REQUEST discard handling The sent REQUEST message was discarded. This can be at the start of an AMS or in the middle. Handle what to do based on where we came from. 1) SE_SNK_EVALUATE_CAPABILITY: sends SoftReset 2) SE_SNK_READY: goes back to SNK Ready BUG=b:170259288 BRANCH=zork TEST=Monitor mentioned in parent bug should not Vconn Swap loop Signed-off-by: Denis Brockus Change-Id: I8665215bb9b9d363b82d23cae90b9f3c5617b7a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2454970 Tested-by: Denis Brockus Reviewed-by: Diana Z Commit-Queue: Denis Brockus --- common/usbc/usb_pe_drp_sm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 5b4f8a65ba..19fb59d0a2 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -2807,7 +2807,17 @@ static void pe_snk_select_capability_run(int port) * Handle discarded message */ if (msg_check & PE_MSG_DISCARDED) { - pe_send_soft_reset(port, TCPC_TX_SOP); + /* + * The sent REQUEST message was discarded. This can be at + * the start of an AMS or in the middle. Handle what to + * do based on where we came from. + * 1) SE_SNK_EVALUATE_CAPABILITY: sends SoftReset + * 2) SE_SNK_READY: goes back to SNK Ready + */ + if (get_last_state_pe(port) == PE_SNK_EVALUATE_CAPABILITY) + pe_send_soft_reset(port, TCPC_TX_SOP); + else + set_state_pe(port, PE_SNK_READY); return; } -- cgit v1.2.1