Skip to content

Commit 76c1218

Browse files
Stefan Bindingtiwai
authored andcommitted
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 <[email protected]> Acked-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent a51d8ba commit 76c1218

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

include/sound/cs35l41.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,8 @@ struct cs35l41_otp_map_element_t {
816816
};
817817

818818
enum cs35l41_cspl_mbox_status {
819+
CSPL_MBOX_STS_ERROR = U32_MAX,
820+
CSPL_MBOX_STS_ERROR2 = 0x00ffffff, // firmware not always sign-extending 24-bit value
819821
CSPL_MBOX_STS_RUNNING = 0,
820822
CSPL_MBOX_STS_PAUSED = 1,
821823
CSPL_MBOX_STS_RDY_FOR_REINIT = 2,

sound/soc/codecs/cs35l41-lib.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,11 @@ int cs35l41_set_cspl_mbox_cmd(struct device *dev, struct regmap *regmap,
14741474
continue;
14751475
}
14761476

1477+
if (sts == CSPL_MBOX_STS_ERROR || sts == CSPL_MBOX_STS_ERROR2) {
1478+
dev_err(dev, "CSPL Error Detected\n");
1479+
return -EINVAL;
1480+
}
1481+
14771482
if (!cs35l41_check_cspl_mbox_sts(cmd, sts))
14781483
dev_dbg(dev, "[%u] cmd %u returned invalid sts %u", i, cmd, sts);
14791484
else

0 commit comments

Comments
 (0)