diff options
author | Todd Broch <tbroch@chromium.org> | 2014-10-16 22:46:27 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-20 22:25:19 +0000 |
commit | 0e3497762c71e6c4cd7fe6b7f71beb15ff654f6f (patch) | |
tree | a8f1faa62a15b313b25ec7b88c9a8122d3e73aae /board/hoho/usb_pd_policy.c | |
parent | a4d51baf7c12dec2327d8badbdcb093b86df5050 (diff) | |
download | chrome-ec-0e3497762c71e6c4cd7fe6b7f71beb15ff654f6f.tar.gz |
pd: alternate mode: Limit response to valid modes during discovery.
Previous reading of specification left some doubt about how SVDM
responder to 'discover modes' command communicated the number of valid
modes. It is communicated via the 'object position' field in the VDM
header where: opos = modes + 1.
This change adds the mode count to the opos field and sends only that
amount of data back to the initiator. Initiator stores that mode_cnt
so that it can correctly choose a mode when 'enter mode' phase occurs.
BRANCH=none
BUG=chrome-os-partner:30645
TEST=manual,
1. see SVDM responder to Discover modes only send supported number of
modes for SVID.
2. 'pe 0 dump' displays correct set of discovered modes on initiator.
Change-Id: I9b626dd6dd3e85e80b4f0596332300d74b1830ee
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/223981
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/hoho/usb_pd_policy.c')
-rw-r--r-- | board/hoho/usb_pd_policy.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/board/hoho/usb_pd_policy.c b/board/hoho/usb_pd_policy.c index 20097e80c1..b647219085 100644 --- a/board/hoho/usb_pd_policy.c +++ b/board/hoho/usb_pd_policy.c @@ -131,15 +131,15 @@ const uint32_t vdo_dp_mode[1] = { static int svdm_response_modes(int port, uint32_t *payload) { + int mode_cnt = ARRAY_SIZE(vdo_dp_mode); + if (PD_VDO_VID(payload[0]) != USB_SID_DISPLAYPORT) { /* TODO(tbroch) USB billboard enabled here then */ return 1; /* will generate a NAK */ } - memset(payload + 1, 0, sizeof(uint32_t) * PDO_MODES); - payload[1] = vdo_dp_mode[0]; - /* TODO(tbroch) does spec have mechanism for identifying valid modes - * returned for svid? */ - return PDO_MAX_OBJECTS; + + memcpy(payload + 1, vdo_dp_mode, sizeof(vdo_dp_mode)); + return mode_cnt + 1; } static int svdm_enter_mode(int port, uint32_t *payload) |