summaryrefslogtreecommitdiff
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-14 15:18:47 +0000
commitfdaf8763014b294f6a1beb3f7035f3a2ee15d50c (patch)
treed864ee66266a89f475f78e910b5d9777e317e076
parent55d15e37db960bbb75ed595aa0fe6ba68b8bbfe1 (diff)
downloadchrome-ec-fdaf8763014b294f6a1beb3f7035f3a2ee15d50c.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 (cherry picked from commit e09b3110611a5e12de424ef62d2290c9425a37d9) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2825349 Tested-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org>
-rw-r--r--common/usbc/dp_alt_mode.c8
-rw-r--r--common/usbc/tbt_alt_mode.c9
2 files changed, 12 insertions, 5 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;
}
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;