# HDA config for multiple Headphone jacks



## aragon (Nov 21, 2010)

Hi,

My notebook has two Headphone jacks.  In Windows I can plug a headphone into either jack and the speaker will be muted and sound redirected to the headphone.  I can also have two headphones plugged in simultaneously and sound will be duplicated to both.

I can't seem to get this working in FreeBSD though.  Default pin configuration is:


```
hdac0: Processing audio FG cad=0 nid=1...
hdac0: GPIO: 0xc0000003 NumGPIO=3 NumGPO=0 NumGPI=0 GPIWake=1 GPIUnsol=1
hdac0:  nid 10 0x0221101f as  1 seq 15    Headphones  Jack jack  1 loc  2 color   Black misc 0
hdac0:  nid 11 0x40f000f0 as 15 seq  0         Other  None jack  0 loc  0 color Unknown misc 0
hdac0:  nid 12 0x40f000f1 as 15 seq  1         Other  None jack  0 loc  0 color Unknown misc 0
hdac0:  nid 13 0x90170110 as  1 seq  0       Speaker Fixed jack  7 loc 16 color Unknown misc 1
hdac0:  nid 14 0x02a11030 as  3 seq  0           Mic  Jack jack  1 loc  2 color   Black misc 0
hdac0:  nid 15 0x02011020 as  2 seq  0      Line-out  Jack jack  1 loc  2 color   Black misc 0
hdac0:  nid 16 0x40f000f2 as 15 seq  2         Other  None jack  0 loc  0 color Unknown misc 0
hdac0:  nid 17 0x40f000f3 as 15 seq  3         Other  None jack  0 loc  0 color Unknown misc 0
hdac0:  nid 18 0x40f000f4 as 15 seq  4         Other  None jack  0 loc  0 color Unknown misc 0
hdac0:  nid 19 0x90a60040 as  4 seq  0           Mic Fixed jack  6 loc 16 color Unknown misc 0
hdac0:  nid 20 0x40f000f5 as 15 seq  5         Other  None jack  0 loc  0 color Unknown misc 0
hdac0:  nid 33 0x01442170 as  7 seq  0     SPDIF-out  Jack jack  4 loc  1 color    Grey misc 1
hdac0:  nid 34 0x40f000f7 as 15 seq  7         Other  None jack  0 loc  0 color Unknown misc 0
hdac0: Patched pins configuration:
hdac0:  nid 10 0x0221101f as  1 seq 15    Headphones  Jack jack  1 loc  2 color   Black misc 0
hdac0:  nid 11 0x40f000f0 as 15 seq  0         Other  None jack  0 loc  0 color Unknown misc 0 [DISABLED]
hdac0:  nid 12 0x40f000f1 as 15 seq  1         Other  None jack  0 loc  0 color Unknown misc 0 [DISABLED]
hdac0:  nid 13 0x90170110 as  1 seq  0       Speaker Fixed jack  7 loc 16 color Unknown misc 1
hdac0:  nid 14 0x02a11030 as  3 seq  0           Mic  Jack jack  1 loc  2 color   Black misc 0
hdac0:  nid 15 0x02011020 as  2 seq  0      Line-out  Jack jack  1 loc  2 color   Black misc 0
hdac0:  nid 16 0x40f000f2 as 15 seq  2         Other  None jack  0 loc  0 color Unknown misc 0 [DISABLED]
hdac0:  nid 17 0x40f000f3 as 15 seq  3         Other  None jack  0 loc  0 color Unknown misc 0 [DISABLED]
hdac0:  nid 18 0x40f000f4 as 15 seq  4         Other  None jack  0 loc  0 color Unknown misc 0 [DISABLED]
hdac0:  nid 19 0x90a60040 as  4 seq  0           Mic Fixed jack  6 loc 16 color Unknown misc 0
hdac0:  nid 20 0x40f000f5 as 15 seq  5         Other  None jack  0 loc  0 color Unknown misc 0 [DISABLED]
hdac0:  nid 33 0x01442170 as  7 seq  0     SPDIF-out  Jack jack  4 loc  1 color    Grey misc 1
hdac0:  nid 34 0x40f000f7 as 15 seq  7         Other  None jack  0 loc  0 color Unknown misc 0 [DISABLED]
hdac0: 5 associations found:
hdac0: Association 0 (1) out:
hdac0:  Pin nid=13 seq=0
hdac0:  Pin nid=10 seq=15
hdac0: Association 1 (2) out:
hdac0:  Pin nid=15 seq=0
hdac0: Association 2 (3) in:
hdac0:  Pin nid=14 seq=0
hdac0: Association 3 (4) in:
hdac0:  Pin nid=19 seq=0
hdac0: Association 4 (7) out:
hdac0:  Pin nid=33 seq=0
hdac0: Tracing association 0 (1)
hdac0:  Pin 13 traced to DAC 2
hdac0:  Pin 10 traced to DAC 2 and hpredir 0
hdac0: Association 0 (1) trace succeeded
hdac0: Tracing association 1 (2)
hdac0:  Pin 15 traced to DAC 5
hdac0: Association 1 (2) trace succeeded
hdac0: Tracing association 2 (3)
hdac0:  Pin 14 traced to ADC 7
hdac0: Association 2 (3) trace succeeded
hdac0: Tracing association 3 (4)
hdac0:  Pin 19 traced to ADC 8
hdac0: Association 3 (4) trace succeeded
hdac0: Tracing association 4 (7)
hdac0:  Pin 33 traced to DAC 30
hdac0: Association 4 (7) trace succeeded
hdac0: Tracing input monitor
hdac0: Tracing other input monitors
hdac0:  Tracing nid 14 to out
hdac0:  nid 14 is input monitor
hdac0:  Tracing nid 19 to out
hdac0:  nid 19 is input monitor
hdac0: Tracing beeper
hdac0: GPIO init: data=0x00000000 mask=0x00000000 dir=0x00000000
hdac0: GPIO commit: data=0x00000004 mask=0x00000004 dir=0x00000004
hdac0: Enabling headphone/speaker audio routing switching:
hdac0:  as=0 sense nid=10 [UNSOL]
hdac0: Pin sense: nid=10 res=0xffffffff
hdac0: FG config/quirks: gpio2 forcestereo ivref50 ivref80 ivref100 ivref
```

I have tried creating hints to set nids 10 and 15 to both have as 1, seq 15, and Headphones device type, but snd_hda(4) complains about duplicate pins.  With the default pin config above, two output PCM devices are created, and when playing back audio I can only output to one of those devices at a time.

Any ideas how to either:

* Get nids 10 and 15 both duplicating nid 13.
OR
* Make mplayer duplicate audio to two PCM devices simultaneously.


----------



## mav@ (Nov 22, 2010)

Microsoft UAA specification defines duplication/redirection only for one output pin in association. You can't have two duplicated headphones. First idea won't work.

I don't know about mplayer playing to two PCM devices - IMHO unlikely.

Third option - group both output connectors into same association with seq's 0 and 15. For one at 15 you should set "type=Headphones misc=1" to disable automatic redirection and do configure unconditional duplication. As result using different PCM devices you will be able to switch between speaker and headphones.

Forth option - ignore redirection/duplication in driver completely and configure external connectors as additional channels of the PCM device. After that mplayer could be configured to handle multichannel audio and duplicate front audio streams to the additional channel pairs.


----------

