Bug 70865 - analog-output-speaker not working anymore when headphone is plugged
Summary: analog-output-speaker not working anymore when headphone is plugged
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL: Z
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-25 14:45 UTC by Knuth Posern
Modified: 2018-07-30 10:26 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
(2.) Test with headphone/lineout plugged (in front) -- client-side + pulseaudio output (12.63 KB, application/x-gzip)
2013-10-25 14:50 UTC, Knuth Posern
Details
(1.) Test with no audio cables plugged -- client-side + pulseaudio output (12.62 KB, application/x-gzip)
2013-10-25 14:50 UTC, Knuth Posern
Details

Description Knuth Posern 2013-10-25 14:45:24 UTC
HP desktop pc with audio line-out / headphone jack in front and rear AND a built-in mono speaker.

Hardware: 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02)

Debian wheezy stable system with pulseaudio 2.0-6.1

With alsa there is a ""Simple mixer control 'Independent HP'" if set to
  * "Enable", sound is /only/ audible through the built-in speaker
  * "Disable", sound is /only/ audible through the connected headphone/line-out

With pulseaudio (thanks a lot to poljar #pulseaudio IRC !):
 (1.) If I unplug any line-out audio cable aka headphone cables, then
      * pactl set-sink-port 0 analog-output-headphones
        Makes sound only be audible through the built-in internal mono speaker
      * pactl set-sink-port 0 analog-output-speaker
        Makes no sound audible (which seems to be exactly how it should be :)

 (2.) If I plug an headphone cable either rear or front, then:
      * pactl set-sink-port 0 analog-output-headphones
        Makes sound /only/ be audible through the plugged headphone/line-out
BUT:
      * pactl set-sink-port 0 analog-output-speaker
        Makes sound /only/ be audible through the plugged headphone/line-out TOO

<poljar> statement: that sounds wrong, analog-output-speaker should either tagged as not available if the hardware prevents it to output to the speaker while something is connected or it should work, so feel free to report a bug

I created for both cases (1.) and (2.) the pulseaudio-output and the client-output. I hope you find them useful. Please let me know if you need anything else.

The system is a headless server system.
pulseaudio is running as user pulse

To get the pulseaudio-output it ran like this (debian default with changed --log-target and added -vvvvvv):

/usr/bin/pulseaudio -vvvvvv --system --disallow-exit --daemonize --log-target=file:/tmp/pulseaudio.log --high-priority --disallow-module-loading=1

So unter pulse I did not find any way yet to use the built-in speaker for sound-output when I have a headphone/line-out plugged.
Even though under alsa I am able to toggle the output to come through the built-in speaker and with or without a headphone/line-out plugged!

This is bugging me, because I have my stereo plugged all the time to the system, but it ONLY gets turned on, when I need it. So important system notifications should be played through speaker.

Please help :)

Thanks a lot in advance !

Tormen.
Comment 1 Knuth Posern 2013-10-25 14:50:10 UTC
Created attachment 88110 [details]
(2.) Test with headphone/lineout plugged (in front) -- client-side + pulseaudio output
Comment 2 Knuth Posern 2013-10-25 14:50:54 UTC
Created attachment 88111 [details]
(1.) Test with no audio cables plugged -- client-side + pulseaudio output
Comment 3 Raymond 2013-10-26 01:33:11 UTC
post the output of alsa-info.sh
Comment 4 Knuth Posern 2013-10-26 09:59:00 UTC
alsa-info.sh (without pulseaudio running):

http://www.alsa-project.org/db/?f=2511d529b16298e39ca4d5e5db2daf94bba8a794
Comment 5 Raymond 2013-10-27 03:49:08 UTC
this seem to be Front Playback Volume and Switch instead of PCM Playback Volume and Switch



Node 0x12 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Control: name="PCM Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Line Out Jack", index=0, device=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0001001f: OUT HP EAPD Detect Trigger ImpSense
  EAPD 0x2: EAPD
  Pin Default 0x01014010: [Jack] Line Out at Ext Rear
    Conn = 1/8, Color = Green
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=02, enabled=1
  Power states:  D0 D3
  Power: setting=D0, actual=D0
  Connection: 1
     0x0a

Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Speaker Only' 'Line Out Speaker'
  Item0: 'Line Out Speaker'
Comment 6 Raymond 2013-10-27 06:27:27 UTC
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-output-desktop-speaker.conf


 do pulseaudio need to differentate desktop speaker from notebook speaker ?
Comment 7 Knuth Posern 2013-10-29 08:29:21 UTC
Hi,

>  do pulseaudio need to differentate desktop speaker from notebook speaker ?

Are you suggesting that pulseaudio would need to differentiate between desktop speaker and notebook speaker to work properly?

And is this question meant for me to answer ? - I am having this problem on a desktop PC. Otherwise unfortunately I would not know what to answer you.

Also I am not sure that I understand the implications of your Comment #5:
https://bugs.freedesktop.org/show_bug.cgi?id=70865#c5

So .... my system implements a "Front Playback Volume and Switch" instead of "PCM Playback Volume and Switch" and this is what breaks it for me ?

Did you come to a conclusion? Do you need more input?

Thanks a lot for your guidance!

Tormen
Comment 8 Raymond 2013-10-30 01:10:49 UTC
Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Speaker Only' 'Line Out Speaker'
  Item0: 'Line Out Speaker'

the headphone Jack and line out Jack detection control return the state of the the Jack (plugged or unplugged)


pulseaudio use headphone Jack kcontrol to mute speaker volume

http://cgit.freedesktop.org/pulseaudio/pulseaudio/plain/src/modules/alsa/mixer/paths/analog-output-headphones.conf


[Element Speaker]
switch = off
volume = off

it also use line out front Jack kcontrol to mute speaker

http://cgit.freedesktop.org/pulseaudio/pulseaudio/plain/src/modules/alsa/mixer/paths/analog-output-lineout.conf

[Element Speaker]
switch = mute
volume = off
Comment 9 Raymond 2013-10-30 01:11:15 UTC
Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Speaker Only' 'Line Out Speaker'
  Item0: 'Line Out Speaker'

the headphone Jack and line out Jack detection control return the state of the the Jack (plugged or unplugged)


pulseaudio use headphone Jack kcontrol to mute speaker volume

http://cgit.freedesktop.org/pulseaudio/pulseaudio/plain/src/modules/alsa/mixer/paths/analog-output-headphones.conf


[Element Speaker]
switch = off
volume = off

it also use line out front Jack kcontrol to mute speaker

http://cgit.freedesktop.org/pulseaudio/pulseaudio/plain/src/modules/alsa/mixer/paths/analog-output-lineout.conf

[Element Speaker]
switch = mute
volume = off
Comment 10 Raymond 2013-10-30 07:07:23 UTC
As pulseaudio did not have any conf file to use "PCM Playback Switch"


better to name the playback switch to Front instead of PCM when the mute is at pin complex of Line Out


/* give some appropriate ctl name prefix for the given line out channel */
static const char *get_line_out_pfx(struct hda_codec *codec, int ch,
				    int *index, int ctl_type)
{
	struct hda_gen_spec *spec = codec->spec;
	struct auto_pin_cfg *cfg = &spec->autocfg;
+	struct nid_path *path;
+	hda_nid_t nid;
+
+	if (ctl_type == NID_PATH_MUTE_CTL) {
+		path = snd_hda_get_path_from_idx(codec, spec->out_paths[ch]);
+		nid = path->ctls[ctl_type] & 0x3f;
+		if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_PIN)
+			return channel_name[ch];
+	}
Comment 11 Raymond 2013-11-03 08:20:50 UTC
Line Out has PCM playback switch is due to this patch

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_generic.c?id=247d85ee068610c50d66ee0cd3130e02c69f5f2e


volume is ok but mute switch is not shared by two outputs ( at least on hp dc5800)


 /* for a single channel output, we don't have to name the channel */
 if (cfg->line_outs == 1 && !spec->multi_ios)
- return "PCM";
+ return (ctl_type == NID_PATH_MUTE_CTL) ? channel_name[ch] : "PCM";
Comment 12 Raymond 2013-11-15 00:32:45 UTC
With alsa there is a ""Simple mixer control 'Independent HP'" if set to
  * "Enable", sound is /only/ audible through the built-in speaker
  * "Disable", sound is /only/ audible through the connected headphone/line-out

as pulseaudio only use device 0 for analog playback, 

when independent HP is on , HP is only  used for alt analog device 2 (auto mute of speaker by headphone is disabled)

when independent HP is off, HP is used by analog device 0

if your external speaker is always plugged into line out,  


do you mean you want the internal speaker only auto muted by headphone but not by line out ?




APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD1884 Analog [AD1884 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: AD1884 Alt Analog [AD1884 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0




Node 0x03 [Audio Output] wcaps 0x405: Stereo Amp-Out
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="AD1884 Alt Analog", type="Audio", device=2
  Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0
  Amp-Out vals:  [0x27 0x27]
  Converter: stream=0, channel=0
  Power states:  D0 D3
  Power: setting=D0, actual=D0
Node 0x04 [Audio Output] wcaps 0x405: Stereo Amp-Out
  Control: name="PCM Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="AD1884 Analog", type="Audio", device=0
  Amp-Out caps: ofs=0x27, nsteps=0x27, stepsize=0x05, mute=0
  Amp-Out vals:  [0x27 0x27]
  Converter: stream=0, channel=0
  Power states:  D0 D3
  Power: setting=D0, actual=D0
Comment 13 GitLab Migration User 2018-07-30 10:26:53 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/426.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.