diff options
author | Denis Brockus <dbrockus@chromium.org> | 2019-12-05 14:39:15 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-12-06 20:07:55 +0000 |
commit | 15eda17ccf3df7a8e600758fa7795dde9853800f (patch) | |
tree | 5deab190b3fdb97617c4453cc0b1000330f7c953 /common/usbc/usbc_task.c | |
parent | 89197aceaf26ccf33b143c7a5e95eb07ba4c7464 (diff) | |
download | chrome-ec-15eda17ccf3df7a8e600758fa7795dde9853800f.tar.gz |
usbc: use different task pause for each port
Switching over to using an array with an entry per
port so each port is individually paused and awaken.
BUG=none
BRANCH=none
TEST=charger attach unattach repeated time should work
Change-Id: I570f93876d2ea60a5a0707f2096969ceb269b31f
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1954307
Commit-Queue: Jett Rink <jettrink@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'common/usbc/usbc_task.c')
-rw-r--r-- | common/usbc/usbc_task.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/common/usbc/usbc_task.c b/common/usbc/usbc_task.c index 219cf73b9a..dd0f73f0d4 100644 --- a/common/usbc/usbc_task.c +++ b/common/usbc/usbc_task.c @@ -34,7 +34,7 @@ #define USBC_EVENT_TIMEOUT (5 * MSEC) -static uint8_t paused; +static uint8_t paused[CONFIG_USB_PD_PORT_MAX_COUNT]; int tc_restart_tcpc(int port) { @@ -43,12 +43,12 @@ int tc_restart_tcpc(int port) void tc_pause_event_loop(int port) { - paused = 1; + paused[port] = 1; } void tc_start_event_loop(int port) { - paused = 0; + paused[port] = 0; task_set_event(PD_PORT_TO_TASK_ID(port), TASK_EVENT_WAKE, 0); } @@ -178,7 +178,9 @@ void pd_task(void *u) while (1) { /* wait for next event/packet or timeout expiration */ const uint32_t evt = - task_wait_event(paused ? -1 : USBC_EVENT_TIMEOUT); + task_wait_event(paused[port] + ? -1 + : USBC_EVENT_TIMEOUT); /* handle events that affect the state machine as a whole */ tc_event_check(port, evt); |