Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the commit message, the git commit prefix should refer to the component changed, i.e. here "audio: host: ".

Could you explain a bit in which case this happens. "src" -> resampler case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kai, thanks for feedback.
Regarding the commit message, I will make a correction to specify the component as "audio: host."

Regarding the scenario in which this could happen:
This condition typically occurs at the end of a stream, where the last data chunk does not meet the condition for reload DMA buffer (e.g., large buffers), leaving a non-zero partial_size.


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;
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to duplicate the logic at the end of the functions, so how about instaed:

if (copy_bytes)
     cb(dev, copy_bytes);

if (!hd->partial_bytes)
       return 0;

And let the existing code to call dma_reload at the end of the function.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnikodem Ack, so above won't work with CONFIG_HOST_DMA_RELOAD_DELAY_ENABLE=y and if we get repeated calls copy_bytes==0 (stream is ending). So back to original version (with just the commit message clarified) is ok to me


return 0;
}

cb(dev, copy_bytes);

Expand Down