Can't switch between speakers and headphones

Bug #976076 reported by Lalo Martins
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
alsa-driver (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

This is a freshly-installed Precise (from beta2 iso) on an AMD64 custom built computer; the motherboard is an ASRock N68-GE3 UCC, as you can see from the files the chipsets are all NVIDIA. The audio codec is VIA.

Main problem: alsa and pulse's idea of switching between the speakers and headset is wrong. If I open alsamixer and toggle the (problematic, I heard) “Independent HP” switch, that works like a charm; turn it on and I get sound only on the speakers, turn it off and I get sound only on the headset. But nothing else (jack sense, clicking an output on Sound Settings, even muting “Front” by hand) works.

Secondary problem: once that's working, it would be nice if jack sensing would do it automatically.

I tried playing with the “model” flag and even “sense_mask”, but nothing works. I currently reset my alsa-base.conf to factory.

I read many reports telling me to install the latest from ubuntu-audio-dev, but of course there aren't any for precise yet.

Also installed some hda stuff from diwic; hda-jack-retask reports my front pin is a green headphones front pin as it's supposed to be, so I didn't override anything. And hda-jack-sense-test calls it “Green HP Out”; but only lists it with -a.

lalo:~> sudo hda-jack-sense-test -a
Pin 0x24 (Green Line Out): present = Yes
Pin 0x25 (Black Line Out): present = No
Pin 0x26 (Orange Line Out): present = No
Pin 0x27 (Grey Line Out): present = No
Pin 0x28 (Green HP Out): present = Yes
Pin 0x29 (Pink Mic): present = No
Pin 0x2a (Blue Line In): present = No
Pin 0x2b (Pink Mic): present = No
Pin 0x2c (Internal CD): present = No
Pin 0x2d (Not connected): present = No
Pin 0x2e (Not connected): present = No
Pin 0x2f (Not connected): present = No

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: alsa-base 1.0.25+dfsg-0ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-22.35-generic 3.2.14
Uname: Linux 3.2.0-22-generic x86_64
NonfreeKernelModules: nvidia
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24.
ApportVersion: 2.0-0ubuntu4
Architecture: amd64
Date: Sat Apr 7 18:58:24 2012
PackageArchitecture: all
SourcePackage: alsa-driver
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 03/07/2011
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: P1.30
dmi.board.name: N68-GE3 UCC
dmi.board.vendor: ASRock
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: To Be Filled By O.E.M.
dmi.chassis.version: To Be Filled By O.E.M.
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrP1.30:bd03/07/2011:svnToBeFilledByO.E.M.:pnToBeFilledByO.E.M.:pvrToBeFilledByO.E.M.:rvnASRock:rnN68-GE3UCC:rvr:cvnToBeFilledByO.E.M.:ct3:cvrToBeFilledByO.E.M.:
dmi.product.name: To Be Filled By O.E.M.
dmi.product.version: To Be Filled By O.E.M.
dmi.sys.vendor: To Be Filled By O.E.M.
modified.conffile..etc.modprobe.d.alsa.base.conf: [modified]
mtime.conffile..etc.modprobe.d.alsa.base.conf: 2012-04-07T17:16:20.066290

Revision history for this message
Lalo Martins (lalo.martins) wrote :
Revision history for this message
Daniel Letzeisen (dtl131) wrote :

Lalo, there is a precise alsa-hda-dkms package, and it will probably solve the issue since ALSA 1.0.25 fixes lots of problems with VIA codecs:

sudo apt-add-repository ppa:ubuntu-audio-dev/alsa-daily
sudo apt-get update
sudo apt-get install alsa-hda-dkms

Revision history for this message
Lalo Martins (lalo.martins) wrote :

Updates:

1: I was slightly wrong about “Independent HP”: turning it off puts everything in the correct state according to the jack (or in plain English: turns the speaker off if the jack is plugged, on if unplugged). But plugging or unplugging the jack while this control is off doesn't change the speaker state at all.

2: I figured I'd test the stuff from ppa:diwic/jack-detection but that version of pulseaudio just removed the headphones output from my sound settings entirely :-)

I'll try the alsa-daily ppa, and also the jack-detection kernel with latest pulseaudio, and report if any combination works. Thanks!

Revision history for this message
Lalo Martins (lalo.martins) wrote :

Tried that, Dave, no change at all :-(

Any way I can make it double-sure I'm using the drivers from alsa-daily?

Revision history for this message
Lalo Martins (lalo.martins) wrote :

working around it with a script for now :-P I'll attach it here in case anyone with the same problem arrives here via google or something. I put this in my “startup applications” and it does the trick.

I'll go on testing proposed solutions though, looking forward to killing the script.

Revision history for this message
Zakhar (alainb06) wrote :
Download full text (5.7 KiB)

Hi, I have a similar problem.

Here is the output of
$ sudo hda-jack-sense-test

WITHOUT headphone connected:

Sigmatel specific "Power-Map: 0x00" verb ignored for the moment
Sigmatel specific "Analog Loopback: 0x00" verb ignored for the moment
Pin 0x0b (Black Mic): present = No
Pin 0x0f (Green Line Out): present = No

WITH headphone connected

Sigmatel specific "Power-Map: 0x00" verb ignored for the moment
Sigmatel specific "Analog Loopback: 0x00" verb ignored for the moment
Pin 0x0b (Black Mic): present = No
Pin 0x0f (Green Line Out): present = Yes

And there is absolutely no switching happening between speakers and headphone although apparently there is a detection on "Green Line Out".

The other problem is that 10.04 showed me Speakers AND Heaphone on the sound control applet, so I could "manually" switch, and that was fine enough.
Now, as the OS is supposed to detect jack insertion, both sound control panel and pavucontrol show only ONE output!

I read you initial post about "independent HP" and failed to find such an option on alsamixer... same after having googled it and read many post that mention it but fail to explain where/how to find the option.

Nevertheless Alsamixer is showing me:
Master
Speaker
PCM
Front

Apparently "Speaker" is for the main speakers of the Laptop and "Front" is for the headphones.

So, at the moment I have a "manual workaround", but still a regression from 10.04 as I have to do it with the console instead of the control applet.

Any idea to solve that (or should I open a separate bug?)

Additional info:
(12.04 amd64 release - fresh install)

$ uname -a
Linux user-Notebook-PC 3.2.0-24-generic #37-Ubuntu SMP Wed Apr 25 08:43:22 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ aplay --list-devices
**** Liste des Périphériques Matériels PLAYBACK ****
carte 0: Intel [HDA Intel], périphérique 0: STAC92xx Analog [STAC92xx Analog]
  Sous-périphériques: 0/1
  Sous-périphérique #0: subdevice #0
carte 0: Intel [HDA Intel], périphérique 1: STAC92xx Digital [STAC92xx Digital]
  Sous-périphériques: 1/1
  Sous-périphérique #0: subdevice #0
carte 1: NVidia [HDA NVidia], périphérique 3: HDMI 0 [HDMI 0]
  Sous-périphériques: 1/1
  Sous-périphérique #0: subdevice #0
carte 1: NVidia [HDA NVidia], périphérique 7: HDMI 0 [HDMI 0]
  Sous-périphériques: 1/1
  Sous-périphérique #0: subdevice #0
carte 1: NVidia [HDA NVidia], périphérique 8: HDMI 0 [HDMI 0]
  Sous-périphériques: 1/1
  Sous-périphérique #0: subdevice #0
carte 1: NVidia [HDA NVidia], périphérique 9: HDMI 0 [HDMI 0]
  Sous-périphériques: 1/1
  Sous-périphérique #0: subdevice #0

$ lsmod
Module Size Used by
parport_pc 32866 0
bnep 18281 2
ppdev 17113 0
rfcomm 47604 0
bluetooth 180104 10 bnep,rfcomm
vesafb 13844 1
nfsd 277809 2
nfs 356307 2
lockd 86161 2 nfsd,nfs
fscache 61529 1 nfs
auth_rpcgss 53380 2 nfsd,nfs
nfs_acl 12883 2 nfsd,nfs
sunrpc 245464 19 nfsd,nfs,lockd,auth_rpcgss,nfs_acl
snd_hda_codec_hdmi 32474 4
arc4 ...

Read more...

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in alsa-driver (Ubuntu):
status: New → Confirmed
Revision history for this message
Zakhar (alainb06) wrote :

P.S. : forgot to say that is on the Intel-HDA, not on the NVidia HDMI that I'm not using (don't have an HDMI device to test it!), contrary to the poster of this bug.

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

Coming from a duplicate of this bug

Try adding the following line to /etc/modprobe.d/alsa-base.conf :
options snd-hda-intel model=hp-dv5

Revision history for this message
Daniel Letzeisen (dtl131) wrote :

@LocutusOfBorg: That line was intended for a different system with a different audio codec. That bug is not a duplicate of this one, even though the symptom is the same.

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

For the independent headphone device 2 vt1718s hp, you can add module-alsa-sink device=hw:0,2 after module-udev-detect in /etc/pulse/default.pa

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

it mainly depend on your computer chassis 's front audio panel is hda (with jack dectection) and bios setup select the front audio panel type

Misc = NO_PRESENCE imply no jack detection circuit

Node 0x28 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Control: name="Headphone Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Independent HP", index=0, device=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals: [0x00 0x00]
  Pincap 0x0000233c: IN OUT HP Detect
    Vref caps: HIZ 50 100
  Pin Default 0x0221411f: [Jack] HP Out at Ext Front
    Conn = 1/8, Color = Green
    DefAssociation = 0x1, Sequence = 0xf
    Misc = NO_PRESENCE
  Pin-ctls: 0xc0: OUT HP VREF_HIZ
  Unsolicited: tag=00, enabled=0
  Power states: D0 D1 D2 D3
  Power: setting=D0, actual=D0
  Connection: 1
     0x1bp

Revision history for this message
Lalo Martins (lalo.martins) wrote :

Upgraded to 12.10. Problem still exists, and “Independent HP” workaround (and therefore my script) won't work anymore :-(

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

independent hp ON mean that you can use hw:0,2 which only output to headphone at device 2: VT1718S HP [VT1718S HP] while you can play 5.1,to rear panel jack device 0: VT1718S Analog [VT1718S Analog]

however pulseaudio does not support multi streaming

http://www.intel.com/support/motherboards/desktop/sb/cs-020642.htm#multistream

**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: VT1718S Analog [VT1718S Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 2: VT1718S HP [VT1718S HP]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 7: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 8: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 9: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Revision history for this message
Lalo Martins (lalo.martins) wrote :

Raymond, thanks, that's all very interesting technically, and to my amazement I actually understand everything you said. The average user, however, cares for none of that; they expect (in fact, even I expect, although I'm probably much techier than the “average user”) that when the headset is plugged in, sound to the speakers stops. The “independent hp” thing was ever only a workaround; the fact that it doesn't work around the issue anymore only makes the bug more urgent.

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

the module-switch-on-port-available of pulseaudio 2.0 use hda jack sense to determine the availablity of the output path

as your front audio panel does not support jack sense so headphone port is always unavailable

 active profile: <output:analog-stereo+input:analog-stereo>
 sinks:
  alsa_output.pci-0000_00_05.0.analog-stereo/#0: Built-in Audio Analogue Stereo
 sources:
  alsa_output.pci-0000_00_05.0.analog-stereo.monitor/#0: Monitor of Built-in Audio Analogue Stereo
  alsa_input.pci-0000_00_05.0.analog-stereo/#1: Built-in Audio Analogue Stereo
 ports:
  analog-output: Analogue Output (priority 9900, available: unknown)
   properties:

  analog-output-headphones: Headphones (priority 9000, available: unknown)
   properties:

  analog-input-microphone-front: Front Microphone (priority 8500, available: unknown)
   properties:

  analog-input-microphone-rear: Rear Microphone (priority 8200, available: no)
   properties:

  analog-input-linein: Line In (priority 8100, available: no)
   properties:

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

if hda-jack-sense-test return yes

you just need to change the front audio panel type in bios setup to hda

sudo hda-jack-sense-test -a
 Pin 0x24 (Green Line Out): present = Yes
 Pin 0x25 (Black Line Out): present = No
 Pin 0x26 (Orange Line Out): present = No
 Pin 0x27 (Grey Line Out): present = No
 Pin 0x28 (Green HP Out): present = Yes
 Pin 0x29 (Pink Mic): present = No
 Pin 0x2a (Blue Line In): present = No
 Pin 0x2b (Pink Mic): present = No
 Pin 0x2c (Internal CD): present = No

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

turnig independent hp ON also disable auto mute since it allow you to play different audio stream to rear panel jacks

Revision history for this message
Lalo Martins (lalo.martins) wrote :

Raymond, there's no such setting in my BIOS, I can turn the front panel on or off.

% sudo hda-jack-sense-test -a
Pin 0x24 (Green Line Out): present = Yes
Pin 0x25 (Black Line Out): present = Yes
Pin 0x26 (Orange Line Out): present = Yes
Pin 0x27 (Grey Line Out): present = Yes
Pin 0x28 (Green HP Out): present = Yes
Pin 0x29 (Pink Mic): present = No
Pin 0x2a (Blue Line In): present = No
Pin 0x2b (Pink Mic): present = No
Pin 0x2c (Internal CD): present = No
Pin 0x2d (Not connected): present = No
Pin 0x2e (Not connected): present = No
Pin 0x2f (Not connected): present = No

(That would be pin 28, as you can see it's already seen as HP Out.)

However, on quantal hda-jack-retask does work, even though it's retasking the pin to the same thing it reports it already was without retasking. Go figure.

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

it is unlikely hda-jack-retask works on vt1718s

the driver is hardcoded 0x28 for the headphone in set_widgets_power_state_vt1718S()

http://git.kernel.org/?p=linux/kernel/git/tiwai/sound.git;a=commitdiff;h=054d867e032daf55c3343fc6d36c5c5f1e7954db;hp=54c2a89f60fd71b924d0f848ac892442951401a6

Revision history for this message
Lalo Martins (lalo.martins) wrote :

You should say “strange” rather than “unlikely”, since I just posted that it does, indeed, work for me. I don't have the required ALSA/kernel/sound knowledge to figure out why, but it does.

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

refer to hda specification

7.4.1 Standard Audio 48-Pin Codec Packages

1. PORT-A must have output capability.
2. If the codec has headphone capability, it must be available on PORT-A at a minimum.

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

http://voices.canonical.com/david.henningsson/2011/11/29/turn-your-mic-jack-into-a-headphone-jack/

i don't think ths works on all hda codecs . may be just specifc realtek and sigmatel codecs since there are notebook which have dual headphone jacks using these codecs

Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

This release of Ubuntu is no longer receiving maintenance updates. If this is still an issue on a maintained version of Ubuntu please let us know.

Changed in alsa-driver (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for alsa-driver (Ubuntu) because there has been no activity for 60 days.]

Changed in alsa-driver (Ubuntu):
status: Incomplete → Expired
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.