提交 646ab160 编写于 作者: H Harald Welte 提交者: Jaroslav Kysela

[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: NHarald Welte <laforge@openmoko.org>
Signed-off-by: NArnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NJaroslav Kysela <perex@suse.cz>
上级 fca7f388
...@@ -158,18 +158,22 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -158,18 +158,22 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream,
if (!dma) if (!dma)
return 0; return 0;
/* prepare DMA */ /* this may get called several times by oss emulation
prtd->params = dma; * with different params -HW */
if (prtd->params == NULL) {
/* prepare DMA */
prtd->params = dma;
DBG("params %p, client %p, channel %d\n", prtd->params, DBG("params %p, client %p, channel %d\n", prtd->params,
prtd->params->client, prtd->params->channel); prtd->params->client, prtd->params->channel);
ret = s3c2410_dma_request(prtd->params->channel, ret = s3c2410_dma_request(prtd->params->channel,
prtd->params->client, NULL); prtd->params->client, NULL);
if (ret) { if (ret) {
DBG(KERN_ERR "failed to get dma channel\n"); DBG(KERN_ERR "failed to get dma channel\n");
return ret; return ret;
}
} }
/* channel needs configuring for mem=>device, increment memory addr, /* channel needs configuring for mem=>device, increment memory addr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册