summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/cs35l41-lib.c
diff options
context:
space:
mode:
authorStefan Binding <sbinding@opensource.cirrus.com>2023-10-26 17:05:58 +0200
committerTakashi Iwai <tiwai@suse.de>2023-10-26 17:55:29 +0200
commit76c121821a3128eb9d0183a525cf334beb9ccc47 (patch)
tree90896d4b53992210cc85c6fed22b958bbb67d929 /sound/soc/codecs/cs35l41-lib.c
parentALSA: hda: cs35l41: Check CSPL state after loading firmware (diff)
downloadlinux-76c121821a3128eb9d0183a525cf334beb9ccc47.tar.xz
linux-76c121821a3128eb9d0183a525cf334beb9ccc47.zip
ASoC: cs35l41: Detect CSPL errors when sending CSPL commands
The existing code checks for the correct state transition after sending a command. However, it is possible for the message box to return -1, which indicates an error, if an error has occurred in the firmware. We can detect if the error has occurred, and return a different error. In addition, there is no recovering from a CSPL error, so the retry mechanism is not needed in this case, and we can return immediately. Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20231026150558.2105827-9-sbinding@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/soc/codecs/cs35l41-lib.c')
-rw-r--r--sound/soc/codecs/cs35l41-lib.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/codecs/cs35l41-lib.c b/sound/soc/codecs/cs35l41-lib.c
index ddedb7e63cb6..4569e4f7cf7e 100644
--- a/sound/soc/codecs/cs35l41-lib.c
+++ b/sound/soc/codecs/cs35l41-lib.c
@@ -1474,6 +1474,11 @@ int cs35l41_set_cspl_mbox_cmd(struct device *dev, struct regmap *regmap,
continue;
}
+ if (sts == CSPL_MBOX_STS_ERROR || sts == CSPL_MBOX_STS_ERROR2) {
+ dev_err(dev, "CSPL Error Detected\n");
+ return -EINVAL;
+ }
+
if (!cs35l41_check_cspl_mbox_sts(cmd, sts))
dev_dbg(dev, "[%u] cmd %u returned invalid sts %u", i, cmd, sts);
else