hwang4@hwang4-Inspiron-7520:~/work/mainline/alsa/sound$ git show 
c4cfcf6f4297c9256b53790bacbbbd6901fef468
commit c4cfcf6f4297c9256b53790bacbbbd6901fef468 (origin/for-linus)
Author: Hui Wang <hui.w...@canonical.com>
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: <sta...@vger.kernel.org>
    Signed-off-by: Kailang Yang <kail...@realtek.com>
    Signed-off-by: Hui Wang <hui.w...@canonical.com>
    Signed-off-by: Takashi Iwai <ti...@suse.de>

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 changed:

- These laptops all have the codec of alc285.
+ [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.
  
- reproduced by:
+ [Fix]
+ Don't use the DAC of headphone, let headphone share the DAC with speaker,
+ the noise disappears.
  
-         1. Hookup a set of headphones that you can separately place
-         in/on your ears. (ie. ear buds)
+ [Test Case]
+ After applying this patch, we tested on Lenovo P52, P72, X1 carbon and X1
+ Yoda2, no noise anymore
  
-         2. Put only the right headphone in/on your ear.
- 
-         3. Go to the Gnome sound settings and bring up the "Test
-         Speakers" function
- 
-         4. Play the left speaker test
- 
-         You would expect to hear nothing in the right ear, but instead
-         you hear a "pop" at the start of each word spoken. ("pop"
-         Front "pop" left). You can repeat with the left headphone and
-         see similar results. I even tried shifting the balance all the
-         way to the left/right and get the same results.
- 
-         So one problem appears to be when the headphone jack is
-         initially sent audio, it causes a "pop" in the headphone jack.
+ [Regression Potential]
+ Low. This patch only apply to several lenovo machines, and after applying
+ this patch, both speaker and headphone still work very well.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1805079

Title:
  click/pop noise in the headphone on several lenovo laptops

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1805079/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to