summaryrefslogtreecommitdiff
path: root/common/usbc/dp_alt_mode.c
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2021-03-31 16:23:47 -0600
committerCommit Bot <commit-bot@chromium.org>2021-04-13 18:37:33 +0000
commite09b3110611a5e12de424ef62d2290c9425a37d9 (patch)
tree0ee2165a8dc6e6f635b70954bc7a33083ba55904 /common/usbc/dp_alt_mode.c
parentd1924be854913acf1b42fc9fff9c547c947b72b7 (diff)
downloadchrome-ec-e09b3110611a5e12de424ef62d2290c9425a37d9.tar.gz
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 <alevkoy@chromium.org> Change-Id: If72b3410f9aa174c48c65a8ca908d79e2090fa62 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2798525
Diffstat (limited to 'common/usbc/dp_alt_mode.c')
-rw-r--r--common/usbc/dp_alt_mode.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/usbc/dp_alt_mode.c b/common/usbc/dp_alt_mode.c
index 321fe1c884..eb42dfef0f 100644
--- a/common/usbc/dp_alt_mode.c
+++ b/common/usbc/dp_alt_mode.c
@@ -70,8 +70,7 @@ bool dp_entry_is_done(int port)
static void dp_entry_failed(int port)
{
CPRINTS("C%d: DP alt mode protocol failed!", port);
- dp_state[port] = IS_ENABLED(CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY)
- ? DP_START : DP_INACTIVE;
+ dp_state[port] = DP_INACTIVE;
}
static bool dp_response_valid(int port, enum tcpm_transmit_type type,
@@ -103,6 +102,11 @@ static void dp_exit_to_usb_mode(int port)
set_usb_mux_with_current_data_role(port);
CPRINTS("C%d: Exited DP mode", 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.
+ */
dp_state[port] = IS_ENABLED(CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY)
? DP_START : DP_INACTIVE;
}