Skip to content

Commit 16b53b4

Browse files
dnikodemlgirdwood
authored andcommitted
audio: host: reload DMA buffer on non-zero partial_size
This patch ensures that the DMA buffer is reloaded when partial_size is non-zero, even if copy_bytes is zero. This condition typically occurs at the end of a stream, where the last data chunk does not meet the condition for reload DMA buffer, leaving a non-zero partial_size. Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
1 parent 7b5475b commit 16b53b4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/audio/host-zephyr.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,20 @@ static int host_copy_normal(struct host_data *hd, struct comp_dev *dev, copy_cal
449449
comp_dbg(dev, "host_copy_normal()");
450450

451451
copy_bytes = host_get_copy_bytes_normal(hd, dev);
452-
if (!copy_bytes)
452+
if (!copy_bytes) {
453+
if (hd->partial_size != 0) {
454+
if (stream_sync(hd, dev)) {
455+
ret = dma_reload(hd->chan->dma->z_dev, hd->chan->index, 0, 0,
456+
hd->partial_size);
457+
if (ret < 0)
458+
comp_err(dev, "dma_reload() failed, ret = %u", ret);
459+
460+
hd->partial_size = 0;
461+
}
462+
}
463+
453464
return 0;
465+
}
454466

455467
cb(dev, copy_bytes);
456468

0 commit comments

Comments
 (0)