# Sound comes out of both earphones and built in speaker



## curses (Jan 19, 2010)

Alrighty then. here's my next weird problem! Ready? oh well. Whenever i am playing sound on my computer, I get sound coming out of both the ear buds and the built in speaker. I'm using the snd_hda driver. I would think that when i plug in my earphones, sound wouldn't come out of the speaker. sure doesn't in linux.


----------



## aragon (Jan 19, 2010)

That can be fixed.  Ideally you should read and understand snd_hda(4), but otherwise paste us a verbose boot log (boot -v at loader) and someone might suggest the fix...


----------



## curses (Jan 21, 2010)

Alright, but where do you suppose that log file is stashed?


----------



## aragon (Jan 21, 2010)

/var/run/dmesg.boot


----------



## curses (Jan 21, 2010)

I've attached the compressed file to this post. had to compress it or the forum would get all grumpy. hope you don't have scribus; it tries to open it and it can't. go figure.


----------



## mav@ (Jan 21, 2010)

I would say your codec is heavily misconfigured. Try to add to /boot/loader.conf lines:


```
hint.hdac.0.cad0.nid12.config="as=1 seq=0"
hint.hdac.0.cad0.nid10.config="as=1 seq=15 device=Headphones"
hint.hdac.0.cad0.nid11.config="as=3 seq=0 conn=Fixed"
hint.hdac.0.cad0.nid17.config="as=4 seq=0"
```


----------



## therek (Feb 24, 2010)

Hi. I'm having some strange problem, but first of all my sound card is:

```
hdac0: <Intel 82801I High Definition Audio Controller> mem 0xfe320000-0xfe323fff irq 22 at device 27.0 on pci0
hdac0: HDA Driver Revision: 20100122_0141
```

Now, the problem is that regardless of whether the headphones are plugged in or not the sound is directed to built-in speakers. Changing sysctl's 'hw.snd.default_unit' value from 0 to 1 do make the sound output to be redirected from speakers to headphones, though I'd like the speakers to be turned off and sound sent to headphones automagically.

My pin configuration is as follows:

```
hdac0: Processing audio FG cad=0 nid=1...
hdac0: GPIO: 0x40000004 NumGPIO=4 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
hdac0:  nid 18 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0:  nid 20 0x99130110 as  1 seq  0       Speaker Fixed jack  3 loc 25 color Unknown misc 1
hdac0:  nid 21 0x02211420 as  2 seq  0    Headphones  Jack jack  1 loc  2 color   Black misc 4
hdac0:  nid 22 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0:  nid 24 0x02a11c40 as  4 seq  0           Mic  Jack jack  1 loc  2 color   Black misc 12
hdac0:  nid 25 0x99a30950 as  5 seq  0           Mic Fixed jack  3 loc 25 color Unknown misc 9
hdac0:  nid 26 0x01a11c4f as  4 seq 15           Mic  Jack jack  1 loc  1 color   Black misc 12
hdac0:  nid 27 0x0121141f as  1 seq 15    Headphones  Jack jack  1 loc  1 color   Black misc 4
hdac0:  nid 28 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0: Patching widget caps nid=29 0x00400000 -> 0x00700000
hdac0:  nid 30 0x02454130 as  3 seq  0     SPDIF-out  Jack jack  5 loc  2 color   Green 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 18 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 20 0x99130110 as  1 seq  0       Speaker Fixed jack  3 loc 25 color Unknown misc 1
hdac0:  nid 21 0x02211420 as  2 seq  0    Headphones  Jack jack  1 loc  2 color   Black misc 4
hdac0:  nid 22 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 24 0x02a11c40 as  4 seq  0           Mic  Jack jack  1 loc  2 color   Black misc 12
hdac0:  nid 25 0x99a30950 as  5 seq  0           Mic Fixed jack  3 loc 25 color Unknown misc 9
hdac0:  nid 26 0x01a11c4f as  4 seq 15           Mic  Jack jack  1 loc  1 color   Black misc 12
hdac0:  nid 27 0x0121141f as  1 seq 15    Headphones  Jack jack  1 loc  1 color   Black misc 4
hdac0:  nid 28 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 30 0x02454130 as  3 seq  0     SPDIF-out  Jack jack  5 loc  2 color   Green misc 1
hdac0:  nid 31 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0: 5 associations found:
hdac0: Association 0 (1) out:
hdac0:  Pin nid=20 seq=0
hdac0:  Pin nid=27 seq=15
hdac0: Association 1 (2) out:
hdac0:  Pin nid=21 seq=0
hdac0: Association 2 (3) out:
hdac0:  Pin nid=30 seq=0
hdac0: Association 3 (4) in:
hdac0:  Pin nid=24 seq=0
hdac0:  Pin nid=26 seq=15
hdac0: Association 4 (5) in:
hdac0:  Pin nid=25 seq=0
```

I suppose following should do the trick, but setting it in /boot/loader.conf or /boot/device.hints doesn't seem to take effect, though kenv(1) says it is set.

```
hint.hdac.0.cad0.nid27.config="as=2 seq=0"
hint.hdac.0.cad0.nid21.config="as=1 seq=15"
```

Any idea why is it so?


----------



## mav@ (Feb 25, 2010)

You should check whether your hardware supports jack sensing. You may do it using pindump or watching verbose messages when plugging in headphones.


----------



## therek (Feb 26, 2010)

Yes it supports. My problem was that somehow I couldn't reconfigure pins (switch nid27 with nid21). Funny enough, today pindump showed that pins are set exactly as I wanted, so everything works fine. I must have done something wrong previously.

Nonetheless, thanks for your great work on the driver itself!


----------

