Bug 103482 - Headset jack partially not recognized as connected at boot
Summary: Headset jack partially not recognized as connected at boot
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: alsa (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-27 13:05 UTC by Carlo Caione
Modified: 2018-07-30 10:12 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
PA log with mic connected at boot (120.05 KB, text/plain)
2017-10-27 13:05 UTC, Carlo Caione
Details
PA log without mic connected at boot (119.94 KB, text/plain)
2017-10-27 13:06 UTC, Carlo Caione
Details
pactl-list-cards (3.88 KB, text/plain)
2017-11-06 09:04 UTC, Carlo Caione
Details
pactl.list.cards with increased priorities (3.88 KB, text/plain)
2017-11-16 15:38 UTC, Carlo Caione
Details

Description Carlo Caione 2017-10-27 13:05:10 UTC
Codec is RT5651. The driver codec is exporting two jack controls:

numid=173,iface=CARD,name='Headphone Jack'                                                                                                                                           
  ; type=BOOLEAN,access=r-------,values=1                                                                                                                                            
  : values=off                                                                                                                                                                       
numid=174,iface=CARD,name='Headset Mic Jack'                                                                                                                                         
  ; type=BOOLEAN,access=r-------,values=1                                                                                                                                            
  : values=off                

The driver correctly recognizes when the jack is connected / disconnected and in general it works fine (audio output and input are switched to the headset when the jack is connected).

The problem arises when we boot the machine with the headset jack already connected. In this case pulseaudio keeps setting the audio output to the speakers and the audio input to the headset mic. When the jack is then disconnected and connected again, everything works fine.

Please note that the kernel is exporting to the userspace the correct status for the headset jack, so I guess the problem is somewhere in the pulseaudio behavior.

In attachment the logs of when pulseaudio is started with and without headset jack connected.
Comment 1 Carlo Caione 2017-10-27 13:05:45 UTC
Created attachment 135102 [details]
PA log with mic connected at boot
Comment 2 Carlo Caione 2017-10-27 13:06:18 UTC
Created attachment 135103 [details]
PA log without mic connected at boot
Comment 3 Tanu Kaskinen 2017-11-02 10:00:08 UTC
Can you attach the output of "pactl list cards" after boot when the routing is wrong?

I suspect that the headphones and the speakers are both marked as available, and the speaker priority is higher. Do you hear audio from the speakers when this happens?
Comment 4 Carlo Caione 2017-11-06 09:04:32 UTC
Created attachment 135253 [details]
pactl-list-cards

> Can you attach the output of "pactl list cards" after boot when the routing
> is wrong?

In attachment

> I suspect that the headphones and the speakers are both marked as available,
> and the speaker priority is higher. Do you hear audio from the speakers when
> this happens?

I just checked this better: when I boot with the jack inserted the audio is routed through both: speakers and headphones. The input is set on the main microphone.
Comment 5 Tanu Kaskinen 2017-11-07 13:04:51 UTC
Ok, both output ports have the same priority. The UCM configuration could provide the priority, but your UCM configuration doesn't do that. I don't think it's a good idea to use UCM as the priority authority anyway, because if the system has both UCM and non-UCM cards, the priorities between the cards wouldn't be comparable (and I doubt that the priorities between two different UCM cards would be comparable either). Instead, PulseAudio should determine the priority based on the device types. AFAIK, UCM doesn't currently provide device type information, so that's something to fix in UCM. As a workaround, PulseAudio could guess the device type from the device name.

I don't know why the Handset Microphone port has higher priority than the default 100. Does your UCM config have any differences to what's currently in alsa-lib master branch?

Regarding the simultaneous output to both speakers and headphones: I suppose this happens only after boot? The UCM config looks like it has appropriate mute commands in the DisableSequence sections for both devices. I believe the disable sequences aren't executed during boot, however, so the default mixer configuration in bytcr-rt5651.conf should be changed to mute all outputs.
Comment 6 Carlo Caione 2017-11-08 11:55:56 UTC
(In reply to Tanu Kaskinen from comment #5)
> Ok, both output ports have the same priority. The UCM configuration could
> provide the priority, but your UCM configuration doesn't do that. I don't
> think it's a good idea to use UCM as the priority authority anyway, because
> if the system has both UCM and non-UCM cards, the priorities between the
> cards wouldn't be comparable (and I doubt that the priorities between two
> different UCM cards would be comparable either). Instead, PulseAudio should
> determine the priority based on the device types. AFAIK, UCM doesn't
> currently provide device type information, so that's something to fix in
> UCM. As a workaround, PulseAudio could guess the device type from the device
> name.
Given how many UCM cards are around I wonder why this is not something already fixed / known.


> I don't know why the Handset Microphone port has higher priority than the
> default 100. Does your UCM config have any differences to what's currently
> in alsa-lib master branch?
No, I'm using exactly the same UCM config. Weird.


> Regarding the simultaneous output to both speakers and headphones: I suppose
> this happens only after boot? The UCM config looks like it has appropriate
> mute commands in the DisableSequence sections for both devices. I believe
> the disable sequences aren't executed during boot, however, so the default
> mixer configuration in bytcr-rt5651.conf should be changed to mute all
> outputs.
Yeah, you are right. Fixed that at least :)
Comment 7 Tanu Kaskinen 2017-11-08 12:28:57 UTC
(In reply to Carlo Caione from comment #6)
> Given how many UCM cards are around I wonder why this is not something
> already fixed / known.

UCM cards have started to appear on desktop/laptop type machines only quite recently.
Comment 8 Carlo Caione 2017-11-16 15:38:09 UTC
Created attachment 135520 [details]
pactl.list.cards with increased priorities

Even changing priorities something is still wrong. In attachment the output of `pactl list cards` showing the increased priority for the headset. Even with the increased priorities when booting with the jack connected the audio output is thought `Speaker` (ok) but input is still set to `Mainmic`.
Comment 9 Tanu Kaskinen 2017-12-12 03:41:13 UTC
Have you perhaps selected Mainmic manually at some point, making that choice to be restored at boot? Does removing ~/.config/pulse/*device-volumes* help?
Comment 10 GitLab Migration User 2018-07-30 10:12:47 UTC
-- 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/269.


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.