[alsa-devel] Internal Mics and Speakers not visible in PulseAudio

Posted to both alsa-devel and pulseaudio-discuss lists, as this is a cross issue.
PulseAudio tries to figure out what equipment is present on the machine using the mixer. If it finds e g "Headphone Playback Volume", "Headphone Playback Switch", or "Headphone Jack", it assumes that a headphone is present and creates a headphone port. If it finds no ports, it creates a fallback "Analog Output" port.
Now assume that we have a laptop with speakers and a headphone jack, but with only a "Master Playback Volume", and a "Headphone Jack" for the jack detection. PulseAudio will take the "Headphone Jack", and create a headphone port. Now, if this port is currently unconnected/unavailable, it will not show up at all [1]. As a result, the internal speakers - for which no port was created - will be essentially unusable.
Now, I thought this was a problem with a pair of machines only, that we could easily quirk on the PulseAudio side. But after looking through Ubuntu bugs and posting a blog post [2] about the issue, I have now collected 21 different machines affected, mostly on the input side. Several Realtek chips are affected on the dmic side, and some older STAC92xx chips have problems in both directions. So it becomes evident to me, that this is something that needs to be fixed pretty fast.
So, to move forward, we need to expose these speakers and internal mics to userspace. A very simple (untested) patch is attached. This would make "Internal Mic Jack" and "Speaker Jack" show up. Note that the actual status can be overridden/ignored on the PulseAudio side - the importance here is the sign that there are internal mics and speakers, so that the PulseAudio ports get created.
I could develop it a little to make sure we don't actually do any jack detection for these pins but always return them as being true/present. That is, if you approve the idea? I admit that the "Internal Mic Jack" is somewhat misleading/hacky as the internal mic is not connected to any physical jack, but it seems like the simplest way of resolving the problem currently.

2012/5/30 David Henningsson david.henningsson@canonical.com:
Posted to both alsa-devel and pulseaudio-discuss lists, as this is a cross issue.
PulseAudio tries to figure out what equipment is present on the machine using the mixer. If it finds e g "Headphone Playback Volume", "Headphone Playback Switch", or "Headphone Jack", it assumes that a headphone is present and creates a headphone port. If it finds no ports, it creates a fallback "Analog Output" port.
Now assume that we have a laptop with speakers and a headphone jack, but with only a "Master Playback Volume", and a "Headphone Jack" for the jack detection. PulseAudio will take the "Headphone Jack", and create a headphone port. Now, if this port is currently unconnected/unavailable, it will not show up at all [1]. As a result, the internal speakers - for which no port was created
- will be essentially unusable.
Now, I thought this was a problem with a pair of machines only, that we could easily quirk on the PulseAudio side. But after looking through Ubuntu bugs and posting a blog post [2] about the issue, I have now collected 21 different machines affected, mostly on the input side. Several Realtek chips are affected on the dmic side, and some older STAC92xx chips have problems in both directions. So it becomes evident to me, that this is something that needs to be fixed pretty fast.
So, to move forward, we need to expose these speakers and internal mics to userspace. A very simple (untested) patch is attached. This would make "Internal Mic Jack" and "Speaker Jack" show up. Note that the actual status can be overridden/ignored on the PulseAudio side - the importance here is the sign that there are internal mics and speakers, so that the PulseAudio ports get created.
I could develop it a little to make sure we don't actually do any jack detection for these pins but always return them as being true/present. That is, if you approve the idea? I admit that the "Internal Mic Jack" is somewhat misleading/hacky as the internal mic is not connected to any physical jack, but it seems like the simplest way of resolving the problem currently.
I am afraid this does not work with desktop computer which has front mic , internal mic, Line in ,CD (or stereo mix with those via hda codecs)
With ubuntu 12.04 and unity , if I enable hda jack detect with my ad198x on my desktop, sound preference does not allow me to select front mic since I am still using ac97 front panel (with no jack detect circuit)
Although the rear mic and line in jacks are detectable, when I unplug the rear mic, the sound preference automatically switch to the "web cam mic" since the desktop does not has any internal mic
The concept of using jack detection to select recording source is not suitable when there is more than two undetectable sources or two detectable jacks
Some user may connect the output of TV card to the blue jack of ad198x which is loop back to green jack. The presence of jack in "Line in" does not implies that the user is intend to select Line in as input source since the user is just using the analog mixing of ad198x codec
The correct way is to use the items in "Input Source" or "Capture Source"
Simple mixer control 'Input Source',0 Capabilities: cenum Items: 'Front Mic' 'Rear Mic' 'Line' 'CD' 'Mix' Item0: 'Front Mic' Simple mixer control 'Input Source',1 Capabilities: cenum Items: 'Front Mic' 'Rear Mic' 'Line' 'CD' 'Mix' Item0: 'Front Mic' Simple mixer control 'Input Source',2 Capabilities: cenum Items: 'Front Mic' 'Rear Mic' 'Line' 'CD' 'Mix' Item0: 'Line'

On 05/30/2012 03:04 PM, Raymond Yau wrote:
2012/5/30 David Henningssondavid.henningsson@canonical.com:
Posted to both alsa-devel and pulseaudio-discuss lists, as this is a cross issue.
PulseAudio tries to figure out what equipment is present on the machine using the mixer. If it finds e g "Headphone Playback Volume", "Headphone Playback Switch", or "Headphone Jack", it assumes that a headphone is present and creates a headphone port. If it finds no ports, it creates a fallback "Analog Output" port.
Now assume that we have a laptop with speakers and a headphone jack, but with only a "Master Playback Volume", and a "Headphone Jack" for the jack detection. PulseAudio will take the "Headphone Jack", and create a headphone port. Now, if this port is currently unconnected/unavailable, it will not show up at all [1]. As a result, the internal speakers - for which no port was created
- will be essentially unusable.
Now, I thought this was a problem with a pair of machines only, that we could easily quirk on the PulseAudio side. But after looking through Ubuntu bugs and posting a blog post [2] about the issue, I have now collected 21 different machines affected, mostly on the input side. Several Realtek chips are affected on the dmic side, and some older STAC92xx chips have problems in both directions. So it becomes evident to me, that this is something that needs to be fixed pretty fast.
So, to move forward, we need to expose these speakers and internal mics to userspace. A very simple (untested) patch is attached. This would make "Internal Mic Jack" and "Speaker Jack" show up. Note that the actual status can be overridden/ignored on the PulseAudio side - the importance here is the sign that there are internal mics and speakers, so that the PulseAudio ports get created.
I could develop it a little to make sure we don't actually do any jack detection for these pins but always return them as being true/present. That is, if you approve the idea? I admit that the "Internal Mic Jack" is somewhat misleading/hacky as the internal mic is not connected to any physical jack, but it seems like the simplest way of resolving the problem currently.
I am afraid this does not work with desktop computer which has front mic , internal mic, Line in ,CD (or stereo mix with those via hda codecs)
With ubuntu 12.04 and unity , if I enable hda jack detect with my ad198x on my desktop, sound preference does not allow me to select front mic since I am still using ac97 front panel (with no jack detect circuit)
In that case your BIOS should detect that you're using an ac'97 front panel and set the "no prescence detect" bit in the default pin config.
The codec driver should then not create any jack at all, and PulseAudio would pick up 'Input Source' -> 'Front Mic' as a reason to have create a 'Front Mic' port.
But maybe there is some sense in wanting to create a different state for when it's undetectable (present = yes/no/unknown) in the interface between the kernel and userspace?

2012/5/30 David Henningsson david.henningsson@canonical.com:
On 05/30/2012 03:04 PM, Raymond Yau wrote:
I am afraid this does not work with desktop computer which has front mic , internal mic, Line in ,CD (or stereo mix with those via hda codecs)
With ubuntu 12.04 and unity , if I enable hda jack detect with my ad198x on my desktop, sound preference does not allow me to select front mic since I am still using ac97 front panel (with no jack detect circuit)
In that case your BIOS should detect that you're using an ac'97 front panel and set the "no prescence detect" bit in the default pin config.
The codec driver should then not create any jack at all, and PulseAudio would pick up 'Input Source' -> 'Front Mic' as a reason to have create a 'Front Mic' port.
The patched driver just create two jack detect controls for rear panel jacks when BIOS set front audio panel type to AC97
There are difference for the system settings/sound in unity and gnome
In gnome session, the system settings/sound list the three hardcoded ports (front mic, line and rear mic) instead of all the items in the "Input source" / "Capture Source" controls ( There is no CD in HDA, and no CD , stereo mix, aux, phone for my other sound cards with ac97 codec)
Is there any way to add back "Stereo Mix" to pulseaudio 's port ?
In unity session, the system settings/sound only list the plugged jacks.
I think the usage of jack detect to select input source automatically is broken for for those motherboards which have three audio jacks in rear panel and retask those pink and blue jacks for surround51 output.
The module-switch-on-available-port should check whether "Channel mode' is 6 and exclude the result those jack detect of "rear mic" and "line in" since they have been retasked for output
BTW, the ICH8 HDA controller support multi stream capturing and ad1988 has thee capture subdevices
arecord -l card 1: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog] Subdevices: 3/3 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2
what is the definition of "Mono Output" in pulseaudio ?
it is just the capability of the sound card to play mono or have a mono speaker with a specific volume control
My three other sound cards does support mono playback and mono capture
The system setting/sound in gnome session allow me to select "mono duplex" but when it does not allow me to select "mono output + mono input" in unity session.

On 06/01/2012 04:54 AM, Raymond Yau wrote:
2012/5/30 David Henningssondavid.henningsson@canonical.com:
On 05/30/2012 03:04 PM, Raymond Yau wrote:
I am afraid this does not work with desktop computer which has front mic , internal mic, Line in ,CD (or stereo mix with those via hda codecs)
With ubuntu 12.04 and unity , if I enable hda jack detect with my ad198x on my desktop, sound preference does not allow me to select front mic since I am still using ac97 front panel (with no jack detect circuit)
In that case your BIOS should detect that you're using an ac'97 front panel and set the "no prescence detect" bit in the default pin config.
The codec driver should then not create any jack at all, and PulseAudio would pick up 'Input Source' -> 'Front Mic' as a reason to have create a 'Front Mic' port.
The patched driver just create two jack detect controls for rear panel jacks when BIOS set front audio panel type to AC97
There are difference for the system settings/sound in unity and gnome
In gnome session, the system settings/sound list the three hardcoded ports (front mic, line and rear mic) instead of all the items in the "Input source" / "Capture Source" controls ( There is no CD in HDA, and no CD , stereo mix, aux, phone for my other sound cards with ac97 codec)
Is there any way to add back "Stereo Mix" to pulseaudio 's port ?
Yes. See:
http://www.freedesktop.org/wiki/Software/PulseAudio/Backends/ALSA/Profiles
However if you have additional questions about how to write PulseAudio profiles and paths I might not have the time to help you out with that, hopefully you will be able to sort that out by yourself.
In unity session, the system settings/sound only list the plugged jacks.
I think the usage of jack detect to select input source automatically is broken for for those motherboards which have three audio jacks in rear panel and retask those pink and blue jacks for surround51 output.
The module-switch-on-available-port should check whether "Channel mode' is 6 and exclude the result those jack detect of "rear mic" and "line in" since they have been retasked for output
Hmm. That would lead to quite hairy code in PulseAudio, I'm afraid...and I don't think it's the right way to solve the problem either.
I think we could go about this in different ways.
1) The easiest way is to say that if you're changing "Channel mode" manually in alsamixer, you're on your own. After all, the normal/newbie end user would not know about alsamixer at all, so if you're capable of changing things in alsamixer you're assumed to be capable of configuring PulseAudio's profiles (using the link above) to match that as well.
2) We could make a policy decision to remove the code that retasks the jacks, and direct people to hda-jack-retask if they want to do that. That would mean simpler code for everyone - however, with the recent addition of multi-IO in the Realtek driver (for example), things doesn't seem to head that way...
3) We could add both "Line Out Surround Jack" and "Rear Mic Jack". The "Rear Mic Jack" would always return present=no when you're in 6-channel surround retask mode, and "Line Out Surround Jack" would always return present=no when you're in the normal mode.
BTW, the ICH8 HDA controller support multi stream capturing and ad1988 has thee capture subdevices
arecord -l card 1: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog] Subdevices: 3/3 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2
You would be able to make a multi-source profile in PulseAudio that can record from all of these simultaneously, but we're missing a patch that can control volumes and switches with indices, so you would have to control the gain manually in alsamixer.
what is the definition of "Mono Output" in pulseaudio ?
it is just the capability of the sound card to play mono or have a mono speaker with a specific volume control
My three other sound cards does support mono playback and mono capture
The system setting/sound in gnome session allow me to select "mono duplex" but when it does not allow me to select "mono output + mono input" in unity session.
That sounds like the known bug I was working on yesterday.

David Henningsson david.henningsson@canonical.com 於 2012年6月1日星期五寫道:
On 06/01/2012 04:54 AM, Raymond Yau wrote:
2012/5/30 David Henningssondavid.henningsson@canonical.com:
On 05/30/2012 03:04 PM, Raymond Yau wrote:
I am afraid this does not work with desktop computer which has front mic , internal mic, Line in ,CD (or stereo mix with those via hda codecs)
With ubuntu 12.04 and unity , if I enable hda jack detect with my ad198x on my desktop, sound preference does not allow me to select front mic since I am still using ac97 front panel (with no jack detect circuit)
For those user with hda front audio panel, When the rear mic is unplugged, pulse audio change the input to another sound card if there is no plugged input jacks as pa don't regard cd or stereo mic as valid port of the input source.
When the rear mic is plugged before pulaseaudio start and it is the first port of the input in the sound setting ,it change to the webcam mic(second port) after the rear mic is unplugged.
So it won't autoselect when The user plugged the rear mic again. He have to select the rear mic in sound setting, the rear mic is the last port in sound setting.it will change to the mic1of another sound card(last port)
There are difference for the system settings/sound in unity and gnome
In gnome session, the system settings/sound list the three hardcoded ports (front mic, line and rear mic) instead of all the items in the "Input source" / "Capture Source" controls ( There is no CD in HDA, and no CD , stereo mix, aux, phone for my other sound cards with ac97 codec)
Is there any way to add back "Stereo Mix" to pulseaudio 's port ?
Yes. See:
http://www.freedesktop.org/wiki/Software/PulseAudio/Backends/ALSA/Profiles
However if you have additional questions about how to write PulseAudio
profiles and paths I might not have the time to help you out with that, hopefully you will be able to sort that out by yourself.
I have follows colin's tutorial compiling and running pulse audio from git. Do i need to build the unity/gnome sound setting and what are the name of the system setting sound in gnome and unity?
Although there is no aux in sound setting, select analog input in sound setting will select the aux
Why changing the input port from rear mic to front mic also change the value of rear mic boost and front mic boost at the same time ?
This forbid multi streaming capture using two mic.
In unity session, the system settings/sound only list the plugged jacks.
I think the usage of jack detect to select input source automatically is broken for for those motherboards which have three audio jacks in rear panel and retask those pink and blue jacks for surround51 output.
The module-switch-on-available-port should check whether "Channel mode' is 6 and exclude the result those jack detect of "rear mic" and "line in" since they have been retasked for output
Hmm. That would lead to quite hairy code in PulseAudio, I'm afraid...and
I don't think it's the right way to solve the problem either.
I think we could go about this in different ways.
- The easiest way is to say that if you're changing "Channel mode"
manually in alsamixer, you're on your own. After all, the normal/newbie end user would not know about alsamixer at all, so if you're capable of changing things in alsamixer you're assumed to be capable of configuring PulseAudio's profiles (using the link above) to match that as well.
- We could make a policy decision to remove the code that retasks the
jacks, and direct people to hda-jack-retask if they want to do that. That would mean simpler code for everyone - however, with the recent addition of multi-IO in the Realtek driver (for example), things doesn't seem to head that way...
- We could add both "Line Out Surround Jack" and "Rear Mic Jack". The
"Rear Mic Jack" would always return present=no when you're in 6-channel surround retask mode, and "Line Out Surround Jack" would always return present=no when you're in the normal mode.
It seem that is not possible to implement 3) in current implementation in hda-jack.c
I prefer an module parameter of hda for disable the creation of jack detect control since this force pa to fallback like the other sound cards which have no jack detection
The behaviour of desktop users are different from notebook users The desktop users are unlikely to plug/unplug the jacks at rear panel every time. They rather connected all the necessary jacks of the rear audio panel
BTW, the ICH8 HDA controller support multi stream capturing and ad1988 has thee capture subdevices
arecord -l card 1: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog] Subdevices: 3/3 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2
You would be able to make a multi-source profile in PulseAudio that can
record from all of these simultaneously, but we're missing a patch that can control volumes and switches with indices, so you would have to control the gain manually in alsamixer.
I don't think this work since when changing from rear mic to front mic, pulseaudio also change the rear mic boost and front mic boost. Especially when the pulse audio API does not allow application to select different sink or source (I.e. Multi streaming playback/capture is not supported by pulse audio)
The possible way is 1) an module parameter of hda driver to disable creation of jack detection controls 2) don't use module-switch-on-available-port in default.pa
Btw it seem sound is distorted when the application capture mono and the sound card only support stereo is because pa just sum the left and right channel (clipping)

On 06/07/2012 04:59 AM, Raymond Yau wrote:
David Henningsson <david.henningsson@canonical.com mailto:david.henningsson@canonical.com> 於 2012年6月1日星期五寫道:
On 06/01/2012 04:54 AM, Raymond Yau wrote:
2012/5/30 David Henningsson<david.henningsson@canonical.com
mailto:david.henningsson@canonical.com>:
On 05/30/2012 03:04 PM, Raymond Yau wrote:
I am afraid this does not work with desktop computer which has front mic , internal mic, Line in ,CD (or stereo mix with those via hda codecs)
With ubuntu 12.04 and unity , if I enable hda jack detect with my ad198x on my desktop, sound preference does not allow me to select front mic since I am still using ac97 front panel (with no jack detect circuit)
For those user with hda front audio panel, When the rear mic is unplugged, pulse audio change the input to another sound card if there is no plugged input jacks as pa don't regard cd or stereo mic as valid port of the input source.
When the rear mic is plugged before pulaseaudio start and it is the first port of the input in the sound setting ,it change to the webcam mic(second port) after the rear mic is unplugged.
So it won't autoselect when The user plugged the rear mic again. He have to select the rear mic in sound setting, the rear mic is the last port in sound setting.it http://setting.it will change to the mic1of another sound card(last port)
I think we have to live with these kinds of issues in PulseAudio until Colin has completed his priority list implementation.
There are difference for the system settings/sound in unity and gnome
In gnome session, the system settings/sound list the three hardcoded ports (front mic, line and rear mic) instead of all the items in the "Input source" / "Capture Source" controls ( There is no CD in HDA, and no CD , stereo mix, aux, phone for my other sound cards with ac97 codec)
Is there any way to add back "Stereo Mix" to pulseaudio 's port ?
Yes. See:
http://www.freedesktop.org/wiki/Software/PulseAudio/Backends/ALSA/Profiles
However if you have additional questions about how to write
PulseAudio profiles and paths I might not have the time to help you out with that, hopefully you will be able to sort that out by yourself.
I have follows colin's tutorial compiling and running pulse audio from git.
You don't need to recompile pulseaudio to change configuration files, they are all in /usr/share/pulseaudio/alsa-mixer
Do i need to build the unity/gnome sound setting and what are the name of the system setting sound in gnome and unity?
Although there is no aux in sound setting, select analog input in sound setting will select the aux
Why changing the input port from rear mic to front mic also change the value of rear mic boost and front mic boost at the same time ?
This forbid multi streaming capture using two mic.
You can change this by changing the configuration files.
In unity session, the system settings/sound only list the plugged
jacks.
I think the usage of jack detect to select input source automatically is broken for for those motherboards which have three audio jacks in rear panel and retask those pink and blue jacks for surround51 output.
The module-switch-on-available-port should check whether "Channel mode' is 6 and exclude the result those jack detect of "rear mic" and "line in" since they have been retasked for output
Hmm. That would lead to quite hairy code in PulseAudio, I'm
afraid...and I don't think it's the right way to solve the problem either.
I think we could go about this in different ways.
- The easiest way is to say that if you're changing "Channel mode"
manually in alsamixer, you're on your own. After all, the normal/newbie end user would not know about alsamixer at all, so if you're capable of changing things in alsamixer you're assumed to be capable of configuring PulseAudio's profiles (using the link above) to match that as well.
- We could make a policy decision to remove the code that retasks
the jacks, and direct people to hda-jack-retask if they want to do that. That would mean simpler code for everyone - however, with the recent addition of multi-IO in the Realtek driver (for example), things doesn't seem to head that way...
- We could add both "Line Out Surround Jack" and "Rear Mic Jack".
The "Rear Mic Jack" would always return present=no when you're in 6-channel surround retask mode, and "Line Out Surround Jack" would always return present=no when you're in the normal mode.
It seem that is not possible to implement 3) in current implementation in hda-jack.c
But everything is possible with the right patches :-)
I prefer an module parameter of hda for disable the creation of jack detect control since this force pa to fallback like the other sound cards which have no jack detection
Why don't you just remove the jack detection from PulseAudio's configuration files instead?
The behaviour of desktop users are different from notebook users The desktop users are unlikely to plug/unplug the jacks at rear panel every time. They rather connected all the necessary jacks of the rear audio panel
BTW, the ICH8 HDA controller support multi stream capturing and ad1988 has thee capture subdevices
arecord -l card 1: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog] Subdevices: 3/3 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2
You would be able to make a multi-source profile in PulseAudio that
can record from all of these simultaneously, but we're missing a patch that can control volumes and switches with indices, so you would have to control the gain manually in alsamixer.
I don't think this work since when changing from rear mic to front mic, pulseaudio also change the rear mic boost and front mic boost. Especially when the pulse audio API does not allow application to select different sink or source (I.e. Multi streaming playback/capture is not supported by pulse audio)
The possible way is
- an module parameter of hda driver to disable creation of jack
detection controls 2) don't use module-switch-on-available-port in default.pa http://default.pa
Btw it seem sound is distorted when the application capture mono and the sound card only support stereo is because pa just sum the left and right channel (clipping)
Ok. As a workaround, lower the input gain.

At Wed, 30 May 2012 14:46:48 +0200, David Henningsson wrote:
Posted to both alsa-devel and pulseaudio-discuss lists, as this is a cross issue.
PulseAudio tries to figure out what equipment is present on the machine using the mixer. If it finds e g "Headphone Playback Volume", "Headphone Playback Switch", or "Headphone Jack", it assumes that a headphone is present and creates a headphone port. If it finds no ports, it creates a fallback "Analog Output" port.
Now assume that we have a laptop with speakers and a headphone jack, but with only a "Master Playback Volume", and a "Headphone Jack" for the jack detection. PulseAudio will take the "Headphone Jack", and create a headphone port. Now, if this port is currently unconnected/unavailable, it will not show up at all [1]. As a result, the internal speakers - for which no port was created - will be essentially unusable.
Now, I thought this was a problem with a pair of machines only, that we could easily quirk on the PulseAudio side. But after looking through Ubuntu bugs and posting a blog post [2] about the issue, I have now collected 21 different machines affected, mostly on the input side. Several Realtek chips are affected on the dmic side, and some older STAC92xx chips have problems in both directions. So it becomes evident to me, that this is something that needs to be fixed pretty fast.
So, to move forward, we need to expose these speakers and internal mics to userspace. A very simple (untested) patch is attached. This would make "Internal Mic Jack" and "Speaker Jack" show up. Note that the actual status can be overridden/ignored on the PulseAudio side - the importance here is the sign that there are internal mics and speakers, so that the PulseAudio ports get created.
I could develop it a little to make sure we don't actually do any jack detection for these pins but always return them as being true/present. That is, if you approve the idea? I admit that the "Internal Mic Jack" is somewhat misleading/hacky as the internal mic is not connected to any physical jack, but it seems like the simplest way of resolving the problem currently.
I've thought of a similar change, but I postponed it because of some concerns: - the control actually is no-op as it's a fixed pin; IOW, should we really perform the jack-detection verb on such a pin? - as you mentioned, should it be really named as "Jack"?
The second point is just a matter of formality. We can regard "Jack" as the suffix to indicate the pin information. But the behavior jack ctl of such fixed pins should be defined exactly.
Takashi
-- David Henningsson, Canonical Ltd. https://launchpad.net/~diwic
[1] At least in Ubuntu's new Sound Settings UI.
[2] http://voices.canonical.com/david.henningsson/2012/05/22/three-audio-bugs-in... [2 expose-intmic.patch <text/x-patch (7bit)>] diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index 2dd1c11..61becde 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -312,7 +312,7 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, return 0; def_conf = snd_hda_codec_get_pincfg(codec, nid); conn = get_defcfg_connect(def_conf);
- if (conn != AC_JACK_PORT_COMPLEX)
if (conn == AC_JACK_PORT_NONE) return 0;
snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), &idx);

On 05/30/2012 04:56 PM, Takashi Iwai wrote:
At Wed, 30 May 2012 14:46:48 +0200, David Henningsson wrote:
Posted to both alsa-devel and pulseaudio-discuss lists, as this is a cross issue.
PulseAudio tries to figure out what equipment is present on the machine using the mixer. If it finds e g "Headphone Playback Volume", "Headphone Playback Switch", or "Headphone Jack", it assumes that a headphone is present and creates a headphone port. If it finds no ports, it creates a fallback "Analog Output" port.
Now assume that we have a laptop with speakers and a headphone jack, but with only a "Master Playback Volume", and a "Headphone Jack" for the jack detection. PulseAudio will take the "Headphone Jack", and create a headphone port. Now, if this port is currently unconnected/unavailable, it will not show up at all [1]. As a result, the internal speakers - for which no port was created - will be essentially unusable.
Now, I thought this was a problem with a pair of machines only, that we could easily quirk on the PulseAudio side. But after looking through Ubuntu bugs and posting a blog post [2] about the issue, I have now collected 21 different machines affected, mostly on the input side. Several Realtek chips are affected on the dmic side, and some older STAC92xx chips have problems in both directions. So it becomes evident to me, that this is something that needs to be fixed pretty fast.
So, to move forward, we need to expose these speakers and internal mics to userspace. A very simple (untested) patch is attached. This would make "Internal Mic Jack" and "Speaker Jack" show up. Note that the actual status can be overridden/ignored on the PulseAudio side - the importance here is the sign that there are internal mics and speakers, so that the PulseAudio ports get created.
I could develop it a little to make sure we don't actually do any jack detection for these pins but always return them as being true/present. That is, if you approve the idea? I admit that the "Internal Mic Jack" is somewhat misleading/hacky as the internal mic is not connected to any physical jack, but it seems like the simplest way of resolving the problem currently.
I've thought of a similar change, but I postponed it because of some concerns:
- the control actually is no-op as it's a fixed pin; IOW, should we really perform the jack-detection verb on such a pin?
I don't think we should perform the actual verb on these devices.
- as you mentioned, should it be really named as "Jack"?
The second point is just a matter of formality. We can regard "Jack" as the suffix to indicate the pin information. But the behavior jack ctl of such fixed pins should be defined exactly.
I would like us to be able to distinguish the "phantom" Jacks from the real ones. We can do this either by 1) Adding a third state - this might require us to change the type from BOOLEAN to something else, I don't know how backwards compatible such a change could be, or 2) Instead of calling them "Jack", we could have another suffix [1]. We could still have them as BOOLEAN and always return TRUE.
3) This is probably a bit overkill, as PulseAudio can do without that functionality anyway, but one could consider the speaker presence turning to FALSE when headphones are plugged in and then back to TRUE when headphones are unplugged - but only if "Automute mode" is enabled.
participants (3)
-
David Henningsson
-
Raymond Yau
-
Takashi Iwai