public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RFC] ASoC: OMAP: fix OMAP1510 broken PCM pointer callback
@ 2009-06-27 22:21 Janusz Krzysztofik
  2009-06-28 19:37 ` Jarkko Nikula
  2009-06-30  9:39 ` Mark Brown
  0 siblings, 2 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2009-06-27 22:21 UTC (permalink / raw)
  To: Jarkko Nikula, Peter Ujfalusi, Tony Lindgren
  Cc: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
	linux-kernel

This patch tries to work around the problem of broken OMAP1510 PCM playback 
pointer calculation by replacing DMA function call that incorrectly tries to 
read the value form DMA hardware with a value computed locally from an 
already maintained variable omap_runtime_data.period_index.

Tested on OMAP5910 based Amstrad Delta (E3) using work in progress ASoC 
driver.

Based on linux-2.6-asoc.git v2.6.31-rc1.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
It seems that on OMAP1510, DMA Channel Progress Counter registers 
(DMA_CPC_CH[0-8]) always contain values derived from DMA channels destination 
port address, even if constant, and there are no DMA registers available that 
would follow DMA channels source port address. Because of this limitation, 
current implementation of omap_get_dma_src_pos() for OMAP1510 is broken and 
doesn't seem to be easy correctable.

--- linux-2.6.31-rc1/sound/soc/omap/omap-pcm.c.orig	2009-06-27 
20:20:16.000000000 +0200
+++ linux-2.6.31-rc1/sound/soc/omap/omap-pcm.c	2009-06-27 23:21:42.000000000 
+0200
@@ -216,12 +216,15 @@ static snd_pcm_uframes_t omap_pcm_pointe
 	dma_addr_t ptr;
 	snd_pcm_uframes_t offset;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		ptr = omap_get_dma_src_pos(prtd->dma_ch);
-	else
+	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
 		ptr = omap_get_dma_dst_pos(prtd->dma_ch);
+		offset = bytes_to_frames(runtime, ptr - runtime->dma_addr);
+	} else if (!(cpu_is_omap1510())) {
+		ptr = omap_get_dma_src_pos(prtd->dma_ch);
+		offset = bytes_to_frames(runtime, ptr - runtime->dma_addr);
+	} else
+		offset = prtd->period_index * runtime->period_size;
 
-	offset = bytes_to_frames(runtime, ptr - runtime->dma_addr);
 	if (offset >= runtime->buffer_size)
 		offset = 0;
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-06-30  9:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-27 22:21 [PATCH] [RFC] ASoC: OMAP: fix OMAP1510 broken PCM pointer callback Janusz Krzysztofik
2009-06-28 19:37 ` Jarkko Nikula
2009-06-28 22:08   ` Janusz Krzysztofik
2009-06-29  6:04     ` Jarkko Nikula
2009-06-29  6:37     ` Peter Ujfalusi
2009-06-29  7:15       ` Jarkko Nikula
2009-06-29 13:51       ` Janusz Krzysztofik
2009-06-30  5:20         ` [alsa-devel] " Peter Ujfalusi
2009-06-30  9:39 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox