Skip to content

Commit c76d0eb

Browse files
tiwaigregkh
authored andcommitted
ALSA: hda/realtek: Use codec SSID matching for Lenovo devices
[ Upstream commit 504f052 ] 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 <tiwai@suse.de> Link: https://patch.msgid.link/20241008120233.7154-4-tiwai@suse.de Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 753693b commit c76d0eb

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
@@ -7726,8 +7726,6 @@ enum {
77267726
ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
77277727
ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
77287728
ALC298_FIXUP_LENOVO_C940_DUET7,
7729-
ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7730-
ALC287_FIXUP_LENOVO_LEGION_7,
77317729
ALC287_FIXUP_13S_GEN2_SPEAKERS,
77327730
ALC256_FIXUP_SET_COEF_DEFAULTS,
77337731
ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
@@ -7772,8 +7770,6 @@ enum {
77727770
ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1,
77737771
ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318,
77747772
ALC256_FIXUP_CHROME_BOOK,
7775-
ALC287_FIXUP_LENOVO_14ARP8_LEGION_IAH7,
7776-
ALC287_FIXUP_LENOVO_SSID_17AA3820,
77777773
ALC245_FIXUP_CLEVO_NOISY_MIC,
77787774
ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
77797775
ALC233_FIXUP_MEDION_MTL_SPK,
@@ -7796,72 +7792,6 @@ static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
77967792
__snd_hda_apply_fixup(codec, id, action, 0);
77977793
}
77987794

7799-
/* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7800-
* 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7801-
* so we need to apply a different fixup in this case. The only DuetITL codec
7802-
* SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7803-
* and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7804-
* have matched correctly by their codecs.
7805-
*/
7806-
static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7807-
const struct hda_fixup *fix,
7808-
int action)
7809-
{
7810-
int id;
7811-
7812-
if (codec->core.subsystem_id == 0x17aa3802)
7813-
id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7814-
else
7815-
id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7816-
__snd_hda_apply_fixup(codec, id, action, 0);
7817-
}
7818-
7819-
/* Similar to above the Lenovo Yoga Pro 7 14ARP8 PCI SSID matches the codec SSID of the
7820-
Legion Y9000X 2022 IAH7.*/
7821-
static void alc287_fixup_lenovo_14arp8_legion_iah7(struct hda_codec *codec,
7822-
const struct hda_fixup *fix,
7823-
int action)
7824-
{
7825-
int id;
7826-
7827-
if (codec->core.subsystem_id == 0x17aa386e)
7828-
id = ALC287_FIXUP_CS35L41_I2C_2; /* Legion Y9000X 2022 IAH7 */
7829-
else
7830-
id = ALC285_FIXUP_SPEAKER2_TO_DAC1; /* Yoga Pro 7 14ARP8 */
7831-
__snd_hda_apply_fixup(codec, id, action, 0);
7832-
}
7833-
7834-
/* Another hilarious PCI SSID conflict with Lenovo Legion Pro 7 16ARX8H (with
7835-
* TAS2781 codec) and Legion 7i 16IAX7 (with CS35L41 codec);
7836-
* we apply a corresponding fixup depending on the codec SSID instead
7837-
*/
7838-
static void alc287_fixup_lenovo_legion_7(struct hda_codec *codec,
7839-
const struct hda_fixup *fix,
7840-
int action)
7841-
{
7842-
int id;
7843-
7844-
if (codec->core.subsystem_id == 0x17aa38a8)
7845-
id = ALC287_FIXUP_TAS2781_I2C; /* Legion Pro 7 16ARX8H */
7846-
else
7847-
id = ALC287_FIXUP_CS35L41_I2C_2; /* Legion 7i 16IAX7 */
7848-
__snd_hda_apply_fixup(codec, id, action, 0);
7849-
}
7850-
7851-
/* Yet more conflicting PCI SSID (17aa:3820) on two Lenovo models */
7852-
static void alc287_fixup_lenovo_ssid_17aa3820(struct hda_codec *codec,
7853-
const struct hda_fixup *fix,
7854-
int action)
7855-
{
7856-
int id;
7857-
7858-
if (codec->core.subsystem_id == 0x17aa3820)
7859-
id = ALC269_FIXUP_ASPIRE_HEADSET_MIC; /* IdeaPad 330-17IKB 81DM */
7860-
else /* 0x17aa3802 */
7861-
id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* "Yoga Duet 7 13ITL6 */
7862-
__snd_hda_apply_fixup(codec, id, action, 0);
7863-
}
7864-
78657795
static const struct hda_fixup alc269_fixups[] = {
78667796
[ALC269_FIXUP_GPIO2] = {
78677797
.type = HDA_FIXUP_FUNC,
@@ -9810,14 +9740,6 @@ static const struct hda_fixup alc269_fixups[] = {
98109740
.type = HDA_FIXUP_FUNC,
98119741
.v.func = alc298_fixup_lenovo_c940_duet7,
98129742
},
9813-
[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9814-
.type = HDA_FIXUP_FUNC,
9815-
.v.func = alc287_fixup_lenovo_14irp8_duetitl,
9816-
},
9817-
[ALC287_FIXUP_LENOVO_LEGION_7] = {
9818-
.type = HDA_FIXUP_FUNC,
9819-
.v.func = alc287_fixup_lenovo_legion_7,
9820-
},
98219743
[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
98229744
.type = HDA_FIXUP_VERBS,
98239745
.v.verbs = (const struct hda_verb[]) {
@@ -10002,10 +9924,6 @@ static const struct hda_fixup alc269_fixups[] = {
100029924
.chained = true,
100039925
.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
100049926
},
10005-
[ALC287_FIXUP_LENOVO_14ARP8_LEGION_IAH7] = {
10006-
.type = HDA_FIXUP_FUNC,
10007-
.v.func = alc287_fixup_lenovo_14arp8_legion_iah7,
10008-
},
100099927
[ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
100109928
.type = HDA_FIXUP_FUNC,
100119929
.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
@@ -10140,10 +10058,6 @@ static const struct hda_fixup alc269_fixups[] = {
1014010058
.chained = true,
1014110059
.chain_id = ALC225_FIXUP_HEADSET_JACK
1014210060
},
10143-
[ALC287_FIXUP_LENOVO_SSID_17AA3820] = {
10144-
.type = HDA_FIXUP_FUNC,
10145-
.v.func = alc287_fixup_lenovo_ssid_17aa3820,
10146-
},
1014710061
[ALC245_FIXUP_CLEVO_NOISY_MIC] = {
1014810062
.type = HDA_FIXUP_FUNC,
1014910063
.v.func = alc269_fixup_limit_int_mic_boost,
@@ -10911,11 +10825,13 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
1091110825
SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
1091210826
SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
1091310827
SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10914-
SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10828+
HDA_CODEC_QUIRK(0x17aa, 0x3802, "DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10829+
SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8", ALC287_FIXUP_TAS2781_I2C),
1091510830
SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
1091610831
SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
1091710832
SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10918-
SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330 / Yoga Duet 7", ALC287_FIXUP_LENOVO_SSID_17AA3820),
10833+
HDA_CODEC_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10834+
SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
1091910835
SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
1092010836
SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
1092110837
SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
@@ -10929,8 +10845,10 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
1092910845
SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
1093010846
SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
1093110847
SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10932-
SND_PCI_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7 / Yoga Pro 7 14ARP8", ALC287_FIXUP_LENOVO_14ARP8_LEGION_IAH7),
10933-
SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7/7i", ALC287_FIXUP_LENOVO_LEGION_7),
10848+
HDA_CODEC_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7", ALC287_FIXUP_CS35L41_I2C_2),
10849+
SND_PCI_QUIRK(0x17aa, 0x386e, "Yoga Pro 7 14ARP8", ALC285_FIXUP_SPEAKER2_TO_DAC1),
10850+
HDA_CODEC_QUIRK(0x17aa, 0x386f, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C),
10851+
SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2),
1093410852
SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C),
1093510853
SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
1093610854
SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),

0 commit comments

Comments
 (0)