diff options
author | Mark Brown <broonie@kernel.org> | 2019-02-26 12:18:11 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-02-26 12:18:11 +0000 |
commit | ae3f563a85e96cc8ba68ba2eae36da9bba6e9c4a (patch) | |
tree | c0d5172578b69d6a29a92c00d276595b31add5e1 /sound/soc/codecs/wm_adsp.c | |
parent | cdcdba5d624fc3fbad224230ca318c6ddf73795a (diff) | |
parent | 8af6c521cc236534093f9e744cfa004314bfe5ae (diff) | |
download | lwn-ae3f563a85e96cc8ba68ba2eae36da9bba6e9c4a.tar.gz lwn-ae3f563a85e96cc8ba68ba2eae36da9bba6e9c4a.zip |
Merge branch 'for-5.0' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.1
Diffstat (limited to 'sound/soc/codecs/wm_adsp.c')
-rw-r--r-- | sound/soc/codecs/wm_adsp.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 8077c18cbcdf..b93fdc8d2d6f 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -3529,6 +3529,23 @@ static int wm_adsp_buffer_free(struct wm_adsp *dsp) 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) { struct wm_adsp_compr *compr = stream->runtime->private_data; @@ -3550,6 +3567,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); /* Trigger the IRQ at one fragment of data */ @@ -3625,23 +3646,6 @@ static int wm_adsp_buffer_update_avail(struct wm_adsp_compr_buf *buf) 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) { - compr_err(buf, "Failed to check buffer error: %d\n", ret); - return ret; - } - if (buf->error != 0) { - compr_err(buf, "Buffer error occurred: %d\n", buf->error); - return -EIO; - } - - return 0; -} - int wm_adsp_compr_handle_irq(struct wm_adsp *dsp) { struct wm_adsp_compr_buf *buf; |