Skip to content

Commit ae7abe3

Browse files
Stefan Bindingtiwai
authored andcommitted
ALSA: hda/realtek: Add CS35L41 support for Thinkpad laptops
Add support for two CS35L41 using I2C bus and the component binding method [ Fix the entries to be sorted order by tiwai ] Signed-off-by: Stefan Binding <[email protected]> Signed-off-by: Lucas Tanure <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent d3dca02 commit ae7abe3

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6580,6 +6580,37 @@ static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_
65806580
}
65816581
}
65826582

6583+
static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6584+
const char *hid, int count)
6585+
{
6586+
struct device *dev = hda_codec_dev(cdc);
6587+
struct alc_spec *spec = cdc->spec;
6588+
char *name;
6589+
int ret, i;
6590+
6591+
switch (action) {
6592+
case HDA_FIXUP_ACT_PRE_PROBE:
6593+
for (i = 0; i < count; i++) {
6594+
name = devm_kasprintf(dev, GFP_KERNEL,
6595+
"%s-%s:00-cs35l41-hda.%d", bus, hid, i);
6596+
if (!name)
6597+
return;
6598+
component_match_add(dev, &spec->match, comp_match_dev_name, name);
6599+
}
6600+
ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6601+
if (ret)
6602+
codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6603+
else
6604+
spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6605+
break;
6606+
}
6607+
}
6608+
6609+
static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6610+
{
6611+
cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6612+
}
6613+
65836614
static void alc287_legion_16achg6_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
65846615
struct snd_pcm_substream *sub, int action)
65856616
{
@@ -6916,6 +6947,7 @@ enum {
69166947
ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
69176948
ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
69186949
ALC287_FIXUP_LEGION_16ACHG6,
6950+
ALC287_FIXUP_CS35L41_I2C_2,
69196951
};
69206952

69216953
static const struct hda_fixup alc269_fixups[] = {
@@ -8662,6 +8694,10 @@ static const struct hda_fixup alc269_fixups[] = {
86628694
.type = HDA_FIXUP_FUNC,
86638695
.v.func = alc287_fixup_legion_16achg6_speakers,
86648696
},
8697+
[ALC287_FIXUP_CS35L41_I2C_2] = {
8698+
.type = HDA_FIXUP_FUNC,
8699+
.v.func = cs35l41_fixup_i2c_two,
8700+
},
86658701
};
86668702

86678703
static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -9059,6 +9095,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
90599095
SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
90609096
SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
90619097
SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9098+
SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9099+
SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9100+
SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
90629101
SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
90639102
SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
90649103
SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),

0 commit comments

Comments
 (0)