Commit f253491
committed
hda-dma: Fix HDA DMA position regs going out of sync with w_ptr/r_ptr.
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>1 parent b193c48 commit f253491
File tree
3 files changed
+62
-0
lines changed- src
- audio
- include/sof/audio
3 files changed
+62
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1516 | 1516 | | |
1517 | 1517 | | |
1518 | 1518 | | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
1519 | 1522 | | |
1520 | 1523 | | |
1521 | 1524 | | |
| |||
1647 | 1650 | | |
1648 | 1651 | | |
1649 | 1652 | | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
1650 | 1665 | | |
1651 | 1666 | | |
1652 | 1667 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
389 | 406 | | |
390 | 407 | | |
391 | 408 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
661 | 662 | | |
662 | 663 | | |
663 | 664 | | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
664 | 694 | | |
665 | 695 | | |
666 | 696 | | |
| |||
0 commit comments