audio: dai-zephyr: minor cleanup of xrun handling code#10479
audio: dai-zephyr: minor cleanup of xrun handling code#10479kv2019i merged 1 commit intothesofproject:mainfrom
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 <kai.vehmanen@linux.intel.com>
There was a problem hiding this comment.
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.
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.
There was a problem hiding this comment.
I don't mind @lyakh but you need to find some developer who understands them. ;) I poured all my knowledge into these comments.
There was a problem hiding this comment.
@kv2019i I think you are that developer! Since you understand what this function does, you certainly also understand what those functions do, because all this function does is calling one of them!
|
Checked build fails in https://sof-ci.01.org/sofpr/PR10479/build18464/build/index.html manually and they are with Intel ace40 build target and not related to this PR. Ignoring and proceeding with merge. |
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.