Bug 96237

Summary: Unplugging jack from Line Out removes Line Out as Port. pulseaudio -k necessary to fix it
Product: PulseAudio Reporter: f1ght3r <f1ght3r>
Component: modulesAssignee: pulseaudio-bugs
Status: RESOLVED DUPLICATE QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: pulseaudio -k && pulseaudio -vvvv 2>&1 | tee pulseaudio.log
alsa-info.sh output

Description f1ght3r 2016-05-27 07:34:26 UTC
Created attachment 124122 [details]
pulseaudio -k && pulseaudio -vvvv 2>&1 | tee pulseaudio.log

When using pulseaudio, everything works normal as expected - aside from the fact that plasma/kde5 isn't able to save the default output device in its system settings -.

Music can be played. If the jack is then unplugged from the Line Out port and reattached again, the Port Line Out is no longer available as a port that can be selected, neither via pavucontrol nor any other means that i know of.

To get the port back, pulseaudio has to be killed, i.e. pulseaudio -k. Afterwards it will work again until the jack is removed and everything begins again.

Full log attached:
pulseaudio -k && pulseaudio -vvvv 2>&1 | tee pulseaudio.log

alsa-info.sh output attached.

uname -a:
Linux _HOSTNAME_ 4.3.3-gentoo #3 SMP Thu Mar 31 10:51:14 CEST 2016 x86_64 Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz GenuineIntel GNU/Linux

plasma 5.6.4, kde-applications 16.04.1, kde-framework 5.22.0
Comment 1 f1ght3r 2016-05-27 07:35:26 UTC
Created attachment 124123 [details]
alsa-info.sh output
Comment 2 f1ght3r 2016-05-27 07:46:14 UTC
I forgot to mention, this problem appeared when switching from pulseaudio 7.0 to 8.0. Also i tried it before, when plasma and kde was on the version before the one i'm currently using: plasma-5.5.5 kde-frameworks-5.21 kde-applications-15.12.3.

Downgrading to pulseaudio 7.0 solved the problem then.
Comment 3 Raymond 2016-05-27 08:52:56 UTC
D: [pulseaudio] module-alsa-card.c: Jack 'Line Out Front Jack' is now unplugged
D: [pulseaudio] device-port.c: Setting port analog-output-lineout to status no
D: [pulseaudio] module-switch-on-port-available.c: Trying to switch away from port analog-output-lineout, found iec958-stereo-output
D: [pulseaudio] module-switch-on-port-available.c: Trying to switch to port iec958-stereo-output
D: [pulseaudio] module-switch-on-port-available.c: Finding best profile for port iec958-stereo-output, preferred = (null)
D: [pulseaudio] sink-input.c: Starting to move sink input 0 from 'alsa_output.pci-0000_00_1b.0.analog-stereo'
D: [alsa-sink-ALC892 Analog] alsa-sink.c: Latency set to 40,00ms
D: [alsa-sink-ALC892 Analog] alsa-sink.c: hwbuf_unused=58480
D: [alsa-sink-ALC892 Analog] alsa-sink.c: setting avail_min=15062
I: [pulseaudio] source-output.c: Freeing output 3 "Ausschlagsserkennung"
D: [alsa-sink-ALC892 Analog] sink-input.c: Have to rewind 6924 bytes on render memblockq.
D: [alsa-sink-ALC892 Analog] sink-input.c: Have to rewind 6924 bytes on implementor.
D: [alsa-sink-ALC892 Analog] alsa-sink.c: Latency set to 40,00ms
D: [alsa-sink-ALC892 Analog] alsa-sink.c: hwbuf_unused=58480
D: [alsa-sink-ALC892 Analog] alsa-sink.c: setting avail_min=15062
D: [alsa-sink-ALC892 Analog] sink.c: Requesting rewind due to started move
D: [alsa-sink-ALC892 Analog] alsa-sink.c: Requested volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
D: [alsa-sink-ALC892 Analog] alsa-sink.c: Got hardware volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
D: [alsa-sink-ALC892 Analog] alsa-sink.c: Calculated software volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB (accurate-enough=yes)
D: [alsa-sink-ALC892 Analog] sink.c: Volume not changing
D: [alsa-sink-ALC892 Analog] alsa-sink.c: Requested to rewind 65536 bytes.
D: [alsa-sink-ALC892 Analog] alsa-sink.c: Limited to 6672 bytes.
D: [alsa-sink-ALC892 Analog] alsa-sink.c: before: 1668
D: [alsa-sink-ALC892 Analog] alsa-sink.c: after: 1668
D: [alsa-sink-ALC892 Analog] alsa-sink.c: Rewound 6672 bytes.
D: [alsa-sink-ALC892 Analog] sink.c: Processing rewind...
D: [alsa-sink-ALC892 Analog] sink.c: latency = 1292
D: [alsa-sink-ALC892 Analog] source.c: Processing rewind...
D: [pulseaudio] module-rescue-streams.c: No sink inputs to move away.
D: [pulseaudio] module-rescue-streams.c: No evacuation source found.
D: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.pci-0000_00_1b.0.analog-stereo becomes idle, timeout in 5 seconds.
I: [pulseaudio] source-output.c: Freeing output 1 "Ausschlagsserkennung"
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove event.
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to remove event.
D: [alsa-sink-ALC892 Analog] alsa-sink.c: Thread shutting down
I: [pulseaudio] sink.c: Freeing sink 1 "alsa_output.pci-0000_00_1b.0.analog-stereo"
I: [pulseaudio] source.c: Freeing source 1 "alsa_output.pci-0000_00_1b.0.analog-stereo.monitor"
D: [pulseaudio] alsa-util.c: Trying iec958:0 with SND_PCM_NO_AUTO_FORMAT ...
D: [pulseaudio] alsa-util.c: Managed to open iec958:0
I: [pulseaudio] alsa-util.c: Trying to disable ALSA period wakeups, using timers only
D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 371 ms
D: [pulseaudio] alsa-util.c: Set buffer size first (to 88200 samples), period size second (to 88200 samples).
I: [pulseaudio] alsa-util.c: ALSA period wakeups disabled
I: [pulseaudio] alsa-sink.c: Successfully opened device iec958:0.
I: [pulseaudio] alsa-sink.c: Selected mapping 'Digital Stereo (IEC958)' (iec958-stereo).
Comment 4 Raymond 2016-05-27 08:56:49 UTC
as your three detectable jacks (HDMI, headphone and Line Out) are unplugged, the digital port (SPDIF) become the only port
Comment 5 f1ght3r 2016-05-27 08:58:50 UTC
I unplugged only the green one, standard Line Out, and plugged it back in 2 seconds later. Doesn't matter what kind of device was connected. The logs were cut after the jack had been plugged in for at least 5 seconds.

Afterwards I've found no way to get sound working again via that Line Out port other than killing pulseaudio.
Comment 6 Raymond 2016-05-27 09:13:02 UTC
your five analog audio output node 0x2, 0x03, 0x4, 0x5 ,0x25 and two digital digital output 0x6 and 0x10 are playing concurrently ( Converter: stream=5, channel=0)  when you turn on

Simple mixer control 'IEC958 Default PCM',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]




APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


the digital device 1 should be busy
Comment 7 f1ght3r 2016-05-27 09:16:59 UTC
I'm sorry I can't be more help, but I don't know enough about alsa and pulseaudio. I just know one thing: After the jack has been removed and plugged in again, there is nothing i can do to get music to come out of the device plugged into that slot!

Should I have configured something somewhere that I don't know of, please tell me which configuration files to remove, so I can try to start from default.
Comment 8 Raymond 2016-05-27 09:23:48 UTC
as you turn on "IEC958 default PCM", the digital audio output have same stream tag 5 as those analog audio output


Node 0x06 [Audio Output] wcaps 0x611: Stereo Digital
  Converter: stream=5, channel=0
  Digital: GenLevel
  Digital category: 0x2
  IEC Coding Type: 0x0
  PCM:
    rates [0x5f0]: 32000 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0

Node 0x10 [Audio Output] wcaps 0x611: Stereo Digital
  Control: name="IEC958 Playback Con Mask", index=0, device=0
  Control: name="IEC958 Playback Pro Mask", index=0, device=0
  Control: name="IEC958 Playback Default", index=0, device=0
  Control: name="IEC958 Playback Switch", index=0, device=0
  Control: name="IEC958 Default PCM Playback Switch", index=0, device=0
  Device: name="ALC892 Digital", type="SPDIF", device=1
  Converter: stream=5, channel=0
  Digital: GenLevel
  Digital category: 0x2
  IEC Coding Type: 0x0
  PCM:
    rates [0x5f0]: 32000 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Comment 9 f1ght3r 2016-05-27 09:45:35 UTC
"as you turn on "IEC958 default PCM", the digital audio output have same stream tag 5 as those analog audio output"

I didn't turn anything on or off, i just played music, unplugged Line out to switch from my stereo to headphones (plugged back in) and no music anymore, no port Line Out available anymore.

I just don't understand what I am supposed to do. Please tell me in simple sentences what I need to do to resolve this issue.
Comment 10 Tanu Kaskinen 2016-05-27 10:44:56 UTC
You're probably suffering from this bug:
https://bugs.freedesktop.org/show_bug.cgi?id=93903

This will be fixed in 9.0. In the mean time, you can switch from the digital profile back to analog in pavucontrol's "Configuration" tab. I understand that's very annoying, if this has to be done often, and maybe not any less inconvenient than running "pulseaudio -k".
Comment 11 Tanu Kaskinen 2016-05-27 10:47:03 UTC

*** This bug has been marked as a duplicate of bug 93903 ***
Comment 12 Raymond 2016-05-28 02:50:59 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_codec.c?id=9a08160bdbe3148a405f72798f76e2a5d30bd243


Added a new mixer switch to enable/disable the sharing of the default
PCM stream with analog and SPDIF outputs.  When "IEC958 Default PCM"
switch is on, the PCM stream is routed both to analog and SPDIF outputs.

in theory, the driver have to stop the analog/ digital pcm stream before it start digital pcm sin the two digital audio output already playing and need to stop

the control should be protected similar to 'independent hp switch'

http://www.intel.com/content/www/us/en/support/boards-and-kits/desktop-boards/000007156.html

hda controller support multi streaming, no only headphone and line output play two different stream, you can also play different audio to analog and digital pcm

however the driver still not support playback for two digital audio output, it only treat one as primary and the other as secondary 



Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Front Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="ALC892 Analog", type="Audio", device=0
  Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x40 0x40]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x03 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Surround Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x40 0x40]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x04 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Center Playback Volume", index=0, device=0
    ControlAmp: chs=1, dir=Out, idx=0, ofs=0
  Control: name="LFE Playback Volume", index=0, device=0
    ControlAmp: chs=2, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x40 0x40]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x05 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Side Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x40 0x40]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Comment 13 Raymond 2016-05-28 02:56:23 UTC
asus has optional spdif daughter card for connecting the internal spdif connector , 




Node 0x11 [Pin Complex] wcaps 0x400781: Stereo Digital
  Pincap 0x00000010: OUT
  Pin Default 0x99430140: [Fixed] SPDIF Out at Int ATAPI
    Conn = ATAPI, Color = Unknown
    DefAssociation = 0x4, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x10


Node 0x1e [Pin Complex] wcaps 0x400781: Stereo Digital
  Pincap 0x00000010: OUT
  Pin Default 0x01456130: [Jack] SPDIF Out at Ext Rear
    Conn = Optical, Color = Orange
    DefAssociation = 0x3, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x06
Comment 14 Raymond 2016-05-28 03:05:43 UTC
Turning this switch off has a merit for some codecs, though.  Some codec
chips don't support 24bit formats for SPDIF but only for analog outputs.



Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Front Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="ALC892 Analog", type="Audio", device=0
  Amp-Out caps: ofs=0x40, nsteps=0x40, stepsize=0x03, mute=0
  Amp-Out vals:  [0x40 0x40]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0


Node 0x06 [Audio Output] wcaps 0x611: Stereo Digital
  Converter: stream=5, channel=0
  Digital: GenLevel
  Digital category: 0x2
  IEC Coding Type: 0x0
  PCM:
    rates [0x5f0]: 32000 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Comment 15 Raymond 2016-05-28 03:39:26 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_codec.c?id=5930ca41857f57e130b4438a9a261b2ab91f6fcf

Allow opening the dedicated SPDIF stream while running on analog dup
mode.  Then the SPDIF stream is once reset and assigned for the new
stream.  It's useful for exclusive SPDIF output like AC3/DTS.

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.