summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-03-31 11:43:21 -0600
committerCommit Bot <commit-bot@chromium.org>2020-03-31 21:27:06 +0000
commit8e78ab84c51b38f305478468a50ae268dd97fc9f (patch)
treeb50a03d85f0cb750b0dca08bb1aeb100d5cf6f1b
parent9a905747e3747ae5db727d2f68d45749b95a97ca (diff)
downloadchrome-ec-8e78ab84c51b38f305478468a50ae268dd97fc9f.tar.gz
tcpmv2: default tc state change needs to be to a tc state
leaving auto_toggle_run can have a next state of default but this causes the tc state change to transition to a PD state which if all of the options are enabled it will line up but if something is gone it can direct the tc to the wrong state. BUG=b:152028728 BRANCH=none TEST=check trembyle to still be working Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ic3b6ac3faf04ee6cad9d7f74d9ab67a5c23776ad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2129342 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index a3aa63f83c..166815cd6c 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -2866,10 +2866,12 @@ static void tc_drp_auto_toggle_run(const int port)
}
}
+ if (next_state == DRP_TC_DEFAULT)
+ next_state = (PD_ROLE_DEFAULT(port) == PD_ROLE_SOURCE)
+ ? DRP_TC_UNATTACHED_SRC
+ : DRP_TC_UNATTACHED_SNK;
+
switch (next_state) {
- case DRP_TC_DEFAULT:
- set_state_tc(port, PD_DEFAULT_STATE(port));
- break;
case DRP_TC_UNATTACHED_SNK:
/*
* New SNK connection.
@@ -2891,6 +2893,7 @@ static void tc_drp_auto_toggle_run(const int port)
set_state_tc(port, TC_UNATTACHED_SRC);
break;
case DRP_TC_DRP_AUTO_TOGGLE:
+ default:
/*
* We are staying in PD_STATE_DRP_AUTO_TOGGLE
*/