Skip to contentSkip to conversation

ALSA: hda/realtek - Fix silent headphone output on MacPro 4, 1

PATCH In review Mario Kleiner 2 participants 3 messages Dec 19, 2015 – Dec 21, 2015 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda/realtek - Fix silent headphone output on MacPro 4, 1

Without this patch, internal speaker and line-out work, but front headphone output jack stays silent on the Mac Pro 4,1.

This code path also gets executed on the MacPro 5,1 due to identical codec SSID, but i don't know if it has any positive or adverse effects there or not.

---
 sound/pci/hda/patch_realtek.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +31 -1
index 9bedf7c..6224bdd 100644
@@ -1755,6 +1755,7 @@ enum {
 	ALC889_FIXUP_MBA11_VREF,
 	ALC889_FIXUP_MBA21_VREF,
 	ALC889_FIXUP_MP11_VREF,
+	ALC889_FIXUP_MP41_VREF,
 	ALC882_FIXUP_INV_DMIC,
 	ALC882_FIXUP_NO_PRIMARY_HP,
 	ALC887_FIXUP_ASUS_BASS,
@@ -1905,6 +1906,29 @@ static void alc889_fixup_mba21_vref(struct hda_codec *codec,
 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
 }
 
+/* Set VREF on HP pin on Mac Pro 4,1 */
+static void alc889_fixup_mp41_vref(struct hda_codec *codec,
+				   const struct hda_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+	static hda_nid_t nids[1] = { 0x19 };
+	int i;
+
+	if (action != HDA_FIXUP_ACT_INIT)
+		return;
+
+	for (i = 0; i < ARRAY_SIZE(nids); i++) {
+		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
+		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
+			continue;
+		val = snd_hda_codec_get_pin_target(codec, nids[i]);
+		val |= AC_PINCTL_VREF_80;
+		snd_hda_set_pin_ctl(codec, nids[i], val);
+		spec->gen.keep_vref_in_automute = 1;
+		break;
+	}
+}
+
 /* Don't take HP output as primary
  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
@@ -2133,6 +2157,12 @@ static const struct hda_fixup alc882_fixups[] = {
 		.chained = true,
 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
 	},
+	[ALC889_FIXUP_MP41_VREF] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc889_fixup_mp41_vref,
+		.chained = true,
+		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
+	},
 	[ALC882_FIXUP_INV_DMIC] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc_fixup_inv_dmic,
@@ -2215,7 +2245,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
-	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
+	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Signature · 1 line
1.9.1
#1 lore raw
Quoted 41 lines · Mario Kleiner

Without this patch, internal speaker and line-out work, but front headphone output jack stays silent on the Mac Pro 4,1.

This code path also gets executed on the MacPro 5,1 due to identical codec SSID, but i don't know if it has any positive or adverse effects there or not.

---
 sound/pci/hda/patch_realtek.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +12 -0
index 9bedf7c..6224bdd 100644
@@ -1755,6 +1755,7 @@ enum {
 	ALC889_FIXUP_MBA11_VREF,
 	ALC889_FIXUP_MBA21_VREF,
 	ALC889_FIXUP_MP11_VREF,
+	ALC889_FIXUP_MP41_VREF,
 	ALC882_FIXUP_INV_DMIC,
 	ALC882_FIXUP_NO_PRIMARY_HP,
 	ALC887_FIXUP_ASUS_BASS,
@@ -1905,6 +1906,29 @@ static void alc889_fixup_mba21_vref(struct hda_codec *codec,
 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
 }
 
+/* Set VREF on HP pin on Mac Pro 4,1 */
+static void alc889_fixup_mp41_vref(struct hda_codec *codec,
+				   const struct hda_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+	static hda_nid_t nids[1] = { 0x19 };
+	int i;
+
+	if (action != HDA_FIXUP_ACT_INIT)
+		return;
+

sound/pci/hda/patch_realtek.c static void alc889_fixup_mba21_vref(struct hda_codec *codec, · line 1929

Quoted 10 lines
sound/pci/hda/patch_realtek.c +10 -0
+	for (i = 0; i < ARRAY_SIZE(nids); i++) {
+		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
+		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
+			continue;
+		val = snd_hda_codec_get_pin_target(codec, nids[i]);
+		val |= AC_PINCTL_VREF_80;
+		snd_hda_set_pin_ctl(codec, nids[i], val);
+		spec->gen.keep_vref_in_automute = 1;
+		break;
+	}

This looks rather like a copy of alc889_fixup_mbp_vref() but with a different vref level. If so, instead of copying, modify the original function to take the vref level instead.

thanks,

Takashi

Quoted 31 lines
sound/pci/hda/patch_realtek.c +9 -1
+}
+
 /* Don't take HP output as primary
  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
@@ -2133,6 +2157,12 @@ static const struct hda_fixup alc882_fixups[] = {
 		.chained = true,
 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
 	},
+	[ALC889_FIXUP_MP41_VREF] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc889_fixup_mp41_vref,
+		.chained = true,
+		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
+	},
 	[ALC882_FIXUP_INV_DMIC] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc_fixup_inv_dmic,
@@ -2215,7 +2245,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
-	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
+	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Signature · 1 line
1.9.1
#2 lore raw
Quoted 59 lines · Takashi Iwai
Quoted 41 lines · Mario Kleiner

Without this patch, internal speaker and line-out work, but front headphone output jack stays silent on the Mac Pro 4,1.

This code path also gets executed on the MacPro 5,1 due to identical codec SSID, but i don't know if it has any positive or adverse effects there or not.

---
  sound/pci/hda/patch_realtek.c | 32 +++++++++++++++++++++++++++++++-
  1 file changed, 31 insertions(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +12 -0
index 9bedf7c..6224bdd 100644
@@ -1755,6 +1755,7 @@ enum {
  	ALC889_FIXUP_MBA11_VREF,
  	ALC889_FIXUP_MBA21_VREF,
  	ALC889_FIXUP_MP11_VREF,
+	ALC889_FIXUP_MP41_VREF,
  	ALC882_FIXUP_INV_DMIC,
  	ALC882_FIXUP_NO_PRIMARY_HP,
  	ALC887_FIXUP_ASUS_BASS,
@@ -1905,6 +1906,29 @@ static void alc889_fixup_mba21_vref(struct hda_codec *codec,
  		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
  }
 
+/* Set VREF on HP pin on Mac Pro 4,1 */
+static void alc889_fixup_mp41_vref(struct hda_codec *codec,
+				   const struct hda_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+	static hda_nid_t nids[1] = { 0x19 };
+	int i;
+
+	if (action != HDA_FIXUP_ACT_INIT)
+		return;
+

sound/pci/hda/patch_realtek.c static void alc889_fixup_mba21_vref(struct hda_codec *codec, · line 1929

Quoted 10 lines
sound/pci/hda/patch_realtek.c +10 -0
+	for (i = 0; i < ARRAY_SIZE(nids); i++) {
+		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
+		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
+			continue;
+		val = snd_hda_codec_get_pin_target(codec, nids[i]);
+		val |= AC_PINCTL_VREF_80;
+		snd_hda_set_pin_ctl(codec, nids[i], val);
+		spec->gen.keep_vref_in_automute = 1;
+		break;
+	}

This looks rather like a copy of alc889_fixup_mbp_vref() but with a different vref level. If so, instead of copying, modify the original function to take the vref level instead.

Quoted 4 lines

thanks,

Takashi

Thanks for the feedback. Just sent out v2 which is simpler and works just as well.

thanks,
-mario

Quoted 32 lines
Quoted 32 lines
sound/pci/hda/patch_realtek.c +9 -2
+}
+
  /* Don't take HP output as primary
   * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
   * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
@@ -2133,6 +2157,12 @@ static const struct hda_fixup alc882_fixups[] = {
  		.chained = true,
  		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
  	},
+	[ALC889_FIXUP_MP41_VREF] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc889_fixup_mp41_vref,
+		.chained = true,
+		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
+	},
  	[ALC882_FIXUP_INV_DMIC] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = alc_fixup_inv_dmic,
@@ -2215,7 +2245,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
  	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
  	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
  	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
-	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
+	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
  	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
  	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
  	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
--

1.9.1