[PATCH] s3c24xx-pcm: fix hw_params dma handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Harald Welte <laforge@xxxxxxxxxxxx>
Signed-off-by: Arnaud Patard <arnaud.patard@xxxxxxxxxxx>

Index: linux-2.6.20/sound/soc/s3c24xx/s3c24xx-pcm.c
===================================================================
--- linux-2.6.20.orig/sound/soc/s3c24xx/s3c24xx-pcm.c	2007-02-15 21:50:25.000000000 +0100
+++ linux-2.6.20/sound/soc/s3c24xx/s3c24xx-pcm.c	2007-02-15 22:25:10.000000000 +0100
@@ -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
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux