aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/s3c24xx/s3c24xx-pcm.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c
index 49580fb481d5..6c70a81c730c 100644
--- a/sound/soc/s3c24xx/s3c24xx-pcm.c
+++ b/sound/soc/s3c24xx/s3c24xx-pcm.c
@@ -20,6 +20,7 @@
20 20
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/io.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
25#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
@@ -30,7 +31,6 @@
30#include <sound/soc.h> 31#include <sound/soc.h>
31 32
32#include <asm/dma.h> 33#include <asm/dma.h>
33#include <asm/io.h>
34#include <asm/hardware.h> 34#include <asm/hardware.h>
35#include <asm/arch/dma.h> 35#include <asm/arch/dma.h>
36#include <asm/arch/audio.h> 36#include <asm/arch/audio.h>
@@ -93,7 +93,7 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream)
93 while (prtd->dma_loaded < prtd->dma_limit) { 93 while (prtd->dma_loaded < prtd->dma_limit) {
94 unsigned long len = prtd->dma_period; 94 unsigned long len = prtd->dma_period;
95 95
96 DBG("dma_loaded: %d\n",prtd->dma_loaded); 96 DBG("dma_loaded: %d\n", prtd->dma_loaded);
97 97
98 if ((pos + len) > prtd->dma_end) { 98 if ((pos + len) > prtd->dma_end) {
99 len = prtd->dma_end - pos; 99 len = prtd->dma_end - pos;
@@ -101,7 +101,7 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream)
101 __func__, len); 101 __func__, len);
102 } 102 }
103 103
104 ret = s3c2410_dma_enqueue(prtd->params->channel, 104 ret = s3c2410_dma_enqueue(prtd->params->channel,
105 substream, pos, len); 105 substream, pos, len);
106 106
107 if (ret == 0) { 107 if (ret == 0) {
@@ -129,7 +129,7 @@ static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel,
129 return; 129 return;
130 130
131 prtd = substream->runtime->private_data; 131 prtd = substream->runtime->private_data;
132 132
133 if (substream) 133 if (substream)
134 snd_pcm_period_elapsed(substream); 134 snd_pcm_period_elapsed(substream);
135 135
@@ -150,7 +150,7 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream,
150 struct snd_soc_pcm_runtime *rtd = substream->private_data; 150 struct snd_soc_pcm_runtime *rtd = substream->private_data;
151 struct s3c24xx_pcm_dma_params *dma = rtd->dai->cpu_dai->dma_data; 151 struct s3c24xx_pcm_dma_params *dma = rtd->dai->cpu_dai->dma_data;
152 unsigned long totbytes = params_buffer_bytes(params); 152 unsigned long totbytes = params_buffer_bytes(params);
153 int ret=0; 153 int ret = 0;
154 154
155 DBG("Entered %s\n", __func__); 155 DBG("Entered %s\n", __func__);
156 156
@@ -223,7 +223,7 @@ static int s3c24xx_pcm_prepare(struct snd_pcm_substream *substream)
223 /* return if this is a bufferless transfer e.g. 223 /* return if this is a bufferless transfer e.g.
224 * codec <--> BT codec or GSM modem -- lg FIXME */ 224 * codec <--> BT codec or GSM modem -- lg FIXME */
225 if (!prtd->params) 225 if (!prtd->params)
226 return 0; 226 return 0;
227 227
228 /* channel needs configuring for mem=>device, increment memory addr, 228 /* channel needs configuring for mem=>device, increment memory addr,
229 * sync to pclk, half-word transfers to the IIS-FIFO. */ 229 * sync to pclk, half-word transfers to the IIS-FIFO. */
@@ -293,8 +293,8 @@ static int s3c24xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
293 return ret; 293 return ret;
294} 294}
295 295
296static snd_pcm_uframes_t 296static snd_pcm_uframes_t
297 s3c24xx_pcm_pointer(struct snd_pcm_substream *substream) 297s3c24xx_pcm_pointer(struct snd_pcm_substream *substream)
298{ 298{
299 struct snd_pcm_runtime *runtime = substream->runtime; 299 struct snd_pcm_runtime *runtime = substream->runtime;
300 struct s3c24xx_runtime_data *prtd = runtime->private_data; 300 struct s3c24xx_runtime_data *prtd = runtime->private_data;
@@ -313,7 +313,7 @@ static snd_pcm_uframes_t
313 313
314 spin_unlock(&prtd->lock); 314 spin_unlock(&prtd->lock);
315 315
316 DBG("Pointer %x %x\n",src,dst); 316 DBG("Pointer %x %x\n", src, dst);
317 317
318 /* we seem to be getting the odd error from the pcm library due 318 /* we seem to be getting the odd error from the pcm library due
319 * to out-of-bounds pointers. this is maybe due to the dma engine 319 * to out-of-bounds pointers. this is maybe due to the dma engine
@@ -355,11 +355,11 @@ static int s3c24xx_pcm_close(struct snd_pcm_substream *substream)
355 355
356 DBG("Entered %s\n", __func__); 356 DBG("Entered %s\n", __func__);
357 357
358 if (prtd) 358 if (!prtd)
359 kfree(prtd);
360 else
361 DBG("s3c24xx_pcm_close called with prtd == NULL\n"); 359 DBG("s3c24xx_pcm_close called with prtd == NULL\n");
362 360
361 kfree(prtd);
362
363 return 0; 363 return 0;
364} 364}
365 365
@@ -371,9 +371,9 @@ static int s3c24xx_pcm_mmap(struct snd_pcm_substream *substream,
371 DBG("Entered %s\n", __func__); 371 DBG("Entered %s\n", __func__);
372 372
373 return dma_mmap_writecombine(substream->pcm->card->dev, vma, 373 return dma_mmap_writecombine(substream->pcm->card->dev, vma,
374 runtime->dma_area, 374 runtime->dma_area,
375 runtime->dma_addr, 375 runtime->dma_addr,
376 runtime->dma_bytes); 376 runtime->dma_bytes);
377} 377}
378 378
379static struct snd_pcm_ops s3c24xx_pcm_ops = { 379static struct snd_pcm_ops s3c24xx_pcm_ops = {
@@ -432,7 +432,7 @@ static void s3c24xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
432 432
433static u64 s3c24xx_pcm_dmamask = DMA_32BIT_MASK; 433static u64 s3c24xx_pcm_dmamask = DMA_32BIT_MASK;
434 434
435static int s3c24xx_pcm_new(struct snd_card *card, 435static int s3c24xx_pcm_new(struct snd_card *card,
436 struct snd_soc_codec_dai *dai, struct snd_pcm *pcm) 436 struct snd_soc_codec_dai *dai, struct snd_pcm *pcm)
437{ 437{
438 int ret = 0; 438 int ret = 0;
@@ -467,7 +467,6 @@ struct snd_soc_platform s3c24xx_soc_platform = {
467 .pcm_new = s3c24xx_pcm_new, 467 .pcm_new = s3c24xx_pcm_new,
468 .pcm_free = s3c24xx_pcm_free_dma_buffers, 468 .pcm_free = s3c24xx_pcm_free_dma_buffers,
469}; 469};
470
471EXPORT_SYMBOL_GPL(s3c24xx_soc_platform); 470EXPORT_SYMBOL_GPL(s3c24xx_soc_platform);
472 471
473MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); 472MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");