-
Notifications
You must be signed in to change notification settings - Fork 349
audio: dai-zephyr: minor cleanup of xrun handling code #10479
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
base: main
Are you sure you want to change the base?
Conversation
Some minor improvements to make the xrun handling code easier to follow. The current implementation is checking for DAI DMA overrun/underrun conditions both at start of a copy callback (using data from DMA driver dma_get_status()), as well as at end of copy callback (using dma_reload()). There is also two separate mechanisms to report xruns, one specific to IPC4 (CONFIG_XRUN_NOTIFICATIONS_ENABLE) and one common method using component.h interface (comp_underrun() and comp_underrun()). Add documentation to the xrun helper functions and rename dai_report_xrun() to dai_report_reload_xrun() to better reflect the actual implementation. Signed-off-by: Kai Vehmanen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves the readability and documentation of xrun (overrun/underrun) handling code in the DAI Zephyr driver. The changes clarify that xrun detection occurs at two points: during status checks via dma_get_status() and after reload attempts via dma_reload().
Changes:
- Added comprehensive documentation to xrun detection and reporting helper functions
- Renamed
dai_report_xrun()todai_report_reload_xrun()to clarify it handles reload-specific xrun reporting - Updated all call sites to use the new function name
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * Report xrun occurrence after DAI DMA driver reports | ||
| * an error for a reload attempt of 'bytes' of data. | ||
| * | ||
| * See also xrun detection done in dai_get_status(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it also make sense to explain a bit more what comp_underrun() and comp_overrun() do? Their comments aren't particularly enlightening either:
Called by the component device when underrun is detected.
Some minor improvements to make the xrun handling code easier to follow. The current implementation is checking for DAI DMA overrun/underrun conditions both at start of a copy callback (using data from DMA driver dma_get_status()), as well as at end of copy callback (using dma_reload()). There is also two separate mechanisms to report xruns, one specific to IPC4 (CONFIG_XRUN_NOTIFICATIONS_ENABLE) and one common method using component.h interface (comp_underrun() and comp_underrun()).
Add documentation to the xrun helper functions and rename dai_report_xrun() to dai_report_reload_xrun() to better reflect the actual implementation.