History

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.

Stefan Binding committed 2 years ago

Commit d04ce411 parent 37f67ab4 files · +9 −7Browse files

Unified · Split

4 files
  1. include/sound/cs35l41.h +1 −1
  2. sound/pci/hda/cs35l41_hda.c +2 −2
  3. sound/soc/codecs/cs35l41-lib.c +4 −2
  4. sound/soc/codecs/cs35l41.c +2 −2
include/sound/cs35l41.h+1−1
@@ -906,6 +906,6 @@ int cs35l41_init_boost(struct device *dev, struct regmap *regmap, · 905 unmodified lines
906906 bool cs35l41_safe_reset(struct regmap *regmap, enum cs35l41_boost_type b_type);
907907 int cs35l41_mdsync_up(struct regmap *regmap);
908908 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);
910910
911911 #endif /* __CS35L41_H */
sound/pci/hda/cs35l41_hda.c+2−2
@@ -598,7 +598,7 @@ static void cs35l41_hda_play_done(struct device *dev) · 597 unmodified lines
598598 dev_dbg(dev, "Play (Complete)\n");
599599
600600 cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 1,
601− cs35l41->cs_dsp.running);
601+ &cs35l41->cs_dsp);
602602 cs35l41_mute(dev, false);
603603 }
604604
@@ -611,7 +611,7 @@ static void cs35l41_hda_pause_start(struct device *dev) · 6 unmodified lines
611611
612612 cs35l41_mute(dev, true);
613613 cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 0,
614− cs35l41->cs_dsp.running);
614+ &cs35l41->cs_dsp);
615615 }
616616
617617 static void cs35l41_hda_pause_done(struct device *dev)
sound/soc/codecs/cs35l41-lib.c+4−2
@@ -16,6 +16,8 @@ · 15 unmodified lines
1616
1717 #include <sound/cs35l41.h>
1818
19+#define CS35L41_FIRMWARE_OLD_VERSION 0x001C00 /* v0.28.0 */
20+
1921 static const struct reg_default cs35l41_reg[] = {
2022 { CS35L41_PWR_CTRL1, 0x00000000 },
2123 { CS35L41_PWR_CTRL2, 0x00000000 },
@@ -1214,7 +1216,7 @@ EXPORT_SYMBOL_GPL(cs35l41_safe_reset); · 1192 unmodified lines
12141216 * the PLL Lock interrupt, in the IRQ handler.
12151217 */
12161218 int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l41_boost_type b_type,
1217− int enable, bool firmware_running)
1219+ int enable, struct cs_dsp *dsp)
12181220 {
12191221 int ret;
12201222 unsigned int gpio1_func, pad_control, pwr_ctrl1, pwr_ctrl3, int_status, pup_pdn_mask;
@@ -1309,7 +1311,7 @@ int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l4 · 88 unmodified lines
13091311 }
13101312 regmap_write(regmap, CS35L41_IRQ1_STATUS1, CS35L41_PUP_DONE_MASK);
13111313
1312− if (firmware_running)
1314+ if (dsp->running && dsp->fw_id_version > CS35L41_FIRMWARE_OLD_VERSION)
13131315 ret = cs35l41_set_cspl_mbox_cmd(dev, regmap,
13141316 CSPL_MBOX_CMD_SPK_OUT_ENABLE);
13151317 else
sound/soc/codecs/cs35l41.c+2−2
@@ -519,11 +519,11 @@ static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w, · 518 unmodified lines
519519 ARRAY_SIZE(cs35l41_pup_patch));
520520
521521 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);
523523 break;
524524 case SND_SOC_DAPM_POST_PMD:
525525 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);
527527
528528 regmap_multi_reg_write_bypassed(cs35l41->regmap,
529529 cs35l41_pdn_patch,