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>
This commit is contained in:
Damian Nikodem 2024-01-16 10:34:39 +01:00 committed by Liam Girdwood
parent 7b5475b0af
commit 16b53b423c
1 changed files with 13 additions and 1 deletions

View File

@ -449,8 +449,20 @@ static int host_copy_normal(struct host_data *hd, struct comp_dev *dev, copy_cal
comp_dbg(dev, "host_copy_normal()");
copy_bytes = host_get_copy_bytes_normal(hd, dev);
if (!copy_bytes)
if (!copy_bytes) {
if (hd->partial_size != 0) {
if (stream_sync(hd, dev)) {
ret = dma_reload(hd->chan->dma->z_dev, hd->chan->index, 0, 0,
hd->partial_size);
if (ret < 0)
comp_err(dev, "dma_reload() failed, ret = %u", ret);
hd->partial_size = 0;
}
}
return 0;
}
cb(dev, copy_bytes);