linux icon indicating copy to clipboard operation
linux copied to clipboard

[FEATURE] Xiaomi Redmibook 16 2024 mic is not working

Open OrelSokolov opened this issue 1 year ago • 30 comments

So can anyone help with implementing firmware for this model? What should I provide?

options snd-hda-intel dmic_detect=0 currently works for sound, but internal microphone does not work. 3.5 headset works.

Thanks.

UPD: Windows works fine with internal mic, device info:

INTELAUDIO\CTLR_DEV_7E28&LINKTYPE_02&DEVTYPE_00&VEN_8086&DEV_AE20&SUBSYS_1D722309&REV_10EC\5&1ed5312d&0&0000

OrelSokolov avatar May 28 '24 06:05 OrelSokolov

please share the output of 'alsa-info', it's not clear that it's an SOF problem but more likely a Linux hardware detection issue.

plbossart avatar May 28 '24 12:05 plbossart

@plbossart https://alsa-project.org/db/?f=d737cae0b969ade16eb2ee0cc55ef12687a840ff

OrelSokolov avatar May 30 '24 13:05 OrelSokolov

Looks like this issue is unrelated to SOF and is a platform issue with HDA mic integration.

lgirdwood avatar Jun 10 '24 16:06 lgirdwood

please share alsa-info without this "option snd_intel_dspcfg: dsp_driver=1"

plbossart avatar Jun 10 '24 18:06 plbossart

@plbossart how to do this? I ran just alsa-info without any options.

OrelSokolov avatar Jun 11 '24 08:06 OrelSokolov

you have this option somewhere in /etc/modprobe.d/*.conf. Remove it, reboot and send the results of alsa-info.

plbossart avatar Jun 11 '24 09:06 plbossart

double check the results,

!!Modprobe options (Sound related)
!!--------------------------------

snd_pcsp: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2
snd_usb_audio: index=-2
snd_usb_caiaq: index=-2
snd_usb_ua101: index=-2
snd_usb_us122l: index=-2
snd_usb_usx2y: index=-2
snd_cmipci: mpu_port=0x330 fm_port=0x388
snd_pcsp: index=-2
snd_usb_audio: index=-2
snd_intel_dspcfg: dsp_driver=1 <<<< THIS NEEDS TO BE GONE

plbossart avatar Jun 11 '24 09:06 plbossart

@plbossart done https://alsa-project.org/db/?f=b1f3f31e1135aa62303b8ac4ed4a30c40d382bad

OrelSokolov avatar Jun 11 '24 10:06 OrelSokolov

Ha yes, we've seen this before

[    6.000606] sof-audio-pci-intel-mtl 0000:00:1f.3: no matching blob for sample rate: 48000 sample width: 32 channels: 4
[    6.000623] sof-audio-pci-intel-mtl 0000:00:1f.3: failed to prepare widget dai-copier.DMIC.dmic01.capture
[    6.000629] sof-audio-pci-intel-mtl 0000:00:1f.3: Failed to prepare connected widgets

This was reported in https://github.com/thesofproject/linux/issues/4973 and fixed by https://github.com/thesofproject/linux/commit/806f52fcaa524083b565187154bdaf014781ed4b

The patch was submitted upstream and is already in maintainer branches, commit d556f807bda0b260b392069b3c8ac9e6491f0025, and already in Linus' tree.

Please try to apply this commit or wait until it shows up in your distribution.

plbossart avatar Jun 11 '24 10:06 plbossart

@plbossart so how can I fix this on Ubuntu? Kernel did not help some weeks ago.

OrelSokolov avatar Jun 11 '24 11:06 OrelSokolov

you can compile your own kernel or wait for the Ubuntu kernel to have this supported. Presumably the fix will be applied to Linux stable so all distros will get the fix at some point.

plbossart avatar Jun 11 '24 11:06 plbossart

@plbossart thanks a lot!

OrelSokolov avatar Jun 11 '24 11:06 OrelSokolov

@plbossart this is not Huawei, this is Xiaomi

OrelSokolov avatar Jun 12 '24 10:06 OrelSokolov

@plbossart anyway, I am running 6.10rc2, looks like it includes this commit. But still no any microphone input.

Can you please give advice how to configure alsa now?

https://alsa-project.org/db/?f=ebfc9d57a9e98132909114151d1f70e9109b8eaa

OrelSokolov avatar Jun 12 '24 11:06 OrelSokolov

are you sure this is the right log? There's the same error

[    5.310431] sof-audio-pci-intel-mtl 0000:00:1f.3: no matching blob for sample rate: 48000 sample width: 32 channels: 4
[    5.310450] sof-audio-pci-intel-mtl 0000:00:1f.3: failed to prepare widget dai-copier.DMIC.dmic01.capture
[    5.310457] sof-audio-pci-intel-mtl 0000:00:1f.3: Failed to prepare connected widgets

I can't recall if we need a topology update as well. @ujfalusi might know?

plbossart avatar Jun 12 '24 13:06 plbossart

@plbossart as you can see this is within new kernel 6.10 which includes your patch. And yes, I have no idea how to setup this thing properly. I turned off again dsp driver, I tried to install some repos from the SOF project earlier. So I have no clue what is the correct combination of these. That's why I created and issue to ask for help to detect correct combination of kernel, driver, config and etc...

OrelSokolov avatar Jun 12 '24 13:06 OrelSokolov

Can you also extract the NHLT?

cat /sys/firmware/acpi/tables/NHLT > nhlt.dat; gzip nhlt.dat

and attach the zipped file, thanks!

plbossart avatar Jun 12 '24 14:06 plbossart

nhlt.dat.gz

OrelSokolov avatar Jun 12 '24 14:06 OrelSokolov

nhlt.dsl.txt

This still looks like the 16-bit issue corrected by the commit d556f80

my money is on the topology now. Please try to add (backup what you have of course!) from this comment: https://github.com/thesofproject/linux/issues/4973#issuecomment-2099838538

plbossart avatar Jun 12 '24 14:06 plbossart

@plbossart locate command gives this

/usr/lib/firmware/intel/sof-ipc4-tplg/sof-hda-generic-4ch.tplg
/usr/lib/firmware/intel/sof-ipc4-tplg-v2.9/sof-hda-generic-4ch.tplg
/usr/lib/firmware/intel/sof-ipc4-tplg-v2.9/sof-hda-generic-4ch.tplg.zst
/usr/lib/firmware/intel/sof-tplg/sof-hda-generic-4ch.tplg
/usr/lib/firmware/intel/sof-tplg/sof-hda-generic-4ch.tplg.zst

OrelSokolov avatar Jun 12 '24 17:06 OrelSokolov

@plbossart OMG it works!!!! Without any additional options

Thanks. What is futher steps to fix this in codebase?

https://alsa-project.org/db/?f=71084485390ea3ac2dab60932cd23e0ee6b91e16

OrelSokolov avatar Jun 12 '24 17:06 OrelSokolov

Excellent.

What is futher steps to fix this in codebase?

If you meant "when is this going to be supported by distros", there will be an 'sof-bin' 2.10 release soonish - in the coming weeks - where the required topology will be included. The kernel patch should also be propagated to stable kernels but that takes time and depends on stable maintainers.

plbossart avatar Jun 12 '24 20:06 plbossart

@plbossart Yes, I mean when this update will be in the linux kernel or somewhere downloadable.

OrelSokolov avatar Jun 12 '24 20:06 OrelSokolov

Fedora is now on Linux 6.10.7 SOF 2024.06, sound and microphone both work.

yw662 avatar Sep 06 '24 03:09 yw662

I'm on Fedora KDE now and can confirm that sound and microphone is working now. However something in the sound pipepline seems to crash somehow after some time. I get robotic sounding voices, everything sounds distored. It stops when I switch to pro audio in the sound settings. When I get it on pro audio, it stops again when switching to play hi fi quality music. Maybe some buffering issues. It seems I can trigger it faster when skipping trough a youtube video with the arrow keys, and often start and stop playing sounds. But yeah, maybe the issue is somewhere in pipewire idk. Anyone else with a redmibook 16 that has this now ? I was on bazzite before (fedora atomic spin with custom kernel) with kernel 6.10, and the sof files from march. So for me its hard to say what introduced this on my side...

johndoe3535 avatar Sep 10 '24 08:09 johndoe3535

I'm on Fedora KDE now and can confirm that sound and microphone is working now. However something in the sound pipepline seems to crash somehow after some time. I get robotic sounding voices, everything sounds distored. It stops when I switch to pro audio in the sound settings. When I get it on pro audio, it stops again when switching to play hi fi quality music. Maybe some buffering issues. It seems I can trigger it faster when skipping trough a youtube video with the arrow keys, and often start and stop playing sounds. But yeah, maybe the issue is somewhere in pipewire idk. Anyone else with a redmibook 16 that has this now ? I was on bazzite before (fedora atomic spin with custom kernel) with kernel 6.10, and the sof files from march. So for me its hard to say what introduced this on my side...

Same issues on Arch Linux (linux=6.10.8, sof-firmware=2024.06, pipewire 1:1.2.3).

Steps to reproduce robotic sound:

  • change microphone level => gets robotic sound until toggle card on/off or switch card profile

Steps to reproduce missed sound:

  • start play sound on user1 and tty1
  • switch to the user2 on tty2 and play something sound too
  • return to the user1 on tt1 => gets missed sound in any application until toggle card profile

malvery avatar Sep 10 '24 10:09 malvery

@johndoe3535, @malvery, can you describe or better provide a recording of the 'robotic' sound? The robotic sound is on the playback or capture direction?

ujfalusi avatar Sep 11 '24 08:09 ujfalusi

@ujfalusi I can confirm this issue. This is completely random issue. I have this issue while using Chrome browser. Restarting application process helps. Bug just adds glitches to the original sound, so it sounds similar to original sound just with glitches.

OrelSokolov avatar Sep 12 '24 14:09 OrelSokolov

@OrelSokolov, so it is with playback? Pipewire/Pulseaudio keeps the audio open for few more seconds after the last user is gone, stopping/restarting application 'fast' enough will still use the same stream the audio was opened with (the sound servers are playing silence when no client is around).

If the issue is easy to reproduce, can you make a recording of it with a phone for example for us to hear it? A video is also good so we could see what is going on in the UI.

I think we will need to collect firmware logs to have cleaner picture and more data points.

ujfalusi avatar Sep 13 '24 05:09 ujfalusi

@johndoe3535, @malvery, can you describe or better provide a recording of the 'robotic' sound? The robotic sound is on the playback or capture direction?

Recorded "robotic" sound on the attached video https://github.com/user-attachments/assets/6221b976-dbba-4026-ba7d-f3011afe3804

How can I help in collecting firmware logs ?

malvery avatar Sep 15 '24 15:09 malvery