diff options
author | Todd Broch <tbroch@chromium.org> | 2015-01-02 21:02:33 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-07 08:45:41 +0000 |
commit | c0933f00b15d63a0a50e4faeed43fb3a60d48390 (patch) | |
tree | 58dee5671f87858626718b1f0b85889fe6c9a529 | |
parent | 5ef45ad19e839006a17668d792770021e022f3c8 (diff) | |
download | chrome-ec-c0933f00b15d63a0a50e4faeed43fb3a60d48390.tar.gz |
pd: Bugfix for pending VDM in disconnected state.
Commit f993fe3c refactored pd_vdm_send_state_machine to allow well timed
PD disconnects to be acceptable. This violates specification as VDMs certainly
shouldn't proceed without an explicit contract and mode entry.
CL reverts the logic to make 'ready' VDM in shadow of disconnect an error.
Signed-off-by: Todd Broch <tbroch@chromium.org>
BRANCH=samus
BUG=chrome-os-partner:33947
TEST=manual, compiles when disconnect occurs 'ready' VDM transistions to
vdm_state VDM_STATE_ERR_BUSY instead of staying 'ready'
Change-Id: Ic8e96506df365a72053713a806356c4afcfde26d
Reviewed-on: https://chromium-review.googlesource.com/238292
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 9d9c9d2178..86ccbeb0ad 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1404,20 +1404,18 @@ static void pd_vdm_send_state_machine(int port, int incoming_packet) switch (pd[port].vdm_state) { case VDM_STATE_READY: - /* - * if there's traffic or we're not in PDO ready state don't send - * a VDM */ - if (incoming_packet || pdo_busy(port)) + /* Only transmit VDM if connected. */ + if (!pd_is_connected(port)) { + pd[port].vdm_state = VDM_STATE_ERR_BUSY; break; + } /* - * Only transmit VDM if connected. Should follow busy logic - * (above) as custom VDMs can leave port in disconnected state + * if there's traffic or we're not in PDO ready state don't send + * a VDM. */ - if (!pd_is_connected(port)) { - pd[port].vdm_state = VDM_STATE_ERR_BUSY; + if (incoming_packet || pdo_busy(port)) break; - } /* Prepare and send VDM */ header = PD_HEADER(PD_DATA_VENDOR_DEF, pd[port].power_role, |