diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2020-01-30 16:12:15 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-04 04:07:52 +0000 |
commit | 9a02c817a31865fa368fbb8f5a7a3aa8875b3308 (patch) | |
tree | aaf7e5bf314e7c590a8086c013f10b9d571c093e /common/usb_pd_alt_mode_dfp.c | |
parent | 0b30c20dcfd5460f957ea687d4b4bfd7bcf3d8de (diff) | |
download | chrome-ec-9a02c817a31865fa368fbb8f5a7a3aa8875b3308.tar.gz |
TCPMv1/v2: Move dfp_consume_modes() to common file
BUG=b:148528713
BRANCH=none
TEST=make buildall -j
Change-Id: I0a587a68b5c814595d78905f1cdd611f710f2182
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032160
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, 17 insertions, 0 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c index e89cf09b57..809943e4f4 100644 --- a/common/usb_pd_alt_mode_dfp.c +++ b/common/usb_pd_alt_mode_dfp.c @@ -301,3 +301,20 @@ void dfp_consume_svids(int port, int cnt, uint32_t *payload) if (i && ((i % 12) == 0)) CPRINTF("ERR:SVID+12\n"); } + +void dfp_consume_modes(int port, int cnt, uint32_t *payload) +{ + struct pd_policy *pe = pd_get_am_policy(port); + int idx = pe->svid_idx; + + pe->svids[idx].mode_cnt = cnt - 1; + + if (pe->svids[idx].mode_cnt < 0) { + CPRINTF("ERR:NOMODE\n"); + } else { + memcpy(pe->svids[pe->svid_idx].mode_vdo, &payload[1], + sizeof(uint32_t) * pe->svids[idx].mode_cnt); + } + + pe->svid_idx++; +} |