-
Notifications
You must be signed in to change notification settings - Fork 349
hda-dma: Fix HDA DMA position regs going out of sync with w_ptr/r_ptr #10013
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
hda-dma: Fix HDA DMA position regs going out of sync with w_ptr/r_ptr #10013
Conversation
|
Failures in CI related to MTL and TGL. Zephyr's GPDMA does not return write_position and read_position in dma_status :( Temporarily switching to draft. Update: Now fixed with new version. |
The HDA DMA hardware keeps track of data in the DMA buffer using hardware Read and Write Position registers. The software uses the struct audio_stream with w_ptr and r_ptr for a similar purpose. If the software w_ptr and r_ptr do not point to the same location as the hardware Write and Read Position registers, the problem occurs. Such desynchronization happens upon a pipeline reset. The dma_buffer is freed during a reset in dai-zephyr or host-zephyr and reallocated in prepare() after the pipeline resume. The reallocated dma_buffer has w_ptr and r_ptr set to NULL, while the hardware HDA DMA Read and Write Position registers retain their values. If, for example, in the DAI playback case, the difference between the Write Position register and w_ptr is more than one period, the problem could easily go unnoticed as the hardware simply copies older data. In case where the difference between the Write Position and w_ptr is more than 0 but less than one period, the DMA copies part of the new data and part of the old data, resulting in glitches. This fix ensures that the software w_ptr and r_ptr stay in sync with the hardware HDA DMA Write and Read Position registers. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
bbe1490 to
f253491
Compare
kv2019i
left a comment
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.
Did you see this in some existing test case? Do you think we should cherry-pick this to v2.13?
Yes. Bug report: https://hsdes.intel.com/appstore/article/#/18041236600 (Sorry, it's Intel's internal link). |
The HDA DMA hardware keeps track of data in the DMA buffer using hardware Read and Write Position registers. The software uses the struct audio_stream with w_ptr and r_ptr for a similar purpose. If the software w_ptr and r_ptr do not point to the same location as the hardware Write and Read Position registers, the problem occurs.
Such desynchronization happens upon a pipeline reset. The dma_buffer is freed during a reset in dai-zephyr or host-zephyr and reallocated in prepare() after the pipeline resume. The reallocated dma_buffer has w_ptr and r_ptr set to NULL, while the hardware HDA DMA Read and Write Position registers retain their values.
If, for example, in the DAI playback case, the difference between the Write Position register and w_ptr is more than one period, the problem could easily go unnoticed as the hardware simply copies older data. In case where the difference between the Write Position and w_ptr is more than 0 but less than one period, the DMA copies part of the new data and part of the old data, resulting in glitches.
This fix ensures that the software w_ptr and r_ptr stay in sync with the hardware HDA DMA Write and Read Position registers.