Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2747285pxu; Sun, 29 Nov 2020 03:49:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRvA6hDrTS8qN28B0EVCiEUUxeYXPgBLRcY+bKGRVQl7XpH2KZlBOysvoeM+DyCXC352y3 X-Received: by 2002:aa7:d514:: with SMTP id y20mr16302935edq.384.1606650559550; Sun, 29 Nov 2020 03:49:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606650559; cv=none; d=google.com; s=arc-20160816; b=OQVO8Z66BLfoYpho45KnO54hDFBscbQyO8xA3xWy8yNC5yyEfZV50PybbAqc7swC1p +u1W+ZtJcbsXcVE0kxwDD6tPZxdu0+X9ta+coX3jzwyMUxqjJ7mueIHChMQlhPhdzqKC VYe/sZdEohFZqw18Ye/TXL9eJdE0ctJl/JYd34yZbZPZdWZyzLiWXUpAo4KsEOqrwZZo pJTp/e6mjtdqZF4M/TZXJFfEaH5bdptX6YCTZmA83grzBjM70SctV+/46UHJa1Dw9vJY gb3ZE7zY/clbCGr8I8K7WuRcY2VinPSCVoeIHQRx2IuAiIweMqRFLmBzl5PDGBbeoq4r 6sMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=WQPMf3rqtZL31WL4103bMwxDXdGb/MeIJtOZKBvFfuU=; b=WCO3o0J2+otEVI6vJ3j25u2bIR3tgItinUdTP7S5LHZkRvpn10RZXd33K27oBM0Zto JgSqjPJnitjm8tXpnNdojzuGYbAANfCYY4l04AG9sbKNB7yBzvhEKMXq6PBAlwfrmBph P8Oft0mEfVVeRaVzUK9xktSOBDYZ/9mxhIi2HvN2R2ZCGZaKxX1TL2t0a4lQYueO4CrN aPyBeKufLMSTJcn4+7PfB5aKuHhO98sRov0Aggi9Yy5ALBYn2feic/0MZcraEA8gvMAE nY1GbbP0fr8k70xLoFsP+gsAKlnRYX4iy3tyo/oS7RVd/waSe35ju9+Chyt1dFdirI3R PK+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ho11si9266981ejc.382.2020.11.29.03.48.57; Sun, 29 Nov 2020 03:49:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387406AbgK2Loo (ORCPT + 99 others); Sun, 29 Nov 2020 06:44:44 -0500 Received: from mga07.intel.com ([134.134.136.100]:8130 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725882AbgK2Lom (ORCPT ); Sun, 29 Nov 2020 06:44:42 -0500 IronPort-SDR: i0wOwxY5AqeMlCm3YdWenTLMklP30ii9Bu6dTa7uvMU/tZAWeyOQ9/mK/HYQw0sv4REuffb3Cz 0a8pHOBi6K7g== X-IronPort-AV: E=McAfee;i="6000,8403,9819"; a="236654212" X-IronPort-AV: E=Sophos;i="5.78,379,1599548400"; d="scan'208";a="236654212" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2020 03:43:14 -0800 IronPort-SDR: y+h36jCuOb3LQ75mQ4kkcuGpJEMWwob8XsN74kQi30UhvBWEMtXJ5jpwNUGxb6M/w1TOJa+A/z FOfOBMYB/0hA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,379,1599548400"; d="scan'208";a="480261657" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga004.jf.intel.com with ESMTP; 29 Nov 2020 03:43:12 -0800 From: Cezary Rojewski To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: alsa-devel@alsa-project.org, broonie@kernel.org, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, mateusz.gorski@linux.intel.com, Cezary Rojewski Subject: [PATCH 5/8] ASoC: Intel: Allow for ROM init retry on CNL platforms Date: Sun, 29 Nov 2020 12:41:45 +0100 Message-Id: <20201129114148.13772-6-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201129114148.13772-1-cezary.rojewski@intel.com> References: <20201129114148.13772-1-cezary.rojewski@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 024aa45f55ccd40704cfdef61b2a8b6d0de9cdd1 upstream. 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. Fixes: cb6a55284629 ("ASoC: Intel: cnl: Add sst library functions for cnl platform") Signed-off-by: Cezary Rojewski Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20200305145314.32579-7-cezary.rojewski@intel.com Signed-off-by: Mark Brown Cc: # 5.4.x --- 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