Commit b5442a75 authored by Janusz Krzysztofik's avatar Janusz Krzysztofik Committed by Mark Brown

ASoC: OMAP: Fix capture pointer handling for OMAP1510 to work correctly with recent ALSA PCM code

With recent (2.6.34) chnages in PCM handling, capture stopped working on my
OMAP1510 based Amstrad Delta videophone.

Using 2.6.34-rc2, I was able to correct the problem in 3 different ways:

1. reverting commit 7b3a177b,
2. enabling additional jiffies check with
	echo 4 >/proc/asound/card0/pcm0c0/xrun_debug
3. applying the patch below.

Since I wasn't able to reproduce the problem on my i686 PC, I guess the
problem is probably machine specific.

The patch reuses the method for software emulation of missing hardware
pointer, already implemented for playback on OMAP1510. It's possible that
event if a hardware pointer is available for capture on this machine, its
behaviour may be not compatible with what upper layer expects.

If you think the problem may be more general and should be solved differently,
on a higher level, I can try to work more on it if you give me a hint.

If the patch gets accepted, I suggest it goes as a fix in the current release
cycle.

Created and tested against linux-2.6.34-rc2.
Signed-off-by: default avatarJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Acked-by: default avatarJarkko Nikula <jhnikula@gmail.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent fb48e3c6
...@@ -60,12 +60,11 @@ static void omap_pcm_dma_irq(int ch, u16 stat, void *data) ...@@ -60,12 +60,11 @@ static void omap_pcm_dma_irq(int ch, u16 stat, void *data)
struct omap_runtime_data *prtd = runtime->private_data; struct omap_runtime_data *prtd = runtime->private_data;
unsigned long flags; unsigned long flags;
if ((cpu_is_omap1510()) && if ((cpu_is_omap1510())) {
(substream->stream == SNDRV_PCM_STREAM_PLAYBACK)) {
/* /*
* OMAP1510 doesn't fully support DMA progress counter * OMAP1510 doesn't fully support DMA progress counter
* and there is no software emulation implemented yet, * and there is no software emulation implemented yet,
* so have to maintain our own playback progress counter * so have to maintain our own progress counters
* that can be used by omap_pcm_pointer() instead. * that can be used by omap_pcm_pointer() instead.
*/ */
spin_lock_irqsave(&prtd->lock, flags); spin_lock_irqsave(&prtd->lock, flags);
...@@ -189,8 +188,7 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -189,8 +188,7 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
dma_params.frame_count = runtime->periods; dma_params.frame_count = runtime->periods;
omap_set_dma_params(prtd->dma_ch, &dma_params); omap_set_dma_params(prtd->dma_ch, &dma_params);
if ((cpu_is_omap1510()) && if ((cpu_is_omap1510()))
(substream->stream == SNDRV_PCM_STREAM_PLAYBACK))
omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ | omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ |
OMAP_DMA_LAST_IRQ | OMAP_DMA_BLOCK_IRQ); OMAP_DMA_LAST_IRQ | OMAP_DMA_BLOCK_IRQ);
else else
...@@ -248,14 +246,15 @@ static snd_pcm_uframes_t omap_pcm_pointer(struct snd_pcm_substream *substream) ...@@ -248,14 +246,15 @@ static snd_pcm_uframes_t omap_pcm_pointer(struct snd_pcm_substream *substream)
dma_addr_t ptr; dma_addr_t ptr;
snd_pcm_uframes_t offset; snd_pcm_uframes_t offset;
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { if (cpu_is_omap1510()) {
offset = prtd->period_index * runtime->period_size;
} else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
ptr = omap_get_dma_dst_pos(prtd->dma_ch); ptr = omap_get_dma_dst_pos(prtd->dma_ch);
offset = bytes_to_frames(runtime, ptr - runtime->dma_addr); offset = bytes_to_frames(runtime, ptr - runtime->dma_addr);
} else if (!(cpu_is_omap1510())) { } else {
ptr = omap_get_dma_src_pos(prtd->dma_ch); ptr = omap_get_dma_src_pos(prtd->dma_ch);
offset = bytes_to_frames(runtime, ptr - runtime->dma_addr); offset = bytes_to_frames(runtime, ptr - runtime->dma_addr);
} else }
offset = prtd->period_index * runtime->period_size;
if (offset >= runtime->buffer_size) if (offset >= runtime->buffer_size)
offset = 0; offset = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment