Skip to content

Commit ba77f7d

Browse files
kv2019iabonislawski
authored andcommitted
audio: chain_dma: fix link DMA reload logic for initial reload
Current code waits until host DMA has more than half of the DMA buffer size worth of data available for transfer. The code however does not check whether link DMA has space for all available data yet and can cause the link DMA write pointer to wrap the read pointer. This will break the delay reporting and can lead to link xruns if the wrapped write pointer ends up too close to the link DMA read position (which is moved by DMA hardware in playback case). Tested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 3499b09 commit ba77f7d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/audio/chain_dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static enum task_state chain_task_run(void *data)
243243
if (!cd->first_data_received && host_avail_bytes > half_buff_size) {
244244
ret = dma_reload(cd->chan_link->dma->z_dev,
245245
cd->chan_link->index, 0, 0,
246-
half_buff_size);
246+
MIN(host_avail_bytes, link_free_bytes));
247247
if (ret < 0) {
248248
tr_err(&chain_dma_tr,
249249
"dma_reload() link error, ret = %d", ret);

0 commit comments

Comments
 (0)