mirror of https://github.com/thesofproject/sof.git
audio: dai-zephyr: reset DMA buffer cursors on TRIGGER_RELEASE
On NXP platforms, stopping the DMAC and then re-configuring it leads to the internal DMA buffer cursors being reset. Leaving the SOF DMA buffer cursors in the same state means the DMA driver and SOF may potentially end up with two different views of the same buffer (from the cursors' point of view). This in, turn, may lead to the DAI consuming stale data because of the values of "free" and "pending" queried from dma_reload() stopping dai_common_copy() from copying new data. To fix this, reset the read and write cursors of the DMA buffer from SOF side. This way, both SOF and the DMA driver will have the same initial view of the DMA buffer cursors. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit is contained in:
parent
3ab82dceb2
commit
9831a9ded7
|
@ -1069,6 +1069,16 @@ static int dai_comp_trigger_internal(struct dai_data *dd, struct comp_dev *dev,
|
|||
buffer_zero(dd->dma_buffer);
|
||||
}
|
||||
|
||||
/* DMA driver and SOF's view of the DMA buffer's
|
||||
* read and write cursors must be the same to
|
||||
* avoid scenarios in which the DMA driver
|
||||
* reports false "free" and "pending" values, thus
|
||||
* leading to the DMA copying stale data due to
|
||||
* dma_status() stopping dai_common_copy() from
|
||||
* updating the data.
|
||||
*/
|
||||
audio_stream_reset(&dd->dma_buffer->stream);
|
||||
|
||||
/* only start the DAI if we are not XRUN handling */
|
||||
if (dd->xrun == 0) {
|
||||
/* recover valid start position */
|
||||
|
|
Loading…
Reference in New Issue