Commit 952d301b authored by Takashi Iwai's avatar Takashi Iwai Committed by Peng Zhang
Browse files

ALSA: hda/realtek: Fix conflicting quirk for PCI SSID 17aa:3820

mainline inclusion
from mainline-v6.10-rc6
commit d3710853fd4a7020904a16686986cf5541ad1c38
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAD6H2

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d3710853fd4a7020904a16686986cf5541ad1c38

---------------------------------------------------------

The recent fix for Lenovo IdeaPad 330-17IKB replaced the quirk entry,
and this eventually breaks the existing quirk for Lenovo Yoga Duet 7
13ITL6 equipped with the same PCI SSID 17aa:3820.

For applying a proper quirk for each model, check the codec SSID
additionally.  Fortunately Yoga Duet has a different codec SSID,
0x17aa3802.

(Interestingly, 17aa:3802 has another conflict of SSID between another
Yoga model vs 14IRP8 which we had to work around similarly.)

Fixes: b1fd0d1285b1 ("ALSA: hda/realtek: Enable headset mic on IdeaPad 330-17IKB 81DM")
Link: https://patch.msgid.link/20240625155217.18767-1-tiwai@suse.de


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>

Conflicts:
	sound/pci/hda/patch_realtek.c
[Context conflicts]
Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
parent 61dbbedc
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -7445,6 +7445,7 @@ enum {
	ALC2XX_FIXUP_HEADSET_MIC,
	ALC289_FIXUP_DELL_CS35L41_SPI_2,
	ALC294_FIXUP_CS35L41_I2C_2,
	ALC287_FIXUP_LENOVO_SSID_17AA3820,
};

/* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -7484,6 +7485,20 @@ static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
	__snd_hda_apply_fixup(codec, id, action, 0);
}

/* Yet more conflicting PCI SSID (17aa:3820) on two Lenovo models */
static void alc287_fixup_lenovo_ssid_17aa3820(struct hda_codec *codec,
					      const struct hda_fixup *fix,
					      int action)
{
	int id;

	if (codec->core.subsystem_id == 0x17aa3820)
		id = ALC269_FIXUP_ASPIRE_HEADSET_MIC; /* IdeaPad 330-17IKB 81DM */
	else /* 0x17aa3802 */
		id =  ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* "Yoga Duet 7 13ITL6 */
	__snd_hda_apply_fixup(codec, id, action, 0);
}

static const struct hda_fixup alc269_fixups[] = {
	[ALC269_FIXUP_GPIO2] = {
		.type = HDA_FIXUP_FUNC,
@@ -9624,6 +9639,10 @@ static const struct hda_fixup alc269_fixups[] = {
		.type = HDA_FIXUP_FUNC,
		.v.func = cs35l41_fixup_i2c_two,
	},
	[ALC287_FIXUP_LENOVO_SSID_17AA3820] = {
		.type = HDA_FIXUP_FUNC,
		.v.func = alc287_fixup_lenovo_ssid_17aa3820,
	},
};

static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -10264,7 +10283,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
	SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
	SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330 / Yoga Duet 7", ALC287_FIXUP_LENOVO_SSID_17AA3820),
	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),