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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/19/2015 09:10 PM, Takashi Iwai wrote:
On Sat, 19 Dec 2015 05:21:57 +0100,
Mario Kleiner wrote:

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.

Signed-off-by: Mario Kleiner <mario.kleiner.de@xxxxxxxxx>
---
  sound/pci/hda/patch_realtek.c | 32 +++++++++++++++++++++++++++++++-
  1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9bedf7c..6224bdd 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -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;
+	}

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


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

thanks,
-mario



+}
+
  /* 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


_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux