# [snd_hda][9-CURRENT] headphone is not working for sound from pcm



## buganini (Feb 24, 2010)

My laptop is Asus A6Va, everythings worked fine months ago.
Headphone stop working (partially) since an update on Jan 20.
Now, all sound works properly with headphone unplugged,
but with headphone plugged, i can only heard sound from mic,SPKR(4), but no sound from pcm.


```
# cat /dev/sndstat 
FreeBSD Audio Driver (newpcm: 32bit 2009061500/i386)
Installed devices:
pcm0: <HDA Realtek ALC880 PCM #0 Digital> (play) default
pcm1: <HDA Realtek ALC880 PCM #1 Analog> (rec)

and some more information from verbose boot dmesg
pcm0: <HDA Realtek ALC880 PCM #0 Digital> at cad 0 nid 1 on hdac0
pcm1: <HDA Realtek ALC880 PCM #1 Analog> at cad 0 nid 1 on hdac0
```

pins seem to be fine:

```
hdac0:  nid 20 0xb7031110 as  1 seq  0      Line-out Fixed jack  3 loc 55 color   Black misc 1
hdac0:  nid 21 0x0121411f as  1 seq 15    Headphones  Jack jack  1 loc  1 color   Green misc 1
hdac0:  nid 22 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0:  nid 23 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0:  nid 24 0x01a19920 as  2 seq  0           Mic  Jack jack  1 loc  1 color    Pink misc 9
hdac0:  nid 25 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0:  nid 26 0x01813121 as  2 seq  1       Line-in  Jack jack  1 loc  1 color    Blue misc 1
hdac0:  nid 27 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0:  nid 28 0xb7331122 as  2 seq  2            CD Fixed jack  3 loc 55 color   Black misc 1
hdac0: Patching widget caps nid=29 0x00400000 -> 0x00700000
hdac0:  nid 30 0xb743111e as  1 seq 14     SPDIF-out Fixed jack  3 loc 55 color   Black misc 1
hdac0:  nid 31 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0: Patched pins configuration:
hdac0:  nid 20 0xb7031110 as  1 seq  0      Line-out Fixed jack  3 loc 55 color   Black misc 1
hdac0:  nid 21 0x0121411f as  1 seq 15    Headphones  Jack jack  1 loc  1 color   Green misc 1
hdac0:  nid 22 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 23 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 24 0x01a19920 as  2 seq  0           Mic  Jack jack  1 loc  1 color    Pink misc 9
hdac0:  nid 25 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 26 0x01813121 as  2 seq  1       Line-in  Jack jack  1 loc  1 color    Blue misc 1
hdac0:  nid 27 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 28 0xb7331122 as  2 seq  2            CD Fixed jack  3 loc 55 color   Black misc 1
hdac0:  nid 30 0xb743111e as  1 seq 14     SPDIF-out Fixed jack  3 loc 55 color   Black misc 1
hdac0:  nid 31 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
```

this should also be fine

```
# mixer
Mixer vol      is currently set to 100:100
Mixer pcm      is currently set to 100:100
Mixer speaker  is currently set to 100:100
Mixer line     is currently set to 100:100
Mixer mic      is currently set to   0:0
Mixer cd       is currently set to  75:75
Mixer igain    is currently set to 100:100
```

I think the problem is here, nid 21,22 use different pcm source.

```
hdac0:             nid: 2
hdac0:            Name: audio output
hdac0:      Widget cap: 0x00000411
hdac0:                  PWR STEREO
hdac0:     Association: 0 (0x00000001)
hdac0:             OSS: pcm (pcm)
hdac0:      Stream cap: 0x00000001
hdac0:                  PCM
hdac0:         PCM cap: 0x000e0560
hdac0:                  16 20 24 bits, 44 48 96 192 KHz
hdac0: 
hdac0:             nid: 3
hdac0:            Name: audio output
hdac0:      Widget cap: 0x00000411
hdac0:                  PWR STEREO
hdac0:     Association: 0 (0x00008000)
hdac0:             OSS: pcm (pcm)
hdac0:      Stream cap: 0x00000001
hdac0:                  PCM
hdac0:         PCM cap: 0x000e0560
hdac0:                  16 20 24 bits, 44 48 96 192 KHz
hdac0: 
hdac0:             nid: 11
hdac0:            Name: audio mixer
hdac0:      Widget cap: 0x0020010b
hdac0:                  STEREO
hdac0:     Association: -2 (0x00000000)
hdac0:             OSS: speaker, line, mic, cd
hdac0:       Input amp: 0x80034123
hdac0:                  mute=1 step=65 size=3 offset=35
hdac0:     connections: 8
hdac0:           |
hdac0:           + <- nid=24 [pin: Mic (Pink Jack)]
hdac0:           + [DISABLED] <- nid=25 [pin: Speaker (None)] [DISABLED]
hdac0:           + <- nid=26 [pin: Line-in (Blue Jack)]
hdac0:           + [DISABLED] <- nid=27 [pin: Speaker (None)] [DISABLED]
hdac0:           + <- nid=28 [pin: CD (Fixed)]
hdac0:           + <- nid=29 [beep widget]
hdac0:           + [DISABLED] <- nid=20 [pin: Line-out (Fixed)]
hdac0:           + [DISABLED] <- nid=21 [pin: Headphones (Green Jack)]
hdac0: 
hdac0:             nid: 12
hdac0:            Name: audio mixer
hdac0:      Widget cap: 0x0020010f
hdac0:                  STEREO
hdac0:     Association: 0 (0x00000001)
hdac0:             OSS: pcm, speaker, line, mic, cd
hdac0:      Output amp: 0x00034040
hdac0:                  mute=0 step=64 size=3 offset=64
hdac0:       Input amp: 0x80000000
hdac0:                  mute=1 step=0 size=0 offset=0
hdac0:     connections: 2
hdac0:           |
hdac0:           + <- nid=2 [audio output]
hdac0:           + <- nid=11 [audio mixer]
hdac0: 
hdac0:             nid: 13
hdac0:            Name: audio mixer
hdac0:      Widget cap: 0x0020010f
hdac0:                  STEREO
hdac0:     Association: 0 (0x00008000)
hdac0:             OSS: pcm, speaker, line, mic, cd
hdac0:      Output amp: 0x00034040
hdac0:                  mute=0 step=64 size=3 offset=64
hdac0:       Input amp: 0x80000000
hdac0:                  mute=1 step=0 size=0 offset=0
hdac0:     connections: 2
hdac0:           |
hdac0:           + <- nid=3 [audio output]
hdac0:           + <- nid=11 [audio mixer]
hdac0: 
hdac0:             nid: 20
hdac0:            Name: pin: Line-out (Fixed)
hdac0:      Widget cap: 0x0040018d
hdac0:                  UNSOL STEREO
hdac0:     Association: 0 (0x00000001)
hdac0:         Pin cap: 0x0000003f
hdac0:                  ISC TRQD PDC HP OUT IN
hdac0:      Pin config: 0xb7031110
hdac0:     Pin control: 0x00000040 OUT
hdac0:      Output amp: 0x80000000
hdac0:                  mute=1 step=0 size=0 offset=0
hdac0:     connections: 1
hdac0:           |
hdac0:           + <- nid=12 [audio mixer]
hdac0: 
hdac0:             nid: 21
hdac0:            Name: pin: Headphones (Green Jack)
hdac0:      Widget cap: 0x0040018d
hdac0:                  UNSOL STEREO
hdac0:     Association: 0 (0x00008000)
hdac0:         Pin cap: 0x0000003f
hdac0:                  ISC TRQD PDC HP OUT IN
hdac0:      Pin config: 0x0121411f
hdac0:     Pin control: 0x000000c0 HP OUT
hdac0:      Output amp: 0x80000000
hdac0:                  mute=1 step=0 size=0 offset=0
hdac0:     connections: 1
hdac0:           |
hdac0:           + <- nid=13 [audio mixer]
hdac0:
```
and

```
hdac0: 2 associations found:
hdac0: Association 0 (1) out:
hdac0:  Pin nid=20 seq=0
hdac0:  Pin nid=30 seq=14
hdac0:  Pin nid=21 seq=15
hdac0: Association 1 (2) in:
hdac0:  Pin nid=24 seq=0
hdac0:  Pin nid=26 seq=1
hdac0:  Pin nid=28 seq=2
hdac0: Tracing association 0 (1)
hdac0:  Pin 20 traced to DAC 2
hdac0:  Pin 30 traced to DAC 6
hdac0:  Unable to trace pin 21 seq 15 with min nid 0 and hpredir 0
hdac0:  Unable to trace pin 30 seq 14 with min nid 7
hdac0:  Unable to trace pin 20 seq 0 with min nid 3
hdac0:  Pin 20 traced to DAC 2 with fake redirection
hdac0:  Pin 30 traced to DAC 6 with fake redirection
hdac0:  Pin 21 traced to DAC 3 with fake redirection
hdac0: Association 0 (1) trace succeeded
hdac0: Tracing association 1 (2)
hdac0:  Pin 24 traced to ADC 7
hdac0:  Pin 26 traced to ADC 7
hdac0:  Pin 28 traced to ADC 7
hdac0: Association 1 (2) trace succeeded
hdac0: Tracing input monitor
hdac0: Tracing other input monitors
hdac0:  Tracing nid 24 to out
hdac0:  nid 24 is input monitor
hdac0:  Tracing nid 26 to out
hdac0:  nid 26 is input monitor
hdac0:  Tracing nid 28 to out
hdac0:  nid 28 is input monitor
hdac0: Tracing beeper
hdac0:  nid 29 traced to out
hdac0: No jack detection support at pin 21
```

but i don't know how to change connection.

`sysctl hw.snd.default_unit=1` doesnt help.x(


----------



## mav@ (Feb 25, 2010)

Send me please full verbose driver output with hw.snd.verbose=4. You may send it directly to mav@FreeBSD.org.


----------



## buganini (Feb 26, 2010)

one line patch from mav@ fix my problem


```
try to change in hdac.c file line
       if (as->hpredir >= 0 && i == as->pincnt) {
to
       if (as->fakeredir && i == (as->pincnt - 1)) {
```

Thanks, mav@ !


----------



## buganini (Feb 26, 2010)

patch committed
http://svn.freebsd.org/viewvc/base/head/sys/dev/sound/pci/hda/hdac.c?revision=204351&view=markup

thanks, again.


----------



## ProFTP (Mar 20, 2010)

Can you please tell how this problem can be solved here http://forums.freebsd.org/showthread.php?t=12433


----------

