diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2020-01-30 16:35:54 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-04 04:07:53 +0000 |
commit | 51e1a092de5daf59b1a6b39755183a6ef312f199 (patch) | |
tree | 50ceba37d23cdd44bced495d3f2ba18187b6f631 /common/usb_pd_alt_mode_dfp.c | |
parent | 9a02c817a31865fa368fbb8f5a7a3aa8875b3308 (diff) | |
download | chrome-ec-51e1a092de5daf59b1a6b39755183a6ef312f199.tar.gz |
TCPMv1/v2: Move dfp_discover_modes() to common file
BUG=b:148528713
BRANCH=none
TEST=make buildall -j
Change-Id: I83c6dca9652a9c613849b292b4c2329da3f9d424
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032161
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 | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c index 809943e4f4..40a048a2bc 100644 --- a/common/usb_pd_alt_mode_dfp.c +++ b/common/usb_pd_alt_mode_dfp.c @@ -318,3 +318,16 @@ void dfp_consume_modes(int port, int cnt, uint32_t *payload) pe->svid_idx++; } + +int dfp_discover_modes(int port, uint32_t *payload) +{ + struct pd_policy *pe = pd_get_am_policy(port); + uint16_t svid = pe->svids[pe->svid_idx].svid; + + if (pe->svid_idx >= pe->svid_cnt) + return 0; + + payload[0] = VDO(svid, 1, CMD_DISCOVER_MODES); + + return 1; +} |