diff options
author | Scott Collyer <scollyer@google.com> | 2019-09-11 16:25:16 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-17 02:21:49 +0000 |
commit | c654e71e4909f2913a12bf444fb83dcbf442043d (patch) | |
tree | d877788d369ddd42d72f62a43beac72bd394320c | |
parent | af88cc91a92f15c65699d206fb6415a6d7edd3a0 (diff) | |
download | chrome-ec-c654e71e4909f2913a12bf444fb83dcbf442043d.tar.gz |
pd: Prevent trasmitting messages if rx messages are pending
This CL adds a check in pd_transmit to prevent sending tx messages if
there are pending rx messages to be processed. This fixes an issue
where a power role swap request is received, but before the accept
reply can be sent a VDM discover identity message is sent which
confuses the other side of the connection.
BUG=b:140092163
BRANCH=None
TEST=Tested with the AA-AM1N95W charge through hub. Verfied
that this can be attached to Kohaku with external power already
connected and successfully power role swap into source to charge the
kohaku port. Tested 20-25 connections with no failures. Prior to this
change the failure rate was 1 out of 3 attempts.
Change-Id: Iebe53e0fc52bf817b709d58ef3e0ee7b226b0aa9
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1799288
Reviewed-by: Jett Rink <jettrink@chromium.org>
Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Commit-Queue: Scott Collyer <scollyer@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index ae70ffb72b..039ef9dc23 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -884,6 +884,13 @@ static int pd_transmit(int port, enum tcpm_transmit_type type, /* If comms are disabled, do not transmit, return error */ if (!pd_comm_is_enabled(port)) return -1; + + /* Don't try to transmit anything until we have processed + * all RX messages. + */ + if (tcpm_has_pending_message(port)) + return -1; + #ifdef CONFIG_USB_PD_REV30 /* Source-coordinated collision avoidance */ /* |