diff mbox series

ALSA: hda/realtek: Add quirk for HP Spectre x360 14 eu0000

Message ID 65d6986c-3152-417b-aa17-543224aca2a8@cpp.in (mailing list archive)
State Superseded
Headers show
Series ALSA: hda/realtek: Add quirk for HP Spectre x360 14 eu0000 | expand

Commit Message

Anthony I Gilea March 17, 2024, 2:38 a.m. UTC
Connect two CS35L41 amps on I2C bus with HDA.
Fix pincfgs.
Fix bass speakers connecting to a wrong DAC.
Fix mute and micmute LEDs.

Signed-off-by: Anthony I Gilea <i@cpp.in>
---
  sound/pci/hda/patch_realtek.c | 38 ++++++++++++++++++++++++++++++++++++++
  1 file changed, 38 insertions(+)
diff mbox series

Patch

diff --ruNp a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
--- a/sound/pci/hda/patch_realtek.c	2024-03-10 23:38:09.000000000 +0300
+++ b/sound/pci/hda/patch_realtek.c	2024-03-17 03:36:42.305164663 +0300
@@ -7204,6 +7204,38 @@  static void alc_fixup_headset_mic(struct
  	}
  }

+static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,
+					  const struct hda_fixup *fix, int action)
+{
+	/*
+	 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
+	 * unconnected.
+	 * The Pin Complex 0x17 for the bass speakers has the lowest association
+	 * and sequence values so shift it up a bit to squeeze 0x14 in.
+	 */
+	static const struct hda_pintbl pincfgs[] = {
+		{ 0x14, 0x90170110 }, // top/treble
+		{ 0x17, 0x90170111 }, // bottom/bass
+		{ }
+	};
+
+	/*
+	 * Force DAC 0x02 for the bass speakers 0x17.
+	 */
+	static const hda_nid_t conn[] = { 0x02 };
+
+	switch (action) {
+	case HDA_FIXUP_ACT_PRE_PROBE:
+		snd_hda_apply_pincfgs(codec, pincfgs);
+		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
+		break;
+	}
+
+	cs35l41_fixup_i2c_two(codec, fix, action);
+	alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
+	alc245_fixup_hp_gpio_led(codec, fix, action);
+}
+

  enum {
  	ALC269_FIXUP_GPIO2,
@@ -7478,6 +7510,7 @@  enum {
  	ALC2XX_FIXUP_HEADSET_MIC,
  	ALC289_FIXUP_DELL_CS35L41_SPI_2,
  	ALC294_FIXUP_CS35L41_I2C_2,
+	ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX,
  };

  /* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -9655,6 +9688,10 @@  static const struct hda_fixup alc269_fix
  		.type = HDA_FIXUP_FUNC,
  		.v.func = cs35l41_fixup_i2c_two,
  	},
+	[ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc245_fixup_hp_spectre_x360_eu0xxx,
+	},
  };

  static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -9989,6 +10026,7 @@  static const struct snd_pci_quirk alc269
  	SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
  	SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
  	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
+	SND_PCI_QUIRK(0x103c, 0x8c15, "HP Spectre x360 2-in-1 Laptop 14-eu0xxx", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
  	SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
  	SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
  	SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),