summaryrefslogtreecommitdiff
path: root/common/usbc/usbc_task.c
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2020-04-10 16:06:05 -0700
committerCommit Bot <commit-bot@chromium.org>2020-04-12 03:41:36 +0000
commit5c947e512c5fc099ef93edcde6444b8279cb41e9 (patch)
tree07f9cda558f71cdcd8444e3775bbbf0e9b2d256c /common/usbc/usbc_task.c
parent3f2623d4598f13691747ea4980c5edbd362f958c (diff)
downloadchrome-ec-5c947e512c5fc099ef93edcde6444b8279cb41e9.tar.gz
TCPMv2: Only send TASK_EVENT_WAKE events when SM is paused
If the tc_start_event_loop function is called while the state machine is not paused, do not send TASK_EVENT_WAKE events. BUG=b:153792915 BRANCH=none TEST=make -j buildall Change-Id: I425dcb63d2b4d90404c87110094fcfeaf0f53636 Signed-off-by: Sam Hurst <shurst@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2144481 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'common/usbc/usbc_task.c')
-rw-r--r--common/usbc/usbc_task.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/common/usbc/usbc_task.c b/common/usbc/usbc_task.c
index 6dde2712e6..3ba7a81642 100644
--- a/common/usbc/usbc_task.c
+++ b/common/usbc/usbc_task.c
@@ -48,8 +48,14 @@ void tc_pause_event_loop(int port)
void tc_start_event_loop(int port)
{
- paused[port] = 0;
- task_set_event(PD_PORT_TO_TASK_ID(port), TASK_EVENT_WAKE, 0);
+ /*
+ * Only generate TASK_EVENT_WAKE event if state
+ * machine is transitioning to un-paused
+ */
+ if (paused[port]) {
+ paused[port] = 0;
+ task_set_event(PD_PORT_TO_TASK_ID(port), TASK_EVENT_WAKE, 0);
+ }
}
/* High-priority interrupt tasks implementations */