aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-rpi/rpi-dma-i2s-fix.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/linux-rpi/rpi-dma-i2s-fix.patch')
-rw-r--r--main/linux-rpi/rpi-dma-i2s-fix.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/main/linux-rpi/rpi-dma-i2s-fix.patch b/main/linux-rpi/rpi-dma-i2s-fix.patch
new file mode 100644
index 0000000000..82fa6dcf7c
--- /dev/null
+++ b/main/linux-rpi/rpi-dma-i2s-fix.patch
@@ -0,0 +1,66 @@
+From 8a2e9aec63f46deceacd0a92a66835a07fb18a31 Mon Sep 17 00:00:00 2001
+From: Matthias Reichl <hias@horus.com>
+Date: Sun, 8 Nov 2015 16:58:57 +0100
+Subject: [PATCH] bcm2708-dmaengine: fix calculation of cyclic DMA frames
+
+The calculation of the number of required frames was wrong which
+could lead to the last frame being longer than the requested period
+length and even the maximum supported transfer size.
+
+eg when requesting a 88208 bytes buffer with a period len of 22052
+(the defaults when playing a 44.1kHz stereo 16bit file with aplay)
+the code would allocate 3 frames, two with 22052 bytes and the
+last one with 44104 bytes instead of the expected 4 frames with
+22052 bytes each.
+
+Signed-off-by: Matthias Reichl <hias@horus.com>
+---
+ drivers/dma/bcm2708-dmaengine.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c
+index 85ce18b..91eac60 100644
+--- a/drivers/dma/bcm2708-dmaengine.c
++++ b/drivers/dma/bcm2708-dmaengine.c
+@@ -710,7 +710,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic(
+ max_size = MAX_NORMAL_TRANSFER;
+ period_len = min(period_len, max_size);
+
+- d->frames = (buf_len-1) / period_len + 1;
++ d->frames = DIV_ROUND_UP(buf_len, period_len);
+
+ /* Allocate memory for control blocks */
+ d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb);
+--
+2.6.3
+
+
+From 8e469d0e00fa0f337e0e5ccdb504ce0ecf6ea6d6 Mon Sep 17 00:00:00 2001
+From: Matthias Reichl <hias@horus.com>
+Date: Sun, 8 Nov 2015 17:00:45 +0100
+Subject: [PATCH] bcm2708-i2s: match period_bytes_max to DMA controller limit
+
+bcm2708-dmaengine supports a maximum transfer length of 32k bytes on
+the lite channels. period_bytes_max should reflect this limit.
+
+Signed-off-by: Matthias Reichl <hias@horus.com>
+---
+ sound/soc/bcm/bcm2708-i2s.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/soc/bcm/bcm2708-i2s.c b/sound/soc/bcm/bcm2708-i2s.c
+index 5e93cd6..b65d785 100644
+--- a/sound/soc/bcm/bcm2708-i2s.c
++++ b/sound/soc/bcm/bcm2708-i2s.c
+@@ -881,7 +881,7 @@ static struct snd_pcm_hardware bcm2708_pcm_hardware = {
+ SNDRV_PCM_FMTBIT_S24_LE |
+ SNDRV_PCM_FMTBIT_S32_LE,
+ .period_bytes_min = 32,
+- .period_bytes_max = 64 * PAGE_SIZE,
++ .period_bytes_max = SZ_32K,
+ .periods_min = 2,
+ .periods_max = 255,
+ .buffer_bytes_max = 128 * PAGE_SIZE,
+--
+2.6.3
+