alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: vinod.koul@intel.com, tiwai@suse.com, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
	lgirdwood@gmail.com
Subject: [PATCH v2 5/6] ASoC: wm_adsp: Improve DSP error handling
Date: Wed, 6 Apr 2016 11:21:54 +0100	[thread overview]
Message-ID: <1459938115-25456-6-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1459938115-25456-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>

If we encounter an error on the DSP side whilst user-space is
waiting on the poll we should call snd_compr_fragment_elapsed,
although data is not actually available we want to wake
user-space such that the error can be propagated out
quickly. Additionally some versions of the DSP firmware are
not super consistent about actually generating an IRQ if they
encounter an error, as such we will check the DSP error status
every time we run out of available data as well, to ensure we
catch it.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/wm_adsp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index f70c609..3ac2e1f 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -2853,7 +2853,7 @@ int wm_adsp_compr_handle_irq(struct wm_adsp *dsp)
 
 	ret = wm_adsp_buffer_get_error(buf);
 	if (ret < 0)
-		goto out;
+		goto out_notify; /* Wake poll to report error */
 
 	ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(irq_count),
 				  &buf->irq_count);
@@ -2868,6 +2868,7 @@ int wm_adsp_compr_handle_irq(struct wm_adsp *dsp)
 		goto out;
 	}
 
+out_notify:
 	if (compr && compr->stream)
 		snd_compr_fragment_elapsed(compr->stream);
 
@@ -2928,6 +2929,10 @@ int wm_adsp_compr_pointer(struct snd_compr_stream *stream,
 		 * DSP to inform us once a whole fragment is available.
 		 */
 		if (buf->avail < wm_adsp_compr_frag_words(compr)) {
+			ret = wm_adsp_buffer_get_error(buf);
+			if (ret < 0)
+				goto out;
+
 			ret = wm_adsp_buffer_reenable_irq(buf);
 			if (ret < 0) {
 				adsp_err(dsp,
-- 
2.1.4

  parent reply	other threads:[~2016-04-06 10:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06 10:21 [PATCH v2 0/6] Propagate errors out from compressed streams Charles Keepax
2016-04-06 10:21 ` [PATCH v2 1/6] ASoC: compress: Pass error out of soc_compr_pointer Charles Keepax
2016-04-06 10:21 ` [PATCH v2 2/6] ALSA: compress: Add function to indicate the stream has gone bad Charles Keepax
2016-04-07  0:40   ` Koul, Vinod
2016-04-07  8:28     ` Charles Keepax
2016-04-07 23:07       ` Koul, Vinod
2016-04-08  4:49         ` Takashi Iwai
2016-04-08 10:58         ` Charles Keepax
2016-04-06 10:21 ` [PATCH v2 3/6] ALSA: compress: Replace complex if statement with switch Charles Keepax
2016-04-06 10:21 ` [PATCH v2 4/6] ASoC: wm_adsp: Factor out fetching of stream errors from the DSP Charles Keepax
2016-04-06 17:19   ` Applied "ASoC: wm_adsp: Factor out fetching of stream errors from the DSP" to the asoc tree Mark Brown
2016-04-06 10:21 ` Charles Keepax [this message]
2016-04-06 17:19   ` Applied "ASoC: wm_adsp: Improve DSP error handling" " Mark Brown
2016-04-06 10:21 ` [PATCH v2 6/6] ASoC: wm_adsp: Use new snd_compr_stop_xrun to signal stream failure Charles Keepax

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=1459938115-25456-6-git-send-email-ckeepax@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=tiwai@suse.com \
    --cc=vinod.koul@intel.com \
    /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).