[Sound-open-firmware] [PATCH] dai: handle xrun with more clear logic
Keyon Jie
yang.jie at linux.intel.com
Fri Mar 30 16:46:05 CEST 2018
1. xrun happens.
2. trigger pipeline xrun and recover.
3. set dd->xrun in XRUN cmd from pipeline recover.
4. stop dma and reset buffer to 0s.
5. dai prepare and clear dd->xrun in prepare calling from recover.
6. start dma again in START cmd from pipeline recover.
This fix APL pause/release Xrun issue in my test.
Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
---
src/audio/dai.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/audio/dai.c b/src/audio/dai.c
index 2888c40..e1ea9ab 100644
--- a/src/audio/dai.c
+++ b/src/audio/dai.c
@@ -82,8 +82,8 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next)
trace_dai("irq");
- /* is stream stopped or paused and we are not handling XRUN ? */
- if (dev->state != COMP_STATE_ACTIVE && dd->xrun == 0) {
+ /* stop dma copy for pause/stop/xrun */
+ if (dev->state != COMP_STATE_ACTIVE || dd->xrun) {
/* stop the DAI */
dai_trigger(dd->dai, COMP_TRIGGER_STOP, dev->params.direction);
@@ -111,9 +111,6 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next)
dcache_writeback_region(dma_buffer->addr,
dma_buffer->size);
}
-
- /* inform waiters */
- wait_completed(&dd->complete);
return;
}
@@ -456,8 +453,11 @@ static int dai_prepare(struct comp_dev *dev)
}
/* dma reconfig not required if XRUN handling */
- if (dd->xrun)
+ if (dd->xrun) {
+ /* after prepare, we have recovered from xrun */
+ dd->xrun = 0;
return ret;
+ }
ret = dma_set_config(dd->dma, dd->chan, &dd->config);
if (ret < 0)
--
2.14.1
More information about the Sound-open-firmware
mailing list