Bug 262579 - Framework Laptop: headset/mic input issues
Summary: Framework Laptop: headset/mic input issues
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks: 262152
  Show dependency treegraph
 
Reported: 2022-03-15 23:24 UTC by Ed Maste
Modified: 2022-04-28 18:29 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2022-03-15 23:24:11 UTC
On a Framework laptop [new model w/ Tempo 92HD95B codec] I am unable to record anything via the built-in mic. Setting all gains to 1.00 results in a nearly silent recording. Normalizing the recorded audio shows results in white noise but with no evidence of anything picked up by the mic.

Tapping on the laptop casing near the keyboard [and normalizing] results in a recording with noise that corresponds to the taps.
Comment 1 Ed Maste freebsd_committer 2022-03-17 18:54:28 UTC
Aha, it is possible to record from /dev/dsp1 using the built-in mic.

Sound info from dmesg:

hdac0: <Intel Tiger Lake HDA Controller> mem 0x605d1c8000-0x605d1cbfff,0x605d000000-0x605d0fffff at device 31.3 on pci0
hdacc0: <Tempo 92HD95B HDA CODEC> at cad 0 on hdac0
hdaa0: <Tempo 92HD95B Audio Function Group> at nid 1 on hdacc0
pcm0: <Tempo 92HD95B (Analog)> at nid 13 and 11 on hdaa0
pcm1: <Tempo 92HD95B (Analog)> at nid 10 and 14 on hdaa0
hdacc1: <Intel Tiger Lake HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel Tiger Lake Audio Function Group> at nid 1 on hdacc1
pcm2: <Intel Tiger Lake (HDMI/DP 8ch)> at nid 4 on hdaa1

92HD95B datasheet: https://temposemi.com/wp-content/uploads/2018/05/92HD95_DS.pdf
Comment 2 Ed Maste freebsd_committer 2022-03-17 19:58:23 UTC
dmesg output from Ubuntu 21.10 for reference
(note headphone and headset mic did not work out of the box in Ubuntu)


[    6.702451] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
[    6.702508] snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002)
[    6.702766] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    6.749928] snd_hda_codec_idt hdaudioC0D0: autoconfig for 92HD95: line_outs=1 (0xd/0x0/0x0/0x0/0x0) type:speaker
[    6.749931] snd_hda_codec_idt hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    6.749932] snd_hda_codec_idt hdaudioC0D0:    hp_outs=1 (0xa/0x0/0x0/0x0/0x0)
[    6.749933] snd_hda_codec_idt hdaudioC0D0:    mono: mono_out=0x0
[    6.749934] snd_hda_codec_idt hdaudioC0D0:    inputs:
[    6.749935] snd_hda_codec_idt hdaudioC0D0:      Internal Mic=0xe
[    6.749935] snd_hda_codec_idt hdaudioC0D0:      Mic=0xb
[    6.814874] input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1f.3/sound/card0/input12
[    6.814908] input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1f.3/sound/card0/input13
[    6.814938] input: HDA Intel PCH HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input14
[    6.814965] input: HDA Intel PCH HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input15
[    6.814995] input: HDA Intel PCH HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input16
[    6.815020] input: HDA Intel PCH HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input17
[    6.815046] input: HDA Intel PCH HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input18
[    6.815064] input: HDA Intel PCH HDMI/DP,pcm=11 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input19
[    6.815081] input: HDA Intel PCH HDMI/DP,pcm=12 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input20
[    6.815098] input: HDA Intel PCH HDMI/DP,pcm=13 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input21
[    6.815115] input: HDA Intel PCH HDMI/DP,pcm=14 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input22
[    6.815132] input: HDA Intel PCH HDMI/DP,pcm=15 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input23
[    6.815149] input: HDA Intel PCH HDMI/DP,pcm=16 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input24
[    6.815167] input: HDA Intel PCH HDMI/DP,pcm=17 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input25
Comment 3 Ed Maste freebsd_committer 2022-03-18 01:34:07 UTC
With a headset plugged in, sysctl dev.hdac.0.pindump produces:

hdaa0: Dumping AFG pins:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 10 0321101f 1  15 Headphones    Jack  1/8     Left       Black   0
hdaa0:     Caps:    OUT HP EAPD      Sense: 0x80000000 (connected)
hdaa0: 11 04a19020 2  0  Mic           Jack  1/8     Right      Pink    0
hdaa0:     Caps: IN        EAPD VREF Sense: 0x80000000 (connected)
hdaa0: 12 40f000f0 15 0  Other         None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps: IN        EAPD VREF Sense: 0x00000000 (disconnected)
hdaa0: 13 90134110 1  0  Speaker       Fixed ATAPI   Internal   Green   1
hdaa0:     Caps:    OUT    EAPD     
hdaa0: 14 90a31130 3  0  Mic           Fixed ATAPI   Internal   Black   1
hdaa0:     Caps: IN                 
hdaa0: 15 40f000f0 15 0  Other         None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps: IN                 
hdaa0: 24 40f000f0 15 0  Other         None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa0: NumGPIO=4 NumGPO=0 NumGPI=0 GPIWake=1 GPIUnsol=1
hdaa0:  GPIO0: disabled
hdaa0:  GPIO1: disabled
hdaa0:  GPIO2: disabled
hdaa0:  GPIO3: disabled

The codec datasheet has this interesting note:

To ensure that the BIAS voltage reaches a level of ~2.6V, please add the following widgets to the codec initialization routine at system power-on: 0x0017E442, 0x 0017DC02, 0x0017EA0D. Testing has shown that the microphone in some headsets may not function properly unless these widgets are properly configured.
Comment 4 Jonathan Vasquez 2022-04-28 16:30:49 UTC
Hey Ed,

I'm also experiencing some issues with some parts of Sound / Headset on the framework laptop as well. I'm running FreeBSD 14.0-CURRENT #0 main-n255077-490a0f77de7 with the same Tempo chip. I noticed that:

1. Sound (Speakers) works fine.
2. Sound (Headset via 3.5 mm jack) works fine and sound is properly redirected.
3. Sound (Headset via 3.5 mm -> USB adapter) gives the below output in 'dmesg', but nothing shows up in KDE's audio devices window and no apps use it.

ugen1.9: <Razer Razer USB Sound Card> at usbus1
uaudio0 on uhub1
uaudio0: <Razer Razer USB Sound Card, class 0/0, rev 2.00/0.0e, addr 27> on usbus1
uaudio0: Play[0]: 48000 Hz, 2 ch, 24-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 16000 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
uaudio0: No MIDI sequencer.
pcm3: <USB audio> on uaudio0
uaudio0: HID volume keys found.

4. Microphone seemed to work fine for recording in OBS. I was able to record my voice and it didn't seem like there was any distortion. The physical microphone kill switch also seemed to disable audio input as well.
Comment 5 Ed Maste freebsd_committer 2022-04-28 16:49:04 UTC
(In reply to Jonathan Vasquez from comment #4)

A couple of questions:

- What does `cat /dev/sndstat` show with the USB device plugged in? Try `beep -d /dev/dsp1.0` (or dsp2.0 etc.), do you get a beep on the USB-connected device?

- What device did you select for recording with the built-in mic?

- Have you tried a headset with mic? (i.e., TRRS plug)

- Do you have an older (before Oct 2021) or newer Framework (i.e., do you have a TSI 92HD95B codec or Realtek ALC295)?
Comment 6 Jonathan Vasquez 2022-04-28 17:04:26 UTC
Hey Ed,

1. Given this output when plugging in the device via the USB adapter:

ugen1.10: <Razer Razer USB Sound Card> at usbus1
uhid2 on uhub1
uhid2: <Razer Razer USB Sound Card, class 0/0, rev 2.00/0.0e, addr 9> on usbus1
uaudio0 on uhub1
uaudio0: <Razer Razer USB Sound Card, class 0/0, rev 2.00/0.0e, addr 9> on usbus1
uaudio0: Play[0]: 48000 Hz, 2 ch, 24-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
uaudio0: Record[0]: 16000 Hz, 2 ch, 16-bit S-LE PCM format, 2x2ms buffer.
uaudio0: No MIDI sequencer.
pcm3: <USB audio> on uaudio0
uaudio0: No HID volume keys found.

The following output for 'cat /dev/sndstat' is displayed:

Installed devices:
pcm0: <Tempo 92HD95B (Analog 2.0+HP/2.0)> (play/rec) default
pcm1: <Tempo 92HD95B (Internal Analog Mic)> (rec)
pcm2: <Intel Tiger Lake (HDMI/DP 8ch)> (play)
pcm3: <USB audio> (play/rec)
No devices installed from userspace.

No beep was audible when doing 'beep /dev/dsp1.0' or 'beep /dev/dsp2.0'. I also tried the 0.0 and 0.1 dsps but those were for other parts of the system it seems haha (0.1 produced a beep for the normal speakers, and 0.0 didn't yield any sound).

2. I selected the 'Tempo 92HD95B (Internal Analog Mic)' in OBS's 'Mic/Auxiliary Audio' box.

3. This Razer Headset actually does have a Mic option but I didn't plug it in and test it originally (I completely forgot about it haha since it doesn't work on Linux and so I usually just leave the Mic extension disconnected). However, connecting it now didn't yield any results in 'dmesg' and no option to use the Mic was displayed. I also attempted to unplug and plug the headset with the microphone extension already attached and there was no difference in the dmesg output or available microphone options. I'm guessing maybe because the USB adapter serves as a way to communicate/convert the output/input channels between the 3.5 mm jack (analog) and digital via this adapter.. so I'm thinking the "Record[0]" lines may be related to this functionality.

4. I ordered this laptop on November 20, 2021 as part of Batch 6. 'dmesg' shows the following:

$ dmesg | grep 92HD95B

hdacc0: <Tempo 92HD95B HDA CODEC> at cad 0 on hdac0
hdaa0: <Tempo 92HD95B Audio Function Group>GEOM_ELI: Encryption: AES-XTS 256
pcm0: <Tempo 92HD95B (Analog 2.0+HP/2.0)> at nid 13,10 and 11 on hdaa0
pcm1: <Tempo 92HD95B (Internal Analog Mic)> at nid 14 on hdaa0

$ dmesg | grep 295
<nothing>
Comment 7 Jonathan Vasquez 2022-04-28 17:07:46 UTC
For the record, I'm also documenting all of this here:

https://xyinn.org/md/freebsd/framework_laptop
Comment 8 Ed Maste freebsd_committer 2022-04-28 18:17:49 UTC
(In reply to Jonathan Vasquez from comment #6)
> pcm3: <USB audio> (play/rec)

In that case, try beep -d /dev/dsp3.0.

A TRRS mic should be accessible via pcm0 / /dev/dsp0.x but I think some special config for the 92HD95B might be needed.

You can check sysctl dev.hdac.0.pindump with the headset plugged/unplugged, I believe with a mic connected you should see it as:

hdaa0: 11 04a19020 2  0  Mic           Jack  1/8     Right      Pink    0
hdaa0:     Caps: IN        EAPD VREF Sense: 0x80000000 (connected)

(Location and colour incorrect here.)
Comment 9 Jonathan Vasquez 2022-04-28 18:29:56 UTC
So when I tested the /dev/dsp* devices before, it listed only 0.0, 0.1, 1.0, and 2.0. After a reboot, it lists 0.0, 1.0, 2.0, and 3.0. So it seems the numbers may be changing. Either way, at this enumeration, I was able to hear the beep at 3.0. I may have incorrectly omitted the "-d" flag before but not sure given the enumeration change.

jon@leslie:~ $ ls /dev/ds*
/dev/dsp0.0     /dev/dsp1.0     /dev/dsp2.0     /dev/dsp3.0

jon@leslie:~ $ beep -d /dev/dsp0.0  <-- main speakers

jon@leslie:~ $ beep -d /dev/dsp1.0  <-- failed (not sure what device this is)
beep: Failed to open '/dev/dsp1.0'

jon@leslie:~ $ beep -d /dev/dsp2.0  <-- I didn't hear any particular sound but I'm wondering if this is actually the 3.5mm jack.

jon@leslie:~ $ beep -d /dev/dsp3.0  <-- Headset over USB (worked)

Regarding 'pindump':

Regardless of whether it was plugged in or not (via USB Adapter), or even if it was just the 3.5 mm jack directly, 'sysctl dev.hdac.0.pindump' always just said:

dev.hdac.0.pindump: 0