# Rear mic using snd_hda on amd64 9.x-STABLE amd64 Dell Optiplex 780



## BostonDriver (May 8, 2013)

I am unable to use the rear panel microphone on 9.1-STABLE amd64. 

Using 


```
sysctl hw.snd.default_unit=1
```
 lets the front headset work but turns off the front mic.  Using 
	
	



```
sysctl hw.snd.default_unit=0
```
 lets the front mic work with the rear speakers

The machine is a Dell Optiplex 780 with integrated sound using the snd_hda driver.

`cat /etc/sndstat`

```
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <Analog Devices AD1984A (Analog)> on hdaa0 kld snd_hda (1p:1v/1r:1v) default
	snddev flags=0x2e2<AUTOVCHAN,BUSY,MPSAFE,REGISTERED,VPC>
	[pcm0:play:dsp0.p0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000004
	interrupts 0, underruns 0, feed 0, ready 0 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x2100<BUSY,HAS_VCHAN>
	{userland} -> feeder_mixer(0x00200010) -> {hardware}
	pcm0:play:dsp0.p0[pcm0:virtual:dsp0.vp0]: spd 8000, fmt 0x00100008, flags 0x10000000, 0x00000000
	interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:0/0/0]
	channel flags=0x10000000<VIRTUAL>
	{userland} -> feeder_root(0x00000000) -> {hardware}
	[pcm0:record:dsp0.r0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000005
	interrupts 0, overruns 0, feed 0, hfree 4096, sfree 4096 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x2100<BUSY,HAS_VCHAN>
	{hardware} -> feeder_root(0x00200010) -> feeder_mixer(0x00200010) -> {userland}
	pcm0:record:dsp0.r0[pcm0:virtual:dsp0.vr0]: spd 8000, fmt 0x00100008, flags 0x10000000, 0x00000000
	interrupts 0, overruns 0, feed 0, hfree 0, sfree 0 [b:0/0/0|bs:0/0/0]
	channel flags=0x10000000<VIRTUAL>
	{hardware} -> feeder_root(0x00000000) -> {userland}
pcm1: <Analog Devices AD1984A (Analog)> on hdaa0 kld snd_hda (1p:1v/1r:1v)
	snddev flags=0x2e2<AUTOVCHAN,BUSY,MPSAFE,REGISTERED,VPC>
	[pcm1:play:dsp1.p0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000004
	interrupts 0, underruns 0, feed 0, ready 0 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x2100<BUSY,HAS_VCHAN>
	{userland} -> feeder_mixer(0x00200010) -> {hardware}
	pcm1:play:dsp1.p0[pcm1:virtual:dsp1.vp0]: spd 8000, fmt 0x00100008, flags 0x10000000, 0x00000000
	interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:0/0/0]
	channel flags=0x10000000<VIRTUAL>
	{userland} -> feeder_root(0x00000000) -> {hardware}
	[pcm1:record:dsp1.r0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000005
	interrupts 0, overruns 0, feed 0, hfree 4096, sfree 4096 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x2100<BUSY,HAS_VCHAN>
	{hardware} -> feeder_root(0x00200010) -> feeder_mixer(0x00200010) -> {userland}
	pcm1:record:dsp1.r0[pcm1:virtual:dsp1.vr0]: spd 8000, fmt 0x00100008, flags 0x10000000, 0x00000000
	interrupts 0, overruns 0, feed 0, hfree 0, sfree 0 [b:0/0/0|bs:0/0/0]
	channel flags=0x10000000<VIRTUAL>
	{hardware} -> feeder_root(0x00000000) -> {userland}
```

`pindump`


```
kernel: hdaa0: Dumping AFG pins:
kernel: hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
kernel: hdaa0: 17 02214040 4  0  Headphones    Jack  1/8     Front      Green   0
kernel: hdaa0:     Caps:    OUT HP           Sense: 0x800009c0 (connected) delay 60us
kernel: hdaa0: 18 01014010 1  0  Line-out      Jack  1/8     Rear       Green   0
kernel: hdaa0:     Caps:    OUT HP EAPD      Sense: 0x80000023 (connected) delay 80us
kernel: hdaa0: 19 991301f0 15 0  Speaker       Fixed ATAPI   Onboard    Unknown 1 DISA
kernel: hdaa0:     Caps:    OUT    EAPD     
kernel: hdaa0: 20 02a19020 2  0  Mic           Jack  1/8     Front      Pink    0
kernel: hdaa0:     Caps: IN             VREF Sense: 0x800007f8 (connected) delay 60us
kernel: hdaa0: 21 01813030 3  0  Line-in       Jack  1/8     Rear       Blue    0
kernel: hdaa0:     Caps: IN             VREF Sense: 0x800007f8 (connected) delay 70us
kernel: hdaa0: 22 413301f0 15 0  CD            None  ATAPI   Rear       Unknown 1 DISA
kernel: hdaa0:     Caps: IN OUT    EAPD      Sense: 0x0000ff00 (disconnected) delay 40us
kernel: hdaa0: 23 41a601f0 15 0  Mic           None  Digital Rear       Unknown 1 DISA
kernel: hdaa0:     Caps: IN                 
kernel: hdaa0: 27 414501f0 15 0  SPDIF-out     None  Optical Rear       Unknown 1 DISA
kernel: hdaa0:     Caps:    OUT              Sense: 0x8000ff00 (connected)
kernel: hdaa0: 28 413301f0 15 0  CD            None  ATAPI   Rear       Unknown 1 DISA
kernel: hdaa0:     Caps: IN OUT         VREF Sense: 0x0000ff00 (disconnected) delay 40us
kernel: hdaa0: NumGPIO=3 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
kernel: hdaa0:  GPIO0: disabled
kernel: hdaa0:  GPIO1: disabled
kernel: hdaa0:  GPIO2: disabled
```

`mixer`


```
$ mixer -f /dev/mixer0
Mixer vol      is currently set to  75:75
Mixer pcm      is currently set to  75:75
Mixer speaker  is currently set to  75:75
Mixer mic      is currently set to  90:90
Mixer rec      is currently set to  90:90
Mixer igain    is currently set to  50:50
Mixer ogain    is currently set to  50:50
Recording source: mic

mixer -f /dev/mixer1
Mixer vol      is currently set to  76:76
Mixer pcm      is currently set to  75:75
Mixer line     is currently set to  90:90
Mixer rec      is currently set to  90:90
Recording source: line
```

`dmesg`: next post,


----------



## BostonDriver (May 8, 2013)

`dmesg` (from `kldload snd_hda`)

http://pastebin.com/58trCm3D


----------



## sunnyg (May 31, 2013)

*input/output association pairs*

I'm new here but I was working on this on my Macbook Pro earlier for a similar goal. 

According to snd_hda(4) under the as option, for every input/output pair of associations created, a separate PCM device is created. So I think adding


```
hint.hdaa.0.nid17_config="as=1 seq=0"
hint.hdaa.0.nid18_config="as=3 seq=0"
hint.hdaa.0.nid21_config="as=4 seq=0"
```

to your /boot/loader.conf and rebooting might do it.


----------

