@@ -4595,6 +4595,23 @@ static int wm_adsp_buffer_free(struct wm_adsp *dsp)
45954595 return 0 ;
45964596}
45974597
4598+ static int wm_adsp_buffer_get_error (struct wm_adsp_compr_buf * buf )
4599+ {
4600+ int ret ;
4601+
4602+ ret = wm_adsp_buffer_read (buf , HOST_BUFFER_FIELD (error ), & buf -> error );
4603+ if (ret < 0 ) {
4604+ adsp_err (buf -> dsp , "Failed to check buffer error: %d\n" , ret );
4605+ return ret ;
4606+ }
4607+ if (buf -> error != 0 ) {
4608+ adsp_err (buf -> dsp , "Buffer error occurred: %d\n" , buf -> error );
4609+ return - EIO ;
4610+ }
4611+
4612+ return 0 ;
4613+ }
4614+
45984615int wm_adsp_compr_trigger (struct snd_compr_stream * stream , int cmd )
45994616{
46004617 struct wm_adsp_compr * compr = stream -> runtime -> private_data ;
@@ -4616,6 +4633,10 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd)
46164633 }
46174634 }
46184635
4636+ ret = wm_adsp_buffer_get_error (compr -> buf );
4637+ if (ret < 0 )
4638+ break ;
4639+
46194640 wm_adsp_buffer_clear (compr -> buf );
46204641
46214642 /* Trigger the IRQ at one fragment of data */
@@ -4691,23 +4712,6 @@ static int wm_adsp_buffer_update_avail(struct wm_adsp_compr_buf *buf)
46914712 return 0 ;
46924713}
46934714
4694- static int wm_adsp_buffer_get_error (struct wm_adsp_compr_buf * buf )
4695- {
4696- int ret ;
4697-
4698- ret = wm_adsp_buffer_read (buf , HOST_BUFFER_FIELD (error ), & buf -> error );
4699- if (ret < 0 ) {
4700- adsp_err (buf -> dsp , "Failed to check buffer error: %d\n" , ret );
4701- return ret ;
4702- }
4703- if (buf -> error != 0 ) {
4704- adsp_err (buf -> dsp , "Buffer error occurred: %d\n" , buf -> error );
4705- return - EIO ;
4706- }
4707-
4708- return 0 ;
4709- }
4710-
47114715int wm_adsp_compr_handle_irq (struct wm_adsp * dsp )
47124716{
47134717 struct wm_adsp_compr_buf * buf ;
0 commit comments