summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-smdk2443/0037-Use-dma_size-parameter-and-fix-buffdone-oops.patch
blob: 720f3b486892b9703744356ab1062689f64aa510 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
From b0679d107622f7480a6629d3e92af714d9ea78b4 Mon Sep 17 00:00:00 2001
From: Graeme Gregory <gg@a10082.wolfsonmicro.main>
Date: Mon, 26 Mar 2007 15:34:29 +0100
Subject: [PATCH] Use dma_size parameter and fix buffdone oops

Make use of the dma_size parameter in i2s.c and pcm.c

Move the access of prtd in buffdone until after we have checked for an
abort as flush may be called when prtd is no longer valid.

Signed-off-by: Graeme Gregory <gg@opensource.wolfsonmicro.com>
---
 sound/soc/s3c24xx/s3c24xx-i2s.c |    6 ++++--
 sound/soc/s3c24xx/s3c24xx-pcm.c |   16 +++++++++-------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c
index df655a5..8ca314d 100644
--- a/sound/soc/s3c24xx/s3c24xx-i2s.c
+++ b/sound/soc/s3c24xx/s3c24xx-i2s.c
@@ -61,13 +61,15 @@ static struct s3c2410_dma_client s3c24xx_dma_client_in = {
 static struct s3c24xx_pcm_dma_params s3c24xx_i2s_pcm_stereo_out = {
 	.client		= &s3c24xx_dma_client_out,
 	.channel	= DMACH_I2S_OUT,
-	.dma_addr	= S3C2410_PA_IIS + S3C2410_IISFIFO
+	.dma_addr	= S3C2410_PA_IIS + S3C2410_IISFIFO,
+	.dma_size	= 2,
 };
 
 static struct s3c24xx_pcm_dma_params s3c24xx_i2s_pcm_stereo_in = {
 	.client		= &s3c24xx_dma_client_in,
 	.channel	= DMACH_I2S_IN,
-	.dma_addr	= S3C2410_PA_IIS + S3C2410_IISFIFO
+	.dma_addr	= S3C2410_PA_IIS + S3C2410_IISFIFO,
+	.dma_size	= 2,
 };
 
 struct s3c24xx_i2s_info {
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c
index 867f1b3..dc28bc6 100644
--- a/sound/soc/s3c24xx/s3c24xx-pcm.c
+++ b/sound/soc/s3c24xx/s3c24xx-pcm.c
@@ -38,7 +38,7 @@
 
 #include "s3c24xx-pcm.h"
 
-#define S3C24XX_PCM_DEBUG 0
+#define S3C24XX_PCM_DEBUG 1
 #if S3C24XX_PCM_DEBUG
 #define DBG(x...) printk(KERN_DEBUG x)
 #else
@@ -119,13 +119,15 @@ static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel,
 							enum s3c2410_dma_buffresult result)
 {
 	struct snd_pcm_substream *substream = dev_id;
-	struct s3c24xx_runtime_data *prtd = substream->runtime->private_data;
+	struct s3c24xx_runtime_data *prtd;
 
 	DBG("Entered %s\n", __FUNCTION__);
 
 	if (result == S3C2410_RES_ABORT || result == S3C2410_RES_ERR)
 		return;
 
+	prtd = substream->runtime->private_data;
+	
 	if (substream)
 		snd_pcm_period_elapsed(substream);
 
@@ -177,10 +179,12 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream,
 						S3C2410_DISRCC_APB, prtd->params->dma_addr);
 
 		s3c2410_dma_config(prtd->params->channel,
-						2, S3C2410_DCON_SYNC_PCLK | S3C2410_DCON_HANDSHAKE);
+						prtd->params->dma_size,
+						S3C2410_DCON_SYNC_PCLK | S3C2410_DCON_HANDSHAKE);
 	} else {
 		s3c2410_dma_config(prtd->params->channel,
-						2, S3C2410_DCON_HANDSHAKE | S3C2410_DCON_SYNC_PCLK);
+						prtd->params->dma_size,
+						S3C2410_DCON_HANDSHAKE | S3C2410_DCON_SYNC_PCLK);
 
 		s3c2410_dma_devconfig(prtd->params->channel,
 						S3C2410_DMASRC_HW, 0x3,
@@ -214,7 +218,7 @@ static int s3c24xx_pcm_hw_free(struct snd_pcm_substream *substream)
 
 	/* TODO - do we need to ensure DMA flushed */
 	snd_pcm_set_runtime_buffer(substream, NULL);
-
+	
 	if (prtd->params) {
 		s3c2410_dma_free(prtd->params->channel, prtd->params->client);
 		prtd->params = NULL;
@@ -321,8 +325,6 @@ static int s3c24xx_pcm_open(struct snd_pcm_substream *substream)
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct s3c24xx_runtime_data *prtd;
 
-	int ret;
-
 	DBG("Entered %s\n", __FUNCTION__);
 
 	snd_soc_set_runtime_hwparams(substream, &s3c24xx_pcm_hardware);
-- 
1.5.0.3