summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorHarald Welte <laforge@openmoko.org>2007-07-24 12:49:39 +0200
committerJaroslav Kysela <perex@perex.cz>2007-10-16 15:57:57 +0200
commit646ab160ff5e672838209dbd679d50af63fbd366 (patch)
treeb2661fdcd378aa090f6135ef0e2507da8110998e /sound
parentfca7f38892fa713d5221e26fd3ee57817b4bc031 (diff)
downloadlinux-646ab160ff5e672838209dbd679d50af63fbd366.tar.gz
linux-646ab160ff5e672838209dbd679d50af63fbd366.tar.bz2
linux-646ab160ff5e672838209dbd679d50af63fbd366.zip
[ALSA] s3c24xx-pcm: fix hw_params dma handling
Since the PCM emulation can call multiple times to hw_setup(), but we can only once allocate/request the DMA channel, we have to handle this gracefully. Signed-off-by: Harald Welte <laforge@openmoko.org> Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/s3c24xx/s3c24xx-pcm.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c
index bfbdc3cbd43b..4107a87d4de3 100644
--- a/sound/soc/s3c24xx/s3c24xx-pcm.c
+++ b/sound/soc/s3c24xx/s3c24xx-pcm.c
@@ -158,18 +158,22 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream,
if (!dma)
return 0;
- /* prepare DMA */
- prtd->params = dma;
+ /* this may get called several times by oss emulation
+ * with different params -HW */
+ if (prtd->params == NULL) {
+ /* prepare DMA */
+ prtd->params = dma;
- DBG("params %p, client %p, channel %d\n", prtd->params,
- prtd->params->client, prtd->params->channel);
+ DBG("params %p, client %p, channel %d\n", prtd->params,
+ prtd->params->client, prtd->params->channel);
- ret = s3c2410_dma_request(prtd->params->channel,
- prtd->params->client, NULL);
+ ret = s3c2410_dma_request(prtd->params->channel,
+ prtd->params->client, NULL);
- if (ret) {
- DBG(KERN_ERR "failed to get dma channel\n");
- return ret;
+ if (ret) {
+ DBG(KERN_ERR "failed to get dma channel\n");
+ return ret;
+ }
}
/* channel needs configuring for mem=>device, increment memory addr,