audio:sst:error handling during stream alloc
authorRamesh Babu K V <ramesh.babu@intel.com>
Wed, 11 Apr 2012 16:56:18 +0000 (22:26 +0530)
committerbuildbot <buildbot@intel.com>
Tue, 8 May 2012 14:07:33 +0000 (07:07 -0700)
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 <ramesh.babu@intel.com>
Reviewed-on: http://android.intel.com:8080/43749
Reviewed-by: Abdullah, Omair M <omair.m.abdullah@intel.com>
Reviewed-by: Agarwal, Vaibhav <vaibhav.agarwal@intel.com>
Reviewed-by: Koul, Vinod <vinod.koul@intel.com>
Reviewed-by: Gupta, ArvindX K <arvindx.k.gupta@intel.com>
Reviewed-by: Hibare, PramodX <pramodx.hibare@intel.com>
Tested-by: Hibare, PramodX <pramodx.hibare@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
sound/soc/mid-x86/sst/intel_sst_drv_interface.c

index ca07088..2123c4a 100644 (file)
@@ -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*/