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>
This commit is contained in:
Todd Broch
2015-01-02 21:02:33 -08:00
committed by ChromeOS Commit Bot
parent 5ef45ad19e
commit c0933f00b1

View File

@@ -1404,21 +1404,19 @@ 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))
break;
/*
* Only transmit VDM if connected. Should follow busy logic
* (above) as custom VDMs can leave port in disconnected state
*/
/* Only transmit VDM if connected. */
if (!pd_is_connected(port)) {
pd[port].vdm_state = VDM_STATE_ERR_BUSY;
break;
}
/*
* if there's traffic or we're not in PDO ready state don't send
* a VDM.
*/
if (incoming_packet || pdo_busy(port))
break;
/* Prepare and send VDM */
header = PD_HEADER(PD_DATA_VENDOR_DEF, pd[port].power_role,
pd[port].data_role, pd[port].msg_id,