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

ALSA: cs35l41: Fix for old systems which do not support command

Some older laptops using cs35l41 use firmware which does not support
the CSPL_MBOX_CMD_SPK_OUT_ENABLE command.
Firmware versions v0.28.0 and older do not support this command.

Fixes: fa3efcc36aac ("ALSA: cs35l41: Use mbox command to enable speaker output for external boost")
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231117163609.823627-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Stefan Binding and committed by
Takashi Iwai
d04ce411 37f67abe

+9 -7
+1 -1
include/sound/cs35l41.h
··· 906 906 bool cs35l41_safe_reset(struct regmap *regmap, enum cs35l41_boost_type b_type); 907 907 int cs35l41_mdsync_up(struct regmap *regmap); 908 908 int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l41_boost_type b_type, 909 - int enable, bool firmware_running); 909 + int enable, struct cs_dsp *dsp); 910 910 911 911 #endif /* __CS35L41_H */
+2 -2
sound/pci/hda/cs35l41_hda.c
··· 598 598 dev_dbg(dev, "Play (Complete)\n"); 599 599 600 600 cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 1, 601 - cs35l41->cs_dsp.running); 601 + &cs35l41->cs_dsp); 602 602 cs35l41_mute(dev, false); 603 603 } 604 604 ··· 611 611 612 612 cs35l41_mute(dev, true); 613 613 cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 0, 614 - cs35l41->cs_dsp.running); 614 + &cs35l41->cs_dsp); 615 615 } 616 616 617 617 static void cs35l41_hda_pause_done(struct device *dev)
+4 -2
sound/soc/codecs/cs35l41-lib.c
··· 16 16 17 17 #include <sound/cs35l41.h> 18 18 19 + #define CS35L41_FIRMWARE_OLD_VERSION 0x001C00 /* v0.28.0 */ 20 + 19 21 static const struct reg_default cs35l41_reg[] = { 20 22 { CS35L41_PWR_CTRL1, 0x00000000 }, 21 23 { CS35L41_PWR_CTRL2, 0x00000000 }, ··· 1216 1214 * the PLL Lock interrupt, in the IRQ handler. 1217 1215 */ 1218 1216 int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l41_boost_type b_type, 1219 - int enable, bool firmware_running) 1217 + int enable, struct cs_dsp *dsp) 1220 1218 { 1221 1219 int ret; 1222 1220 unsigned int gpio1_func, pad_control, pwr_ctrl1, pwr_ctrl3, int_status, pup_pdn_mask; ··· 1311 1309 } 1312 1310 regmap_write(regmap, CS35L41_IRQ1_STATUS1, CS35L41_PUP_DONE_MASK); 1313 1311 1314 - if (firmware_running) 1312 + if (dsp->running && dsp->fw_id_version > CS35L41_FIRMWARE_OLD_VERSION) 1315 1313 ret = cs35l41_set_cspl_mbox_cmd(dev, regmap, 1316 1314 CSPL_MBOX_CMD_SPK_OUT_ENABLE); 1317 1315 else
+2 -2
sound/soc/codecs/cs35l41.c
··· 519 519 ARRAY_SIZE(cs35l41_pup_patch)); 520 520 521 521 ret = cs35l41_global_enable(cs35l41->dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type, 522 - 1, cs35l41->dsp.cs_dsp.running); 522 + 1, &cs35l41->dsp.cs_dsp); 523 523 break; 524 524 case SND_SOC_DAPM_POST_PMD: 525 525 ret = cs35l41_global_enable(cs35l41->dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type, 526 - 0, cs35l41->dsp.cs_dsp.running); 526 + 0, &cs35l41->dsp.cs_dsp); 527 527 528 528 regmap_multi_reg_write_bypassed(cs35l41->regmap, 529 529 cs35l41_pdn_patch,