Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142689
b: refs/heads/master
c: a4d11fe
h: refs/heads/master
i:
  142687: 39a6643
v: v3
  • Loading branch information
Timur Tabi authored and Mark Brown committed Apr 2, 2009
1 parent b9e071b commit 4d959d0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7377226c344a7295a7573dce400ce9ddd42f0ca4
refs/heads/master: a4d11fe50c238a7da5225d1399314c3505cbd792
17 changes: 17 additions & 0 deletions trunk/sound/soc/fsl/fsl_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,23 @@ static snd_pcm_uframes_t fsl_dma_pointer(struct snd_pcm_substream *substream)
else
position = in_be32(&dma_channel->dar);

/*
* When capture is started, the SSI immediately starts to fill its FIFO.
* This means that the DMA controller is not started until the FIFO is
* full. However, ALSA calls this function before that happens, when
* MR.DAR is still zero. In this case, just return zero to indicate
* that nothing has been received yet.
*/
if (!position)
return 0;

if ((position < dma_private->dma_buf_phys) ||
(position > dma_private->dma_buf_end)) {
dev_err(substream->pcm->card->dev,
"dma pointer is out of range, halting stream\n");
return SNDRV_PCM_POS_XRUN;
}

frames = bytes_to_frames(runtime, position - dma_private->dma_buf_phys);

/*
Expand Down
20 changes: 2 additions & 18 deletions trunk/sound/soc/fsl/fsl_ssi.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,28 +466,12 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
setbits32(&ssi->scr,
CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_TE);
} else {
long timeout = jiffies + 10;

else
setbits32(&ssi->scr,
CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_RE);

/* Wait until the SSI has filled its FIFO. Without this
* delay, ALSA complains about overruns. When the FIFO
* is full, the DMA controller initiates its first
* transfer. Until then, however, the DMA's DAR
* register is zero, which translates to an
* out-of-bounds pointer. This makes ALSA think an
* overrun has occurred.
*/
while (!(in_be32(&ssi->sisr) & CCSR_SSI_SISR_RFF0) &&
(jiffies < timeout));
if (!(in_be32(&ssi->sisr) & CCSR_SSI_SISR_RFF0))
return -EIO;
}
break;

case SNDRV_PCM_TRIGGER_STOP:
Expand Down

0 comments on commit 4d959d0

Please sign in to comment.