Skip to content

Commit 504f052

Browse files
committed
ALSA: hda/realtek: Use codec SSID matching for Lenovo devices
Now we can perform the codec ID matching primarily, and reduce the conditional application of the quirk for conflicting PCI SSIDs in various Lenovo devices. Here, HDA_CODEC_QUIRK() is applied at first so that the device with the codec SSID matching is picked up, followed by SND_PCI_QUIRK() for PCI SSID matching with the same ID number. Signed-off-by: Takashi Iwai <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 1f55e36 commit 504f052

File tree

1 file changed

+8
-90
lines changed

1 file changed

+8
-90
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 8 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -7687,8 +7687,6 @@ enum {
76877687
ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
76887688
ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
76897689
ALC298_FIXUP_LENOVO_C940_DUET7,
7690-
ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7691-
ALC287_FIXUP_LENOVO_LEGION_7,
76927690
ALC287_FIXUP_13S_GEN2_SPEAKERS,
76937691
ALC256_FIXUP_SET_COEF_DEFAULTS,
76947692
ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
@@ -7732,8 +7730,6 @@ enum {
77327730
ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1,
77337731
ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318,
77347732
ALC256_FIXUP_CHROME_BOOK,
7735-
ALC287_FIXUP_LENOVO_14ARP8_LEGION_IAH7,
7736-
ALC287_FIXUP_LENOVO_SSID_17AA3820,
77377733
ALC245_FIXUP_CLEVO_NOISY_MIC,
77387734
ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
77397735
};
@@ -7755,72 +7751,6 @@ static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
77557751
__snd_hda_apply_fixup(codec, id, action, 0);
77567752
}
77577753

7758-
/* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7759-
* 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7760-
* so we need to apply a different fixup in this case. The only DuetITL codec
7761-
* SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7762-
* and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7763-
* have matched correctly by their codecs.
7764-
*/
7765-
static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7766-
const struct hda_fixup *fix,
7767-
int action)
7768-
{
7769-
int id;
7770-
7771-
if (codec->core.subsystem_id == 0x17aa3802)
7772-
id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7773-
else
7774-
id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7775-
__snd_hda_apply_fixup(codec, id, action, 0);
7776-
}
7777-
7778-
/* Similar to above the Lenovo Yoga Pro 7 14ARP8 PCI SSID matches the codec SSID of the
7779-
Legion Y9000X 2022 IAH7.*/
7780-
static void alc287_fixup_lenovo_14arp8_legion_iah7(struct hda_codec *codec,
7781-
const struct hda_fixup *fix,
7782-
int action)
7783-
{
7784-
int id;
7785-
7786-
if (codec->core.subsystem_id == 0x17aa386e)
7787-
id = ALC287_FIXUP_CS35L41_I2C_2; /* Legion Y9000X 2022 IAH7 */
7788-
else
7789-
id = ALC285_FIXUP_SPEAKER2_TO_DAC1; /* Yoga Pro 7 14ARP8 */
7790-
__snd_hda_apply_fixup(codec, id, action, 0);
7791-
}
7792-
7793-
/* Another hilarious PCI SSID conflict with Lenovo Legion Pro 7 16ARX8H (with
7794-
* TAS2781 codec) and Legion 7i 16IAX7 (with CS35L41 codec);
7795-
* we apply a corresponding fixup depending on the codec SSID instead
7796-
*/
7797-
static void alc287_fixup_lenovo_legion_7(struct hda_codec *codec,
7798-
const struct hda_fixup *fix,
7799-
int action)
7800-
{
7801-
int id;
7802-
7803-
if (codec->core.subsystem_id == 0x17aa38a8)
7804-
id = ALC287_FIXUP_TAS2781_I2C; /* Legion Pro 7 16ARX8H */
7805-
else
7806-
id = ALC287_FIXUP_CS35L41_I2C_2; /* Legion 7i 16IAX7 */
7807-
__snd_hda_apply_fixup(codec, id, action, 0);
7808-
}
7809-
7810-
/* Yet more conflicting PCI SSID (17aa:3820) on two Lenovo models */
7811-
static void alc287_fixup_lenovo_ssid_17aa3820(struct hda_codec *codec,
7812-
const struct hda_fixup *fix,
7813-
int action)
7814-
{
7815-
int id;
7816-
7817-
if (codec->core.subsystem_id == 0x17aa3820)
7818-
id = ALC269_FIXUP_ASPIRE_HEADSET_MIC; /* IdeaPad 330-17IKB 81DM */
7819-
else /* 0x17aa3802 */
7820-
id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* "Yoga Duet 7 13ITL6 */
7821-
__snd_hda_apply_fixup(codec, id, action, 0);
7822-
}
7823-
78247754
static const struct hda_fixup alc269_fixups[] = {
78257755
[ALC269_FIXUP_GPIO2] = {
78267756
.type = HDA_FIXUP_FUNC,
@@ -9731,14 +9661,6 @@ static const struct hda_fixup alc269_fixups[] = {
97319661
.type = HDA_FIXUP_FUNC,
97329662
.v.func = alc298_fixup_lenovo_c940_duet7,
97339663
},
9734-
[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9735-
.type = HDA_FIXUP_FUNC,
9736-
.v.func = alc287_fixup_lenovo_14irp8_duetitl,
9737-
},
9738-
[ALC287_FIXUP_LENOVO_LEGION_7] = {
9739-
.type = HDA_FIXUP_FUNC,
9740-
.v.func = alc287_fixup_lenovo_legion_7,
9741-
},
97429664
[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
97439665
.type = HDA_FIXUP_VERBS,
97449666
.v.verbs = (const struct hda_verb[]) {
@@ -9923,10 +9845,6 @@ static const struct hda_fixup alc269_fixups[] = {
99239845
.chained = true,
99249846
.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
99259847
},
9926-
[ALC287_FIXUP_LENOVO_14ARP8_LEGION_IAH7] = {
9927-
.type = HDA_FIXUP_FUNC,
9928-
.v.func = alc287_fixup_lenovo_14arp8_legion_iah7,
9929-
},
99309848
[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
99319849
.type = HDA_FIXUP_FUNC,
99329850
.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
@@ -10057,10 +9975,6 @@ static const struct hda_fixup alc269_fixups[] = {
100579975
.chained = true,
100589976
.chain_id = ALC225_FIXUP_HEADSET_JACK
100599977
},
10060-
[ALC287_FIXUP_LENOVO_SSID_17AA3820] = {
10061-
.type = HDA_FIXUP_FUNC,
10062-
.v.func = alc287_fixup_lenovo_ssid_17aa3820,
10063-
},
100649978
[ALC245_FIXUP_CLEVO_NOISY_MIC] = {
100659979
.type = HDA_FIXUP_FUNC,
100669980
.v.func = alc269_fixup_limit_int_mic_boost,
@@ -10794,11 +10708,13 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
1079410708
SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
1079510709
SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
1079610710
SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10797-
SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10711+
HDA_CODEC_QUIRK(0x17aa, 0x3802, "DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10712+
SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8", ALC287_FIXUP_TAS2781_I2C),
1079810713
SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
1079910714
SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
1080010715
SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10801-
SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330 / Yoga Duet 7", ALC287_FIXUP_LENOVO_SSID_17AA3820),
10716+
HDA_CODEC_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10717+
SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
1080210718
SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
1080310719
SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
1080410720
SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
@@ -10812,8 +10728,10 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
1081210728
SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
1081310729
SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
1081410730
SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10815-
SND_PCI_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7 / Yoga Pro 7 14ARP8", ALC287_FIXUP_LENOVO_14ARP8_LEGION_IAH7),
10816-
SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7/7i", ALC287_FIXUP_LENOVO_LEGION_7),
10731+
HDA_CODEC_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7", ALC287_FIXUP_CS35L41_I2C_2),
10732+
SND_PCI_QUIRK(0x17aa, 0x386e, "Yoga Pro 7 14ARP8", ALC285_FIXUP_SPEAKER2_TO_DAC1),
10733+
HDA_CODEC_QUIRK(0x17aa, 0x386f, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C),
10734+
SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2),
1081710735
SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C),
1081810736
SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
1081910737
SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),

0 commit comments

Comments
 (0)