alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org
Cc: pierre-louis.bossart@linux.intel.com,
	Cezary Rojewski <cezary.rojewski@intel.com>,
	lgirdwood@gmail.com, tiwai@suse.com, vkoul@kernel.org,
	broonie@kernel.org
Subject: [PATCH 6/7] ASoC: Intel: Allow for ROM init retry on CNL platforms
Date: Thu,  5 Mar 2020 15:53:13 +0100	[thread overview]
Message-ID: <20200305145314.32579-7-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20200305145314.32579-1-cezary.rojewski@intel.com>

Due to unconditional initial timeouts, firmware may fail to load during
its initialization. This issue cannot be resolved on driver side as it
is caused by external sources such as CSME but has to be accounted for
nonetheless.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Fixes: cb6a55284629 ("ASoC: Intel: cnl: Add sst library functions for cnl platform")
---
 sound/soc/intel/skylake/bxt-sst.c     |  2 --
 sound/soc/intel/skylake/cnl-sst.c     | 15 ++++++++++-----
 sound/soc/intel/skylake/skl-sst-dsp.h |  1 +
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 92a82e6b5fe6..cdafade8abd6 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -38,8 +38,6 @@
 /* Delay before scheduling D0i3 entry */
 #define BXT_D0I3_DELAY 5000
 
-#define BXT_FW_ROM_INIT_RETRY 3
-
 static unsigned int bxt_get_errorcode(struct sst_dsp *ctx)
 {
 	 return sst_dsp_shim_read(ctx, BXT_ADSP_ERROR_CODE);
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 4f64f097e9ae..060e47ae3391 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -109,7 +109,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
 {
 	struct firmware stripped_fw;
 	struct skl_dev *cnl = ctx->thread_context;
-	int ret;
+	int ret, i;
 
 	if (!ctx->fw) {
 		ret = request_firmware(&ctx->fw, ctx->fw_name, ctx->dev);
@@ -131,12 +131,16 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
 	stripped_fw.size = ctx->fw->size;
 	skl_dsp_strip_extended_manifest(&stripped_fw);
 
-	ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size);
-	if (ret < 0) {
-		dev_err(ctx->dev, "prepare firmware failed: %d\n", ret);
-		goto cnl_load_base_firmware_failed;
+	for (i = 0; i < BXT_FW_ROM_INIT_RETRY; i++) {
+		ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size);
+		if (!ret)
+			break;
+		dev_dbg(ctx->dev, "prepare firmware failed: %d\n", ret);
 	}
 
+	if (ret < 0)
+		goto cnl_load_base_firmware_failed;
+
 	ret = sst_transfer_fw_host_dma(ctx);
 	if (ret < 0) {
 		dev_err(ctx->dev, "transfer firmware failed: %d\n", ret);
@@ -158,6 +162,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
 	return 0;
 
 cnl_load_base_firmware_failed:
+	dev_err(ctx->dev, "firmware load failed: %d\n", ret);
 	release_firmware(ctx->fw);
 	ctx->fw = NULL;
 
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index cdfec0fca577..067d1ea11cde 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -67,6 +67,7 @@ struct skl_dev;
 
 #define SKL_FW_INIT			0x1
 #define SKL_FW_RFW_START		0xf
+#define BXT_FW_ROM_INIT_RETRY		3
 
 #define SKL_ADSPIC_IPC			1
 #define SKL_ADSPIS_IPC			1
-- 
2.17.1


  parent reply	other threads:[~2020-03-05 14:57 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 14:53 [PATCH 0/7] ASoC: Intel: Skylake: Fix HDaudio and Dmic Cezary Rojewski
2020-03-05 14:53 ` [PATCH 1/7] ASoC: Intel: Skylake: Remove superfluous chip initialization Cezary Rojewski
2020-03-06 20:52   ` Pierre-Louis Bossart
2020-03-09 13:57     ` Cezary Rojewski
2020-03-09 16:48       ` Pierre-Louis Bossart
2020-03-09 17:43         ` Cezary Rojewski
2020-03-09 18:41           ` Pierre-Louis Bossart
2020-03-10 17:45   ` Applied "ASoC: Intel: Skylake: Remove superfluous chip initialization" to the asoc tree Mark Brown
2020-03-05 14:53 ` [PATCH 2/7] ASoC: Intel: Skylake: Select hda configuration permissively Cezary Rojewski
2020-03-06 20:57   ` Pierre-Louis Bossart
2020-03-09 13:47     ` Cezary Rojewski
2020-03-09 17:03       ` Pierre-Louis Bossart
2020-03-10  9:30         ` Cezary Rojewski
2020-03-10 17:45   ` Applied "ASoC: Intel: Skylake: Select hda configuration permissively" to the asoc tree Mark Brown
2020-03-05 14:53 ` [PATCH 3/7] ASoC: Intel: Skylake: Enable codec wakeup during chip init Cezary Rojewski
2020-03-10 17:44   ` Applied "ASoC: Intel: Skylake: Enable codec wakeup during chip init" to the asoc tree Mark Brown
2020-03-05 14:53 ` [PATCH 4/7] ASoC: Intel: Skylake: Shield against no-NHLT configurations Cezary Rojewski
2020-03-06 21:03   ` Pierre-Louis Bossart
2020-03-09 13:03     ` Cezary Rojewski
2020-03-09 17:01       ` Pierre-Louis Bossart
2020-03-09 17:38         ` Cezary Rojewski
2020-03-09 18:40           ` Pierre-Louis Bossart
2020-03-10 17:44   ` Applied "ASoC: Intel: Skylake: Shield against no-NHLT configurations" to the asoc tree Mark Brown
2020-03-05 14:53 ` [PATCH 5/7] ASoC: Intel: skl_hda_dsp: Enable Dmic configuration Cezary Rojewski
2020-03-06 14:46   ` Kai Vehmanen
2020-03-06 15:49     ` Pierre-Louis Bossart
2020-03-06 19:05       ` Cezary Rojewski
2020-03-06 19:49         ` Pierre-Louis Bossart
2020-03-06 19:58           ` Cezary Rojewski
2020-03-05 14:53 ` Cezary Rojewski [this message]
2020-03-10 17:44   ` Applied "ASoC: Intel: Allow for ROM init retry on CNL platforms" to the asoc tree Mark Brown
2020-03-05 14:53 ` [PATCH 7/7] ASoC: Intel: Skylake: Await purge request ack on CNL Cezary Rojewski
2020-03-10 17:44   ` Applied "ASoC: Intel: Skylake: Await purge request ack on CNL" to the asoc tree Mark Brown
2020-03-06 20:48 ` [PATCH 0/7] ASoC: Intel: Skylake: Fix HDaudio and Dmic Pierre-Louis Bossart
2020-03-09 11:38   ` Mark Brown
2020-03-09 14:02     ` Cezary Rojewski
2020-03-09 16:54       ` Mark Brown
2020-03-09 17:48         ` Cezary Rojewski
2020-03-09 17:52           ` Mark Brown
2020-03-10 16:03         ` Pierre-Louis Bossart
     [not found]           ` <2dc38392-760b-a5fc-fa00-98530729f2d3@intel.com>
2020-03-11 16:56             ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200305145314.32579-7-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).