summaryrefslogtreecommitdiff
path: root/common/usbc/tbt_alt_mode.c
diff options
context:
space:
mode:
authorAyushee Shah <ayushee.shah@intel.com>2021-02-26 13:02:30 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-10 02:03:58 +0000
commit43fe3569949f74ece62d6a82829355c39a010d65 (patch)
tree6e354ed3d13cca1c4569c75697e2ea57f2d8f983 /common/usbc/tbt_alt_mode.c
parentd3372a419d5e4c78fedb70a125390a005938df10 (diff)
downloadchrome-ec-43fe3569949f74ece62d6a82829355c39a010d65.tar.gz
USB4: For AP mode entry, add support for active cables
For AP mode entry, request to enter Thunderbolt cable mode entry prior to entering USB4 mode if - 1. Thunderbolt Mode SOP' VDO active/passive bit (B25) is TBT_CABLE_ACTIVE or 2. It's an active cable with VDM version < 2.0 or VDO version < 1.3 BUG=b:181286325 BRANCH=None TEST=Able to enter USB4 mode with LRD cable Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Change-Id: Ie223fa3d95c2357a0e50aeea93444e6f7639cc3f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2724653 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'common/usbc/tbt_alt_mode.c')
-rw-r--r--common/usbc/tbt_alt_mode.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/common/usbc/tbt_alt_mode.c b/common/usbc/tbt_alt_mode.c
index 793de4c778..3ce66f7e5d 100644
--- a/common/usbc/tbt_alt_mode.c
+++ b/common/usbc/tbt_alt_mode.c
@@ -222,6 +222,37 @@ static void tbt_active_cable_exit_mode(int port)
tbt_state[port] = TBT_EXIT_SOP_PRIME;
}
+bool tbt_cable_entry_required_for_usb4(int port)
+{
+ struct pd_discovery *disc_sop_prime;
+ union tbt_mode_resp_cable cable_mode_resp;
+
+ /* Request to enter Thunderbolt mode for the cable prior to entering
+ * USB4 mode if -
+ * 1. Thunderbolt Mode SOP' VDO active/passive bit (B25) is
+ * TBT_CABLE_ACTIVE or
+ * 2. It's an active cable with VDM version < 2.0 or
+ * VDO version < 1.3
+ */
+ if (tbt_cable_entry_is_done(port))
+ return false;
+
+ cable_mode_resp.raw_value =
+ pd_get_tbt_mode_vdo(port, TCPC_TX_SOP_PRIME);
+
+ if (cable_mode_resp.tbt_active_passive == TBT_CABLE_ACTIVE)
+ return true;
+
+ if (get_usb_pd_cable_type(port) == IDH_PTYPE_ACABLE) {
+ disc_sop_prime = pd_get_am_discovery(port, TCPC_TX_SOP_PRIME);
+ if (pd_get_vdo_ver(port, TCPC_TX_SOP_PRIME) < VDM_VER20 ||
+ disc_sop_prime->identity.product_t1.a_rev30.vdo_ver <
+ VDO_VERSION_1_3)
+ return true;
+ }
+ return false;
+}
+
void intel_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
uint32_t *vdm)
{