summaryrefslogtreecommitdiff
path: root/common/usbc/usb_prl_sm.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-08-22 11:46:52 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-02 18:16:48 +0000
commite74f988385e6f7cad5db96e939c41fb1efc001d8 (patch)
treedca98f06e38599e483afc4f6c33893ad7af2bd7f /common/usbc/usb_prl_sm.c
parent1f11429ce850c93d9cd2f2bc762e10898689b7de (diff)
downloadchrome-ec-e74f988385e6f7cad5db96e939c41fb1efc001d8.tar.gz
TCPMv2: allow TxSinkNG/OK to cross power roles on pr_swaps
BUG=b:165822172 BRANCH=none TEST=DUT-DUT PR_Swap Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I056b61cc0e6b7a56f1673728f52783c9d0cf196c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2370746 Tested-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'common/usbc/usb_prl_sm.c')
-rw-r--r--common/usbc/usb_prl_sm.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c
index 30a0969d97..8fc49c23c1 100644
--- a/common/usbc/usb_prl_sm.c
+++ b/common/usbc/usb_prl_sm.c
@@ -798,40 +798,28 @@ static void prl_tx_wait_for_message_request_run(const int port)
*/
if (IS_ENABLED(CONFIG_USB_PD_REV30) && is_sop_rev30(port) &&
pe_in_local_ams(port)) {
- if (PRL_TX_CHK_FLAG(port, PRL_FLAGS_SINK_NG)) {
+ if (PRL_TX_CHK_FLAG(port, PRL_FLAGS_SINK_NG |
+ PRL_FLAGS_WAIT_SINK_OK)) {
/*
- * Setting the TxSinkNG requires us to wait to allow
- * the SNK a chance to receive the signal. If we are
- * already in a source initiated AMS there is no
- * reason to set that again and perform the wait. In
- * the case of a multi-message AMS, like PR_Swap's
- * PS_RDY, we want to continue the AMS even though
- * our role may have changed.
+ * If we are already in an AMS then allow the
+ * multi-message AMS to continue, even if we
+ * swap power roles.
*
- * Fall through
- */
- } else if (pd_get_power_role(port) == PD_ROLE_SOURCE) {
- /*
- * Start of SRC AMS notification received from
- * Policy Engine
+ * Fall Through using the current AMS
*/
- PRL_TX_SET_FLAG(port, PRL_FLAGS_SINK_NG);
- set_state_prl_tx(port, PRL_TX_SRC_SOURCE_TX);
- return;
} else {
/*
- * Start of SNK AMS notification received from
+ * Start of SRC AMS notification received from
* Policy Engine
*/
- if (!PRL_TX_CHK_FLAG(port, PRL_FLAGS_WAIT_SINK_OK)) {
+ if (pd_get_power_role(port) == PD_ROLE_SOURCE) {
+ PRL_TX_SET_FLAG(port, PRL_FLAGS_SINK_NG);
+ set_state_prl_tx(port, PRL_TX_SRC_SOURCE_TX);
+ } else {
PRL_TX_SET_FLAG(port, PRL_FLAGS_WAIT_SINK_OK);
- /*
- * First Message in AMS notification
- * received from Policy Engine.
- */
set_state_prl_tx(port, PRL_TX_SNK_START_AMS);
- return;
}
+ return;
}
}