summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-10-06 18:12:28 -0600
committerCommit Bot <commit-bot@chromium.org>2020-10-07 15:31:44 +0000
commit50407523c0c969e1dc0f75a1ee2d972a5b1dc3c1 (patch)
treef0c26b718b116c5fc698fdb825221b67daebd09d
parent5abcdc389876bf4ed9069bc71e52e15c7cddca53 (diff)
downloadchrome-ec-50407523c0c969e1dc0f75a1ee2d972a5b1dc3c1.tar.gz
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 <dbrockus@google.com> Change-Id: I8665215bb9b9d363b82d23cae90b9f3c5617b7a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2454970 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--common/usbc/usb_pe_drp_sm.c12
1 files changed, 11 insertions, 1 deletions
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;
}