Bug 262579 - Framework Laptop: headset/mic input issues
Summary: Framework Laptop: headset/mic input issues
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks: frameworklaptop
  Show dependency treegraph
 
Reported: 2022-03-15 23:24 UTC by Ed Maste
Modified: 2024-01-10 17:08 UTC (History)
6 users (show)

See Also:
koobs: mfc-stable13+
koobs: mfc-stable12?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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
Comment 10 Jonathan Vasquez 2022-08-06 01:55:39 UTC
I got a chance today to retest my razer headset over 3.5mm -> USB -> laptop, and it works fine. I think it probably was a user error on my part a few months ago. Once I set the /dev/pcm3 device as the default in "mixertui", and restarting any application that currently needed the audio device, allowed the sound to work properly.
Comment 11 Jonathan Vasquez 2022-08-06 01:56:44 UTC
I meant to say the "pcm3 device in mixertui".
Comment 12 commit-hook freebsd_committer freebsd_triage 2022-09-13 16:16:59 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d88dc1b0b9af4de5ecbe0cdae1cea6055c8c9ec8

commit d88dc1b0b9af4de5ecbe0cdae1cea6055c8c9ec8
Author:     Pavel Timofeev <timp87@gmail.com>
AuthorDate: 2022-08-28 23:31:40 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-09-13 16:16:26 +0000

    hda: add patch for Framework laptop v2 headphone jack

    Fix headphone (12th gen Intel laptops) and mic jack (both 11th and
    12th gen) switching.

    PR:             262579
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D36354

 sys/dev/sound/pci/hda/hdaa_patches.c | 6 +++++-
 sys/dev/sound/pci/hda/hdac.h         | 3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)
Comment 13 Nuno Teixeira freebsd_committer freebsd_triage 2022-09-14 11:45:09 UTC
Hi @emaste!

Could you take a look at #265632 or https://reviews.freebsd.org/D36511 ?

Thanks
Comment 14 commit-hook freebsd_committer freebsd_triage 2022-09-20 00:46:45 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=04c146afea26ea71c6f628ed94435740f87eda7e

commit 04c146afea26ea71c6f628ed94435740f87eda7e
Author:     Pavel Timofeev <timp87@gmail.com>
AuthorDate: 2022-08-28 23:31:40 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-09-20 00:45:40 +0000

    hda: add patch for Framework laptop v2 headphone jack

    Fix headphone (12th gen Intel laptops) and mic jack (both 11th and
    12th gen) switching.

    PR:             262579
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D36354

    (cherry picked from commit d88dc1b0b9af4de5ecbe0cdae1cea6055c8c9ec8)

 sys/dev/sound/pci/hda/hdaa_patches.c | 6 +++++-
 sys/dev/sound/pci/hda/hdac.h         | 3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)
Comment 15 Kubilay Kocak freebsd_committer freebsd_triage 2022-10-26 02:20:15 UTC
@Ed Can this go to stable/12, or is it not affected?
Comment 16 Pavel Timofeev 2023-01-27 16:52:52 UTC
(In reply to Kubilay Kocak from comment #15)
It probably is
Comment 17 Ed Maste freebsd_committer freebsd_triage 2023-01-27 19:39:31 UTC
(In reply to Kubilay Kocak from comment #15)
stable/12 is affected but there's refactoring and other work that was done between stable/12 and those commits, so it cannot be trivially merged. There are no more 12.x releases to come, so these changes will only be available in 13 and later.
Comment 18 Mark Linimon freebsd_committer freebsd_triage 2023-12-27 16:51:49 UTC
^Triage: closed as already committed to 12 and 13.
Comment 19 mmatalka 2024-01-10 16:05:00 UTC
Hello,

I have a Framework with Tempo 92HD95B and am unable to record via mic jack or laptop mic.

My dmesg is:

kernel: hdacc0: <Tempo 92HD95B HDA CODEC> at cad 0 on hdac0
kernel: hdaa0: <Tempo 92HD95B Audio Function Group> at nid 1 on hdacc0
kernel: pcm0: <Tempo 92HD95B (Analog 2.0+HP/2.0)> at nid 13,10 and 14,11 on hdaa0

/dev/sndstat

FreeBSD Audio Driver (64bit 2009061500/amd64)
Installed devices:
pcm0: <Tempo 92HD95B (Analog 2.0+HP/2.0)> on hdaa0  (1p:2v/2r:1v) default
        snddev flags=0x2e2<AUTOVCHAN,BUSY,MPSAFE,REGISTERED,VPC>
        [pcm0:play:dsp0.p0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000004
        interrupts 2244, underruns 0, feed 2244, ready 0 [b:2048/1024/2|bs:2048/1024/2]
        channel flags=0x2100<BUSY,HAS_VCHAN>
        {userland} -> feeder_mixer(0x00200010) -> {hardware}
        pcm0:play:dsp0.p0[pcm0:virtual:dsp0.vp0]: spd 48000, fmt 0x00200010, flags 0x10000000, 0x00000021
        interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:8192/1024/8]
        channel flags=0x10000000<VIRTUAL>
        {userland} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) -> {hardware}
        pcm0:play:dsp0.p0[pcm0:virtual:dsp0.vp1]: spd 48000, fmt 0x00200010, flags 0x10000000, 0x00000021
        interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:8192/1024/8]
        channel flags=0x10000000<VIRTUAL>
        {userland} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) -> {hardware}
        [pcm0:record:dsp0.r0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000005
        interrupts 0, overruns 0, feed 0, hfree 512, sfree 512 [b:512/256/2|bs:512/256/2]
        channel flags=0x2100<BUSY,HAS_VCHAN>
        {hardware} -> feeder_root(0x00200010) -> feeder_mixer(0x00200010) -> {userland}
        [pcm0:record:dsp0.r1]: spd 44100, fmt 0x00200010, flags 0x00000000, 0x00000021
        interrupts 0, overruns 0, feed 0, hfree 512, sfree 32768 [b:512/256/2|bs:32768/256/128]
        channel flags=0x0
        {hardware} -> feeder_root(0x00200010) -> feeder_volume(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}
No devices installed from userspace.


And uname -a

FreeBSD bix 15.0-CURRENT FreeBSD 15.0-CURRENT #6 main-n267044-eb4d13126d85: Fri Dec 22 11:53:07 CET 2023     root@bix:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

Let me know if I should make a new ticket or this validly fits in here as a regression, or maybe I am just doing something wrong?
Comment 20 Ed Maste freebsd_committer freebsd_triage 2024-01-10 17:08:54 UTC
(In reply to mmatalka from comment #19)
I suspect that you are encountering an issue that was never fixed. Most likely the commits above were necessary, but not sufficient, to address all issues.

That said, to avoid confusion it would be best to have a new bug report open for the issue you have; this one can be referenced as a "See Also".