From e09b3110611a5e12de424ef62d2290c9425a37d9 Mon Sep 17 00:00:00 2001 From: Abe Levkoy Date: Wed, 31 Mar 2021 16:23:47 -0600 Subject: TCPMv2: Don't retry after failed alt mode entry If entering DP or TBT alt mode fails, leave the state machine in an inactive state. Allow the DPM to see that the mode entry process is done and stop trying to send more VDMs. BUG=b:184197145,b:179443762 TEST=make buildall TEST=Pass TDA.2.1.2.1 on Voxel with AP-driven mode entry TEST=Enter, exit, and reenter DP and TBT mode with host commands BRANCH=firmware-volteer-13672.B-main Signed-off-by: Abe Levkoy Change-Id: If72b3410f9aa174c48c65a8ca908d79e2090fa62 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2798525 --- common/usbc/tbt_alt_mode.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'common/usbc/tbt_alt_mode.c') diff --git a/common/usbc/tbt_alt_mode.c b/common/usbc/tbt_alt_mode.c index de296aa216..fdee453904 100644 --- a/common/usbc/tbt_alt_mode.c +++ b/common/usbc/tbt_alt_mode.c @@ -138,6 +138,11 @@ bool tbt_cable_entry_is_done(int port) static void tbt_exit_done(int port) { + /* + * If the EC exits an alt mode autonomously, don't try to enter it again. If + * the AP commands the EC to exit DP mode, it might command the EC to enter + * again later, so leave the state machine ready for that possibility. + */ tbt_state[port] = IS_ENABLED(CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY) ? TBT_START : TBT_INACTIVE; TBT_CLR_FLAG(port, TBT_FLAG_RETRY_DONE); @@ -385,9 +390,7 @@ void intel_vdm_naked(int port, enum tcpm_transmit_type type, uint8_t vdm_cmd) tbt_active_cable_exit_mode(port); else { tbt_prints("exit mode SOP failed", port); - tbt_state[port] = - IS_ENABLED(CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY) - ? TBT_START : TBT_INACTIVE; + tbt_state[port] = TBT_INACTIVE; TBT_CLR_FLAG(port, TBT_FLAG_RETRY_DONE); } break; -- cgit v1.2.1