From 26fc52ba3fe91126cb0ff8dac9246ee9db7756f5 Mon Sep 17 00:00:00 2001 From: Ramesh Babu K V Date: Wed, 11 Apr 2012 22:26:18 +0530 Subject: [PATCH] audio:sst:error handling during stream alloc BZ: 32085 In rarest cases, the previous stream free may not freed by firmware. In such error conditions, firmware will not be able to do stream alloc and returns stream in use error. This causes no audio activity in a device until reboot. If stream alloc fails due to stream in use error, free it immediately and return the error to application. Application would retry again and will succeed in audio playback or capture. Change-Id: Ie28cb45ddf43cbda415037dbeb6d924be7fdae9f Signed-off-by: Ramesh Babu K V Reviewed-on: http://android.intel.com:8080/43749 Reviewed-by: Abdullah, Omair M Reviewed-by: Agarwal, Vaibhav Reviewed-by: Koul, Vinod Reviewed-by: Gupta, ArvindX K Reviewed-by: Hibare, PramodX Tested-by: Hibare, PramodX Reviewed-by: buildbot Tested-by: buildbot --- sound/soc/mid-x86/sst/intel_sst_drv_interface.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/soc/mid-x86/sst/intel_sst_drv_interface.c b/sound/soc/mid-x86/sst/intel_sst_drv_interface.c index ca07088..2123c4a 100644 --- a/sound/soc/mid-x86/sst/intel_sst_drv_interface.c +++ b/sound/soc/mid-x86/sst/intel_sst_drv_interface.c @@ -220,8 +220,13 @@ int sst_get_stream_allocated(struct sst_stream_params *str_param, /* Block the call for reply */ retval = sst_wait_timeout(sst_drv_ctx, &str_info->ctrl_blk); if ((retval != 0) || (str_info->ctrl_blk.ret_code != 0)) { - pr_err("sst: FW alloc failed retval %d, ret_code %d\n", + pr_err("sst: FW alloc failed retval %d, ret_code %d\n",\ retval, str_info->ctrl_blk.ret_code); + if (retval == SST_ERR_STREAM_IN_USE) { + pr_err("sst:FW not in clean state, send free for:%d\n", + str_param->device_type); + sst_free_stream(str_param->device_type); + } str_id = -str_info->ctrl_blk.ret_code; /*return error*/ if (str_id == 0) str_id = retval; /*FW timed out*/ -- 2.7.4