diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2020-02-12 12:01:31 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-14 00:17:13 +0000 |
commit | ba2927dd652c425bef420f90c6610ffcd182e070 (patch) | |
tree | 6d9b88e3561b1aee49deb5d956df0dd4621be40a /common/usb_common.c | |
parent | eb3344e698973f61559614f9b0aaa6c0282e9e11 (diff) | |
download | chrome-ec-ba2927dd652c425bef420f90c6610ffcd182e070.tar.gz |
TCPMv1/v2: Move PD & Partner type detection code to common file
BUG=b:148528713
BRANCH=none
TEST=make buildall -j
Change-Id: Icb9dfe998df889e8e2d6de7776d9889295115708
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2052644
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/usb_common.c')
-rw-r--r-- | common/usb_common.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/common/usb_common.c b/common/usb_common.c index fa568601ab..660098b5cd 100644 --- a/common/usb_common.c +++ b/common/usb_common.c @@ -153,6 +153,27 @@ enum pd_cc_states pd_get_cc_state( return PD_CC_NONE; } +/** + * This function checks the current CC status of the port partner + * and returns true if the attached partner is UFP. + */ +bool pd_partner_is_ufp(int port) +{ + enum pd_cc_states cc_state = pd_get_task_cc_state(port); + + return cc_state == PD_CC_UFP_ATTACHED || + cc_state == PD_CC_UFP_DEBUG_ACC || + cc_state == PD_CC_UFP_AUDIO_ACC; +} + +bool pd_is_debug_acc(int port) +{ + enum pd_cc_states cc_state = pd_get_task_cc_state(port); + + return cc_state == PD_CC_UFP_DEBUG_ACC || + cc_state == PD_CC_DFP_DEBUG_ACC; +} + __overridable int pd_board_check_request(uint32_t rdo, int pdo_cnt) { return EC_SUCCESS; |