thesofproject / linux

Linux kernel source tree
Other
91 stars 131 forks source link

[BUG] No microphone input on ASUS TUF Gaming F15 laptop #4729

Open AnErrupTion opened 10 months ago

AnErrupTion commented 10 months ago

Describe the bug I don't get any sound from my laptop's internal microphone, on my ASUS TUF Gaming F15, model TUF506HCB (Tiger Lake).

To Reproduce Clean install of Debian Sid with the firmware-sof-signed package installed.

Reproduction Rate Always (100%).

Expected behavior I should get some form of input from my internal microphone.

Impact I'm unable to use my internal microphone to talk to my friends on Discord, and I have to use a headset instead (in which case it does work, I do get sound from its microphone).

Environment 1) Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).

Screenshots or console output amixer -c 1:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 87 [100%] [0.00dB] [off]
  Front Right: Playback 87 [100%] [0.00dB] [off]
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 87 [100%] [0.00dB] [on]
  Front Right: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'IEC958',1
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'IEC958',2
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 63
  Front Left: Capture 63 [100%] [30.00dB] [on]
  Front Right: Capture 63 [100%] [30.00dB] [on]
Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Disabled'
Simple mixer control 'Headset Mic',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Mono
  Mono: Capture [on]
Simple mixer control 'Headset Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Internal Mic',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Mono
  Mono: Capture [off]
Simple mixer control 'Internal Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 1 [33%] [10.00dB]
  Front Right: 1 [33%] [10.00dB]
Simple mixer control 'PGA1.0 1 Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]
Simple mixer control 'PGA2.0 2 Master',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 80
  Front Left: Capture 50 [62%] [0.00dB]
  Front Right: Capture 50 [62%] [0.00dB]
Simple mixer control 'PGA30.0 30',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]
Simple mixer control 'PGA31.0 31',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]
Simple mixer control 'PGA7.0 7 Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]
Simple mixer control 'PGA8.0 8 Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]
Simple mixer control 'PGA9.0 9 Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]

amixer info -c 1:

Card sysdefault:1 'sofhdadsp'/'ASUSTeKCOMPUTERINC.-ASUSTUFGamingF15FX506HCB_TUF566HCB-1.0-FX506HCB'
  Mixer name    : 'Realtek ALC256'
  Components    : 'HDA:80862812,80860101,00100000 HDA:10ec0256,104316f2,00100002'
  Controls      : 45
  Simple ctrls  : 19

sudo dmesg | grep sof-:

[    3.432477] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002)
[    3.432682] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[    3.432790] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    3.439610] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode
[    3.460251] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 5
[    3.460254] sof-audio-pci-intel-tgl 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[    3.460256] sof-audio-pci-intel-tgl 0000:00:1f.3: DMICs detected in NHLT tables: 0
[    3.461278] sof-audio-pci-intel-tgl 0000:00:1f.3: firmware: direct-loading firmware intel/sof/sof-tgl-h.ri
[    3.462734] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    3.462736] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[    3.462739] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
[    3.547819] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    3.547821] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[    3.552836] sof-audio-pci-intel-tgl 0000:00:1f.3: firmware: direct-loading firmware intel/sof-tplg/sof-hda-generic.tplg
[    3.552937] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0
[    3.633441] input: sof-hda-dsp Headphone as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input22
[    3.633477] input: sof-hda-dsp HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input23
[    3.633497] input: sof-hda-dsp HDMI/DP,pcm=4 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input24
[    3.633517] input: sof-hda-dsp HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input25

By the way, please tell me if some information is missing, I tried my best to include all of it though.

plbossart commented 10 months ago

It's not clear that you have a PCH-attached DMIC:

DMICs detected in NHLT tables: 0

That tells us there is no information in ACPI regarding microphones. Either the hardware connects microphones to the HDaudio codec, or the ACPI table is wrong.

AnErrupTion commented 10 months ago

It's not clear that you have a PCH-attached DMIC:

DMICs detected in NHLT tables: 0

That tells us there is no information in ACPI regarding microphones. Either the hardware connects microphones to the HDaudio codec, or the ACPI table is wrong.

So, is there anything I can do, like providing more information? Maybe I could provide the specific ACPI table (I'm not sure which one it is though, or if it would even be helpful), since I don't know anything about my hardware in that regard.

plbossart commented 10 months ago

You could try to force the number of mics to 4 and see if you see any signs of life in the recording.

add this /etc/modprobe.d/alsa-base.conf options snd_sof_intel_hda_common dmic_num=4

arecord -Dhw:0,6 -c4 -r48000 -fS32_LE -d 10 test.wav

Also try to add this file sof-dyndbg.conf.txt as /etc/modprobe.d/sof-dyndbg.conf, reboot and attach the dmesg log.

AnErrupTion commented 10 months ago

You could try to force the number of mics to 4 and see if you see any signs of life in the recording.

add this /etc/modprobe.d/alsa-base.conf options snd_sof_intel_hda_common dmic_num=4

arecord -Dhw:0,6 -c4 -r48000 -fS32_LE -d 10 test.wav

Also try to add this file sof-dyndbg.conf.txt as /etc/modprobe.d/sof-dyndbg.conf, reboot and attach the dmesg log.

Things are looking better! I now see 2 input devices instead of 1 like before when adding dmic_num=4: image

Unfortunately, I still can't hear my voice: on the first input on the list above, I can only hear static, and on the second one, I can't hear anything.

Here is the dmesg log, as requested: dmesg.txt

plbossart commented 10 months ago

you really want to record at the alsa level only with the command I suggested and look at the waveforms. arecord -Dhw:0,6 -c4 -r48000 -fS32_LE -d 10 test.wav

If you can't hear anything I am afraid there's no hardware really.

What I find surprising is that if you have no dmics then there would be no reason to use the SOF driver. Unfortunately your dmesg buffer is way too small, I can't see any of the initial probe/configuration parts. Please increase the console size and rerun the tests.

AnErrupTion commented 10 months ago

you really want to record at the alsa level only with the command I suggested and look at the waveforms. arecord -Dhw:0,6 -c4 -r48000 -fS32_LE -d 10 test.wav

If you can't hear anything I am afraid there's no hardware really.

What I find surprising is that if you have no dmics then there would be no reason to use the SOF driver. Unfortunately your dmesg buffer is way too small, I can't see any of the initial probe/configuration parts. Please increase the console size and rerun the tests.

Here are the waveforms in Audacity: image

I can't see anything unfortunately, apart from this sound at the very beginning: it's a very high pitched sound that gets louder and louder until some point where it instantly stops.

Here's what should be the dmesg complete log (this time I checked and it looks complete :D): dmesg.txt

plbossart commented 10 months ago

@AnErrupTion is there a specific reason why you forced the use of the SOF driver? this command line option bypasses the driver selection:

snd-intel-dspcfg.dsp_driver=3

Please try and remove it and see what happens with the snd-hda-intel driver.

I am pretty sure you do not have any DMICs connected to the DSP, as shown by the zero signal (except for the DC removal at the start that's typically the sign of no mic connected).

AnErrupTion commented 10 months ago

is there a specific reason why you forced the use of the SOF driver? this command line option bypasses the driver selection:

There is, it was to get potentially better audio on Linux, but when installing the SOF firmware it wasn't getting loaded automatically for some reason, so I just forced its initialization. It seemed like it worked too, at least for the audio output part, which is why I kept it this way until I needed to use my internal microphone again.

Please try and remove it and see what happens with the snd-hda-intel driver.

Well yeah, now my internal microphone works perfectly again.

plbossart commented 10 months ago

Ok, so in theory the SOF driver should work just fine with the HDaudio internal mic - since we rely on snd-hda-intel for all the codec-side configuration - but there's likely a configuration missing.

Can you try to force SOF again with the snd-intel-dspcfg.dsp_driver=3 option but use a headset microphone? If this works, then clearly there's a set of mixer configuration issues for the internal mic. We should really try and figure out what the issue is.

There isn't much benefit to the SOF driver for now, it's just a glorified DMA for HDaudio, but this may change in the future with some enhancements that @singalsu is working on.

AnErrupTion commented 10 months ago

Can you try to force SOF again with the snd-intel-dspcfg.dsp_driver=3 option but use a headset microphone?

I used my headset's microphone with SOF even before filing this issue and it worked perfectly fine. But since I may get a pair of headphones without a microphone, I've been more interested in using my internal microphone.

plbossart commented 10 months ago

This really points to a configuration issue, we probably need to use alsa-info to try to see any differences in mixer configurations with and withtout the dsp_driver=3 option. Can you attach both files please while trying to record from the internal mic with the alsa hw: device (not the UI tools).

AnErrupTion commented 10 months ago

Can you attach both files please while trying to record from the internal mic with the alsa hw: device (not the UI tools).

Which files? Do you want me run the alsa-info.sh script (and in which case, with which options?) with and without the dsp_driver=3 option?

plbossart commented 10 months ago

Can you attach both files please while trying to record from the internal mic with the alsa hw: device (not the UI tools).

Which files? Do you want me run the alsa-info.sh script (and in which case, with which options?) with and without the dsp_driver=3 option?

yep.

AnErrupTion commented 10 months ago

Without SOF: http://alsa-project.org/db/?f=f0570cac3ef4e3c58a7a6c65c5819dec309cd422

With SOF: http://alsa-project.org/db/?f=747dc5631799defe9f082b39b571d3a1f5eab3a5

Note that when running the script with SOF, I found this message in the console:

cat: '/sys/module/snd_soc_skl_hda_dsp/parameters/*': No such file or directory
plbossart commented 10 months ago

Just to be clear, you ran those tests without any headphone/headset connected?

In the SOF case I see this headset switch on, it's off without SOF.

Simple mixer control 'Headset Mic',0 Capabilities: cswitch cswitch-joined cswitch-exclusive Capture exclusive group: 0 Capture channels: Mono Mono: Capture [on]

the internal mic is also disabled, it's on without SOF

Simple mixer control 'Internal Mic',0 Capabilities: cswitch cswitch-joined cswitch-exclusive Capture exclusive group: 0 Capture channels: Mono Mono: Capture [off]

AnErrupTion commented 10 months ago

Just to be clear, you ran those tests without any headphone/headset connected?

Actually I did run those tests with my headset plugged in. I can re-run them without it plugged in, if necessary.

the internal mic is also disabled, it's on without SOF

With alsamixer, I can see this: image

It's not clear to me how to enable it, if possible in the first place.

plbossart commented 10 months ago

please re-run the tests with the headset removed. There's clearly something different wrt jack detection.

AnErrupTion commented 10 months ago

please re-run the tests with the headset removed. There's clearly something different wrt jack detection.

Here are the tests re-ran without the headset plugged in:

Without SOF: http://alsa-project.org/db/?f=a8bae051833da787d02f978fa47db3c438249598

With SOF: http://alsa-project.org/db/?f=3e1ae73ddbf0c6cbf6df239577f39e33c3c9ae21

plbossart commented 10 months ago

without SOF Simple mixer control 'Headset Mic',0 Capabilities: cswitch cswitch-joined cswitch-exclusive Capture exclusive group: 0 Capture channels: Mono Mono: Capture [off]

with SOF Simple mixer control 'Headset Mic',0 Capabilities: cswitch cswitch-joined cswitch-exclusive Capture exclusive group: 0 Capture channels: Mono Mono: Capture [on]

Clearly that will not work...Not sure if this can be modified or is this is a problem with the codec itself.

AnErrupTion commented 10 months ago

Clearly that will not work...Not sure if this can be modified or is this is a problem with the codec itself.

So, is there anything else I can do on my end?

plbossart commented 10 months ago

you can try to muck with those controls and set them to the same value as the 'no SOF' version