diff options
author | Scott Collyer <scollyer@google.com> | 2021-02-22 08:28:38 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-17 16:27:56 +0000 |
commit | b8f039e2de4469119a087897844694bbcc4130fc (patch) | |
tree | af0a7ced8ad4627367c8be577f8378f97c530c6e /common | |
parent | 0ee437d1a11f20a580f2a409c44dab4a5f317894 (diff) | |
download | chrome-ec-b8f039e2de4469119a087897844694bbcc4130fc.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>
Diffstat (limited to 'common')
-rw-r--r-- | common/usbc/usb_tc_drp_acc_trysrc_sm.c | 10 |
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 7158b4342f..35f57e0f83 100644 --- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c +++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c @@ -2032,11 +2032,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) |