]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/alsa-hda-realtek-fixup-headphone-noise-via-runtime-suspend.patch
c098b65b036130400f48f9f38d0cc0cf81bf3c63
[thirdparty/kernel/stable-queue.git] / queue-4.19 / alsa-hda-realtek-fixup-headphone-noise-via-runtime-suspend.patch
1 From dad3197da7a3817f27bb24f7fd3c135ffa707202 Mon Sep 17 00:00:00 2001
2 From: Kailang Yang <kailang@realtek.com>
3 Date: Fri, 10 May 2019 16:28:57 +0800
4 Subject: ALSA: hda/realtek - Fixup headphone noise via runtime suspend
5
6 From: Kailang Yang <kailang@realtek.com>
7
8 commit dad3197da7a3817f27bb24f7fd3c135ffa707202 upstream.
9
10 Dell platform with ALC298.
11 system enter to runtime suspend. Headphone had noise.
12 Let Headset Mic not shutup will solve this issue.
13
14 [ Fixed minor coding style issues by tiwai ]
15
16 Signed-off-by: Kailang Yang <kailang@realtek.com>
17 Cc: <stable@vger.kernel.org>
18 Signed-off-by: Takashi Iwai <tiwai@suse.de>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 sound/pci/hda/patch_realtek.c | 59 ++++++++++++++++++++++++------------------
23 1 file changed, 35 insertions(+), 24 deletions(-)
24
25 --- a/sound/pci/hda/patch_realtek.c
26 +++ b/sound/pci/hda/patch_realtek.c
27 @@ -477,12 +477,45 @@ static void alc_auto_setup_eapd(struct h
28 set_eapd(codec, *p, on);
29 }
30
31 +static int find_ext_mic_pin(struct hda_codec *codec);
32 +
33 +static void alc_headset_mic_no_shutup(struct hda_codec *codec)
34 +{
35 + const struct hda_pincfg *pin;
36 + int mic_pin = find_ext_mic_pin(codec);
37 + int i;
38 +
39 + /* don't shut up pins when unloading the driver; otherwise it breaks
40 + * the default pin setup at the next load of the driver
41 + */
42 + if (codec->bus->shutdown)
43 + return;
44 +
45 + snd_array_for_each(&codec->init_pins, i, pin) {
46 + /* use read here for syncing after issuing each verb */
47 + if (pin->nid != mic_pin)
48 + snd_hda_codec_read(codec, pin->nid, 0,
49 + AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
50 + }
51 +
52 + codec->pins_shutup = 1;
53 +}
54 +
55 static void alc_shutup_pins(struct hda_codec *codec)
56 {
57 struct alc_spec *spec = codec->spec;
58
59 - if (!spec->no_shutup_pins)
60 - snd_hda_shutup_pins(codec);
61 + switch (codec->core.vendor_id) {
62 + case 0x10ec0286:
63 + case 0x10ec0288:
64 + case 0x10ec0298:
65 + alc_headset_mic_no_shutup(codec);
66 + break;
67 + default:
68 + if (!spec->no_shutup_pins)
69 + snd_hda_shutup_pins(codec);
70 + break;
71 + }
72 }
73
74 /* generic shutup callback;
75 @@ -2923,27 +2956,6 @@ static int alc269_parse_auto_config(stru
76 return alc_parse_auto_config(codec, alc269_ignore, ssids);
77 }
78
79 -static int find_ext_mic_pin(struct hda_codec *codec);
80 -
81 -static void alc286_shutup(struct hda_codec *codec)
82 -{
83 - const struct hda_pincfg *pin;
84 - int i;
85 - int mic_pin = find_ext_mic_pin(codec);
86 - /* don't shut up pins when unloading the driver; otherwise it breaks
87 - * the default pin setup at the next load of the driver
88 - */
89 - if (codec->bus->shutdown)
90 - return;
91 - snd_array_for_each(&codec->init_pins, i, pin) {
92 - /* use read here for syncing after issuing each verb */
93 - if (pin->nid != mic_pin)
94 - snd_hda_codec_read(codec, pin->nid, 0,
95 - AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
96 - }
97 - codec->pins_shutup = 1;
98 -}
99 -
100 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
101 {
102 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
103 @@ -7611,7 +7623,6 @@ static int patch_alc269(struct hda_codec
104 case 0x10ec0286:
105 case 0x10ec0288:
106 spec->codec_variant = ALC269_TYPE_ALC286;
107 - spec->shutup = alc286_shutup;
108 break;
109 case 0x10ec0298:
110 spec->codec_variant = ALC269_TYPE_ALC298;