diff options
author | Sam Hurst <shurst@google.com> | 2019-12-06 10:40:24 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-12-07 03:24:53 +0000 |
commit | 76d3b5d97e7b6887d782d95719f292c4050e91ce (patch) | |
tree | beeed5c59f3b8e7fa71ba5dbdcf6c644b300465f | |
parent | 2f814c9a297f2be7a508676a17052c7fe652c1d2 (diff) | |
download | chrome-ec-76d3b5d97e7b6887d782d95719f292c4050e91ce.tar.gz |
TCPMv2: Operating as a SNK, clear the End AMS flag
While operating as a sink, the End AMS flag is cleared
at the end of the Atomic Message Sequence.
BUG=b:145812132
BRANCH=none
TEST=make -j buildall
manual tests:
Using a kohaku and a Kensington dock, I verified that
the END_AMS flag is cleard and PD communication does
not stop.
Change-Id: Ia8b40ab42916dc5b2a690a6fb7f519015912a6fa
Signed-off-by: Sam Hurst <shurst@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1954256
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | common/usbc/usb_prl_sm.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c index 9a78b59474..a295d61d31 100644 --- a/common/usbc/usb_prl_sm.c +++ b/common/usbc/usb_prl_sm.c @@ -495,7 +495,7 @@ static void prl_tx_wait_for_message_request_run(const int port) (PRL_FLAGS_START_AMS | PRL_FLAGS_END_AMS))) { if (tc_get_power_role(port) == PD_ROLE_SOURCE) { /* - * Start of AMS notification received from + * Start of SRC AMS notification received from * Policy Engine */ if (PRL_TX_CHK_FLAG(port, PRL_FLAGS_START_AMS)) { @@ -504,18 +504,22 @@ static void prl_tx_wait_for_message_request_run(const int port) return; } /* - * End of AMS notification received from + * End of SRC AMS notification received from * Policy Engine */ else if (PRL_TX_CHK_FLAG(port, PRL_FLAGS_END_AMS)) { - PRL_TX_CLR_FLAG(port, PRL_FLAGS_END_AMS); /* Set Rp = SinkTxOk */ tcpm_select_rp_value(port, SINK_TX_OK); tcpm_set_cc(port, TYPEC_CC_RP); prl_tx[port].retry_counter = 0; + /* PRL_FLAGS_END AMS is cleared here */ prl_tx[port].flags = 0; } } else { + /* + * Start of SNK AMS notification received from + * Policy Engine + */ if (PRL_TX_CHK_FLAG(port, PRL_FLAGS_START_AMS)) { PRL_TX_CLR_FLAG(port, PRL_FLAGS_START_AMS); /* @@ -525,6 +529,16 @@ static void prl_tx_wait_for_message_request_run(const int port) set_state_prl_tx(port, PRL_TX_SNK_START_AMS); return; } + /* + * End of SNK AMS notification received from + * Policy Engine + */ + else if (PRL_TX_CHK_FLAG(port, PRL_FLAGS_END_AMS)) { + prl_tx[port].retry_counter = 0; + /* PRL_FLAGS_END AMS is cleared here */ + prl_tx[port].flags = 0; + } + } } else if (PRL_TX_CHK_FLAG(port, PRL_FLAGS_MSG_XMIT)) { PRL_TX_CLR_FLAG(port, PRL_FLAGS_MSG_XMIT); |