From 71f43044795c57db9c6b717199cf9a16229ae4a5 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Tue, 5 Apr 2011 20:55:43 +1200 Subject: [PATCH] --- yaml --- r: 248151 b: refs/heads/master c: 0b7ce9e2bd2d9dbc8f4797b0cd5e0d138cb529e1 h: refs/heads/master i: 248149: 9017b330b9532fa6d29f02c25d7dfecdafe7516b 248147: 45acbb31978faa6af50862e745e49fce6e4f4da3 248143: d78701938a9753b779959470b625d08284f6e74a v: v3 --- [refs] | 2 +- trunk/sound/pci/asihpi/asihpi.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index e1d6e736db00..a06fd6285ad1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a6477134db119a22aa30911ff18e440b8db9df65 +refs/heads/master: 0b7ce9e2bd2d9dbc8f4797b0cd5e0d138cb529e1 diff --git a/trunk/sound/pci/asihpi/asihpi.c b/trunk/sound/pci/asihpi/asihpi.c index 434342f874ff..a5226e3af3d7 100644 --- a/trunk/sound/pci/asihpi/asihpi.c +++ b/trunk/sound/pci/asihpi/asihpi.c @@ -165,6 +165,7 @@ struct snd_card_asihpi_pcm { 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_elapsed_dma_ofs; /* DMA R/W offset in buffer */ + unsigned int drained_count; struct snd_pcm_substream *substream; u32 h_stream; struct hpi_format format; @@ -592,6 +593,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, if (substream->stream != s->stream) continue; + ds->drained_count = 0; if ((s->stream == SNDRV_PCM_STREAM_PLAYBACK) && (card->support_mmap)) { /* 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)) { hpi_handle_error(hpi_stream_start(ds->h_stream)); snd_printdd("P%d start\n", s->number); + ds->drained_count = 0; } } else if (state == HPI_STATE_DRAINED) { snd_printd(KERN_WARNING "P%d drained\n", s->number); - /*snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN); - continue; */ + ds->drained_count++; + if (ds->drained_count > 2) { + snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN); + continue; + } + } else { + ds->drained_count = 0; } } else pcm_buf_dma_ofs = bytes_avail + ds->pcm_buf_host_rw_ofs;