[Sound-open-firmware] [PATCH] pipeline: only schedule playback streams at pipeline start.

Liam Girdwood liam.r.girdwood at linux.intel.com
Sun Dec 10 21:48:12 CET 2017


Capture pipelines must wait for the DAI to fill one period of data
before they can be scheduled. This avoids underruning the pipeline.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/audio/pipeline.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c
index 4fe7896..3cfffb6 100644
--- a/src/audio/pipeline.c
+++ b/src/audio/pipeline.c
@@ -208,13 +208,19 @@ static void pipeline_cmd_update(struct pipeline *p, struct comp_dev *comp,
 	case COMP_CMD_RELEASE:
 		p->xrun_bytes = 0;
 
-		/* schedule initial pipeline fill when next idle */
-		pipeline_schedule_copy_idle(p);
-
-		/* schedule pipeline */
-		if (p->ipc_pipe.timer)
-			pipeline_schedule_copy(p, 0);
-
+		/* playback pipelines need scheduled now, capture pipelines are
+		 * scheduled once their initial DMA period is filled by the DAI */
+		if (comp->params.direction == SOF_IPC_STREAM_PLAYBACK) {
+
+			/* pipelines are either scheduled by timers or DAI/DMA interrupts */
+			if (p->ipc_pipe.timer) {
+				/* timer - schedule initial copy */
+				pipeline_schedule_copy(p, 0);
+			} else {
+				/* DAI - schedule initial pipeline fill when next idle */
+				pipeline_schedule_copy_idle(p);
+			}
+		}
 		break;
 	case COMP_CMD_SUSPEND:
 	case COMP_CMD_RESUME:
-- 
2.14.1



More information about the Sound-open-firmware mailing list