diff --git a/src/audio/dai-zephyr.c b/src/audio/dai-zephyr.c index 0b415bf28d86..14f6038354f8 100644 --- a/src/audio/dai-zephyr.c +++ b/src/audio/dai-zephyr.c @@ -1597,6 +1597,13 @@ int dai_zephyr_copy(struct dai_data *dd, struct comp_dev *dev, pcm_converter_fun samples = MIN(samples, src_samples); } + /* return if nothing to copy */ + if (!samples) { + comp_warn(dev, "dai_zephyr_copy(): nothing to copy, dd->total_data_processed %llu", dd->total_data_processed); + dma_reload(dd->chan->dma->z_dev, dd->chan->index, 0, 0, 0); + return 0; + } + /* limit bytes per copy to one period for the whole pipeline * in order to avoid high load spike * if FAST_MODE is enabled, then one period limitation is omitted @@ -1619,13 +1626,6 @@ int dai_zephyr_copy(struct dai_data *dd, struct comp_dev *dev, pcm_converter_fun comp_warn(dev, "dai_zephyr_copy(): Copy_bytes %d + free bytes %d < period bytes %d, possible glitch", copy_bytes, free_bytes, dd->period_bytes); - /* return if nothing to copy */ - if (!copy_bytes) { - comp_warn(dev, "dai_zephyr_copy(): nothing to copy"); - dma_reload(dd->chan->dma->z_dev, dd->chan->index, 0, 0, 0); - return 0; - } - /* trigger optional DAI_TRIGGER_COPY which prepares dai to copy */ ret = dai_trigger(dd->dai->dev, dev->direction, DAI_TRIGGER_COPY); if (ret < 0) diff --git a/src/audio/host-zephyr.c b/src/audio/host-zephyr.c index a31ccf84f7af..c61cf2725458 100644 --- a/src/audio/host-zephyr.c +++ b/src/audio/host-zephyr.c @@ -422,8 +422,8 @@ static uint32_t host_get_copy_bytes_normal(struct host_data *hd, struct comp_dev dma_copy_bytes = MIN(hd->period_bytes, dma_copy_bytes); if (!dma_copy_bytes) - comp_info(dev, "no bytes to copy, available samples: %d, free_samples: %d", - avail_samples, free_samples); + comp_info(dev, "no bytes to copy, hd->total_data_processed %llu available samples: %d, free_samples: %d", + hd->total_data_processed, avail_samples, free_samples); buffer_release(buffer_c);