From: linux@audioscience.com
To: patch@alsa-project.org
Cc: tiwai@suse.de,
Eliot Blennerhassett <eblennerhassett@audioscience.com>,
alsa-devel@alsa-project.org
Subject: [[PATCH] snd-asihpi: 3/8] Handle playback drained status better.
Date: Tue, 05 Apr 2011 20:55:43 +1200 [thread overview]
Message-ID: <1301993748-21113-3-git-send-email-linux@audioscience.com> (raw)
In-Reply-To: <1301993748-21113-1-git-send-email-linux@audioscience.com>
From: Eliot Blennerhassett <eblennerhassett@audioscience.com>
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>
---
pci/asihpi/asihpi.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/pci/asihpi/asihpi.c b/pci/asihpi/asihpi.c
index 434342f..a5226e3 100644
--- a/pci/asihpi/asihpi.c
+++ b/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;
--
1.7.0.4
next prev parent reply other threads:[~2011-04-05 8:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 8:55 [[PATCH] snd-asihpi: 1/8] Control naming linux
2011-04-05 8:55 ` [[PATCH] snd-asihpi: 2/8] Debug printing linux
2011-04-05 8:55 ` linux [this message]
2011-04-05 8:55 ` [[PATCH] snd-asihpi: 4/8] MMAP for non-busmaster cards linux
2011-04-05 8:55 ` [[PATCH] snd-asihpi: 5/8] Remove 2 unused functions linux
2011-04-05 8:55 ` [[PATCH] snd-asihpi: 6/8] Standardise substream name generation linux
2011-04-05 8:55 ` [[PATCH] snd-asihpi: 7/8] Simplify driver unload cleanup linux
2011-04-05 8:55 ` [[PATCH] snd-asihpi: 8/8] Minor cleanups linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1301993748-21113-3-git-send-email-linux@audioscience.com \
--to=linux@audioscience.com \
--cc=alsa-devel@alsa-project.org \
--cc=eblennerhassett@audioscience.com \
--cc=patch@alsa-project.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).