Skip to content

Commit 3914cd2

Browse files
ranj063kv2019i
authored andcommitted
ASoC: SOF: Intel: hda: report error only for the last ROM init iteration
The FW boot sequence includes multiple attempts for ROM init. When it does take more than one attempt, we should not log the errors encountered during the failed attempts and only log them during the final iteration. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 1697493 commit 3914cd2

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

sound/soc/sof/intel/hda-loader.c

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static int cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format,
7979
* reset/stall and then turn it off
8080
*/
8181
static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
82-
u32 fwsize, int stream_tag)
82+
u32 fwsize, int stream_tag, int iteration)
8383
{
8484
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
8585
const struct sof_intel_dsp_desc *chip = hda->desc;
@@ -90,7 +90,8 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
9090
/* step 1: power up corex */
9191
ret = hda_dsp_core_power_up(sdev, chip->cores_mask);
9292
if (ret < 0) {
93-
dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n");
93+
if (iteration == HDA_FW_BOOT_ATTEMPTS)
94+
dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n");
9495
goto err;
9596
}
9697

@@ -112,7 +113,9 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
112113
/* step 3: unset core 0 reset state & unstall/run core 0 */
113114
ret = hda_dsp_core_run(sdev, HDA_DSP_CORE_MASK(0));
114115
if (ret < 0) {
115-
dev_err(sdev->dev, "error: dsp core start failed %d\n", ret);
116+
if (iteration == HDA_FW_BOOT_ATTEMPTS)
117+
dev_err(sdev->dev,
118+
"error: dsp core start failed %d\n", ret);
116119
ret = -EIO;
117120
goto err;
118121
}
@@ -126,8 +129,10 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
126129
HDA_DSP_INIT_TIMEOUT_US);
127130

128131
if (ret < 0) {
129-
dev_err(sdev->dev, "error: %s: timeout for HIPCIE done\n",
130-
__func__);
132+
if (iteration == HDA_FW_BOOT_ATTEMPTS)
133+
dev_err(sdev->dev,
134+
"error: %s: timeout for HIPCIE done\n",
135+
__func__);
131136
goto err;
132137
}
133138

@@ -141,7 +146,9 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
141146
ret = hda_dsp_core_power_down(sdev,
142147
chip->cores_mask & ~(HDA_DSP_CORE_MASK(0)));
143148
if (ret < 0) {
144-
dev_err(sdev->dev, "error: dsp core x power down failed\n");
149+
if (iteration == HDA_FW_BOOT_ATTEMPTS)
150+
dev_err(sdev->dev,
151+
"error: dsp core x power down failed\n");
145152
goto err;
146153
}
147154

@@ -159,9 +166,10 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
159166
if (!ret)
160167
return 0;
161168

162-
dev_err(sdev->dev,
163-
"error: %s: timeout HDA_DSP_SRAM_REG_ROM_STATUS read\n",
164-
__func__);
169+
if (iteration == HDA_FW_BOOT_ATTEMPTS)
170+
dev_err(sdev->dev,
171+
"error: %s: timeout HDA_DSP_SRAM_REG_ROM_STATUS read\n",
172+
__func__);
165173

166174
err:
167175
hda_dsp_dump(sdev, SOF_DBG_REGS | SOF_DBG_PCI | SOF_DBG_MBOX);
@@ -329,25 +337,25 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
329337

330338
/* try ROM init a few times before giving up */
331339
for (i = 0; i < HDA_FW_BOOT_ATTEMPTS; i++) {
340+
dev_dbg(sdev->dev,
341+
"Attempting iteration %d of Core En/ROM load...\n", i);
342+
332343
ret = cl_dsp_init(sdev, stripped_firmware.data,
333-
stripped_firmware.size, tag);
344+
stripped_firmware.size, tag, i + 1);
334345

335346
/* don't retry anymore if successful */
336347
if (!ret)
337348
break;
349+
}
338350

339-
dev_dbg(sdev->dev, "iteration %d of Core En/ROM load failed: %d\n",
351+
if (i == HDA_FW_BOOT_ATTEMPTS) {
352+
dev_err(sdev->dev, "error: dsp init failed after %d attempts with err: %d\n",
340353
i, ret);
341-
dev_dbg(sdev->dev, "Error code=0x%x: FW status=0x%x\n",
354+
dev_err(sdev->dev, "ROM error=0x%x: FW status=0x%x\n",
342355
snd_sof_dsp_read(sdev, HDA_DSP_BAR,
343356
HDA_DSP_SRAM_REG_ROM_ERROR),
344357
snd_sof_dsp_read(sdev, HDA_DSP_BAR,
345358
HDA_DSP_SRAM_REG_ROM_STATUS));
346-
}
347-
348-
if (i == HDA_FW_BOOT_ATTEMPTS) {
349-
dev_err(sdev->dev, "error: dsp init failed after %d attempts with err: %d\n",
350-
i, ret);
351359
goto cleanup;
352360
}
353361

0 commit comments

Comments
 (0)