click/pop noise in the headphone on several lenovo laptops

Bug #1805079 reported by Hui Wang on 2018-11-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Critical
Hui Wang

Bug Description

[Impact]
Lenovo told us that some linux uers reported headphone noise on Lenovo's
website. After investigating, we found those Lenovo laptop mdoels all
have the codec of alc285, and we can reproduce the noise problem too.

[Fix]
Don't use the DAC of headphone, let headphone share the DAC with speaker,
the noise disappears.

[Test Case]
After applying this patch, we tested on Lenovo P52, P72, X1 carbon and X1
Yoda2, no noise anymore

[Regression Potential]
Low. This patch only apply to several lenovo machines, and after applying
this patch, both speaker and headphone still work very well.

Hui Wang (hui.wang) on 2018-11-26
Changed in linux (Ubuntu):
importance: Undecided → Critical

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1805079

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Hui Wang (hui.wang) wrote :

hwang4@hwang4-Inspiron-7520:~/work/mainline/alsa/sound$ git show c4cfcf6f4297c9256b53790bacbbbd6901fef468
commit c4cfcf6f4297c9256b53790bacbbbd6901fef468 (origin/for-linus)
Author: Hui Wang <email address hidden>
Date: Mon Nov 26 14:17:16 2018 +0800

    ALSA: hda/realtek - fix the pop noise on headphone for lenovo laptops

    We have several Lenovo laptops with the codec alc285, when playing
    sound via headphone, we can hear click/pop noise in the headphone,
    if we let the headphone share the DAC of NID 0x2 with the speaker,
    the noise disappears.

    The Lenovo laptops here include P52, P72, X1 yoda2 and X1 carbon.

    I have tried to set preferred_dacs and override_conn, but neither of
    them worked. Thanks for Kailang, he told me to invalidate the NID 0x3
    through override_wcaps.

    BugLink: https://bugs.launchpad.net/bugs/1805079
    Cc: <email address hidden>
    Signed-off-by: Kailang Yang <email address hidden>
    Signed-off-by: Hui Wang <email address hidden>
    Signed-off-by: Takashi Iwai <email address hidden>

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 1118fd1bbf1a..e66da22272fd 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5358,6 +5358,16 @@ static void alc274_fixup_bind_dacs(struct hda_codec *codec,
        spec->gen.preferred_dacs = preferred_pairs;
 }

+/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
+static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action)
+{
+ if (action != HDA_FIXUP_ACT_PRE_PROBE)
+ return;
+
+ snd_hda_override_wcaps(codec, 0x03, 0);
+}
+
 /* for hda_fixup_thinkpad_acpi() */
 #include "thinkpad_helper.c"

@@ -5495,6 +5505,7 @@ enum {
        ALC255_FIXUP_DELL_HEADSET_MIC,
        ALC295_FIXUP_HP_X360,
        ALC221_FIXUP_HP_HEADSET_MIC,
+ ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
 };

 static const struct hda_fixup alc269_fixups[] = {
@@ -6362,6 +6373,10 @@ static const struct hda_fixup alc269_fixups[] = {
                .chained = true,
                .chain_id = ALC269_FIXUP_HEADSET_MIC
        },
+ [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc285_fixup_invalidate_dacs,
+ },
 };

 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7035,6 +7050,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
                {0x12, 0x90a60130},
                {0x19, 0x03a11020},
                {0x21, 0x0321101f}),
+ SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
+ {0x12, 0x90a60130},
+ {0x14, 0x90170110},
+ {0x19, 0x04a11040},
+ {0x21, 0x04211020}),
        SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
                {0x12, 0x90a60120},
                {0x14, 0x90170110},

description: updated
Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Seth Forshee (sforshee) on 2018-11-27
Changed in linux (Ubuntu):
status: Confirmed → Fix Committed
AceLan Kao (acelankao) wrote :

This bug is awaiting verification that the kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-bionic' to 'verification-done-bionic'. If the problem still exists, change the tag 'verification-needed-bionic' to 'verification-failed-bionic'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: verification-needed-bionic
Vadim Vygonets (vygonets) wrote :

Awesome fix, Hui Wang, thank you!

I'm on Lenovo ThinkPad X1 Carbon 6th, model 20KH006JGE. After upgrading to Linux 4.19.7, the audio mute and microphone mute LEDs (on F1 and F4 keys) stopped working. They do work if I remove the line:

                {0x12, 0x90a60130},

Just removing it doesn't sound like the greatest idea, but I couldn't find the ALC285 datasheet online. If you could direct me to information about ALC285 registers so that I can fix the issue, or provide me with another value for the register so that I can test it, it will be greatly appreciated.

Many thanks,
Vadim.

Hui Wang (hui.wang) wrote :

@Vadim,

Need to add the code as below:
  .chained = true,
  .chain_id = ALC269_FIXUP_THINKPAD_ACPI

I will send the patch to fix it.

Thanks.

tags: added: verification-done-bionic
removed: verification-needed-bionic
Vadim Vygonets (vygonets) wrote :

Hi Hui Wang,

I added the lines and now everything works perfectly. Thank you!

Hui Wang (hui.wang) wrote :

Hello Vadim,

already sent the patch to review, let us wait for the next release.

Thanks.

Vadim Vygonets (vygonets) wrote :

Hi Hui Wang,

While waiting for your patch to reach the mainline, I just insert these two lines myself.

However, I still have issues with the sound.

Scenario: laptop is off, headphones are inserted, sound (both mic and output) is muted; I turn it on, log in etc., unmute the output and play something.

The sound is often too quiet (maybe 10 to 15 dB weaker than expected). If I unplug the headphones and plug them back in, the sound level rises to expected levels, but I start hearing noise reminiscent of cheap soundcards (with grounding problems?), where the noise characteristics change with the activity of other devices (e.g., mouse movements). The noise is stronger if I touch the touchpad. If I mute the sound, the noise disappears.

This does not happen if I remove the "0x12" line, whether or not I add the .chained/.chain_id lines. Interestingly, init_pin_configs in sysfs shows the same value for 0x12:

$ cat /sys/class/sound/hwC0D0/init_pin_configs
0x12 0x90a60130
0x13 0x40000000
0x14 0x90170110
0x16 0x411111f0
0x17 0x411111f0
0x18 0x411111f0
0x19 0x04a11040
0x1a 0x411111f0
0x1b 0x411111f0
0x1d 0x40600001
0x1e 0x411111f0
0x21 0x04211020

(driver_pin_configs and user_pin_configs are empty.)

Thank you,
Vadim.

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

Other bug subscribers