linux icon indicating copy to clipboard operation
linux copied to clipboard

[BUG] Headset microphone doesn't work on ASUS Zenbook UX435

Open szatanjl opened this issue 2 years ago • 6 comments

Describe the bug

Microphone in headset connected to a laptop (ASUS Zenbook UX435EG) via jack doesn't work. Works on Windows no problem. Built-in laptop microphone gets detected as "Tiger Lake-LP Smart Sound Technology Audio Controller Digital Microphone" and works without any issues. But the headset one is either not detected or detected but picks up only silence.

In pulsemixer I can see two Inputs:

  • "Tiger Lake-LP Smart Sound Technology Audio Controller Digital Microphone" - built-in microphone
  • "Tiger Lake-LP Smart Sound Technology Audio Controller Headphones Stereo Microphone" - ???

I am guessing that the second one is supposed to be the microphone in the headset. But when I try to record anything from the second input I get silence.

The headset output does work. I can listen to music etc no problem.

I have gone through https://thesofproject.github.io/latest/getting_started/intel_debug/suggestions.html, https://www.kernel.org/doc/html/v4.14/sound/hd-audio/notes.html, and many Google results. I have tried many /etc/modprode.d/*.conf options: options snd_sof_intel_hda_common dmic_num=4, options snd-hda-intel model=... with many different models from this list https://www.kernel.org/doc/html/v4.14/sound/hd-audio/models.html, and some other random ones found on the internet. No luck.

I have also tried with both pulseaudio and pipewire. Doesn't make any difference.

To Reproduce Connect Headset to jack, select input in pulsemixer and record. Either records from built-in microphone or not at all, depending on which input is chosen.

Reproduction Rate 100%

Expected behavior I want microphone in headset to work.

Impact Huge annoyance.

Environment

  1. Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
    • Kernel: 6.0.8.arch1-1
    • SOF: 2.2.2-1
  2. Name of the topology file
    • Topology: I don't know. Default one?
  3. Name of the platform(s) on which the bug is observed.
    • Platform: Arch Linux x86_64

Screenshots or console output Attaching alsa-info taken with and without headset plugged in. alsa-info-with.txt alsa-info-wo.txt

szatanjl avatar Nov 13 '22 10:11 szatanjl

@szatanjl do you have the relevant sections of dmesg ? One thing we do see a lot is that the Linux HDA codec driver is missing some of the HDA verb configurations used to enabled newer HDA codecs (and this is manually done by Windows OEMs for Windows). See https://github.com/agasecond/QemuDumpHDAVerbs and https://github.com/Conmanx360/QemuHDADump

lgirdwood avatar Nov 14 '22 15:11 lgirdwood

Try this first @szatanjl, this is likely an HDaudio codec issue. SOF driver/firmware know nothing about headsets.

Edit: with the link this time https://thesofproject.github.io/latest/getting_started/intel_debug/suggestions.html#disable-sof-on-pci-hdaudio-devices-to-test-audio-playback

plbossart avatar Nov 14 '22 16:11 plbossart

Thank you for quick reply.

@szatanjl do you have the relevant sections of dmesg ?

Which are the relevant sections of dmesg? I am attaching the whole dmesg output. dmesg.log

I will go over the links provided and try to collect HDA dump from Windows. I can see that it is not 5 minute work so I will need to find some more time. Maybe I will get to it on weekend.

szatanjl avatar Nov 14 '22 19:11 szatanjl

Hello.

HDAudio legacy

I tried the options snd-intel-dspcfg dsp_driver=1 and with that no microphone works at all. I can listen to music on both laptop speakers and headset. But I cant record anything on headset's microphone, nor on the builtin mic.

With default HDAudio settings (wihout above snd-intel-dspcfg) at least the builtin mic works.

HDADump

I tried following this step by step guide https://github.com/Conmanx360/QemuHDADump/wiki/Setup-and-usage-of-the-program, but unfortunately without luck. Do you have any ideas what I could be doing wrong?

Here are my IOMMU groups

IOMMU Group 0:
	0000:00:00.0 Host bridge [0600]: Intel Corporation 11th Gen Core Processor Host Bridge/DRAM Registers [8086:9a14] (rev 01)
IOMMU Group 1:
	0000:00:02.0 VGA compatible controller [0300]: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] [8086:9a49] (rev 01)
IOMMU Group 2:
	0000:00:04.0 Signal processing controller [1180]: Intel Corporation TigerLake-LP Dynamic Tuning Processor Participant [8086:9a03] (rev 01)
IOMMU Group 3:
	0000:00:07.0 PCI bridge [0604]: Intel Corporation Tiger Lake-LP Thunderbolt 4 PCI Express Root Port #0 [8086:9a23] (rev 01)
IOMMU Group 4:
	0000:00:07.1 PCI bridge [0604]: Intel Corporation Tiger Lake-LP Thunderbolt 4 PCI Express Root Port #1 [8086:9a25] (rev 01)
IOMMU Group 5:
	0000:00:08.0 System peripheral [0880]: Intel Corporation GNA Scoring Accelerator module [8086:9a11] (rev 01)
IOMMU Group 6:
	0000:00:0a.0 Signal processing controller [1180]: Intel Corporation Tigerlake Telemetry Aggregator Driver [8086:9a0d] (rev 01)
IOMMU Group 7:
	0000:00:0d.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP Thunderbolt 4 USB Controller [8086:9a13] (rev 01)
	0000:00:0d.2 USB controller [0c03]: Intel Corporation Tiger Lake-LP Thunderbolt 4 NHI #0 [8086:9a1b] (rev 01)
IOMMU Group 8:
	0000:00:0e.0 RAID bus controller [0104]: Intel Corporation Volume Management Device NVMe RAID Controller [8086:9a0b]
	10000:e0:1d.0 PCI bridge [0604]: Intel Corporation Tiger Lake-LP PCI Express Root Port #9 [8086:a0b0] (rev 20)
	10000:e1:00.0 Non-Volatile memory controller [0108]: Intel Corporation SSD 660P Series [8086:f1a8] (rev 03)
IOMMU Group 9:
	0000:00:14.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP USB 3.2 Gen 2x1 xHCI Host Controller [8086:a0ed] (rev 20)
	0000:00:14.2 RAM memory [0500]: Intel Corporation Tiger Lake-LP Shared SRAM [8086:a0ef] (rev 20)
IOMMU Group 10:
	0000:00:14.3 Network controller [0280]: Intel Corporation Wi-Fi 6 AX201 [8086:a0f0] (rev 20)
IOMMU Group 11:
	0000:00:15.0 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #0 [8086:a0e8] (rev 20)
	0000:00:15.1 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #1 [8086:a0e9] (rev 20)
IOMMU Group 12:
	0000:00:16.0 Communication controller [0780]: Intel Corporation Tiger Lake-LP Management Engine Interface [8086:a0e0] (rev 20)
IOMMU Group 13:
	0000:00:1c.0 PCI bridge [0604]: Intel Corporation Device [8086:a0bb] (rev 20)
IOMMU Group 14:
	0000:00:1c.4 PCI bridge [0604]: Intel Corporation Device [8086:a0bc] (rev 20)
IOMMU Group 15:
	0000:00:1d.0 System peripheral [0880]: Intel Corporation RST VMD Managed Controller [8086:09ab]
IOMMU Group 16:
	0000:00:1f.0 ISA bridge [0601]: Intel Corporation Tiger Lake-LP LPC Controller [8086:a082] (rev 20)
	0000:00:1f.3 Multimedia audio controller [0401]: Intel Corporation Tiger Lake-LP Smart Sound Technology Audio Controller [8086:a0c8] (rev 20)
	0000:00:1f.4 SMBus [0c05]: Intel Corporation Tiger Lake-LP SMBus Controller [8086:a0a3] (rev 20)
	0000:00:1f.5 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP SPI Controller [8086:a0a4] (rev 20)
IOMMU Group 17:
	0000:57:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader [10ec:522a] (rev 01)
IOMMU Group 18:
	0000:58:00.0 3D controller [0302]: NVIDIA Corporation TU117M [GeForce MX450] [10de:1f9c] (rev a1)

What I do

I have compiled qemu with tracing as in the guide. I have four PCI devices in group 16 including the sound card, and so I do the following:

  1. cat /proc/cmdline: BOOT_IMAGE=/vmlinuz-linux root=UUID=836101e0-1d37-4af6-9d59-5c63dbf59d2a rw ibt=off pci-stub.ids=8086:a0c8,8086:a082,8086:a0a3,8086:a0a4 intel_iommu=on iommu=pt. Listed all four devices from groun 16 under pci-stub.ids

  2. I run sudo ./vfio-bind.sh 0000:00:1f.0 0000:00:1f.3 0000:00:1f.4 0000:00:1f.5. No output, no errors, everything seems to be fine

  3. Run VM

$ sudo ./startvm.sh 2>&1 >/dev/null | ./QemuHDADump /dev/tty
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.
bar_region 0, addr 0x000, data 0x00000000, bytes 0.

And that's it. Nothing. No frame00 files. No sound in windows VM.

Potential issue?

When simply running VM without QemuHDADump I get following errors:

QEMU 7.1.93 monitor - type 'help' for more information
(qemu) qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.5, no available reset mechanism.
qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.4, no available reset mechanism.
qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no available reset mechanism.
qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.0, no available reset mechanism.
qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.5, no available reset mechanism.
qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.4, no available reset mechanism.
qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no available reset mechanism.
qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.0, no available reset mechanism.

So maybe this "no available reset" has something to do with that and I cannot passthrough the sound card?

Files

start-vm.sh file looks like this (maybe this is incorrect?):

#!/bin/sh

../qemu/build/qemu-system-x86_64 \
	-enable-kvm -m 4G -smp 4 \
	-hda ../qemu/build/virtual-machine.img \
	-device vfio-pci,host=0000:00:1f.0,x-no-mmap=true \
	-device vfio-pci,host=0000:00:1f.3,x-no-mmap=true \
	-device vfio-pci,host=0000:00:1f.4,x-no-mmap=true \
	-device vfio-pci,host=0000:00:1f.5,x-no-mmap=true \
	-trace events=events.txt -monitor stdio

events.txt:

-vfio_region_read
vfio_region_write

szatanjl avatar Dec 03 '22 12:12 szatanjl

You should try this setup instead https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-from-a-Windows-sound-driver

plbossart avatar Dec 05 '22 15:12 plbossart

Ok, I will try with this one. For some reason I didn't think of it on Saturday, but now it seams obvious that I probably need to install some drivers on the Windows VM.

szatanjl avatar Dec 05 '22 20:12 szatanjl