Bug 70791

Summary: Audio output heavily distorted on HP ProDesk 600 G1 SFF
Product: Drivers Reporter: Robert Hancock (hancockrwd)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED INVALID    
Severity: normal CC: superquad.vortex2
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.13.3 Subsystem:
Regression: No Bisected commit-id:

Description Robert Hancock 2014-02-18 16:30:26 UTC
I have a HP ProDesk 600 G1 machine which seems to have some strange behavior with the front headphone jack(s) running under Fedora 20 (running 3.13.3 kernel):

This machine has two front jacks: a headphone jack and a microphone/headphone jack. When the headphones are plugged into the headphone jack, there's usually no change in the sound outputs list in the Sound control panel. The audio (mostly) works if the audio output device is set to Analog Output, but sometimes spuriously changes back to Speakers and the headphone output stops working (I suspect maybe from a spurious jack-sensing event, though I'm not certain). More confusingly, a couple of times I have gotten it into the state (through various fiddling with jacks and playing in the Sound control panel) where plugging into this jack is detected and causes the Headphone output to be selected in the control panel. I haven't been able to figure out consistently what causes this to happen.

If the headphone is plugged into the microphone/headphone jack, then the control panel consistently switches to the Headphone output and consistently switches back the way it was when it's unplugged. However, there's no actual audio output coming out of that jack. (From some of the HP manuals, it sounds like with the Windows driver, when you plug into this jack, it's supposed to pop up a prompt asking you whether you want to use it as a microphone or headphones.) 

The more serious problem is that intermittently, on the headphone jack you'll start getting a bunch of loud static (clicking noises) and any actual audio playback becomes very faint and distorted.
 
I'm guessing perhaps something isn't being initialized/setup properly
in the codec, causing this kind of erratic behavior. The alsa-info
output is uploaded at:

http://www.alsa-project.org/db/?f=594e837b7af07ffbe3473cf807465bc81a587880

I tried using hda-analyzer but it fails on this machine with:

ValueError: wrong proc file format (unknown dig1 bit 'KAE')

as it seems to choke on something in the HDMI codec details. There seems to be no way to stop it from looking at that codec other than running it as a normal user and pointing at a copy of the codec proc file, but then obviously I can't change anything with it.

Reported on alsa-user here: http://thread.gmane.org/gmane.linux.alsa.user/38191
Comment 1 Robert Hancock 2014-02-18 20:03:18 UTC
I did manage to get hda_analyzer to work (after hacking it to ignore some of the lines in the codec proc file for the HDMI codec which it couldn't handle). However, I haven't gotten much success. Right now I'm in a state where there's no audio output at all and I don't know what could have changed (which is why I suspect there's something not being initialized properly and so it ends up in some random state on power-up).

I've tried playing with various nodes in hda_analyzer, unmuting and increasing volume on various sliders randomly without any success. The best I got was that toggling the OUT flag on the headphone jack pin would turn on or off that crackling/popping noise on the output, but there still wasn't any audio.

It does seem like some of the widget connections that I would expect to see in the codec graph aren't set up. Though hda_analyzer seems to spew out various errors on some nodes so I don't know if that's just an issue with hda_analyzer. It seems like that tool definitely needs some work with current kernels.
Comment 2 Raymond 2014-02-19 04:01:30 UTC
you have to post the pulseaudio verbose log 

pulseaudio -vvvv

and the alsa-info of patched alsa-driver

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths

if front headphone jack detect control return false when plugged

pulseaudio seem mute headphone playback switch in the following conf


analog-output.conf

[Element Headphone]
switch = mute
volume = zero

analog-output-desktop-speaker.conf

[Element Headphone]
switch = mute
volume = zero

analog-output-lineout.conf

[Element Headphone]
switch = mute
volume = zero

analog-output-speaker.conf

[Element Headphone]
switch = off
volume = off
Comment 3 Raymond 2014-02-19 05:57:18 UTC
the mono speaker of your business desktop is designed to share audio output node 0x2 with other pin complex 

Node 0x0c [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00] [0x80 0x80]
  Connection: 2
     0x02 0x0b

Node 0x0e [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x0f [Audio Mixer] wcaps 0x20010a: Mono Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00] [0x00]
  Connection: 2
     0x02 0x0b

Node 0x17 [Pin Complex] wcaps 0x40010c: Mono Amp-Out
  Control: name="Speaker Playback Switch", index=0, device=0
    ControlAmp: chs=1, dir=Out, idx=0, ofs=0
  Control: name="Speaker Phantom Jack", index=0, device=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00]
  Pincap 0x00010010: OUT EAPD
  EAPD 0x2: EAPD
  Pin Default 0x90170110: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Connection: 1
     0x0f
Comment 4 Robert Hancock 2014-02-19 16:03:44 UTC
So I've gone back to the original state in order to see if I had mixed anything up. The summary is:

-With the default settings, I do get audio playback through the headphone and line out jacks with the PulseAudio output source set to "Analog Output". (When plugging into the headphone-only jack, the audio works although no headphones are detected in PulseAudio. When plugging into the headphone/microphone jack, PulseAudio detects headphones but I don't get any audio output from this jack. Nonetheless, using the headphone-only jack does work.)

-Unfortunately, the audio output from both headphone and line out is heavily distorted. It sounds like a form of clipping when actual audio is playing, and when the audio playback is silent it's rapid clicking/popping noises with a loud background hiss. Thus far I haven't been able to figure out much idea of where this is coming from. Testing with hda_analyzer shows that making each of these changes has these results on the output from the headphone-only jack:

Muting output amplifier on node 0x21: Audio playback muted, noise continues
Muting inputs 3/4 on mixer 0x0d: no effect
Muting inputs 1/2 on mixer 0x0d: Audio playback muted, noise continues
Changing output level of audio out node 0x03: works as expected on audio playback, no effect on noise
Changing input source on node 0x21 to 0x0c and turning up audio level on node 0x02: level on 0x02 controls audio playback level, but no effect on noise

So essentially all of the control widgets work as I would expect but unfortunately have no effect on the noise. I've renamed the bug to describe the main actual problem that prevents the audio from being usable on this machine. I'm not sure where to go from here. It seems like there is some kind of a lower-level issue with the codec setup or something. Any suggestions for anything else to try (module options? codec hints?)
Comment 5 Raymond 2014-02-20 07:44:31 UTC
your headphone plugged into mic jack won't get any audio unless  mic jack is retasked as output (i.e. pin-ctls become OUT instead of IN) 

the best way is disable jack detection by early patching
Comment 6 Raymond 2014-02-25 04:20:47 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=4b016931a997be59a2be0da3398985a19fdfa5be

+ { 0x10ec0292, 0x1028, 0, "ALC3226" },

seem you are not using latest alsa driver since ALC292 was renamed as ALC3226
Comment 7 Robert Hancock 2014-10-20 16:05:33 UTC
Sorry for the lack of update on this. This turned out to be some kind of hardware defect on that specific machine (bad solder joints on the motherboard or something) as the noise also occurred in the audio tests in the HP diagnostic utility. The machine was swapped out with an EliteDesk 800 G1 (which seems to have similar audio hardware) and the headphone jack works fine.