diff options
author | Harald Welte <laforge@openmoko.org> | 2007-07-24 06:49:39 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:57:57 -0400 |
commit | 646ab160ff5e672838209dbd679d50af63fbd366 (patch) | |
tree | b2661fdcd378aa090f6135ef0e2507da8110998e /sound/soc | |
parent | fca7f38892fa713d5221e26fd3ee57817b4bc031 (diff) |
[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/soc')
-rw-r--r-- | sound/soc/s3c24xx/s3c24xx-pcm.c | 22 |
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, | |||
158 | if (!dma) | 158 | if (!dma) |
159 | return 0; | 159 | return 0; |
160 | 160 | ||
161 | /* prepare DMA */ | 161 | /* this may get called several times by oss emulation |
162 | prtd->params = dma; | 162 | * with different params -HW */ |
163 | if (prtd->params == NULL) { | ||
164 | /* prepare DMA */ | ||
165 | prtd->params = dma; | ||
163 | 166 | ||
164 | DBG("params %p, client %p, channel %d\n", prtd->params, | 167 | DBG("params %p, client %p, channel %d\n", prtd->params, |
165 | prtd->params->client, prtd->params->channel); | 168 | prtd->params->client, prtd->params->channel); |
166 | 169 | ||
167 | ret = s3c2410_dma_request(prtd->params->channel, | 170 | ret = s3c2410_dma_request(prtd->params->channel, |
168 | prtd->params->client, NULL); | 171 | prtd->params->client, NULL); |
169 | 172 | ||
170 | if (ret) { | 173 | if (ret) { |
171 | DBG(KERN_ERR "failed to get dma channel\n"); | 174 | DBG(KERN_ERR "failed to get dma channel\n"); |
172 | return ret; | 175 | return ret; |
176 | } | ||
173 | } | 177 | } |
174 | 178 | ||
175 | /* channel needs configuring for mem=>device, increment memory addr, | 179 | /* channel needs configuring for mem=>device, increment memory addr, |