s3c24xx-pcm: fix hw_params dma handling
PATCH 1/1 s3c24xx-pcm: fix hw_params dma handling
Hi,
While testing the recently merged driver for the neo1973, I found out that it was not working due to dma allocation failure. The problem is that there's only one dma channel available on s3c2410 and there may be more than one call to pcm_ops->hw_params(), resulting in dma request failures. This patch from Harald Welte fix this.
Arnaud
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.
sound/soc/s3c24xx/s3c24xx-pcm.c +16 -12
@@ -155,18 +155,22 @@if (!dma)return 0 ; -/* prepare DMA */ - prtd->params = dma; - -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 ); - -if (ret) { -DBG (KERN_ERR "failed to get dma channel\n" ); -return ret; +/* 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); + + ret =s3c2410_dma_request (prtd->params->channel, + prtd->params->client,NULL ); + +if (ret) { +DBG (KERN_ERR "failed to get dma channel\n" ); +return ret; + } }/* channel needs configuring for mem=>device, increment memory addr,
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 6 lines · Arnaud Patard
While testing the recently merged driver for the neo1973, I found out that it was not working due to dma allocation failure. The problem is that there's only one dma channel available on s3c2410 and there may be more than one call to
pcm_ops->hw_params(), resulting in dma request failures. This patch from Harald Welte fix this.
Thanks for picking up that one, Arnaud! I didn't submit this myself since it was just a 'quick fix' and I don't understand enough about ALSA to be sure that this really is the proper fix...
Signature · 3 lines
- Harald Welte <[email protected]> http://openmoko.org/ ============================================================================ Software for the world's first truly open Free Software mobile phone
Takashi Iwai
AppliedAt Tue, 24 Jul 2007 10:56:29 +0200,
Quoted 10 lines · Arnaud Patard (Rtp)
Hi,
While testing the recently merged driver for the neo1973, I found out that it was not working due to dma allocation failure. The problem is that there's only one dma channel available on s3c2410 and there may be more than one call to
pcm_ops->hw_params(), resulting in dma request failures. This patch from Harald Welte fix this.Arnaud
Thanks, applied to ALSA tree now.
Takashi