diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2016-04-06 06:21:53 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-04-06 13:15:21 -0400 |
commit | 9771b18a0b374b6e6ecfa84c8b59d5ef79e969b1 (patch) | |
tree | fee2a0aabafd6150b6e8b62e20a968ac9b3ffd66 | |
parent | c13202f7d7101a6f5542f3a31b9a6787ae7b746c (diff) |
ASoC: wm_adsp: Factor out fetching of stream errors from the DSP
Factor out the reading of the DSP error flag into its own function to
support further improvements to the code.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/wm_adsp.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 953c4278b75e..f70c60914042 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -2816,6 +2816,23 @@ static int wm_adsp_buffer_update_avail(struct wm_adsp_compr_buf *buf) | |||
2816 | return 0; | 2816 | return 0; |
2817 | } | 2817 | } |
2818 | 2818 | ||
2819 | static int wm_adsp_buffer_get_error(struct wm_adsp_compr_buf *buf) | ||
2820 | { | ||
2821 | int ret; | ||
2822 | |||
2823 | ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(error), &buf->error); | ||
2824 | if (ret < 0) { | ||
2825 | adsp_err(buf->dsp, "Failed to check buffer error: %d\n", ret); | ||
2826 | return ret; | ||
2827 | } | ||
2828 | if (buf->error != 0) { | ||
2829 | adsp_err(buf->dsp, "Buffer error occurred: %d\n", buf->error); | ||
2830 | return -EIO; | ||
2831 | } | ||
2832 | |||
2833 | return 0; | ||
2834 | } | ||
2835 | |||
2819 | int wm_adsp_compr_handle_irq(struct wm_adsp *dsp) | 2836 | int wm_adsp_compr_handle_irq(struct wm_adsp *dsp) |
2820 | { | 2837 | { |
2821 | struct wm_adsp_compr_buf *buf; | 2838 | struct wm_adsp_compr_buf *buf; |
@@ -2834,16 +2851,9 @@ int wm_adsp_compr_handle_irq(struct wm_adsp *dsp) | |||
2834 | 2851 | ||
2835 | adsp_dbg(dsp, "Handling buffer IRQ\n"); | 2852 | adsp_dbg(dsp, "Handling buffer IRQ\n"); |
2836 | 2853 | ||
2837 | ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(error), &buf->error); | 2854 | ret = wm_adsp_buffer_get_error(buf); |
2838 | if (ret < 0) { | 2855 | if (ret < 0) |
2839 | adsp_err(dsp, "Failed to check buffer error: %d\n", ret); | ||
2840 | goto out; | ||
2841 | } | ||
2842 | if (buf->error != 0) { | ||
2843 | adsp_err(dsp, "Buffer error occurred: %d\n", buf->error); | ||
2844 | ret = -EIO; | ||
2845 | goto out; | 2856 | goto out; |
2846 | } | ||
2847 | 2857 | ||
2848 | ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(irq_count), | 2858 | ret = wm_adsp_buffer_read(buf, HOST_BUFFER_FIELD(irq_count), |
2849 | &buf->irq_count); | 2859 | &buf->irq_count); |