diff mbox series

[v3] ASoC: Intel: Skylake: Recover BXT FW on DSP boot timeout error

Message ID 20190912112441.28327-1-pawel.harlozinski@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v3] ASoC: Intel: Skylake: Recover BXT FW on DSP boot timeout error | expand

Commit Message

Pawel Harlozinski Sept. 12, 2019, 11:24 a.m. UTC
When DSP boots with timeout error try to reload firmware
to keep best user expeirience.

Change-Id: Ic7377da687e7441a487c443f9de1ebae5967afa2
Signed-off-by: Szymon Mielczarek <szymonx.mielczarek@intel.com>
Signed-off-by: Pawel Harlozinski <pawel.harlozinski@linux.intel.com>
---
 sound/soc/intel/skylake/bxt-sst.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Pierre-Louis Bossart Sept. 12, 2019, 1:23 p.m. UTC | #1
On 9/12/19 6:24 AM, Pawel Harlozinski wrote:
> When DSP boots with timeout error try to reload firmware
> to keep best user expeirience.

experience

> 
> Change-Id: Ic7377da687e7441a487c443f9de1ebae5967afa2

please remove this Change-Id.

> Signed-off-by: Szymon Mielczarek <szymonx.mielczarek@intel.com>
> Signed-off-by: Pawel Harlozinski <pawel.harlozinski@linux.intel.com>
> ---
>   sound/soc/intel/skylake/bxt-sst.c | 16 ++++++++++------
>   1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
> index 92a82e6b5fe6..fdf4c198445e 100644
> --- a/sound/soc/intel/skylake/bxt-sst.c
> +++ b/sound/soc/intel/skylake/bxt-sst.c
> @@ -446,14 +446,19 @@ static int bxt_set_dsp_D0(struct sst_dsp *ctx, unsigned int core_id)
>   
>   	/* If core 1 was turned on for booting core 0, turn it off */
>   		skl_dsp_core_power_down(ctx, SKL_DSP_CORE_MASK(1));
> +		/* FIXME this FW recovery applies only for BXT */
>   		if (ret == 0) {
> -			dev_err(ctx->dev, "%s: DSP boot timeout\n", __func__);
> -			dev_err(ctx->dev, "Error code=0x%x: FW status=0x%x\n",
> +			dev_warn(ctx->dev,
> +				"DSP boot timeout: Error code=0x%x: FW status=0x%x. Reloading FW\n",
>   				sst_dsp_shim_read(ctx, BXT_ADSP_ERROR_CODE),
>   				sst_dsp_shim_read(ctx, BXT_ADSP_FW_STATUS));
> -			dev_err(ctx->dev, "Failed to set core0 to D0 state\n");
> -			ret = -EIO;
> -			goto err;
> +
> +			ret = bxt_sst_init_fw(skl->dev, skl);

Can you provide more explanations on the flow, if I look at the code I 
only see that this will load the firmware and library, which looks like 
the re-doing the start of this function set_dsp_D0, it doesn't seem to 
retry a boot so not sure in what state the DSP lands and if all the 
control variables such as boot_complete are set.

> +			if (ret < 0) {
> +				dev_err(ctx->dev, "Reload fw failed: %d. Failed to set core0 to D0 state\n",
> +				ret);
> +				goto err;

is there a reason why you removed the ret = -EIO assignment?

> +			}
>   		}
>   	}
>   
> @@ -478,7 +483,6 @@ static int bxt_set_dsp_D0(struct sst_dsp *ctx, unsigned int core_id)
>   	if (core_id == SKL_DSP_CORE0_ID)
>   		core_mask |= SKL_DSP_CORE_MASK(1);
>   	skl_dsp_disable_core(ctx, core_mask);
> -
>   	return ret;
>   }
>   
>
diff mbox series

Patch

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 92a82e6b5fe6..fdf4c198445e 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -446,14 +446,19 @@  static int bxt_set_dsp_D0(struct sst_dsp *ctx, unsigned int core_id)
 
 	/* If core 1 was turned on for booting core 0, turn it off */
 		skl_dsp_core_power_down(ctx, SKL_DSP_CORE_MASK(1));
+		/* FIXME this FW recovery applies only for BXT */
 		if (ret == 0) {
-			dev_err(ctx->dev, "%s: DSP boot timeout\n", __func__);
-			dev_err(ctx->dev, "Error code=0x%x: FW status=0x%x\n",
+			dev_warn(ctx->dev,
+				"DSP boot timeout: Error code=0x%x: FW status=0x%x. Reloading FW\n",
 				sst_dsp_shim_read(ctx, BXT_ADSP_ERROR_CODE),
 				sst_dsp_shim_read(ctx, BXT_ADSP_FW_STATUS));
-			dev_err(ctx->dev, "Failed to set core0 to D0 state\n");
-			ret = -EIO;
-			goto err;
+
+			ret = bxt_sst_init_fw(skl->dev, skl);
+			if (ret < 0) {
+				dev_err(ctx->dev, "Reload fw failed: %d. Failed to set core0 to D0 state\n",
+				ret);
+				goto err;
+			}
 		}
 	}
 
@@ -478,7 +483,6 @@  static int bxt_set_dsp_D0(struct sst_dsp *ctx, unsigned int core_id)
 	if (core_id == SKL_DSP_CORE0_ID)
 		core_mask |= SKL_DSP_CORE_MASK(1);
 	skl_dsp_disable_core(ctx, core_mask);
-
 	return ret;
 }