Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 646ab160 authored by Harald Welte's avatar Harald Welte Committed by Jaroslav Kysela
Browse files

[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: default avatarHarald Welte <laforge@openmoko.org>
Signed-off-by: default avatarArnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent fca7f388
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -158,6 +158,9 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream,
	if (!dma)
		return 0;

	/* this may get called several times by oss emulation
	 * with different params -HW */
	if (prtd->params == NULL) {
		/* prepare DMA */
		prtd->params = dma;

@@ -171,6 +174,7 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream,
			DBG(KERN_ERR "failed to get dma channel\n");
			return ret;
		}
	}

	/* channel needs configuring for mem=>device, increment memory addr,
	 * sync to pclk, half-word transfers to the IIS-FIFO. */