summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyushee Shah <ayushee.shah@intel.com>2021-01-06 15:15:37 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-07 19:18:16 +0000
commitc3981e9ec46b0bb839b06a898bb0e99b760b3058 (patch)
tree45bbd2e3fc8b50b6d295a6caaff201aa981264de
parentf22925531a49127dca6b43b738e4c006fa33ff11 (diff)
downloadchrome-ec-c3981e9ec46b0bb839b06a898bb0e99b760b3058.tar.gz
usb_pd: correct PD control flag bit shifting
PD control flag returned to host doesn't have correct bit shifting, this causes enumeration failure of TBT devices using MBR cable. Hence, corrected PD control flag bit shifting BUG=b:176604391 BRANCH=none TEST=Test with MBR cable and enumeration is successful. make buildall -j Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Change-Id: Ica3c71b00e435c5ba417717baf22fc6dc26f9a92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613904 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--common/usb_pd_host_cmd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/common/usb_pd_host_cmd.c b/common/usb_pd_host_cmd.c
index dedfad4f2a..c08332621b 100644
--- a/common/usb_pd_host_cmd.c
+++ b/common/usb_pd_host_cmd.c
@@ -269,11 +269,15 @@ static uint8_t get_pd_control_flags(int port)
* Table F-11 TBT3 Cable Discover Mode VDO Responses
* For Passive cables, Active Cable Plug link training is set to 0
*/
- control_flags |= cable_resp.lsrx_comm == UNIDIR_LSRX_COMM;
- control_flags |= device_resp.tbt_adapter == TBT_ADAPTER_TBT2_LEGACY;
- control_flags |= cable_resp.tbt_cable == TBT_CABLE_OPTICAL;
- control_flags |= get_usb_pd_cable_type(port) == IDH_PTYPE_ACABLE;
- control_flags |= cable_resp.tbt_active_passive == TBT_CABLE_ACTIVE;
+ control_flags |= (get_usb_pd_cable_type(port) == IDH_PTYPE_ACABLE ||
+ cable_resp.tbt_active_passive == TBT_CABLE_ACTIVE) ?
+ USB_PD_CTRL_ACTIVE_CABLE : 0;
+ control_flags |= cable_resp.tbt_cable == TBT_CABLE_OPTICAL ?
+ USB_PD_CTRL_OPTICAL_CABLE : 0;
+ control_flags |= device_resp.tbt_adapter == TBT_ADAPTER_TBT2_LEGACY ?
+ USB_PD_CTRL_TBT_LEGACY_ADAPTER : 0;
+ control_flags |= cable_resp.lsrx_comm == UNIDIR_LSRX_COMM ?
+ USB_PD_CTRL_ACTIVE_LINK_UNIDIR : 0;
return control_flags;
}