Headphones not detected after fresh boot or suspend/resume cycle, until unplugged and plugged back in

Bug #1442428 reported by Furkan
42
This bug affects 9 people
Affects Status Importance Assigned to Milestone
ALSA driver
Unknown
Unknown
alsa-driver (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

This is a regression from Ubuntu 14.04 (I have not tested 14.10).

Headphones which were already plugged in prior to a suspend/resume cycle or a shutdown/reboot are not detected after a power-on (i.e., "Headphones: Built-in Audio" is absent from the "Output" tab in the Sound Settings). Unplugging the headphones and plugging them back in results in the headphones being detected and automatically selected.

I used the ubuntu-bug tool to submit this bug report after a fresh boot, and after going through the troubleshooting steps (which unsuccessfully attempted to play some tones through the headphone jack), "Headphones" showed up in the Output tab (without me having to unplug them and plug them in again), but was not automatically selected ("Line Out" is selected by default). Manually selecting "Headphones" succeeded in enabling sound on the headphones. So it appears that perhaps pulseaudio does not automatically check for the presence of headphones upon boot or resume from suspend (or maybe it does, but the hardware isn't ready to respond at the time).

ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: alsa-base 1.0.25+dfsg-0ubuntu4
ProcVersionSignature: Ubuntu 3.19.0-13.13~pre201504091631-generic 3.19.3
Uname: Linux 3.19.0-13-generic x86_64
ApportVersion: 2.17-0ubuntu1
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: furkan 2171 F.... pulseaudio
 /dev/snd/controlC0: furkan 2171 F.... pulseaudio
CurrentDesktop: Unity
Date: Thu Apr 9 20:45:11 2015
InstallationDate: Installed on 2014-06-06 (307 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Release amd64 (20140417)
PackageArchitecture: all
SourcePackage: alsa-driver
Symptom: audio
Symptom_AlsaPlaybackTest: ALSA playback test through plughw:SB failed
Symptom_Card: Built-in Audio - HDA ATI SB
Symptom_DevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: furkan 2171 F.... pulseaudio
 /dev/snd/controlC0: furkan 2171 F.... pulseaudio
Symptom_Jack: Green Headphone Out, Front
Symptom_Type: No sound at all
Title: [GA-970A-D3, VIA VT2020, Green Headphone Out, Front] No sound at all
UpgradeStatus: Upgraded to vivid on 2015-03-27 (13 days ago)
dmi.bios.date: 12/16/2013
dmi.bios.vendor: Award Software International, Inc.
dmi.bios.version: F13b
dmi.board.name: GA-970A-D3
dmi.board.vendor: Gigabyte Technology Co., Ltd.
dmi.board.version: x.x
dmi.chassis.type: 3
dmi.chassis.vendor: Gigabyte Technology Co., Ltd.
dmi.modalias: dmi:bvnAwardSoftwareInternational,Inc.:bvrF13b:bd12/16/2013:svnGigabyteTechnologyCo.,Ltd.:pnGA-970A-D3:pvr:rvnGigabyteTechnologyCo.,Ltd.:rnGA-970A-D3:rvrx.x:cvnGigabyteTechnologyCo.,Ltd.:ct3:cvr:
dmi.product.name: GA-970A-D3
dmi.sys.vendor: Gigabyte Technology Co., Ltd.

Revision history for this message
Furkan (falaca) wrote :
Revision history for this message
Raymond (superquad-vortex2) wrote :

ports:
  analog-output-lineout: Line Out (priority 9900, latency offset 0 usec, available: yes)
   properties:

  analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: yes)
   properties:
    device.icon_name = "audio-headphones"
 active port: <analog-output-lineout>

seem both line out and headphone are available but line out has higher priority

Revision history for this message
Raymond (superquad-vortex2) wrote :

does the jack detection correct ?

control.40 {
  iface CARD
  name 'Line Out Front Jack'
  value true
  comment {
   access read
   type BOOLEAN
   count 1
  }
 }
 control.41 {
  iface CARD
  name 'Line Out Surround Jack'
  value false
  comment {
   access read
   type BOOLEAN
   count 1
  }
 }
 control.42 {
  iface CARD
  name 'Line Out CLFE Jack'
  value false
  comment {
   access read
   type BOOLEAN
   count 1
  }
 }
 control.43 {
  iface CARD
  name 'Line Out Side Jack'
  value false
  comment {
   access read
   type BOOLEAN
   count 1
  }
 }
 control.44 {
  iface CARD
  name 'Front Headphone Jack'
  value true
  comment {
   access read
   type BOOLEAN
   count 1
  }
 }

Revision history for this message
Raymond (superquad-vortex2) wrote :

try

 hdajacksenseteet -a

when you plug and unplug headphone

Changed in alsa-driver (Ubuntu):
status: New → Incomplete
Revision history for this message
Furkan (falaca) wrote :

I'm unable to find the "hdajacksensetest" or "hda-jack-sense-test" tool. It seems to be part of the "snd-hda-tools" package which I found on this PPA, but it's not available for vivid: https://launchpad.net/~diwic/+archive/ubuntu/ppa

Any other pointers on where I can get it?

Also, as I mentioned in the initial report, I used ubuntu-bug to file the bug, and it ran some diagnostic tests which ended up detecting the headphone jack, but as you stated the line out has higher priority. But before running the diagnostic tests, the headphone jack is unavailable. I can post some logs of that as well (i.e., after suspend/resume, but not using the ubuntu-bug tool), if you have any in mind that you want me to share.

Revision history for this message
Raymond (superquad-vortex2) wrote :
Revision history for this message
Furkan (falaca) wrote :

Thanks Raymond. I think I got some interesting results.

I ran hdajacksensetest and amixer -c0 contents after a fresh boot (when my headphones were not detected) and ran them again after unplugging and plugging my headphones back in.

hdajacksensetest gave the same result for both tests:

Pin 0x24 (Green Line Out, Rear side): present = Yes
Pin 0x25 (Black Line Out, Rear side): present = No
Pin 0x26 (Orange Line Out, Rear side): present = No
Pin 0x27 (Grey Line Out, Rear side): present = No
Pin 0x28 (Green Headphone, Front side): present = Yes
Pin 0x29 (Pink Mic, Front side): present = No
Pin 0x2a (Blue Line In, Rear side): present = No
Pin 0x2b (Pink Mic, Rear side): present = No

The amixer output changed after unplugging and plugging the headphones back in. I've attached text files showing the before/after output.

Revision history for this message
Furkan (falaca) wrote :

Also, I downgraded from pulseaudio 6.0 to 5.0 using the packages from this PPA: https://launchpad.net/~ubuntu-audio-dev/+archive/ubuntu/pulse-testing?field.series_filter=vivid

And it has fixed the issue. I may try to do a bisect if I get the chance.

Revision history for this message
Raymond (superquad-vortex2) wrote :

Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 42
  Mono:
  Front Left: Playback 0 [0%] [-63.00dB] [off]
  Front Right: Playback 0 [0%] [-63.00dB] [off]

http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa/mixer/paths/analog-output-lineout.conf?id=9d0a5b5cb7ea3adc1b548a6e1e953ee20835e6b6

do pulseaudio switch off headphone playback switch when line out is available ?

Revision history for this message
Raymond (superquad-vortex2) wrote :

http://www.intel.com/support/motherboards/desktop/sb/CS-034206.htm

!!------------

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: VT2020 Analog [VT2020 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: VT2020 Digital [VT2020 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 2: VT2020 Alt Analog [VT2020 Alt Analog]
  Subdevices: 1/1

enable multistreaming (independent hp) disable auto mute

Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Enabled'

Simple mixer control 'Independent HP',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Disabled'

Revision history for this message
Furkan (falaca) wrote :

If I understood your question right, that's exactly what happens:

1) I disconnected my speakers from the rear jack, and plugged my headphones into the front jack. After rebooting, the headphones are detected and the sound works - everything is perfect. I opened the Sound Settings dialog, and "Headphones" are present, "Line Out" is absent.

2) I plugged my speakers into the rear jack, and sound immediately stopped playing from the headphones. But the speakers are also silent, even though they're not muted in the GUI. I try muting and unmuting, switching between headphones and line out in the GUI, but nothing works - neither the speakers, nor the headphones.

3) I unplug the headphones, and the speakers start to work. I plug the headphones back in and they start to work, and the speakers are muted (even if I manually select line out from the GUI).

Now, both my headphones and speakers are plugged in, and I decide to test the original bug again:

4) I reboot my system: No Ubuntu welcome sound (the drum sound when the lightdm greeter appears) is played. But when I log in and get to the desktop, the headphones work. The sound settings GUI shows both headphones and line out, and headphones are selected.

5) I suspend and resume the PC. The headphones stop working, and they are gone from the sound settings GUI.

6) I reboot again: Now, the Ubuntu welcome sound plays from the speakers. Headphones are silent. I log in and check the sound settings GUI: line out is present, headphones are absent. Unplugging and plugging in the headphones makes them detected and selected by default in the GUI, and the headphones start working.

So, to correct my original description: Suspend/shutdown has a different effect from rebooting the system.

Revision history for this message
Raymond (superquad-vortex2) wrote :

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/log/sound/pci/hda/patch_realtek.c?qt=grep&q=gigabyte

all gigabyte motherboard use same pci system id, this mean that any pci quirk of the driver apply to all realtek alc88x codesc

you need to ask the author to use an unique id (e.g. dmi.board.name) for quirk on gigabyte motherboard

Revision history for this message
Raymond (superquad-vortex2) wrote :
Revision history for this message
Raymond (superquad-vortex2) wrote :

1) I disconnected my speakers from the rear jack, and plugged my headphones into the front jack. After rebooting, the headphones are detected and the sound works - everything is perfect. I opened the Sound Settings dialog, and "Headphones" are present, "Line Out" is absent.

2) I plugged my speakers into the rear jack, and sound immediately stopped playing from the headphones. But the speakers are also silent, even though they're not muted in the GUI. I try muting and unmuting, switching between headphones and line out in the GUI, but nothing works - neither the speakers, nor the headphones.

these are pulseaudio bug since you don't have the above patch,

line out jacks are muted by the driver
headphone are muted by pulseaudio

Revision history for this message
Raymond (superquad-vortex2) wrote :

5) I suspend and resume the PC. The headphones stop working, and they are gone from the sound settings GUI.

diff -u alsa_ifo_before_suspend alsa_info_after_resuume

Revision history for this message
Furkan (falaca) wrote :

I have attached:

alsainfo_beforesuspend.txt
alsainfo_aftersuspend.txt
alsadiff.txt

And also the following files, with the jackpoll_ms=400 workaround:

alsainfo_beforesuspend_polling.txt
alsainfo_aftersuspend_polling.txt
alsadiff_withpolling.txt

alsadiff has many more changes, compared to alsadiff_withpolling.

Revision history for this message
matthias (matthias291999) wrote :

Pulse audio is automatically suspending idling devices (module-suspend-on-idle).

Revision history for this message
Furkan (falaca) wrote :
Changed in alsa-driver (Ubuntu):
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.