[alsa-devel] line-out mute on "phantom" HP jack (Via codec)
Hi,
On Via codecs reported on https://bugs.launchpad.net/bugs/1052499, while investigating the report, it can be seen that on Headphone pin the plug is not detectable (NO_PRESENCE). It could be that front panel is AC97 wiring or something else, I don't know. But it makes the jack detection handling code to add the headphone jack as "phantom", which makes snd_hda_jack_detect return headphone jack as always present (commit 80c8bfbe768 is applied/cherry-picked on the reported kernel).
Thus after jacks are added, the automute code will always detect HP as present, and keep muted all line-outs. The proposed solution following this is using is_jack_detectable inside via_hp_automute to handle this, other codecs seem to use also is_jack_detectable at the moment in similar situations. Other approach could be also to not report presence on phantom jacks with HP or Line Outs.
-- []'s Herton
If headphone jack can't detect plug presence, and we have the jack in the jack table, snd_hda_jack_detect will return the plug as always present (as it'll be considered as a phantom jack). The problem is that when this happens, line out pins will always be disabled, resulting in no sound if there are no headphones connected.
This was reported as a no sound problem after suspend on http://bugs.launchpad.net/bugs/1052499, since the bug doesn't manifests on first initialization before the phantom jack is added, but on resume we reexecute the initialization code, and via_hp_automute starts reporting HP always present with the jack now on the table.
BugLink: https://bugs.launchpad.net/bugs/1052499 Signed-off-by: Herton Ronaldo Krzesinski herton.krzesinski@canonical.com --- sound/pci/hda/patch_via.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index ea28667..64b1257 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -1672,7 +1672,8 @@ static void via_hp_automute(struct hda_codec *codec) struct via_spec *spec = codec->spec;
if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] && - (spec->codec_type != VT1708 || spec->vt1708_jack_detect)) + (spec->codec_type != VT1708 || spec->vt1708_jack_detect) && + is_jack_detectable(codec, spec->autocfg.hp_pins[0])) present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
if (spec->smart51_enabled)
At Fri, 21 Sep 2012 20:45:19 -0300, Herton Ronaldo Krzesinski wrote:
If headphone jack can't detect plug presence, and we have the jack in the jack table, snd_hda_jack_detect will return the plug as always present (as it'll be considered as a phantom jack). The problem is that when this happens, line out pins will always be disabled, resulting in no sound if there are no headphones connected.
This was reported as a no sound problem after suspend on http://bugs.launchpad.net/bugs/1052499, since the bug doesn't manifests on first initialization before the phantom jack is added, but on resume we reexecute the initialization code, and via_hp_automute starts reporting HP always present with the jack now on the table.
BugLink: https://bugs.launchpad.net/bugs/1052499 Signed-off-by: Herton Ronaldo Krzesinski herton.krzesinski@canonical.com
Thanks, applied now.
Takashi
sound/pci/hda/patch_via.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index ea28667..64b1257 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -1672,7 +1672,8 @@ static void via_hp_automute(struct hda_codec *codec) struct via_spec *spec = codec->spec;
if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] &&
(spec->codec_type != VT1708 || spec->vt1708_jack_detect))
(spec->codec_type != VT1708 || spec->vt1708_jack_detect) &&
is_jack_detectable(codec, spec->autocfg.hp_pins[0]))
present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
if (spec->smart51_enabled)
-- 1.7.9.5
2012-9-22 上午7:45 於 "Herton Ronaldo Krzesinski" < herton.krzesinski@canonical.com> 寫道:
Hi,
On Via codecs reported on https://bugs.launchpad.net/bugs/1052499, while investigating the report, it can be seen that on Headphone pin the plug is not detectable (NO_PRESENCE). It could be that front panel is AC97 wiring or something else, I don't know. But it makes the jack detection handling code to add the headphone jack as "phantom", which makes snd_hda_jack_detect return headphone jack as always present (commit 80c8bfbe768 is applied/cherry-picked on the reported kernel).
Thus after jacks are added, the automute code will always detect HP as present, and keep muted all line-outs. The proposed solution following this is using is_jack_detectable inside via_hp_automute to handle this, other codecs seem to use also is_jack_detectable at the moment in similar situations. Other approach could be also to not report presence on phantom jacks with HP or Line Outs.
Most VIA codecs support independent headphone which allow user to play different audio streams to rear panel jack and front panel headphone.
if independent headphone switch is ON, pulseaudio should not mute the rear line out
APLAY
**** List of PLAYBACK Hardware Devices **** card 0: NVidia [HDA NVidia], device 0: VT1705 Analog [VT1705 Analog] Subdevices: 0/1 Subdevice #0: subdevice #0 card 0: NVidia [HDA NVidia], device 2: VT1705 HP [VT1705 HP] Subdevices: 1/1 Subdevice #0: subdevice #0
participants (3)
-
Herton Ronaldo Krzesinski
-
Raymond Yau
-
Takashi Iwai