Summary: | Microphone port switch | ||
---|---|---|---|
Product: | PulseAudio | Reporter: | Pali Rohár <pali.rohar> |
Component: | core | Assignee: | pulseaudio-bugs |
Status: | RESOLVED MOVED | QA Contact: | pulseaudio-bugs |
Severity: | normal | ||
Priority: | medium | CC: | leho, lennart, pali.rohar |
Version: | unspecified | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
output from alsa-info.sh
alsa-info with unplugged jack alsa-info with nokia jack alsa-info.3.13.0-44-generic.combo alsa-info.3.13.0-44-generic.disconnected alsa-info.3.13.0-44-generic.headphones alsa-info.3.13.0-44-generic.microphone alsa-info.3.13.0-44-generic.nokia alsa-info.3.19.0-031900rc1-generic.combo alsa-info.3.19.0-031900rc1-generic.disconnected alsa-info.3.19.0-031900rc1-generic.headphones alsa-info.3.19.0-031900rc1-generic.microphone alsa-info.3.19.0-031900rc1-generic.nokia |
Description
Pali Rohár
2014-07-21 00:16:11 UTC
you have to post the output of alsa-info.sh the auto mic selection is performed by the driver when the headset Mic use the Jack state of headphone https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/log/sound/pci/hda?qt=grep&q=headset+mic Created attachment 103172 [details]
output from alsa-info.sh
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=73bdd597823e2231dc882577dbbaf8df92fe1775 do you mean the driver does auto swtich the input to headset Mic when heafeet is plugged /sys/class/sound/hwC1D0/init_pin_configs: 0x12 0x90a60140 0x13 0x411111f0 0x14 0x90170110 0x15 0x0221401f 0x16 0x01014020 0x18 0x411111f0 0x19 0x01a19030 0x1a 0x411111f0 0x1b 0x411111f0 0x1d 0x40700001 0x1e 0x411111f0 /sys/class/sound/hwC1D0/driver_pin_configs: 0x16 0x21014020 0x19 0x21a19030 0x1a 0x01a1913c control.11 { iface MIXER name 'Capture Source' value 'Internal Mic' comment { access 'read write' type ENUMERATED count 1 item.0 'Dock Mic' item.1 'Headset Mic' item.2 'Internal Mic' } } seem auto Mic selection is disabled when there is capture source control to select input source this cannot be solved by pulseaudio in user space, there are some laptop (e.g. DELL alienware) which have headset, hp and Mic jacks https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1302090 https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1332900 only driver know which one is headphone or headset if you want to enable auto Mic with internal Mic, headset Mic, dock mic or dock headset mic So it is not pulseaudio who switching output port based on jack detection, but kernel driver? when there are two detectable mic JacKS and internal Mic, there is no way to know the user want to use which input sources when both Mic jacks are plugged if you really want auto Mic between headset Mic and internal mic if you notebook does not support conventional Mic jack modify driver to create a headset Mic Jack which return the Jack state of headphones and don't create the headset Mic phantom jack and use hda Jack retask to remove dock mic to enable auto mic there are hda codec which only have one playback volume control but no headphone playback switch nor speaker playback switch driver can perform auto mute by gpio or using pin ctl https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1334110 What I want is to have some consistency. If I plug headphones (mic+output) into jack I want to set either both parts (mic+output) or none as default audio device. Now when I plug headphones into jack, only audio output is switched for using from internal speakers into jack heaphones. It is really stupid if I have active conference call (and using internal mic+internal speakers) and I plug headset (intput+output) into jack and only audio output is automatically switched from speakers to headphones... Mic should too. + [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl[]) { + { 0x16, 0x21014020 }, /* dock line out */ + { 0x19, 0x21a19030 }, /* dock mic */ + { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */ + { } + }, + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC + }, + [ALC269_FIXUP_HEADSET_MODE] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_headset_mode, + }, + [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_headset_mode_no_hp_mic, + }, static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC), SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), + SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), your laptop is using ALC269_FIXUP_DELL2_MIC_NO_PRESENCE to enable auto Mic, the codec need to differentiate between the headset and headphone you have to provide out put of debugged version of alsa driver which show the headset is set to which modes : headphone, iPhone style headset, Nokia Style headset, Mic in dirty workaound is to change to use headphone Jack to change the headset Mic if the notebook only support headset and don't support headphone http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf static void alc_headset_mode_default(struct hda_codec *codec) +{ + } + snd_printdd("Headset jack set to headphone (default) mode.\n"); +} + seem driver initialized the Jack to headphone instead of headset by default what is difference between headset jack and headphone jack? https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=5780b627e24113323427c102175296ae43dfb9d7 those netbooks have one audio Jack which can be use as headphone or Mic , but they don't support headset from user point of view, i will expect the driver initialize the Jack as Same as the icon next to the Jack http://www.intel.com/support/motherboards/desktop/sb/CS-034198.htm for desktop, those rear Mic and line in can be retasked as output to support surround5.1 for netbook, the headphone can be retasked as Mic. for those notebook with three/four jacks , those input jacks and headphone jacks can also be retasked as line out jacks to support surround 5.1/7.1 http://bazaar.launchpad.net/~unity-settings-daemon-team/unity-settings-daemon/trunk/view/head:/plugins/media-keys/what-did-you-plug-in/pa-backend.c Headphone Mic Jack - indicates headphone and mic-in mode share the same jack, i e, not two separate jacks. Hardware cannot distinguish between a headphone and a mic. Headset Mic Phantom Jack - indicates headset jack where hardware can not distinguish between headphones and headsets Headset Mic Jack - indicates headset jack where hardware can distinguish between headphones and headsets. There is no use popping up a dialog in this case, unless we already need to do this for the mic-in mode. it seem that your notebbok cannot distinguish betweeen headphone and headset do the user manual mention that it support headset only ? control.20 { iface CARD name 'Headset Mic Phantom Jack' value true comment { access read type BOOLEAN count 1 } http://mailman.alsa-project.org/pipermail/alsa-devel/2014-July/079168.html do module-switch-on-port-available work to those mini PC with one Jack but no internal speaker/Mic ? https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1169143 the patch is based on all those notebook support both headset and headphone but the implementation does not setup those Jack for headset by default you have to ask the author there may be some notebook using other codec which support headset only but not headphone http://support.lenovo.com/en_IN/downloads/detail.page?DocID=PD025183 To listen to the sound from your computer, connect a headphone or a headset that has a 3.5 mm 4-pole plug to the combo audio jack. Note: The combo audio jack does not support a conventional microphone seem some thinpad does not support conventional microphone but supplier both headphone and headset http://bazaar.launchpad.net/~unity-settings-daemon-team/unity-settings-daemon/trunk/view/head:/plugins/media-keys/what-did-you-plug-in/dialog-window.c one of the reason may be the program logic assume headphone mode always supported d->hp_btn = create_icon_button(WDYPI_DIALOG_HEADPHONES, _("Headphones"), "audio-headphones"); gtk_box_pack_start(GTK_BOX(d->icon_box), d->hp_btn, FALSE, TRUE, 0); if (show_headset) { d->hs_btn = create_icon_button(WDYPI_DIALOG_HEADSET, _("Headset"), "audio-headset"); gtk_box_pack_start(GTK_BOX(d->icon_box), d->hs_btn, FALSE, TRUE, 0); } if (show_mic) { d->mic_btn = create_icon_button(WDYPI_DIALOG_MICROPHONE, _("Microphone"), "audio-input-microphone"); gtk_box_pack_start(GTK_BOX(d->icon_box), d->mic_btn, FALSE, TRUE, 0); } (In reply to comment #5) > So it is not pulseaudio who switching output port based on jack detection, > but kernel driver? yes, it is the kerenl driver perform auto mute, pulseaudio just use the Jack detection control to find out which volume control of the selected audio path in your case, you may need to give up the support of headphone by using a new hint to force the driver to support headset only when the codec cannot differentiate headset or headphone the alternative way is to use what did you plugin to select the headset or headphone when ever you plugged So what to do? Do you need some other logs? Or cannot be auto mic switch implemented? have you ask David who implement headset mic for dell notebook alsaid driver ? https://bugzilla.kernel.org/show_bug.cgi?id=76611 it seem that none of dell notebooks can dintinguish headset and notebook but there are dell alienware notebook which have three jacks : headset, headphone and Mic jack those alienware users are expect they don't need to use the pop up dialog Node 0x16 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out Control: name="PCM Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Dock Line Out Jack", index=0, device=0 Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x0001001c: OUT HP EAPD Detect EAPD 0x2: EAPD Pin Default 0x01014020: [Jack] Line Out at Ext Rear Conn = 1/8, Color = Green DefAssociation = 0x2, Sequence = 0x0 Pin-ctls: 0x40: OUT Unsolicited: tag=02, enabled=1 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 2 0x0c* 0x0d Node 0x14 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out Control: name="Speaker Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Control: name="Speaker Phantom Jack", index=0, device=0 Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x00 0x00] Pincap 0x00010010: OUT EAPD EAPD 0x2: EAPD Pin Default 0x90170110: [Fixed] Speaker at Int N/A Conn = Analog, Color = Unknown DefAssociation = 0x1, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0x40: OUT Unsolicited: tag=00, enabled=0 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 Connection: 2 0x0c* 0x0d does the playback work with dock line out, it seem that dock line out and internal speaker share dac and pcm playback volume I do not have dock/port replicator so I cannot test how it will work. https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/Documentation/sound/alsa/HD-Audio-Controls.txt the driver should document if the capture source is really used for switch the function of combo jack https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/?id=2041d56464a067461d7cc21734a0f024587ed2ff this is the only headset Mic with sequence number 0x0c support Jack detect but does it really imply that it is capable of distinguish headset and headphone (In reply to comment #7) > What I want is to have some consistency. If I plug headphones (mic+output) > into jack I want to set either both parts (mic+output) or none as default > audio device. > > Now when I plug headphones into jack, only audio output is switched for > using from internal speakers into jack heaphones. > > It is really stupid if I have active conference call (and using internal > mic+internal speakers) and I plug headset (intput+output) into jack and only > audio output is automatically switched from speakers to headphones... Mic > should too. Have you read the link Raymond pointed to: http://voices.canonical.com/david.henningsson/2014/03/07/headset-jacks-on-newer-laptops/ We don't know if you plugged in a headphone or a headset, so the best we can do is to pop up a dialog asking you what you plugged in, so you can select "headphone" or "headset" by a simple click of a button. Which is what we do in Ubuntu 14.04. (I was investigating whether to do some of this GUI related stuff in PulseAudio instead so it could help users of other distros as well, but Tanu was hesitant to adding GUI related stuff in PulseAudio.) If I understand correctly, you wrote that it is not possible to autodetect if device is headphone (line out) or headset (line out + line in), right? But when I plug my old Nokia headset which has 4 pin jack (last pin is ground and it has both mic input and speakers output), kernel autodetect that something was inserted and automatically switch input from internal mic to jack mic. So somemthing now detected that headphones with microphone was inserted... So why cannot be that autodetection used also for switching audio output from internal laptop speakers to headset jack? Also I tried normal headphones (without mic, 3 pin jack) and nothing switched microphone input. So really HW/kernel/PA can somehow distinguish between headset and heaphones -- because I see in PA port config that input is automatically changed when I plug/unplug Nokia headset. Or I missed something? (In reply to comment #29) > If I understand correctly, you wrote that it is not possible to autodetect > if device is headphone (line out) or headset (line out + line in), right? > > But when I plug my old Nokia headset which has 4 pin jack (last pin is > ground and it has both mic input and speakers output), kernel autodetect > that something was inserted and automatically switch input from internal mic > to jack mic. > > So somemthing now detected that headphones with microphone was inserted... > So why cannot be that autodetection used also for switching audio output > from internal laptop speakers to headset jack? > > Also I tried normal headphones (without mic, 3 pin jack) and nothing > switched microphone input. So really HW/kernel/PA can somehow distinguish > between headset and heaphones -- because I see in PA port config that input > is automatically changed when I plug/unplug Nokia headset. > > Or I missed something? Ok, this is confusing. Could you post alsa-info for both scenarios 1) with headset plugged in 2) with headphones plugged in? ...and we could compare them for differences? Created attachment 104872 [details]
alsa-info with unplugged jack
Created attachment 104873 [details]
alsa-info with nokia jack
This is interesting. Now I used older kernel version, but from ubuntu repository (3.13.0-32-generic #57~precise1-Ubuntu) and when I plugged nokia headset now it automatically siwtched both output and input to jack. I'm sure that before only mic output was automatically switched and from first attachment I see that it was on upstream kernel 3.16. So ubuntu kernel in precise has some patches which are not in upstream 3.16 which enable autoswitch also for output (not only mic input) -- or that autoswitch for output is broken in new kernels. Now I do not have any classic 3 pin jack headpnes (without mic) to test, so if you need output from alsa-info please wait some time... To double check, could you compare headphone and headset plugged in, on the same kernel version? To see that something actually reacts differently? https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=ab16c6dd79389761eca1366d809a002b44b7f960 auto selection of dock Mic, ext Mic and int mic was supported (In reply to comment #29) > If I understand correctly, you wrote that it is not possible to autodetect > if device is headphone (line out) or headset (line out + line in), right? > to switch between headphone and line out, the driver need to change EAPD and pin ctl from OUT HP to OUT so change the capture source is not suitable for changing the role of the combo Jack: so far it seem none of those 4 pin combo Jack support to use as line in but three pin Mic Jack can be switch to line in using the Mic Jack mode control by adding hint add_jack_mode i think Palo expect his headset mic can work like those iPhone headset connected to macbook air , those Jack is dedicated to headset and does support headphone nor microphone how about hacking headset-mic.conf use headphone jack but this mean you cannot use normal headphone or mic http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf [Jack Headset Mic] required-any = any [Jack Headset Mic Phantom] state.plugged = unknown state.unplugged = unknown required-any = any [Jack Headphone] -state.plugged = unknown +required-any=any what I expect is that if I connect headset (input+output) to jack then pulseaudio automatically switch input+output from internal mic+speakers to headset connected to jack. Now I tested 3.17-rc6 kernel and it switch only speakers output to headset. Microphone input was not switched. But it worked with ubuntu kernel (3.13.0-32-generic #57~precise1-Ubuntu). So ubuntu has some special patch for it which is not in upstream kernel, or there is regression, it worked with older kernel but not with new. Created attachment 111277 [details]
alsa-info.3.13.0-44-generic.combo
Created attachment 111278 [details]
alsa-info.3.13.0-44-generic.disconnected
Created attachment 111279 [details]
alsa-info.3.13.0-44-generic.headphones
Created attachment 111280 [details]
alsa-info.3.13.0-44-generic.microphone
Created attachment 111282 [details]
alsa-info.3.13.0-44-generic.nokia
Created attachment 111283 [details]
alsa-info.3.19.0-031900rc1-generic.combo
Created attachment 111284 [details]
alsa-info.3.19.0-031900rc1-generic.disconnected
Created attachment 111285 [details]
alsa-info.3.19.0-031900rc1-generic.headphones
Created attachment 111286 [details]
alsa-info.3.19.0-031900rc1-generic.microphone
Created attachment 111287 [details]
alsa-info.3.19.0-031900rc1-generic.nokia
I uploaded new outputs from alsa-info.sh script. I tested it on Ubuntu 12.04 Precise release with lastest precise kernel 3.13.0-44-generic and also with new upstream kernel 3.19-rc1. Each test file has suffix: * combo: connected both microphone (3 pins) and headphones (3 pins) via special reduction (4 pins) to jack port * disconnected: nothing was connected to jack port * headphones: standard headphones (3 pins) was connected to jack port * microphone: only (stereo) microphone (3 pins) was connected to jack port * nokia: Nokia Headset (headphones + microphone) (4 pins) was connected to jack port Are these logs enough for analyze? Do you need something more? So, if I understand you correctly, with the alsa-info.3.13.0-44-generic kernel, the system reacts differently depending on whether you plug in headphones or headset combo. So I did a "diff -u alsa-info.3.13.0-44-generic.headphones alsa-info.3.13.0-44-generic.combo", but I couldn't see any differences that could result in PulseAudio reacting differently w r t jack detection. In both cases (headphones and combo) under 3.13.0-44-generic pulseaudio changes audio output when jack is inserted. But do not change audio input when combo is plugged. So I think that system reacts in same way. But "diff -u alsa-info.3.13.0-44-generic.headphones alsa-info.3.13.0-44-generic.combo" contains some differences in "Converter:" lines. (In reply to Pali Rohár from comment #52) > In both cases (headphones and combo) under 3.13.0-44-generic pulseaudio > changes audio output when jack is inserted. But do not change audio input > when combo is plugged. So I think that system reacts in same way. But in comment #29 you say that the system reacts in a different way depending on whether you plug in headphones or headsets. And that is what we are trying to verify here. But now you say they are reacting the same? > But "diff -u alsa-info.3.13.0-44-generic.headphones > alsa-info.3.13.0-44-generic.combo" contains some differences in "Converter:" > lines. The converter numbers are initialized on first playback/record. If they are zero, it probably means you have not had a stream running to/from the codec since the sound driver was last initialized (which usually happens on boot only, I think). They are unrelated to jack detection. I said that: (In reply to Pali Rohár from comment #29) > But when I plug my old Nokia headset which has 4 pin jack (last pin is > ground and it has both mic input and speakers output), kernel autodetect > that something was inserted and automatically switch input from internal mic > to jack mic. And I remember that pulseaudio really switched input to jack mic. But now with same Nokia headset and with pulseaudio 5.0 and kernel 3.13.0-44-generic input is not switched. So something must have been changed in kernel or pulseaudio since I did that tests. Otherwise I cannot explain different behaviour in past and now. (In reply to Pali Rohár from comment #54) > I said that: > > (In reply to Pali Rohár from comment #29) > > But when I plug my old Nokia headset which has 4 pin jack (last pin is > > ground and it has both mic input and speakers output), kernel autodetect > > that something was inserted and automatically switch input from internal mic > > to jack mic. > > And I remember that pulseaudio really switched input to jack mic. > > But now with same Nokia headset and with pulseaudio 5.0 and kernel > 3.13.0-44-generic input is not switched. > > So something must have been changed in kernel or pulseaudio since I did that > tests. Otherwise I cannot explain different behaviour in past and now. Ok. If you can find a configuration (PA, kernel, etc) where the system acts differently between headphones and headsets, please submit alsa-info for those two scenarios. If you can't find it, I think we should close this bug. as the combo jack cannot differentiate headphone, headset , headset mic phantom jack is created you have to give up the support of headphone in order to allow headset mic can be auto selected https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/include/sound/jack.h enum snd_jack_types { SND_JACK_HEADPHONE = 0x0001, SND_JACK_MICROPHONE = 0x0002, SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE, use jack sense of headphone pin to represent both headphone and mic . need to modify dfriver to create headset jack instead of headphone jack and headset mic phantom jack I'm not sure I get understand the NEEDINFO state of this bug. What information is still missing? Currently on my Gnome 3.20 desktop, I'm also confused by needing to manually switch Input Device to Headset microphone for business calls, running pulseaudio-8.0 (has been the same for many previous versions, if not always). Why wouldn't pulseaudio automatically do this for me? Windows drivers seem to have no problems. -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/50. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.