Skip to content

Commit

Permalink
audio: host: reload DMA buffer on non-zero partial_size
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dnikodem authored and lgirdwood committed Jan 18, 2024
1 parent 7b5475b commit 16b53b4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/audio/host-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 16b53b4

Please sign in to comment.