summaryrefslogtreecommitdiff
path: root/common/usb_pd_protocol.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2018-10-17 22:41:32 -0700
committerCommit Bot <commit-bot@chromium.org>2020-05-05 12:10:00 +0000
commit026f308016365484e37c1379ccc868605cb41681 (patch)
tree7168442fce2bf7fe9467d0449dc8f4a69e3401d6 /common/usb_pd_protocol.c
parent06922f11767086a5aeb68768d032685749388333 (diff)
downloadchrome-ec-026f308016365484e37c1379ccc868605cb41681.tar.gz
CHERRY-PICK: usb_pd: Retry sending VDMs on transmit failure.
When VDM messages are queued up to be sent and encounter a transmit failure, there are no retry mechanisms in place. This leads to cases where we think we had sent a reply but it wasn't actually sent and violates the PD 2.0+ spec. This commit simply attempts to retry sending the VDM when it encounters an error. BUG=b:117902978 BRANCH=firmware-nocturne-10984.B TEST=Flash nocturne; Plug in Apple 87W USB-C charger, verify that retries are attempted when a reply to DiscIdent fails to be transmitted. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/1288036 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Change-Id: I9c0ed392e27482e4e0b87cfa52b82941e3679eb5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2160869 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Patryk Duda <pdk@semihalf.com> Commit-Queue: Patryk Duda <pdk@semihalf.com>
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r--common/usb_pd_protocol.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 50a5b33750..3766d5e182 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -2261,6 +2261,11 @@ static void pd_vdm_send_state_machine(int port)
pd[port].vdm_state = VDM_STATE_ERR_TMOUT;
}
break;
+ case VDM_STATE_ERR_SEND:
+ /* Sending the VDM failed, so try again. */
+ CPRINTF("C%d VDMretry\n", port);
+ pd[port].vdm_state = VDM_STATE_READY;
+ break;
default:
break;
}