[Sound-open-firmware] [PATCH] comp: pause: Make sure dai/host state are preserved during pause/resume

Liam Girdwood liam.r.girdwood at linux.intel.com
Thu Dec 21 23:09:37 CET 2017


The DAI and host components states must be preserved during pause so that
when normal pipeline positions are used on resume. i.e. pause just looks
like a very long pipeline schedule.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/audio/dai.c  | 10 ++++------
 src/audio/host.c |  1 -
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/audio/dai.c b/src/audio/dai.c
index 9058f5c..b7ad1b4 100644
--- a/src/audio/dai.c
+++ b/src/audio/dai.c
@@ -95,7 +95,6 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next)
 
 		/* inform waiters */
 		wait_completed(&dd->complete);
-		return;
 	}
 
 	/* is our pipeline handling an XRUN ? */
@@ -172,9 +171,8 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next)
 	}
 
 	/* notify pipeline that DAI needs its buffer processed */
-	pipeline_schedule_copy(dev->pipeline, 0);
-
-	return;
+	if (dev->state == COMP_STATE_ACTIVE)
+		pipeline_schedule_copy(dev->pipeline, 0);
 }
 
 static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
@@ -539,10 +537,10 @@ static int dai_cmd(struct comp_dev *dev, int cmd, void *data)
 		return ret;
 
 	switch (cmd) {
-	case COMP_CMD_RELEASE:
 	case COMP_CMD_START:
-
 		dai_pointer_init(dev);
+		/* fall through */
+	case COMP_CMD_RELEASE:
 
 		/* only start the DAI if we are not XRUN handling */
 		if (dd->xrun == 0) {
diff --git a/src/audio/host.c b/src/audio/host.c
index 8f09952..7cb62ef 100644
--- a/src/audio/host.c
+++ b/src/audio/host.c
@@ -529,7 +529,6 @@ static int host_cmd(struct comp_dev *dev, int cmd, void *data)
 		return ret;
 
 	switch (cmd) {
-	case COMP_CMD_PAUSE:
 	case COMP_CMD_STOP:
 		ret = host_stop(dev);
 		break;
-- 
2.14.1



More information about the Sound-open-firmware mailing list