diff options
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/s3c24xx/s3c24xx-pcm.c | 42 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c24xx-pcm.h | 7 |
2 files changed, 27 insertions, 22 deletions
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c index f1c0b9fa179c..21dc6974d6a3 100644 --- a/sound/soc/s3c24xx/s3c24xx-pcm.c +++ b/sound/soc/s3c24xx/s3c24xx-pcm.c | |||
@@ -89,7 +89,7 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream) | |||
89 | 89 | ||
90 | DBG("Entered %s\n", __FUNCTION__); | 90 | DBG("Entered %s\n", __FUNCTION__); |
91 | 91 | ||
92 | while ( prtd->dma_loaded < prtd->dma_limit) { | 92 | while (prtd->dma_loaded < prtd->dma_limit) { |
93 | unsigned long len = prtd->dma_period; | 93 | unsigned long len = prtd->dma_period; |
94 | 94 | ||
95 | DBG("dma_loaded: %d\n",prtd->dma_loaded); | 95 | DBG("dma_loaded: %d\n",prtd->dma_loaded); |
@@ -100,7 +100,8 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream) | |||
100 | __FUNCTION__, len); | 100 | __FUNCTION__, len); |
101 | } | 101 | } |
102 | 102 | ||
103 | ret = s3c2410_dma_enqueue(prtd->params->channel, substream, pos, len); | 103 | ret = s3c2410_dma_enqueue(prtd->params->channel, |
104 | substream, pos, len); | ||
104 | 105 | ||
105 | if (ret == 0) { | 106 | if (ret == 0) { |
106 | prtd->dma_loaded++; | 107 | prtd->dma_loaded++; |
@@ -115,17 +116,19 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream) | |||
115 | } | 116 | } |
116 | 117 | ||
117 | static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel, | 118 | static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel, |
118 | void *dev_id, int size, | 119 | void *dev_id, int size, |
119 | enum s3c2410_dma_buffresult result) | 120 | enum s3c2410_dma_buffresult result) |
120 | { | 121 | { |
121 | struct snd_pcm_substream *substream = dev_id; | 122 | struct snd_pcm_substream *substream = dev_id; |
122 | struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; | 123 | struct s3c24xx_runtime_data *prtd; |
123 | 124 | ||
124 | DBG("Entered %s\n", __FUNCTION__); | 125 | DBG("Entered %s\n", __FUNCTION__); |
125 | 126 | ||
126 | if (result == S3C2410_RES_ABORT || result == S3C2410_RES_ERR) | 127 | if (result == S3C2410_RES_ABORT || result == S3C2410_RES_ERR) |
127 | return; | 128 | return; |
128 | 129 | ||
130 | prtd = substream->runtime->private_data; | ||
131 | |||
129 | if (substream) | 132 | if (substream) |
130 | snd_pcm_period_elapsed(substream); | 133 | snd_pcm_period_elapsed(substream); |
131 | 134 | ||
@@ -173,18 +176,22 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
173 | * sync to pclk, half-word transfers to the IIS-FIFO. */ | 176 | * sync to pclk, half-word transfers to the IIS-FIFO. */ |
174 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 177 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
175 | s3c2410_dma_devconfig(prtd->params->channel, | 178 | s3c2410_dma_devconfig(prtd->params->channel, |
176 | S3C2410_DMASRC_MEM, S3C2410_DISRCC_INC | | 179 | S3C2410_DMASRC_MEM, S3C2410_DISRCC_INC | |
177 | S3C2410_DISRCC_APB, prtd->params->dma_addr); | 180 | S3C2410_DISRCC_APB, prtd->params->dma_addr); |
178 | 181 | ||
179 | s3c2410_dma_config(prtd->params->channel, | 182 | s3c2410_dma_config(prtd->params->channel, |
180 | 2, S3C2410_DCON_SYNC_PCLK | S3C2410_DCON_HANDSHAKE); | 183 | prtd->params->dma_size, |
184 | S3C2410_DCON_SYNC_PCLK | | ||
185 | S3C2410_DCON_HANDSHAKE); | ||
181 | } else { | 186 | } else { |
182 | s3c2410_dma_config(prtd->params->channel, | 187 | s3c2410_dma_config(prtd->params->channel, |
183 | 2, S3C2410_DCON_HANDSHAKE | S3C2410_DCON_SYNC_PCLK); | 188 | prtd->params->dma_size, |
189 | S3C2410_DCON_HANDSHAKE | | ||
190 | S3C2410_DCON_SYNC_PCLK); | ||
184 | 191 | ||
185 | s3c2410_dma_devconfig(prtd->params->channel, | 192 | s3c2410_dma_devconfig(prtd->params->channel, |
186 | S3C2410_DMASRC_HW, 0x3, | 193 | S3C2410_DMASRC_HW, 0x3, |
187 | prtd->params->dma_addr); | 194 | prtd->params->dma_addr); |
188 | } | 195 | } |
189 | 196 | ||
190 | s3c2410_dma_set_buffdone_fn(prtd->params->channel, | 197 | s3c2410_dma_set_buffdone_fn(prtd->params->channel, |
@@ -215,7 +222,7 @@ static int s3c24xx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
215 | /* TODO - do we need to ensure DMA flushed */ | 222 | /* TODO - do we need to ensure DMA flushed */ |
216 | snd_pcm_set_runtime_buffer(substream, NULL); | 223 | snd_pcm_set_runtime_buffer(substream, NULL); |
217 | 224 | ||
218 | if(prtd->params) { | 225 | if (prtd->params) { |
219 | s3c2410_dma_free(prtd->params->channel, prtd->params->client); | 226 | s3c2410_dma_free(prtd->params->channel, prtd->params->client); |
220 | prtd->params = NULL; | 227 | prtd->params = NULL; |
221 | } | 228 | } |
@@ -281,7 +288,8 @@ static int s3c24xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
281 | return ret; | 288 | return ret; |
282 | } | 289 | } |
283 | 290 | ||
284 | static snd_pcm_uframes_t s3c24xx_pcm_pointer(struct snd_pcm_substream *substream) | 291 | static snd_pcm_uframes_t |
292 | s3c24xx_pcm_pointer(struct snd_pcm_substream *substream) | ||
285 | { | 293 | { |
286 | struct snd_pcm_runtime *runtime = substream->runtime; | 294 | struct snd_pcm_runtime *runtime = substream->runtime; |
287 | struct s3c24xx_runtime_data *prtd = runtime->private_data; | 295 | struct s3c24xx_runtime_data *prtd = runtime->private_data; |
@@ -321,8 +329,6 @@ static int s3c24xx_pcm_open(struct snd_pcm_substream *substream) | |||
321 | struct snd_pcm_runtime *runtime = substream->runtime; | 329 | struct snd_pcm_runtime *runtime = substream->runtime; |
322 | struct s3c24xx_runtime_data *prtd; | 330 | struct s3c24xx_runtime_data *prtd; |
323 | 331 | ||
324 | int ret; | ||
325 | |||
326 | DBG("Entered %s\n", __FUNCTION__); | 332 | DBG("Entered %s\n", __FUNCTION__); |
327 | 333 | ||
328 | snd_soc_set_runtime_hwparams(substream, &s3c24xx_pcm_hardware); | 334 | snd_soc_set_runtime_hwparams(substream, &s3c24xx_pcm_hardware); |
@@ -342,7 +348,7 @@ static int s3c24xx_pcm_close(struct snd_pcm_substream *substream) | |||
342 | 348 | ||
343 | DBG("Entered %s\n", __FUNCTION__); | 349 | DBG("Entered %s\n", __FUNCTION__); |
344 | 350 | ||
345 | if(prtd) | 351 | if (prtd) |
346 | kfree(prtd); | 352 | kfree(prtd); |
347 | else | 353 | else |
348 | DBG("s3c24xx_pcm_close called with prtd == NULL\n"); | 354 | DBG("s3c24xx_pcm_close called with prtd == NULL\n"); |
@@ -419,8 +425,8 @@ static void s3c24xx_pcm_free_dma_buffers(struct snd_pcm *pcm) | |||
419 | 425 | ||
420 | static u64 s3c24xx_pcm_dmamask = DMA_32BIT_MASK; | 426 | static u64 s3c24xx_pcm_dmamask = DMA_32BIT_MASK; |
421 | 427 | ||
422 | static int s3c24xx_pcm_new(struct snd_card *card, struct snd_soc_codec_dai *dai, | 428 | static int s3c24xx_pcm_new(struct snd_card *card, |
423 | struct snd_pcm *pcm) | 429 | struct snd_soc_codec_dai *dai, struct snd_pcm *pcm) |
424 | { | 430 | { |
425 | int ret = 0; | 431 | int ret = 0; |
426 | 432 | ||
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.h b/sound/soc/s3c24xx/s3c24xx-pcm.h index 5dced4ab1932..0088c79822ea 100644 --- a/sound/soc/s3c24xx/s3c24xx-pcm.h +++ b/sound/soc/s3c24xx/s3c24xx-pcm.h | |||
@@ -16,15 +16,14 @@ | |||
16 | #define ST_OPENED (1<<1) | 16 | #define ST_OPENED (1<<1) |
17 | 17 | ||
18 | struct s3c24xx_pcm_dma_params { | 18 | struct s3c24xx_pcm_dma_params { |
19 | struct s3c2410_dma_client *client; /* stream identifier */ | 19 | struct s3c2410_dma_client *client; /* stream identifier */ |
20 | int channel; /* Channel ID */ | 20 | int channel; /* Channel ID */ |
21 | dma_addr_t dma_addr; | 21 | dma_addr_t dma_addr; |
22 | int dma_size; /* Size of the DMA transfer */ | ||
22 | }; | 23 | }; |
23 | 24 | ||
24 | #define S3C24XX_DAI_I2S 0 | 25 | #define S3C24XX_DAI_I2S 0 |
25 | 26 | ||
26 | extern struct snd_soc_cpu_dai s3c24xx_i2s_dai; | ||
27 | |||
28 | /* platform data */ | 27 | /* platform data */ |
29 | extern struct snd_soc_platform s3c24xx_soc_platform; | 28 | extern struct snd_soc_platform s3c24xx_soc_platform; |
30 | extern struct snd_ac97_bus_ops s3c24xx_ac97_ops; | 29 | extern struct snd_ac97_bus_ops s3c24xx_ac97_ops; |