dai: recovery dai buffer and dma pointer for none-init start

For none-init first trigger start, need to recovery buffer state and set
the dma pointer as pause/release did.
This will allow ALSA STOP/START recovery pattern work now.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
This commit is contained in:
Pan Xiuli 2018-12-19 18:14:34 +08:00 committed by Liam Girdwood
parent dd8cfda311
commit bea92dfcc8
1 changed files with 13 additions and 0 deletions

View File

@ -551,6 +551,19 @@ static int dai_comp_trigger(struct comp_dev *dev, int cmd)
trace_dai("dai_comp_trigger(), START"); trace_dai("dai_comp_trigger(), START");
if (!dd->pointer_init) if (!dd->pointer_init)
dai_pointer_init(dev); dai_pointer_init(dev);
/* for nono-first init start, we need to recover the buffer
* state as well pointer position as pause/relesas did
*/
else {
/* set valid buffer pointer */
dai_buffer_process(dev);
/* recover valid start position */
ret = dma_release(dd->dma, dd->chan);
if (ret < 0)
return ret;
}
/* only start the DAI if we are not XRUN handling /* only start the DAI if we are not XRUN handling
* and the ptr is not initialized by the host as in this * and the ptr is not initialized by the host as in this
* case start is deferred to the first copy call as the buffer * case start is deferred to the first copy call as the buffer