From 8f9b769af84c6bb4d835b0434b0e7f66364e3a73 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 24 May 2022 12:03:59 +0200 Subject: [PATCH] dai: add a DAI operations copy method Add a DAI copy method to be called before dma_copy(). Signed-off-by: Guennadi Liakhovetski --- src/audio/dai-legacy.c | 3 +++ src/audio/dai-zephyr.c | 3 +++ src/include/sof/lib/dai.h | 1 + 3 files changed, 7 insertions(+) diff --git a/src/audio/dai-legacy.c b/src/audio/dai-legacy.c index 1d30a22d1..07653fc99 100644 --- a/src/audio/dai-legacy.c +++ b/src/audio/dai-legacy.c @@ -1000,6 +1000,9 @@ static int dai_copy(struct comp_dev *dev) return 0; } + if (dd->dai->drv->ops.copy) + dd->dai->drv->ops.copy(dd->dai); + ret = dma_copy_legacy(dd->chan, copy_bytes, 0); if (ret < 0) { dai_report_xrun(dev, copy_bytes); diff --git a/src/audio/dai-zephyr.c b/src/audio/dai-zephyr.c index e20e08257..921c03c68 100644 --- a/src/audio/dai-zephyr.c +++ b/src/audio/dai-zephyr.c @@ -1107,6 +1107,9 @@ static int dai_copy(struct comp_dev *dev) return 0; } + if (dd->dai->drv->ops.copy) + dd->dai->drv->ops.copy(dd->dai); + struct dma_cb_data next = { .channel = dd->chan, .elem = { .size = copy_bytes }, diff --git a/src/include/sof/lib/dai.h b/src/include/sof/lib/dai.h index 4fa37897a..34129e1fe 100644 --- a/src/include/sof/lib/dai.h +++ b/src/include/sof/lib/dai.h @@ -86,6 +86,7 @@ struct dai_ops { int (*remove)(struct dai *dai); uint32_t (*get_init_delay_ms)(struct dai *dai); int (*get_fifo_depth)(struct dai *dai, int direction); + void (*copy)(struct dai *dai); /* Can be used by DAIs to prepare for data copying */ }; struct timestamp_cfg {