summaryrefslogtreecommitdiff
path: root/common/usb_pd_host_cmd.c
diff options
context:
space:
mode:
authorAyushee <ayushee.shah@intel.com>2020-06-16 13:55:08 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-26 09:30:36 +0000
commitd8c83aa6b30658ccb8d8ef1e46cc5d30dc491ebe (patch)
treed0c870e4d524ed59ac17e68eb42e41d6c7baafe3 /common/usb_pd_host_cmd.c
parentc0cee430c75fd428876416c7b3ede705c19dce0f (diff)
downloadchrome-ec-d8c83aa6b30658ccb8d8ef1e46cc5d30dc491ebe.tar.gz
usb_pd: Remove pd_cable dependent Thunderbolt code from common code
1. Separated the common functions needed to check for port/cable's Thunderbolt mode compatibility back into TCPMv1. 2. Refactored the common Thunderbolt mode functions using pd_cable structure for mode information by adding a. Generic function that returns the Discover Mode response of specified SVID. b. Thunderbolt specific functiion that returns Discover Mode response of Intel SVID. 3. Removed the redundant pd_cable structure from DRP state machine policy engine. BUG=b:158294748 b:150611251 BRANCH=None TEST=1. Able to enter into Thunderbolt mode on TCPMv1 Change-Id: I30c8f1a007228408e08520502db00601ca3a2521 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2249020 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'common/usb_pd_host_cmd.c')
-rw-r--r--common/usb_pd_host_cmd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/common/usb_pd_host_cmd.c b/common/usb_pd_host_cmd.c
index 3a26018e64..19e74b47aa 100644
--- a/common/usb_pd_host_cmd.c
+++ b/common/usb_pd_host_cmd.c
@@ -253,8 +253,14 @@ static const mux_state_t typec_mux_map[USB_PD_CTRL_MUX_COUNT] = {
*/
static uint8_t get_pd_control_flags(int port)
{
- union tbt_mode_resp_cable cable_resp = get_cable_tbt_vdo(port);
- union tbt_mode_resp_device device_resp = get_dev_tbt_vdo(port);
+ union tbt_mode_resp_cable cable_resp;
+ union tbt_mode_resp_device device_resp;
+
+ if (!IS_ENABLED(CONFIG_USB_PD_ALT_MODE_DFP))
+ return 0;
+
+ cable_resp.raw_value = pd_get_tbt_mode_vdo(port, TCPC_TX_SOP_PRIME);
+ device_resp.raw_value = pd_get_tbt_mode_vdo(port, TCPC_TX_SOP);
/*
* Ref: USB Type-C Cable and Connector Specification