# Audio input on compaq notebook



## mickey (Apr 27, 2020)

I have been trying hard to get audio input to work on my Compaq Presario CQ71-325SG notebook, which has integrated speakers and microphone as well as 2 x 3.5mm Jacks on the front to connect an external microphone and headphones aka headset. This notebook has previously been running Windows 10 which automatically installed a IDT High Definition Audio driver and I have used MicroSIP for VoIP. Now with FreeBSD 12.1-RELEASE-p4 installed I am seeing multiple problems with getting audio input to work correctly, audio output (playback) however works fine out of the box on the internal speakers which are muted when headphones get plugged into the front jack, Without any settings in /boot/device.hints and/or /etc/sysctl.conf, this is what I get:

`cat /dev/sndstat`

```
Installed devices:
pcm0: <IDT 92HD75B3 (Analog 2.0+HP/2.0)> (play/rec) default
pcm1: <NVIDIA MCP78 (Digital)> (play)
No devices installed from userspace.
```
Pindump:

```
hdaa0: Dumping AFG pins:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 10 0121101f 1  15 Headphones    Jack  1/8     Rear       Black   0
hdaa0:     Caps:    OUT HP           Sense: 0x00000000 (disconnected)
hdaa0: 11 01a11020 2  0  Mic           Jack  1/8     Rear       Black   0
hdaa0:     Caps: IN             VREF Sense: 0x80000000 (connected)
hdaa0: 12 92a71130 3  0  Mic           Fixed Analog  0x12       Black   1 DISA
hdaa0:     Caps: IN             VREF Sense: 0x00000000 (disconnected)
hdaa0: 13 90110110 1  0  Speaker       Fixed 1/8     Internal   Unknown 1
hdaa0:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa0: 14 40f000f9 15 9  Other         None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps: IN                  Sense: 0x00000000 (disconnected)
hdaa0: 20 40f000f1 15 1  Other         None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps: IN OUT             
hdaa0: 24 40f000f2 15 2  Other         None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps: IN                 
hdaa0: 30 40f000f4 15 4  Other         None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps:    OUT             
hdaa0: 31 40f000f5 15 5  Other         None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps:    OUT    EAPD     
hdaa0: 32 40f000f6 15 6  Other         None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps:    OUT             
hdaa0: NumGPIO=8 NumGPO=0 NumGPI=0 GPIWake=1 GPIUnsol=1
hdaa0:  GPIO0: disabled
hdaa0:  GPIO1: disabled
hdaa0:  GPIO2: disabled
hdaa0:  GPIO3: disabled
hdaa0:  GPIO4: disabled
hdaa0:  GPIO5: disabled
hdaa0:  GPIO6: disabled
hdaa0:  GPIO7: disabled
```
mixer:

```
Mixer vol      is currently set to  85:85
Mixer pcm      is currently set to 100:100
Mixer speaker  is currently set to 100:100
Mixer mic      is currently set to 100:100
Mixer mix      is currently set to   0:0
Mixer rec      is currently set to 100:100
Recording source: mic
```

*Problem 1*: Internal microphone disabled and using separate association number.

As evidenced by DISA appearing in above pindump for nid 12, the internal microphone is disabled in the default configuration and also it uses as=3 whereas the external microphone (nid 11) uses as=2. As far as my understanding goes, after having read through snd_hda(4) multiple times, the different association numbers would normally cause a separate pcm device to be created for the internal microphone. Apparently that does not happen as it ends up being disabled. The cause for this is likely found in the verbose boot messages:

```
hdaa0: Tracing association 2 (3)                                                                
hdaa0:  Unable to trace pin 12 to ADC 19, undo traces                                           
hdaa0: Association 2 (3) trace failed
```
I was able to fix this problem by grouping both internal and external microphone pins into the same association with one using a sequence number of 15 which according to snd_hda(4) should mean mixed devices. Setting the following in /boot/device.hints, I get the external microphone as _mic_ and the internal microphone as _monitor_ in the mixer.

```
hint.hdaa.0.nid12.config="as=2 seq=0 loc=16 color=0"                                           
hint.hdaa.0.nid11.config="as=2 seq=15 loc=2"
```

*Problem 2*: No audio input whatsoever until setting the mixer's recording source to mix once.

Trying to record audio from either internal or external microphone using `ffmpeg -f oss -i /dev/dsp test.m4a` yields complete silence until the mixer's recording source is set to _mix_ once. After that I can select either _mic_ or _monitor_ as the recording source and get audio from the external/internal microphones respectively. Thread microphone-only-works-when-i-switch-inputs.38363 shows that someone was having the same problem ~7 years ago on FreeBSD 9.x, but there was no solution and I also have a hard time figuring what kind of internal initialization setting the recording source to mix does, that magically makes sound input work. This problem seems unrelated to the other problems, i.e. whatever pin routing or other settings I have tried so far, did not make any difference in regards to this particular problem.

*Problem 3*: Noise when recording from the internal microphone.

Recording sound from an external microphone seems fine, however recording sound from the internal microphone gives a humming noise with the voice only having low volume, even when speaking from a distance of only like 20cm. So far I have not found any setting that has any influence on this.

Any ideas what else I could try are highly welcome.


----------

