Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: cs35l56: Log a message if firmware is missing

If the amp is still reporting FIRMWARE_MISSING after cs35l56_patch()
has completed it is helpful to log a warning.

After a complete firmware download the FIRMWARE_MISSING flag will be
clear. If this isn't the case, the driver should log a message to
report this.

The amp can produce basic audio output without firmware, as a fallback,
so this wasn't originally logged as a warning condition because the amp
is still in an operational state - just not with full functionality.
However, it was not at all obvious to an end user that anything is
unusual.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20251128112520.40067-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Richard Fitzgerald and committed by
Mark Brown
816c9cac feab2875

+21
+1
include/sound/cs35l56.h
··· 409 409 struct snd_ctl_elem_value *uvalue); 410 410 int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, 411 411 bool *fw_missing, unsigned int *fw_version); 412 + void cs35l56_warn_if_firmware_missing(struct cs35l56_base *cs35l56_base); 412 413 void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp); 413 414 int cs35l56_hw_init(struct cs35l56_base *cs35l56_base); 414 415 int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base);
+17
sound/soc/codecs/cs35l56-shared.c
··· 1337 1337 } 1338 1338 EXPORT_SYMBOL_NS_GPL(cs35l56_read_prot_status, "SND_SOC_CS35L56_SHARED"); 1339 1339 1340 + void cs35l56_warn_if_firmware_missing(struct cs35l56_base *cs35l56_base) 1341 + { 1342 + unsigned int firmware_version; 1343 + bool firmware_missing; 1344 + int ret; 1345 + 1346 + ret = cs35l56_read_prot_status(cs35l56_base, &firmware_missing, &firmware_version); 1347 + if (ret) 1348 + return; 1349 + 1350 + if (!firmware_missing) 1351 + return; 1352 + 1353 + dev_warn(cs35l56_base->dev, "FIRMWARE_MISSING\n"); 1354 + } 1355 + EXPORT_SYMBOL_NS_GPL(cs35l56_warn_if_firmware_missing, "SND_SOC_CS35L56_SHARED"); 1356 + 1340 1357 void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp) 1341 1358 { 1342 1359 __be32 pid, sid, tid;
+3
sound/soc/codecs/cs35l56.c
··· 823 823 goto err_unlock; 824 824 } 825 825 826 + /* Check if the firmware is still reported missing */ 827 + cs35l56_warn_if_firmware_missing(&cs35l56->base); 828 + 826 829 regmap_clear_bits(cs35l56->base.regmap, 827 830 cs35l56->base.fw_reg->prot_sts, 828 831 CS35L56_FIRMWARE_MISSING);