thesofproject / linux

Linux kernel source tree
Other
91 stars 133 forks source link

The built-in microphone cannot record #4099

Open imtangmeng opened 1 year ago

imtangmeng commented 1 year ago

On the LENOVO 81M4 (LENOVO_MT_81M4_BU_idea_FM_ZhaoYang K3-IML) Notebook machine, it is found that the built-in microphone of the audio cannot record.

Hardware environment: LENOVO 81M4 (LENOVO_MT_81M4_BU_idea_FM_ZhaoYang K3-IML) Notebook LNVNB161216 8GB(HMA81GS6JJR8N-VK DDR4 2667 MT/s) Comet Lake PCH-LP cAVS/sofhdadsp /card0

For information obtained by alsa-info, refer to the following link: https://github.com/imtangmeng/intel-audio/blob/master/alsa-info.txt.8xyayNSSyT

plbossart commented 1 year ago

@imtangmeng I suspect you have the PDM1 problem, it's a classic on Lenovo platforms.

Can you add this file sof-dyndbg.conf.txt as /etc/modprobe.d/sof-dyndbg.conf and attach the full dmesg log.

Thanks!

imtangmeng commented 1 year ago

The full dmesg log is as follow: https://github.com/imtangmeng/intel-audio/blob/master/dmesg.log

plbossart commented 1 year ago

Thanks @imtangmeng so you do have 2 mics, and there's a known issue with some platforms that connect the 2 mics to PDM1 instead of the default PDM0.

[    4.077807] sof-audio-pci-intel-cnl 0000:00:1f.3: DMICs detected in NHLT tables: 2
[    4.181360] snd_sof:snd_sof_load_topology: sof-audio-pci-intel-cnl 0000:00:1f.3: loading topology:intel/sof-tplg/sof-hda-generic-2ch.tplg

the only work-around we have in those cases is to try with a different topology sof-hda-generic-2ch-pdm1.tplg (file zipped sof-hda-generic-2ch-pdm1.tplg.gz

In theory this file should already be in /lib/firmware/intel/sof-tplg, but if it isn't just unzip and copy it over to this location.

They you can use

options snd-sof-pci tplg_filename=sof-hda-generic-2ch-pdm1.tplg

if your kernel does not provide this option, which was added recently, then override your default file after backing it up.

cp sof-hda-generic-2ch.tplg sof-hda-generic-2ch.tplg.backup
cp sof-hda-generic-2ch-pdm1.tplg sof-hda-generic-2ch.tplg

This override is problematic because it will break at every distribution update.

Let us know if that fixes your issue.

imtangmeng commented 1 year ago

Unfortunately, the issue was not resolved.

After doing the following actions, the speaker, microphone and headset become unrecognizable:

cp sof-hda-generic-2ch.tplg sof-hda-generic-2ch.tplg.backup cp sof-hda-generic-2ch-pdm1.tplg sof-hda-generic-2ch.tplg

The full dmesg log is as follows: https://github.com/imtangmeng/intel-audio/blob/master/dmesg-sof-hda-generic-2ch-pdm1.log

plbossart commented 1 year ago

humm, this is really surprising. You have tons of errors not related to the DMIC, and the only differences are this

$ diff sof-hda-generic-2ch.conf sof-hda-generic-2ch-pdm1.conf 
2206,2207c2206,2207
<   tuples."short.pdm0" {
<       SOF_TKN_INTEL_DMIC_PDM_CTRL_ID      "0"
---
>   tuples."short.pdm1" {
>       SOF_TKN_INTEL_DMIC_PDM_CTRL_ID      "1"
2280,2281c2280,2281
<   tuples."short.pdm0" {
<       SOF_TKN_INTEL_DMIC_PDM_CTRL_ID      "0"
---
>   tuples."short.pdm1" {
>       SOF_TKN_INTEL_DMIC_PDM_CTRL_ID      "1"

and looking at the initial log I see this

[    4.174907] sof-audio-pci-intel-cnl 0000:00:1f.3: Firmware info: version 1:6:0-18fab

This is completely obsolete, you need to update your SOF firmware/topology first, and then try the PDM1 part later.

imtangmeng commented 1 year ago

After I updated my SOF firmware/topology and try the PDM1 part, the built-in microphone is still not recognized using: https://github.com/imtangmeng/intel-audio/blob/master/dmesg.log

plbossart commented 1 year ago

@imtangmeng well, there is progress in that there is no error at the kernel level. So you will have to try to see at the alsa hw device level what happens. See https://thesofproject.github.io/latest/getting_started/intel_debug/suggestions.html#digital-mic-issues

If your mic is not recognized at the PulseAudio/Pipewire level it's a different issue related to missing UCM files. Given that you didn't have the last firmware, it wouldn't be surprising that you also don't have the alsa-ucm-conf updates.

imtangmeng commented 1 year ago

In fact, I have updated alsa-ucm-conf first, with the following information: !!Packages installed !!--------------------

ii alsa-topology-conf 1.2.4-1 all ALSA topology configuration files ii alsa-ucm-conf 1.2.8-1 all ALSA Use Case Manager configuration files ii alsa-utils 1.2.4-1 amd64 Utilities for configuring and using ALSA

Detailed information reference link: https://github.com/imtangmeng/intel-audio/blob/master/alsa-info.txt.noVeE9NBHn

I speculate that alsa-ucm-conf may need to be modify for this machine, but I don't know how to configure it

plbossart commented 1 year ago

You don't need any specific UCM support to test the dmic support, see the link above.