diff mbox series

[v3] ALSA: hda/realtek: Add special fixup for Lenovo 14IRP8

Message ID 170879111795.8.6687687359006700715.273812184@willian.wang (mailing list archive)
State Accepted
Commit 0ac32a396e4f41e88df76ce2282423188a2d2ed0
Headers show
Series [v3] ALSA: hda/realtek: Add special fixup for Lenovo 14IRP8 | expand

Commit Message

Willian Wang Feb. 24, 2024, 4:11 p.m. UTC
Lenovo Slim/Yoga Pro 9 14IRP8 requires a special fixup because there is
a collision of its PCI SSID (17aa:3802) with Lenovo Yoga DuetITL 2021
codec SSID.

Fixes: 3babae915f4c ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=208555
Link: https://lore.kernel.org/all/d5b42e483566a3815d229270abd668131a0d9f3a.camel@irl.hu
Cc: stable@vger.kernel.org
Signed-off-by: Willian Wang <git@willian.wang>
---
 sound/pci/hda/patch_realtek.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

Comments

Gergo Koteles Feb. 25, 2024, 2:51 a.m. UTC | #1
On Sat, 2024-02-24 at 13:11 -0300, Willian Wang wrote:
> Lenovo Slim/Yoga Pro 9 14IRP8 requires a special fixup because there is
> a collision of its PCI SSID (17aa:3802) with Lenovo Yoga DuetITL 2021
> codec SSID.
> 
> Fixes: 3babae915f4c ("ALSA: hda/tas2781: Add tas2781 HDA driver")
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=208555
> Link: https://lore.kernel.org/all/d5b42e483566a3815d229270abd668131a0d9f3a.camel@irl.hu
> Cc: stable@vger.kernel.org
> Signed-off-by: Willian Wang <git@willian.wang>

Reviewed-by: Gergo Koteles <soyer@irl.hu>

> ---
>  sound/pci/hda/patch_realtek.c | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 0ec1312bffd5..f3b847f38153 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -7444,6 +7444,7 @@ enum {
>  	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
>  	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
>  	ALC298_FIXUP_LENOVO_C940_DUET7,
> +	ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
>  	ALC287_FIXUP_13S_GEN2_SPEAKERS,
>  	ALC256_FIXUP_SET_COEF_DEFAULTS,
>  	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
> @@ -7495,6 +7496,26 @@ static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
>  	__snd_hda_apply_fixup(codec, id, action, 0);
>  }
>  
> +/* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
> + * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
> + * so we need to apply a different fixup in this case. The only DuetITL codec
> + * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
> + * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
> + * have matched correctly by their codecs.
> + */
> +static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
> +					      const struct hda_fixup *fix,
> +					      int action)
> +{
> +	int id;
> +
> +	if (codec->core.subsystem_id == 0x17aa3802)
> +		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
> +	else
> +		id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
> +	__snd_hda_apply_fixup(codec, id, action, 0);
> +}
> +
>  static const struct hda_fixup alc269_fixups[] = {
>  	[ALC269_FIXUP_GPIO2] = {
>  		.type = HDA_FIXUP_FUNC,
> @@ -9379,6 +9400,10 @@ static const struct hda_fixup alc269_fixups[] = {
>  		.type = HDA_FIXUP_FUNC,
>  		.v.func = alc298_fixup_lenovo_c940_duet7,
>  	},
> +	[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
> +		.type = HDA_FIXUP_FUNC,
> +		.v.func = alc287_fixup_lenovo_14irp8_duetitl,
> +	},
>  	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
>  		.type = HDA_FIXUP_VERBS,
>  		.v.verbs = (const struct hda_verb[]) {
> @@ -10247,7 +10272,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
>  	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
>  	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
>  	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
> -	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
> +	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
>  	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),
Takashi Iwai Feb. 25, 2024, 8:30 a.m. UTC | #2
On Sat, 24 Feb 2024 17:11:49 +0100,
Willian Wang wrote:
> 
> Lenovo Slim/Yoga Pro 9 14IRP8 requires a special fixup because there is
> a collision of its PCI SSID (17aa:3802) with Lenovo Yoga DuetITL 2021
> codec SSID.
> 
> Fixes: 3babae915f4c ("ALSA: hda/tas2781: Add tas2781 HDA driver")
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=208555
> Link: https://lore.kernel.org/all/d5b42e483566a3815d229270abd668131a0d9f3a.camel@irl.hu
> Cc: stable@vger.kernel.org
> Signed-off-by: Willian Wang <git@willian.wang>

Applied now.  Thanks.


Takashi
diff mbox series

Patch

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 0ec1312bffd5..f3b847f38153 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7444,6 +7444,7 @@  enum {
 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
 	ALC298_FIXUP_LENOVO_C940_DUET7,
+	ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
 	ALC256_FIXUP_SET_COEF_DEFAULTS,
 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
@@ -7495,6 +7496,26 @@  static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
 	__snd_hda_apply_fixup(codec, id, action, 0);
 }
 
+/* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
+ * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
+ * so we need to apply a different fixup in this case. The only DuetITL codec
+ * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
+ * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
+ * have matched correctly by their codecs.
+ */
+static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
+					      const struct hda_fixup *fix,
+					      int action)
+{
+	int id;
+
+	if (codec->core.subsystem_id == 0x17aa3802)
+		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
+	else
+		id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
+	__snd_hda_apply_fixup(codec, id, action, 0);
+}
+
 static const struct hda_fixup alc269_fixups[] = {
 	[ALC269_FIXUP_GPIO2] = {
 		.type = HDA_FIXUP_FUNC,
@@ -9379,6 +9400,10 @@  static const struct hda_fixup alc269_fixups[] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc298_fixup_lenovo_c940_duet7,
 	},
+	[ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc287_fixup_lenovo_14irp8_duetitl,
+	},
 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
 		.type = HDA_FIXUP_VERBS,
 		.v.verbs = (const struct hda_verb[]) {
@@ -10247,7 +10272,7 @@  static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
 	SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
-	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
+	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
 	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),