Commit f938f348 authored by Stuart Henderson's avatar Stuart Henderson Committed by Mark Brown

ASoC: wm_adsp: Update cached error state on trigger

If a compressed stream is restarted after getting an error, the cached
error value will still be used on the next pointer request, preventing
the stream from starting.  Resolve this by ensuring the error status is
updated on trigger start.
Signed-off-by: default avatarStuart Henderson <stuarth@opensource.cirrus.com>
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 05bd7fcd
...@@ -3422,6 +3422,23 @@ static int wm_adsp_buffer_free(struct wm_adsp *dsp) ...@@ -3422,6 +3422,23 @@ static int wm_adsp_buffer_free(struct wm_adsp *dsp)
return 0; return 0;
} }
static int wm_adsp_buffer_get_error(struct wm_adsp_compr_buf *buf)
{
int ret;
ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(error), &buf->error);
if (ret < 0) {
adsp_err(buf->dsp, "Failed to check buffer error: %d\n", ret);
return ret;
}
if (buf->error != 0) {
adsp_err(buf->dsp, "Buffer error occurred: %d\n", buf->error);
return -EIO;
}
return 0;
}
int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd) int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd)
{ {
struct wm_adsp_compr *compr = stream->runtime->private_data; struct wm_adsp_compr *compr = stream->runtime->private_data;
...@@ -3443,6 +3460,10 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd) ...@@ -3443,6 +3460,10 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd)
} }
} }
ret = wm_adsp_buffer_get_error(compr->buf);
if (ret < 0)
break;
wm_adsp_buffer_clear(compr->buf); wm_adsp_buffer_clear(compr->buf);
/* Trigger the IRQ at one fragment of data */ /* Trigger the IRQ at one fragment of data */
...@@ -3518,23 +3539,6 @@ static int wm_adsp_buffer_update_avail(struct wm_adsp_compr_buf *buf) ...@@ -3518,23 +3539,6 @@ static int wm_adsp_buffer_update_avail(struct wm_adsp_compr_buf *buf)
return 0; return 0;
} }
static int wm_adsp_buffer_get_error(struct wm_adsp_compr_buf *buf)
{
int ret;
ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(error), &buf->error);
if (ret < 0) {
adsp_err(buf->dsp, "Failed to check buffer error: %d\n", ret);
return ret;
}
if (buf->error != 0) {
adsp_err(buf->dsp, "Buffer error occurred: %d\n", buf->error);
return -EIO;
}
return 0;
}
int wm_adsp_compr_handle_irq(struct wm_adsp *dsp) int wm_adsp_compr_handle_irq(struct wm_adsp *dsp)
{ {
struct wm_adsp_compr_buf *buf; struct wm_adsp_compr_buf *buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment