Skip to content

Commit afd17e6

Browse files
simontrimmertiwai
authored andcommitted
ASoC: cs35l56: Add support for CS35L54 and CS35L57
The CS35L54 and CS35L57 are Boosted Smart Amplifiers. The CS35L54 has I2C/SPI control and I2S/TDM audio. The CS35L57 also has SoundWire control and audio. The hardware differences between L54, L56 and L57 do not affect the driver control interface so they can all be handled by the same driver. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Message-ID: <20240308135900.603192-2-rf@opensource.cirrus.com>
1 parent 85b4f2a commit afd17e6

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

include/sound/cs35l56.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ struct cs35l56_base {
257257
struct regmap *regmap;
258258
int irq;
259259
struct mutex irq_lock;
260+
u8 type;
260261
u8 rev;
261262
bool init_done;
262263
bool fw_patched;

sound/soc/codecs/cs35l56-sdw.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static int cs35l56_sdw_bus_config(struct sdw_slave *peripheral,
366366
dev_dbg(cs35l56->base.dev, "%s: sclk=%u c=%u r=%u\n",
367367
__func__, sclk, params->col, params->row);
368368

369-
if (cs35l56->base.rev < 0xb0)
369+
if ((cs35l56->base.type == 0x56) && (cs35l56->base.rev < 0xb0))
370370
return cs35l56_a1_kick_divider(cs35l56, peripheral);
371371

372372
return 0;
@@ -543,6 +543,7 @@ static const struct dev_pm_ops cs35l56_sdw_pm = {
543543

544544
static const struct sdw_device_id cs35l56_sdw_id[] = {
545545
SDW_SLAVE_ENTRY(0x01FA, 0x3556, 0),
546+
SDW_SLAVE_ENTRY(0x01FA, 0x3557, 0),
546547
{},
547548
};
548549
MODULE_DEVICE_TABLE(sdw, cs35l56_sdw_id);

sound/soc/codecs/cs35l56-shared.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,13 +692,17 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base)
692692
devid &= CS35L56_DEVID_MASK;
693693

694694
switch (devid) {
695+
case 0x35A54:
695696
case 0x35A56:
697+
case 0x35A57:
696698
break;
697699
default:
698700
dev_err(cs35l56_base->dev, "Unknown device %x\n", devid);
699701
return ret;
700702
}
701703

704+
cs35l56_base->type = devid & 0xFF;
705+
702706
ret = regmap_read(cs35l56_base->regmap, CS35L56_DSP_RESTRICT_STS1, &secured);
703707
if (ret) {
704708
dev_err(cs35l56_base->dev, "Get Secure status failed\n");
@@ -719,8 +723,8 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base)
719723
if (ret)
720724
return ret;
721725

722-
dev_info(cs35l56_base->dev, "Cirrus Logic CS35L56%s Rev %02X OTP%d fw:%d.%d.%d (patched=%u)\n",
723-
cs35l56_base->secured ? "s" : "", cs35l56_base->rev, otpid,
726+
dev_info(cs35l56_base->dev, "Cirrus Logic CS35L%02X%s Rev %02X OTP%d fw:%d.%d.%d (patched=%u)\n",
727+
cs35l56_base->type, cs35l56_base->secured ? "s" : "", cs35l56_base->rev, otpid,
724728
fw_ver >> 16, (fw_ver >> 8) & 0xff, fw_ver & 0xff, !fw_missing);
725729

726730
/* Wake source and *_BLOCKED interrupts default to unmasked, so mask them */

sound/soc/codecs/cs35l56.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,10 @@ static int cs35l56_component_probe(struct snd_soc_component *component)
972972
return -ENODEV;
973973
}
974974

975+
cs35l56->dsp.part = kasprintf(GFP_KERNEL, "cs35l%02x", cs35l56->base.type);
976+
if (!cs35l56->dsp.part)
977+
return -ENOMEM;
978+
975979
cs35l56->component = component;
976980
wm_adsp2_component_probe(&cs35l56->dsp, component);
977981

@@ -1002,6 +1006,9 @@ static void cs35l56_component_remove(struct snd_soc_component *component)
10021006

10031007
wm_adsp2_component_remove(&cs35l56->dsp, component);
10041008

1009+
kfree(cs35l56->dsp.part);
1010+
cs35l56->dsp.part = NULL;
1011+
10051012
kfree(cs35l56->dsp.fwf_name);
10061013
cs35l56->dsp.fwf_name = NULL;
10071014

@@ -1221,7 +1228,12 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)
12211228

12221229
dsp = &cs35l56->dsp;
12231230
cs35l56_init_cs_dsp(&cs35l56->base, &dsp->cs_dsp);
1224-
dsp->part = "cs35l56";
1231+
1232+
/*
1233+
* dsp->part is filled in later as it is based on the DEVID. In a
1234+
* SoundWire system that cannot be read until enumeration has occurred
1235+
* and the device has attached.
1236+
*/
12251237
dsp->fw = 12;
12261238
dsp->wmfw_optional = true;
12271239

0 commit comments

Comments
 (0)