Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio: dai-zephyr: put no-data checks behind a build option #8649

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions app/debug_overlay.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ CONFIG_ASSERT=y
# CONFIG_ZTEST=y
# CONFIG_SOF_BOOT_TEST=y

CONFIG_DAI_VERBOSE_GLITCH_WARNINGS=y

# Following options can be enabled additionally,
# but will incur a higher runtime cost, so are thus
# disabled by default.
Expand Down
9 changes: 9 additions & 0 deletions src/audio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,13 @@ config DISABLE_DESCRIPTOR_SPLIT
help
This option disbale the descriptor split for host p-table.

config DAI_VERBOSE_GLITCH_WARNINGS
bool "Enable additional checks and warnings for DAI data flow"
default n
help
Select if you want to enable additional checks and warning logs for
DAI data flow. If DAI copy is called with no data to process,
always emit a warning. This option useful to debug issues with
DAI DMA operation and issues with low-latency scheduling.

endmenu
6 changes: 6 additions & 0 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,9 @@ int dai_zephyr_multi_endpoint_copy(struct dai_data **dd, struct comp_dev *dev,

/* return if nothing to copy */
if (!frames) {
#if CONFIG_DAI_VERBOSE_GLITCH_WARNINGS
comp_warn(dev, "dai_zephyr_multi_endpoint_copy(): nothing to copy");
#endif

for (i = 0; i < num_endpoints; i++) {
ret = dma_reload(dd[i]->chan->dma->z_dev, dd[i]->chan->index, 0, 0, 0);
Expand Down Expand Up @@ -1460,6 +1462,7 @@ int dai_common_copy(struct dai_data *dd, struct comp_dev *dev, pcm_converter_fun
comp_dbg(dev, "dai_common_copy(), dir: %d copy_bytes= 0x%x",
dev->direction, copy_bytes);

#if CONFIG_DAI_VERBOSE_GLITCH_WARNINGS
/* Check possibility of glitch occurrence */
if (dev->direction == SOF_IPC_STREAM_PLAYBACK &&
copy_bytes + avail_bytes < dd->period_bytes)
Expand All @@ -1469,10 +1472,13 @@ int dai_common_copy(struct dai_data *dd, struct comp_dev *dev, pcm_converter_fun
copy_bytes + free_bytes < dd->period_bytes)
comp_warn(dev, "dai_common_copy(): Copy_bytes %d + free bytes %d < period bytes %d, possible glitch",
copy_bytes, free_bytes, dd->period_bytes);
#endif

/* return if nothing to copy */
if (!copy_bytes) {
#if CONFIG_DAI_VERBOSE_GLITCH_WARNINGS
comp_warn(dev, "dai_zephyr_copy(): nothing to copy");
#endif
dma_reload(dd->chan->dma->z_dev, dd->chan->index, 0, 0, 0);
return 0;
}
Expand Down