0404-dmaengine-bcm2835-Fix-cyclic-DMA-period-splitting.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 60026ebc9abd3e719f56db57c482679176ae8881 Mon Sep 17 00:00:00 2001
  2. From: Matthias Reichl <hias@horus.com>
  3. Date: Tue, 7 Jun 2016 19:37:10 +0200
  4. Subject: [PATCH] dmaengine: bcm2835: Fix cyclic DMA period splitting
  5. The code responsible for splitting periods into chunks that
  6. can be handled by the DMA controller missed to update total_len,
  7. the number of bytes processed in the current period, when there
  8. are more chunks to follow.
  9. Therefore total_len was stuck at 0 and the code didn't work at all.
  10. This resulted in a wrong control block layout and audio issues because
  11. the cyclic DMA callback wasn't executing on period boundaries.
  12. Fix this by adding the missing total_len update.
  13. Signed-off-by: Matthias Reichl <hias@horus.com>
  14. Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
  15. Tested-by: Clive Messer <clive.messer@digitaldreamtime.co.uk>
  16. ---
  17. drivers/dma/bcm2835-dma.c | 5 ++++-
  18. 1 file changed, 4 insertions(+), 1 deletion(-)
  19. --- a/drivers/dma/bcm2835-dma.c
  20. +++ b/drivers/dma/bcm2835-dma.c
  21. @@ -252,8 +252,11 @@ static void bcm2835_dma_create_cb_set_le
  22. */
  23. /* have we filled in period_length yet? */
  24. - if (*total_len + control_block->length < period_len)
  25. + if (*total_len + control_block->length < period_len) {
  26. + /* update number of bytes in this period so far */
  27. + *total_len += control_block->length;
  28. return;
  29. + }
  30. /* calculate the length that remains to reach period_length */
  31. control_block->length = period_len - *total_len;