summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2021-02-22 08:28:38 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-19 17:39:54 +0000
commitb310f6f494e847d7d66361356f31c298d3aeb601 (patch)
tree72bb8e74f77611b5b52852bb8cfd0e45d5b2b657
parent054968a6d677caeccd59b7f8ec14871d1a33eaba (diff)
downloadchrome-ec-b310f6f494e847d7d66361356f31c298d3aeb601.tar.gz
TCPMv2: TC: Check drp_state upon exit of tc_disabled
This CL fixes a remaining issue for starting in the correct state when the drp_state is set to FORCE_SOURCE. BUG=b:175512794 BRANCH=None TEST=verfied that following disabling of a port that when the port is enabled again, it will start in the unattached_src state instead of unattached_snk. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I86e2ca3a3231a727660fbdd328115ed506fcdd5d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2718267 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774586 Tested-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 8b2a1f23e6..4867ae28d4 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -2049,11 +2049,13 @@ static void tc_disabled_entry(const int port)
static void tc_disabled_run(const int port)
{
- /* If pd_set_suspend clears the request, go to TC_UNATTACHED_SNK. */
- if (!TC_CHK_FLAG(port, TC_FLAGS_REQUEST_SUSPEND))
- set_state_tc(port, TC_UNATTACHED_SNK);
- else
+ /* If pd_set_suspend clears the request, go to TC_UNATTACHED_SNK/SRC. */
+ if (!TC_CHK_FLAG(port, TC_FLAGS_REQUEST_SUSPEND)) {
+ set_state_tc(port, drp_state[port] == PD_DRP_FORCE_SOURCE ?
+ TC_UNATTACHED_SRC : TC_UNATTACHED_SNK);
+ } else {
tc_pause_event_loop(port);
+ }
}
static void tc_disabled_exit(const int port)