thesofproject / linux

Linux kernel source tree
Other
90 stars 130 forks source link

No microphone detected when using headphones on XPS 17 9700 #2698

Closed sergiocaccamo closed 3 years ago

sergiocaccamo commented 3 years ago

I have Ubuntu 20.10 kernel 5.10 oem, the speakers and the microphone now seem to work on the dell xps17 9700, which is good. As soon as I plug the headphone in the jack the audio is correctly redirected to the headphones but the microphone stops responding. If I look at the input, I can only select the input device "Soundwire microphone - sof-soundwire" but the microphone does nothing. To make the microphone work again, I have to unplug the headphones and open again the sound panel (or use alsaucm reload).

Reproduce it by simply plug some headphones with microphone.

juimonen commented 3 years ago

Do you get any pop-up window when you plug in the headphones? With headphones I understand it is a just headphone without microphone? Dell devices usually can't detect if you plug in headset (with mic) or headphone, so it might happen here that the device thinks you have plugged in a headset and tries to use the "imaginary" microphone. So what I meant by pop-up is that usually dell devices ask you did you plug headset or headphone so that the routing can be done correctly...

Anyway it could be also something different, but I guess you should see at least the 2 choices in the input device list.

My suspicion is there's something wrong with the UCM... could you try to perhaps update alsa-ucm?

juimonen commented 3 years ago

@bardliao FYI

juimonen commented 3 years ago

and @jason77-wang FYI also

sergiocaccamo commented 3 years ago

I have tried now 3 headphones. 1 beats : audio and microphone works 2 sony (bot wired, wh-1000xm3, wh-h910n): speaker working, microphone not. the sony work on another laptop with ubuntu 14.04 and they work fine in bluetooth mode.

I have update ucm2 and tried to play a little with the configs, these are mine:

Speakers.conf `#<sof-soundwire/RT700.conf> <sof-soundwire/RT1308.conf>

<sof-soundwire/RT711.conf>

<sof-soundwire/RT5682.conf>

<sof-soundwire/RT715.conf>

<sof-soundwire/Hdmi.conf>`

Heaphones.conf `<sof-soundwire/RT700.conf>

<sof-soundwire/RT1308.conf>

<sof-soundwire/RT711.conf> #only

<sof-soundwire/RT5682.conf>

<sof-soundwire/RT715.conf>

<sof-soundwire/Hdmi.conf>`

juimonen commented 3 years ago

at least the wh-h910n help guide reads that it doesn't route the microphone in the headset through the cable (I guess doesn't have 3 rings in it) -> so the use case should be as "connected headphone, using laptop microphone". So it is probably exactly the case I'm talking above...

juimonen commented 3 years ago

@sergiocaccamo but you're not getting any pop-ups when connecting the devices with cable?

sergiocaccamo commented 3 years ago

@juimonen no, unfortunately no pop-ups when connecting the headphones. Also, that's what I am trying to achieve, audio from headphones but microphone from laptop. The problem is that as soon as I plug it in the headphone the microphone dies.

juimonen commented 3 years ago

@sergiocaccamo ok good we are on the same page then 👍

Let's wait for the others to chime in, I might have quite similar device at hand, but I have not worked with soundwire too much.

sergiocaccamo commented 3 years ago

@juimonen thank you,sure let's wait. I have used different ucm2 settings now but with little success. Googling around it seems I am not the only one having this issue.

bardliao commented 3 years ago

@sergiocaccamo Can you add options snd_soc_rt711 dyndbg=+p to /etc/modprobe.d/alsa-base.conf to enable the debug message of the rt711 codec driver and see if you can see jack_type=0x1 or jack_type=0x3 in dmesg? It is supposed to be 0x1 in your case since your jack is a headphone.

Note that you will need to reboot your device after adding options snd_soc_rt711 dyndbg=+p.

@libinyang Will UCM use on board mic if a headphone is plugged in?

libinyang commented 3 years ago

@libinyang Will UCM use on board mic if a headphone is plugged in?

@bardliao It depends. If headset is plugged in, it will switch to headset mic. If headphone is plugged in, nothing changes and ob board mic is used. In this case, I think it should be the second scenario.

@sergiocaccamo What do you mean by "the microphone stops responding"? Do you mean you can't record anything or the sound-setting record is inactive?

sergiocaccamo commented 3 years ago

@bardliao dmesg shows jack_type=0x1. If I connect headset instead it reports jack_type=0x3. I plugged the headphone in and out 5-6 times, got slightly different results the first few times. Some more info:

@libinyang I meant that if I plug headset the Sound settings show Headset Microphone - sof -soundwire for microphone and Headphones - sof -soundwire for output device and everything works fine. If I connect the headphones (with no microphone) it shows the same for output device (and I can hear sound from the headphones) but the input device field gets stuck with Soundwire microphone - sof -soundwire and the microphone does not work. I cannot select anything else, the field is stuck. If I close the sound panel and open it again the input field is blank and I cannot select anything. Any applications (e.g. chrome) says that no microphone is detected. I have to remove the headphones to make it work again.

Thank you both for the help.

sergiocaccamo commented 3 years ago

Some more info. To make the audio and microphone work (except the headphone issue), I had to use the ucm settings nicely proposed in this reddit thread.

If I use the one from https://github.com/thesofproject/alsa-ucm-conf only the laptop speaker work. This assuming I am copying the right files in the right place as suggested here..

libinyang commented 3 years ago

Some more info. To make the audio and microphone work (except the headphone issue), I had to use the ucm settings nicely proposed in this reddit thread.

If I use the one from https://github.com/thesofproject/alsa-ucm-conf only the laptop speaker work. This assuming I am copying the right files in the right place as suggested here..

@sergiocaccamo Please have a try sudo rm -r /usr/share/audio/ucm2 ; sudo cp -r ucm2 /usr/share/audio/ucm2 in the alsa-ucm-config folder from https://github.com/thesofproject/alsa-ucm-conf. It seems you missed the file ./ucm2/ucm.conf. I'm not sure if it is the root cause. And could please clone https://github.com/thesofproject/sof-test. And go into the folder test-case, and run ./verify-ucm-config.sh to see if the UCM is correct or not?

It's weird to show jack_type=0x0 when you plug in the headphone. Is it a codec issue? @bardliao

bardliao commented 3 years ago

@sergiocaccamo jack_type=0x1 for headphone and jack_type=0x3 for headset is the proper result. @libinyang I think jack_type=0x0 is shown when the jack is plugged out. I.e. We will see jack_type=0x0 then jack_type=0x1 if we remove and insert the headphone and check dmesg after the headphone is inserted.

plbossart commented 3 years ago

No information in 4 months, I suggest we close this bug which looks like a UCM configuration issue.

sergiocaccamo commented 3 years ago

wops, I completely forgot to reply here. I tried the above and the problem persists. I just learned to live with it, and bought usb-c headsets which works fine. I still cannot use the jack heaphones or the sony mentioned above. If you have other steps you want me to try I will be happy to assist.

libinyang commented 3 years ago

@sergiocaccamo Please check whether /usr/share/alsa/ucm2/ucm.conf exists or not. And clone https://github.com/thesofproject/sof-test. And go into the folder test-case/test-case/, and run ./verify-ucm-config.sh to see if the UCM is correct or not.

sergiocaccamo commented 3 years ago

/usr/share/alsa/ucm2/ucm.conf exists. the test gives: USB-C headset

2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c sof-soundwire open sof-soundwire
2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c sof-soundwire reload
2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c 'sof-soundwire' list _verbs
2021-05-20 09:45:58 UTC [INFO] found verb: HiFi
2021-05-20 09:45:58 UTC [INFO] found verb: Headphones
2021-05-20 09:45:58 UTC [INFO] found verb: HDMI
2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb HDMI get _verb
2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb HDMI list _devices
2021-05-20 09:45:58 UTC [INFO] found device: HDMI1
2021-05-20 09:45:58 UTC [INFO] found device: HDMI2
2021-05-20 09:45:58 UTC [INFO] found device: HDMI3
2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI3' list1 _enadevs
2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI3' reload
2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI2' list1 _enadevs
2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI2' reload
2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI1' list1 _enadevs
2021-05-20 09:45:58 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI1' reload
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb Headphones get _verb
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb Headphones list _devices
2021-05-20 09:45:59 UTC [INFO] found device: Headphones
2021-05-20 09:45:59 UTC [INFO] found device: Headset
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'Headphones' set _enadev 'Headset' list1 _enadevs
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'Headphones' set _enadev 'Headset' reload
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'Headphones' set _enadev 'Headphones' list1 _enadevs
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'Headphones' set _enadev 'Headphones' reload
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb HiFi get _verb
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb HiFi list _devices
2021-05-20 09:45:59 UTC [INFO] found device: Speaker
2021-05-20 09:45:59 UTC [INFO] found device: Mic
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HiFi' set _enadev 'Mic' list1 _enadevs
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HiFi' set _enadev 'Mic' reload
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HiFi' set _enadev 'Speaker' list1 _enadevs
2021-05-20 09:45:59 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HiFi' set _enadev 'Speaker' reload
2021-05-20 09:45:59 UTC [INFO] Test Result: PASS!

jack 3.5 or nothing plugged in, gives the same

2021-05-20 09:52:56 UTC [COMMAND] alsaucm -c sof-soundwire open sof-soundwire
2021-05-20 09:52:56 UTC [COMMAND] alsaucm -c sof-soundwire reload
2021-05-20 09:52:56 UTC [COMMAND] alsaucm -c 'sof-soundwire' list _verbs
2021-05-20 09:52:56 UTC [INFO] found verb: HiFi
2021-05-20 09:52:56 UTC [INFO] found verb: Headphones
2021-05-20 09:52:56 UTC [INFO] found verb: HDMI
2021-05-20 09:52:56 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb HDMI get _verb
2021-05-20 09:52:56 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb HDMI list _devices
2021-05-20 09:52:56 UTC [INFO] found device: HDMI1
2021-05-20 09:52:56 UTC [INFO] found device: HDMI2
2021-05-20 09:52:56 UTC [INFO] found device: HDMI3
2021-05-20 09:52:56 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI3' list1 _enadevs
2021-05-20 09:52:56 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI3' reload
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI2' list1 _enadevs
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI2' reload
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI1' list1 _enadevs
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HDMI' set _enadev 'HDMI1' reload
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb Headphones get _verb
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb Headphones list _devices
2021-05-20 09:52:57 UTC [INFO] found device: Headphones
2021-05-20 09:52:57 UTC [INFO] found device: Headset
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'Headphones' set _enadev 'Headset' list1 _enadevs
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'Headphones' set _enadev 'Headset' reload
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'Headphones' set _enadev 'Headphones' list1 _enadevs
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'Headphones' set _enadev 'Headphones' reload
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb HiFi get _verb
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb HiFi list _devices
2021-05-20 09:52:57 UTC [INFO] found device: Speaker
2021-05-20 09:52:57 UTC [INFO] found device: Mic
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HiFi' set _enadev 'Mic' list1 _enadevs
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HiFi' set _enadev 'Mic' reload
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HiFi' set _enadev 'Speaker' list1 _enadevs
2021-05-20 09:52:57 UTC [COMMAND] alsaucm -c 'sof-soundwire' set _verb 'HiFi' set _enadev 'Speaker' reload
2021-05-20 09:52:57 UTC [INFO] Test Result: PASS!
sergiocaccamo commented 3 years ago

break Here is a gif showing the problem happening. I say 'test' repeatedly. When I plug in the heaphones and try to use the laptop microphones nothing happens.

libinyang commented 3 years ago

@sergiocaccamo It seems more like a pulseaudio issue. Could you please attached the pulseaudio log and alsa-info when the issue happens?

sergiocaccamo commented 3 years ago

@libinyang I hope I did it right :)

grep -i pulse /var/log/syslog
May 29 18:50:32 sergio-xps dbus-daemon[1382]: [system] Activating via systemd: service name='org.freedesktop.RealtimeKit1' unit='rtkit-daemon.service' requested by ':1.34' (uid=125 pid=1633 comm="/usr/bin/pulseaudio --daemonize=no --log-target=jo" label="unconfined")
May 29 18:51:21 sergio-xps systemd[1594]: pulseaudio.service: Succeeded.
May 29 18:51:31 sergio-xps systemd[1594]: pulseaudio.socket: Succeeded.

alsa_info.txt

libinyang commented 3 years ago

@sergiocaccamo the pulseaudio log is not enough.

You can:

# mv /usr/bin/pulseaudio /usr/bin/pulseaudio.orig
# killall pulseaudio
# LANG=C pulseaudio.orig -vvvv --log-time=1 2>&1 |tee pulse.log

to catch the pulseaudio log into pulse.log.

plbossart commented 3 years ago

@sergiocaccamo I just tested with a bog-standard Ubuntu 21.04 setup on a Dell device, I don't see any issues. I can select either the headset mic or local microphone from the settings panel. This is likely the OEM image that creates problem, that's likely a Ubuntu issue not an SOF one proper.

let's close since there's no root cause or ability to reproduce.