Ubuntu

Headset support on some Dell machines

Reported by David Henningsson on 2013-04-15
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HWE Next
Undecided
David Henningsson
linux (Ubuntu)
Undecided
David Henningsson
linux-lts-raring (Ubuntu)
High
David Henningsson
pulseaudio (Ubuntu)
Medium
David Henningsson
Precise
Undecided
David Henningsson
Raring
Undecided
David Henningsson

Bug Description

[SRU Justification]
Several new hardware has either headset jacks or headphone-or-mic jacks, where the system cannot detect what has been plugged in. E g, for such a headset jack you can either plug in a headphone or a headset, but since the system cannot tell which one it is, you have to manually tell the system whether you want to use the internal or external mic.
In the case of a headphone-or-mic jack, you can have the jack functioning as either a headphone or a mic, but not as a headset.

Without this patch, PulseAudio would not detect the jack correctly, and not making all options available to the user.

[Regression Potential] is very low: this only affects machines with the specific name "Headphone Mic Jack" or "Headset Mic Jack", which started to appear for a few machines in the 3.5 kernel. People who are running 12.04.0 or 12.04.1 will be unaffected. More machines are coming in the 3.10 kernel, so this is also a preparation for making certification easier later on.

[Test case] On an affected machine, plug in something into the jack. Then go to "Sound Settings" and note what options there are: e g, for a headset jack, you should be able to select both external and internal mic manually.

Changed in linux (Ubuntu):
status: New → In Progress
assignee: nobody → David Henningsson (diwic)
description: updated
Download full text (15.5 KiB)

On some machines, there is a headset jack that can support both
headphone, headsets (of both CTIA and OMTP type) and mic-in.

On other machines, the headset jack supports headphone, headsets
(both CTIA and OMTP), but not mic-in.

This patch implements that functionality as different capture sources.

Buglink: https://bugs.launchpad.net/bugs/1169143
Tested-by: David Chen <email address hidden>
Co-authored-by: Kailang <email address hidden>
Signed-off-by: David Henningsson <email address hidden>
---
 sound/pci/hda/patch_realtek.c | 386 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 386 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6cf27f5..f3307eb 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -52,6 +52,20 @@ enum {
  ALC_INIT_GPIO3,
 };

+enum {
+ ALC_HEADSET_MODE_UNKNOWN,
+ ALC_HEADSET_MODE_UNPLUGGED,
+ ALC_HEADSET_MODE_HEADSET,
+ ALC_HEADSET_MODE_MIC,
+ ALC_HEADSET_MODE_HEADPHONE,
+};
+
+enum {
+ ALC_HEADSET_TYPE_UNKNOWN,
+ ALC_HEADSET_TYPE_CTIA,
+ ALC_HEADSET_TYPE_OMTP,
+};
+
 struct alc_customize_define {
  unsigned int sku_cfg;
  unsigned char port_connectivity;
@@ -87,6 +101,11 @@ struct alc_spec {

  unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */

+ hda_nid_t headset_mic_pin;
+ hda_nid_t headphone_mic_pin;
+ int current_headset_mode;
+ int current_headset_type;
+
  /* hooks */
  void (*init_hook)(struct hda_codec *codec);
 #ifdef CONFIG_PM
@@ -2798,6 +2817,302 @@ static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
  }
 }

+static void alc_headset_mode_unplugged(struct hda_codec *codec)
+{
+ int val;
+
+ switch (codec->vendor_id) {
+ case 0x10ec0283:
+ alc_write_coef_idx(codec, 0x1b, 0x0c0b);
+ alc_write_coef_idx(codec, 0x45, 0xc429);
+ val = alc_read_coef_idx(codec, 0x35);
+ alc_write_coef_idx(codec, 0x35, val & 0xbfff);
+ alc_write_coef_idx(codec, 0x06, 0x2104);
+ alc_write_coef_idx(codec, 0x1a, 0x0001);
+ alc_write_coef_idx(codec, 0x26, 0x0004);
+ alc_write_coef_idx(codec, 0x32, 0x42a3);
+ break;
+ case 0x10ec0292:
+ alc_write_coef_idx(codec, 0x76, 0x000e);
+ alc_write_coef_idx(codec, 0x6c, 0x2400);
+ alc_write_coef_idx(codec, 0x18, 0x7308);
+ alc_write_coef_idx(codec, 0x6b, 0xc429);
+ break;
+ case 0x10ec0668:
+ alc_write_coef_idx(codec, 0x15, 0x0d40);
+ alc_write_coef_idx(codec, 0xb7, 0x802b);
+ break;
+ }
+ snd_printdd("Headset jack set to unplugged mode.\n");
+}
+
+
+static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
+ hda_nid_t mic_pin)
+{
+ int val;
+
+ switch (codec->vendor_id) {
+ case 0x10ec0283:
+ alc_write_coef_idx(codec, 0x45, 0xc429);
+ snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
+ val = alc_read_coef_idx(codec, 0x35);
+ alc_write_coef_idx(codec, 0x35, val | 1<<14);
+ alc_write_coef_idx(codec, 0x06, 0x2100);
+ alc_write_coef_idx(codec, 0x1a, 0x0021);
+ alc_write_coef_idx(codec, 0x26, 0x008c);
+ snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
+ break;
+ case 0x10ec0292:
+ snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
+ alc_write_coef_idx(codec, 0x19, 0xa208);
+ alc_write_coef_idx(codec, 0x2e, 0xacf0);
+ break;...

Takashi Iwai (tiwai) wrote :
Download full text (16.5 KiB)

At Mon, 15 Apr 2013 15:44:14 +0200,
David Henningsson wrote:
>
> On some machines, there is a headset jack that can support both
> headphone, headsets (of both CTIA and OMTP type) and mic-in.
>
> On other machines, the headset jack supports headphone, headsets
> (both CTIA and OMTP), but not mic-in.
>
> This patch implements that functionality as different capture sources.
>
> Buglink: https://bugs.launchpad.net/bugs/1169143
> Tested-by: David Chen <email address hidden>
> Co-authored-by: Kailang <email address hidden>
> Signed-off-by: David Henningsson <email address hidden>

Applied now. Thanks.

Takashi

> ---
> sound/pci/hda/patch_realtek.c | 386 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 386 insertions(+)
>
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 6cf27f5..f3307eb 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -52,6 +52,20 @@ enum {
> ALC_INIT_GPIO3,
> };
>
> +enum {
> + ALC_HEADSET_MODE_UNKNOWN,
> + ALC_HEADSET_MODE_UNPLUGGED,
> + ALC_HEADSET_MODE_HEADSET,
> + ALC_HEADSET_MODE_MIC,
> + ALC_HEADSET_MODE_HEADPHONE,
> +};
> +
> +enum {
> + ALC_HEADSET_TYPE_UNKNOWN,
> + ALC_HEADSET_TYPE_CTIA,
> + ALC_HEADSET_TYPE_OMTP,
> +};
> +
> struct alc_customize_define {
> unsigned int sku_cfg;
> unsigned char port_connectivity;
> @@ -87,6 +101,11 @@ struct alc_spec {
>
> unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
>
> + hda_nid_t headset_mic_pin;
> + hda_nid_t headphone_mic_pin;
> + int current_headset_mode;
> + int current_headset_type;
> +
> /* hooks */
> void (*init_hook)(struct hda_codec *codec);
> #ifdef CONFIG_PM
> @@ -2798,6 +2817,302 @@ static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
> }
> }
>
> +static void alc_headset_mode_unplugged(struct hda_codec *codec)
> +{
> + int val;
> +
> + switch (codec->vendor_id) {
> + case 0x10ec0283:
> + alc_write_coef_idx(codec, 0x1b, 0x0c0b);
> + alc_write_coef_idx(codec, 0x45, 0xc429);
> + val = alc_read_coef_idx(codec, 0x35);
> + alc_write_coef_idx(codec, 0x35, val & 0xbfff);
> + alc_write_coef_idx(codec, 0x06, 0x2104);
> + alc_write_coef_idx(codec, 0x1a, 0x0001);
> + alc_write_coef_idx(codec, 0x26, 0x0004);
> + alc_write_coef_idx(codec, 0x32, 0x42a3);
> + break;
> + case 0x10ec0292:
> + alc_write_coef_idx(codec, 0x76, 0x000e);
> + alc_write_coef_idx(codec, 0x6c, 0x2400);
> + alc_write_coef_idx(codec, 0x18, 0x7308);
> + alc_write_coef_idx(codec, 0x6b, 0xc429);
> + break;
> + case 0x10ec0668:
> + alc_write_coef_idx(codec, 0x15, 0x0d40);
> + alc_write_coef_idx(codec, 0xb7, 0x802b);
> + break;
> + }
> + snd_printdd("Headset jack set to unplugged mode.\n");
> +}
> +
> +
> +static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
> + hda_nid_t mic_pin)
> +{
> + int val;
> +
> + switch (codec->vendor_id) {
> + case 0x10ec0283:
> + alc_write_coef_idx(codec, 0x45, 0xc429);
> + snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
> + val = alc_read_coef_idx(codec, 0x35);
> + alc_write_coef_idx(codec, 0x35, val | 1<<14);
> + alc_write_coef_idx(codec, 0x06, 0x2100);
> + alc_write_coef_idx...

tags: added: blocks-hwcert-enablement
Changed in linux (Ubuntu):
status: In Progress → Fix Committed
David Henningsson (diwic) wrote :

Fixed in 3.10

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
Changed in pulseaudio (Ubuntu):
status: New → In Progress
David Henningsson (diwic) wrote :

The relevant PulseAudio changes are in PulseAudio 4.0 - once we have released that into Saucy, we should probably SRU those files into 12.04 too.

Changed in pulseaudio (Ubuntu):
status: In Progress → Fix Committed
no longer affects: linux (Ubuntu Precise)
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:3.0-0ubuntu9

---------------
pulseaudio (1:3.0-0ubuntu9) saucy; urgency=low

  * debian/patches/0112-*, 0113-*: Add better support for machines with
    "Headphone Mic" and "Headset Mic" jacks, used in some newer hardware
    (LP: #1169143)
 -- David Henningsson <email address hidden> Wed, 24 Jul 2013 10:06:39 +0200

Changed in pulseaudio (Ubuntu):
status: Fix Committed → Fix Released
Changed in pulseaudio (Ubuntu):
assignee: nobody → David Henningsson (diwic)
Changed in pulseaudio (Ubuntu Precise):
assignee: nobody → David Henningsson (diwic)
status: New → In Progress
description: updated
description: updated
David Henningsson (diwic) wrote :

SRU uploaded to precise-proposed, waiting for ubuntu-sru approval.

Changed in hwe-next:
status: New → In Progress

Hello David, or anyone else affected,

Accepted pulseaudio into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/pulseaudio/1:1.1-0ubuntu15.4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in pulseaudio (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Changed in hwe-next:
assignee: nobody → David Henningsson (diwic)
David Henningsson (diwic) wrote :

Per Adam's wishes, I did some regression testing on one machine here. I tested headphones, front mic and rear mic jacks. I tested this under both kernel 3.2 and 3.8. No regressions were found, everything kept working, as expected.

Shawn Wang (shawn111) wrote :

Hi David,
 I did some audio tests, 2-pin headphones (output)/2-pin microphone(input)/3-pin headset(output/input) on two dell machines.

 No regressions were found, everything kept working, as expected.

 Here is my test environment:
 - Precise (12.04) installation
 - PulseAudio from precise-proposed repository
 - A saucy (3.11) kernel / 3.5 lts-quantal kernel with oem-audio-hda-daily-lts-quantal-dkms (0.201309280820~ubunut12.04.01)

David Henningsson (diwic) wrote :

@Shawn, thanks - given our debugging session last week I assume you mean that given a 3.11 kernel, the headset/ mic-only *started* to work after installing PulseAudio from precise-proposed, and it was not working with the pulseaudio from precise-updates.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:1.1-0ubuntu15.4

---------------
pulseaudio (1:1.1-0ubuntu15.4) precise-proposed; urgency=low

  * 0626/0627/0628-alsa-mixer patches:
    Add better support for new machines with headphone-or-mic jacks, and
    headset jacks without individual jack detection. (LP: #1169143)
 -- David Henningsson <email address hidden> Mon, 29 Jul 2013 15:34:12 +0200

Changed in pulseaudio (Ubuntu Precise):
status: Fix Committed → Fix Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Anthony Wong (anthonywong) wrote :

Opened linux-lts-raring as we'd like to fix 14.02.3 as well, so as to resolve the certification issue at bug 1249956.

Yang Kun (YK) (dayangkuncn) wrote :

the version Anthony mentioned in comment #13 should be 12.04.3

David Henningsson (diwic) wrote :

I've done a preliminary backport of patches to kernel 3.8, and packaged it up in the attached DKMS package. Could you test it?

I e, install 12.04 with the lts-raring kernel, and then install this DKMS package, then reboot. Is the headset microphone (and the mic-only part) working now?

David Henningsson (diwic) wrote :
Po-Hsu Lin (cypressyew) wrote :

Hello David,

I just install the deb file you provided in comment #17
The external microphone issue still exist.

Step:
1. Install the deb file on 12.04.3 (3.8.0-29)
2. Reboot, plug the microphone, check if it works

$ dpkg -l | grep oem
ii oem-audio-hda-daily-lts-raring-dkms 0.1

David Henningsson (diwic) wrote :
Po-Hsu Lin (cypressyew) wrote :

With the PulseAudio version 1:1.1-0ubuntu15.4
The fix in comment #17 works on 201306-13688
There will be two devices in the "Input" section,
Headset Microphone / Internal Microphone

With the fix in comment #19, it works on 201308-14155
There will be three devices, Internal Microphone / Headset Microphone / Microphone
in the "input" section when the headset is plugged in
And two devices, Headphone / Speaker in the output section.

The headset microphone (with 2-in-1 jack) could work with "Headset Microphone" selected,

The "Microphone" does not work with a single microphone or a headset microphone even with the "Speaker" selected in the Output section.
It could work if you plug the earphone, and talk into the earphone instead
 (work with the earphone of a 2-in-1 jack headphone or a normal earphone)

Changed in linux-lts-raring (Ubuntu):
status: New → In Progress
assignee: nobody → David Henningsson (diwic)
importance: Undecided → High
David Henningsson (diwic) wrote :

Ok, I think I found the problem with the previous DKMS. Is this one working better?

David Henningsson (diwic) wrote :
Po-Hsu Lin (cypressyew) wrote :

Hello David,
I have this deb verified on 201308-14155 Dell Inspiron 3135
this deb works fine!

Thanks!

no longer affects: linux (Ubuntu Raring)
no longer affects: linux-lts-raring (Ubuntu Raring)
Changed in pulseaudio (Ubuntu Raring):
status: New → In Progress
assignee: nobody → David Henningsson (diwic)
Taihsiang Ho (taihsiangho) wrote :

LP: #1249956 collects the info machines with this bug

David Henningsson (diwic) wrote :

After some discussion with Leann we've decided *not* to backport this to the -lts-raring kernel. This is mainly due to timing issues, i e there is some significant delay before the patches will reach -updates, and at that point, there is not long before 12.04.4 is release. Instead wait for 12.04.4 before certifying these machines.

Changed in linux-lts-raring (Ubuntu):
status: In Progress → Won't Fix
Changed in pulseaudio (Ubuntu Raring):
status: In Progress → Invalid
Changed in pulseaudio (Ubuntu Raring):
status: Invalid → Won't Fix
Changed in hwe-next:
status: In Progress → Fix Released
Po-Hsu Lin (cypressyew) wrote :

Hello David,
I found one sub-system [1028:060a] that is not included in the patch [0]

It's a Dell XPS 13 9333 (201309-14237 )
Hardware information:
00:03.0 Audio device [0403]: Intel Corporation Device [8086:0a0c] (rev 09)
        Subsystem: Dell Device [1028:060a]
        Flags: bus master, fast devsel, latency 0, IRQ 58
        Memory at f0510000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: <access denied>
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd-hda-intel

00:1b.0 Audio device [0403]: Intel Corporation Lynx Point-LP HD Audio Controller [8086:9c20] (rev 04)
        Subsystem: Dell Device [1028:060a]
        Flags: bus master, fast devsel, latency 0, IRQ 62
        Memory at f0514000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: <access denied>
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd-hda-intel

[0] https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/pci/hda/patch_realtek.c

Po-Hsu Lin (cypressyew) wrote :

alsa-info for 201309-14237
http://www.alsa-project.org/db/?f=8c7dfe857ceff462ca2de133e67023c0f68de9cb

Nothing changes with "options snd-hda-intel model=dell-headset-multi " added into /etc/modprobe.d/alsa-base.conf

Po-Hsu Lin (cypressyew) wrote :

With the correct tweak:
options snd-hda-intel model=,dell-headset-multi
added into /etc/modprobe.d/alsa-base.conf

Input source will change form "Analog input" to "Internal Microphone"
And with external headset plugged, two more options "Headset Microphone" and "Microphone" will be available, and the external microphone works with "Headset Microphone" selected

Daniel Manrique (roadmr) on 2014-02-18
Changed in pulseaudio (Ubuntu):
importance: Undecided → Medium
Yung Shen (kaxing) wrote :

There is another Dell XPS 9333 (201309-14238) with the same problem.

I've double checked the workaround that cypressyew mentioned in comment #28 works with linux-image-3.11.0-18.

Also confirmed that this problem does not happen in linux-image-3.14.0-031400rc8 [0].

Alsainfo:
http://www.alsa-project.org/db/?f=baf761f88e65ed838af4f66cbace653413feffbf

lspci -nnvv|grep Audio -A9:
00:03.0 Audio device [0403]: Intel Corporation Device [8086:0a0c] (rev 09)
 Subsystem: Dell Device [1028:060a]
 Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
 Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
 Latency: 0, Cache Line Size: 64 bytes
 Interrupt: pin A routed to IRQ 63
 Region 0: Memory at f0510000 (64-bit, non-prefetchable) [size=16K]
 Capabilities: <access denied>
 Kernel driver in use: snd_hda_intel
 Kernel modules: snd-hda-intel

--
00:1b.0 Audio device [0403]: Intel Corporation Lynx Point-LP HD Audio Controller [8086:9c20] (rev 04)
 Subsystem: Dell Device [1028:060a]
 Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
 Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
 Latency: 0, Cache Line Size: 64 bytes
 Interrupt: pin A routed to IRQ 64
 Region 0: Memory at f0514000 (64-bit, non-prefetchable) [size=16K]
 Capabilities: <access denied>
 Kernel driver in use: snd_hda_intel
 Kernel modules: snd-hda-intel

[0] http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.14-rc8-trusty/

Yung Shen (kaxing) wrote :

Additional checked Dell XPS 9333 (201309-14238) with linux-image-3.11.10-03111006-generic [0] without workaround problem fixed as well.

Alsainfo:
http://www.alsa-project.org/db/?f=fa9905d545fe10fb65896cfa1124b58290c2185e

[0] http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.11.10.6-saucy/

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers