# snd_hda - How to tie up Green Jacks? (FreeBSD 9.1)



## AngryWolf (Apr 2, 2013)

Hi all,

I used to be able to solve such problems, but now I've got this P8Z77-V LX2 motherboard on FreeBSD 9.1-RELEASE and the old methods do not seem to work here...

Right now the rear (green) line-out is plugged to my loudspeakers, which I can successfully use to play sounds, and I have a front headphone jack, but no sound comes out from it. So basically I want the headphones to omit sound too, without having to switch between PCM devices later on, ie. to tie up these ports below:


```
hdaa1: <Realtek ALC887 Audio Function Group> at nid 1 on hdacc1

pcm4:     nid=20 [pin: Line-out (Green Jack)]
pcm5:     nid=27 [pin: Headphones (Green Jack)]
```

(Full verbose log: http://pastebin.com/HqSu7ej9)

They are associated like this:


```
hdaa1: Association 0 (1) out:
hdaa1:  Pin nid=20 seq=0
hdaa1: Association 1 (2) out:
hdaa1:  Pin nid=27 seq=0
```

So I guess I should put those 2 pins into the same association, eg Association 0. Would that make sense?

Then once I figure out how to solve the problem above I should be able to solve this too: I would then also do the same for the mic ports (nid=25, nid=25) and line-in port (nid=26), can I also associate them together the same way?


```
pcm4:              + <- nid=24 [pin: Mic (Pink Jack)] [src: mic]
pcm4:              + <- nid=26 [pin: Line-in (Blue Jack)] [src: line]
pcm5:              + <- nid=25 [pin: Mic (Pink Jack)] [src: monitor]

hdaa1: Association 3 (4) in:
hdaa1:  Pin nid=24 seq=0
hdaa1:  Pin nid=26 seq=15
hdaa1: Association 4 (5) in:
hdaa1:  Pin nid=25 seq=0
```

Thanks in advance.


----------



## mav@ (Apr 5, 2013)

Yes. and yes. Just note that association with ID 0 means disabled pins, so use any other number, for example 1. Input configuration is even easier: formally HDA provides no way to automatically switch between inputs, but the recent snd_hda is able to automatically select audio input within association where it sees something connected.


----------



## AngryWolf (Apr 6, 2013)

Thank you, @mav@.

In short, I am very close to what I wanted.

I have written the following in /boot/device.hints:


```
hint.hdaa.1.nid20.config="as=2 seq=0"
hint.hdaa.1.nid27.config="as=2 seq=15"
hint.hdaa.1.nid24.config="as=4 seq=0"
hint.hdaa.1.nid25.config="as=4 seq=15"
hint.hdaa.1.nid26.config="as=4 seq=1"
```

Now my configuration looks like this:


```
hdaa1: Patched pins configuration:
hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa1: 17 99430130 3  0  SPDIF-out     Fixed ATAPI   Onboard    Unknown 1
hdaa1: 18 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1: 20 01014020 2  0  Line-out      Jack  1/8     Rear       Green   0
hdaa1: 21 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1: 22 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1: 23 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1: 24 01a19840 4  0  Mic           Jack  1/8     Rear       Pink    8
hdaa1: 25 02a1994f 4  15 Mic           Jack  1/8     Front      Pink    9
hdaa1: 26 01813041 4  1  Line-in       Jack  1/8     Rear       Blue    0
hdaa1: 27 0221412f 2  15 Headphones    Jack  1/8     Front      Green   1
hdaa1: 28 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1: 30 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa1: 31 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA

hdaa1: 3 associations found:
hdaa1: Association 0 (2) out:
hdaa1:  Pin nid=20 seq=0
hdaa1:  Pin nid=27 seq=15
hdaa1: Association 1 (3) out:
hdaa1:  Pin nid=17 seq=0
hdaa1: Association 2 (4) in:
hdaa1:  Pin nid=24 seq=0
hdaa1:  Pin nid=26 seq=1
hdaa1:  Pin nid=25 seq=15
```

The only problem is, the loudspeaker (nid=20) is not muted when the headphones (nid=27) are plugged in. But at least they both *e*mit sound!

That's acceptable for me now, and I'll mark this problem as solved. However, if anyone could tell me how to mute the loudspeakers properly, please do, regardless of the topic prefix.


----------



## mav@ (Apr 6, 2013)

Your headphones pin (nid=27) has misc=1 set. It means that it has no support for jack detection, so driver enables both outputs same time. You may try to go to your BIOS setup and make sure that front panel connector configured as HDA, not AC'97. Also you may try to just force misc=0 there and see what happens.


----------



## AngryWolf (Apr 7, 2013)

Hi @mav@,

Checked BIOS, indeed it was on AC97, selected HD. Did not help. Then I forced misc=0, and it still did not help. I guess that's it for this motherboard then. 

Below is the difference of verbose logs:


when I only change the front panel to HD,
when I also force misc=0,


```
--- dmesg1.txt	2013-04-07 01:29:25.000000000 +0200
+++ dmesg2.txt	2013-04-07 01:39:21.000000000 +0200
@@ -609,9 +606,9 @@
 hdaa1: 31 411111f0 15 0  Speaker       None  1/8     Rear       Black   1
 hdaa1: Patching widget caps nid=29 0x00400400 -> 0x00700400
 hdaa1: Patching pin config nid=20 0x01014010 -> 0x01014020
-hdaa1: Patching pin config nid=25 0x02a19c50 -> 0x02a19c4f
+hdaa1: Patching pin config nid=25 0x02a19c50 -> 0x02a1904f
 hdaa1: Patching pin config nid=26 0x0181304f -> 0x01813041
-hdaa1: Patching pin config nid=27 0x02214c20 -> 0x02214c2f
+hdaa1: Patching pin config nid=27 0x02214c20 -> 0x0221402f
 hdaa1: Patched pins configuration:
 hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
 hdaa1: 17 99430130 3  0  SPDIF-out     Fixed ATAPI   Onboard    Unknown 1
@@ -621,9 +618,9 @@
 hdaa1: 22 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
 hdaa1: 23 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
 hdaa1: 24 01a19840 4  0  Mic           Jack  1/8     Rear       Pink    8
-hdaa1: 25 02a19c4f 4  15 Mic           Jack  1/8     Front      Pink    12
+hdaa1: 25 02a1904f 4  15 Mic           Jack  1/8     Front      Pink    0
 hdaa1: 26 01813041 4  1  Line-in       Jack  1/8     Rear       Blue    0
-hdaa1: 27 02214c2f 2  15 Headphones    Jack  1/8     Front      Green   12
+hdaa1: 27 0221402f 2  15 Headphones    Jack  1/8     Front      Green   0
 hdaa1: 28 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
 hdaa1: 30 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
 hdaa1: 31 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
@@ -973,7 +970,7 @@
 hdaa1:             OSS: monitor (monitor)
 hdaa1:         Pin cap: 0x0000373e
 hdaa1:                  TRQD PDC HP OUT IN VREF[ 50 80 100 GROUND HIZ ]
-hdaa1:      Pin config: 0x02a19c4f
+hdaa1:      Pin config: 0x02a1904f
 hdaa1:     Pin control: 0x00000025 IN VREFs
 hdaa1:      Output amp: 0x80000000
 hdaa1:                  mute=1 step=0 size=0 offset=0
@@ -1016,7 +1013,7 @@
 hdaa1:     Association: 0 (0x00008000)
 hdaa1:         Pin cap: 0x0001373e
 hdaa1:                  TRQD PDC HP OUT IN VREF[ 50 80 100 GROUND HIZ ] EAPD
-hdaa1:      Pin config: 0x02214c2f
+hdaa1:      Pin config: 0x0221402f
 hdaa1:     Pin control: 0x000000c0 HP OUT
 hdaa1:            EAPD: 0x00000002
 hdaa1:      Output amp: 0x80000000
```


----------

