Skip to contentSkip to conversation

ALSA: hda - add mute LED for HP Pavilion 17 (Realtek codec)

PATCH Superseded David Henningsson 2 participants 5 messages Jan 7, 2013 Sound

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ALSA: hda - add mute LED for HP Pavilion 17 (Realtek codec)

The mute LED is in this case connected to the Mic1 VREF.

The machine also exposes the following string in BIOS:
"HP_Mute_LED_0_A", so if more machines are coming, it probably makes sense to try to do something more generic, like for the IDT codec.

---
 sound/pci/hda/patch_realtek.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

I know this is a copy-paste, but I didn't really find a better and more condensed way to do it. Perhaps if we get a third variation it would make sense to write a more generic version.

Also, Alsa-info is available at https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1096789/+attachment/3476010/+files/alsa-info.txt

sound/pci/hda/patch_realtek.c +30 -1
index 6ee3459..2e6803e 100644
@@ -5992,7 +5992,30 @@ static void alc269_fixup_quanta_mute(struct hda_codec *codec,
 	spec->automute_hook = alc269_quanta_automute;
 }
 
-/* update mute-LED according to the speaker mute state via mic2 VREF pin */
+/* update mute-LED according to the speaker mute state via mic VREF pin */
+static void alc269_fixup_mic1_mute_hook(void *private_data, int enabled)
+{
+	struct hda_codec *codec = private_data;
+	unsigned int pinval = AC_PINCTL_IN_EN + (enabled ?
+			      AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80);
+	snd_hda_set_pin_ctl_cache(codec, 0x18, pinval);
+}
+
+static void alc269_fixup_mic1_mute(struct hda_codec *codec,
+				   const struct alc_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+	switch (action) {
+	case ALC_FIXUP_ACT_BUILD:
+		spec->vmaster_mute.hook = alc269_fixup_mic1_mute_hook;
+		snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, true);
+		/* fallthru */
+	case ALC_FIXUP_ACT_INIT:
+		snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
+		break;
+	}
+}
+
 static void alc269_fixup_mic2_mute_hook(void *private_data, int enabled)
 {
 	struct hda_codec *codec = private_data;
@@ -6043,6 +6066,7 @@ enum {
 	ALC269_FIXUP_DMIC,
 	ALC269VB_FIXUP_AMIC,
 	ALC269VB_FIXUP_DMIC,
+	ALC269_FIXUP_MIC1_MUTE_LED,
 	ALC269_FIXUP_MIC2_MUTE_LED,
 	ALC269_FIXUP_INV_DMIC,
 	ALC269_FIXUP_LENOVO_DOCK,
@@ -6171,6 +6195,10 @@ static const struct alc_fixup alc269_fixups[] = {
 			{ }
 		},
 	},
+	[ALC269_FIXUP_MIC1_MUTE_LED] = {
+		.type = ALC_FIXUP_FUNC,
+		.v.func = alc269_fixup_mic1_mute,
+	},
 	[ALC269_FIXUP_MIC2_MUTE_LED] = {
 		.type = ALC_FIXUP_FUNC,
 		.v.func = alc269_fixup_mic2_mute,
@@ -6215,6 +6243,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED),
+	SND_PCI_QUIRK(0x103c, 0x1972, "HP Pavilion 17", ALC269_FIXUP_MIC1_MUTE_LED),
 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC),
 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC),
 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Signature · 1 line
1.7.9.5
#1 lore raw

Sorry for the misleading subject in the previous email. There is only one patch.

Quoted 6 lines · David Henningsson

The mute LED is in this case connected to the Mic1 VREF.

The machine also exposes the following string in BIOS:
"HP_Mute_LED_0_A", so if more machines are coming, it probably makes sense to try to do something more generic, like for the IDT codec.

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#2 lore raw
In reply to David Henningsson

At Mon, 7 Jan 2013 10:51:29 +0100,

Quoted 7 lines · David Henningsson

The mute LED is in this case connected to the Mic1 VREF.

The machine also exposes the following string in BIOS:
"HP_Mute_LED_0_A", so if more machines are coming, it probably makes sense to try to do something more generic, like for the IDT codec.

Interesting. So they still point "A" as the output pin A, not NID 0x0a.

Quoted 10 lines
---
 sound/pci/hda/patch_realtek.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

I know this is a copy-paste, but I didn't really find a better and more condensed way to do it. Perhaps if we get a third variation it would make sense to write a more generic version.

Yes, we can improve it better later.

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

Quoted 12 lines

Also, Alsa-info is available at https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1096789/+attachment/3476010/+files/alsa-info.txt

sound/pci/hda/patch_realtek.c +1 -1
index 6ee3459..2e6803e 100644
@@ -5992,7 +5992,30 @@ static void alc269_fixup_quanta_mute(struct hda_codec *codec,
 	spec->automute_hook = alc269_quanta_automute;
 }
 
-/* update mute-LED according to the speaker mute state via mic2 VREF pin */
+/* update mute-LED according to the speaker mute state via mic VREF pin */

Forgot to restore the comment for alc269_fixup_mic2_mute_hook() below?

Quoted 14 lines
sound/pci/hda/patch_realtek.c +14 -0
+static void alc269_fixup_mic1_mute_hook(void *private_data, int enabled)
+{
+	struct hda_codec *codec = private_data;
+	unsigned int pinval = AC_PINCTL_IN_EN + (enabled ?
+			      AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80);
+	snd_hda_set_pin_ctl_cache(codec, 0x18, pinval);
+}
+
+static void alc269_fixup_mic1_mute(struct hda_codec *codec,
+				   const struct alc_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+	switch (action) {
+	case ALC_FIXUP_ACT_BUILD:

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

Quoted 10 lines
sound/pci/hda/patch_realtek.c +9 -0
+		spec->vmaster_mute.hook = alc269_fixup_mic1_mute_hook;
+		snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, true);
+		/* fallthru */
+	case ALC_FIXUP_ACT_INIT:
+		snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
+		break;
+	}
+}
+
 static void alc269_fixup_mic2_mute_hook(void *private_data, int enabled)

Here...

thanks,

Takashi

Quoted 32 lines
sound/pci/hda/patch_realtek.c +6 -0
 {
 	struct hda_codec *codec = private_data;
@@ -6043,6 +6066,7 @@ enum {
 	ALC269_FIXUP_DMIC,
 	ALC269VB_FIXUP_AMIC,
 	ALC269VB_FIXUP_DMIC,
+	ALC269_FIXUP_MIC1_MUTE_LED,
 	ALC269_FIXUP_MIC2_MUTE_LED,
 	ALC269_FIXUP_INV_DMIC,
 	ALC269_FIXUP_LENOVO_DOCK,
@@ -6171,6 +6195,10 @@ static const struct alc_fixup alc269_fixups[] = {
 			{ }
 		},
 	},
+	[ALC269_FIXUP_MIC1_MUTE_LED] = {
+		.type = ALC_FIXUP_FUNC,
+		.v.func = alc269_fixup_mic1_mute,
+	},
 	[ALC269_FIXUP_MIC2_MUTE_LED] = {
 		.type = ALC_FIXUP_FUNC,
 		.v.func = alc269_fixup_mic2_mute,
@@ -6215,6 +6243,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED),
+	SND_PCI_QUIRK(0x103c, 0x1972, "HP Pavilion 17", ALC269_FIXUP_MIC1_MUTE_LED),
 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC),
 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC),
 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Signature · 1 line
1.7.9.5
#3 lore raw

[removing stable from CC]

Quoted 5 lines · Takashi Iwai

At Mon, 7 Jan 2013 10:51:29 +0100,

Quoted 3 lines · David Henningsson

The mute LED is in this case connected to the Mic1 VREF.

Quoted 7 lines
Quoted 4 lines

The machine also exposes the following string in BIOS:
"HP_Mute_LED_0_A", so if more machines are coming, it probably makes sense to try to do something more generic, like for the IDT codec.

Interesting. So they still point "A" as the output pin A, not NID 0x0a.

The existing quirk seems old; but I don't know if that one has a BIOS string. Would be interesting to know to have something to compare with.

Quoted 23 lines
Quoted 10 lines
---
  sound/pci/hda/patch_realtek.c |   31 ++++++++++++++++++++++++++++++-
  1 file changed, 30 insertions(+), 1 deletion(-)

I know this is a copy-paste, but I didn't really find a better and more condensed way to do it. Perhaps if we get a third variation it would make sense to write a more generic version.

Yes, we can improve it better later.

Quoted 10 lines

Also, Alsa-info is available at https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1096789/+attachment/3476010/+files/alsa-info.txt

sound/pci/hda/patch_realtek.c +0 -0
index 6ee3459..2e6803e 100644
@@ -5992,7 +5992,30 @@ static void alc269_fixup_quanta_mute(struct hda_codec *codec,
  	spec->automute_hook = alc269_quanta_automute;
  }
 
Quoted 4 lines

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

Quoted 2 lines
sound/pci/hda/patch_realtek.c +1 -1
-/* update mute-LED according to the speaker mute state via mic2 VREF pin */
+/* update mute-LED according to the speaker mute state via mic VREF pin */

Forgot to restore the comment for alc269_fixup_mic2_mute_hook() below?

I thought the same comment now could cover both quirks, but I can make one comment for each quirk if that is clearer?

Quoted 67 lines
Quoted 15 lines
sound/pci/hda/patch_realtek.c +14 -0
+static void alc269_fixup_mic1_mute_hook(void *private_data, int enabled)
+{
+	struct hda_codec *codec = private_data;
+	unsigned int pinval = AC_PINCTL_IN_EN + (enabled ?
+			      AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80);
+	snd_hda_set_pin_ctl_cache(codec, 0x18, pinval);
+}
+
+static void alc269_fixup_mic1_mute(struct hda_codec *codec,
+				   const struct alc_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+	switch (action) {
+	case ALC_FIXUP_ACT_BUILD:

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

Quoted 10 lines
sound/pci/hda/patch_realtek.c +9 -0
+		spec->vmaster_mute.hook = alc269_fixup_mic1_mute_hook;
+		snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, true);
+		/* fallthru */
+	case ALC_FIXUP_ACT_INIT:
+		snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
+		break;
+	}
+}
+
  static void alc269_fixup_mic2_mute_hook(void *private_data, int enabled)

Here...

thanks,

Takashi

Quoted 32 lines
sound/pci/hda/patch_realtek.c +6 -1
  {
  	struct hda_codec *codec = private_data;
@@ -6043,6 +6066,7 @@ enum {
  	ALC269_FIXUP_DMIC,
  	ALC269VB_FIXUP_AMIC,
  	ALC269VB_FIXUP_DMIC,
+	ALC269_FIXUP_MIC1_MUTE_LED,
  	ALC269_FIXUP_MIC2_MUTE_LED,
  	ALC269_FIXUP_INV_DMIC,
  	ALC269_FIXUP_LENOVO_DOCK,
@@ -6171,6 +6195,10 @@ static const struct alc_fixup alc269_fixups[] = {
  			{ }
  		},
  	},
+	[ALC269_FIXUP_MIC1_MUTE_LED] = {
+		.type = ALC_FIXUP_FUNC,
+		.v.func = alc269_fixup_mic1_mute,
+	},
  	[ALC269_FIXUP_MIC2_MUTE_LED] = {
  		.type = ALC_FIXUP_FUNC,
  		.v.func = alc269_fixup_mic2_mute,
@@ -6215,6 +6243,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
  	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
  	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
  	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED),
+	SND_PCI_QUIRK(0x103c, 0x1972, "HP Pavilion 17", ALC269_FIXUP_MIC1_MUTE_LED),
  	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC),
  	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC),
  	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
--

1.7.9.5

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#4 lore raw

At Mon, 07 Jan 2013 11:53:38 +0100,

Quoted 43 lines · David Henningsson

[removing stable from CC]

Quoted 5 lines · Takashi Iwai

At Mon, 7 Jan 2013 10:51:29 +0100,

Quoted 3 lines · David Henningsson

The mute LED is in this case connected to the Mic1 VREF.

Quoted 7 lines
Quoted 4 lines

The machine also exposes the following string in BIOS:
"HP_Mute_LED_0_A", so if more machines are coming, it probably makes sense to try to do something more generic, like for the IDT codec.

Interesting. So they still point "A" as the output pin A, not NID 0x0a.

The existing quirk seems old; but I don't know if that one has a BIOS string. Would be interesting to know to have something to compare with.

Quoted 23 lines
Quoted 10 lines
---
  sound/pci/hda/patch_realtek.c |   31 ++++++++++++++++++++++++++++++-
  1 file changed, 30 insertions(+), 1 deletion(-)

I know this is a copy-paste, but I didn't really find a better and more condensed way to do it. Perhaps if we get a third variation it would make sense to write a more generic version.

Yes, we can improve it better later.

Quoted 10 lines

Also, Alsa-info is available at https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1096789/+attachment/3476010/+files/alsa-info.txt

sound/pci/hda/patch_realtek.c +0 -0
index 6ee3459..2e6803e 100644
@@ -5992,7 +5992,30 @@ static void alc269_fixup_quanta_mute(struct hda_codec *codec,
  	spec->automute_hook = alc269_quanta_automute;
  }
 
Quoted 7 lines
Quoted 4 lines

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

Quoted 2 lines
sound/pci/hda/patch_realtek.c +1 -1
-/* update mute-LED according to the speaker mute state via mic2 VREF pin */
+/* update mute-LED according to the speaker mute state via mic VREF pin */

Forgot to restore the comment for alc269_fixup_mic2_mute_hook() below?

I thought the same comment now could cover both quirks, but I can make one comment for each quirk if that is clearer?

Yes, please. It's not so obvious that the comment covers both functions.

Takashi

Quoted 74 lines
Quoted 67 lines
Quoted 15 lines
sound/pci/hda/patch_realtek.c +14 -0
+static void alc269_fixup_mic1_mute_hook(void *private_data, int enabled)
+{
+	struct hda_codec *codec = private_data;
+	unsigned int pinval = AC_PINCTL_IN_EN + (enabled ?
+			      AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80);
+	snd_hda_set_pin_ctl_cache(codec, 0x18, pinval);
+}
+
+static void alc269_fixup_mic1_mute(struct hda_codec *codec,
+				   const struct alc_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+	switch (action) {
+	case ALC_FIXUP_ACT_BUILD:

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

Quoted 10 lines
sound/pci/hda/patch_realtek.c +9 -0
+		spec->vmaster_mute.hook = alc269_fixup_mic1_mute_hook;
+		snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, true);
+		/* fallthru */
+	case ALC_FIXUP_ACT_INIT:
+		snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
+		break;
+	}
+}
+
  static void alc269_fixup_mic2_mute_hook(void *private_data, int enabled)

Here...

thanks,

Takashi

Quoted 32 lines
sound/pci/hda/patch_realtek.c +6 -1
  {
  	struct hda_codec *codec = private_data;
@@ -6043,6 +6066,7 @@ enum {
  	ALC269_FIXUP_DMIC,
  	ALC269VB_FIXUP_AMIC,
  	ALC269VB_FIXUP_DMIC,
+	ALC269_FIXUP_MIC1_MUTE_LED,
  	ALC269_FIXUP_MIC2_MUTE_LED,
  	ALC269_FIXUP_INV_DMIC,
  	ALC269_FIXUP_LENOVO_DOCK,
@@ -6171,6 +6195,10 @@ static const struct alc_fixup alc269_fixups[] = {
  			{ }
  		},
  	},
+	[ALC269_FIXUP_MIC1_MUTE_LED] = {
+		.type = ALC_FIXUP_FUNC,
+		.v.func = alc269_fixup_mic1_mute,
+	},
  	[ALC269_FIXUP_MIC2_MUTE_LED] = {
  		.type = ALC_FIXUP_FUNC,
  		.v.func = alc269_fixup_mic2_mute,
@@ -6215,6 +6243,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
  	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
  	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
  	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED),
+	SND_PCI_QUIRK(0x103c, 0x1972, "HP Pavilion 17", ALC269_FIXUP_MIC1_MUTE_LED),
  	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC),
  	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC),
  	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
--

1.7.9.5

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic