Skip to content

Commit a51d8ba

Browse files
Stefan Bindingtiwai
authored andcommitted
ALSA: hda: cs35l41: Check CSPL state after loading firmware
CSPL firmware should be in RUNNING or PAUSED state after loading. If not, the firmware has not been loaded correctly, and we can unload it and pass the error up. Signed-off-by: Stefan Binding <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 33790d1 commit a51d8ba

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

sound/pci/hda/cs35l41_hda.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,7 @@ static int cs35l41_runtime_resume(struct device *dev)
994994

995995
static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41)
996996
{
997+
unsigned int fw_status;
997998
__be32 halo_sts;
998999
int ret;
9991000

@@ -1027,6 +1028,23 @@ static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41)
10271028
goto clean_dsp;
10281029
}
10291030

1031+
ret = regmap_read(cs35l41->regmap, CS35L41_DSP_MBOX_2, &fw_status);
1032+
if (ret < 0) {
1033+
dev_err(cs35l41->dev,
1034+
"Failed to read firmware status: %d\n", ret);
1035+
goto clean_dsp;
1036+
}
1037+
1038+
switch (fw_status) {
1039+
case CSPL_MBOX_STS_RUNNING:
1040+
case CSPL_MBOX_STS_PAUSED:
1041+
break;
1042+
default:
1043+
dev_err(cs35l41->dev, "Firmware status is invalid: %u\n",
1044+
fw_status);
1045+
goto clean_dsp;
1046+
}
1047+
10301048
ret = cs35l41_set_cspl_mbox_cmd(cs35l41->dev, cs35l41->regmap, CSPL_MBOX_CMD_PAUSE);
10311049
if (ret) {
10321050
dev_err(cs35l41->dev, "Error waiting for DSP to pause: %u\n", ret);

0 commit comments

Comments
 (0)