diff options
author | Ayushee <ayushee.shah@intel.com> | 2020-06-01 23:21:21 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-05 10:15:37 +0000 |
commit | c9e0e383c9279c07ddcfa12c604a259da665bebb (patch) | |
tree | 3267034f24ca5b61bd0bf134663ad0ae6a3d03ac /common/usb_pd_alt_mode_dfp.c | |
parent | 86aacabcd3c2e496a43d291d9dee61e29edcc2d0 (diff) | |
download | chrome-ec-c9e0e383c9279c07ddcfa12c604a259da665bebb.tar.gz |
usb_pd: TBT: Refactor limiting the cable speed
Refactored 'get_tbt_cable_speed()' to return thunderbolt-compatible speed
as per the speed supported by DUT's port or cable speed whichever is
lowest.
Also removed 'usb_pd_limit_cable_speed()' to retain cables's actual VDO
response.
BUG=b:157671582
BRANCH=none
TEST=Able to limit thunderbolt cable speed, if the cable speed is higher
than the speed supported by DUT's port.
Signed-off-by: Ayushee <ayushee.shah@intel.com>
Change-Id: I77d3efddb425daa7bd12e9ed21be7088074285bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2227088
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/usb_pd_alt_mode_dfp.c')
-rw-r--r-- | common/usb_pd_alt_mode_dfp.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c index 79ac93d94e..051fa9740c 100644 --- a/common/usb_pd_alt_mode_dfp.c +++ b/common/usb_pd_alt_mode_dfp.c @@ -793,12 +793,23 @@ bool is_tbt_compat_mode(int port, int cnt, const uint32_t *payload) PD_VDO_RESP_MODE_INTEL_TBT(payload[VDO_INDEX_IDH]); } -bool cable_supports_tbt_speed(int port) +enum tbt_compat_cable_speed get_tbt_cable_speed(int port) { struct pd_cable *cable = pd_get_cable_attributes(port); + enum tbt_compat_cable_speed max_tbt_speed = + board_get_max_tbt_speed(port); + + return cable->cable_mode_resp.tbt_cable_speed > max_tbt_speed ? + max_tbt_speed : cable->cable_mode_resp.tbt_cable_speed; +} + +bool cable_supports_tbt_speed(int port) +{ + enum tbt_compat_cable_speed tbt_cable_speed = + get_tbt_cable_speed(port); - return (cable->cable_mode_resp.tbt_cable_speed == TBT_SS_TBT_GEN3 || - cable->cable_mode_resp.tbt_cable_speed == TBT_SS_U32_GEN1_GEN2); + return (tbt_cable_speed == TBT_SS_TBT_GEN3 || + tbt_cable_speed == TBT_SS_U32_GEN1_GEN2); } /* |