diff mbox

[4/4] ASoC: wm_adsp: Improve DSP error handling

Message ID 1457606694-10985-4-git-send-email-ckeepax@opensource.wolfsonmicro.com (mailing list archive)
State New, archived
Headers show

Commit Message

Charles Keepax March 10, 2016, 10:44 a.m. UTC
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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Charles Keepax March 10, 2016, 4:41 p.m. UTC | #1
On Thu, Mar 10, 2016 at 10:44:54AM +0000, Charles Keepax wrote:
> 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>
> ---

Apologies please drop this last change I need to do a respin.
This will ping the poll for spurious interrupts which is not very
desirable. I will fix that and send a rev 2 but the rest of the
chain is good to merge as is.

Thanks,
Charles
diff mbox

Patch

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index f28c244..3ee1c72 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -2861,10 +2861,10 @@  int wm_adsp_compr_handle_irq(struct wm_adsp *dsp)
 		goto out;
 	}
 
+out:
 	if (compr && compr->stream)
 		snd_compr_fragment_elapsed(compr->stream);
 
-out:
 	mutex_unlock(&dsp->pwr_lock);
 
 	return ret;
@@ -2926,6 +2926,10 @@  int wm_adsp_compr_pointer(struct snd_compr_stream *stream,
 					 ret);
 				goto out;
 			}
+
+			ret = wm_adsp_buffer_check_error(buf);
+			if (ret < 0)
+				goto out;
 		}
 	}