Skip to contentSkip to conversation

ALSA: hda: set the 2nd headphone's name to be Headphone2

PATCH In review Hui Wang 2 participants 5 messages Mar 5, 2019 – Mar 6, 2019

Subsystems (2)
lore
Share & tools
lore

Hui Wang

author
#0 lore raw

PATCH 1/1 ALSA: hda: set the 2nd headphone's name to be Headphone2

Recently I saw two Headphones on some HP machines, the 1st Headphone comes from the Front Headphone Jack, the 2nd one comes from the Front Headset Jack, and the current HDA driver will set the same name to them and with different index, just like below:
'Headphone Playback Volume'
'Headphone Playback Switch'
'Headphone Playback Volume' index 1
'Headphone Playback Switch' index 1
'Front Headphone Jack'
'Front Headphone Jack' index 1

This can't be handled by pulseaudio, and pulseaduio already has a path analog-output-headphones-2.conf to handle the 2nd headphone, now we set the 2nd headphone's name to "Headphone2", leave the other headphones unchanged.

The change of hda_auto_parser.c will change the name of Jack.

The change of hda_generic.c will change the name of Volume and Switch.

---
The alsa-info.txt before applying this patch:
https://pastebin.ubuntu.com/p/CrPrHRykgT/

The alsa-info.txt after applying this patch:
https://pastebin.ubuntu.com/p/9VbkyvMBkW/

sound/pci/hda/hda_auto_parser.c | 11 +++++++++--

 sound/pci/hda/hda_generic.c     |  2 ++
 2 files changed, 11 insertions(+), 2 deletions(-)
sound/pci/hda/hda_auto_parser.c +9 -2
index df0d636145f8..748c62a9c5eb 100644
@@ -714,6 +714,8 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
 	unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
 	const char *name = NULL;
 	int i;
+	int ret;
+	int index;
 	bool hdmi;
 
 	if (indexp)
@@ -729,8 +731,13 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
 		return fill_audio_out_name(codec, nid, cfg, "Speaker",
 					   label, maxlen, indexp);
 	case AC_JACK_HP_OUT:
-		return fill_audio_out_name(codec, nid, cfg, "Headphone",
-					   label, maxlen, indexp);
+		ret = fill_audio_out_name(codec, nid, cfg, "Headphone",
+					   label, maxlen, &index);
+		if (index == 1)
+			snprintf(label, maxlen, "%s", "Headphone2");
+		if (indexp)
+			*indexp = index;
+		return ret;
 	case AC_JACK_SPDIF_OUT:
 	case AC_JACK_DIG_OTHER_OUT:
 		hdmi = is_hdmi_cfg(def_conf);
sound/pci/hda/hda_generic.c +2 -0
index 4095cd7c56c6..2a34e8a6e2e1 100644
@@ -2175,6 +2175,8 @@ static int create_extra_outs(struct hda_codec *codec, int num_pins,
 
 		if (num_pins == 2 && i == 1 && !strcmp(pfx, "Speaker"))
 			name = "Bass Speaker";
+		else if (num_pins == 2 && i == 1 && !strcmp(pfx, "Headphone"))
+			name = "Headphone2";
 		else if (num_pins >= 3) {
 			snprintf(tmp, sizeof(tmp), "%s %s",
 				 pfx, channel_name[i]);
Signature · 1 line
2.17.1
maintainer
#1 lore raw

Dne 05. 03. 19 v 15:09 Hui Wang napsal(a):

Quoted 11 lines

Recently I saw two Headphones on some HP machines, the 1st Headphone comes from the Front Headphone Jack, the 2nd one comes from the Front Headset Jack, and the current HDA driver will set the same name to them and with different index, just like below:
'Headphone Playback Volume'
'Headphone Playback Switch'
'Headphone Playback Volume' index 1
'Headphone Playback Switch' index 1
'Front Headphone Jack'
'Front Headphone Jack' index 1

Quoted 8 lines

This can't be handled by pulseaudio, and pulseaduio already has a path analog-output-headphones-2.conf to handle the 2nd headphone, now we set the 2nd headphone's name to "Headphone2", leave the other headphones unchanged.

The change of hda_auto_parser.c will change the name of Jack.

The change of hda_generic.c will change the name of Volume and Switch.

NAK. I'm afraid, but you're trying to revert the change from 2009:

commit 668b9652be33510a2a42b290dd335d34d38e2068

Author: Takashi Iwai <[email protected]>
Date:   Fri Mar 6 10:13:24 2009 +0100

ALSA: hda - Create multiple HP / speaker controls with index

Create multiple "Headphone" and "Speaker" controls with non-zero index numbers instead of "Headphone2", etc.

I think that PA should be fixed instead try to fix the drivers. The indexes are exactly designed to distinguish the multiple similar I/O.

I cannot find any other driver which uses the Headphone2 control name.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
author
#2 lore raw
Quoted 31 lines · Jaroslav Kysela

Dne 05. 03. 19 v 15:09 Hui Wang napsal(a):

Quoted 11 lines

Recently I saw two Headphones on some HP machines, the 1st Headphone comes from the Front Headphone Jack, the 2nd one comes from the Front Headset Jack, and the current HDA driver will set the same name to them and with different index, just like below:
'Headphone Playback Volume'
'Headphone Playback Switch'
'Headphone Playback Volume' index 1
'Headphone Playback Switch' index 1
'Front Headphone Jack'
'Front Headphone Jack' index 1

Quoted 8 lines

This can't be handled by pulseaudio, and pulseaduio already has a path analog-output-headphones-2.conf to handle the 2nd headphone, now we set the 2nd headphone's name to "Headphone2", leave the other headphones unchanged.

The change of hda_auto_parser.c will change the name of Jack.

The change of hda_generic.c will change the name of Volume and Switch.

NAK. I'm afraid, but you're trying to revert the change from 2009:

commit 668b9652be33510a2a42b290dd335d34d38e2068

Author: Takashi Iwai <[email protected]>
Date:   Fri Mar 6 10:13:24 2009 +0100

ALSA: hda - Create multiple HP / speaker controls with index

Create multiple "Headphone" and "Speaker" controls with non-zero index numbers instead of "Headphone2", etc.

Quoted 9 lines

I think that PA should be fixed instead try to fix the drivers. The indexes are exactly designed to distinguish the multiple similar I/O.

I cannot find any other driver which uses the Headphone2 control name.

Jaroslav

OK, got it.  I tried to add the index to the pulseaudio in Jan, but not finish yet.  If you have time, please take a look at my patches and make a comment on them.

https://lists.freedesktop.org/archives/pulseaudio-discuss/2019-January/030761.html

Thanks,

Hui.

maintainer
#3 lore raw

Dne 06. 03. 19 v 1:23 Hui Wang napsal(a):

Quoted 39 lines · Jaroslav Kysela
Quoted 38 lines

Dne 05. 03. 19 v 15:09 Hui Wang napsal(a):

Quoted 11 lines

Recently I saw two Headphones on some HP machines, the 1st Headphone comes from the Front Headphone Jack, the 2nd one comes from the Front Headset Jack, and the current HDA driver will set the same name to them and with different index, just like below:
'Headphone Playback Volume'
'Headphone Playback Switch'
'Headphone Playback Volume' index 1
'Headphone Playback Switch' index 1
'Front Headphone Jack'
'Front Headphone Jack' index 1

Quoted 8 lines

This can't be handled by pulseaudio, and pulseaduio already has a path analog-output-headphones-2.conf to handle the 2nd headphone, now we set the 2nd headphone's name to "Headphone2", leave the other headphones unchanged.

The change of hda_auto_parser.c will change the name of Jack.

The change of hda_generic.c will change the name of Volume and Switch.

NAK. I'm afraid, but you're trying to revert the change from 2009:

commit 668b9652be33510a2a42b290dd335d34d38e2068

Author: Takashi Iwai <[email protected]>
Date:   Fri Mar 6 10:13:24 2009 +0100

ALSA: hda - Create multiple HP / speaker controls with index

Create multiple "Headphone" and "Speaker" controls with non-zero index numbers instead of "Headphone2", etc.

I think that PA should be fixed instead try to fix the drivers. The indexes are exactly designed to distinguish the multiple similar I/O.

I cannot find any other driver which uses the Headphone2 control name.

Quoted 7 lines
Quoted 2 lines

Jaroslav

OK, got it.  I tried to add the index to the pulseaudio in Jan, but not finish yet.  If you have time, please take a look at my patches and make a comment on them.

https://lists.freedesktop.org/archives/pulseaudio-discuss/2019-January/030761.html

Your changes seem as a good start. Unfortunately, I don't know PA internals, so it would be better, if a PA developer can review those patches.

Jaroslav

Signature · 6 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
author
#4 lore raw
Quoted 46 lines · Jaroslav Kysela

Dne 06. 03. 19 v 1:23 Hui Wang napsal(a):

Quoted 45 lines · Jaroslav Kysela
Quoted 31 lines

Dne 05. 03. 19 v 15:09 Hui Wang napsal(a):

Quoted 11 lines

Recently I saw two Headphones on some HP machines, the 1st Headphone comes from the Front Headphone Jack, the 2nd one comes from the Front Headset Jack, and the current HDA driver will set the same name to them and with different index, just like below:
'Headphone Playback Volume'
'Headphone Playback Switch'
'Headphone Playback Volume' index 1
'Headphone Playback Switch' index 1
'Front Headphone Jack'
'Front Headphone Jack' index 1

Quoted 8 lines

This can't be handled by pulseaudio, and pulseaduio already has a path analog-output-headphones-2.conf to handle the 2nd headphone, now we set the 2nd headphone's name to "Headphone2", leave the other headphones unchanged.

The change of hda_auto_parser.c will change the name of Jack.

The change of hda_generic.c will change the name of Volume and Switch.

NAK. I'm afraid, but you're trying to revert the change from 2009:

commit 668b9652be33510a2a42b290dd335d34d38e2068

Author: Takashi Iwai <[email protected]>
Date:   Fri Mar 6 10:13:24 2009 +0100

ALSA: hda - Create multiple HP / speaker controls with index

Create multiple "Headphone" and "Speaker" controls with non-zero index numbers instead of "Headphone2", etc.

Quoted 9 lines

I think that PA should be fixed instead try to fix the drivers. The indexes are exactly designed to distinguish the multiple similar I/O.

I cannot find any other driver which uses the Headphone2 control name.

Jaroslav

OK, got it.  I tried to add the index to the pulseaudio in Jan, but not finish yet.  If you have time, please take a look at my patches and make a comment on them.

Quoted 6 lines
Quoted 1 line

https://lists.freedesktop.org/archives/pulseaudio-discuss/2019-January/030761.html

Your changes seem as a good start. Unfortunately, I don't know PA internals, so it would be better, if a PA developer can review those patches.

Jaroslav

OK, Thanks.

_______________________________________________
pulseaudio-discuss mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss