Bug 96201 - Headset mic connected to combo jack not working with Acer Aspire V5-122P-0408
Summary: Headset mic connected to combo jack not working with Acer Aspire V5-122P-0408
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: Intel Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-06 14:32 UTC by Nicholas Bishop
Modified: 2016-10-11 20:21 UTC (History)
5 users (show)

See Also:
Kernel Version: 3.17.4-301.fc21.x86_64
Subsystem:
Regression: No
Bisected commit-id:


Attachments
two runs of alsa-info (prefixed descriptions with "!!!!") (30.26 KB, text/plain)
2015-04-06 14:32 UTC, Nicholas Bishop
Details
alsa-info with combo headset plugged in (30.26 KB, text/plain)
2015-04-06 14:35 UTC, Nicholas Bishop
Details
alsa-info without anything plugged in (30.27 KB, text/plain)
2015-04-06 14:35 UTC, Nicholas Bishop
Details
Patch to add headset-mode and headset-mode-no-hp-mic models (754 bytes, patch)
2015-05-19 08:08 UTC, Takashi Iwai
Details | Diff
alsa-info with dell-headset-multi (33.57 KB, text/plain)
2015-06-01 15:07 UTC, Maccer
Details
alsa-info with headset mode (28.23 KB, text/plain)
2015-06-01 15:08 UTC, Maccer
Details
alsa-info with headset-mode-no-hp-mic (28.15 KB, text/plain)
2015-06-01 15:09 UTC, Maccer
Details
Test fix patch for Aspire V5 (2.18 KB, patch)
2015-06-01 15:34 UTC, Takashi Iwai
Details | Diff
alsa-info with patch applied (29.19 KB, application/octet-stream)
2015-06-25 22:57 UTC, Nicholas Bishop
Details
Revised patch for Aspre V5 (6.11 KB, patch)
2015-06-26 13:42 UTC, Takashi Iwai
Details | Diff
alsa-info with aspire-v5-headset-2.diff applied (27.22 KB, text/plain)
2015-06-26 16:42 UTC, Nicholas Bishop
Details
alsa-info on v4.1 without any patches applied (25.18 KB, text/plain)
2015-06-26 19:20 UTC, Nicholas Bishop
Details
alsa-info output for Acer V5-573G (64.76 KB, application/octet-stream)
2015-07-16 16:13 UTC, Mateusz Sylwestrzak
Details
Additional patch for Aspire V5-573G (741 bytes, patch)
2015-07-16 19:02 UTC, Takashi Iwai
Details | Diff
Acer V5-573G after applying the two patches. (66.96 KB, application/octet-stream)
2015-07-18 23:43 UTC, Mateusz Sylwestrzak
Details
Acer V5-573G - 0x19 mod in ALC282_FIXUP_ASPIRE_V5_PINS (56.49 KB, application/octet-stream)
2015-07-19 10:11 UTC, Mateusz Sylwestrzak
Details
Acer V5-573G - no patches, hdajackretask for 0x19 (57.42 KB, application/octet-stream)
2015-07-19 12:59 UTC, Mateusz Sylwestrzak
Details
Acer V5-573G / 0x19 mod in ALC282_FIXUP_ASPIRE_V5_PINS / working fine (56.67 KB, application/octet-stream)
2015-07-19 13:38 UTC, Mateusz Sylwestrzak
Details
patch to make the external microphone work in Acer V5-573G (374 bytes, patch)
2015-07-19 13:39 UTC, Mateusz Sylwestrzak
Details | Diff
Acer Aspire V5-573G add headset mic support (1.08 KB, patch)
2015-07-19 14:10 UTC, Mateusz Sylwestrzak
Details | Diff
Acer Aspire V5-573G add headset mic support (1.08 KB, patch)
2015-07-19 14:12 UTC, Mateusz Sylwestrzak
Details | Diff

Description Nicholas Bishop 2015-04-06 14:32:54 UTC
Created attachment 173181 [details]
two runs of alsa-info (prefixed descriptions with "!!!!")

The Acer Aspire V5-122P-0408 has an internal microphone and a combo headset jack. The internal microphone works fine, and the headset output works too (sound plays and it detects the presence correctly). The headset microphone input does not work, however.

I've attached two runs of alsa-info, one with a combo headset plugged in and one without anything plugged in.

Let me know if there's any additional information I can provide.
Comment 1 Nicholas Bishop 2015-04-06 14:35:21 UTC
Created attachment 173191 [details]
alsa-info with combo headset plugged in
Comment 2 Nicholas Bishop 2015-04-06 14:35:49 UTC
Created attachment 173201 [details]
alsa-info without anything plugged in
Comment 3 Maccer 2015-05-14 20:59:14 UTC
I also have the same bug with my Acer V5-571G. Here's [some info](https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1351916). It seems that it affects multiple users and in different distros.
Comment 4 Maccer 2015-05-14 21:00:31 UTC
(In reply to Maccer from comment #3)
> I also have the same bug with my Acer V5-571G. Here's [some
> info](https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1351916).
> It seems that it affects multiple users and in different distros.
Comment 5 Maccer 2015-05-16 08:54:41 UTC
Yaay! i found a workaround! It seems that the mic isn't correctly detected. What i did was:

sudo echo "options snd-hda-intel model=dell-headset-multi" > /etc/modprobe.d/snd-hda-intel.conf

and the mic started to work after a reboot. if it didn't work for you, you may try replacing " dell-headset-multi " with 
" headset-mic " , " alc271-dmic " or any other mic model from  https://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt  that is assigned to your audio card.
Comment 6 Takashi Iwai 2015-05-19 08:07:25 UTC
Could you try to apply the patch below and use model=headset-mode-no-hp-mic or model=headset-mode instead?  These don't override the pin configurations that were designed for Dell machines.
Comment 7 Takashi Iwai 2015-05-19 08:08:01 UTC
Created attachment 177301 [details]
Patch to add headset-mode and headset-mode-no-hp-mic models
Comment 8 Maccer 2015-05-30 17:43:39 UTC
It doesn't work with those models.
Comment 9 Takashi Iwai 2015-05-31 07:34:15 UTC
Please give alsa-info.sh outputs, just for confirming whether you tested properly.
Comment 10 Maccer 2015-06-01 15:07:46 UTC
Created attachment 178481 [details]
alsa-info with dell-headset-multi

Altrough this model is what works on my laptop, it shows 2 headset mics (different names but is the same mic).
Comment 11 Maccer 2015-06-01 15:08:24 UTC
Created attachment 178491 [details]
alsa-info with headset mode
Comment 12 Maccer 2015-06-01 15:09:24 UTC
Created attachment 178501 [details]
alsa-info with headset-mode-no-hp-mic

Here you have the last one.
Comment 13 Takashi Iwai 2015-06-01 15:33:42 UTC
Thanks.  So, you'd need to set up an additional mic pin explicitly.  It's either 0x19 or 0x1a, and my wild shot points to the former.

Could you check the patch below without model option?  (You'd need to apply the previous model option patch.  Or you can ignore the last chunk, as it just adds a new model option.)
Comment 14 Takashi Iwai 2015-06-01 15:34:12 UTC
Created attachment 178511 [details]
Test fix patch for Aspire V5
Comment 15 Maccer 2015-06-01 16:09:48 UTC
How should i do it?
Comment 16 Takashi Iwai 2015-06-01 16:10:54 UTC
Apply the patch and test :)
Comment 17 Maccer 2015-06-01 16:12:58 UTC
I mean, how do I apply a patch? I have no experience with this.
Comment 18 Takashi Iwai 2015-06-01 16:16:10 UTC
Grrr, so your results in comment 11 and 12 are also invalid.  It was the request with these models after applying the patch in comment 7.  Without the patch, it doesn't work, of course.

For applying the patch, run on the top of kernel tree like:

   patch -p1 < /somewhere/your-patch

where "/somewhere/your-patch" is a path of the patch you downloaded.
Then build and install the kernel as usual.
Comment 19 Nicholas Bishop 2015-06-25 22:57:12 UTC
Original reporter here. I just tested the patch on Linux 4.1.0 and confirmed that I can switch from internal mic to the headset mic on the Acer Aspire V5 122P.

I'm curious, are we sure that the jack does not support presence detection? Is there anything I should do to check?
Comment 20 Nicholas Bishop 2015-06-25 22:57:47 UTC
Created attachment 180911 [details]
alsa-info with patch applied
Comment 21 Raymond 2015-06-26 09:38:01 UTC
driver usually create input soure controls only on desktop , auto mic select don't need any capture source control/input source control

Simple mixer control 'Input Source',0
  Capabilities: cenum
  Items: 'Internal Mic' 'Headset Mic'
  Item0: 'Headset Mic'
Simple mixer control 'Input Source',1
  Capabilities: cenum
  Items: 'Internal Mic' 'Headset Mic'
  Item0: 'Headset Mic'
Comment 22 Takashi Iwai 2015-06-26 13:41:44 UTC
(In reply to Nicholas Bishop from comment #19)
> Original reporter here. I just tested the patch on Linux 4.1.0 and confirmed
> that I can switch from internal mic to the headset mic on the Acer Aspire V5
> 122P.
> 
> I'm curious, are we sure that the jack does not support presence detection?
> Is there anything I should do to check?

OK, how about the revised patch below?
Comment 23 Takashi Iwai 2015-06-26 13:42:15 UTC
Created attachment 180981 [details]
Revised patch for Aspre V5
Comment 24 Nicholas Bishop 2015-06-26 16:42:00 UTC
With the new patch I couldn't get it to switch the headset mic anymore, internal mic was always chosen. Attaching updated alsa-info
Comment 25 Nicholas Bishop 2015-06-26 16:42:45 UTC
Created attachment 181011 [details]
alsa-info with aspire-v5-headset-2.diff applied
Comment 26 Takashi Iwai 2015-06-26 17:33:16 UTC
It implies that the headset detection didn't work as expected.  (It was originally for Dell machines, after all.)

Maybe we should go back to basic: could you check whether NID 0x19 give the jack detection?  For example, run hda-verb like

   hda-verb /dev/snd/hwC1D0 0x19 GET_PIN_SENSE 0

at both headset plugged and unplugged states.  Does either of them return the value with the bit 31 set?  Also, check the same for the headphone without a mic, not the headset.
Comment 27 Nicholas Bishop 2015-06-26 18:33:57 UTC
Mic headset plugged in: 0x80000000

Headphones (no mic) plugged in: 0x0

Nothing plugged in: 0x80000000

Note: I got that output on the kernel with aspire-v5-headset-2.diff applied, not sure if that was the desired environment or not.
Comment 28 Takashi Iwai 2015-06-26 18:40:59 UTC
Please retest without any patch applied.
Comment 29 Nicholas Bishop 2015-06-26 19:20:16 UTC
With no patches applied:

Mic headset plugged in: 0x0

Headphones (no mic) plugged in: 0x0

Nothing plugged in: 0x0

I will attach a new alsa-info to confirm that this kernel was built without the previous patches.
Comment 30 Nicholas Bishop 2015-06-26 19:20:51 UTC
Created attachment 181021 [details]
alsa-info on v4.1 without any patches applied
Comment 31 Takashi Iwai 2015-06-27 08:25:37 UTC
Thanks.  So the jack detection isn't straightforward as expected.

Then I'm going to queue the first version of the fix to 4.2-rc1.  This makes the mic working at least.  The auto switch feature will be implemented later.
After merging to 4.2-rc1, the fix will be backported to stable kernels eventually.
Comment 32 Mateusz Sylwestrzak 2015-07-16 15:54:15 UTC
Hi, 

I'd like to report that Acer V5-573G is also affected. Still it seems to pull up different pin numbers in the code. 

Overriding the 0x19 PIN with 0x01a1913c also works here.

Could you please account for this model in the code, too?

Thanks in advance,
Mateusz
Comment 33 Takashi Iwai 2015-07-16 15:58:31 UTC
(In reply to matisec7 from comment #32)
> Hi, 
> 
> I'd like to report that Acer V5-573G is also affected. Still it seems to
> pull up different pin numbers in the code. 
> 
> Overriding the 0x19 PIN with 0x01a1913c also works here.
> 
> Could you please account for this model in the code, too?

Please give alsa-info.sh output.  It should contain more detailed information.
Comment 34 Mateusz Sylwestrzak 2015-07-16 16:13:15 UTC
Created attachment 182841 [details]
alsa-info output for Acer V5-573G
Comment 35 Takashi Iwai 2015-07-16 18:59:28 UTC
Could you try the patch below?
Comment 36 Takashi Iwai 2015-07-16 19:02:37 UTC
Created attachment 182871 [details]
Additional patch for Aspire V5-573G

Apply this one on the top of the patch of comment 14.
Comment 37 Mateusz Sylwestrzak 2015-07-16 20:45:12 UTC
Thanks a million. Do you plan on merging it into the kernel trees?

As a workaround, I use hda-jack-retask.
Comment 38 Mateusz Sylwestrzak 2015-07-16 20:47:19 UTC
I'll try the patch, though, but over the weekend. I'll provide feedback here. 

Thanks again.
Comment 39 Takashi Iwai 2015-07-17 10:39:42 UTC
(In reply to Mateusz Sylwestrzak from comment #37)
> Thanks a million. Do you plan on merging it into the kernel trees?

Yes, but only when it's confirmed to actually work :)
Comment 40 Mateusz Sylwestrzak 2015-07-18 23:42:40 UTC
Hi, 

I've applied the two patches and compiled a kernel. It seems that the 0x19 pin is assigned the correct value for /sys/class/sound/hwC1D0/driver_pin_configs but not for /sys/class/sound/hwC1D0/init_pin_configs. 

In practice, the headset microphone is the internal microphone so it's not working the way it should. 

Best,
MS
Comment 41 Mateusz Sylwestrzak 2015-07-18 23:43:36 UTC
Created attachment 183051 [details]
Acer V5-573G after applying the two patches.

It doesn't seem to work properly.
Comment 42 Takashi Iwai 2015-07-19 06:51:19 UTC
OK, then the first thing to test is to remap the pins like:

0x18 0x0321101f
0x21 0x03a11020

This will point 0x18 as the headphone and 0x21 as the mic.

You can pass these via patch firmware file over patch module option.  See Documentation/sound/alsa/HD-Audio.txt for instruction.
Comment 43 Takashi Iwai 2015-07-19 06:52:58 UTC
(In reply to Takashi Iwai from comment #42)
> OK, then the first thing to test is to remap the pins like:

Oops, sorry, pasted to a wrong bug.
Comment 44 Takashi Iwai 2015-07-19 06:59:47 UTC
(In reply to Mateusz Sylwestrzak from comment #40)
> Hi, 
> 
> I've applied the two patches and compiled a kernel. It seems that the 0x19
> pin is assigned the correct value for
> /sys/class/sound/hwC1D0/driver_pin_configs but not for
> /sys/class/sound/hwC1D0/init_pin_configs. 

This is the correct behavior.  The init_pin_configs contains the values set by BIOS while the driver_pin_configs are the values overridden by the driver.  Thus, the patch behaves as expected.
 
> In practice, the headset microphone is the internal microphone so it's not
> working the way it should. 

Are you sure that just changing the NID 0x19 makes it working?  I supposed that it's a headset mic similar like other Aspire models that needs the special handling of headset detection.

If just changing NID 0x19 pincfg is enough, you'd need to just replace the value of NID 0x19 in ALC282_FIXUP_ASPIRE_V5_PINS without any further fixup chain.
Comment 45 Mateusz Sylwestrzak 2015-07-19 09:20:06 UTC
I'm sure. Patching it like this made it work:

/etc/modprobe.d/hda-jack-retask.conf:
# This file was added by the program 'hda-jack-retask'.
# If you want to revert the changes made by this program, you can simply erase this file and reboot your computer.
options snd-hda-intel patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw


/lib/firmware/hda-jack-retask.fw:                               
[codec]
0x80862807 0x80860101 0

[pincfg]
0x19 0x01a1913c

When working properly, the labels for input devices in kmix were "microphone" vs "internal microphone". After the two patches, it was "headset microphone" vs "internal microphone" but the two sources were the internal microphone in fact.
 
I've just started compiling a new kernel with the 0x01a1913c NID value in 0x19 in ALC282_FIXUP_ASPIRE_V5_PINS.

I'm going to post feedback any time soon. 

I hope that it works and that you'll be able to incorporate the fix into the code.  

Best, 
MS
Comment 46 Mateusz Sylwestrzak 2015-07-19 10:11:40 UTC
Created attachment 183071 [details]
Acer V5-573G - 0x19 mod in ALC282_FIXUP_ASPIRE_V5_PINS

Hi, 

now I'm confused as neither the "internal microphone" nor the "microphone" seem to work. When I'm trying to record with either, all I'm getting is repetitive clicks.
Comment 47 Mateusz Sylwestrzak 2015-07-19 12:59:59 UTC
Created attachment 183081 [details]
Acer V5-573G - no patches, hdajackretask for 0x19

Hi,

this one is a workaround that actually works with the standard 4.1.2-2 kernel shipped by Arch Linux.

/etc/modprobe.d/hda-jack-retask.conf:
# This file was added by the program 'hda-jack-retask'.
# If you want to revert the changes made by this program, you can simply erase this file and reboot your computer.
options snd-hda-intel patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw


/lib/firmware/hda-jack-retask.fw:                                                                     
[codec]
0x80862807 0x80860101 0

[pincfg]
0x19 0x01a1913c
Comment 48 Mateusz Sylwestrzak 2015-07-19 13:38:15 UTC
Created attachment 183091 [details]
Acer V5-573G / 0x19 mod in ALC282_FIXUP_ASPIRE_V5_PINS / working fine

Sorry for the confusion. 

Once again, I installed the kernel with the 0x19 in the ALC282_FIXUP_ASPIRE_V5_PINS array and it works as desired. 

I'm attaching an alsa-info log.

Below I'll attach a patch that made the mic work properly.
Comment 49 Mateusz Sylwestrzak 2015-07-19 13:39:02 UTC
Created attachment 183101 [details]
patch to make the external microphone work in Acer V5-573G
Comment 50 Takashi Iwai 2015-07-19 13:44:04 UTC
OK, then could you format your patch in a formal way to merge to the upstream, i.e. give a proper subject and the patch description, and last but not least, your signed-off-by tag?
Comment 51 Mateusz Sylwestrzak 2015-07-19 14:10:58 UTC
Created attachment 183121 [details]
Acer Aspire V5-573G add headset mic support

Please let me know if anything's missing.
Comment 52 Mateusz Sylwestrzak 2015-07-19 14:12:23 UTC
Created attachment 183131 [details]
Acer Aspire V5-573G add headset mic support

Please ignore the patch above. It was attached by mistake.

Please let me know if anything's missing.
Comment 53 Takashi Iwai 2015-07-19 15:40:55 UTC
The patch looks good, I'm going to queue it.  It'll be included in 4.2-rc4 and backported later to stable kernels.  Thanks!
Comment 54 Mateusz Sylwestrzak 2015-07-19 17:13:32 UTC
Great! Thank you, too. Take care.
Comment 55 Sergey Fedorov 2016-10-11 20:21:44 UTC
(In reply to Mateusz Sylwestrzak from comment #52)
> Created attachment 183131 [details]
> Acer Aspire V5-573G add headset mic support
> 
> Please ignore the patch above. It was attached by mistake.
> 
> Please let me know if anything's missing.

Hi Mateusz, is it possible to mute the internal mic when a headset with mic attached? Thanks!

Note You need to log in before you can comment on or make changes to this bug.