diff options
author | Ayushee <ayushee.shah@intel.com> | 2020-06-16 17:19:17 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-30 21:38:05 +0000 |
commit | a057167851e63be53e2de757361dc2e303b737e2 (patch) | |
tree | 3736a076490f16ad15a06c18406686e4694879fb /include/usb_tbt_alt_mode.h | |
parent | 39ada1fd2bdadb8a319e7134e650c65332f0bc2e (diff) | |
download | chrome-ec-a057167851e63be53e2de757361dc2e303b737e2.tar.gz |
TCPMv2: Add Entry flow for Thunderbolt mode
Create a separate module for representing Thunderbolt mode which decides
whether and how we can enter into Thunderbolt alternate mode.
Modify the Device Policy Manger (usb_pd_dpm.c) to first check if the
port partner and cable is a Thunderbolt Compatible. If not, continue the
rest of the PD flow undisturbed.
BUG=b:148528713
BRANCH=none
TEST=1. Attach Thunderbolt dock, DUT should enter Thunderbolt mode
2. Attach Type-C dock, DUT should enter DP mode
3. Attach DP dongle, DUT should enter DP mode
Change-Id: I369eb6337144676996c9d94a412eec060eacd273
Signed-off-by: Ayushee <ayushee.shah@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250488
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'include/usb_tbt_alt_mode.h')
-rw-r--r-- | include/usb_tbt_alt_mode.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/include/usb_tbt_alt_mode.h b/include/usb_tbt_alt_mode.h new file mode 100644 index 0000000000..186c2f8139 --- /dev/null +++ b/include/usb_tbt_alt_mode.h @@ -0,0 +1,65 @@ +/* Copyright 2020 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* + * Thunderbolt alternate mode support + * Refer to USB Type-C Cable and Connector Specification Release 2.0 Section F + */ + +#ifndef __CROS_EC_USB_TBT_ALT_MODE_H +#define __CROS_EC_USB_TBT_ALT_MODE_H + +#include <stdint.h> + +#include "tcpm.h" + +/* + * Initialize Thunderbolt state for the specified port. + * + * @param port USB-C port number + */ +void tbt_init(int port); + +/* + * Handles received Thunderbolt VDM ACKs. + * + * @param port USB-C port number + * @param type Transmit type (SOP, SOP') for received ACK + * @param vdo_count The number of VDOs in the ACK VDM + * @param vdm VDM from ACK + */ +void intel_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count, + uint32_t *vdm); + +/* + * Handles NAKed (or Not Supported or timed out) Thunderbolt VDM requests. + * + * @param port USB-C port number + * @param type Transmit type (SOP, SOP') for request + * @param svid The SVID of the request + * @param vdm_cmd The VDM command of the request + */ +void intel_vdm_naked(int port, enum tcpm_transmit_type type, uint8_t vdm_cmd); + +/* + * Reset the Thunderbolt mode VDM state for the specified port, as when exiting + * Thunderbolt mode. + * + * @param port USB-C port number + */ +void tbt_teardown(int port); + +/* + * Construct the next Thunderbolt VDM that should be sent. + * + * @param port USB-C port number + * @param vdo_count The number of VDOs in vdm; must be at least VDO_MAX_SIZE + * @param vdm The VDM payload to be sent; output; must point to at least + * VDO_MAX_SIZE elements + * @return The number of VDOs written to VDM or -1 to indicate error + */ +int tbt_setup_next_vdm(int port, int vdo_count, uint32_t *vdm); + +#endif |