ALSA: asihpi: Handle playback drained status better
Use the card drained status reporting for playback, but allow it to persist for a few timer cycles before signalling XRUN, to allow card to recover by itself. Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
a6477134db
commit
0b7ce9e2bd
@ -165,6 +165,7 @@ struct snd_card_asihpi_pcm {
|
|||||||
unsigned int pcm_buf_host_rw_ofs; /* Host R/W pos */
|
unsigned int pcm_buf_host_rw_ofs; /* Host R/W pos */
|
||||||
unsigned int pcm_buf_dma_ofs; /* DMA R/W offset in buffer */
|
unsigned int pcm_buf_dma_ofs; /* DMA R/W offset in buffer */
|
||||||
unsigned int pcm_buf_elapsed_dma_ofs; /* DMA R/W offset in buffer */
|
unsigned int pcm_buf_elapsed_dma_ofs; /* DMA R/W offset in buffer */
|
||||||
|
unsigned int drained_count;
|
||||||
struct snd_pcm_substream *substream;
|
struct snd_pcm_substream *substream;
|
||||||
u32 h_stream;
|
u32 h_stream;
|
||||||
struct hpi_format format;
|
struct hpi_format format;
|
||||||
@ -592,6 +593,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
|
|||||||
if (substream->stream != s->stream)
|
if (substream->stream != s->stream)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
ds->drained_count = 0;
|
||||||
if ((s->stream == SNDRV_PCM_STREAM_PLAYBACK) &&
|
if ((s->stream == SNDRV_PCM_STREAM_PLAYBACK) &&
|
||||||
(card->support_mmap)) {
|
(card->support_mmap)) {
|
||||||
/* How do I know how much valid data is present
|
/* How do I know how much valid data is present
|
||||||
@ -771,12 +773,18 @@ static void snd_card_asihpi_timer_function(unsigned long data)
|
|||||||
(on_card_bytes < ds->pcm_buf_host_rw_ofs)) {
|
(on_card_bytes < ds->pcm_buf_host_rw_ofs)) {
|
||||||
hpi_handle_error(hpi_stream_start(ds->h_stream));
|
hpi_handle_error(hpi_stream_start(ds->h_stream));
|
||||||
snd_printdd("P%d start\n", s->number);
|
snd_printdd("P%d start\n", s->number);
|
||||||
|
ds->drained_count = 0;
|
||||||
}
|
}
|
||||||
} else if (state == HPI_STATE_DRAINED) {
|
} else if (state == HPI_STATE_DRAINED) {
|
||||||
snd_printd(KERN_WARNING "P%d drained\n",
|
snd_printd(KERN_WARNING "P%d drained\n",
|
||||||
s->number);
|
s->number);
|
||||||
/*snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN);
|
ds->drained_count++;
|
||||||
continue; */
|
if (ds->drained_count > 2) {
|
||||||
|
snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ds->drained_count = 0;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
pcm_buf_dma_ofs = bytes_avail + ds->pcm_buf_host_rw_ofs;
|
pcm_buf_dma_ofs = bytes_avail + ds->pcm_buf_host_rw_ofs;
|
||||||
|
Loading…
Reference in New Issue
Block a user