From 5198517136117b478bccd3c421e0afa3d1f29eb3 Mon Sep 17 00:00:00 2001 From: Wu Zhigang Date: Thu, 19 Jul 2018 09:22:12 +0800 Subject: [PATCH] component:refine the state machine for state transform. 1. when component is at PAUSED, it will not receive START command from host or DSP internal. 2. when the component is at PAUSED, it would receive STOP command from host. we miss this point. Signed-off-by: Wu Zhigang --- src/audio/component.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/audio/component.c b/src/audio/component.c index 902c53fddd52..5d91a9b4a340 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -122,8 +122,7 @@ int comp_set_state(struct comp_dev *dev, int cmd) switch (cmd) { case COMP_TRIGGER_START: - if (dev->state == COMP_STATE_PREPARE || - dev->state == COMP_STATE_PAUSED) { + if (dev->state == COMP_STATE_PREPARE) { dev->state = COMP_STATE_ACTIVE; } else { trace_comp_error("CES"); @@ -142,7 +141,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) break; case COMP_TRIGGER_STOP: case COMP_TRIGGER_XRUN: - if (dev->state == COMP_STATE_ACTIVE) { + if (dev->state == COMP_STATE_ACTIVE || + dev->state == COMP_STATE_PAUSED) { dev->state = COMP_STATE_PREPARE; } else { trace_comp_error("CEs");