blob: c18077b39449c98ebf588c245aeed81a81bbf5b8 [file] [log] [blame]
Thomas Gleixnerd0fa1172019-05-20 19:07:57 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
Takashi Iwai1d045db2011-07-07 18:23:21 +02005 * HD audio interface patch for Realtek ALC codecs
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
Kailang Yangdf694da2005-12-05 19:42:22 +01007 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * Takashi Iwai <tiwai@suse.de>
Jonathan Woithe409a3e92012-03-27 13:01:01 +103010 * Jonathan Woithe <jwoithe@just42.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
Takashi Iwai08fb0d02013-01-10 17:33:58 +010017#include <linux/dmi.h>
Paul Gortmakerda155d52011-07-15 12:38:28 -040018#include <linux/module.h>
David Henningsson33f4acd2015-01-07 15:50:13 +010019#include <linux/input.h>
Kai-Heng Feng87dc3642020-04-30 21:52:07 +080020#include <linux/leds.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <sound/core.h>
Kailang Yang9ad0e492010-09-14 23:22:00 +020022#include <sound/jack.h>
Pierre-Louis Bossartbe57bff2018-08-22 15:24:57 -050023#include <sound/hda_codec.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include "hda_local.h"
Takashi Iwai23d30f22012-05-07 17:17:32 +020025#include "hda_auto_parser.h"
Takashi Iwai1835a0f2011-10-27 22:12:46 +020026#include "hda_jack.h"
Takashi Iwai08c189f2012-12-19 15:22:24 +010027#include "hda_generic.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Takashi Iwaicd63a5f2013-07-05 12:13:59 +020029/* keep halting ALC5505 DSP, for power saving */
30#define HALT_REALTEK_ALC5505
31
Takashi Iwai4a79ba32009-04-22 16:31:35 +020032/* extra amp-initialization sequence types */
33enum {
Takashi Iwai1c76aa52018-06-21 16:37:54 +020034 ALC_INIT_UNDEFINED,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020035 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020037};
38
David Henningsson73bdd592013-04-15 15:44:14 +020039enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45};
46
47enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51};
52
Hui Wangc7b60a82015-12-28 11:35:25 +080053enum {
54 ALC_KEY_MICMUTE_INDEX,
55};
56
Kailang Yangda00c242010-03-19 11:23:45 +010057struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
David Henningsson90622912010-10-14 14:50:18 +020067 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010068};
69
Takashi Iwai766538a2020-06-18 13:08:41 +020070struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75};
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010078 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020079
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 /* codec parameterization */
Kailang Yangda00c242010-03-19 11:23:45 +010081 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010082 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
83
Takashi Iwai5579cd62018-06-19 22:22:41 +020084 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
Takashi Iwai215c8502018-06-19 22:34:26 +020088 bool gpio_write_delay; /* add a delay before writing gpio_data */
Takashi Iwai5579cd62018-06-19 22:22:41 +020089
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +020090 /* mute LED for HP laptops, see vref_mute_led_set() */
Takashi Iwai08fb0d02013-01-10 17:33:58 +010091 int mute_led_polarity;
Kai-Heng Fengdbd13172020-04-30 16:32:51 +080092 int micmute_led_polarity;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010093 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +080094 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010095
Takashi Iwai0f32fd192014-11-19 12:16:14 +010096 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
Takashi Iwai766538a2020-06-18 13:08:41 +020098 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100100
David Henningsson73bdd592013-04-15 15:44:14 +0200101 hda_nid_t headset_mic_pin;
102 hda_nid_t headphone_mic_pin;
103 int current_headset_mode;
104 int current_headset_type;
105
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100106 /* hooks */
107 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200108#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500109 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100110#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200111 void (*shutup)(struct hda_codec *codec);
Takashi Iwai70a09762015-12-15 14:59:58 +0100112 void (*reboot_notify)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200113
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200114 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200115 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
Kailang Yang693abe12019-01-29 15:38:21 +0800118 unsigned int done_hp_init:1;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100119 unsigned int no_shutup_pins:1;
Kailang Yangd3ba58b2019-05-06 15:09:42 +0800120 unsigned int ultra_low_power:1;
Hui Wang476c02e2020-03-29 16:20:18 +0800121 unsigned int has_hs_key:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100122
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200123 /* for PLL fix */
124 hda_nid_t pll_nid;
125 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200126 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100127 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800128 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100129};
130
Takashi Iwai23f0c042009-02-26 13:03:58 +0100131/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200132 * COEF access helper functions
133 */
134
135static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
136 unsigned int coef_idx)
137{
138 unsigned int val;
139
140 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
141 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
142 return val;
143}
144
145#define alc_read_coef_idx(codec, coef_idx) \
146 alc_read_coefex_idx(codec, 0x20, coef_idx)
147
148static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
149 unsigned int coef_idx, unsigned int coef_val)
150{
151 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
153}
154
155#define alc_write_coef_idx(codec, coef_idx, coef_val) \
156 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
157
Takashi Iwai98b24882014-08-18 13:47:50 +0200158static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
159 unsigned int coef_idx, unsigned int mask,
160 unsigned int bits_set)
161{
162 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
163
164 if (val != -1)
165 alc_write_coefex_idx(codec, nid, coef_idx,
166 (val & ~mask) | bits_set);
167}
168
169#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
170 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
171
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200172/* a special bypass for COEF 0; read the cached value at the second time */
173static unsigned int alc_get_coef0(struct hda_codec *codec)
174{
175 struct alc_spec *spec = codec->spec;
176
177 if (!spec->coef0)
178 spec->coef0 = alc_read_coef_idx(codec, 0);
179 return spec->coef0;
180}
181
Takashi Iwai54db6c32014-08-18 15:11:19 +0200182/* coef writes/updates batch */
183struct coef_fw {
184 unsigned char nid;
185 unsigned char idx;
186 unsigned short mask;
187 unsigned short val;
188};
189
190#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
191 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
192#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
193#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
194#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
195
196static void alc_process_coef_fw(struct hda_codec *codec,
197 const struct coef_fw *fw)
198{
199 for (; fw->nid; fw++) {
200 if (fw->mask == (unsigned short)-1)
201 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
202 else
203 alc_update_coefex_idx(codec, fw->nid, fw->idx,
204 fw->mask, fw->val);
205 }
206}
207
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200208/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200209 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100210 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200211
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200212/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200213static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
214{
215 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200216
Takashi Iwai5579cd62018-06-19 22:22:41 +0200217 spec->gpio_mask |= mask;
218 spec->gpio_dir |= mask;
219 spec->gpio_data |= mask;
220}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200221
Takashi Iwai5579cd62018-06-19 22:22:41 +0200222static void alc_write_gpio_data(struct hda_codec *codec)
223{
224 struct alc_spec *spec = codec->spec;
225
226 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
227 spec->gpio_data);
228}
229
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200230static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
231 bool on)
232{
233 struct alc_spec *spec = codec->spec;
234 unsigned int oldval = spec->gpio_data;
235
236 if (on)
237 spec->gpio_data |= mask;
238 else
239 spec->gpio_data &= ~mask;
240 if (oldval != spec->gpio_data)
241 alc_write_gpio_data(codec);
242}
243
Takashi Iwai5579cd62018-06-19 22:22:41 +0200244static void alc_write_gpio(struct hda_codec *codec)
245{
246 struct alc_spec *spec = codec->spec;
247
248 if (!spec->gpio_mask)
249 return;
250
251 snd_hda_codec_write(codec, codec->core.afg, 0,
252 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
253 snd_hda_codec_write(codec, codec->core.afg, 0,
254 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200255 if (spec->gpio_write_delay)
256 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200257 alc_write_gpio_data(codec);
258}
259
260static void alc_fixup_gpio(struct hda_codec *codec, int action,
261 unsigned int mask)
262{
263 if (action == HDA_FIXUP_ACT_PRE_PROBE)
264 alc_setup_gpio(codec, mask);
265}
266
267static void alc_fixup_gpio1(struct hda_codec *codec,
268 const struct hda_fixup *fix, int action)
269{
270 alc_fixup_gpio(codec, action, 0x01);
271}
272
273static void alc_fixup_gpio2(struct hda_codec *codec,
274 const struct hda_fixup *fix, int action)
275{
276 alc_fixup_gpio(codec, action, 0x02);
277}
278
279static void alc_fixup_gpio3(struct hda_codec *codec,
280 const struct hda_fixup *fix, int action)
281{
282 alc_fixup_gpio(codec, action, 0x03);
283}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200284
Takashi Iwaiae065f12018-06-19 23:00:03 +0200285static void alc_fixup_gpio4(struct hda_codec *codec,
286 const struct hda_fixup *fix, int action)
287{
288 alc_fixup_gpio(codec, action, 0x04);
289}
290
Takashi Iwai8a503552020-06-18 13:08:32 +0200291static void alc_fixup_micmute_led(struct hda_codec *codec,
292 const struct hda_fixup *fix, int action)
293{
294 if (action == HDA_FIXUP_ACT_PROBE)
295 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
296}
297
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200298/*
299 * Fix hardware PLL issue
300 * On some codecs, the analog PLL gating control must be off while
301 * the default value is 1.
302 */
303static void alc_fix_pll(struct hda_codec *codec)
304{
305 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200306
Takashi Iwai98b24882014-08-18 13:47:50 +0200307 if (spec->pll_nid)
308 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
309 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200310}
311
312static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
313 unsigned int coef_idx, unsigned int coef_bit)
314{
315 struct alc_spec *spec = codec->spec;
316 spec->pll_nid = nid;
317 spec->pll_coef_idx = coef_idx;
318 spec->pll_coef_bit = coef_bit;
319 alc_fix_pll(codec);
320}
321
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100322/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200323static void alc_update_knob_master(struct hda_codec *codec,
324 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100325{
326 unsigned int val;
327 struct snd_kcontrol *kctl;
328 struct snd_ctl_elem_value *uctl;
329
330 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
331 if (!kctl)
332 return;
333 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
334 if (!uctl)
335 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100336 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100337 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
338 val &= HDA_AMP_VOLMASK;
339 uctl->value.integer.value[0] = val;
340 uctl->value.integer.value[1] = val;
341 kctl->put(kctl, uctl);
342 kfree(uctl);
343}
344
David Henningsson29adc4b2012-09-25 11:31:00 +0200345static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100346{
David Henningsson29adc4b2012-09-25 11:31:00 +0200347 /* For some reason, the res given from ALC880 is broken.
348 Here we adjust it properly. */
349 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100350}
351
Kailang Yang394c97f2014-11-12 17:38:08 +0800352/* Change EAPD to verb control */
353static void alc_fill_eapd_coef(struct hda_codec *codec)
354{
355 int coef;
356
357 coef = alc_get_coef0(codec);
358
Takashi Iwai7639a062015-03-03 10:07:24 +0100359 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800360 case 0x10ec0262:
361 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
362 break;
363 case 0x10ec0267:
364 case 0x10ec0268:
365 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
366 break;
367 case 0x10ec0269:
368 if ((coef & 0x00f0) == 0x0010)
369 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
370 if ((coef & 0x00f0) == 0x0020)
371 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
372 if ((coef & 0x00f0) == 0x0030)
373 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
374 break;
375 case 0x10ec0280:
376 case 0x10ec0284:
377 case 0x10ec0290:
378 case 0x10ec0292:
379 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
380 break;
Kailang Yang42314302016-02-03 15:03:50 +0800381 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100382 case 0x10ec0295:
383 case 0x10ec0299:
384 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -0500385 fallthrough;
Takashi Iwai44be77c2017-12-27 08:53:59 +0100386 case 0x10ec0215:
Kailang Yang394c97f2014-11-12 17:38:08 +0800387 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800388 case 0x10ec0235:
Thomas Hebbc4473742020-03-30 12:09:38 -0400389 case 0x10ec0236:
Kailang Yang7fbdcd82020-04-23 14:18:31 +0800390 case 0x10ec0245:
Kailang Yang394c97f2014-11-12 17:38:08 +0800391 case 0x10ec0255:
Thomas Hebbc4473742020-03-30 12:09:38 -0400392 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800393 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800394 case 0x10ec0282:
395 case 0x10ec0283:
396 case 0x10ec0286:
Kailang Yang630e3612020-05-27 14:10:26 +0800397 case 0x10ec0287:
Kailang Yang394c97f2014-11-12 17:38:08 +0800398 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800399 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800400 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800401 case 0x10ec0289:
Kailang Yang1078bef2018-11-08 16:36:15 +0800402 case 0x10ec0300:
Kailang Yang394c97f2014-11-12 17:38:08 +0800403 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
404 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800405 case 0x10ec0275:
406 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
407 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800408 case 0x10ec0293:
409 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
410 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800411 case 0x10ec0234:
412 case 0x10ec0274:
413 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800414 case 0x10ec0700:
415 case 0x10ec0701:
416 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +0800417 case 0x10ec0711:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800418 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
419 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800420 case 0x10ec0662:
421 if ((coef & 0x00f0) == 0x0030)
422 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
423 break;
424 case 0x10ec0272:
425 case 0x10ec0273:
426 case 0x10ec0663:
427 case 0x10ec0665:
428 case 0x10ec0670:
429 case 0x10ec0671:
430 case 0x10ec0672:
431 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
432 break;
Kailang Yang9194a1e2020-01-07 17:22:19 +0800433 case 0x10ec0222:
Kailang Yangf0778872019-10-24 15:13:32 +0800434 case 0x10ec0623:
435 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
436 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800437 case 0x10ec0668:
438 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
439 break;
440 case 0x10ec0867:
441 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
442 break;
443 case 0x10ec0888:
444 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
445 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
446 break;
447 case 0x10ec0892:
448 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
449 break;
450 case 0x10ec0899:
451 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +0800452 case 0x10ec0b00:
Kailang Yang65553b12017-07-11 15:15:47 +0800453 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800454 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800455 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
456 break;
457 }
458}
459
Kailang Yangf9423e72008-05-27 12:32:25 +0200460/* additional initialization for ALC888 variants */
461static void alc888_coef_init(struct hda_codec *codec)
462{
Kailang Yang1df88742014-10-29 16:10:13 +0800463 switch (alc_get_coef0(codec) & 0x00f0) {
464 /* alc888-VA */
465 case 0x00:
466 /* alc888-VB */
467 case 0x10:
468 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
469 break;
470 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200471}
472
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100473/* turn on/off EAPD control (only if available) */
474static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
475{
476 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
477 return;
478 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
479 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
480 on ? 2 : 0);
481}
482
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200483/* turn on/off EAPD controls of the codec */
484static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
485{
486 /* We currently only handle front, HP */
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100487 static const hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800488 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200489 };
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100490 const hda_nid_t *p;
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200491 for (p = pins; *p; p++)
492 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200493}
494
Kailang Yangdad31972019-05-10 16:28:57 +0800495static int find_ext_mic_pin(struct hda_codec *codec);
496
497static void alc_headset_mic_no_shutup(struct hda_codec *codec)
498{
499 const struct hda_pincfg *pin;
500 int mic_pin = find_ext_mic_pin(codec);
501 int i;
502
503 /* don't shut up pins when unloading the driver; otherwise it breaks
504 * the default pin setup at the next load of the driver
505 */
506 if (codec->bus->shutdown)
507 return;
508
509 snd_array_for_each(&codec->init_pins, i, pin) {
510 /* use read here for syncing after issuing each verb */
511 if (pin->nid != mic_pin)
512 snd_hda_codec_read(codec, pin->nid, 0,
513 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
514 }
515
516 codec->pins_shutup = 1;
517}
518
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100519static void alc_shutup_pins(struct hda_codec *codec)
520{
521 struct alc_spec *spec = codec->spec;
522
Kailang Yangdad31972019-05-10 16:28:57 +0800523 switch (codec->core.vendor_id) {
Kailang Yang66c5d712019-12-09 15:56:15 +0800524 case 0x10ec0283:
Kailang Yangdad31972019-05-10 16:28:57 +0800525 case 0x10ec0286:
526 case 0x10ec0288:
527 case 0x10ec0298:
528 alc_headset_mic_no_shutup(codec);
529 break;
530 default:
531 if (!spec->no_shutup_pins)
532 snd_hda_shutup_pins(codec);
533 break;
534 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100535}
536
Takashi Iwai1c7161532011-04-07 10:37:16 +0200537/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100538 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200539 */
540static void alc_eapd_shutup(struct hda_codec *codec)
541{
Kailang Yang97a26572013-11-29 00:35:26 -0500542 struct alc_spec *spec = codec->spec;
543
Takashi Iwai1c7161532011-04-07 10:37:16 +0200544 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500545 if (!spec->no_depop_delay)
546 msleep(200);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100547 alc_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200548}
549
Takashi Iwai1d045db2011-07-07 18:23:21 +0200550/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200551static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200552{
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200553 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200554 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200555 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200556 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100557 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200558 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200559 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200560 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200561 case 0x10ec0880:
562 case 0x10ec0882:
563 case 0x10ec0883:
564 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800565 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200566 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200567 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200568 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200569 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200570 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200571 break;
572 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200573}
Kailang Yangea1fb292008-08-26 12:58:38 +0200574
Takashi Iwai35a39f92019-02-01 11:19:50 +0100575/* get a primary headphone pin if available */
576static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
577{
578 if (spec->gen.autocfg.hp_pins[0])
579 return spec->gen.autocfg.hp_pins[0];
580 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
581 return spec->gen.autocfg.line_out_pins[0];
582 return 0;
583}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200584
585/*
586 * Realtek SSID verification
587 */
588
David Henningsson90622912010-10-14 14:50:18 +0200589/* Could be any non-zero and even value. When used as fixup, tells
590 * the driver to ignore any present sku defines.
591 */
592#define ALC_FIXUP_SKU_IGNORE (2)
593
Takashi Iwai23d30f22012-05-07 17:17:32 +0200594static void alc_fixup_sku_ignore(struct hda_codec *codec,
595 const struct hda_fixup *fix, int action)
596{
597 struct alc_spec *spec = codec->spec;
598 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
599 spec->cdefine.fixup = 1;
600 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
601 }
602}
603
Mengdong Linb5c66112013-11-29 00:35:35 -0500604static void alc_fixup_no_depop_delay(struct hda_codec *codec,
605 const struct hda_fixup *fix, int action)
606{
607 struct alc_spec *spec = codec->spec;
608
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500609 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500610 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500611 codec->depop_delay = 0;
612 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500613}
614
Kailang Yangda00c242010-03-19 11:23:45 +0100615static int alc_auto_parse_customize_define(struct hda_codec *codec)
616{
617 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100618 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100619 struct alc_spec *spec = codec->spec;
620
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200621 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
622
David Henningsson90622912010-10-14 14:50:18 +0200623 if (spec->cdefine.fixup) {
624 ass = spec->cdefine.sku_cfg;
625 if (ass == ALC_FIXUP_SKU_IGNORE)
626 return -1;
627 goto do_sku;
628 }
629
Takashi Iwai5100cd02014-02-15 10:03:19 +0100630 if (!codec->bus->pci)
631 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100632 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200633 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100634 goto do_sku;
635
636 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100637 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100638 nid = 0x17;
639 ass = snd_hda_codec_get_pincfg(codec, nid);
640
641 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100642 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100643 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100644 return -1;
645 }
646
647 /* check sum */
648 tmp = 0;
649 for (i = 1; i < 16; i++) {
650 if ((ass >> i) & 1)
651 tmp++;
652 }
653 if (((ass >> 16) & 0xf) != tmp)
654 return -1;
655
656 spec->cdefine.port_connectivity = ass >> 30;
657 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
658 spec->cdefine.check_sum = (ass >> 16) & 0xf;
659 spec->cdefine.customization = ass >> 8;
660do_sku:
661 spec->cdefine.sku_cfg = ass;
662 spec->cdefine.external_amp = (ass & 0x38) >> 3;
663 spec->cdefine.platform_type = (ass & 0x4) >> 2;
664 spec->cdefine.swap = (ass & 0x2) >> 1;
665 spec->cdefine.override = ass & 0x1;
666
Takashi Iwai4e76a882014-02-25 12:21:03 +0100667 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100668 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100669 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100670 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100671 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
672 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
673 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
674 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
675 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
676 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
677 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100678
679 return 0;
680}
681
Takashi Iwai08c189f2012-12-19 15:22:24 +0100682/* return the position of NID in the list, or -1 if not found */
683static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
684{
685 int i;
686 for (i = 0; i < nums; i++)
687 if (list[i] == nid)
688 return i;
689 return -1;
690}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200691/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200692static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
693{
Takashi Iwai21268962011-07-07 15:01:13 +0200694 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200695}
696
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200697/* check subsystem ID and set up device-specific initialization;
698 * return 1 if initialized, 0 if invalid SSID
699 */
700/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
701 * 31 ~ 16 : Manufacture ID
702 * 15 ~ 8 : SKU ID
703 * 7 ~ 0 : Assembly ID
704 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
705 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100706static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200707{
708 unsigned int ass, tmp, i;
709 unsigned nid;
710 struct alc_spec *spec = codec->spec;
711
David Henningsson90622912010-10-14 14:50:18 +0200712 if (spec->cdefine.fixup) {
713 ass = spec->cdefine.sku_cfg;
714 if (ass == ALC_FIXUP_SKU_IGNORE)
715 return 0;
716 goto do_sku;
717 }
718
Takashi Iwai7639a062015-03-03 10:07:24 +0100719 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100720 if (codec->bus->pci &&
721 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200722 goto do_sku;
723
724 /* invalid SSID, check the special NID pin defcfg instead */
725 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400726 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200727 * 29~21 : reserve
728 * 20 : PCBEEP input
729 * 19~16 : Check sum (15:1)
730 * 15~1 : Custom
731 * 0 : override
732 */
733 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100734 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200735 nid = 0x17;
736 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100737 codec_dbg(codec,
738 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200739 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100740 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200741 return 0;
742 if ((ass >> 30) != 1) /* no physical connection */
743 return 0;
744
745 /* check sum */
746 tmp = 0;
747 for (i = 1; i < 16; i++) {
748 if ((ass >> i) & 1)
749 tmp++;
750 }
751 if (((ass >> 16) & 0xf) != tmp)
752 return 0;
753do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100754 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100755 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200756 /*
757 * 0 : override
758 * 1 : Swap Jack
759 * 2 : 0 --> Desktop, 1 --> Laptop
760 * 3~5 : External Amplifier control
761 * 7~6 : Reserved
762 */
763 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200764 if (spec->init_amp == ALC_INIT_UNDEFINED) {
765 switch (tmp) {
766 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200767 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200768 break;
769 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200770 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200771 break;
772 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200773 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200774 break;
775 case 5:
776 default:
777 spec->init_amp = ALC_INIT_DEFAULT;
778 break;
779 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200780 }
781
782 /* is laptop or Desktop and enable the function "Mute internal speaker
783 * when the external headphone out jack is plugged"
784 */
785 if (!(ass & 0x8000))
786 return 1;
787 /*
788 * 10~8 : Jack location
789 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
790 * 14~13: Resvered
791 * 15 : 1 --> enable the function "Mute internal speaker
792 * when the external headphone out jack is plugged"
793 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100794 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200795 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200796 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100797 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100798 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
799 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200800 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100801 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200802 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200803 return 1;
804}
Kailang Yangea1fb292008-08-26 12:58:38 +0200805
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200806/* Check the validity of ALC subsystem-id
807 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
808static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200809{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100810 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200811 struct alc_spec *spec = codec->spec;
Takashi Iwai67791202020-04-18 21:06:39 +0200812 if (spec->init_amp == ALC_INIT_UNDEFINED) {
813 codec_dbg(codec,
814 "realtek: Enable default setup for auto mode as fallback\n");
815 spec->init_amp = ALC_INIT_DEFAULT;
816 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200817 }
Takashi Iwai21268962011-07-07 15:01:13 +0200818}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200819
Takashi Iwai41e41f12005-06-08 14:48:49 +0200820/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200821 */
822
David Henningsson9d36a7d2014-10-07 10:18:42 +0200823static void alc_fixup_inv_dmic(struct hda_codec *codec,
824 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200825{
826 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100827
David Henningsson9d36a7d2014-10-07 10:18:42 +0200828 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200829}
830
Takashi Iwai603c4012008-07-30 15:01:44 +0200831
Takashi Iwai2eab6942012-12-18 15:30:41 +0100832static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200834 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835
Takashi Iwai08c189f2012-12-19 15:22:24 +0100836 err = snd_hda_gen_build_controls(codec);
837 if (err < 0)
838 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839
Takashi Iwai1727a772013-01-10 09:52:52 +0100840 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100841 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842}
843
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200844
Linus Torvalds1da177e2005-04-16 15:20:36 -0700845/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100846 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200847 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200848
Takashi Iwaic9af7532019-05-10 11:01:43 +0200849static void alc_pre_init(struct hda_codec *codec)
850{
851 alc_fill_eapd_coef(codec);
852}
853
Kailang Yangaeac1a02019-05-16 16:10:44 +0800854#define is_s3_resume(codec) \
855 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
Takashi Iwaic9af7532019-05-10 11:01:43 +0200856#define is_s4_resume(codec) \
857 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
858
Linus Torvalds1da177e2005-04-16 15:20:36 -0700859static int alc_init(struct hda_codec *codec)
860{
861 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200862
Takashi Iwaic9af7532019-05-10 11:01:43 +0200863 /* hibernation resume needs the full chip initialization */
864 if (is_s4_resume(codec))
865 alc_pre_init(codec);
866
Takashi Iwai546bb672012-03-07 08:37:19 +0100867 if (spec->init_hook)
868 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100869
Takashi Iwai89781d02019-08-30 12:03:38 +0200870 spec->gen.skip_verbs = 1; /* applied in below */
Kailang Yang607ca3b2019-04-26 16:35:41 +0800871 snd_hda_gen_init(codec);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200872 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200873 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai89781d02019-08-30 12:03:38 +0200874 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200875
Takashi Iwai1727a772013-01-10 09:52:52 +0100876 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200877
Linus Torvalds1da177e2005-04-16 15:20:36 -0700878 return 0;
879}
880
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100881static inline void alc_shutup(struct hda_codec *codec)
882{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200883 struct alc_spec *spec = codec->spec;
884
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200885 if (!snd_hda_get_bool_hint(codec, "shutup"))
886 return; /* disabled explicitly by hints */
887
Takashi Iwai1c7161532011-04-07 10:37:16 +0200888 if (spec && spec->shutup)
889 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200890 else
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100891 alc_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100892}
893
Takashi Iwai70a09762015-12-15 14:59:58 +0100894static void alc_reboot_notify(struct hda_codec *codec)
895{
896 struct alc_spec *spec = codec->spec;
897
898 if (spec && spec->reboot_notify)
899 spec->reboot_notify(codec);
900 else
901 alc_shutup(codec);
902}
903
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100904#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700905
Takashi Iwai83012a72012-08-24 18:38:08 +0200906#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500907static void alc_power_eapd(struct hda_codec *codec)
908{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200909 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500910}
911
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200912static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100913{
914 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100915 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100916 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500917 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100918 return 0;
919}
920#endif
921
Takashi Iwai2a439522011-07-26 09:52:50 +0200922#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100923static int alc_resume(struct hda_codec *codec)
924{
Kailang Yang97a26572013-11-29 00:35:26 -0500925 struct alc_spec *spec = codec->spec;
926
927 if (!spec->no_depop_delay)
928 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100929 codec->patch_ops.init(codec);
Takashi Iwai1a462be2020-01-09 10:01:04 +0100930 snd_hda_regmap_sync(codec);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200931 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100932 return 0;
933}
Takashi Iwaie044c392008-10-27 16:56:24 +0100934#endif
935
Linus Torvalds1da177e2005-04-16 15:20:36 -0700936/*
937 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200938static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700939 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100940 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700941 .init = alc_init,
942 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200943 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200944#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100945 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100946 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100947 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200948#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100949 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700950};
951
David Henningsson29adc4b2012-09-25 11:31:00 +0200952
Takashi Iwaided255b2015-10-01 17:59:43 +0200953#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100954
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200955/*
Kailang Yang4b016932013-11-28 11:55:09 +0100956 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200957 */
958struct alc_codec_rename_table {
959 unsigned int vendor_id;
960 unsigned short coef_mask;
961 unsigned short coef_bits;
962 const char *name;
963};
964
Kailang Yang4b016932013-11-28 11:55:09 +0100965struct alc_codec_rename_pci_table {
966 unsigned int codec_vendor_id;
967 unsigned short pci_subvendor;
968 unsigned short pci_subdevice;
969 const char *name;
970};
971
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100972static const struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800973 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200974 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
975 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
976 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
977 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
978 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
979 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
980 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200981 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800982 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200983 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
984 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
985 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
986 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
987 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
988 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
989 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
990 { } /* terminator */
991};
992
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100993static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
Kailang Yang4b016932013-11-28 11:55:09 +0100994 { 0x10ec0280, 0x1028, 0, "ALC3220" },
995 { 0x10ec0282, 0x1028, 0, "ALC3221" },
996 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800997 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +0100998 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +0800999 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +01001000 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1001 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001002 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1003 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +08001004 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +08001005 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +08001006 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +08001007 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +08001008 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +08001009 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001010 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1011 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1012 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1013 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1014 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1015 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1016 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1017 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1018 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1019 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1020 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +01001021 { } /* terminator */
1022};
1023
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001024static int alc_codec_rename_from_preset(struct hda_codec *codec)
1025{
1026 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +01001027 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001028
1029 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001030 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001031 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02001032 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001033 return alc_codec_rename(codec, p->name);
1034 }
Kailang Yang4b016932013-11-28 11:55:09 +01001035
Takashi Iwai5100cd02014-02-15 10:03:19 +01001036 if (!codec->bus->pci)
1037 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +01001038 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001039 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +01001040 continue;
1041 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1042 continue;
1043 if (!q->pci_subdevice ||
1044 q->pci_subdevice == codec->bus->pci->subsystem_device)
1045 return alc_codec_rename(codec, q->name);
1046 }
1047
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001048 return 0;
1049}
1050
Takashi Iwaie4770622011-07-08 11:11:35 +02001051
1052/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001053 * Digital-beep handlers
1054 */
1055#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001056
1057/* additional beep mixers; private_value will be overwritten */
1058static const struct snd_kcontrol_new alc_beep_mixer[] = {
1059 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1060 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1061};
1062
1063/* set up and create beep controls */
1064static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1065 int idx, int dir)
1066{
1067 struct snd_kcontrol_new *knew;
1068 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1069 int i;
1070
1071 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1072 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1073 &alc_beep_mixer[i]);
1074 if (!knew)
1075 return -ENOMEM;
1076 knew->private_value = beep_amp;
1077 }
1078 return 0;
1079}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001080
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001081static const struct snd_pci_quirk beep_allow_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001082 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001083 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001084 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001085 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001086 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1087 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1088 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001089 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001090 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001091 /* denylist -- no beep available */
Takashi Iwai051c78a2019-08-22 09:58:07 +02001092 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1093 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001094 {}
1095};
1096
1097static inline int has_cdefine_beep(struct hda_codec *codec)
1098{
1099 struct alc_spec *spec = codec->spec;
1100 const struct snd_pci_quirk *q;
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001101 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001102 if (q)
1103 return q->value;
1104 return spec->cdefine.enable_pcbeep;
1105}
1106#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001107#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001108#define has_cdefine_beep(codec) 0
1109#endif
1110
1111/* parse the BIOS configuration and set up the alc_spec */
1112/* return 1 if successful, 0 if the proper config is not found,
1113 * or a negative error code
1114 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001115static int alc_parse_auto_config(struct hda_codec *codec,
1116 const hda_nid_t *ignore_nids,
1117 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001118{
1119 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001120 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001121 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001122
Takashi Iwai53c334a2011-08-23 18:27:14 +02001123 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1124 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001125 if (err < 0)
1126 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001127
1128 if (ssid_nids)
1129 alc_ssid_check(codec, ssid_nids);
1130
Takashi Iwai08c189f2012-12-19 15:22:24 +01001131 err = snd_hda_gen_parse_auto_config(codec, cfg);
1132 if (err < 0)
1133 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001134
Takashi Iwai1d045db2011-07-07 18:23:21 +02001135 return 1;
1136}
1137
Takashi Iwai3de95172012-05-07 18:03:15 +02001138/* common preparation job for alc_spec */
1139static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1140{
1141 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1142 int err;
1143
1144 if (!spec)
1145 return -ENOMEM;
1146 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001147 snd_hda_gen_spec_init(&spec->gen);
1148 spec->gen.mixer_nid = mixer_nid;
1149 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001150 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001151 /* FIXME: do we need this for all Realtek codec models? */
1152 codec->spdif_status_reset = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001153 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001154
1155 err = alc_codec_rename_from_preset(codec);
1156 if (err < 0) {
1157 kfree(spec);
1158 return err;
1159 }
1160 return 0;
1161}
1162
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001163static int alc880_parse_auto_config(struct hda_codec *codec)
1164{
1165 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001166 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001167 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1168}
1169
Takashi Iwai1d045db2011-07-07 18:23:21 +02001170/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001171 * ALC880 fix-ups
1172 */
1173enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001174 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001175 ALC880_FIXUP_GPIO2,
1176 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001177 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001178 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001179 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001180 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001181 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001182 ALC880_FIXUP_VOL_KNOB,
1183 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001184 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001185 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001186 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001187 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001188 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001189 ALC880_FIXUP_3ST_BASE,
1190 ALC880_FIXUP_3ST,
1191 ALC880_FIXUP_3ST_DIG,
1192 ALC880_FIXUP_5ST_BASE,
1193 ALC880_FIXUP_5ST,
1194 ALC880_FIXUP_5ST_DIG,
1195 ALC880_FIXUP_6ST_BASE,
1196 ALC880_FIXUP_6ST,
1197 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001198 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001199};
1200
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001201/* enable the volume-knob widget support on NID 0x21 */
1202static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001203 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001204{
Takashi Iwai1727a772013-01-10 09:52:52 +01001205 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001206 snd_hda_jack_detect_enable_callback(codec, 0x21,
1207 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001208}
1209
Takashi Iwai1727a772013-01-10 09:52:52 +01001210static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001211 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001212 .type = HDA_FIXUP_FUNC,
1213 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001214 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001215 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001216 .type = HDA_FIXUP_FUNC,
1217 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001218 },
1219 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001220 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001221 .v.verbs = (const struct hda_verb[]) {
1222 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1223 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1224 { }
1225 },
1226 .chained = true,
1227 .chain_id = ALC880_FIXUP_GPIO2,
1228 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001229 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001230 .type = HDA_FIXUP_PINS,
1231 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001232 /* disable bogus unused pins */
1233 { 0x16, 0x411111f0 },
1234 { 0x18, 0x411111f0 },
1235 { 0x1a, 0x411111f0 },
1236 { }
1237 }
1238 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001239 [ALC880_FIXUP_LG_LW25] = {
1240 .type = HDA_FIXUP_PINS,
1241 .v.pins = (const struct hda_pintbl[]) {
1242 { 0x1a, 0x0181344f }, /* line-in */
1243 { 0x1b, 0x0321403f }, /* headphone */
1244 { }
1245 }
1246 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001247 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001248 .type = HDA_FIXUP_PINS,
1249 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001250 /* disable bogus unused pins */
1251 { 0x17, 0x411111f0 },
1252 { }
1253 },
1254 .chained = true,
1255 .chain_id = ALC880_FIXUP_GPIO2,
1256 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001257 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001258 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001259 .v.verbs = (const struct hda_verb[]) {
1260 /* change to EAPD mode */
1261 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1262 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1263 {}
1264 },
1265 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001266 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001267 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001268 .v.verbs = (const struct hda_verb[]) {
1269 /* change to EAPD mode */
1270 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1271 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1272 {}
1273 },
1274 .chained = true,
1275 .chain_id = ALC880_FIXUP_GPIO2,
1276 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001277 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001278 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001279 .v.func = alc880_fixup_vol_knob,
1280 },
1281 [ALC880_FIXUP_FUJITSU] = {
1282 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001283 .type = HDA_FIXUP_PINS,
1284 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001285 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001286 { 0x15, 0x99030120 }, /* speaker */
1287 { 0x16, 0x99030130 }, /* bass speaker */
1288 { 0x17, 0x411111f0 }, /* N/A */
1289 { 0x18, 0x411111f0 }, /* N/A */
1290 { 0x19, 0x01a19950 }, /* mic-in */
1291 { 0x1a, 0x411111f0 }, /* N/A */
1292 { 0x1b, 0x411111f0 }, /* N/A */
1293 { 0x1c, 0x411111f0 }, /* N/A */
1294 { 0x1d, 0x411111f0 }, /* N/A */
1295 { 0x1e, 0x01454140 }, /* SPDIF out */
1296 { }
1297 },
1298 .chained = true,
1299 .chain_id = ALC880_FIXUP_VOL_KNOB,
1300 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001301 [ALC880_FIXUP_F1734] = {
1302 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001303 .type = HDA_FIXUP_PINS,
1304 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001305 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001306 { 0x15, 0x99030120 }, /* speaker */
1307 { 0x16, 0x411111f0 }, /* N/A */
1308 { 0x17, 0x411111f0 }, /* N/A */
1309 { 0x18, 0x411111f0 }, /* N/A */
1310 { 0x19, 0x01a19950 }, /* mic-in */
1311 { 0x1a, 0x411111f0 }, /* N/A */
1312 { 0x1b, 0x411111f0 }, /* N/A */
1313 { 0x1c, 0x411111f0 }, /* N/A */
1314 { 0x1d, 0x411111f0 }, /* N/A */
1315 { 0x1e, 0x411111f0 }, /* N/A */
1316 { }
1317 },
1318 .chained = true,
1319 .chain_id = ALC880_FIXUP_VOL_KNOB,
1320 },
Takashi Iwai817de922012-02-20 17:20:48 +01001321 [ALC880_FIXUP_UNIWILL] = {
1322 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001323 .type = HDA_FIXUP_PINS,
1324 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001325 { 0x14, 0x0121411f }, /* HP */
1326 { 0x15, 0x99030120 }, /* speaker */
1327 { 0x16, 0x99030130 }, /* bass speaker */
1328 { }
1329 },
1330 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001331 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001332 .type = HDA_FIXUP_PINS,
1333 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001334 /* disable bogus unused pins */
1335 { 0x17, 0x411111f0 },
1336 { 0x19, 0x411111f0 },
1337 { 0x1b, 0x411111f0 },
1338 { 0x1f, 0x411111f0 },
1339 { }
1340 }
1341 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001342 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001343 .type = HDA_FIXUP_PINS,
1344 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001345 /* set up the whole pins as BIOS is utterly broken */
1346 { 0x14, 0x99030120 }, /* speaker */
1347 { 0x15, 0x0121411f }, /* HP */
1348 { 0x16, 0x411111f0 }, /* N/A */
1349 { 0x17, 0x411111f0 }, /* N/A */
1350 { 0x18, 0x01a19950 }, /* mic-in */
1351 { 0x19, 0x411111f0 }, /* N/A */
1352 { 0x1a, 0x01813031 }, /* line-in */
1353 { 0x1b, 0x411111f0 }, /* N/A */
1354 { 0x1c, 0x411111f0 }, /* N/A */
1355 { 0x1d, 0x411111f0 }, /* N/A */
1356 { 0x1e, 0x0144111e }, /* SPDIF */
1357 { }
1358 }
1359 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001360 [ALC880_FIXUP_ASUS_W5A] = {
1361 .type = HDA_FIXUP_PINS,
1362 .v.pins = (const struct hda_pintbl[]) {
1363 /* set up the whole pins as BIOS is utterly broken */
1364 { 0x14, 0x0121411f }, /* HP */
1365 { 0x15, 0x411111f0 }, /* N/A */
1366 { 0x16, 0x411111f0 }, /* N/A */
1367 { 0x17, 0x411111f0 }, /* N/A */
1368 { 0x18, 0x90a60160 }, /* mic */
1369 { 0x19, 0x411111f0 }, /* N/A */
1370 { 0x1a, 0x411111f0 }, /* N/A */
1371 { 0x1b, 0x411111f0 }, /* N/A */
1372 { 0x1c, 0x411111f0 }, /* N/A */
1373 { 0x1d, 0x411111f0 }, /* N/A */
1374 { 0x1e, 0xb743111e }, /* SPDIF out */
1375 { }
1376 },
1377 .chained = true,
1378 .chain_id = ALC880_FIXUP_GPIO1,
1379 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001380 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001381 .type = HDA_FIXUP_PINS,
1382 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001383 { 0x14, 0x01014010 }, /* line-out */
1384 { 0x15, 0x411111f0 }, /* N/A */
1385 { 0x16, 0x411111f0 }, /* N/A */
1386 { 0x17, 0x411111f0 }, /* N/A */
1387 { 0x18, 0x01a19c30 }, /* mic-in */
1388 { 0x19, 0x0121411f }, /* HP */
1389 { 0x1a, 0x01813031 }, /* line-in */
1390 { 0x1b, 0x02a19c40 }, /* front-mic */
1391 { 0x1c, 0x411111f0 }, /* N/A */
1392 { 0x1d, 0x411111f0 }, /* N/A */
1393 /* 0x1e is filled in below */
1394 { 0x1f, 0x411111f0 }, /* N/A */
1395 { }
1396 }
1397 },
1398 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001399 .type = HDA_FIXUP_PINS,
1400 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001401 { 0x1e, 0x411111f0 }, /* N/A */
1402 { }
1403 },
1404 .chained = true,
1405 .chain_id = ALC880_FIXUP_3ST_BASE,
1406 },
1407 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001408 .type = HDA_FIXUP_PINS,
1409 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001410 { 0x1e, 0x0144111e }, /* SPDIF */
1411 { }
1412 },
1413 .chained = true,
1414 .chain_id = ALC880_FIXUP_3ST_BASE,
1415 },
1416 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001417 .type = HDA_FIXUP_PINS,
1418 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001419 { 0x14, 0x01014010 }, /* front */
1420 { 0x15, 0x411111f0 }, /* N/A */
1421 { 0x16, 0x01011411 }, /* CLFE */
1422 { 0x17, 0x01016412 }, /* surr */
1423 { 0x18, 0x01a19c30 }, /* mic-in */
1424 { 0x19, 0x0121411f }, /* HP */
1425 { 0x1a, 0x01813031 }, /* line-in */
1426 { 0x1b, 0x02a19c40 }, /* front-mic */
1427 { 0x1c, 0x411111f0 }, /* N/A */
1428 { 0x1d, 0x411111f0 }, /* N/A */
1429 /* 0x1e is filled in below */
1430 { 0x1f, 0x411111f0 }, /* N/A */
1431 { }
1432 }
1433 },
1434 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001435 .type = HDA_FIXUP_PINS,
1436 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001437 { 0x1e, 0x411111f0 }, /* N/A */
1438 { }
1439 },
1440 .chained = true,
1441 .chain_id = ALC880_FIXUP_5ST_BASE,
1442 },
1443 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001444 .type = HDA_FIXUP_PINS,
1445 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001446 { 0x1e, 0x0144111e }, /* SPDIF */
1447 { }
1448 },
1449 .chained = true,
1450 .chain_id = ALC880_FIXUP_5ST_BASE,
1451 },
1452 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001453 .type = HDA_FIXUP_PINS,
1454 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001455 { 0x14, 0x01014010 }, /* front */
1456 { 0x15, 0x01016412 }, /* surr */
1457 { 0x16, 0x01011411 }, /* CLFE */
1458 { 0x17, 0x01012414 }, /* side */
1459 { 0x18, 0x01a19c30 }, /* mic-in */
1460 { 0x19, 0x02a19c40 }, /* front-mic */
1461 { 0x1a, 0x01813031 }, /* line-in */
1462 { 0x1b, 0x0121411f }, /* HP */
1463 { 0x1c, 0x411111f0 }, /* N/A */
1464 { 0x1d, 0x411111f0 }, /* N/A */
1465 /* 0x1e is filled in below */
1466 { 0x1f, 0x411111f0 }, /* N/A */
1467 { }
1468 }
1469 },
1470 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001471 .type = HDA_FIXUP_PINS,
1472 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001473 { 0x1e, 0x411111f0 }, /* N/A */
1474 { }
1475 },
1476 .chained = true,
1477 .chain_id = ALC880_FIXUP_6ST_BASE,
1478 },
1479 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001480 .type = HDA_FIXUP_PINS,
1481 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001482 { 0x1e, 0x0144111e }, /* SPDIF */
1483 { }
1484 },
1485 .chained = true,
1486 .chain_id = ALC880_FIXUP_6ST_BASE,
1487 },
Takashi Iwai53971452013-01-23 18:21:37 +01001488 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1489 .type = HDA_FIXUP_PINS,
1490 .v.pins = (const struct hda_pintbl[]) {
1491 { 0x1b, 0x0121401f }, /* HP with jack detect */
1492 { }
1493 },
1494 .chained_before = true,
1495 .chain_id = ALC880_FIXUP_6ST_BASE,
1496 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001497};
1498
1499static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001500 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001501 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001502 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001503 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001504 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001505 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001506 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001507 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001508 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001509 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001510 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001511 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001512 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001513 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001514 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001515 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001516 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001517 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001518 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1519 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1520 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001521 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001522 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001523
1524 /* Below is the copied entries from alc880_quirks.c.
1525 * It's not quite sure whether BIOS sets the correct pin-config table
1526 * on these machines, thus they are kept to be compatible with
1527 * the old static quirks. Once when it's confirmed to work without
1528 * these overrides, it'd be better to remove.
1529 */
1530 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1531 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1532 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1533 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1534 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1535 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1536 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1537 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1538 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1539 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1540 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1541 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1542 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1543 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1544 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1545 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1546 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1547 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1548 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1549 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1550 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1551 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1552 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1553 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1554 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1555 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1556 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1557 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1558 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1560 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1561 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1563 /* default Intel */
1564 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1565 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1566 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1567 {}
1568};
1569
Takashi Iwai1727a772013-01-10 09:52:52 +01001570static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001571 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1572 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1573 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1574 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1575 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1576 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001577 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001578 {}
1579};
1580
1581
1582/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001583 * OK, here we have finally the patch for ALC880
1584 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001585static int patch_alc880(struct hda_codec *codec)
1586{
1587 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001588 int err;
1589
Takashi Iwai3de95172012-05-07 18:03:15 +02001590 err = alc_alloc_spec(codec, 0x0b);
1591 if (err < 0)
1592 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001593
Takashi Iwai3de95172012-05-07 18:03:15 +02001594 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001595 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001596 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001597
Takashi Iwai225068a2015-05-29 10:42:14 +02001598 codec->patch_ops.unsol_event = alc880_unsol_event;
1599
Takashi Iwaic9af7532019-05-10 11:01:43 +02001600 alc_pre_init(codec);
1601
Takashi Iwai1727a772013-01-10 09:52:52 +01001602 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001603 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001604 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001605
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001606 /* automatic parse from the BIOS config */
1607 err = alc880_parse_auto_config(codec);
1608 if (err < 0)
1609 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001610
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001611 if (!spec->gen.no_analog) {
1612 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1613 if (err < 0)
1614 goto error;
1615 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001616
Takashi Iwai1727a772013-01-10 09:52:52 +01001617 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001618
Takashi Iwai1d045db2011-07-07 18:23:21 +02001619 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001620
1621 error:
1622 alc_free(codec);
1623 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001624}
1625
1626
1627/*
1628 * ALC260 support
1629 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001630static int alc260_parse_auto_config(struct hda_codec *codec)
1631{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001632 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001633 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1634 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001635}
1636
Takashi Iwai1d045db2011-07-07 18:23:21 +02001637/*
1638 * Pin config fixes
1639 */
1640enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001641 ALC260_FIXUP_HP_DC5750,
1642 ALC260_FIXUP_HP_PIN_0F,
1643 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001644 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001645 ALC260_FIXUP_GPIO1_TOGGLE,
1646 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001647 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001648 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001649 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001650 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001651 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001652};
1653
Takashi Iwai20f7d922012-02-16 12:35:16 +01001654static void alc260_gpio1_automute(struct hda_codec *codec)
1655{
1656 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001657
1658 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001659}
1660
1661static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001662 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001663{
1664 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001665 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001666 /* although the machine has only one output pin, we need to
1667 * toggle GPIO1 according to the jack state
1668 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001669 spec->gen.automute_hook = alc260_gpio1_automute;
1670 spec->gen.detect_hp = 1;
1671 spec->gen.automute_speaker = 1;
1672 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001673 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001674 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001675 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001676 }
1677}
1678
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001679static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001680 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001681{
1682 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001683 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001684 { 0x0f, 0x02214000 }, /* HP/speaker */
1685 { 0x12, 0x90a60160 }, /* int mic */
1686 { 0x13, 0x02a19000 }, /* ext mic */
1687 { 0x18, 0x01446000 }, /* SPDIF out */
1688 /* disable bogus I/O pins */
1689 { 0x10, 0x411111f0 },
1690 { 0x11, 0x411111f0 },
1691 { 0x14, 0x411111f0 },
1692 { 0x15, 0x411111f0 },
1693 { 0x16, 0x411111f0 },
1694 { 0x17, 0x411111f0 },
1695 { 0x19, 0x411111f0 },
1696 { }
1697 };
1698
1699 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001700 case HDA_FIXUP_ACT_PRE_PROBE:
1701 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001702 spec->init_amp = ALC_INIT_NONE;
1703 break;
1704 }
1705}
1706
Takashi Iwai39aedee2013-01-10 17:10:40 +01001707static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1708 const struct hda_fixup *fix, int action)
1709{
1710 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001711 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001712 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001713}
1714
1715static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1716 const struct hda_fixup *fix, int action)
1717{
1718 struct alc_spec *spec = codec->spec;
1719 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001720 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001721 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001722 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001723}
1724
Takashi Iwai1727a772013-01-10 09:52:52 +01001725static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001726 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001727 .type = HDA_FIXUP_PINS,
1728 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001729 { 0x11, 0x90130110 }, /* speaker */
1730 { }
1731 }
1732 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001733 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001734 .type = HDA_FIXUP_PINS,
1735 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001736 { 0x0f, 0x01214000 }, /* HP */
1737 { }
1738 }
1739 },
1740 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001741 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001742 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001743 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1744 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001745 { }
1746 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001747 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001748 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001749 .type = HDA_FIXUP_FUNC,
1750 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001751 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001752 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001753 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001754 .v.func = alc260_fixup_gpio1_toggle,
1755 .chained = true,
1756 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1757 },
1758 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001759 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001760 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001761 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1762 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001763 { }
1764 },
1765 .chained = true,
1766 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1767 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001768 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001769 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001770 .v.func = alc260_fixup_gpio1_toggle,
1771 .chained = true,
1772 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001773 },
1774 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001775 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001776 .v.func = alc260_fixup_kn1,
1777 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001778 [ALC260_FIXUP_FSC_S7020] = {
1779 .type = HDA_FIXUP_FUNC,
1780 .v.func = alc260_fixup_fsc_s7020,
1781 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001782 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1783 .type = HDA_FIXUP_FUNC,
1784 .v.func = alc260_fixup_fsc_s7020_jwse,
1785 .chained = true,
1786 .chain_id = ALC260_FIXUP_FSC_S7020,
1787 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001788 [ALC260_FIXUP_VAIO_PINS] = {
1789 .type = HDA_FIXUP_PINS,
1790 .v.pins = (const struct hda_pintbl[]) {
1791 /* Pin configs are missing completely on some VAIOs */
1792 { 0x0f, 0x01211020 },
1793 { 0x10, 0x0001003f },
1794 { 0x11, 0x411111f0 },
1795 { 0x12, 0x01a15930 },
1796 { 0x13, 0x411111f0 },
1797 { 0x14, 0x411111f0 },
1798 { 0x15, 0x411111f0 },
1799 { 0x16, 0x411111f0 },
1800 { 0x17, 0x411111f0 },
1801 { 0x18, 0x411111f0 },
1802 { 0x19, 0x411111f0 },
1803 { }
1804 }
1805 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001806};
1807
1808static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001809 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001810 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001811 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001812 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001813 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001814 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001815 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001816 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001817 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001818 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001819 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001820 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001821 {}
1822};
1823
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001824static const struct hda_model_fixup alc260_fixup_models[] = {
1825 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1826 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1827 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1828 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1829 {}
1830};
1831
Takashi Iwai1d045db2011-07-07 18:23:21 +02001832/*
1833 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001834static int patch_alc260(struct hda_codec *codec)
1835{
1836 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001837 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001838
Takashi Iwai3de95172012-05-07 18:03:15 +02001839 err = alc_alloc_spec(codec, 0x07);
1840 if (err < 0)
1841 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001842
Takashi Iwai3de95172012-05-07 18:03:15 +02001843 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001844 /* as quite a few machines require HP amp for speaker outputs,
1845 * it's easier to enable it unconditionally; even if it's unneeded,
1846 * it's almost harmless.
1847 */
1848 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001849 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001850
Takashi Iwai225068a2015-05-29 10:42:14 +02001851 spec->shutup = alc_eapd_shutup;
1852
Takashi Iwaic9af7532019-05-10 11:01:43 +02001853 alc_pre_init(codec);
1854
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001855 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1856 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001857 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001858
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001859 /* automatic parse from the BIOS config */
1860 err = alc260_parse_auto_config(codec);
1861 if (err < 0)
1862 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001863
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001864 if (!spec->gen.no_analog) {
1865 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1866 if (err < 0)
1867 goto error;
1868 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001869
Takashi Iwai1727a772013-01-10 09:52:52 +01001870 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001871
Takashi Iwai1d045db2011-07-07 18:23:21 +02001872 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001873
1874 error:
1875 alc_free(codec);
1876 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001877}
1878
1879
1880/*
1881 * ALC882/883/885/888/889 support
1882 *
1883 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1884 * configuration. Each pin widget can choose any input DACs and a mixer.
1885 * Each ADC is connected from a mixer of all inputs. This makes possible
1886 * 6-channel independent captures.
1887 *
1888 * In addition, an independent DAC for the multi-playback (not used in this
1889 * driver yet).
1890 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001891
1892/*
1893 * Pin config fixes
1894 */
1895enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001896 ALC882_FIXUP_ABIT_AW9D_MAX,
1897 ALC882_FIXUP_LENOVO_Y530,
1898 ALC882_FIXUP_PB_M5210,
1899 ALC882_FIXUP_ACER_ASPIRE_7736,
1900 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001901 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001902 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001903 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001904 ALC888_FIXUP_EEE1601,
Takashi Iwai177943a32011-11-09 12:55:18 +01001905 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001906 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001907 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001908 ALC882_FIXUP_GPIO1,
1909 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001910 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001911 ALC889_FIXUP_COEF,
1912 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001913 ALC882_FIXUP_ACER_ASPIRE_4930G,
1914 ALC882_FIXUP_ACER_ASPIRE_8930G,
1915 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001916 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001917 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001918 ALC889_FIXUP_MBP_VREF,
1919 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001920 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001921 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001922 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001923 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001924 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001925 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001926 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001927 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001928 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001929 ALC1220_FIXUP_CLEVO_P950,
Richard Sailer80690a22019-04-02 15:52:04 +02001930 ALC1220_FIXUP_CLEVO_PB51ED,
1931 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Jian-Hong Panca184352020-10-07 13:22:25 +08001932 ALC887_FIXUP_ASUS_AUDIO,
1933 ALC887_FIXUP_ASUS_HMIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001934};
1935
Takashi Iwai68ef0562011-11-09 18:24:44 +01001936static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001937 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001938{
Takashi Iwai1727a772013-01-10 09:52:52 +01001939 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001940 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001941 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001942}
1943
Takashi Iwai56710872011-11-14 17:42:11 +01001944/* set up GPIO at initialization */
1945static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001946 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001947{
Takashi Iwai215c8502018-06-19 22:34:26 +02001948 struct alc_spec *spec = codec->spec;
1949
1950 spec->gpio_write_delay = true;
1951 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001952}
1953
Takashi Iwai02a237b2012-02-13 15:25:07 +01001954/* Fix the connection of some pins for ALC889:
1955 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1956 * work correctly (bko#42740)
1957 */
1958static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001959 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001960{
Takashi Iwai1727a772013-01-10 09:52:52 +01001961 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001962 /* fake the connections during parsing the tree */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001963 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1964 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1965 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1966 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1967 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1968 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001969 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001970 /* restore the connections */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001971 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1972 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1973 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1974 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1975 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001976 }
1977}
1978
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001979/* Set VREF on HP pin */
1980static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001981 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001982{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001983 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001984 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001985 int i;
1986
Takashi Iwai1727a772013-01-10 09:52:52 +01001987 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001988 return;
1989 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1990 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1991 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1992 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001993 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001994 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001995 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001996 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001997 break;
1998 }
1999}
2000
Takashi Iwai0756f092013-12-04 13:59:45 +01002001static void alc889_fixup_mac_pins(struct hda_codec *codec,
2002 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002003{
2004 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002005 int i;
2006
Takashi Iwai0756f092013-12-04 13:59:45 +01002007 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002008 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002009 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002010 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002011 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002012 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01002013 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002014}
2015
Takashi Iwai0756f092013-12-04 13:59:45 +01002016/* Set VREF on speaker pins on imac91 */
2017static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2018 const struct hda_fixup *fix, int action)
2019{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002020 static const hda_nid_t nids[] = { 0x18, 0x1a };
Takashi Iwai0756f092013-12-04 13:59:45 +01002021
2022 if (action == HDA_FIXUP_ACT_INIT)
2023 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2024}
2025
Adrien Vergée7729a42014-01-24 14:56:14 -05002026/* Set VREF on speaker pins on mba11 */
2027static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2028 const struct hda_fixup *fix, int action)
2029{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002030 static const hda_nid_t nids[] = { 0x18 };
Adrien Vergée7729a42014-01-24 14:56:14 -05002031
2032 if (action == HDA_FIXUP_ACT_INIT)
2033 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2034}
2035
Takashi Iwai0756f092013-12-04 13:59:45 +01002036/* Set VREF on speaker pins on mba21 */
2037static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2038 const struct hda_fixup *fix, int action)
2039{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002040 static const hda_nid_t nids[] = { 0x18, 0x19 };
Takashi Iwai0756f092013-12-04 13:59:45 +01002041
2042 if (action == HDA_FIXUP_ACT_INIT)
2043 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2044}
2045
Takashi Iwaie427c232012-07-29 10:04:08 +02002046/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09002047 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2048 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02002049 */
2050static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002051 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02002052{
2053 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002054 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002055 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002056 spec->gen.no_multi_io = 1;
2057 }
Takashi Iwaie427c232012-07-29 10:04:08 +02002058}
2059
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002060static void alc_fixup_bass_chmap(struct hda_codec *codec,
2061 const struct hda_fixup *fix, int action);
2062
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002063/* For dual-codec configuration, we need to disable some features to avoid
2064 * conflicts of kctls and PCM streams
2065 */
2066static void alc_fixup_dual_codecs(struct hda_codec *codec,
2067 const struct hda_fixup *fix, int action)
2068{
2069 struct alc_spec *spec = codec->spec;
2070
2071 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2072 return;
2073 /* disable vmaster */
2074 spec->gen.suppress_vmaster = 1;
2075 /* auto-mute and auto-mic switch don't work with multiple codecs */
2076 spec->gen.suppress_auto_mute = 1;
2077 spec->gen.suppress_auto_mic = 1;
2078 /* disable aamix as well */
2079 spec->gen.mixer_nid = 0;
2080 /* add location prefix to avoid conflicts */
2081 codec->force_pin_prefix = 1;
2082}
2083
2084static void rename_ctl(struct hda_codec *codec, const char *oldname,
2085 const char *newname)
2086{
2087 struct snd_kcontrol *kctl;
2088
2089 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2090 if (kctl)
2091 strcpy(kctl->id.name, newname);
2092}
2093
2094static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2095 const struct hda_fixup *fix,
2096 int action)
2097{
2098 alc_fixup_dual_codecs(codec, fix, action);
2099 switch (action) {
2100 case HDA_FIXUP_ACT_PRE_PROBE:
2101 /* override card longname to provide a unique UCM profile */
2102 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2103 break;
2104 case HDA_FIXUP_ACT_BUILD:
2105 /* rename Capture controls depending on the codec */
2106 rename_ctl(codec, "Capture Volume",
2107 codec->addr == 0 ?
2108 "Rear-Panel Capture Volume" :
2109 "Front-Panel Capture Volume");
2110 rename_ctl(codec, "Capture Switch",
2111 codec->addr == 0 ?
2112 "Rear-Panel Capture Switch" :
2113 "Front-Panel Capture Switch");
2114 break;
2115 }
2116}
2117
Peisen0202f5c2017-10-26 10:35:36 +08002118static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2119 const struct hda_fixup *fix,
2120 int action)
2121{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002122 static const hda_nid_t conn1[] = { 0x0c };
Peisen0202f5c2017-10-26 10:35:36 +08002123
2124 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2125 return;
2126
2127 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2128 /* We therefore want to make sure 0x14 (front headphone) and
2129 * 0x1b (speakers) use the stereo DAC 0x02
2130 */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002131 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2132 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Peisen0202f5c2017-10-26 10:35:36 +08002133}
2134
Jeremy Soller7f665b12019-02-13 10:56:19 -07002135static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2136 const struct hda_fixup *fix, int action);
2137
Richard Sailer80690a22019-04-02 15:52:04 +02002138static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002139 const struct hda_fixup *fix,
2140 int action)
2141{
2142 alc1220_fixup_clevo_p950(codec, fix, action);
2143 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2144}
2145
Jian-Hong Panca184352020-10-07 13:22:25 +08002146static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2147 struct hda_jack_callback *jack)
2148{
2149 struct alc_spec *spec = codec->spec;
2150 unsigned int vref;
2151
2152 snd_hda_gen_hp_automute(codec, jack);
2153
2154 if (spec->gen.hp_jack_present)
2155 vref = AC_PINCTL_VREF_80;
2156 else
2157 vref = AC_PINCTL_VREF_HIZ;
2158 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2159}
2160
2161static void alc887_fixup_asus_jack(struct hda_codec *codec,
2162 const struct hda_fixup *fix, int action)
2163{
2164 struct alc_spec *spec = codec->spec;
2165 if (action != HDA_FIXUP_ACT_PROBE)
2166 return;
2167 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2168 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2169}
2170
Takashi Iwai1727a772013-01-10 09:52:52 +01002171static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002172 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002173 .type = HDA_FIXUP_PINS,
2174 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002175 { 0x15, 0x01080104 }, /* side */
2176 { 0x16, 0x01011012 }, /* rear */
2177 { 0x17, 0x01016011 }, /* clfe */
2178 { }
2179 }
2180 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002181 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002182 .type = HDA_FIXUP_PINS,
2183 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002184 { 0x15, 0x99130112 }, /* rear int speakers */
2185 { 0x16, 0x99130111 }, /* subwoofer */
2186 { }
2187 }
2188 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002189 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002190 .type = HDA_FIXUP_PINCTLS,
2191 .v.pins = (const struct hda_pintbl[]) {
2192 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002193 {}
2194 }
2195 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002196 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002197 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002198 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002199 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002200 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002201 .type = HDA_FIXUP_PINS,
2202 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002203 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2204 { }
2205 }
2206 },
Marton Balint8f239212012-03-05 21:33:23 +01002207 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002208 .type = HDA_FIXUP_PINS,
2209 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002210 { 0x1c, 0x993301f0 }, /* CD */
2211 { }
2212 }
2213 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002214 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2215 .type = HDA_FIXUP_PINS,
2216 .v.pins = (const struct hda_pintbl[]) {
2217 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2218 { }
2219 },
2220 .chained = true,
2221 .chain_id = ALC889_FIXUP_CD,
2222 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002223 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002224 .type = HDA_FIXUP_PINS,
2225 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002226 { 0x17, 0x90170111 }, /* hidden surround speaker */
2227 { }
2228 }
2229 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002230 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002231 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002232 .v.verbs = (const struct hda_verb[]) {
2233 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2234 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2235 { }
2236 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002237 },
2238 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002239 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002240 .v.verbs = (const struct hda_verb[]) {
2241 /* change to EAPD mode */
2242 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2243 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2244 { }
2245 }
2246 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002247 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002248 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002249 .v.verbs = (const struct hda_verb[]) {
2250 /* change to EAPD mode */
2251 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2252 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2253 { }
2254 }
2255 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002256 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002257 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002258 .v.verbs = (const struct hda_verb[]) {
2259 /* eanable EAPD on Acer laptops */
2260 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2261 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2262 { }
2263 }
2264 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002265 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002266 .type = HDA_FIXUP_FUNC,
2267 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002268 },
2269 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002270 .type = HDA_FIXUP_FUNC,
2271 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002272 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002273 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002274 .type = HDA_FIXUP_FUNC,
2275 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002276 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002277 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002278 .type = HDA_FIXUP_FUNC,
2279 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002280 .chained = true,
2281 .chain_id = ALC882_FIXUP_EAPD,
2282 },
2283 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002284 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002285 .v.func = alc889_fixup_coef,
2286 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002287 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002288 .type = HDA_FIXUP_PINS,
2289 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002290 { 0x16, 0x99130111 }, /* CLFE speaker */
2291 { 0x17, 0x99130112 }, /* surround speaker */
2292 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002293 },
2294 .chained = true,
2295 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002296 },
2297 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002298 .type = HDA_FIXUP_PINS,
2299 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002300 { 0x16, 0x99130111 }, /* CLFE speaker */
2301 { 0x1b, 0x99130112 }, /* surround speaker */
2302 { }
2303 },
2304 .chained = true,
2305 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2306 },
2307 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2308 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002309 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002310 .v.verbs = (const struct hda_verb[]) {
2311 /* Enable all DACs */
2312 /* DAC DISABLE/MUTE 1? */
2313 /* setting bits 1-5 disables DAC nids 0x02-0x06
2314 * apparently. Init=0x38 */
2315 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2316 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2317 /* DAC DISABLE/MUTE 2? */
2318 /* some bit here disables the other DACs.
2319 * Init=0x4900 */
2320 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2321 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2322 /* DMIC fix
2323 * This laptop has a stereo digital microphone.
2324 * The mics are only 1cm apart which makes the stereo
2325 * useless. However, either the mic or the ALC889
2326 * makes the signal become a difference/sum signal
2327 * instead of standard stereo, which is annoying.
2328 * So instead we flip this bit which makes the
2329 * codec replicate the sum signal to both channels,
2330 * turning it into a normal mono mic.
2331 */
2332 /* DMIC_CONTROL? Init value = 0x0001 */
2333 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2334 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2335 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2336 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2337 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002338 },
2339 .chained = true,
2340 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002341 },
Takashi Iwai56710872011-11-14 17:42:11 +01002342 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002343 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002344 .v.func = alc885_fixup_macpro_gpio,
2345 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002346 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002347 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002348 .v.func = alc889_fixup_dac_route,
2349 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002350 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002351 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002352 .v.func = alc889_fixup_mbp_vref,
2353 .chained = true,
2354 .chain_id = ALC882_FIXUP_GPIO1,
2355 },
2356 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002357 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002358 .v.func = alc889_fixup_imac91_vref,
2359 .chained = true,
2360 .chain_id = ALC882_FIXUP_GPIO1,
2361 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002362 [ALC889_FIXUP_MBA11_VREF] = {
2363 .type = HDA_FIXUP_FUNC,
2364 .v.func = alc889_fixup_mba11_vref,
2365 .chained = true,
2366 .chain_id = ALC889_FIXUP_MBP_VREF,
2367 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002368 [ALC889_FIXUP_MBA21_VREF] = {
2369 .type = HDA_FIXUP_FUNC,
2370 .v.func = alc889_fixup_mba21_vref,
2371 .chained = true,
2372 .chain_id = ALC889_FIXUP_MBP_VREF,
2373 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002374 [ALC889_FIXUP_MP11_VREF] = {
2375 .type = HDA_FIXUP_FUNC,
2376 .v.func = alc889_fixup_mba11_vref,
2377 .chained = true,
2378 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2379 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002380 [ALC889_FIXUP_MP41_VREF] = {
2381 .type = HDA_FIXUP_FUNC,
2382 .v.func = alc889_fixup_mbp_vref,
2383 .chained = true,
2384 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2385 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002386 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002387 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002388 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002389 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002390 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002391 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002392 .v.func = alc882_fixup_no_primary_hp,
2393 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002394 [ALC887_FIXUP_ASUS_BASS] = {
2395 .type = HDA_FIXUP_PINS,
2396 .v.pins = (const struct hda_pintbl[]) {
2397 {0x16, 0x99130130}, /* bass speaker */
2398 {}
2399 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002400 .chained = true,
2401 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2402 },
2403 [ALC887_FIXUP_BASS_CHMAP] = {
2404 .type = HDA_FIXUP_FUNC,
2405 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002406 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002407 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2408 .type = HDA_FIXUP_FUNC,
2409 .v.func = alc1220_fixup_gb_dual_codecs,
2410 },
Peisen0202f5c2017-10-26 10:35:36 +08002411 [ALC1220_FIXUP_CLEVO_P950] = {
2412 .type = HDA_FIXUP_FUNC,
2413 .v.func = alc1220_fixup_clevo_p950,
2414 },
Richard Sailer80690a22019-04-02 15:52:04 +02002415 [ALC1220_FIXUP_CLEVO_PB51ED] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002416 .type = HDA_FIXUP_FUNC,
Richard Sailer80690a22019-04-02 15:52:04 +02002417 .v.func = alc1220_fixup_clevo_pb51ed,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002418 },
Richard Sailer80690a22019-04-02 15:52:04 +02002419 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002420 .type = HDA_FIXUP_PINS,
2421 .v.pins = (const struct hda_pintbl[]) {
2422 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2423 {}
2424 },
2425 .chained = true,
Richard Sailer80690a22019-04-02 15:52:04 +02002426 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002427 },
Jian-Hong Panca184352020-10-07 13:22:25 +08002428 [ALC887_FIXUP_ASUS_AUDIO] = {
2429 .type = HDA_FIXUP_PINS,
2430 .v.pins = (const struct hda_pintbl[]) {
2431 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2432 { 0x19, 0x22219420 },
2433 {}
2434 },
2435 },
2436 [ALC887_FIXUP_ASUS_HMIC] = {
2437 .type = HDA_FIXUP_FUNC,
2438 .v.func = alc887_fixup_asus_jack,
2439 .chained = true,
2440 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2441 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002442};
2443
2444static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002445 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2446 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002447 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002448 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2449 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2450 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2451 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002452 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2453 ALC882_FIXUP_ACER_ASPIRE_4930G),
2454 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2455 ALC882_FIXUP_ACER_ASPIRE_4930G),
2456 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2457 ALC882_FIXUP_ACER_ASPIRE_8930G),
2458 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2459 ALC882_FIXUP_ACER_ASPIRE_8930G),
2460 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2461 ALC882_FIXUP_ACER_ASPIRE_4930G),
2462 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2463 ALC882_FIXUP_ACER_ASPIRE_4930G),
2464 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2465 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002466 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002467 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2468 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002469 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002470 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002471 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002472 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002473 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002474 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Jian-Hong Panca184352020-10-07 13:22:25 +08002475 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002476 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002477 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002478 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002479 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002480 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002481 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Fernando Luis Vázquez Cao12e31a72013-02-12 16:47:44 +09002482 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaic44d9b12016-02-07 09:38:26 +01002483 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002484
2485 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002486 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2487 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2488 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002489 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002490 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2491 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002492 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2493 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002494 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002495 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002496 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002497 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2498 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002499 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002500 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2501 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2502 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002503 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002504 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002505 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2506 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002507 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002508
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002509 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002510 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002511 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Christian Lachner0d45e862020-02-23 10:24:16 +01002512 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
Christian Lachnerd9e8fe02020-05-18 07:38:44 +02002513 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia0b03952020-06-16 15:21:50 +02002514 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia655e2b2020-02-17 16:19:47 +01002515 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai1d3aa4a2020-04-08 15:56:45 +02002516 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7dafba32020-02-12 09:10:47 +01002517 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaicc5049a2020-02-18 09:09:15 +01002518 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002519 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai63691582017-05-22 16:32:46 +02002520 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002521 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002522 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Peisen0202f5c2017-10-26 10:35:36 +08002523 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaif3d737b2018-07-17 17:08:32 +02002524 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller2f0d5202018-05-07 09:28:45 -06002525 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
Richard Sailer503d90b2019-06-19 13:33:11 +02002526 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2527 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2528 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2529 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002530 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2531 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2532 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002533 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2534 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002535 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002536 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002537 {}
2538};
2539
Takashi Iwai1727a772013-01-10 09:52:52 +01002540static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002541 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2542 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2543 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2544 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2545 {.id = ALC889_FIXUP_CD, .name = "cd"},
2546 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2547 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2548 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2549 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2550 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2551 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2552 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2553 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2554 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2555 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002556 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2557 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2558 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002559 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2560 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2561 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2562 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2563 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2564 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2565 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2566 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002567 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002568 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002569 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002570 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002571 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002572 {}
2573};
2574
Takashi Iwai1d045db2011-07-07 18:23:21 +02002575/*
2576 * BIOS auto configuration
2577 */
2578/* almost identical with ALC880 parser... */
2579static int alc882_parse_auto_config(struct hda_codec *codec)
2580{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002581 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002582 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2583 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002584}
2585
Takashi Iwai1d045db2011-07-07 18:23:21 +02002586/*
2587 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002588static int patch_alc882(struct hda_codec *codec)
2589{
2590 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002591 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002592
Takashi Iwai3de95172012-05-07 18:03:15 +02002593 err = alc_alloc_spec(codec, 0x0b);
2594 if (err < 0)
2595 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002596
Takashi Iwai3de95172012-05-07 18:03:15 +02002597 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002598
Takashi Iwai7639a062015-03-03 10:07:24 +01002599 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002600 case 0x10ec0882:
2601 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002602 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002603 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002604 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002605 break;
2606 default:
2607 /* ALC883 and variants */
2608 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2609 break;
2610 }
2611
Takashi Iwaic9af7532019-05-10 11:01:43 +02002612 alc_pre_init(codec);
2613
Takashi Iwai1727a772013-01-10 09:52:52 +01002614 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002615 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002616 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002617
2618 alc_auto_parse_customize_define(codec);
2619
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002620 if (has_cdefine_beep(codec))
2621 spec->gen.beep_nid = 0x01;
2622
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002623 /* automatic parse from the BIOS config */
2624 err = alc882_parse_auto_config(codec);
2625 if (err < 0)
2626 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002627
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002628 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2629 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2630 if (err < 0)
2631 goto error;
2632 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002633
Takashi Iwai1727a772013-01-10 09:52:52 +01002634 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002635
Takashi Iwai1d045db2011-07-07 18:23:21 +02002636 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002637
2638 error:
2639 alc_free(codec);
2640 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002641}
2642
2643
2644/*
2645 * ALC262 support
2646 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002647static int alc262_parse_auto_config(struct hda_codec *codec)
2648{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002649 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002650 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2651 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002652}
2653
2654/*
2655 * Pin config fixes
2656 */
2657enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002658 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002659 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002660 ALC262_FIXUP_HP_Z200,
2661 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002662 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002663 ALC262_FIXUP_BENQ,
2664 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002665 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002666 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002667};
2668
Takashi Iwai1727a772013-01-10 09:52:52 +01002669static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002670 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002671 .type = HDA_FIXUP_PINS,
2672 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002673 { 0x14, 0x99130110 }, /* speaker */
2674 { 0x15, 0x0221142f }, /* front HP */
2675 { 0x1b, 0x0121141f }, /* rear HP */
2676 { }
2677 }
2678 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002679 [ALC262_FIXUP_FSC_S7110] = {
2680 .type = HDA_FIXUP_PINS,
2681 .v.pins = (const struct hda_pintbl[]) {
2682 { 0x15, 0x90170110 }, /* speaker */
2683 { }
2684 },
2685 .chained = true,
2686 .chain_id = ALC262_FIXUP_BENQ,
2687 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002688 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002689 .type = HDA_FIXUP_PINS,
2690 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002691 { 0x16, 0x99130120 }, /* internal speaker */
2692 { }
2693 }
2694 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002695 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002696 .type = HDA_FIXUP_PINS,
2697 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002698 { 0x14, 0x1993e1f0 }, /* int AUX */
2699 { }
2700 }
2701 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002702 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002703 .type = HDA_FIXUP_PINCTLS,
2704 .v.pins = (const struct hda_pintbl[]) {
2705 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002706 {}
2707 },
2708 .chained = true,
2709 .chain_id = ALC262_FIXUP_BENQ,
2710 },
2711 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002712 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002713 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002714 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2715 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2716 {}
2717 }
2718 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002719 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002720 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002721 .v.verbs = (const struct hda_verb[]) {
2722 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2723 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2724 {}
2725 }
2726 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002727 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002728 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002729 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002730 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002731 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2732 .type = HDA_FIXUP_FUNC,
2733 .v.func = alc_fixup_no_depop_delay,
2734 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002735};
2736
2737static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002738 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002739 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002740 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002741 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002742 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002743 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002744 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002745 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2746 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002747 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002748 {}
2749};
2750
Takashi Iwai1727a772013-01-10 09:52:52 +01002751static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002752 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002753 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2754 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2755 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2756 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2757 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2758 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2759 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2760 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002761 {}
2762};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002763
Takashi Iwai1d045db2011-07-07 18:23:21 +02002764/*
2765 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002766static int patch_alc262(struct hda_codec *codec)
2767{
2768 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002769 int err;
2770
Takashi Iwai3de95172012-05-07 18:03:15 +02002771 err = alc_alloc_spec(codec, 0x0b);
2772 if (err < 0)
2773 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002774
Takashi Iwai3de95172012-05-07 18:03:15 +02002775 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002776 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002777
Takashi Iwai225068a2015-05-29 10:42:14 +02002778 spec->shutup = alc_eapd_shutup;
2779
Takashi Iwai1d045db2011-07-07 18:23:21 +02002780#if 0
2781 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2782 * under-run
2783 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002784 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002785#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002786 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2787
Takashi Iwaic9af7532019-05-10 11:01:43 +02002788 alc_pre_init(codec);
2789
Takashi Iwai1727a772013-01-10 09:52:52 +01002790 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002791 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002792 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002793
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002794 alc_auto_parse_customize_define(codec);
2795
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002796 if (has_cdefine_beep(codec))
2797 spec->gen.beep_nid = 0x01;
2798
Takashi Iwai42399f72011-11-07 17:18:44 +01002799 /* automatic parse from the BIOS config */
2800 err = alc262_parse_auto_config(codec);
2801 if (err < 0)
2802 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002803
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002804 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2805 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2806 if (err < 0)
2807 goto error;
2808 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002809
Takashi Iwai1727a772013-01-10 09:52:52 +01002810 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002811
Takashi Iwai1d045db2011-07-07 18:23:21 +02002812 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002813
2814 error:
2815 alc_free(codec);
2816 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002817}
2818
2819/*
2820 * ALC268
2821 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002822/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002823static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2824 struct snd_ctl_elem_value *ucontrol)
2825{
2826 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2827 unsigned long pval;
2828 int err;
2829
2830 mutex_lock(&codec->control_mutex);
2831 pval = kcontrol->private_value;
2832 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2833 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2834 if (err >= 0) {
2835 kcontrol->private_value = (pval & ~0xff) | 0x10;
2836 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2837 }
2838 kcontrol->private_value = pval;
2839 mutex_unlock(&codec->control_mutex);
2840 return err;
2841}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002842
2843static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2844 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002845 {
2846 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2847 .name = "Beep Playback Switch",
2848 .subdevice = HDA_SUBDEV_AMP_FLAG,
2849 .info = snd_hda_mixer_amp_switch_info,
2850 .get = snd_hda_mixer_amp_switch_get,
2851 .put = alc268_beep_switch_put,
2852 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2853 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002854};
2855
2856/* set PCBEEP vol = 0, mute connections */
2857static const struct hda_verb alc268_beep_init_verbs[] = {
2858 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2859 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2860 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2861 { }
2862};
2863
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002864enum {
2865 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002866 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002867 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002868};
2869
Takashi Iwai1727a772013-01-10 09:52:52 +01002870static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002871 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002872 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002873 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002874 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002875 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002876 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002877 .v.verbs = (const struct hda_verb[]) {
2878 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2879 {}
2880 }
2881 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002882 [ALC268_FIXUP_SPDIF] = {
2883 .type = HDA_FIXUP_PINS,
2884 .v.pins = (const struct hda_pintbl[]) {
2885 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2886 {}
2887 }
2888 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002889};
2890
Takashi Iwai1727a772013-01-10 09:52:52 +01002891static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002892 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002893 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002894 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002895 {}
2896};
2897
2898static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002899 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002900 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002901 /* below is codec SSID since multiple Toshiba laptops have the
2902 * same PCI SSID 1179:ff00
2903 */
2904 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002905 {}
2906};
2907
Takashi Iwai1d045db2011-07-07 18:23:21 +02002908/*
2909 * BIOS auto configuration
2910 */
2911static int alc268_parse_auto_config(struct hda_codec *codec)
2912{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002913 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002914 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002915}
2916
Takashi Iwai1d045db2011-07-07 18:23:21 +02002917/*
2918 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002919static int patch_alc268(struct hda_codec *codec)
2920{
2921 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002922 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002923
Takashi Iwai1d045db2011-07-07 18:23:21 +02002924 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002925 err = alc_alloc_spec(codec, 0);
2926 if (err < 0)
2927 return err;
2928
2929 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02002930 if (has_cdefine_beep(codec))
2931 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002932
Takashi Iwai225068a2015-05-29 10:42:14 +02002933 spec->shutup = alc_eapd_shutup;
2934
Takashi Iwaic9af7532019-05-10 11:01:43 +02002935 alc_pre_init(codec);
2936
Takashi Iwai1727a772013-01-10 09:52:52 +01002937 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2938 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002939
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002940 /* automatic parse from the BIOS config */
2941 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002942 if (err < 0)
2943 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002944
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002945 if (err > 0 && !spec->gen.no_analog &&
2946 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002947 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2948 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2949 &alc268_beep_mixer[i])) {
2950 err = -ENOMEM;
2951 goto error;
2952 }
2953 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002954 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002955 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2956 /* override the amp caps for beep generator */
2957 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2958 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2959 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2960 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2961 (0 << AC_AMPCAP_MUTE_SHIFT));
2962 }
2963
Takashi Iwai1727a772013-01-10 09:52:52 +01002964 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002965
Takashi Iwai1d045db2011-07-07 18:23:21 +02002966 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002967
2968 error:
2969 alc_free(codec);
2970 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002971}
2972
2973/*
2974 * ALC269
2975 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01002976
Takashi Iwai1d045db2011-07-07 18:23:21 +02002977static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002978 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002979};
2980
2981static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002982 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002983};
2984
Takashi Iwai1d045db2011-07-07 18:23:21 +02002985/* different alc269-variants */
2986enum {
2987 ALC269_TYPE_ALC269VA,
2988 ALC269_TYPE_ALC269VB,
2989 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02002990 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01002991 ALC269_TYPE_ALC280,
2992 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02002993 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01002994 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08002995 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02002996 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08002997 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002998 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08002999 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003000 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003001 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003002 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003003 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003004 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003005 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003006 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003007};
3008
3009/*
3010 * BIOS auto configuration
3011 */
3012static int alc269_parse_auto_config(struct hda_codec *codec)
3013{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003014 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003015 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3016 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3017 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003018 const hda_nid_t *ssids;
3019
3020 switch (spec->codec_variant) {
3021 case ALC269_TYPE_ALC269VA:
3022 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003023 case ALC269_TYPE_ALC280:
3024 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003025 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003026 ssids = alc269va_ssids;
3027 break;
3028 case ALC269_TYPE_ALC269VB:
3029 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003030 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003031 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003032 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003033 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003034 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003035 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003036 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003037 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003038 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003039 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003040 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003041 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003042 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003043 ssids = alc269_ssids;
3044 break;
3045 default:
3046 ssids = alc269_ssids;
3047 break;
3048 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003049
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003050 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003051}
3052
Hui Wang476c02e2020-03-29 16:20:18 +08003053static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3054 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3055 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3056 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3057 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3058 {}
3059};
3060
3061static void alc_headset_btn_callback(struct hda_codec *codec,
3062 struct hda_jack_callback *jack)
3063{
3064 int report = 0;
3065
3066 if (jack->unsol_res & (7 << 13))
3067 report |= SND_JACK_BTN_0;
3068
3069 if (jack->unsol_res & (1 << 16 | 3 << 8))
3070 report |= SND_JACK_BTN_1;
3071
3072 /* Volume up key */
3073 if (jack->unsol_res & (7 << 23))
3074 report |= SND_JACK_BTN_2;
3075
3076 /* Volume down key */
3077 if (jack->unsol_res & (7 << 10))
3078 report |= SND_JACK_BTN_3;
3079
3080 jack->jack->button_state = report;
3081}
3082
3083static void alc_disable_headset_jack_key(struct hda_codec *codec)
3084{
3085 struct alc_spec *spec = codec->spec;
3086
3087 if (!spec->has_hs_key)
3088 return;
3089
3090 switch (codec->core.vendor_id) {
3091 case 0x10ec0215:
3092 case 0x10ec0225:
3093 case 0x10ec0285:
3094 case 0x10ec0295:
3095 case 0x10ec0289:
3096 case 0x10ec0299:
3097 alc_write_coef_idx(codec, 0x48, 0x0);
3098 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3099 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3100 break;
3101 case 0x10ec0236:
3102 case 0x10ec0256:
3103 alc_write_coef_idx(codec, 0x48, 0x0);
3104 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3105 break;
3106 }
3107}
3108
3109static void alc_enable_headset_jack_key(struct hda_codec *codec)
3110{
3111 struct alc_spec *spec = codec->spec;
3112
3113 if (!spec->has_hs_key)
3114 return;
3115
3116 switch (codec->core.vendor_id) {
3117 case 0x10ec0215:
3118 case 0x10ec0225:
3119 case 0x10ec0285:
3120 case 0x10ec0295:
3121 case 0x10ec0289:
3122 case 0x10ec0299:
3123 alc_write_coef_idx(codec, 0x48, 0xd011);
3124 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3125 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3126 break;
3127 case 0x10ec0236:
3128 case 0x10ec0256:
3129 alc_write_coef_idx(codec, 0x48, 0xd011);
3130 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3131 break;
3132 }
3133}
3134
3135static void alc_fixup_headset_jack(struct hda_codec *codec,
3136 const struct hda_fixup *fix, int action)
3137{
3138 struct alc_spec *spec = codec->spec;
3139
3140 switch (action) {
3141 case HDA_FIXUP_ACT_PRE_PROBE:
3142 spec->has_hs_key = 1;
3143 snd_hda_jack_detect_enable_callback(codec, 0x55,
3144 alc_headset_btn_callback);
3145 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3146 SND_JACK_HEADSET, alc_headset_btn_keymap);
3147 break;
3148 case HDA_FIXUP_ACT_INIT:
3149 alc_enable_headset_jack_key(codec);
3150 break;
3151 }
3152}
3153
Kailang Yang1387e2d2012-11-08 10:23:18 +01003154static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003155{
Takashi Iwai98b24882014-08-18 13:47:50 +02003156 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003157}
3158
3159static void alc269_shutup(struct hda_codec *codec)
3160{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003161 struct alc_spec *spec = codec->spec;
3162
Kailang Yang1387e2d2012-11-08 10:23:18 +01003163 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3164 alc269vb_toggle_power_output(codec, 0);
3165 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3166 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003167 msleep(150);
3168 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003169 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003170}
3171
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003172static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003173 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003174 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003175 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3176 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3177 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3178 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3179 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3180 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3181 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3182 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3183 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3184 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3185 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3186 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3187 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3188 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3189 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3190 WRITE_COEF(0x63, 0x2902), /* PLL */
3191 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3192 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3193 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3194 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3195 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3196 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3197 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3198 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3199 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3200 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3201 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3202 {}
3203};
3204
Kailang Yangcb149cb2014-03-18 16:45:32 +08003205static void alc282_restore_default_value(struct hda_codec *codec)
3206{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003207 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003208}
3209
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003210static void alc282_init(struct hda_codec *codec)
3211{
3212 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003213 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003214 bool hp_pin_sense;
3215 int coef78;
3216
Kailang Yangcb149cb2014-03-18 16:45:32 +08003217 alc282_restore_default_value(codec);
3218
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003219 if (!hp_pin)
3220 return;
3221 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3222 coef78 = alc_read_coef_idx(codec, 0x78);
3223
3224 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3225 /* Headphone capless set to high power mode */
3226 alc_write_coef_idx(codec, 0x78, 0x9004);
3227
3228 if (hp_pin_sense)
3229 msleep(2);
3230
3231 snd_hda_codec_write(codec, hp_pin, 0,
3232 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3233
3234 if (hp_pin_sense)
3235 msleep(85);
3236
3237 snd_hda_codec_write(codec, hp_pin, 0,
3238 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3239
3240 if (hp_pin_sense)
3241 msleep(100);
3242
3243 /* Headphone capless set to normal mode */
3244 alc_write_coef_idx(codec, 0x78, coef78);
3245}
3246
3247static void alc282_shutup(struct hda_codec *codec)
3248{
3249 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003250 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003251 bool hp_pin_sense;
3252 int coef78;
3253
3254 if (!hp_pin) {
3255 alc269_shutup(codec);
3256 return;
3257 }
3258
3259 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3260 coef78 = alc_read_coef_idx(codec, 0x78);
3261 alc_write_coef_idx(codec, 0x78, 0x9004);
3262
3263 if (hp_pin_sense)
3264 msleep(2);
3265
3266 snd_hda_codec_write(codec, hp_pin, 0,
3267 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3268
3269 if (hp_pin_sense)
3270 msleep(85);
3271
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003272 if (!spec->no_shutup_pins)
3273 snd_hda_codec_write(codec, hp_pin, 0,
3274 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003275
3276 if (hp_pin_sense)
3277 msleep(100);
3278
3279 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003280 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003281 alc_write_coef_idx(codec, 0x78, coef78);
3282}
3283
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003284static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003285 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003286 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003287 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3288 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3289 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3290 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3291 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3292 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3293 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3294 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3295 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3296 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3297 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3298 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3299 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3300 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3301 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3302 WRITE_COEF(0x2e, 0x2902), /* PLL */
3303 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3304 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3305 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3306 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3307 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3308 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3309 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3310 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3311 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3312 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3313 WRITE_COEF(0x49, 0x0), /* test mode */
3314 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3315 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3316 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003317 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003318 {}
3319};
3320
Kailang Yang6bd55b02014-03-17 13:51:27 +08003321static void alc283_restore_default_value(struct hda_codec *codec)
3322{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003323 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003324}
3325
Kailang Yang2af02be2013-08-22 10:03:50 +02003326static void alc283_init(struct hda_codec *codec)
3327{
3328 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003329 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003330 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003331
Kailang Yang6bd55b02014-03-17 13:51:27 +08003332 alc283_restore_default_value(codec);
3333
Kailang Yang2af02be2013-08-22 10:03:50 +02003334 if (!hp_pin)
3335 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003336
3337 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003338 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3339
3340 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3341 /* Headphone capless set to high power mode */
3342 alc_write_coef_idx(codec, 0x43, 0x9004);
3343
3344 snd_hda_codec_write(codec, hp_pin, 0,
3345 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3346
3347 if (hp_pin_sense)
3348 msleep(85);
3349
3350 snd_hda_codec_write(codec, hp_pin, 0,
3351 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3352
3353 if (hp_pin_sense)
3354 msleep(85);
3355 /* Index 0x46 Combo jack auto switch control 2 */
3356 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003357 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003358 /* Headphone capless set to normal mode */
3359 alc_write_coef_idx(codec, 0x43, 0x9614);
3360}
3361
3362static void alc283_shutup(struct hda_codec *codec)
3363{
3364 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003365 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003366 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003367
3368 if (!hp_pin) {
3369 alc269_shutup(codec);
3370 return;
3371 }
3372
3373 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3374
3375 alc_write_coef_idx(codec, 0x43, 0x9004);
3376
Harsha Priyab450b172014-10-09 11:04:56 +00003377 /*depop hp during suspend*/
3378 alc_write_coef_idx(codec, 0x06, 0x2100);
3379
Kailang Yang2af02be2013-08-22 10:03:50 +02003380 snd_hda_codec_write(codec, hp_pin, 0,
3381 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3382
3383 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003384 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003385
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003386 if (!spec->no_shutup_pins)
3387 snd_hda_codec_write(codec, hp_pin, 0,
3388 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003389
Takashi Iwai98b24882014-08-18 13:47:50 +02003390 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003391
3392 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003393 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003394 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003395 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003396 alc_write_coef_idx(codec, 0x43, 0x9614);
3397}
3398
Kailang Yang4a219ef2017-06-16 16:54:35 +08003399static void alc256_init(struct hda_codec *codec)
3400{
3401 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003402 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003403 bool hp_pin_sense;
3404
3405 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003406 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003407
3408 msleep(30);
3409
3410 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3411
3412 if (hp_pin_sense)
3413 msleep(2);
3414
3415 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003416 if (spec->ultra_low_power) {
3417 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3418 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3419 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3420 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3421 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3422 msleep(30);
3423 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003424
3425 snd_hda_codec_write(codec, hp_pin, 0,
3426 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3427
Kailang Yang6447c962019-05-08 16:27:03 +08003428 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003429 msleep(85);
3430
3431 snd_hda_codec_write(codec, hp_pin, 0,
3432 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3433
Kailang Yang6447c962019-05-08 16:27:03 +08003434 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003435 msleep(100);
3436
3437 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3438 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003439 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3440 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003441 /*
3442 * Expose headphone mic (or possibly Line In on some machines) instead
3443 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3444 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3445 * this register.
3446 */
3447 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003448}
3449
3450static void alc256_shutup(struct hda_codec *codec)
3451{
3452 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003453 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003454 bool hp_pin_sense;
3455
Kailang Yang6447c962019-05-08 16:27:03 +08003456 if (!hp_pin)
3457 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003458
3459 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3460
3461 if (hp_pin_sense)
3462 msleep(2);
3463
3464 snd_hda_codec_write(codec, hp_pin, 0,
3465 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3466
Kailang Yang6447c962019-05-08 16:27:03 +08003467 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003468 msleep(85);
3469
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003470 /* 3k pull low control for Headset jack. */
3471 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003472 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3473 * when booting with headset plugged. So skip setting it for the codec alc257
3474 */
3475 if (codec->core.vendor_id != 0x10ec0257)
3476 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003477
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003478 if (!spec->no_shutup_pins)
3479 snd_hda_codec_write(codec, hp_pin, 0,
3480 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003481
Kailang Yang6447c962019-05-08 16:27:03 +08003482 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003483 msleep(100);
3484
3485 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003486 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003487 if (spec->ultra_low_power) {
3488 msleep(50);
3489 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3490 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3491 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3492 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3493 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3494 msleep(30);
3495 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003496}
3497
Kailang Yangda911b12018-01-05 16:50:08 +08003498static void alc225_init(struct hda_codec *codec)
3499{
3500 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003501 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003502 bool hp1_pin_sense, hp2_pin_sense;
3503
3504 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003505 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003506 msleep(30);
3507
3508 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3509 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3510
3511 if (hp1_pin_sense || hp2_pin_sense)
3512 msleep(2);
3513
3514 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003515 if (spec->ultra_low_power) {
3516 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3517 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3518 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3519 msleep(30);
3520 }
Kailang Yangda911b12018-01-05 16:50:08 +08003521
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003522 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003523 snd_hda_codec_write(codec, hp_pin, 0,
3524 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3525 if (hp2_pin_sense)
3526 snd_hda_codec_write(codec, 0x16, 0,
3527 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3528
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003529 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003530 msleep(85);
3531
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003532 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003533 snd_hda_codec_write(codec, hp_pin, 0,
3534 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3535 if (hp2_pin_sense)
3536 snd_hda_codec_write(codec, 0x16, 0,
3537 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3538
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003539 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003540 msleep(100);
3541
3542 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3543 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3544}
3545
3546static void alc225_shutup(struct hda_codec *codec)
3547{
3548 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003549 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003550 bool hp1_pin_sense, hp2_pin_sense;
3551
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003552 if (!hp_pin)
3553 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003554
3555 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003556 /* 3k pull low control for Headset jack. */
3557 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3558
3559 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3560 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3561
3562 if (hp1_pin_sense || hp2_pin_sense)
3563 msleep(2);
3564
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003565 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003566 snd_hda_codec_write(codec, hp_pin, 0,
3567 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3568 if (hp2_pin_sense)
3569 snd_hda_codec_write(codec, 0x16, 0,
3570 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3571
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003572 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003573 msleep(85);
3574
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003575 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003576 snd_hda_codec_write(codec, hp_pin, 0,
3577 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3578 if (hp2_pin_sense)
3579 snd_hda_codec_write(codec, 0x16, 0,
3580 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3581
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003582 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003583 msleep(100);
3584
3585 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003586 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003587 if (spec->ultra_low_power) {
3588 msleep(50);
3589 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3590 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3591 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3592 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3593 msleep(30);
3594 }
Hui Wang476c02e2020-03-29 16:20:18 +08003595
3596 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3597 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003598}
3599
Kailang Yangc2d6af52017-06-21 14:50:54 +08003600static void alc_default_init(struct hda_codec *codec)
3601{
3602 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003603 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003604 bool hp_pin_sense;
3605
3606 if (!hp_pin)
3607 return;
3608
3609 msleep(30);
3610
3611 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3612
3613 if (hp_pin_sense)
3614 msleep(2);
3615
3616 snd_hda_codec_write(codec, hp_pin, 0,
3617 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3618
3619 if (hp_pin_sense)
3620 msleep(85);
3621
3622 snd_hda_codec_write(codec, hp_pin, 0,
3623 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3624
3625 if (hp_pin_sense)
3626 msleep(100);
3627}
3628
3629static void alc_default_shutup(struct hda_codec *codec)
3630{
3631 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003632 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003633 bool hp_pin_sense;
3634
3635 if (!hp_pin) {
3636 alc269_shutup(codec);
3637 return;
3638 }
3639
3640 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3641
3642 if (hp_pin_sense)
3643 msleep(2);
3644
3645 snd_hda_codec_write(codec, hp_pin, 0,
3646 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3647
3648 if (hp_pin_sense)
3649 msleep(85);
3650
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003651 if (!spec->no_shutup_pins)
3652 snd_hda_codec_write(codec, hp_pin, 0,
3653 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003654
3655 if (hp_pin_sense)
3656 msleep(100);
3657
3658 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003659 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003660}
3661
Kailang Yang693abe12019-01-29 15:38:21 +08003662static void alc294_hp_init(struct hda_codec *codec)
3663{
3664 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003665 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003666 int i, val;
3667
3668 if (!hp_pin)
3669 return;
3670
3671 snd_hda_codec_write(codec, hp_pin, 0,
3672 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3673
3674 msleep(100);
3675
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003676 if (!spec->no_shutup_pins)
3677 snd_hda_codec_write(codec, hp_pin, 0,
3678 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003679
3680 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3681 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3682
3683 /* Wait for depop procedure finish */
3684 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3685 for (i = 0; i < 20 && val & 0x0080; i++) {
3686 msleep(50);
3687 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3688 }
3689 /* Set HP depop to auto mode */
3690 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3691 msleep(50);
3692}
3693
3694static void alc294_init(struct hda_codec *codec)
3695{
3696 struct alc_spec *spec = codec->spec;
3697
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003698 /* required only at boot or S4 resume time */
3699 if (!spec->done_hp_init ||
3700 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003701 alc294_hp_init(codec);
3702 spec->done_hp_init = true;
3703 }
3704 alc_default_init(codec);
3705}
3706
Kailang Yangad60d502013-06-28 12:03:01 +02003707static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3708 unsigned int val)
3709{
3710 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3711 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3712 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3713}
3714
3715static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3716{
3717 unsigned int val;
3718
3719 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3720 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3721 & 0xffff;
3722 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3723 << 16;
3724 return val;
3725}
3726
3727static void alc5505_dsp_halt(struct hda_codec *codec)
3728{
3729 unsigned int val;
3730
3731 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3732 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3733 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3734 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3735 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3736 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3737 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3738 val = alc5505_coef_get(codec, 0x6220);
3739 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3740}
3741
3742static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3743{
3744 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3745 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3746 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3747 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3748 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3749 alc5505_coef_set(codec, 0x880c, 0x00000004);
3750}
3751
3752static void alc5505_dsp_init(struct hda_codec *codec)
3753{
3754 unsigned int val;
3755
3756 alc5505_dsp_halt(codec);
3757 alc5505_dsp_back_from_halt(codec);
3758 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3759 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3760 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3761 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3762 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3763 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3764 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3765 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3766 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3767 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3768 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3769 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3770 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3771
3772 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3773 if (val <= 3)
3774 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3775 else
3776 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3777
3778 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3779 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3780 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3781 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3782 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3783 alc5505_coef_set(codec, 0x880c, 0x00000003);
3784 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003785
3786#ifdef HALT_REALTEK_ALC5505
3787 alc5505_dsp_halt(codec);
3788#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003789}
3790
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003791#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003792#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3793#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003794#else
3795#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3796#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3797#endif
3798
Takashi Iwai2a439522011-07-26 09:52:50 +02003799#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003800static int alc269_suspend(struct hda_codec *codec)
3801{
3802 struct alc_spec *spec = codec->spec;
3803
3804 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003805 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003806 return alc_suspend(codec);
3807}
3808
Takashi Iwai1d045db2011-07-07 18:23:21 +02003809static int alc269_resume(struct hda_codec *codec)
3810{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003811 struct alc_spec *spec = codec->spec;
3812
Kailang Yang1387e2d2012-11-08 10:23:18 +01003813 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3814 alc269vb_toggle_power_output(codec, 0);
3815 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003816 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003817 msleep(150);
3818 }
3819
3820 codec->patch_ops.init(codec);
3821
Kailang Yang1387e2d2012-11-08 10:23:18 +01003822 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3823 alc269vb_toggle_power_output(codec, 1);
3824 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003825 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003826 msleep(200);
3827 }
3828
Takashi Iwai1a462be2020-01-09 10:01:04 +01003829 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003830 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003831
3832 /* on some machine, the BIOS will clear the codec gpio data when enter
3833 * suspend, and won't restore the data after resume, so we restore it
3834 * in the driver.
3835 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003836 if (spec->gpio_data)
3837 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003838
Kailang Yangad60d502013-06-28 12:03:01 +02003839 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003840 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003841
Takashi Iwai1d045db2011-07-07 18:23:21 +02003842 return 0;
3843}
Takashi Iwai2a439522011-07-26 09:52:50 +02003844#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003845
David Henningsson108cc102012-07-20 10:37:25 +02003846static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003847 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003848{
3849 struct alc_spec *spec = codec->spec;
3850
Takashi Iwai1727a772013-01-10 09:52:52 +01003851 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003852 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3853}
3854
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003855static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3856 const struct hda_fixup *fix,
3857 int action)
3858{
3859 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3860 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3861
3862 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3863 snd_hda_codec_set_pincfg(codec, 0x19,
3864 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3865 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3866}
3867
Takashi Iwai1d045db2011-07-07 18:23:21 +02003868static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003869 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003870{
Takashi Iwai98b24882014-08-18 13:47:50 +02003871 if (action == HDA_FIXUP_ACT_INIT)
3872 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003873}
3874
David Henningsson7c478f02013-10-11 10:18:46 +02003875static void alc269_fixup_headset_mic(struct hda_codec *codec,
3876 const struct hda_fixup *fix, int action)
3877{
3878 struct alc_spec *spec = codec->spec;
3879
3880 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3881 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3882}
3883
Takashi Iwai1d045db2011-07-07 18:23:21 +02003884static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003885 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003886{
3887 static const struct hda_verb verbs[] = {
3888 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3889 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3890 {}
3891 };
3892 unsigned int cfg;
3893
Takashi Iwai7639a062015-03-03 10:07:24 +01003894 if (strcmp(codec->core.chip_name, "ALC271X") &&
3895 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003896 return;
3897 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3898 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3899 snd_hda_sequence_write(codec, verbs);
3900}
3901
Takashi Iwai017f2a12011-07-09 14:42:25 +02003902static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003903 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003904{
3905 struct alc_spec *spec = codec->spec;
3906
Takashi Iwai1727a772013-01-10 09:52:52 +01003907 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003908 return;
3909
3910 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3911 * fix the sample rate of analog I/O to 44.1kHz
3912 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003913 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3914 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003915}
3916
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003917static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003918 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003919{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003920 /* The digital-mic unit sends PDM (differential signal) instead of
3921 * the standard PCM, thus you can't record a valid mono stream as is.
3922 * Below is a workaround specific to ALC269 to control the dmic
3923 * signal source as mono.
3924 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003925 if (action == HDA_FIXUP_ACT_INIT)
3926 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003927}
3928
Takashi Iwai24519912011-08-16 15:08:49 +02003929static void alc269_quanta_automute(struct hda_codec *codec)
3930{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003931 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003932
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003933 alc_write_coef_idx(codec, 0x0c, 0x680);
3934 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003935}
3936
3937static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003938 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003939{
3940 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003941 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003942 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003943 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003944}
3945
David Henningssond240d1d2013-04-15 12:50:02 +02003946static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003947 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003948{
3949 struct alc_spec *spec = codec->spec;
3950 int vref;
3951 msleep(200);
3952 snd_hda_gen_hp_automute(codec, jack);
3953
3954 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3955 msleep(100);
3956 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3957 vref);
3958 msleep(500);
3959 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3960 vref);
3961}
3962
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02003963/*
3964 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
3965 */
3966struct hda_alc298_mbxinit {
3967 unsigned char value_0x23;
3968 unsigned char value_0x25;
3969};
3970
3971static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
3972 const struct hda_alc298_mbxinit *initval,
3973 bool first)
3974{
3975 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
3976 alc_write_coef_idx(codec, 0x26, 0xb000);
3977
3978 if (first)
3979 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
3980
3981 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
3982 alc_write_coef_idx(codec, 0x26, 0xf000);
3983 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
3984
3985 if (initval->value_0x23 != 0x1e)
3986 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
3987
3988 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
3989 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
3990}
3991
3992static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
3993 const struct hda_fixup *fix,
3994 int action)
3995{
3996 /* Initialization magic */
3997 static const struct hda_alc298_mbxinit dac_init[] = {
3998 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
3999 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4000 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4001 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4002 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4003 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4004 {0x2f, 0x00},
4005 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4006 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4007 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4008 {}
4009 };
4010 const struct hda_alc298_mbxinit *seq;
4011
4012 if (action != HDA_FIXUP_ACT_INIT)
4013 return;
4014
4015 /* Start */
4016 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4017 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4018 alc_write_coef_idx(codec, 0x26, 0xf000);
4019 alc_write_coef_idx(codec, 0x22, 0x31);
4020 alc_write_coef_idx(codec, 0x23, 0x0b);
4021 alc_write_coef_idx(codec, 0x25, 0x00);
4022 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4023 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4024
4025 for (seq = dac_init; seq->value_0x23; seq++)
4026 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4027}
4028
David Henningssond240d1d2013-04-15 12:50:02 +02004029static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4030 const struct hda_fixup *fix, int action)
4031{
4032 struct alc_spec *spec = codec->spec;
4033 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4034 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4035 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4036 }
4037}
4038
Takashi Iwai766538a2020-06-18 13:08:41 +02004039static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4040 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004041{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004042 unsigned int pinval;
4043
Takashi Iwai766538a2020-06-18 13:08:41 +02004044 if (!pin)
4045 return;
4046 if (polarity)
4047 on = !on;
4048 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004049 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004050 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4051 /* temporarily power up/down for setting VREF */
4052 snd_hda_power_up_pm(codec);
4053 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4054 snd_hda_power_down_pm(codec);
4055}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004056
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004057/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004058static int vref_mute_led_set(struct led_classdev *led_cdev,
4059 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004060{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004061 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004062 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004063
Takashi Iwai766538a2020-06-18 13:08:41 +02004064 alc_update_vref_led(codec, spec->mute_led_nid,
4065 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004066 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004067}
4068
David Henningssond5b6b652013-11-06 10:50:44 +01004069/* Make sure the led works even in runtime suspend */
4070static unsigned int led_power_filter(struct hda_codec *codec,
4071 hda_nid_t nid,
4072 unsigned int power_state)
4073{
4074 struct alc_spec *spec = codec->spec;
4075
Hui Wang50dd9052014-07-08 17:56:15 +08004076 if (power_state != AC_PWRST_D3 || nid == 0 ||
4077 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004078 return power_state;
4079
4080 /* Set pin ctl again, it might have just been set to 0 */
4081 snd_hda_set_pin_ctl(codec, nid,
4082 snd_hda_codec_get_pin_target(codec, nid));
4083
Takashi Iwaicffd3962015-04-09 10:30:25 +02004084 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004085}
4086
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004087static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4088 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004089{
4090 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004091 const struct dmi_device *dev = NULL;
4092
4093 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4094 return;
4095
4096 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4097 int pol, pin;
4098 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4099 continue;
4100 if (pin < 0x0a || pin >= 0x10)
4101 break;
4102 spec->mute_led_polarity = pol;
4103 spec->mute_led_nid = pin - 0x0a + 0x18;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004104 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004105 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004106 codec_dbg(codec,
4107 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004108 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004109 break;
4110 }
4111}
4112
Takashi Iwai85c467d2018-05-29 11:38:38 +02004113static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4114 const struct hda_fixup *fix,
4115 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004116{
4117 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004118
David Henningssond06ac142013-02-18 11:41:55 +01004119 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4120 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004121 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004122 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004123 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004124 }
4125}
4126
Takashi Iwai85c467d2018-05-29 11:38:38 +02004127static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4128 const struct hda_fixup *fix, int action)
4129{
4130 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4131}
4132
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004133static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4134 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004135{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004136 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004137}
4138
Tom Briden7f783bd2017-03-25 10:12:01 +00004139static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4140 const struct hda_fixup *fix, int action)
4141{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004142 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004143}
4144
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004145/* update LED status via GPIO */
4146static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004147 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004148{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004149 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004150 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004151 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004152}
4153
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004154/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004155static int gpio_mute_led_set(struct led_classdev *led_cdev,
4156 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004157{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004158 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004159 struct alc_spec *spec = codec->spec;
4160
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004161 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004162 spec->mute_led_polarity, !brightness);
4163 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004164}
4165
4166/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004167static int micmute_led_set(struct led_classdev *led_cdev,
4168 enum led_brightness brightness)
4169{
4170 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4171 struct alc_spec *spec = codec->spec;
4172
4173 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004174 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004175 return 0;
4176}
4177
Takashi Iwai01e4a272018-06-19 22:47:30 +02004178/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4179static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4180 int action,
4181 unsigned int mute_mask,
4182 unsigned int micmute_mask)
4183{
4184 struct alc_spec *spec = codec->spec;
4185
4186 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4187
4188 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4189 return;
4190 if (mute_mask) {
4191 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004192 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004193 }
4194 if (micmute_mask) {
4195 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004196 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004197 }
4198}
4199
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004200static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4201 const struct hda_fixup *fix, int action)
4202{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004203 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004204}
4205
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004206static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4207 const struct hda_fixup *fix, int action)
4208{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004209 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004210}
4211
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004212static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4213 const struct hda_fixup *fix, int action)
4214{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004215 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004216}
4217
Takashi Iwai8a503552020-06-18 13:08:32 +02004218/* turn on/off mic-mute LED per capture hook via VREF change */
4219static int vref_micmute_led_set(struct led_classdev *led_cdev,
4220 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004221{
Takashi Iwai8a503552020-06-18 13:08:32 +02004222 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004223 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004224
Takashi Iwai766538a2020-06-18 13:08:41 +02004225 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4226 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004227 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004228}
4229
4230static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4231 const struct hda_fixup *fix, int action)
4232{
4233 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004234
Takashi Iwai01e4a272018-06-19 22:47:30 +02004235 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004236 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004237 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4238 * enable headphone amp
4239 */
4240 spec->gpio_mask |= 0x10;
4241 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004242 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004243 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004244 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004245 }
4246}
4247
David Henningsson7a5255f2014-10-30 08:26:01 +01004248static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4249 const struct hda_fixup *fix, int action)
4250{
David Henningsson7a5255f2014-10-30 08:26:01 +01004251 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004252
Takashi Iwai01e4a272018-06-19 22:47:30 +02004253 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004254 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004255 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004256 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004257 codec->power_filter = led_power_filter;
4258 }
4259}
4260
Takashi Iwai766538a2020-06-18 13:08:41 +02004261static void alc_update_coef_led(struct hda_codec *codec,
4262 struct alc_coef_led *led,
4263 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004264{
Takashi Iwai766538a2020-06-18 13:08:41 +02004265 if (polarity)
4266 on = !on;
4267 /* temporarily power up/down for setting COEF bit */
4268 alc_update_coef_idx(codec, led->idx, led->mask,
4269 on ? led->on : led->off);
4270}
4271
Kailang Yang431e76c2020-04-07 14:40:20 +08004272/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004273static int coef_mute_led_set(struct led_classdev *led_cdev,
4274 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004275{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004276 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004277 struct alc_spec *spec = codec->spec;
4278
Takashi Iwai766538a2020-06-18 13:08:41 +02004279 alc_update_coef_led(codec, &spec->mute_led_coef,
4280 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004281 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004282}
4283
4284static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4285 const struct hda_fixup *fix,
4286 int action)
4287{
4288 struct alc_spec *spec = codec->spec;
4289
4290 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4291 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004292 spec->mute_led_coef.idx = 0x0b;
4293 spec->mute_led_coef.mask = 1 << 3;
4294 spec->mute_led_coef.on = 1 << 3;
4295 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004296 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004297 }
4298}
4299
Kailang Yang24164f42020-04-07 14:52:42 +08004300static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4301 const struct hda_fixup *fix,
4302 int action)
4303{
4304 struct alc_spec *spec = codec->spec;
4305
4306 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4307 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004308 spec->mute_led_coef.idx = 0x34;
4309 spec->mute_led_coef.mask = 1 << 5;
4310 spec->mute_led_coef.on = 0;
4311 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004312 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004313 }
4314}
4315
Kailang Yang431e76c2020-04-07 14:40:20 +08004316/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004317static int coef_micmute_led_set(struct led_classdev *led_cdev,
4318 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004319{
Takashi Iwai8a503552020-06-18 13:08:32 +02004320 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004321 struct alc_spec *spec = codec->spec;
4322
Takashi Iwai766538a2020-06-18 13:08:41 +02004323 alc_update_coef_led(codec, &spec->mic_led_coef,
4324 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004325 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004326}
4327
4328static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4329 const struct hda_fixup *fix, int action)
4330{
4331 struct alc_spec *spec = codec->spec;
4332
4333 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004334 spec->mic_led_coef.idx = 0x19;
4335 spec->mic_led_coef.mask = 1 << 13;
4336 spec->mic_led_coef.on = 1 << 13;
4337 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004338 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004339 }
4340}
4341
Kailang Yang24164f42020-04-07 14:52:42 +08004342static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4343 const struct hda_fixup *fix, int action)
4344{
4345 struct alc_spec *spec = codec->spec;
4346
4347 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004348 spec->mic_led_coef.idx = 0x35;
4349 spec->mic_led_coef.mask = 3 << 2;
4350 spec->mic_led_coef.on = 2 << 2;
4351 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004352 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004353 }
4354}
4355
Kailang Yang431e76c2020-04-07 14:40:20 +08004356static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4357 const struct hda_fixup *fix, int action)
4358{
4359 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4360 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4361}
4362
Kailang Yang24164f42020-04-07 14:52:42 +08004363static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4364 const struct hda_fixup *fix, int action)
4365{
4366 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4367 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4368}
4369
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004370#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004371static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4372 struct hda_jack_callback *event)
4373{
4374 struct alc_spec *spec = codec->spec;
4375
4376 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4377 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004378 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004379 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004380 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004381 input_sync(spec->kb_dev);
4382}
David Henningsson33f4acd2015-01-07 15:50:13 +01004383
Kailang3694cb22015-12-28 11:35:24 +08004384static int alc_register_micmute_input_device(struct hda_codec *codec)
4385{
4386 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004387 int i;
Kailang3694cb22015-12-28 11:35:24 +08004388
4389 spec->kb_dev = input_allocate_device();
4390 if (!spec->kb_dev) {
4391 codec_err(codec, "Out of memory (input_allocate_device)\n");
4392 return -ENOMEM;
4393 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004394
4395 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4396
Kailang3694cb22015-12-28 11:35:24 +08004397 spec->kb_dev->name = "Microphone Mute Button";
4398 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004399 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4400 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4401 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4402 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4403 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004404
4405 if (input_register_device(spec->kb_dev)) {
4406 codec_err(codec, "input_register_device failed\n");
4407 input_free_device(spec->kb_dev);
4408 spec->kb_dev = NULL;
4409 return -ENOMEM;
4410 }
4411
4412 return 0;
4413}
4414
Takashi Iwai01e4a272018-06-19 22:47:30 +02004415/* GPIO1 = set according to SKU external amp
4416 * GPIO2 = mic mute hotkey
4417 * GPIO3 = mute LED
4418 * GPIO4 = mic mute LED
4419 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004420static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4421 const struct hda_fixup *fix, int action)
4422{
David Henningsson33f4acd2015-01-07 15:50:13 +01004423 struct alc_spec *spec = codec->spec;
4424
Takashi Iwai01e4a272018-06-19 22:47:30 +02004425 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004426 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004427 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004428 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004429 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004430
Takashi Iwai01e4a272018-06-19 22:47:30 +02004431 spec->gpio_mask |= 0x06;
4432 spec->gpio_dir |= 0x02;
4433 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004434 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004435 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004436 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004437 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004438 return;
4439 }
4440
4441 if (!spec->kb_dev)
4442 return;
4443
4444 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004445 case HDA_FIXUP_ACT_FREE:
4446 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004447 spec->kb_dev = NULL;
4448 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004449}
4450
Takashi Iwai01e4a272018-06-19 22:47:30 +02004451/* Line2 = mic mute hotkey
4452 * GPIO2 = mic mute LED
4453 */
Kailang3694cb22015-12-28 11:35:24 +08004454static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4455 const struct hda_fixup *fix, int action)
4456{
Kailang3694cb22015-12-28 11:35:24 +08004457 struct alc_spec *spec = codec->spec;
4458
Takashi Iwai01e4a272018-06-19 22:47:30 +02004459 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004460 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004461 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004462 if (alc_register_micmute_input_device(codec) != 0)
4463 return;
4464
Kailang3694cb22015-12-28 11:35:24 +08004465 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4466 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004467 return;
4468 }
4469
4470 if (!spec->kb_dev)
4471 return;
4472
4473 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004474 case HDA_FIXUP_ACT_FREE:
4475 input_unregister_device(spec->kb_dev);
4476 spec->kb_dev = NULL;
4477 }
4478}
Takashi Iwaic4696522018-01-15 10:44:35 +01004479#else /* INPUT */
4480#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4481#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4482#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004483
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004484static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4485 const struct hda_fixup *fix, int action)
4486{
4487 struct alc_spec *spec = codec->spec;
4488
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004489 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004490 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004491 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004492 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004493 }
4494}
4495
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004496static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004497 UPDATE_COEF(0x4a, 1<<8, 0),
4498 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4499 UPDATE_COEF(0x63, 3<<14, 3<<14),
4500 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4501 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4502 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4503 UPDATE_COEF(0x4a, 3<<10, 0),
4504 {}
4505};
4506
David Henningsson73bdd592013-04-15 15:44:14 +02004507static void alc_headset_mode_unplugged(struct hda_codec *codec)
4508{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004509 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004510 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004511 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4512 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4513 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4514 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4515 {}
4516 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004517 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004518 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004519 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4520 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4521 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4522 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004523 {}
4524 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004525 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004526 WRITE_COEF(0x1b, 0x0c0b),
4527 WRITE_COEF(0x45, 0xc429),
4528 UPDATE_COEF(0x35, 0x4000, 0),
4529 WRITE_COEF(0x06, 0x2104),
4530 WRITE_COEF(0x1a, 0x0001),
4531 WRITE_COEF(0x26, 0x0004),
4532 WRITE_COEF(0x32, 0x42a3),
4533 {}
4534 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004535 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004536 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4537 UPDATE_COEF(0x50, 0x2000, 0x2000),
4538 UPDATE_COEF(0x56, 0x0006, 0x0006),
4539 UPDATE_COEF(0x66, 0x0008, 0),
4540 UPDATE_COEF(0x67, 0x2000, 0),
4541 {}
4542 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004543 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004544 UPDATE_COEF(0x19, 0x1300, 0x0300),
4545 {}
4546 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004547 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004548 WRITE_COEF(0x76, 0x000e),
4549 WRITE_COEF(0x6c, 0x2400),
4550 WRITE_COEF(0x18, 0x7308),
4551 WRITE_COEF(0x6b, 0xc429),
4552 {}
4553 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004554 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004555 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4556 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4557 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4558 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4559 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4560 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4561 {}
4562 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004563 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004564 WRITE_COEF(0x15, 0x0d40),
4565 WRITE_COEF(0xb7, 0x802b),
4566 {}
4567 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004568 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004569 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004570 {}
4571 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004572 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004573 UPDATE_COEF(0x4a, 0x0100, 0),
4574 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4575 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4576 UPDATE_COEF(0x4a, 0x0010, 0),
4577 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4578 WRITE_COEF(0x45, 0x5289),
4579 UPDATE_COEF(0x4a, 0x0c00, 0),
4580 {}
4581 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004582
Takashi Iwai7639a062015-03-03 10:07:24 +01004583 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004584 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004585 alc_process_coef_fw(codec, coef0255);
4586 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004587 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004588 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004589 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004590 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004591 case 0x10ec0234:
4592 case 0x10ec0274:
4593 case 0x10ec0294:
4594 alc_process_coef_fw(codec, coef0274);
4595 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004596 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004597 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004598 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004599 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004600 case 0x10ec0286:
4601 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004602 alc_process_coef_fw(codec, coef0288);
4603 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004604 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004605 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004606 alc_process_coef_fw(codec, coef0288);
4607 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004608 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004609 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004610 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004611 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004612 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004613 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004614 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004615 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004616 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004617 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004618 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004619 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004620 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004621 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004622 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004623 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004624 alc_process_coef_fw(codec, coef0225);
4625 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004626 case 0x10ec0867:
4627 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4628 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004629 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004630 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004631}
4632
4633
4634static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4635 hda_nid_t mic_pin)
4636{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004637 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004638 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4639 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4640 {}
4641 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004642 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004643 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4644 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4645 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4646 {}
4647 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004648 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004649 UPDATE_COEF(0x35, 0, 1<<14),
4650 WRITE_COEF(0x06, 0x2100),
4651 WRITE_COEF(0x1a, 0x0021),
4652 WRITE_COEF(0x26, 0x008c),
4653 {}
4654 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004655 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004656 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004657 UPDATE_COEF(0x50, 0x2000, 0),
4658 UPDATE_COEF(0x56, 0x0006, 0),
4659 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4660 UPDATE_COEF(0x66, 0x0008, 0x0008),
4661 UPDATE_COEF(0x67, 0x2000, 0x2000),
4662 {}
4663 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004664 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004665 WRITE_COEF(0x19, 0xa208),
4666 WRITE_COEF(0x2e, 0xacf0),
4667 {}
4668 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004669 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004670 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4671 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4672 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4673 {}
4674 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004675 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004676 WRITE_COEF(0xb7, 0x802b),
4677 WRITE_COEF(0xb5, 0x1040),
4678 UPDATE_COEF(0xc3, 0, 1<<12),
4679 {}
4680 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004681 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004682 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4683 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4684 UPDATE_COEF(0x63, 3<<14, 0),
4685 {}
4686 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004687 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004688 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4689 UPDATE_COEF(0x4a, 0x0010, 0),
4690 UPDATE_COEF(0x6b, 0xf000, 0),
4691 {}
4692 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004693
Takashi Iwai7639a062015-03-03 10:07:24 +01004694 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004695 case 0x10ec0255:
4696 alc_write_coef_idx(codec, 0x45, 0xc489);
4697 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004698 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004699 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4700 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004701 case 0x10ec0236:
4702 case 0x10ec0256:
4703 alc_write_coef_idx(codec, 0x45, 0xc489);
4704 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4705 alc_process_coef_fw(codec, coef0256);
4706 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4707 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004708 case 0x10ec0234:
4709 case 0x10ec0274:
4710 case 0x10ec0294:
4711 alc_write_coef_idx(codec, 0x45, 0x4689);
4712 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4713 alc_process_coef_fw(codec, coef0274);
4714 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4715 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004716 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004717 case 0x10ec0283:
4718 alc_write_coef_idx(codec, 0x45, 0xc429);
4719 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004720 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004721 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4722 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004723 case 0x10ec0286:
4724 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004725 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004726 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4727 alc_process_coef_fw(codec, coef0288);
4728 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4729 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004730 case 0x10ec0292:
4731 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004732 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004733 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004734 case 0x10ec0293:
4735 /* Set to TRS mode */
4736 alc_write_coef_idx(codec, 0x45, 0xc429);
4737 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004738 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004739 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4740 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004741 case 0x10ec0867:
4742 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05004743 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004744 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004745 case 0x10ec0662:
4746 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4747 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4748 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004749 case 0x10ec0668:
4750 alc_write_coef_idx(codec, 0x11, 0x0001);
4751 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004752 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004753 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4754 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004755 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004756 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004757 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004758 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004759 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004760 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004761 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004762 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4763 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4764 alc_process_coef_fw(codec, coef0225);
4765 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4766 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004767 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004768 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004769}
4770
4771static void alc_headset_mode_default(struct hda_codec *codec)
4772{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004773 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004774 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4775 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4776 UPDATE_COEF(0x49, 3<<8, 0<<8),
4777 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4778 UPDATE_COEF(0x63, 3<<14, 0),
4779 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004780 {}
4781 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004782 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004783 WRITE_COEF(0x45, 0xc089),
4784 WRITE_COEF(0x45, 0xc489),
4785 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4786 WRITE_COEF(0x49, 0x0049),
4787 {}
4788 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004789 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004790 WRITE_COEF(0x45, 0xc489),
4791 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4792 WRITE_COEF(0x49, 0x0049),
4793 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4794 WRITE_COEF(0x06, 0x6100),
4795 {}
4796 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004797 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004798 WRITE_COEF(0x06, 0x2100),
4799 WRITE_COEF(0x32, 0x4ea3),
4800 {}
4801 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004802 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004803 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4804 UPDATE_COEF(0x50, 0x2000, 0x2000),
4805 UPDATE_COEF(0x56, 0x0006, 0x0006),
4806 UPDATE_COEF(0x66, 0x0008, 0),
4807 UPDATE_COEF(0x67, 0x2000, 0),
4808 {}
4809 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004810 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004811 WRITE_COEF(0x76, 0x000e),
4812 WRITE_COEF(0x6c, 0x2400),
4813 WRITE_COEF(0x6b, 0xc429),
4814 WRITE_COEF(0x18, 0x7308),
4815 {}
4816 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004817 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004818 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4819 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4820 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4821 {}
4822 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004823 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004824 WRITE_COEF(0x11, 0x0041),
4825 WRITE_COEF(0x15, 0x0d40),
4826 WRITE_COEF(0xb7, 0x802b),
4827 {}
4828 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004829 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004830 WRITE_COEF(0x45, 0x4289),
4831 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4832 UPDATE_COEF(0x6b, 0x0f00, 0),
4833 UPDATE_COEF(0x49, 0x0300, 0x0300),
4834 {}
4835 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004836
Takashi Iwai7639a062015-03-03 10:07:24 +01004837 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004838 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004839 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004840 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004841 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004842 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004843 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004844 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004845 alc_process_coef_fw(codec, coef0225);
4846 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004847 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004848 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004849 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004850 case 0x10ec0236:
4851 case 0x10ec0256:
4852 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4853 alc_write_coef_idx(codec, 0x45, 0xc089);
4854 msleep(50);
4855 alc_process_coef_fw(codec, coef0256);
4856 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004857 case 0x10ec0234:
4858 case 0x10ec0274:
4859 case 0x10ec0294:
4860 alc_process_coef_fw(codec, coef0274);
4861 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004862 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004863 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004864 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004865 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004866 case 0x10ec0286:
4867 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004868 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004869 alc_process_coef_fw(codec, coef0288);
4870 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004871 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004872 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004873 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004874 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004875 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004876 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004877 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004878 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004879 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004880 case 0x10ec0867:
4881 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4882 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004883 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004884 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004885}
4886
4887/* Iphone type */
4888static void alc_headset_mode_ctia(struct hda_codec *codec)
4889{
Kailang Yang89542932017-07-17 15:03:43 +08004890 int val;
4891
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004892 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004893 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4894 WRITE_COEF(0x1b, 0x0c2b),
4895 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4896 {}
4897 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004898 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004899 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08004900 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08004901 {}
4902 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004903 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004904 WRITE_COEF(0x45, 0xd429),
4905 WRITE_COEF(0x1b, 0x0c2b),
4906 WRITE_COEF(0x32, 0x4ea3),
4907 {}
4908 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004909 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004910 UPDATE_COEF(0x50, 0x2000, 0x2000),
4911 UPDATE_COEF(0x56, 0x0006, 0x0006),
4912 UPDATE_COEF(0x66, 0x0008, 0),
4913 UPDATE_COEF(0x67, 0x2000, 0),
4914 {}
4915 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004916 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004917 WRITE_COEF(0x6b, 0xd429),
4918 WRITE_COEF(0x76, 0x0008),
4919 WRITE_COEF(0x18, 0x7388),
4920 {}
4921 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004922 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004923 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4924 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4925 {}
4926 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004927 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004928 WRITE_COEF(0x11, 0x0001),
4929 WRITE_COEF(0x15, 0x0d60),
4930 WRITE_COEF(0xc3, 0x0000),
4931 {}
4932 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004933 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004934 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004935 UPDATE_COEF(0x63, 3<<14, 2<<14),
4936 {}
4937 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004938 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004939 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4940 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004941 {}
4942 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004943
Takashi Iwai7639a062015-03-03 10:07:24 +01004944 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004945 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004946 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004947 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004948 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004949 case 0x10ec0256:
4950 alc_process_coef_fw(codec, coef0256);
4951 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004952 case 0x10ec0234:
4953 case 0x10ec0274:
4954 case 0x10ec0294:
4955 alc_write_coef_idx(codec, 0x45, 0xd689);
4956 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004957 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004958 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004959 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004960 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004961 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004962 val = alc_read_coef_idx(codec, 0x50);
4963 if (val & (1 << 12)) {
4964 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4965 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4966 msleep(300);
4967 } else {
4968 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4969 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4970 msleep(300);
4971 }
4972 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004973 case 0x10ec0286:
4974 case 0x10ec0288:
4975 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4976 msleep(300);
4977 alc_process_coef_fw(codec, coef0288);
4978 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004979 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004980 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004981 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004982 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004983 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004984 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004985 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004986 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004987 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004988 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004989 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004990 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004991 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004992 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004993 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004994 val = alc_read_coef_idx(codec, 0x45);
4995 if (val & (1 << 9))
4996 alc_process_coef_fw(codec, coef0225_2);
4997 else
4998 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004999 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005000 case 0x10ec0867:
5001 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5002 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005003 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005004 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005005}
5006
5007/* Nokia type */
5008static void alc_headset_mode_omtp(struct hda_codec *codec)
5009{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005010 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005011 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5012 WRITE_COEF(0x1b, 0x0c2b),
5013 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5014 {}
5015 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005016 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005017 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005018 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005019 {}
5020 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005021 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005022 WRITE_COEF(0x45, 0xe429),
5023 WRITE_COEF(0x1b, 0x0c2b),
5024 WRITE_COEF(0x32, 0x4ea3),
5025 {}
5026 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005027 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005028 UPDATE_COEF(0x50, 0x2000, 0x2000),
5029 UPDATE_COEF(0x56, 0x0006, 0x0006),
5030 UPDATE_COEF(0x66, 0x0008, 0),
5031 UPDATE_COEF(0x67, 0x2000, 0),
5032 {}
5033 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005034 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005035 WRITE_COEF(0x6b, 0xe429),
5036 WRITE_COEF(0x76, 0x0008),
5037 WRITE_COEF(0x18, 0x7388),
5038 {}
5039 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005040 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005041 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5042 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5043 {}
5044 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005045 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005046 WRITE_COEF(0x11, 0x0001),
5047 WRITE_COEF(0x15, 0x0d50),
5048 WRITE_COEF(0xc3, 0x0000),
5049 {}
5050 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005051 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005052 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005053 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005054 {}
5055 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005056
Takashi Iwai7639a062015-03-03 10:07:24 +01005057 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005058 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005059 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005060 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005061 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005062 case 0x10ec0256:
5063 alc_process_coef_fw(codec, coef0256);
5064 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005065 case 0x10ec0234:
5066 case 0x10ec0274:
5067 case 0x10ec0294:
5068 alc_write_coef_idx(codec, 0x45, 0xe689);
5069 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005070 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005071 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005072 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005073 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005074 case 0x10ec0298:
5075 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005076 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5077 msleep(300);
5078 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005079 case 0x10ec0286:
5080 case 0x10ec0288:
5081 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5082 msleep(300);
5083 alc_process_coef_fw(codec, coef0288);
5084 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005085 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005086 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005087 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005088 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005089 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005090 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005091 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005092 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005093 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005094 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005095 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005096 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005097 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005098 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005099 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005100 alc_process_coef_fw(codec, coef0225);
5101 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005102 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005103 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005104}
5105
5106static void alc_determine_headset_type(struct hda_codec *codec)
5107{
5108 int val;
5109 bool is_ctia = false;
5110 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005111 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005112 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5113 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5114 conteol) */
5115 {}
5116 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005117 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005118 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5119 {}
5120 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005121 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005122 UPDATE_COEF(0x50, 0x2000, 0x2000),
5123 UPDATE_COEF(0x56, 0x0006, 0x0006),
5124 UPDATE_COEF(0x66, 0x0008, 0),
5125 UPDATE_COEF(0x67, 0x2000, 0),
5126 UPDATE_COEF(0x19, 0x1300, 0x1300),
5127 {}
5128 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005129 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005130 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5131 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5132 {}
5133 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005134 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005135 WRITE_COEF(0x11, 0x0001),
5136 WRITE_COEF(0xb7, 0x802b),
5137 WRITE_COEF(0x15, 0x0d60),
5138 WRITE_COEF(0xc3, 0x0c00),
5139 {}
5140 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005141 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005142 UPDATE_COEF(0x4a, 0x0010, 0),
5143 UPDATE_COEF(0x4a, 0x8000, 0),
5144 WRITE_COEF(0x45, 0xd289),
5145 UPDATE_COEF(0x49, 0x0300, 0x0300),
5146 {}
5147 };
David Henningsson73bdd592013-04-15 15:44:14 +02005148
Takashi Iwai7639a062015-03-03 10:07:24 +01005149 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005150 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005151 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005152 msleep(300);
5153 val = alc_read_coef_idx(codec, 0x46);
5154 is_ctia = (val & 0x0070) == 0x0070;
5155 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08005156 case 0x10ec0236:
5157 case 0x10ec0256:
5158 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5159 alc_write_coef_idx(codec, 0x06, 0x6104);
5160 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5161
5162 snd_hda_codec_write(codec, 0x21, 0,
5163 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5164 msleep(80);
5165 snd_hda_codec_write(codec, 0x21, 0,
5166 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5167
5168 alc_process_coef_fw(codec, coef0255);
5169 msleep(300);
5170 val = alc_read_coef_idx(codec, 0x46);
5171 is_ctia = (val & 0x0070) == 0x0070;
5172
5173 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5174 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5175
5176 snd_hda_codec_write(codec, 0x21, 0,
5177 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5178 msleep(80);
5179 snd_hda_codec_write(codec, 0x21, 0,
5180 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5181 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005182 case 0x10ec0234:
5183 case 0x10ec0274:
5184 case 0x10ec0294:
5185 alc_process_coef_fw(codec, coef0274);
5186 msleep(80);
5187 val = alc_read_coef_idx(codec, 0x46);
5188 is_ctia = (val & 0x00f0) == 0x00f0;
5189 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005190 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005191 case 0x10ec0283:
5192 alc_write_coef_idx(codec, 0x45, 0xd029);
5193 msleep(300);
5194 val = alc_read_coef_idx(codec, 0x46);
5195 is_ctia = (val & 0x0070) == 0x0070;
5196 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005197 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005198 snd_hda_codec_write(codec, 0x21, 0,
5199 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5200 msleep(100);
5201 snd_hda_codec_write(codec, 0x21, 0,
5202 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5203 msleep(200);
5204
5205 val = alc_read_coef_idx(codec, 0x50);
5206 if (val & (1 << 12)) {
5207 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5208 alc_process_coef_fw(codec, coef0288);
5209 msleep(350);
5210 val = alc_read_coef_idx(codec, 0x50);
5211 is_ctia = (val & 0x0070) == 0x0070;
5212 } else {
5213 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5214 alc_process_coef_fw(codec, coef0288);
5215 msleep(350);
5216 val = alc_read_coef_idx(codec, 0x50);
5217 is_ctia = (val & 0x0070) == 0x0070;
5218 }
5219 alc_process_coef_fw(codec, coef0298);
5220 snd_hda_codec_write(codec, 0x21, 0,
5221 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5222 msleep(75);
5223 snd_hda_codec_write(codec, 0x21, 0,
5224 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5225 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005226 case 0x10ec0286:
5227 case 0x10ec0288:
5228 alc_process_coef_fw(codec, coef0288);
5229 msleep(350);
5230 val = alc_read_coef_idx(codec, 0x50);
5231 is_ctia = (val & 0x0070) == 0x0070;
5232 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005233 case 0x10ec0292:
5234 alc_write_coef_idx(codec, 0x6b, 0xd429);
5235 msleep(300);
5236 val = alc_read_coef_idx(codec, 0x6c);
5237 is_ctia = (val & 0x001c) == 0x001c;
5238 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005239 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005240 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005241 msleep(300);
5242 val = alc_read_coef_idx(codec, 0x46);
5243 is_ctia = (val & 0x0070) == 0x0070;
5244 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005245 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005246 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005247 msleep(300);
5248 val = alc_read_coef_idx(codec, 0xbe);
5249 is_ctia = (val & 0x1c02) == 0x1c02;
5250 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005251 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005252 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005253 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005254 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005255 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005256 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005257 snd_hda_codec_write(codec, 0x21, 0,
5258 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5259 msleep(80);
5260 snd_hda_codec_write(codec, 0x21, 0,
5261 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5262
Kailang Yang5a367672017-07-21 15:23:53 +08005263 alc_process_coef_fw(codec, alc225_pre_hsmode);
5264 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5265 val = alc_read_coef_idx(codec, 0x45);
5266 if (val & (1 << 9)) {
5267 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5268 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5269 msleep(800);
5270 val = alc_read_coef_idx(codec, 0x46);
5271 is_ctia = (val & 0x00f0) == 0x00f0;
5272 } else {
5273 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5274 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5275 msleep(800);
5276 val = alc_read_coef_idx(codec, 0x46);
5277 is_ctia = (val & 0x00f0) == 0x00f0;
5278 }
5279 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5280 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5281 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005282
5283 snd_hda_codec_write(codec, 0x21, 0,
5284 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5285 msleep(80);
5286 snd_hda_codec_write(codec, 0x21, 0,
5287 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005288 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005289 case 0x10ec0867:
5290 is_ctia = true;
5291 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005292 }
5293
Takashi Iwai4e76a882014-02-25 12:21:03 +01005294 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005295 is_ctia ? "yes" : "no");
5296 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5297}
5298
5299static void alc_update_headset_mode(struct hda_codec *codec)
5300{
5301 struct alc_spec *spec = codec->spec;
5302
5303 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005304 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005305
5306 int new_headset_mode;
5307
5308 if (!snd_hda_jack_detect(codec, hp_pin))
5309 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5310 else if (mux_pin == spec->headset_mic_pin)
5311 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5312 else if (mux_pin == spec->headphone_mic_pin)
5313 new_headset_mode = ALC_HEADSET_MODE_MIC;
5314 else
5315 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5316
David Henningsson5959a6b2013-11-12 11:10:57 +01005317 if (new_headset_mode == spec->current_headset_mode) {
5318 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005319 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005320 }
David Henningsson73bdd592013-04-15 15:44:14 +02005321
5322 switch (new_headset_mode) {
5323 case ALC_HEADSET_MODE_UNPLUGGED:
5324 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005325 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5326 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005327 spec->gen.hp_jack_present = false;
5328 break;
5329 case ALC_HEADSET_MODE_HEADSET:
5330 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5331 alc_determine_headset_type(codec);
5332 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5333 alc_headset_mode_ctia(codec);
5334 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5335 alc_headset_mode_omtp(codec);
5336 spec->gen.hp_jack_present = true;
5337 break;
5338 case ALC_HEADSET_MODE_MIC:
5339 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5340 spec->gen.hp_jack_present = false;
5341 break;
5342 case ALC_HEADSET_MODE_HEADPHONE:
5343 alc_headset_mode_default(codec);
5344 spec->gen.hp_jack_present = true;
5345 break;
5346 }
5347 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5348 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5349 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005350 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005351 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5352 PIN_VREFHIZ);
5353 }
5354 spec->current_headset_mode = new_headset_mode;
5355
5356 snd_hda_gen_update_outputs(codec);
5357}
5358
5359static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005360 struct snd_kcontrol *kcontrol,
5361 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005362{
5363 alc_update_headset_mode(codec);
5364}
5365
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005366static void alc_update_headset_jack_cb(struct hda_codec *codec,
5367 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005368{
David Henningsson73bdd592013-04-15 15:44:14 +02005369 snd_hda_gen_hp_automute(codec, jack);
5370}
5371
5372static void alc_probe_headset_mode(struct hda_codec *codec)
5373{
5374 int i;
5375 struct alc_spec *spec = codec->spec;
5376 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5377
5378 /* Find mic pins */
5379 for (i = 0; i < cfg->num_inputs; i++) {
5380 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5381 spec->headset_mic_pin = cfg->inputs[i].pin;
5382 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5383 spec->headphone_mic_pin = cfg->inputs[i].pin;
5384 }
5385
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005386 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005387 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5388 spec->gen.automute_hook = alc_update_headset_mode;
5389 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5390}
5391
5392static void alc_fixup_headset_mode(struct hda_codec *codec,
5393 const struct hda_fixup *fix, int action)
5394{
5395 struct alc_spec *spec = codec->spec;
5396
5397 switch (action) {
5398 case HDA_FIXUP_ACT_PRE_PROBE:
5399 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5400 break;
5401 case HDA_FIXUP_ACT_PROBE:
5402 alc_probe_headset_mode(codec);
5403 break;
5404 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005405 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5406 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5407 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5408 }
David Henningsson73bdd592013-04-15 15:44:14 +02005409 alc_update_headset_mode(codec);
5410 break;
5411 }
5412}
5413
5414static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5415 const struct hda_fixup *fix, int action)
5416{
5417 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5418 struct alc_spec *spec = codec->spec;
5419 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5420 }
5421 else
5422 alc_fixup_headset_mode(codec, fix, action);
5423}
5424
Kailang Yang31278992014-03-03 15:27:22 +08005425static void alc255_set_default_jack_type(struct hda_codec *codec)
5426{
5427 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005428 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005429 WRITE_COEF(0x1b, 0x880b),
5430 WRITE_COEF(0x45, 0xd089),
5431 WRITE_COEF(0x1b, 0x080b),
5432 WRITE_COEF(0x46, 0x0004),
5433 WRITE_COEF(0x1b, 0x0c0b),
5434 {}
5435 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005436 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005437 WRITE_COEF(0x1b, 0x884b),
5438 WRITE_COEF(0x45, 0xd089),
5439 WRITE_COEF(0x1b, 0x084b),
5440 WRITE_COEF(0x46, 0x0004),
5441 WRITE_COEF(0x1b, 0x0c4b),
5442 {}
5443 };
5444 switch (codec->core.vendor_id) {
5445 case 0x10ec0255:
5446 alc_process_coef_fw(codec, alc255fw);
5447 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005448 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005449 case 0x10ec0256:
5450 alc_process_coef_fw(codec, alc256fw);
5451 break;
5452 }
Kailang Yang31278992014-03-03 15:27:22 +08005453 msleep(30);
5454}
5455
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005456static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5457 const struct hda_fixup *fix, int action)
5458{
5459 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005460 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005461 }
5462 alc_fixup_headset_mode(codec, fix, action);
5463}
5464
Kailang Yang31278992014-03-03 15:27:22 +08005465static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5466 const struct hda_fixup *fix, int action)
5467{
5468 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5469 struct alc_spec *spec = codec->spec;
5470 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5471 alc255_set_default_jack_type(codec);
5472 }
5473 else
5474 alc_fixup_headset_mode(codec, fix, action);
5475}
5476
Kailang Yange1e62b92015-04-08 16:01:22 +08005477static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5478 struct hda_jack_callback *jack)
5479{
5480 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005481
5482 alc_update_headset_jack_cb(codec, jack);
5483 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005484 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005485}
5486
5487static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5488 const struct hda_fixup *fix, int action)
5489{
5490 alc_fixup_headset_mode(codec, fix, action);
5491 if (action == HDA_FIXUP_ACT_PROBE) {
5492 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005493 /* toggled via hp_automute_hook */
5494 spec->gpio_mask |= 0x40;
5495 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005496 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5497 }
5498}
5499
Hui Wang493a52a2014-01-14 14:07:36 +08005500static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5501 const struct hda_fixup *fix, int action)
5502{
5503 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5504 struct alc_spec *spec = codec->spec;
5505 spec->gen.auto_mute_via_amp = 1;
5506 }
5507}
5508
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005509static void alc_fixup_no_shutup(struct hda_codec *codec,
5510 const struct hda_fixup *fix, int action)
5511{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005512 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005513 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005514 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005515 }
5516}
5517
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005518static void alc_fixup_disable_aamix(struct hda_codec *codec,
5519 const struct hda_fixup *fix, int action)
5520{
5521 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5522 struct alc_spec *spec = codec->spec;
5523 /* Disable AA-loopback as it causes white noise */
5524 spec->gen.mixer_nid = 0;
5525 }
5526}
5527
Takashi Iwai7f57d802015-09-24 17:36:51 +02005528/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5529static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5530 const struct hda_fixup *fix, int action)
5531{
5532 static const struct hda_pintbl pincfgs[] = {
5533 { 0x16, 0x21211010 }, /* dock headphone */
5534 { 0x19, 0x21a11010 }, /* dock mic */
5535 { }
5536 };
5537 struct alc_spec *spec = codec->spec;
5538
5539 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Hui Wang871b9062019-08-14 12:09:08 +08005540 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02005541 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5542 codec->power_save_node = 0; /* avoid click noises */
5543 snd_hda_apply_pincfgs(codec, pincfgs);
5544 }
5545}
5546
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005547static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5548 const struct hda_fixup *fix, int action)
5549{
5550 static const struct hda_pintbl pincfgs[] = {
5551 { 0x17, 0x21211010 }, /* dock headphone */
5552 { 0x19, 0x21a11010 }, /* dock mic */
5553 { }
5554 };
5555 struct alc_spec *spec = codec->spec;
5556
5557 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5558 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005559 snd_hda_apply_pincfgs(codec, pincfgs);
5560 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005561 /* Enable DOCK device */
5562 snd_hda_codec_write(codec, 0x17, 0,
5563 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5564 /* Enable DOCK device */
5565 snd_hda_codec_write(codec, 0x19, 0,
5566 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005567 }
5568}
5569
Takashi Iwai399c01a2020-05-26 08:24:06 +02005570static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5571 const struct hda_fixup *fix, int action)
5572{
5573 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5574 * the speaker output becomes too low by some reason on Thinkpads with
5575 * ALC298 codec
5576 */
5577 static const hda_nid_t preferred_pairs[] = {
5578 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5579 0
5580 };
5581 struct alc_spec *spec = codec->spec;
5582
5583 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5584 spec->gen.preferred_dacs = preferred_pairs;
5585}
5586
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005587static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005588{
5589 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005590 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005591
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005592 /* Prevent pop noises when headphones are plugged in */
5593 snd_hda_codec_write(codec, hp_pin, 0,
5594 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5595 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005596}
5597
5598static void alc_fixup_dell_xps13(struct hda_codec *codec,
5599 const struct hda_fixup *fix, int action)
5600{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005601 struct alc_spec *spec = codec->spec;
5602 struct hda_input_mux *imux = &spec->gen.input_mux;
5603 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005604
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005605 switch (action) {
5606 case HDA_FIXUP_ACT_PRE_PROBE:
5607 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5608 * it causes a click noise at start up
5609 */
5610 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005611 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005612 break;
5613 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005614 /* Make the internal mic the default input source. */
5615 for (i = 0; i < imux->num_items; i++) {
5616 if (spec->gen.imux_pins[i] == 0x12) {
5617 spec->gen.cur_mux[0] = i;
5618 break;
5619 }
5620 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005621 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005622 }
5623}
5624
David Henningsson1f8b46c2015-05-12 14:38:15 +02005625static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5626 const struct hda_fixup *fix, int action)
5627{
5628 struct alc_spec *spec = codec->spec;
5629
5630 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5631 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5632 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005633
5634 /* Disable boost for mic-in permanently. (This code is only called
5635 from quirks that guarantee that the headphone is at NID 0x1b.) */
5636 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5637 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005638 } else
5639 alc_fixup_headset_mode(codec, fix, action);
5640}
5641
David Henningsson73bdd592013-04-15 15:44:14 +02005642static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5643 const struct hda_fixup *fix, int action)
5644{
5645 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005646 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005647 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005648 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5649 }
5650 alc_fixup_headset_mode(codec, fix, action);
5651}
5652
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005653/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5654static int find_ext_mic_pin(struct hda_codec *codec)
5655{
5656 struct alc_spec *spec = codec->spec;
5657 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5658 hda_nid_t nid;
5659 unsigned int defcfg;
5660 int i;
5661
5662 for (i = 0; i < cfg->num_inputs; i++) {
5663 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5664 continue;
5665 nid = cfg->inputs[i].pin;
5666 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5667 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5668 continue;
5669 return nid;
5670 }
5671
5672 return 0;
5673}
5674
Dylan Reid08a978d2012-11-18 22:56:40 -08005675static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005676 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005677 int action)
5678{
5679 struct alc_spec *spec = codec->spec;
5680
Takashi Iwai0db75792013-01-23 13:57:20 +01005681 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005682 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005683 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005684
5685 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005686 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005687 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005688 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005689}
David Henningsson693b6132012-06-22 19:12:10 +02005690
David Henningsson3e0d6112013-04-22 14:30:14 +02005691static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5692 const struct hda_fixup *fix,
5693 int action)
5694{
5695 struct alc_spec *spec = codec->spec;
5696 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5697 int i;
5698
5699 /* The mic boosts on level 2 and 3 are too noisy
5700 on the internal mic input.
5701 Therefore limit the boost to 0 or 1. */
5702
5703 if (action != HDA_FIXUP_ACT_PROBE)
5704 return;
5705
5706 for (i = 0; i < cfg->num_inputs; i++) {
5707 hda_nid_t nid = cfg->inputs[i].pin;
5708 unsigned int defcfg;
5709 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5710 continue;
5711 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5712 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5713 continue;
5714
5715 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5716 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5717 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5718 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5719 (0 << AC_AMPCAP_MUTE_SHIFT));
5720 }
5721}
5722
Kailang Yangcd217a62013-08-22 10:15:24 +02005723static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005724 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005725{
5726 struct alc_spec *spec = codec->spec;
5727 int vref;
5728
5729 msleep(200);
5730 snd_hda_gen_hp_automute(codec, jack);
5731
5732 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5733
5734 msleep(600);
5735 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5736 vref);
5737}
5738
Kailang Yangcd217a62013-08-22 10:15:24 +02005739static void alc283_fixup_chromebook(struct hda_codec *codec,
5740 const struct hda_fixup *fix, int action)
5741{
5742 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005743
5744 switch (action) {
5745 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005746 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005747 /* Disable AA-loopback as it causes white noise */
5748 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005749 break;
5750 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005751 /* MIC2-VREF control */
5752 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005753 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005754 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005755 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005756 break;
5757 }
5758}
5759
5760static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5761 const struct hda_fixup *fix, int action)
5762{
5763 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005764
5765 switch (action) {
5766 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005767 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5768 break;
5769 case HDA_FIXUP_ACT_INIT:
5770 /* MIC2-VREF control */
5771 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005772 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005773 break;
5774 }
5775}
5776
Takashi Iwai7bba2152013-09-06 15:45:38 +02005777/* mute tablet speaker pin (0x14) via dock plugging in addition */
5778static void asus_tx300_automute(struct hda_codec *codec)
5779{
5780 struct alc_spec *spec = codec->spec;
5781 snd_hda_gen_update_outputs(codec);
5782 if (snd_hda_jack_detect(codec, 0x1b))
5783 spec->gen.mute_bits |= (1ULL << 0x14);
5784}
5785
5786static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5787 const struct hda_fixup *fix, int action)
5788{
5789 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005790 static const struct hda_pintbl dock_pins[] = {
5791 { 0x1b, 0x21114000 }, /* dock speaker pin */
5792 {}
5793 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005794
5795 switch (action) {
5796 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005797 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02005798 /* TX300 needs to set up GPIO2 for the speaker amp */
5799 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02005800 snd_hda_apply_pincfgs(codec, dock_pins);
5801 spec->gen.auto_mute_via_amp = 1;
5802 spec->gen.automute_hook = asus_tx300_automute;
5803 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005804 snd_hda_gen_hp_automute);
5805 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005806 case HDA_FIXUP_ACT_PROBE:
5807 spec->init_amp = ALC_INIT_DEFAULT;
5808 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005809 case HDA_FIXUP_ACT_BUILD:
5810 /* this is a bit tricky; give more sane names for the main
5811 * (tablet) speaker and the dock speaker, respectively
5812 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005813 rename_ctl(codec, "Speaker Playback Switch",
5814 "Dock Speaker Playback Switch");
5815 rename_ctl(codec, "Bass Speaker Playback Switch",
5816 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005817 break;
5818 }
5819}
5820
David Henningsson338cae52013-10-07 10:39:59 +02005821static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5822 const struct hda_fixup *fix, int action)
5823{
David Henningsson0f4881d2013-12-20 16:08:13 +01005824 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5825 /* DAC node 0x03 is giving mono output. We therefore want to
5826 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5827 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005828 static const hda_nid_t conn1[] = { 0x0c };
5829 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
5830 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01005831 }
David Henningsson338cae52013-10-07 10:39:59 +02005832}
5833
Hui Wangdd9aa332016-08-01 10:20:32 +08005834static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5835 const struct hda_fixup *fix, int action)
5836{
5837 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5838 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5839 we can't adjust the speaker's volume since this node does not has
5840 Amp-out capability. we change the speaker's route to:
5841 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5842 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5843 speaker's volume now. */
5844
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005845 static const hda_nid_t conn1[] = { 0x0c };
5846 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08005847 }
5848}
5849
Takashi Iwaie312a862018-03-06 12:14:17 +01005850/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5851static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5852 const struct hda_fixup *fix, int action)
5853{
5854 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005855 static const hda_nid_t conn[] = { 0x02, 0x03 };
5856 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01005857 }
5858}
5859
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01005860/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
5861static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
5862 const struct hda_fixup *fix, int action)
5863{
5864 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005865 static const hda_nid_t conn[] = { 0x02 };
5866 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01005867 }
5868}
5869
Keith Packard98973f22015-07-15 12:14:39 -07005870/* Hook to update amp GPIO4 for automute */
5871static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5872 struct hda_jack_callback *jack)
5873{
5874 struct alc_spec *spec = codec->spec;
5875
5876 snd_hda_gen_hp_automute(codec, jack);
5877 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08005878 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
5879 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07005880}
5881
5882/* Manage GPIOs for HP EliteBook Folio 9480m.
5883 *
5884 * GPIO4 is the headphone amplifier power control
5885 * GPIO3 is the audio output mute indicator LED
5886 */
5887
5888static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5889 const struct hda_fixup *fix,
5890 int action)
5891{
5892 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07005893
Takashi Iwai01e4a272018-06-19 22:47:30 +02005894 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07005895 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02005896 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5897 spec->gpio_mask |= 0x10;
5898 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07005899 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07005900 }
5901}
5902
Takashi Iwaiae065f12018-06-19 23:00:03 +02005903static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5904 const struct hda_fixup *fix,
5905 int action)
5906{
5907 struct alc_spec *spec = codec->spec;
5908
5909 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5910 spec->gpio_mask |= 0x04;
5911 spec->gpio_dir |= 0x04;
5912 /* set data bit low */
5913 }
5914}
5915
Takashi Iwai6a6660d2020-09-03 10:33:00 +02005916/* Quirk for Thinkpad X1 7th and 8th Gen
5917 * The following fixed routing needed
5918 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
5919 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
5920 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
5921 */
5922static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
5923 const struct hda_fixup *fix, int action)
5924{
5925 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
5926 static const hda_nid_t preferred_pairs[] = {
5927 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
5928 };
5929 struct alc_spec *spec = codec->spec;
5930
5931 switch (action) {
5932 case HDA_FIXUP_ACT_PRE_PROBE:
5933 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
5934 spec->gen.preferred_dacs = preferred_pairs;
5935 break;
5936 case HDA_FIXUP_ACT_BUILD:
5937 /* The generic parser creates somewhat unintuitive volume ctls
5938 * with the fixed routing above, and the shared DAC2 may be
5939 * confusing for PA.
5940 * Rename those to unique names so that PA doesn't touch them
5941 * and use only Master volume.
5942 */
5943 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
5944 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
5945 break;
5946 }
5947}
5948
Kailang Yangca169cc2017-04-25 16:17:40 +08005949static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5950 const struct hda_fixup *fix,
5951 int action)
5952{
5953 alc_fixup_dual_codecs(codec, fix, action);
5954 switch (action) {
5955 case HDA_FIXUP_ACT_PRE_PROBE:
5956 /* override card longname to provide a unique UCM profile */
5957 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5958 break;
5959 case HDA_FIXUP_ACT_BUILD:
5960 /* rename Capture controls depending on the codec */
5961 rename_ctl(codec, "Capture Volume",
5962 codec->addr == 0 ?
5963 "Rear-Panel Capture Volume" :
5964 "Front-Panel Capture Volume");
5965 rename_ctl(codec, "Capture Switch",
5966 codec->addr == 0 ?
5967 "Rear-Panel Capture Switch" :
5968 "Front-Panel Capture Switch");
5969 break;
5970 }
5971}
5972
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08005973static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
5974 const struct hda_fixup *fix, int action)
5975{
5976 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5977 return;
5978
5979 codec->power_save_node = 1;
5980}
5981
Kailang Yang92266652017-12-14 15:28:58 +08005982/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5983static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5984 const struct hda_fixup *fix, int action)
5985{
5986 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005987 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08005988 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5989 0
5990 };
5991
5992 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5993 return;
5994
5995 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08005996 spec->gen.auto_mute_via_amp = 1;
5997 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08005998}
5999
Hui Wangc4cfcf62018-11-26 14:17:16 +08006000/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6001static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6002 const struct hda_fixup *fix, int action)
6003{
6004 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6005 return;
6006
6007 snd_hda_override_wcaps(codec, 0x03, 0);
6008}
6009
Kailang Yang8983eb62019-04-03 15:31:49 +08006010static void alc295_fixup_chromebook(struct hda_codec *codec,
6011 const struct hda_fixup *fix, int action)
6012{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006013 struct alc_spec *spec = codec->spec;
6014
Kailang Yang8983eb62019-04-03 15:31:49 +08006015 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006016 case HDA_FIXUP_ACT_PRE_PROBE:
6017 spec->ultra_low_power = true;
6018 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006019 case HDA_FIXUP_ACT_INIT:
6020 switch (codec->core.vendor_id) {
6021 case 0x10ec0295:
6022 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6023 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6024 break;
6025 case 0x10ec0236:
6026 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6027 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6028 break;
6029 }
6030 break;
6031 }
6032}
6033
Kailang Yangd1dd4212019-01-09 17:05:24 +08006034static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6035 const struct hda_fixup *fix, int action)
6036{
6037 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6038 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6039}
6040
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006041
6042static void alc294_gx502_toggle_output(struct hda_codec *codec,
6043 struct hda_jack_callback *cb)
6044{
6045 /* The Windows driver sets the codec up in a very different way where
6046 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6047 */
6048 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6049 alc_write_coef_idx(codec, 0x10, 0x8a20);
6050 else
6051 alc_write_coef_idx(codec, 0x10, 0x0a20);
6052}
6053
6054static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6055 const struct hda_fixup *fix, int action)
6056{
6057 /* Pin 0x21: headphones/headset mic */
6058 if (!is_jack_detectable(codec, 0x21))
6059 return;
6060
6061 switch (action) {
6062 case HDA_FIXUP_ACT_PRE_PROBE:
6063 snd_hda_jack_detect_enable_callback(codec, 0x21,
6064 alc294_gx502_toggle_output);
6065 break;
6066 case HDA_FIXUP_ACT_INIT:
6067 /* Make sure to start in a correct state, i.e. if
6068 * headphones have been plugged in before powering up the system
6069 */
6070 alc294_gx502_toggle_output(codec, NULL);
6071 break;
6072 }
6073}
6074
Kailang Yang56496252020-07-29 15:09:27 +08006075static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6076 const struct hda_fixup *fix, int action)
6077{
6078 if (action != HDA_FIXUP_ACT_INIT)
6079 return;
6080
6081 msleep(100);
6082 alc_write_coef_idx(codec, 0x65, 0x0);
6083}
6084
Takashi Iwaib317b032014-01-08 11:44:21 +01006085/* for hda_fixup_thinkpad_acpi() */
6086#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006087
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006088static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6089 const struct hda_fixup *fix, int action)
6090{
6091 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6092 hda_fixup_thinkpad_acpi(codec, fix, action);
6093}
6094
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006095/* for alc295_fixup_hp_top_speakers */
6096#include "hp_x360_helper.c"
6097
Takashi Iwai1d045db2011-07-07 18:23:21 +02006098enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006099 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006100 ALC269_FIXUP_SONY_VAIO,
6101 ALC275_FIXUP_SONY_VAIO_GPIO2,
6102 ALC269_FIXUP_DELL_M101Z,
6103 ALC269_FIXUP_SKU_IGNORE,
6104 ALC269_FIXUP_ASUS_G73JW,
6105 ALC269_FIXUP_LENOVO_EAPD,
6106 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006107 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006108 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006109 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006110 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006111 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006112 ALC269_FIXUP_QUANTA_MUTE,
6113 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006114 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006115 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006116 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006117 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006118 ALC269_FIXUP_AMIC,
6119 ALC269_FIXUP_DMIC,
6120 ALC269VB_FIXUP_AMIC,
6121 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006122 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006123 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006124 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006125 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006126 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006127 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6128 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006129 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006130 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006131 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006132 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006133 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006134 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006135 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6136 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006137 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006138 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006139 ALC269_FIXUP_HEADSET_MODE,
6140 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006141 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006142 ALC269_FIXUP_ASUS_X101_FUNC,
6143 ALC269_FIXUP_ASUS_X101_VERB,
6144 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006145 ALC271_FIXUP_AMIC_MIC2,
6146 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006147 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006148 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006149 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006150 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006151 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006152 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006153 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006154 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006155 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006156 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006157 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006158 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006159 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6160 ALC290_FIXUP_SUBWOOFER,
6161 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006162 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006163 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006164 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006165 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006166 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006167 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006168 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006169 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006170 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006171 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006172 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006173 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006174 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006175 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01006176 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006177 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006178 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006179 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006180 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006181 ALC280_FIXUP_HP_9480M,
Kailang Yange1e62b92015-04-08 16:01:22 +08006182 ALC288_FIXUP_DELL_HEADSET_MODE,
6183 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006184 ALC288_FIXUP_DELL_XPS_13,
6185 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006186 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006187 ALC292_FIXUP_DELL_E7X,
6188 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006189 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006190 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006191 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006192 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006193 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006194 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006195 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006196 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006197 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006198 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006199 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006200 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006201 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006202 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006203 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006204 ALC298_FIXUP_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006205 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006206 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006207 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006208 ALC256_FIXUP_ASUS_HEADSET_MODE,
6209 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006210 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006211 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6212 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006213 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006214 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006215 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006216 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006217 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006218 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006219 ALC274_FIXUP_DELL_BIND_DACS,
6220 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006221 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006222 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006223 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006224 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006225 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006226 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006227 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006228 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006229 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006230 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006231 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006232 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006233 ALC294_FIXUP_ASUS_HEADSET_MIC,
6234 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006235 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006236 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006237 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006238 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006239 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006240 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6241 ALC225_FIXUP_WYSE_AUTO_MUTE,
6242 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006243 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006244 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006245 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006246 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006247 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006248 ALC289_FIXUP_DELL_SPK2,
6249 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006250 ALC294_FIXUP_SPK2_TO_DAC1,
6251 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006252 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006253 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006254 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006255 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006256 ALC294_FIXUP_ASUS_GX502_HP,
6257 ALC294_FIXUP_ASUS_GX502_PINS,
6258 ALC294_FIXUP_ASUS_GX502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006259 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006260 ALC285_FIXUP_HP_MUTE_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006261 ALC236_FIXUP_HP_MUTE_LED,
Mike Pozulp14425f12020-05-09 20:28:37 -07006262 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006263 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006264 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006265 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006266 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006267 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006268 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006269 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006270 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006271 ALC269_FIXUP_CZC_B20,
6272 ALC269_FIXUP_CZC_TMI,
6273 ALC269_FIXUP_CZC_L101,
6274 ALC269_FIXUP_LEMOTE_A1802,
6275 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006276 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Hui Wangfc19d552020-09-09 10:00:41 +08006277 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006278 ALC274_FIXUP_HP_MIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006279};
6280
Takashi Iwai1727a772013-01-10 09:52:52 +01006281static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006282 [ALC269_FIXUP_GPIO2] = {
6283 .type = HDA_FIXUP_FUNC,
6284 .v.func = alc_fixup_gpio2,
6285 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006286 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01006287 .type = HDA_FIXUP_PINCTLS,
6288 .v.pins = (const struct hda_pintbl[]) {
6289 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006290 {}
6291 }
6292 },
6293 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006294 .type = HDA_FIXUP_FUNC,
6295 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006296 .chained = true,
6297 .chain_id = ALC269_FIXUP_SONY_VAIO
6298 },
6299 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006300 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006301 .v.verbs = (const struct hda_verb[]) {
6302 /* Enables internal speaker */
6303 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6304 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6305 {}
6306 }
6307 },
6308 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006309 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02006310 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006311 },
6312 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006313 .type = HDA_FIXUP_PINS,
6314 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02006315 { 0x17, 0x99130111 }, /* subwoofer */
6316 { }
6317 }
6318 },
6319 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006320 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006321 .v.verbs = (const struct hda_verb[]) {
6322 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6323 {}
6324 }
6325 },
6326 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006327 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006328 .v.func = alc269_fixup_hweq,
6329 .chained = true,
6330 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6331 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006332 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6333 .type = HDA_FIXUP_FUNC,
6334 .v.func = alc_fixup_disable_aamix,
6335 .chained = true,
6336 .chain_id = ALC269_FIXUP_SONY_VAIO
6337 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006338 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006339 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006340 .v.func = alc271_fixup_dmic,
6341 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02006342 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006343 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006344 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02006345 .chained = true,
6346 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02006347 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006348 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006349 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006350 .v.func = alc269_fixup_stereo_dmic,
6351 },
David Henningsson7c478f02013-10-11 10:18:46 +02006352 [ALC269_FIXUP_HEADSET_MIC] = {
6353 .type = HDA_FIXUP_FUNC,
6354 .v.func = alc269_fixup_headset_mic,
6355 },
Takashi Iwai24519912011-08-16 15:08:49 +02006356 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006357 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02006358 .v.func = alc269_fixup_quanta_mute,
6359 },
6360 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006361 .type = HDA_FIXUP_PINS,
6362 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02006363 { 0x1a, 0x2101103f }, /* dock line-out */
6364 { 0x1b, 0x23a11040 }, /* dock mic-in */
6365 { }
6366 },
6367 .chained = true,
6368 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6369 },
David Henningsson2041d562014-06-13 11:15:44 +02006370 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6371 .type = HDA_FIXUP_PINS,
6372 .v.pins = (const struct hda_pintbl[]) {
6373 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6374 { }
6375 },
6376 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006377 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6378 .type = HDA_FIXUP_PINS,
6379 .v.pins = (const struct hda_pintbl[]) {
6380 { 0x21, 0x0221102f }, /* HP out */
6381 { }
6382 },
6383 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006384 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6385 .type = HDA_FIXUP_FUNC,
6386 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6387 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006388 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6389 .type = HDA_FIXUP_FUNC,
6390 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6391 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02006392 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006393 .type = HDA_FIXUP_PINS,
6394 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006395 { 0x14, 0x99130110 }, /* speaker */
6396 { 0x15, 0x0121401f }, /* HP out */
6397 { 0x18, 0x01a19c20 }, /* mic */
6398 { 0x19, 0x99a3092f }, /* int-mic */
6399 { }
6400 },
6401 },
6402 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006403 .type = HDA_FIXUP_PINS,
6404 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006405 { 0x12, 0x99a3092f }, /* int-mic */
6406 { 0x14, 0x99130110 }, /* speaker */
6407 { 0x15, 0x0121401f }, /* HP out */
6408 { 0x18, 0x01a19c20 }, /* mic */
6409 { }
6410 },
6411 },
6412 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006413 .type = HDA_FIXUP_PINS,
6414 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006415 { 0x14, 0x99130110 }, /* speaker */
6416 { 0x18, 0x01a19c20 }, /* mic */
6417 { 0x19, 0x99a3092f }, /* int-mic */
6418 { 0x21, 0x0121401f }, /* HP out */
6419 { }
6420 },
6421 },
David Henningsson2267ea92012-01-03 08:45:56 +01006422 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006423 .type = HDA_FIXUP_PINS,
6424 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006425 { 0x12, 0x99a3092f }, /* int-mic */
6426 { 0x14, 0x99130110 }, /* speaker */
6427 { 0x18, 0x01a19c20 }, /* mic */
6428 { 0x21, 0x0121401f }, /* HP out */
6429 { }
6430 },
6431 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006432 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006433 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006434 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01006435 },
David Henningssond06ac142013-02-18 11:41:55 +01006436 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6437 .type = HDA_FIXUP_FUNC,
6438 .v.func = alc269_fixup_hp_mute_led_mic1,
6439 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006440 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006441 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006442 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01006443 },
Tom Briden7f783bd2017-03-25 10:12:01 +00006444 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6445 .type = HDA_FIXUP_FUNC,
6446 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006447 .chained = true,
6448 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00006449 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006450 [ALC269_FIXUP_HP_GPIO_LED] = {
6451 .type = HDA_FIXUP_FUNC,
6452 .v.func = alc269_fixup_hp_gpio_led,
6453 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006454 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6455 .type = HDA_FIXUP_FUNC,
6456 .v.func = alc269_fixup_hp_gpio_mic1_led,
6457 },
6458 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6459 .type = HDA_FIXUP_FUNC,
6460 .v.func = alc269_fixup_hp_line1_mic1_led,
6461 },
David Henningsson693b6132012-06-22 19:12:10 +02006462 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006463 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02006464 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02006465 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006466 [ALC269_FIXUP_NO_SHUTUP] = {
6467 .type = HDA_FIXUP_FUNC,
6468 .v.func = alc_fixup_no_shutup,
6469 },
David Henningsson108cc102012-07-20 10:37:25 +02006470 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006471 .type = HDA_FIXUP_PINS,
6472 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02006473 { 0x19, 0x23a11040 }, /* dock mic */
6474 { 0x1b, 0x2121103f }, /* dock headphone */
6475 { }
6476 },
6477 .chained = true,
6478 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6479 },
Takashi Iwaib590b382020-05-14 18:05:33 +02006480 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6481 .type = HDA_FIXUP_FUNC,
6482 .v.func = alc269_fixup_limit_int_mic_boost,
6483 .chained = true,
6484 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6485 },
David Henningsson108cc102012-07-20 10:37:25 +02006486 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006487 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02006488 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01006489 .chained = true,
6490 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02006491 },
David Henningsson73bdd592013-04-15 15:44:14 +02006492 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6493 .type = HDA_FIXUP_PINS,
6494 .v.pins = (const struct hda_pintbl[]) {
6495 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6496 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6497 { }
6498 },
6499 .chained = true,
6500 .chain_id = ALC269_FIXUP_HEADSET_MODE
6501 },
6502 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6503 .type = HDA_FIXUP_PINS,
6504 .v.pins = (const struct hda_pintbl[]) {
6505 { 0x16, 0x21014020 }, /* dock line out */
6506 { 0x19, 0x21a19030 }, /* dock mic */
6507 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6508 { }
6509 },
6510 .chained = true,
6511 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6512 },
David Henningsson338cae52013-10-07 10:39:59 +02006513 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6514 .type = HDA_FIXUP_PINS,
6515 .v.pins = (const struct hda_pintbl[]) {
6516 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6517 { }
6518 },
6519 .chained = true,
6520 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6521 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08006522 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6523 .type = HDA_FIXUP_PINS,
6524 .v.pins = (const struct hda_pintbl[]) {
6525 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6526 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6527 { }
6528 },
6529 .chained = true,
6530 .chain_id = ALC269_FIXUP_HEADSET_MODE
6531 },
David Henningsson73bdd592013-04-15 15:44:14 +02006532 [ALC269_FIXUP_HEADSET_MODE] = {
6533 .type = HDA_FIXUP_FUNC,
6534 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08006535 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006536 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02006537 },
6538 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6539 .type = HDA_FIXUP_FUNC,
6540 .v.func = alc_fixup_headset_mode_no_hp_mic,
6541 },
Takashi Iwai78197172015-06-27 10:21:13 +02006542 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6543 .type = HDA_FIXUP_PINS,
6544 .v.pins = (const struct hda_pintbl[]) {
6545 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6546 { }
6547 },
6548 .chained = true,
6549 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6550 },
David Henningsson88cfcf82013-10-11 10:18:45 +02006551 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6552 .type = HDA_FIXUP_PINS,
6553 .v.pins = (const struct hda_pintbl[]) {
6554 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6555 { }
6556 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02006557 .chained = true,
6558 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02006559 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006560 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006561 .type = HDA_FIXUP_PINS,
6562 .v.pins = (const struct hda_pintbl[]) {
6563 {0x12, 0x90a60130},
6564 {0x13, 0x40000000},
6565 {0x14, 0x90170110},
6566 {0x18, 0x411111f0},
6567 {0x19, 0x04a11040},
6568 {0x1a, 0x411111f0},
6569 {0x1b, 0x90170112},
6570 {0x1d, 0x40759a05},
6571 {0x1e, 0x411111f0},
6572 {0x21, 0x04211020},
6573 { }
6574 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05006575 .chained = true,
6576 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006577 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006578 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6579 .type = HDA_FIXUP_FUNC,
6580 .v.func = alc298_fixup_huawei_mbx_stereo,
6581 .chained = true,
6582 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6583 },
David Henningssond240d1d2013-04-15 12:50:02 +02006584 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6585 .type = HDA_FIXUP_FUNC,
6586 .v.func = alc269_fixup_x101_headset_mic,
6587 },
6588 [ALC269_FIXUP_ASUS_X101_VERB] = {
6589 .type = HDA_FIXUP_VERBS,
6590 .v.verbs = (const struct hda_verb[]) {
6591 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6592 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6593 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6594 { }
6595 },
6596 .chained = true,
6597 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6598 },
6599 [ALC269_FIXUP_ASUS_X101] = {
6600 .type = HDA_FIXUP_PINS,
6601 .v.pins = (const struct hda_pintbl[]) {
6602 { 0x18, 0x04a1182c }, /* Headset mic */
6603 { }
6604 },
6605 .chained = true,
6606 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6607 },
Dylan Reid08a978d2012-11-18 22:56:40 -08006608 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006609 .type = HDA_FIXUP_PINS,
6610 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08006611 { 0x14, 0x99130110 }, /* speaker */
6612 { 0x19, 0x01a19c20 }, /* mic */
6613 { 0x1b, 0x99a7012f }, /* int-mic */
6614 { 0x21, 0x0121401f }, /* HP out */
6615 { }
6616 },
6617 },
6618 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006619 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08006620 .v.func = alc271_hp_gate_mic_jack,
6621 .chained = true,
6622 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6623 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006624 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6625 .type = HDA_FIXUP_FUNC,
6626 .v.func = alc269_fixup_limit_int_mic_boost,
6627 .chained = true,
6628 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6629 },
Dylan Reid42397002013-04-05 14:58:22 -07006630 [ALC269_FIXUP_ACER_AC700] = {
6631 .type = HDA_FIXUP_PINS,
6632 .v.pins = (const struct hda_pintbl[]) {
6633 { 0x12, 0x99a3092f }, /* int-mic */
6634 { 0x14, 0x99130110 }, /* speaker */
6635 { 0x18, 0x03a11c20 }, /* mic */
6636 { 0x1e, 0x0346101e }, /* SPDIF1 */
6637 { 0x21, 0x0321101f }, /* HP out */
6638 { }
6639 },
6640 .chained = true,
6641 .chain_id = ALC271_FIXUP_DMIC,
6642 },
David Henningsson3e0d6112013-04-22 14:30:14 +02006643 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6644 .type = HDA_FIXUP_FUNC,
6645 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01006646 .chained = true,
6647 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02006648 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01006649 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6650 .type = HDA_FIXUP_FUNC,
6651 .v.func = alc269_fixup_limit_int_mic_boost,
6652 .chained = true,
6653 .chain_id = ALC269VB_FIXUP_DMIC,
6654 },
Takashi Iwai23870832013-11-29 14:13:12 +01006655 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6656 .type = HDA_FIXUP_VERBS,
6657 .v.verbs = (const struct hda_verb[]) {
6658 /* class-D output amp +5dB */
6659 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6660 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6661 {}
6662 },
6663 .chained = true,
6664 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6665 },
David Henningsson8e35cd42013-11-06 11:20:01 +01006666 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6667 .type = HDA_FIXUP_FUNC,
6668 .v.func = alc269_fixup_limit_int_mic_boost,
6669 .chained = true,
6670 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6671 },
Anisse Astier02b504d2013-06-03 11:53:10 +02006672 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6673 .type = HDA_FIXUP_PINS,
6674 .v.pins = (const struct hda_pintbl[]) {
6675 { 0x12, 0x99a3092f }, /* int-mic */
6676 { 0x18, 0x03a11d20 }, /* mic */
6677 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6678 { }
6679 },
6680 },
Kailang Yangcd217a62013-08-22 10:15:24 +02006681 [ALC283_FIXUP_CHROME_BOOK] = {
6682 .type = HDA_FIXUP_FUNC,
6683 .v.func = alc283_fixup_chromebook,
6684 },
Kailang Yang0202e992013-12-02 15:20:15 +08006685 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6686 .type = HDA_FIXUP_FUNC,
6687 .v.func = alc283_fixup_sense_combo_jack,
6688 .chained = true,
6689 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6690 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02006691 [ALC282_FIXUP_ASUS_TX300] = {
6692 .type = HDA_FIXUP_FUNC,
6693 .v.func = alc282_fixup_asus_tx300,
6694 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02006695 [ALC283_FIXUP_INT_MIC] = {
6696 .type = HDA_FIXUP_VERBS,
6697 .v.verbs = (const struct hda_verb[]) {
6698 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6699 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6700 { }
6701 },
6702 .chained = true,
6703 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6704 },
David Henningsson0f4881d2013-12-20 16:08:13 +01006705 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6706 .type = HDA_FIXUP_PINS,
6707 .v.pins = (const struct hda_pintbl[]) {
6708 { 0x17, 0x90170112 }, /* subwoofer */
6709 { }
6710 },
6711 .chained = true,
6712 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6713 },
6714 [ALC290_FIXUP_SUBWOOFER] = {
6715 .type = HDA_FIXUP_PINS,
6716 .v.pins = (const struct hda_pintbl[]) {
6717 { 0x17, 0x90170112 }, /* subwoofer */
6718 { }
6719 },
6720 .chained = true,
6721 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6722 },
David Henningsson338cae52013-10-07 10:39:59 +02006723 [ALC290_FIXUP_MONO_SPEAKERS] = {
6724 .type = HDA_FIXUP_FUNC,
6725 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01006726 },
6727 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6728 .type = HDA_FIXUP_FUNC,
6729 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02006730 .chained = true,
6731 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6732 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01006733 [ALC269_FIXUP_THINKPAD_ACPI] = {
6734 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006735 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02006736 .chained = true,
6737 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006738 },
David Henningsson56f27012016-01-11 09:33:14 +01006739 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6740 .type = HDA_FIXUP_FUNC,
6741 .v.func = alc_fixup_inv_dmic,
6742 .chained = true,
6743 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6744 },
Chris Chiu5824ce82017-02-28 14:17:11 -06006745 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08006746 .type = HDA_FIXUP_PINS,
6747 .v.pins = (const struct hda_pintbl[]) {
6748 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6749 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06006750 },
6751 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08006752 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06006753 },
Chris Chiu615966a2017-02-28 14:17:12 -06006754 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6755 .type = HDA_FIXUP_PINS,
6756 .v.pins = (const struct hda_pintbl[]) {
6757 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6758 { }
6759 },
6760 .chained = true,
6761 .chain_id = ALC255_FIXUP_HEADSET_MODE
6762 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006763 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6764 .type = HDA_FIXUP_PINS,
6765 .v.pins = (const struct hda_pintbl[]) {
6766 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6767 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6768 { }
6769 },
6770 .chained = true,
6771 .chain_id = ALC255_FIXUP_HEADSET_MODE
6772 },
Kailang Yang31278992014-03-03 15:27:22 +08006773 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6774 .type = HDA_FIXUP_PINS,
6775 .v.pins = (const struct hda_pintbl[]) {
6776 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6777 { }
6778 },
6779 .chained = true,
6780 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6781 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006782 [ALC255_FIXUP_HEADSET_MODE] = {
6783 .type = HDA_FIXUP_FUNC,
6784 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08006785 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006786 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006787 },
Kailang Yang31278992014-03-03 15:27:22 +08006788 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6789 .type = HDA_FIXUP_FUNC,
6790 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6791 },
Kailang Yanga22aa262014-04-23 17:34:28 +08006792 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6793 .type = HDA_FIXUP_PINS,
6794 .v.pins = (const struct hda_pintbl[]) {
6795 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6796 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6797 { }
6798 },
6799 .chained = true,
6800 .chain_id = ALC269_FIXUP_HEADSET_MODE
6801 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02006802 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02006803 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02006804 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006805 .chained = true,
6806 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6807 },
Takashi Iwai9a811232015-12-09 15:17:43 +01006808 [ALC292_FIXUP_TPT440] = {
6809 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01006810 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01006811 .chained = true,
6812 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6813 },
Anisse Astierabaa22742016-08-24 09:14:13 +02006814 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01006815 .type = HDA_FIXUP_PINS,
6816 .v.pins = (const struct hda_pintbl[]) {
6817 { 0x19, 0x04a110f0 },
6818 { },
6819 },
6820 },
Takashi Iwaib3802782018-11-26 17:47:46 +01006821 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08006822 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02006823 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08006824 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006825 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6826 .type = HDA_FIXUP_PINS,
6827 .v.pins = (const struct hda_pintbl[]) {
6828 { 0x12, 0x90a60130 },
6829 { 0x14, 0x90170110 },
6830 { 0x17, 0x40000008 },
6831 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02006832 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006833 { 0x1a, 0x411111f0 },
6834 { 0x1b, 0x411111f0 },
6835 { 0x1d, 0x40f89b2d },
6836 { 0x1e, 0x411111f0 },
6837 { 0x21, 0x0321101f },
6838 { },
6839 },
6840 },
David Henningsson7a5255f2014-10-30 08:26:01 +01006841 [ALC280_FIXUP_HP_GPIO4] = {
6842 .type = HDA_FIXUP_FUNC,
6843 .v.func = alc280_fixup_hp_gpio4,
6844 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006845 [ALC286_FIXUP_HP_GPIO_LED] = {
6846 .type = HDA_FIXUP_FUNC,
6847 .v.func = alc286_fixup_hp_gpio_led,
6848 },
David Henningsson33f4acd2015-01-07 15:50:13 +01006849 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6850 .type = HDA_FIXUP_FUNC,
6851 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6852 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01006853 [ALC280_FIXUP_HP_DOCK_PINS] = {
6854 .type = HDA_FIXUP_PINS,
6855 .v.pins = (const struct hda_pintbl[]) {
6856 { 0x1b, 0x21011020 }, /* line-out */
6857 { 0x1a, 0x01a1903c }, /* headset mic */
6858 { 0x18, 0x2181103f }, /* line-in */
6859 { },
6860 },
6861 .chained = true,
6862 .chain_id = ALC280_FIXUP_HP_GPIO4
6863 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006864 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6865 .type = HDA_FIXUP_PINS,
6866 .v.pins = (const struct hda_pintbl[]) {
6867 { 0x1b, 0x21011020 }, /* line-out */
6868 { 0x18, 0x2181103f }, /* line-in */
6869 { },
6870 },
6871 .chained = true,
6872 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6873 },
Keith Packard98973f22015-07-15 12:14:39 -07006874 [ALC280_FIXUP_HP_9480M] = {
6875 .type = HDA_FIXUP_FUNC,
6876 .v.func = alc280_fixup_hp_9480m,
6877 },
Kailang Yange1e62b92015-04-08 16:01:22 +08006878 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6879 .type = HDA_FIXUP_FUNC,
6880 .v.func = alc_fixup_headset_mode_dell_alc288,
6881 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006882 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08006883 },
6884 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6885 .type = HDA_FIXUP_PINS,
6886 .v.pins = (const struct hda_pintbl[]) {
6887 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6888 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6889 { }
6890 },
6891 .chained = true,
6892 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6893 },
Hui Wang831bfdf92015-06-26 12:35:17 +08006894 [ALC288_FIXUP_DISABLE_AAMIX] = {
6895 .type = HDA_FIXUP_FUNC,
6896 .v.func = alc_fixup_disable_aamix,
6897 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02006898 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08006899 },
6900 [ALC288_FIXUP_DELL_XPS_13] = {
6901 .type = HDA_FIXUP_FUNC,
6902 .v.func = alc_fixup_dell_xps13,
6903 .chained = true,
6904 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6905 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006906 [ALC292_FIXUP_DISABLE_AAMIX] = {
6907 .type = HDA_FIXUP_FUNC,
6908 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08006909 .chained = true,
6910 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006911 },
David Henningssonc04017e2015-12-15 14:44:03 +01006912 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6913 .type = HDA_FIXUP_FUNC,
6914 .v.func = alc_fixup_disable_aamix,
6915 .chained = true,
6916 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6917 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01006918 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006919 .type = HDA_FIXUP_FUNC,
6920 .v.func = alc_fixup_dell_xps13,
6921 .chained = true,
6922 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6923 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01006924 [ALC292_FIXUP_DELL_E7X] = {
6925 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02006926 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006927 /* micmute fixup must be applied at last */
6928 .chained_before = true,
6929 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
6930 },
James McDonnell54324222019-09-16 14:53:38 +00006931 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
6932 .type = HDA_FIXUP_PINS,
6933 .v.pins = (const struct hda_pintbl[]) {
6934 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
6935 { }
6936 },
6937 .chained_before = true,
6938 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6939 },
Kailang Yang977e6272015-05-18 15:31:20 +08006940 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6941 .type = HDA_FIXUP_PINS,
6942 .v.pins = (const struct hda_pintbl[]) {
6943 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6944 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6945 { }
6946 },
6947 .chained = true,
6948 .chain_id = ALC269_FIXUP_HEADSET_MODE
6949 },
Hui Wang2f726ae2017-03-31 10:31:40 +08006950 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6951 .type = HDA_FIXUP_PINS,
6952 .v.pins = (const struct hda_pintbl[]) {
6953 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6954 { }
6955 },
6956 .chained = true,
6957 .chain_id = ALC269_FIXUP_HEADSET_MODE
6958 },
Kailang Yang6ed11312015-10-26 15:37:39 +08006959 [ALC275_FIXUP_DELL_XPS] = {
6960 .type = HDA_FIXUP_VERBS,
6961 .v.verbs = (const struct hda_verb[]) {
6962 /* Enables internal speaker */
6963 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6964 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6965 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6966 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6967 {}
6968 }
6969 },
Hui Wang23adc192015-12-08 12:27:18 +08006970 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6971 .type = HDA_FIXUP_FUNC,
6972 .v.func = alc_fixup_disable_aamix,
6973 .chained = true,
6974 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6975 },
Kailang3694cb22015-12-28 11:35:24 +08006976 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6977 .type = HDA_FIXUP_FUNC,
6978 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6979 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006980 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6981 .type = HDA_FIXUP_FUNC,
6982 .v.func = alc_fixup_disable_aamix,
6983 .chained = true,
6984 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6985 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08006986 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6987 .type = HDA_FIXUP_FUNC,
6988 .v.func = alc_fixup_disable_mic_vref,
6989 .chained = true,
6990 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6991 },
David Henningsson2ae95572016-02-25 09:37:05 +01006992 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6993 .type = HDA_FIXUP_VERBS,
6994 .v.verbs = (const struct hda_verb[]) {
6995 /* Disable pass-through path for FRONT 14h */
6996 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6997 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6998 {}
6999 },
7000 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007001 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007002 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007003 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7004 .type = HDA_FIXUP_FUNC,
7005 .v.func = alc_fixup_disable_aamix,
7006 .chained = true,
7007 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7008 },
Hui Wange549d192016-04-01 11:00:15 +08007009 [ALC221_FIXUP_HP_FRONT_MIC] = {
7010 .type = HDA_FIXUP_PINS,
7011 .v.pins = (const struct hda_pintbl[]) {
7012 { 0x19, 0x02a19020 }, /* Front Mic */
7013 { }
7014 },
7015 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007016 [ALC292_FIXUP_TPT460] = {
7017 .type = HDA_FIXUP_FUNC,
7018 .v.func = alc_fixup_tpt440_dock,
7019 .chained = true,
7020 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7021 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007022 [ALC298_FIXUP_SPK_VOLUME] = {
7023 .type = HDA_FIXUP_FUNC,
7024 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007025 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007026 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007027 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007028 [ALC295_FIXUP_DISABLE_DAC3] = {
7029 .type = HDA_FIXUP_FUNC,
7030 .v.func = alc295_fixup_disable_dac3,
7031 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007032 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7033 .type = HDA_FIXUP_FUNC,
7034 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007035 .chained = true,
7036 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007037 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007038 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7039 .type = HDA_FIXUP_PINS,
7040 .v.pins = (const struct hda_pintbl[]) {
7041 { 0x1b, 0x90170151 },
7042 { }
7043 },
7044 .chained = true,
7045 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7046 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007047 [ALC269_FIXUP_ATIV_BOOK_8] = {
7048 .type = HDA_FIXUP_FUNC,
7049 .v.func = alc_fixup_auto_mute_via_amp,
7050 .chained = true,
7051 .chain_id = ALC269_FIXUP_NO_SHUTUP
7052 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007053 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7054 .type = HDA_FIXUP_PINS,
7055 .v.pins = (const struct hda_pintbl[]) {
7056 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7057 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7058 { }
7059 },
7060 .chained = true,
7061 .chain_id = ALC269_FIXUP_HEADSET_MODE
7062 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007063 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7064 .type = HDA_FIXUP_FUNC,
7065 .v.func = alc_fixup_headset_mode,
7066 },
7067 [ALC256_FIXUP_ASUS_MIC] = {
7068 .type = HDA_FIXUP_PINS,
7069 .v.pins = (const struct hda_pintbl[]) {
7070 { 0x13, 0x90a60160 }, /* use as internal mic */
7071 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7072 { }
7073 },
7074 .chained = true,
7075 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7076 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007077 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007078 .type = HDA_FIXUP_FUNC,
7079 /* Set up GPIO2 for the speaker amp */
7080 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007081 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007082 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7083 .type = HDA_FIXUP_PINS,
7084 .v.pins = (const struct hda_pintbl[]) {
7085 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7086 { }
7087 },
7088 .chained = true,
7089 .chain_id = ALC269_FIXUP_HEADSET_MIC
7090 },
7091 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7092 .type = HDA_FIXUP_VERBS,
7093 .v.verbs = (const struct hda_verb[]) {
7094 /* Enables internal speaker */
7095 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7096 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7097 {}
7098 },
7099 .chained = true,
7100 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7101 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007102 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7103 .type = HDA_FIXUP_FUNC,
7104 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007105 .chained = true,
7106 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007107 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007108 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7109 .type = HDA_FIXUP_VERBS,
7110 .v.verbs = (const struct hda_verb[]) {
7111 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7112 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7113 { }
7114 },
7115 .chained = true,
7116 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7117 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007118 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7119 .type = HDA_FIXUP_PINS,
7120 .v.pins = (const struct hda_pintbl[]) {
7121 /* Change the mic location from front to right, otherwise there are
7122 two front mics with the same name, pulseaudio can't handle them.
7123 This is just a temporary workaround, after applying this fixup,
7124 there will be one "Front Mic" and one "Mic" in this machine.
7125 */
7126 { 0x1a, 0x04a19040 },
7127 { }
7128 },
7129 },
Kailang Yang5f364132017-07-25 16:28:16 +08007130 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7131 .type = HDA_FIXUP_PINS,
7132 .v.pins = (const struct hda_pintbl[]) {
7133 { 0x16, 0x0101102f }, /* Rear Headset HP */
7134 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7135 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7136 { 0x1b, 0x02011020 },
7137 { }
7138 },
7139 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007140 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7141 },
7142 [ALC225_FIXUP_S3_POP_NOISE] = {
7143 .type = HDA_FIXUP_FUNC,
7144 .v.func = alc225_fixup_s3_pop_noise,
7145 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007146 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7147 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007148 [ALC700_FIXUP_INTEL_REFERENCE] = {
7149 .type = HDA_FIXUP_VERBS,
7150 .v.verbs = (const struct hda_verb[]) {
7151 /* Enables internal speaker */
7152 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7153 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7154 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7155 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7156 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7157 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7158 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7159 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7160 {}
7161 }
7162 },
Kailang Yang92266652017-12-14 15:28:58 +08007163 [ALC274_FIXUP_DELL_BIND_DACS] = {
7164 .type = HDA_FIXUP_FUNC,
7165 .v.func = alc274_fixup_bind_dacs,
7166 .chained = true,
7167 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7168 },
7169 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7170 .type = HDA_FIXUP_PINS,
7171 .v.pins = (const struct hda_pintbl[]) {
7172 { 0x1b, 0x0401102f },
7173 { }
7174 },
7175 .chained = true,
7176 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7177 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007178 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007179 .type = HDA_FIXUP_FUNC,
7180 .v.func = alc_fixup_tpt470_dock,
7181 .chained = true,
7182 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7183 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007184 [ALC298_FIXUP_TPT470_DOCK] = {
7185 .type = HDA_FIXUP_FUNC,
7186 .v.func = alc_fixup_tpt470_dacs,
7187 .chained = true,
7188 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7189 },
Kailang Yangae104a22018-02-05 16:07:20 +08007190 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7191 .type = HDA_FIXUP_PINS,
7192 .v.pins = (const struct hda_pintbl[]) {
7193 { 0x14, 0x0201101f },
7194 { }
7195 },
7196 .chained = true,
7197 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7198 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007199 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7200 .type = HDA_FIXUP_PINS,
7201 .v.pins = (const struct hda_pintbl[]) {
7202 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7203 { }
7204 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007205 .chained = true,
7206 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007207 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007208 [ALC295_FIXUP_HP_X360] = {
7209 .type = HDA_FIXUP_FUNC,
7210 .v.func = alc295_fixup_hp_top_speakers,
7211 .chained = true,
7212 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007213 },
7214 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7215 .type = HDA_FIXUP_PINS,
7216 .v.pins = (const struct hda_pintbl[]) {
7217 { 0x19, 0x0181313f},
7218 { }
7219 },
7220 .chained = true,
7221 .chain_id = ALC269_FIXUP_HEADSET_MIC
7222 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007223 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7224 .type = HDA_FIXUP_FUNC,
7225 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007226 .chained = true,
7227 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007228 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007229 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7230 .type = HDA_FIXUP_FUNC,
7231 .v.func = alc_fixup_auto_mute_via_amp,
7232 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007233 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7234 .type = HDA_FIXUP_PINS,
7235 .v.pins = (const struct hda_pintbl[]) {
7236 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7237 { }
7238 },
7239 .chained = true,
7240 .chain_id = ALC269_FIXUP_HEADSET_MIC
7241 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007242 [ALC294_FIXUP_ASUS_MIC] = {
7243 .type = HDA_FIXUP_PINS,
7244 .v.pins = (const struct hda_pintbl[]) {
7245 { 0x13, 0x90a60160 }, /* use as internal mic */
7246 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7247 { }
7248 },
7249 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007250 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007251 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007252 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7253 .type = HDA_FIXUP_PINS,
7254 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007255 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007256 { }
7257 },
7258 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007259 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007260 },
7261 [ALC294_FIXUP_ASUS_SPK] = {
7262 .type = HDA_FIXUP_VERBS,
7263 .v.verbs = (const struct hda_verb[]) {
7264 /* Set EAPD high */
7265 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7266 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08007267 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7268 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007269 { }
7270 },
7271 .chained = true,
7272 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7273 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007274 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08007275 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007276 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08007277 .chained = true,
7278 .chain_id = ALC225_FIXUP_HEADSET_JACK
7279 },
7280 [ALC225_FIXUP_HEADSET_JACK] = {
7281 .type = HDA_FIXUP_FUNC,
7282 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08007283 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07007284 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7285 .type = HDA_FIXUP_PINS,
7286 .v.pins = (const struct hda_pintbl[]) {
7287 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7288 { }
7289 },
7290 .chained = true,
7291 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7292 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08007293 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7294 .type = HDA_FIXUP_VERBS,
7295 .v.verbs = (const struct hda_verb[]) {
7296 /* Disable PCBEEP-IN passthrough */
7297 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7298 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7299 { }
7300 },
7301 .chained = true,
7302 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7303 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007304 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7305 .type = HDA_FIXUP_PINS,
7306 .v.pins = (const struct hda_pintbl[]) {
7307 { 0x19, 0x03a11130 },
7308 { 0x1a, 0x90a60140 }, /* use as internal mic */
7309 { }
7310 },
7311 .chained = true,
7312 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7313 },
Kailang Yang136824e2019-03-14 16:22:45 +08007314 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7315 .type = HDA_FIXUP_PINS,
7316 .v.pins = (const struct hda_pintbl[]) {
7317 { 0x16, 0x01011020 }, /* Rear Line out */
7318 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7319 { }
7320 },
7321 .chained = true,
7322 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7323 },
7324 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7325 .type = HDA_FIXUP_FUNC,
7326 .v.func = alc_fixup_auto_mute_via_amp,
7327 .chained = true,
7328 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7329 },
7330 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7331 .type = HDA_FIXUP_FUNC,
7332 .v.func = alc_fixup_disable_mic_vref,
7333 .chained = true,
7334 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7335 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007336 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7337 .type = HDA_FIXUP_VERBS,
7338 .v.verbs = (const struct hda_verb[]) {
7339 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7340 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7341 { }
7342 },
7343 .chained = true,
7344 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7345 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08007346 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7347 .type = HDA_FIXUP_PINS,
7348 .v.pins = (const struct hda_pintbl[]) {
7349 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7350 { }
7351 },
7352 .chained = true,
7353 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7354 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08007355 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7356 .type = HDA_FIXUP_PINS,
7357 .v.pins = (const struct hda_pintbl[]) {
7358 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7359 { }
7360 },
7361 .chained = true,
7362 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7363 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007364 [ALC299_FIXUP_PREDATOR_SPK] = {
7365 .type = HDA_FIXUP_PINS,
7366 .v.pins = (const struct hda_pintbl[]) {
7367 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7368 { }
7369 }
7370 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02007371 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7372 .type = HDA_FIXUP_PINS,
7373 .v.pins = (const struct hda_pintbl[]) {
7374 { 0x19, 0x04a11040 },
7375 { 0x21, 0x04211020 },
7376 { }
7377 },
7378 .chained = true,
7379 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7380 },
Kailang Yange79c2262019-12-19 14:12:15 +08007381 [ALC289_FIXUP_DELL_SPK2] = {
7382 .type = HDA_FIXUP_PINS,
7383 .v.pins = (const struct hda_pintbl[]) {
7384 { 0x17, 0x90170130 }, /* bass spk */
7385 { }
7386 },
7387 .chained = true,
7388 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7389 },
7390 [ALC289_FIXUP_DUAL_SPK] = {
7391 .type = HDA_FIXUP_FUNC,
7392 .v.func = alc285_fixup_speaker2_to_dac1,
7393 .chained = true,
7394 .chain_id = ALC289_FIXUP_DELL_SPK2
7395 },
Chris Chiu48e01502019-12-30 11:11:18 +08007396 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7397 .type = HDA_FIXUP_FUNC,
7398 .v.func = alc285_fixup_speaker2_to_dac1,
7399 .chained = true,
7400 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7401 },
7402 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007403 .type = HDA_FIXUP_FUNC,
7404 /* The GPIO must be pulled to initialize the AMP */
7405 .v.func = alc_fixup_gpio4,
7406 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08007407 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007408 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007409 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7410 .type = HDA_FIXUP_FUNC,
7411 .v.func = alc285_fixup_thinkpad_x1_gen7,
7412 .chained = true,
7413 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7414 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08007415 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7416 .type = HDA_FIXUP_FUNC,
7417 .v.func = alc_fixup_headset_jack,
7418 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007419 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08007420 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007421 [ALC294_FIXUP_ASUS_HPE] = {
7422 .type = HDA_FIXUP_VERBS,
7423 .v.verbs = (const struct hda_verb[]) {
7424 /* Set EAPD high */
7425 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7426 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7427 { }
7428 },
7429 .chained = true,
7430 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7431 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007432 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7433 .type = HDA_FIXUP_PINS,
7434 .v.pins = (const struct hda_pintbl[]) {
7435 { 0x19, 0x03a11050 }, /* front HP mic */
7436 { 0x1a, 0x01a11830 }, /* rear external mic */
7437 { 0x21, 0x03211020 }, /* front HP out */
7438 { }
7439 },
7440 .chained = true,
7441 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7442 },
7443 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7444 .type = HDA_FIXUP_VERBS,
7445 .v.verbs = (const struct hda_verb[]) {
7446 /* set 0x15 to HP-OUT ctrl */
7447 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7448 /* unmute the 0x15 amp */
7449 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7450 { }
7451 },
7452 .chained = true,
7453 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7454 },
7455 [ALC294_FIXUP_ASUS_GX502_HP] = {
7456 .type = HDA_FIXUP_FUNC,
7457 .v.func = alc294_fixup_gx502_hp,
7458 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02007459 [ALC294_FIXUP_ASUS_COEF_1B] = {
7460 .type = HDA_FIXUP_VERBS,
7461 .v.verbs = (const struct hda_verb[]) {
7462 /* Set bit 10 to correct noisy output after reboot from
7463 * Windows 10 (due to pop noise reduction?)
7464 */
7465 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7466 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7467 { }
7468 },
7469 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08007470 [ALC285_FIXUP_HP_GPIO_LED] = {
7471 .type = HDA_FIXUP_FUNC,
7472 .v.func = alc285_fixup_hp_gpio_led,
7473 },
Kailang Yang431e76c2020-04-07 14:40:20 +08007474 [ALC285_FIXUP_HP_MUTE_LED] = {
7475 .type = HDA_FIXUP_FUNC,
7476 .v.func = alc285_fixup_hp_mute_led,
7477 },
Kailang Yang24164f42020-04-07 14:52:42 +08007478 [ALC236_FIXUP_HP_MUTE_LED] = {
7479 .type = HDA_FIXUP_FUNC,
7480 .v.func = alc236_fixup_hp_mute_led,
7481 },
Mike Pozulp14425f12020-05-09 20:28:37 -07007482 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7483 .type = HDA_FIXUP_VERBS,
7484 .v.verbs = (const struct hda_verb[]) {
7485 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7486 { }
7487 },
7488 },
Chris Chiu9e433422020-05-12 14:15:24 +08007489 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7490 .type = HDA_FIXUP_PINS,
7491 .v.pins = (const struct hda_pintbl[]) {
7492 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7493 { }
7494 },
7495 .chained = true,
7496 .chain_id = ALC269_FIXUP_HEADSET_MODE
7497 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007498 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7499 .type = HDA_FIXUP_PINS,
7500 .v.pins = (const struct hda_pintbl[]) {
7501 { 0x14, 0x90100120 }, /* use as internal speaker */
7502 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7503 { 0x1a, 0x01011020 }, /* use as line out */
7504 { },
7505 },
7506 .chained = true,
7507 .chain_id = ALC269_FIXUP_HEADSET_MIC
7508 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007509 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7510 .type = HDA_FIXUP_PINS,
7511 .v.pins = (const struct hda_pintbl[]) {
7512 { 0x18, 0x02a11030 }, /* use as headset mic */
7513 { }
7514 },
7515 .chained = true,
7516 .chain_id = ALC269_FIXUP_HEADSET_MIC
7517 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007518 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7519 .type = HDA_FIXUP_PINS,
7520 .v.pins = (const struct hda_pintbl[]) {
7521 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7522 { }
7523 },
7524 .chained = true,
7525 .chain_id = ALC269_FIXUP_HEADSET_MIC
7526 },
Armas Spann293a92c2020-07-24 16:08:37 +02007527 [ALC289_FIXUP_ASUS_GA401] = {
Armas Spannff536642020-07-11 13:05:57 +02007528 .type = HDA_FIXUP_PINS,
7529 .v.pins = (const struct hda_pintbl[]) {
7530 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7531 { }
7532 },
7533 },
Armas Spann4b43d052020-07-24 16:06:16 +02007534 [ALC289_FIXUP_ASUS_GA502] = {
7535 .type = HDA_FIXUP_PINS,
7536 .v.pins = (const struct hda_pintbl[]) {
7537 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7538 { }
7539 },
7540 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007541 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7542 .type = HDA_FIXUP_PINS,
7543 .v.pins = (const struct hda_pintbl[]) {
7544 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7545 { }
7546 },
7547 .chained = true,
7548 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7549 },
Kailang Yang56496252020-07-29 15:09:27 +08007550 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7551 .type = HDA_FIXUP_FUNC,
7552 .v.func = alc285_fixup_hp_gpio_amp_init,
7553 .chained = true,
7554 .chain_id = ALC285_FIXUP_HP_GPIO_LED
7555 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08007556 [ALC269_FIXUP_CZC_B20] = {
7557 .type = HDA_FIXUP_PINS,
7558 .v.pins = (const struct hda_pintbl[]) {
7559 { 0x12, 0x411111f0 },
7560 { 0x14, 0x90170110 }, /* speaker */
7561 { 0x15, 0x032f1020 }, /* HP out */
7562 { 0x17, 0x411111f0 },
7563 { 0x18, 0x03ab1040 }, /* mic */
7564 { 0x19, 0xb7a7013f },
7565 { 0x1a, 0x0181305f },
7566 { 0x1b, 0x411111f0 },
7567 { 0x1d, 0x411111f0 },
7568 { 0x1e, 0x411111f0 },
7569 { }
7570 },
7571 .chain_id = ALC269_FIXUP_DMIC,
7572 },
7573 [ALC269_FIXUP_CZC_TMI] = {
7574 .type = HDA_FIXUP_PINS,
7575 .v.pins = (const struct hda_pintbl[]) {
7576 { 0x12, 0x4000c000 },
7577 { 0x14, 0x90170110 }, /* speaker */
7578 { 0x15, 0x0421401f }, /* HP out */
7579 { 0x17, 0x411111f0 },
7580 { 0x18, 0x04a19020 }, /* mic */
7581 { 0x19, 0x411111f0 },
7582 { 0x1a, 0x411111f0 },
7583 { 0x1b, 0x411111f0 },
7584 { 0x1d, 0x40448505 },
7585 { 0x1e, 0x411111f0 },
7586 { 0x20, 0x8000ffff },
7587 { }
7588 },
7589 .chain_id = ALC269_FIXUP_DMIC,
7590 },
7591 [ALC269_FIXUP_CZC_L101] = {
7592 .type = HDA_FIXUP_PINS,
7593 .v.pins = (const struct hda_pintbl[]) {
7594 { 0x12, 0x40000000 },
7595 { 0x14, 0x01014010 }, /* speaker */
7596 { 0x15, 0x411111f0 }, /* HP out */
7597 { 0x16, 0x411111f0 },
7598 { 0x18, 0x01a19020 }, /* mic */
7599 { 0x19, 0x02a19021 },
7600 { 0x1a, 0x0181302f },
7601 { 0x1b, 0x0221401f },
7602 { 0x1c, 0x411111f0 },
7603 { 0x1d, 0x4044c601 },
7604 { 0x1e, 0x411111f0 },
7605 { }
7606 },
7607 .chain_id = ALC269_FIXUP_DMIC,
7608 },
7609 [ALC269_FIXUP_LEMOTE_A1802] = {
7610 .type = HDA_FIXUP_PINS,
7611 .v.pins = (const struct hda_pintbl[]) {
7612 { 0x12, 0x40000000 },
7613 { 0x14, 0x90170110 }, /* speaker */
7614 { 0x17, 0x411111f0 },
7615 { 0x18, 0x03a19040 }, /* mic1 */
7616 { 0x19, 0x90a70130 }, /* mic2 */
7617 { 0x1a, 0x411111f0 },
7618 { 0x1b, 0x411111f0 },
7619 { 0x1d, 0x40489d2d },
7620 { 0x1e, 0x411111f0 },
7621 { 0x20, 0x0003ffff },
7622 { 0x21, 0x03214020 },
7623 { }
7624 },
7625 .chain_id = ALC269_FIXUP_DMIC,
7626 },
7627 [ALC269_FIXUP_LEMOTE_A190X] = {
7628 .type = HDA_FIXUP_PINS,
7629 .v.pins = (const struct hda_pintbl[]) {
7630 { 0x14, 0x99130110 }, /* speaker */
7631 { 0x15, 0x0121401f }, /* HP out */
7632 { 0x18, 0x01a19c20 }, /* rear mic */
7633 { 0x19, 0x99a3092f }, /* front mic */
7634 { 0x1b, 0x0201401f }, /* front lineout */
7635 { }
7636 },
7637 .chain_id = ALC269_FIXUP_DMIC,
7638 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08007639 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
7640 .type = HDA_FIXUP_PINS,
7641 .v.pins = (const struct hda_pintbl[]) {
7642 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7643 { }
7644 },
7645 .chained = true,
7646 .chain_id = ALC269_FIXUP_HEADSET_MODE
7647 },
Hui Wangfc19d552020-09-09 10:00:41 +08007648 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
7649 .type = HDA_FIXUP_VERBS,
7650 .v.verbs = (const struct hda_verb[]) {
7651 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7652 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7653 { }
7654 },
7655 .chained = true,
7656 .chain_id = ALC289_FIXUP_ASUS_GA401
7657 },
Hui Wang13468bf2020-09-28 16:01:17 +08007658 [ALC274_FIXUP_HP_MIC] = {
7659 .type = HDA_FIXUP_VERBS,
7660 .v.verbs = (const struct hda_verb[]) {
7661 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7662 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7663 { }
7664 },
7665 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007666};
7667
7668static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01007669 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02007670 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
7671 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02007672 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02007673 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
7674 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02007675 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
7676 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05007677 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01007678 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02007679 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Chris Chiu705b65f2018-12-05 14:48:54 +08007680 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007681 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01007682 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiuc7531e32019-03-21 17:17:31 +08007683 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
7684 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007685 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007686 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007687 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007688 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7689 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7690 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08007691 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007692 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007693 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007694 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
David Henningssonaaedfb42013-08-16 14:09:02 +02007695 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08007696 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01007697 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01007698 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007699 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
7700 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01007701 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02007702 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7703 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7704 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01007705 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
7706 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01007707 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02007708 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01007709 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08007710 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7711 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08007712 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02007713 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02007714 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08007715 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08007716 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7717 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01007718 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7719 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7720 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7721 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7722 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007723 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007724 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01007725 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08007726 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08007727 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwaie312a862018-03-06 12:14:17 +01007728 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Takashi Iwai493de342017-02-28 17:27:57 +01007729 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kailang Yang5f364132017-07-25 16:28:16 +08007730 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08007731 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7732 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007733 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
7734 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08007735 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08007736 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08007737 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08007738 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08007739 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7740 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08007741 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
7742 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yanga22aa262014-04-23 17:34:28 +08007743 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7744 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007745 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01007746 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01007747 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
David Henningsson33f4acd2015-01-07 15:50:13 +01007748 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08007749 /* ALC282 */
Hui Wang7976eb42015-02-13 11:14:41 +08007750 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007751 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007752 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007753 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7754 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7755 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7756 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007757 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007758 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007759 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7760 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007761 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007762 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
TienFu Chenb4b33f92015-01-20 15:06:21 +01007763 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
TienFu Chen3271cb22015-02-10 09:09:41 +01007764 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yangc60666b2014-02-21 16:23:35 +08007765 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007766 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7767 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7768 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007769 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Keith Packard98973f22015-07-15 12:14:39 -07007770 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007771 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7772 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007773 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007774 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007775 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007776 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007777 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7778 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7779 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7780 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7781 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007782 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007783 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007784 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007785 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7786 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7787 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007788 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7789 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007790 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007791 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007792 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007793 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007794 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7795 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007796 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7797 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007798 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007799 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7800 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7801 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7802 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwaif8839822016-02-25 14:31:59 +01007803 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01007804 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7805 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Takashi Iwai563785e2018-11-12 09:43:12 +01007806 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08007807 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007808 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01007809 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7810 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05007811 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02007812 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Sam Bazleyd33cd422019-09-01 03:31:30 +01007813 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08007814 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
7815 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Kailang Yang56496252020-07-29 15:09:27 +08007816 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Hui Wang13468bf2020-09-28 16:01:17 +08007817 SND_PCI_QUIRK(0x103c, 0x874e, "HP", ALC274_FIXUP_HP_MIC),
Qiu Wenbo08befca2020-10-02 20:44:54 +08007818 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08007819 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08007820 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007821 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02007822 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02007823 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01007824 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007825 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02007826 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02007827 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02007828 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7829 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
7830 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007831 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
7832 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
7833 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01007834 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01007835 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02007836 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Chris Chiu48e01502019-12-30 11:11:18 +08007837 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Daniel Drake8c8967a2019-10-17 16:15:01 +08007838 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08007839 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08007840 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007841 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08007842 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02007843 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06007844 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02007845 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02007846 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06007847 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02007848 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007849 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Armas Spann4b43d052020-07-24 16:06:16 +02007850 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Armas Spann293a92c2020-07-24 16:08:37 +02007851 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007852 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Chris Chiueeed4cd2017-02-28 14:17:15 -06007853 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02007854 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
7855 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
7856 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7857 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02007858 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01007859 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02007860 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007861 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
7862 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7863 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02007864 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02007865 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02007866 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02007867 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Takashi Iwai88776f32015-05-01 09:20:34 +02007868 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01007869 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
David Henningsson2041d562014-06-13 11:15:44 +02007870 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08007871 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02007872 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09007873 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02007874 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07007875 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7876 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07007877 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09007878 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7879 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007880 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09007881 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02007882 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
7883 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01007884 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Jeremy Soller89e3a562019-01-30 16:12:31 -07007885 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller80a50522019-05-07 17:11:08 -04007886 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller891afcf2019-05-10 10:15:07 -04007887 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7888 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
7889 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
Kailang Yangca169cc2017-04-25 16:17:40 +08007890 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Hui Wangef0b3202020-04-27 11:00:39 +08007891 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007892 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
7893 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
7894 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
7895 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
7896 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaib590b382020-05-14 18:05:33 +02007897 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02007898 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02007899 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02007900 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02007901 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02007902 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01007903 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02007904 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02007905 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05007906 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02007907 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01007908 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02007909 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01007910 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07007911 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02007912 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007913 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7914 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02007915 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02007916 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007917 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
7918 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7919 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01007920 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007921 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7922 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7923 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01007924 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09007925 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02007926 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang3694cb22015-12-28 11:35:24 +08007927 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08007928 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08007929 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02007930 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08007931 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08007932 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08007933 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08007934 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08007935 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7936 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
David Henningsson56f27012016-01-11 09:33:14 +01007937 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01007938 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02007939 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
David Henningssona4a9e082013-08-16 14:09:01 +02007940 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02007941 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02007942 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02007943 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02007944 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01007945 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02007946 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02007947 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08007948 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02007949 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02007950 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02007951 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007952 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7953 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7954 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02007955 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007956 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7957 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningsson012e7eb2012-08-08 08:43:37 +02007958 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007959 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04007960 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08007961 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
7962 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
7963 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02007964 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Hui Wangfc19d552020-09-09 10:00:41 +08007965 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Hui Wang695d1ec2019-11-21 10:54:27 +08007966 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02007967 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08007968 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
7969 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08007970 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Takashi Iwaia4297b52011-08-23 18:40:12 +02007971
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01007972#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02007973 /* Below is a quirk table taken from the old code.
7974 * Basically the device should work as is without the fixup table.
7975 * If BIOS doesn't give a proper info, enable the corresponding
7976 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02007977 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02007978 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
7979 ALC269_FIXUP_AMIC),
7980 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02007981 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
7982 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
7983 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
7984 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
7985 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
7986 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
7987 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
7988 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
7989 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
7990 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
7991 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
7992 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
7993 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
7994 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
7995 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
7996 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
7997 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
7998 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
7999 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8000 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8001 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8002 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8003 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8004 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8005 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8006 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8007 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8008 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8009 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8010 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8011 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8012 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8013 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8014 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8015 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8016 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8017 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8018 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8019#endif
8020 {}
8021};
8022
David Henningsson214eef72014-07-22 14:09:35 +02008023static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8024 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8025 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8026 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8027 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008028 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02008029 {}
8030};
8031
Takashi Iwai1727a772013-01-10 09:52:52 +01008032static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02008033 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8034 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008035 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8036 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8037 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02008038 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02008039 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8040 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02008041 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02008042 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008043 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008044 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02008045 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8046 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008047 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8048 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08008049 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08008050 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02008051 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01008052 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02008053 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02008054 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008055 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008056 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02008057 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008058 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8059 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8060 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8061 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8062 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8063 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8064 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8065 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8066 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8067 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8068 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8069 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8070 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8071 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8072 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8073 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8074 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8075 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8076 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8077 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8078 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8079 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8080 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8081 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8082 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8083 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8084 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8085 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8086 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8087 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8088 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8089 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8090 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8091 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8092 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8093 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8094 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8095 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8096 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8097 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01008098 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008099 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
8100 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8101 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8102 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8103 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8104 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8105 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8106 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8107 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8108 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8109 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8110 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8111 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8112 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8113 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008114 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8115 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8116 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08008117 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008118 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01008119 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008120 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8121 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8122 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8123 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8124 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8125 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8126 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8127 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8128 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8129 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8130 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8131 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8132 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8133 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8134 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8135 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8136 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08008137 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8138 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008139 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02008140 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008141 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07008142 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08008143 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08008144 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02008145 {}
8146};
Kailang Yangcfc5a842016-02-03 15:20:39 +08008147#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08008148 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02008149
Hui Wange8191a82015-04-24 13:39:59 +08008150#define ALC256_STANDARD_PINS \
8151 {0x12, 0x90a60140}, \
8152 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08008153 {0x21, 0x02211020}
8154
David Henningssonfea185e2014-09-03 10:23:04 +02008155#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008156 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08008157
David Henningssonfea185e2014-09-03 10:23:04 +02008158#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008159 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02008160
8161#define ALC292_STANDARD_PINS \
8162 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08008163 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08008164
Hui Wang3f6409702016-09-11 11:26:16 +08008165#define ALC295_STANDARD_PINS \
8166 {0x12, 0xb7a60130}, \
8167 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08008168 {0x21, 0x04211020}
8169
Woodrow Shen703867e2015-08-05 12:34:12 +08008170#define ALC298_STANDARD_PINS \
8171 {0x12, 0x90a60130}, \
8172 {0x21, 0x03211020}
8173
Hui Wange1918932014-05-26 16:22:44 +08008174static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08008175 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
8176 {0x14, 0x01014020},
8177 {0x17, 0x90170110},
8178 {0x18, 0x02a11030},
8179 {0x19, 0x0181303F},
8180 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06008181 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8182 {0x12, 0x90a601c0},
8183 {0x14, 0x90171120},
8184 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06008185 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8186 {0x14, 0x90170110},
8187 {0x1b, 0x90a70130},
8188 {0x21, 0x03211020}),
8189 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8190 {0x1a, 0x90a70130},
8191 {0x1b, 0x90170110},
8192 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01008193 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008194 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008195 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008196 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01008197 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008198 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008199 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008200 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08008201 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8202 ALC225_STANDARD_PINS,
8203 {0x12, 0xb7a60150},
8204 {0x14, 0x901701a0}),
8205 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8206 ALC225_STANDARD_PINS,
8207 {0x12, 0xb7a60150},
8208 {0x14, 0x901701b0}),
8209 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8210 ALC225_STANDARD_PINS,
8211 {0x12, 0xb7a60130},
8212 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05008213 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8214 {0x1b, 0x01111010},
8215 {0x1e, 0x01451130},
8216 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08008217 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
8218 {0x12, 0x90a60140},
8219 {0x14, 0x90170110},
8220 {0x19, 0x02a11030},
8221 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08008222 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8223 {0x14, 0x90170110},
8224 {0x19, 0x02a11030},
8225 {0x1a, 0x02a11040},
8226 {0x1b, 0x01014020},
8227 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08008228 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8229 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08008230 {0x19, 0x02a11030},
8231 {0x1a, 0x02a11040},
8232 {0x1b, 0x01011020},
8233 {0x21, 0x0221101f}),
8234 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8235 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08008236 {0x19, 0x02a11020},
8237 {0x1a, 0x02a11030},
8238 {0x21, 0x0221101f}),
Hui Wangc77900e2014-09-03 11:31:07 +08008239 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08008240 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08008241 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02008242 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08008243 {0x14, 0x90170130},
8244 {0x21, 0x02211040}),
8245 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008246 {0x12, 0x90a60140},
8247 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02008248 {0x21, 0x02211020}),
8249 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8250 {0x12, 0x90a60160},
8251 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008252 {0x21, 0x02211030}),
8253 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08008254 {0x14, 0x90170110},
8255 {0x1b, 0x02011020},
8256 {0x21, 0x0221101f}),
8257 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08008258 {0x14, 0x90170110},
8259 {0x1b, 0x01011020},
8260 {0x21, 0x0221101f}),
8261 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02008262 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02008263 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02008264 {0x21, 0x0221103f}),
8265 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08008266 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08008267 {0x1b, 0x01011020},
8268 {0x21, 0x0221103f}),
8269 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8270 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08008271 {0x1b, 0x02011020},
8272 {0x21, 0x0221103f}),
8273 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008274 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008275 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008276 {0x21, 0x0221105f}),
8277 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008278 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008279 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008280 {0x21, 0x0221101f}),
8281 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008282 {0x12, 0x90a60160},
8283 {0x14, 0x90170120},
8284 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008285 {0x21, 0x0321102f}),
8286 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8287 {0x12, 0x90a60160},
8288 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008289 {0x21, 0x02211040}),
8290 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8291 {0x12, 0x90a60160},
8292 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008293 {0x21, 0x02211050}),
8294 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8295 {0x12, 0x90a60170},
8296 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008297 {0x21, 0x02211030}),
8298 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8299 {0x12, 0x90a60170},
8300 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008301 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08008302 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08008303 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08008304 {0x14, 0x90171130},
8305 {0x21, 0x02211040}),
8306 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8307 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08008308 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08008309 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02008310 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02008311 {0x12, 0x90a60180},
8312 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02008313 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08008314 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8315 {0x12, 0x90a60180},
8316 {0x14, 0x90170120},
8317 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08008318 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8319 {0x1b, 0x01011020},
8320 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008321 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8322 {0x14, 0x90170110},
8323 {0x1b, 0x90a70130},
8324 {0x21, 0x04211020}),
8325 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8326 {0x14, 0x90170110},
8327 {0x1b, 0x90a70130},
8328 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08008329 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08008330 {0x12, 0x90a60130},
8331 {0x14, 0x90170110},
8332 {0x21, 0x03211020}),
8333 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08008334 {0x12, 0x90a60130},
8335 {0x14, 0x90170110},
8336 {0x21, 0x04211020}),
8337 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08008338 {0x1a, 0x90a70130},
8339 {0x1b, 0x90170110},
8340 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01008341 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
8342 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01008343 {0x14, 0x90170110},
8344 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008345 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08008346 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
8347 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08008348 {0x14, 0x90170110},
8349 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08008350 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08008351 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08008352 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02008353 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008354 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02008355 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02008356 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02008357 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08008358 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008359 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008360 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008361 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008362 {0x21, 0x03211040}),
8363 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008364 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008365 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008366 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08008367 {0x21, 0x03211020}),
8368 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008369 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008370 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008371 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008372 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08008373 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02008374 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08008375 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08008376 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08008377 {0x21, 0x04211020}),
David Henningsson76c21322014-06-24 14:46:54 +02008378 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008379 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02008380 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02008381 {0x21, 0x0321101f}),
8382 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8383 {0x12, 0x90a60160},
8384 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008385 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08008386 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008387 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08008388 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08008389 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08008390 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08008391 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Hui Wangc4cfcf62018-11-26 14:17:16 +08008392 {0x12, 0x90a60130},
8393 {0x14, 0x90170110},
8394 {0x19, 0x04a11040},
8395 {0x21, 0x04211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08008396 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
8397 {0x12, 0x90a60130},
8398 {0x17, 0x90170110},
8399 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02008400 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08008401 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08008402 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08008403 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08008404 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008405 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008406 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08008407 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08008408 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008409 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008410 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008411 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08008412 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008413 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008414 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008415 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008416 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008417 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008418 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008419 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008420 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008421 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08008422 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008423 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008424 {0x14, 0x90170110},
8425 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008426 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08008427 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008428 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008429 {0x14, 0x90170110},
8430 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008431 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008432 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008433 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008434 {0x14, 0x90170110},
8435 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008436 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08008437 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008438 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08008439 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08008440 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08008441 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08008442 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008443 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08008444 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08008445 {0x16, 0x01014020},
8446 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08008447 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02008448 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008449 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08008450 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02008451 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008452 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02008453 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02008454 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08008455 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02008456 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008457 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08008458 {0x13, 0x90a60140}),
Chris Chiud8ae4582018-12-07 17:17:11 +08008459 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
8460 {0x14, 0x90170110},
8461 {0x1b, 0x90a70130},
8462 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08008463 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8464 {0x12, 0x90a60130},
8465 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08008466 {0x21, 0x03211020}),
8467 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8468 {0x12, 0x90a60130},
8469 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08008470 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02008471 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8472 {0x12, 0x90a60130},
8473 {0x17, 0x90170110},
8474 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08008475 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08008476 {0x12, 0x90a60120},
8477 {0x17, 0x90170110},
8478 {0x21, 0x04211030}),
8479 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08008480 {0x12, 0x90a60130},
8481 {0x17, 0x90170110},
8482 {0x21, 0x03211020}),
8483 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8484 {0x12, 0x90a60130},
8485 {0x17, 0x90170110},
8486 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08008487 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08008488 {0x14, 0x90170110},
8489 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08008490 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8491 {0x14, 0x90170110},
8492 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08008493 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08008494 ALC295_STANDARD_PINS,
8495 {0x17, 0x21014020},
8496 {0x18, 0x21a19030}),
8497 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8498 ALC295_STANDARD_PINS,
8499 {0x17, 0x21014040},
8500 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08008501 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8502 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08008503 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08008504 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02008505 {0x17, 0x90170110}),
8506 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8507 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08008508 {0x17, 0x90170140}),
8509 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8510 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02008511 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08008512 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
8513 {0x12, 0xb7a60140},
8514 {0x13, 0xb7a60150},
8515 {0x17, 0x90170110},
8516 {0x1a, 0x03011020},
8517 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00008518 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
8519 {0x12, 0xb7a60140},
8520 {0x17, 0x90170110},
8521 {0x1a, 0x03a11030},
8522 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08008523 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8524 ALC225_STANDARD_PINS,
8525 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08008526 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08008527 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
8528 {0x14, 0x01014010},
8529 {0x17, 0x90170120},
8530 {0x18, 0x02a11030},
8531 {0x19, 0x02a1103f},
8532 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08008533 {}
8534};
Takashi Iwai1d045db2011-07-07 18:23:21 +02008535
Hui Wang7c0a6932019-08-16 14:27:40 +08008536/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
8537 * more machines, don't need to match all valid pins, just need to match
8538 * all the pins defined in the tbl. Just because of this reason, it is possible
8539 * that a single machine matches multiple tbls, so there is one limitation:
8540 * at most one tbl is allowed to define for the same vendor and same codec
8541 */
8542static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
8543 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8544 {0x19, 0x40000000},
8545 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08008546 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8547 {0x19, 0x40000000},
8548 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08008549 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8550 {0x19, 0x40000000},
8551 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08008552 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
8553 {0x19, 0x40000000},
8554 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08008555 {}
8556};
8557
Takashi Iwai546bb672012-03-07 08:37:19 +01008558static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02008559{
Kailang Yang526af6e2012-03-07 08:25:20 +01008560 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008561 int val;
8562
Kailang Yang526af6e2012-03-07 08:25:20 +01008563 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01008564 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01008565
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008566 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008567 alc_write_coef_idx(codec, 0xf, 0x960b);
8568 alc_write_coef_idx(codec, 0xe, 0x8817);
8569 }
8570
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008571 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008572 alc_write_coef_idx(codec, 0xf, 0x960b);
8573 alc_write_coef_idx(codec, 0xe, 0x8814);
8574 }
8575
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008576 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008577 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02008578 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008579 }
8580
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008581 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008582 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02008583 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008584 /* Capless ramp up clock control */
8585 alc_write_coef_idx(codec, 0xd, val | (1<<10));
8586 }
8587 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02008588 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008589 /* Class D power on reset */
8590 alc_write_coef_idx(codec, 0x17, val | (1<<7));
8591 }
8592 }
8593
Takashi Iwai98b24882014-08-18 13:47:50 +02008594 /* HP */
8595 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008596}
8597
8598/*
8599 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008600static int patch_alc269(struct hda_codec *codec)
8601{
8602 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02008603 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008604
Takashi Iwai3de95172012-05-07 18:03:15 +02008605 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008606 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02008607 return err;
8608
8609 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01008610 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08008611 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008612
Takashi Iwai225068a2015-05-29 10:42:14 +02008613#ifdef CONFIG_PM
8614 codec->patch_ops.suspend = alc269_suspend;
8615 codec->patch_ops.resume = alc269_resume;
8616#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08008617 spec->shutup = alc_default_shutup;
8618 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02008619
Takashi Iwai7639a062015-03-03 10:07:24 +01008620 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01008621 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02008622 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008623 switch (alc_get_coef0(codec) & 0x00f0) {
8624 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01008625 if (codec->bus->pci &&
8626 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008627 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008628 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02008629 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008630 break;
8631 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01008632 if (codec->bus->pci &&
8633 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008634 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008635 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02008636 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008637 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02008638 case 0x0030:
8639 spec->codec_variant = ALC269_TYPE_ALC269VD;
8640 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008641 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02008642 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008643 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008644 if (err < 0)
8645 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08008646 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01008647 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008648 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01008649 break;
8650
8651 case 0x10ec0280:
8652 case 0x10ec0290:
8653 spec->codec_variant = ALC269_TYPE_ALC280;
8654 break;
8655 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01008656 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08008657 spec->shutup = alc282_shutup;
8658 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01008659 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02008660 case 0x10ec0233:
8661 case 0x10ec0283:
8662 spec->codec_variant = ALC269_TYPE_ALC283;
8663 spec->shutup = alc283_shutup;
8664 spec->init_hook = alc283_init;
8665 break;
Kailang Yang065380f2013-01-10 10:25:48 +01008666 case 0x10ec0284:
8667 case 0x10ec0292:
8668 spec->codec_variant = ALC269_TYPE_ALC284;
8669 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02008670 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08008671 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02008672 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02008673 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08008674 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02008675 spec->codec_variant = ALC269_TYPE_ALC286;
8676 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08008677 case 0x10ec0298:
8678 spec->codec_variant = ALC269_TYPE_ALC298;
8679 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08008680 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02008681 case 0x10ec0255:
8682 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08008683 spec->shutup = alc256_shutup;
8684 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02008685 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08008686 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08008687 case 0x10ec0256:
8688 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08008689 spec->shutup = alc256_shutup;
8690 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02008691 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08008692 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08008693 case 0x10ec0257:
8694 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08008695 spec->shutup = alc256_shutup;
8696 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08008697 spec->gen.mixer_nid = 0;
8698 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08008699 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +08008700 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +08008701 case 0x10ec0285:
Kailang Yang630e3612020-05-27 14:10:26 +08008702 case 0x10ec0287:
Kailang Yang0a6f0602017-06-30 16:00:48 +08008703 case 0x10ec0289:
8704 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08008705 spec->shutup = alc225_shutup;
8706 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08008707 spec->gen.mixer_nid = 0;
8708 break;
Kailang Yang42314302016-02-03 15:03:50 +08008709 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08008710 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08008711 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08008712 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08008713 spec->shutup = alc225_shutup;
8714 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01008715 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08008716 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008717 case 0x10ec0234:
8718 case 0x10ec0274:
8719 case 0x10ec0294:
8720 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08008721 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08008722 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08008723 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008724 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08008725 case 0x10ec0300:
8726 spec->codec_variant = ALC269_TYPE_ALC300;
8727 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008728 break;
Kailang Yangf0778872019-10-24 15:13:32 +08008729 case 0x10ec0623:
8730 spec->codec_variant = ALC269_TYPE_ALC623;
8731 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08008732 case 0x10ec0700:
8733 case 0x10ec0701:
8734 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +08008735 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +08008736 spec->codec_variant = ALC269_TYPE_ALC700;
8737 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08008738 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08008739 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08008740 break;
8741
Takashi Iwai1d045db2011-07-07 18:23:21 +02008742 }
8743
Kailang Yangad60d502013-06-28 12:03:01 +02008744 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05008745 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02008746 spec->init_hook = alc5505_dsp_init;
8747 }
8748
Takashi Iwaic9af7532019-05-10 11:01:43 +02008749 alc_pre_init(codec);
8750
Takashi Iwaiefe55732018-06-15 11:55:02 +02008751 snd_hda_pick_fixup(codec, alc269_fixup_models,
8752 alc269_fixup_tbl, alc269_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +08008753 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +08008754 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +02008755 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
8756 alc269_fixups);
8757 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8758
8759 alc_auto_parse_customize_define(codec);
8760
8761 if (has_cdefine_beep(codec))
8762 spec->gen.beep_nid = 0x01;
8763
Takashi Iwaia4297b52011-08-23 18:40:12 +02008764 /* automatic parse from the BIOS config */
8765 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008766 if (err < 0)
8767 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008768
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008769 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
8770 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
8771 if (err < 0)
8772 goto error;
8773 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02008774
Takashi Iwai1727a772013-01-10 09:52:52 +01008775 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01008776
Takashi Iwai1d045db2011-07-07 18:23:21 +02008777 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008778
8779 error:
8780 alc_free(codec);
8781 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008782}
8783
8784/*
8785 * ALC861
8786 */
8787
Takashi Iwai1d045db2011-07-07 18:23:21 +02008788static int alc861_parse_auto_config(struct hda_codec *codec)
8789{
Takashi Iwai1d045db2011-07-07 18:23:21 +02008790 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008791 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
8792 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008793}
8794
Takashi Iwai1d045db2011-07-07 18:23:21 +02008795/* Pin config fixes */
8796enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008797 ALC861_FIXUP_FSC_AMILO_PI1505,
8798 ALC861_FIXUP_AMP_VREF_0F,
8799 ALC861_FIXUP_NO_JACK_DETECT,
8800 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01008801 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02008802};
8803
Takashi Iwai31150f22012-01-30 10:54:08 +01008804/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
8805static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01008806 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01008807{
8808 struct alc_spec *spec = codec->spec;
8809 unsigned int val;
8810
Takashi Iwai1727a772013-01-10 09:52:52 +01008811 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01008812 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01008813 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01008814 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
8815 val |= AC_PINCTL_IN_EN;
8816 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02008817 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01008818 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01008819}
8820
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008821/* suppress the jack-detection */
8822static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01008823 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008824{
Takashi Iwai1727a772013-01-10 09:52:52 +01008825 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008826 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008827}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008828
Takashi Iwai1727a772013-01-10 09:52:52 +01008829static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008830 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008831 .type = HDA_FIXUP_PINS,
8832 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008833 { 0x0b, 0x0221101f }, /* HP */
8834 { 0x0f, 0x90170310 }, /* speaker */
8835 { }
8836 }
8837 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008838 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008839 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01008840 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01008841 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008842 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008843 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008844 .v.func = alc_fixup_no_jack_detect,
8845 },
8846 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008847 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008848 .v.func = alc861_fixup_asus_amp_vref_0f,
8849 .chained = true,
8850 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01008851 },
8852 [ALC660_FIXUP_ASUS_W7J] = {
8853 .type = HDA_FIXUP_VERBS,
8854 .v.verbs = (const struct hda_verb[]) {
8855 /* ASUS W7J needs a magic pin setup on unused NID 0x10
8856 * for enabling outputs
8857 */
8858 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8859 { }
8860 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008861 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02008862};
8863
8864static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01008865 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01008866 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008867 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
8868 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
8869 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
8870 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
8871 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
8872 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008873 {}
8874};
8875
8876/*
8877 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008878static int patch_alc861(struct hda_codec *codec)
8879{
8880 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008881 int err;
8882
Takashi Iwai3de95172012-05-07 18:03:15 +02008883 err = alc_alloc_spec(codec, 0x15);
8884 if (err < 0)
8885 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008886
Takashi Iwai3de95172012-05-07 18:03:15 +02008887 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02008888 if (has_cdefine_beep(codec))
8889 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008890
Takashi Iwai225068a2015-05-29 10:42:14 +02008891#ifdef CONFIG_PM
8892 spec->power_hook = alc_power_eapd;
8893#endif
8894
Takashi Iwaic9af7532019-05-10 11:01:43 +02008895 alc_pre_init(codec);
8896
Takashi Iwai1727a772013-01-10 09:52:52 +01008897 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
8898 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008899
Takashi Iwaicb4e4822011-08-23 17:34:25 +02008900 /* automatic parse from the BIOS config */
8901 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008902 if (err < 0)
8903 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008904
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008905 if (!spec->gen.no_analog) {
8906 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
8907 if (err < 0)
8908 goto error;
8909 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02008910
Takashi Iwai1727a772013-01-10 09:52:52 +01008911 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01008912
Takashi Iwai1d045db2011-07-07 18:23:21 +02008913 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008914
8915 error:
8916 alc_free(codec);
8917 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008918}
8919
8920/*
8921 * ALC861-VD support
8922 *
8923 * Based on ALC882
8924 *
8925 * In addition, an independent DAC
8926 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008927static int alc861vd_parse_auto_config(struct hda_codec *codec)
8928{
Takashi Iwai1d045db2011-07-07 18:23:21 +02008929 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008930 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
8931 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008932}
8933
Takashi Iwai1d045db2011-07-07 18:23:21 +02008934enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02008935 ALC660VD_FIX_ASUS_GPIO1,
8936 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02008937};
8938
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02008939/* exclude VREF80 */
8940static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01008941 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02008942{
Takashi Iwai1727a772013-01-10 09:52:52 +01008943 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01008944 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
8945 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02008946 }
8947}
8948
Takashi Iwaidf73d832018-06-19 23:05:47 +02008949/* reset GPIO1 */
8950static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
8951 const struct hda_fixup *fix, int action)
8952{
8953 struct alc_spec *spec = codec->spec;
8954
8955 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8956 spec->gpio_mask |= 0x02;
8957 alc_fixup_gpio(codec, action, 0x01);
8958}
8959
Takashi Iwai1727a772013-01-10 09:52:52 +01008960static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008961 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +02008962 .type = HDA_FIXUP_FUNC,
8963 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +02008964 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02008965 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008966 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02008967 .v.func = alc861vd_fixup_dallas,
8968 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02008969};
8970
8971static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02008972 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008973 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02008974 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008975 {}
8976};
8977
Takashi Iwai1d045db2011-07-07 18:23:21 +02008978/*
8979 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008980static int patch_alc861vd(struct hda_codec *codec)
8981{
8982 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02008983 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008984
Takashi Iwai3de95172012-05-07 18:03:15 +02008985 err = alc_alloc_spec(codec, 0x0b);
8986 if (err < 0)
8987 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008988
Takashi Iwai3de95172012-05-07 18:03:15 +02008989 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02008990 if (has_cdefine_beep(codec))
8991 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008992
Takashi Iwai225068a2015-05-29 10:42:14 +02008993 spec->shutup = alc_eapd_shutup;
8994
Takashi Iwaic9af7532019-05-10 11:01:43 +02008995 alc_pre_init(codec);
8996
Takashi Iwai1727a772013-01-10 09:52:52 +01008997 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
8998 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008999
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009000 /* automatic parse from the BIOS config */
9001 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009002 if (err < 0)
9003 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009004
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009005 if (!spec->gen.no_analog) {
9006 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9007 if (err < 0)
9008 goto error;
9009 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009010
Takashi Iwai1727a772013-01-10 09:52:52 +01009011 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009012
Takashi Iwai1d045db2011-07-07 18:23:21 +02009013 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009014
9015 error:
9016 alc_free(codec);
9017 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009018}
9019
9020/*
9021 * ALC662 support
9022 *
9023 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9024 * configuration. Each pin widget can choose any input DACs and a mixer.
9025 * Each ADC is connected from a mixer of all inputs. This makes possible
9026 * 6-channel independent captures.
9027 *
9028 * In addition, an independent DAC for the multi-playback (not used in this
9029 * driver yet).
9030 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009031
9032/*
9033 * BIOS auto configuration
9034 */
9035
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009036static int alc662_parse_auto_config(struct hda_codec *codec)
9037{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02009038 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009039 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9040 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9041 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02009042
Takashi Iwai7639a062015-03-03 10:07:24 +01009043 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9044 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9045 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009046 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01009047 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009048 ssids = alc662_ssids;
9049 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009050}
9051
Todd Broch6be79482010-12-07 16:51:05 -08009052static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009053 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009054{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01009055 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009056 return;
Todd Broch6be79482010-12-07 16:51:05 -08009057 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9058 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9059 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9060 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9061 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01009062 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08009063}
9064
Takashi Iwai8e383952013-10-30 17:41:12 +01009065static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9066 { .channels = 2,
9067 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9068 { .channels = 4,
9069 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9070 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9071 { }
9072};
9073
9074/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009075static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01009076 const struct hda_fixup *fix, int action)
9077{
9078 if (action == HDA_FIXUP_ACT_BUILD) {
9079 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01009080 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01009081 }
9082}
9083
Takashi Iwaibf686652014-01-13 16:18:25 +01009084/* avoid D3 for keeping GPIO up */
9085static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9086 hda_nid_t nid,
9087 unsigned int power_state)
9088{
9089 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02009090 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01009091 return AC_PWRST_D0;
9092 return power_state;
9093}
9094
Takashi Iwai3e887f32014-01-10 17:50:58 +01009095static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9096 const struct hda_fixup *fix, int action)
9097{
9098 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009099
Takashi Iwai01e4a272018-06-19 22:47:30 +02009100 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01009101 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01009102 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01009103 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009104 }
9105}
9106
Kailang Yangc6790c82016-11-25 16:15:17 +08009107static void alc662_usi_automute_hook(struct hda_codec *codec,
9108 struct hda_jack_callback *jack)
9109{
9110 struct alc_spec *spec = codec->spec;
9111 int vref;
9112 msleep(200);
9113 snd_hda_gen_hp_automute(codec, jack);
9114
9115 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
9116 msleep(100);
9117 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9118 vref);
9119}
9120
9121static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
9122 const struct hda_fixup *fix, int action)
9123{
9124 struct alc_spec *spec = codec->spec;
9125 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9126 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9127 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
9128 }
9129}
9130
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009131static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
9132 struct hda_jack_callback *cb)
9133{
9134 /* surround speakers at 0x1b already get muted automatically when
9135 * headphones are plugged in, but we have to mute/unmute the remaining
9136 * channels manually:
9137 * 0x15 - front left/front right
9138 * 0x18 - front center/ LFE
9139 */
9140 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
9141 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
9142 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
9143 } else {
9144 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
9145 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
9146 }
9147}
9148
9149static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
9150 const struct hda_fixup *fix, int action)
9151{
9152 /* Pin 0x1b: shared headphones jack and surround speakers */
9153 if (!is_jack_detectable(codec, 0x1b))
9154 return;
9155
9156 switch (action) {
9157 case HDA_FIXUP_ACT_PRE_PROBE:
9158 snd_hda_jack_detect_enable_callback(codec, 0x1b,
9159 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +01009160 /* subwoofer needs an extra GPIO setting to become audible */
9161 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009162 break;
9163 case HDA_FIXUP_ACT_INIT:
9164 /* Make sure to start in a correct state, i.e. if
9165 * headphones have been plugged in before powering up the system
9166 */
9167 alc662_aspire_ethos_mute_speakers(codec, NULL);
9168 break;
9169 }
9170}
9171
Kailang Yang5af290282020-01-17 14:04:01 +08009172static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
9173 const struct hda_fixup *fix, int action)
9174{
9175 struct alc_spec *spec = codec->spec;
9176
9177 static const struct hda_pintbl pincfgs[] = {
9178 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
9179 { 0x1b, 0x0181304f },
9180 { }
9181 };
9182
9183 switch (action) {
9184 case HDA_FIXUP_ACT_PRE_PROBE:
9185 spec->gen.mixer_nid = 0;
9186 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9187 snd_hda_apply_pincfgs(codec, pincfgs);
9188 break;
9189 case HDA_FIXUP_ACT_INIT:
9190 alc_write_coef_idx(codec, 0x19, 0xa054);
9191 break;
9192 }
9193}
9194
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01009195static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +08009196 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
9197 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
9198 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
9199 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
9200 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
9201 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
9202 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
9203 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
9204 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
9205 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
9206 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
9207 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
9208 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
9209 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
9210 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
9211 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
9212 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
9213 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
9214 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
9215 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
9216 {}
9217};
9218
9219static void alc668_restore_default_value(struct hda_codec *codec)
9220{
9221 alc_process_coef_fw(codec, alc668_coefs);
9222}
9223
David Henningsson6cb3b702010-09-09 08:51:44 +02009224enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04009225 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01009226 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009227 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08009228 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009229 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009230 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02009231 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009232 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02009233 ALC662_FIXUP_ASUS_MODE1,
9234 ALC662_FIXUP_ASUS_MODE2,
9235 ALC662_FIXUP_ASUS_MODE3,
9236 ALC662_FIXUP_ASUS_MODE4,
9237 ALC662_FIXUP_ASUS_MODE5,
9238 ALC662_FIXUP_ASUS_MODE6,
9239 ALC662_FIXUP_ASUS_MODE7,
9240 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009241 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02009242 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02009243 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009244 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02009245 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009246 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02009247 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009248 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01009249 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009250 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009251 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08009252 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009253 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009254 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009255 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009256 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009257 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009258 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +02009259 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009260 ALC891_FIXUP_HEADSET_MODE,
9261 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009262 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009263 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08009264 ALC662_FIXUP_USI_FUNC,
9265 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08009266 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009267 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009268 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +08009269 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +08009270 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +08009271 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
David Henningsson6cb3b702010-09-09 08:51:44 +02009272};
9273
Takashi Iwai1727a772013-01-10 09:52:52 +01009274static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04009275 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009276 .type = HDA_FIXUP_PINS,
9277 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04009278 { 0x15, 0x99130112 }, /* subwoofer */
9279 { }
9280 }
9281 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01009282 [ALC662_FIXUP_LED_GPIO1] = {
9283 .type = HDA_FIXUP_FUNC,
9284 .v.func = alc662_fixup_led_gpio1,
9285 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009286 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009287 .type = HDA_FIXUP_PINS,
9288 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02009289 { 0x17, 0x99130112 }, /* subwoofer */
9290 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01009291 },
9292 .chained = true,
9293 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009294 },
Todd Broch6be79482010-12-07 16:51:05 -08009295 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009296 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01009297 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009298 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009299 [ALC662_FIXUP_CZC_ET26] = {
9300 .type = HDA_FIXUP_PINS,
9301 .v.pins = (const struct hda_pintbl[]) {
9302 {0x12, 0x403cc000},
9303 {0x14, 0x90170110}, /* speaker */
9304 {0x15, 0x411111f0},
9305 {0x16, 0x411111f0},
9306 {0x18, 0x01a19030}, /* mic */
9307 {0x19, 0x90a7013f}, /* int-mic */
9308 {0x1a, 0x01014020},
9309 {0x1b, 0x0121401f},
9310 {0x1c, 0x411111f0},
9311 {0x1d, 0x411111f0},
9312 {0x1e, 0x40478e35},
9313 {}
9314 },
9315 .chained = true,
9316 .chain_id = ALC662_FIXUP_SKU_IGNORE
9317 },
Anisse Astierd2ebd472011-01-20 12:36:21 +01009318 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009319 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009320 .v.verbs = (const struct hda_verb[]) {
9321 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
9322 {}
9323 }
9324 },
David Henningsson94024cd2011-04-29 14:10:55 +02009325 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009326 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02009327 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02009328 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009329 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009330 .type = HDA_FIXUP_PINS,
9331 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009332 { 0x14, 0x0221201f }, /* HP out */
9333 { }
9334 },
9335 .chained = true,
9336 .chain_id = ALC662_FIXUP_SKU_IGNORE
9337 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009338 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009339 .type = HDA_FIXUP_PINS,
9340 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009341 { 0x14, 0x99130110 }, /* speaker */
9342 { 0x18, 0x01a19c20 }, /* mic */
9343 { 0x19, 0x99a3092f }, /* int-mic */
9344 { 0x21, 0x0121401f }, /* HP out */
9345 { }
9346 },
9347 .chained = true,
9348 .chain_id = ALC662_FIXUP_SKU_IGNORE
9349 },
9350 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009351 .type = HDA_FIXUP_PINS,
9352 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009353 { 0x14, 0x99130110 }, /* speaker */
9354 { 0x18, 0x01a19820 }, /* mic */
9355 { 0x19, 0x99a3092f }, /* int-mic */
9356 { 0x1b, 0x0121401f }, /* HP out */
9357 { }
9358 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009359 .chained = true,
9360 .chain_id = ALC662_FIXUP_SKU_IGNORE
9361 },
9362 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009363 .type = HDA_FIXUP_PINS,
9364 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009365 { 0x14, 0x99130110 }, /* speaker */
9366 { 0x15, 0x0121441f }, /* HP */
9367 { 0x18, 0x01a19840 }, /* mic */
9368 { 0x19, 0x99a3094f }, /* int-mic */
9369 { 0x21, 0x01211420 }, /* HP2 */
9370 { }
9371 },
9372 .chained = true,
9373 .chain_id = ALC662_FIXUP_SKU_IGNORE
9374 },
9375 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009376 .type = HDA_FIXUP_PINS,
9377 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009378 { 0x14, 0x99130110 }, /* speaker */
9379 { 0x16, 0x99130111 }, /* speaker */
9380 { 0x18, 0x01a19840 }, /* mic */
9381 { 0x19, 0x99a3094f }, /* int-mic */
9382 { 0x21, 0x0121441f }, /* HP */
9383 { }
9384 },
9385 .chained = true,
9386 .chain_id = ALC662_FIXUP_SKU_IGNORE
9387 },
9388 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009389 .type = HDA_FIXUP_PINS,
9390 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009391 { 0x14, 0x99130110 }, /* speaker */
9392 { 0x15, 0x0121441f }, /* HP */
9393 { 0x16, 0x99130111 }, /* speaker */
9394 { 0x18, 0x01a19840 }, /* mic */
9395 { 0x19, 0x99a3094f }, /* int-mic */
9396 { }
9397 },
9398 .chained = true,
9399 .chain_id = ALC662_FIXUP_SKU_IGNORE
9400 },
9401 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009402 .type = HDA_FIXUP_PINS,
9403 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009404 { 0x14, 0x99130110 }, /* speaker */
9405 { 0x15, 0x01211420 }, /* HP2 */
9406 { 0x18, 0x01a19840 }, /* mic */
9407 { 0x19, 0x99a3094f }, /* int-mic */
9408 { 0x1b, 0x0121441f }, /* HP */
9409 { }
9410 },
9411 .chained = true,
9412 .chain_id = ALC662_FIXUP_SKU_IGNORE
9413 },
9414 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009415 .type = HDA_FIXUP_PINS,
9416 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009417 { 0x14, 0x99130110 }, /* speaker */
9418 { 0x17, 0x99130111 }, /* speaker */
9419 { 0x18, 0x01a19840 }, /* mic */
9420 { 0x19, 0x99a3094f }, /* int-mic */
9421 { 0x1b, 0x01214020 }, /* HP */
9422 { 0x21, 0x0121401f }, /* HP */
9423 { }
9424 },
9425 .chained = true,
9426 .chain_id = ALC662_FIXUP_SKU_IGNORE
9427 },
9428 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009429 .type = HDA_FIXUP_PINS,
9430 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009431 { 0x14, 0x99130110 }, /* speaker */
9432 { 0x12, 0x99a30970 }, /* int-mic */
9433 { 0x15, 0x01214020 }, /* HP */
9434 { 0x17, 0x99130111 }, /* speaker */
9435 { 0x18, 0x01a19840 }, /* mic */
9436 { 0x21, 0x0121401f }, /* HP */
9437 { }
9438 },
9439 .chained = true,
9440 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009441 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01009442 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009443 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009444 .v.func = alc_fixup_no_jack_detect,
9445 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02009446 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009447 .type = HDA_FIXUP_PINS,
9448 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02009449 { 0x1b, 0x02214020 }, /* Front HP */
9450 { }
9451 }
9452 },
Takashi Iwai125821a2012-06-22 14:30:29 +02009453 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009454 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02009455 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02009456 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009457 [ALC668_FIXUP_DELL_XPS13] = {
9458 .type = HDA_FIXUP_FUNC,
9459 .v.func = alc_fixup_dell_xps13,
9460 .chained = true,
9461 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
9462 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009463 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
9464 .type = HDA_FIXUP_FUNC,
9465 .v.func = alc_fixup_disable_aamix,
9466 .chained = true,
9467 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9468 },
Hui Wang493a52a2014-01-14 14:07:36 +08009469 [ALC668_FIXUP_AUTO_MUTE] = {
9470 .type = HDA_FIXUP_FUNC,
9471 .v.func = alc_fixup_auto_mute_via_amp,
9472 .chained = true,
9473 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9474 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02009475 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
9476 .type = HDA_FIXUP_PINS,
9477 .v.pins = (const struct hda_pintbl[]) {
9478 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9479 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
9480 { }
9481 },
9482 .chained = true,
9483 .chain_id = ALC662_FIXUP_HEADSET_MODE
9484 },
9485 [ALC662_FIXUP_HEADSET_MODE] = {
9486 .type = HDA_FIXUP_FUNC,
9487 .v.func = alc_fixup_headset_mode_alc662,
9488 },
David Henningsson73bdd592013-04-15 15:44:14 +02009489 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
9490 .type = HDA_FIXUP_PINS,
9491 .v.pins = (const struct hda_pintbl[]) {
9492 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9493 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9494 { }
9495 },
9496 .chained = true,
9497 .chain_id = ALC668_FIXUP_HEADSET_MODE
9498 },
9499 [ALC668_FIXUP_HEADSET_MODE] = {
9500 .type = HDA_FIXUP_FUNC,
9501 .v.func = alc_fixup_headset_mode_alc668,
9502 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009503 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01009504 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009505 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01009506 .chained = true,
9507 .chain_id = ALC662_FIXUP_ASUS_MODE4
9508 },
David Henningsson61a75f12014-02-07 09:31:08 +01009509 [ALC662_FIXUP_BASS_16] = {
9510 .type = HDA_FIXUP_PINS,
9511 .v.pins = (const struct hda_pintbl[]) {
9512 {0x16, 0x80106111}, /* bass speaker */
9513 {}
9514 },
9515 .chained = true,
9516 .chain_id = ALC662_FIXUP_BASS_CHMAP,
9517 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009518 [ALC662_FIXUP_BASS_1A] = {
9519 .type = HDA_FIXUP_PINS,
9520 .v.pins = (const struct hda_pintbl[]) {
9521 {0x1a, 0x80106111}, /* bass speaker */
9522 {}
9523 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009524 .chained = true,
9525 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009526 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009527 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009528 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009529 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009530 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009531 [ALC662_FIXUP_ASUS_Nx50] = {
9532 .type = HDA_FIXUP_FUNC,
9533 .v.func = alc_fixup_auto_mute_via_amp,
9534 .chained = true,
9535 .chain_id = ALC662_FIXUP_BASS_1A
9536 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009537 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
9538 .type = HDA_FIXUP_FUNC,
9539 .v.func = alc_fixup_headset_mode_alc668,
9540 .chain_id = ALC662_FIXUP_BASS_CHMAP
9541 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009542 [ALC668_FIXUP_ASUS_Nx51] = {
9543 .type = HDA_FIXUP_PINS,
9544 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009545 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9546 { 0x1a, 0x90170151 }, /* bass speaker */
9547 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009548 {}
9549 },
9550 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009551 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009552 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009553 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +02009554 .type = HDA_FIXUP_VERBS,
9555 .v.verbs = (const struct hda_verb[]) {
9556 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
9557 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
9558 {}
9559 },
9560 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009561 [ALC668_FIXUP_ASUS_G751] = {
9562 .type = HDA_FIXUP_PINS,
9563 .v.pins = (const struct hda_pintbl[]) {
9564 { 0x16, 0x0421101f }, /* HP */
9565 {}
9566 },
9567 .chained = true,
9568 .chain_id = ALC668_FIXUP_MIC_COEF
9569 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009570 [ALC891_FIXUP_HEADSET_MODE] = {
9571 .type = HDA_FIXUP_FUNC,
9572 .v.func = alc_fixup_headset_mode,
9573 },
9574 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
9575 .type = HDA_FIXUP_PINS,
9576 .v.pins = (const struct hda_pintbl[]) {
9577 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9578 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9579 { }
9580 },
9581 .chained = true,
9582 .chain_id = ALC891_FIXUP_HEADSET_MODE
9583 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009584 [ALC662_FIXUP_ACER_VERITON] = {
9585 .type = HDA_FIXUP_PINS,
9586 .v.pins = (const struct hda_pintbl[]) {
9587 { 0x15, 0x50170120 }, /* no internal speaker */
9588 { }
9589 }
9590 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009591 [ALC892_FIXUP_ASROCK_MOBO] = {
9592 .type = HDA_FIXUP_PINS,
9593 .v.pins = (const struct hda_pintbl[]) {
9594 { 0x15, 0x40f000f0 }, /* disabled */
9595 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009596 { }
9597 }
9598 },
Kailang Yangc6790c82016-11-25 16:15:17 +08009599 [ALC662_FIXUP_USI_FUNC] = {
9600 .type = HDA_FIXUP_FUNC,
9601 .v.func = alc662_fixup_usi_headset_mic,
9602 },
9603 [ALC662_FIXUP_USI_HEADSET_MODE] = {
9604 .type = HDA_FIXUP_PINS,
9605 .v.pins = (const struct hda_pintbl[]) {
9606 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
9607 { 0x18, 0x01a1903d },
9608 { }
9609 },
9610 .chained = true,
9611 .chain_id = ALC662_FIXUP_USI_FUNC
9612 },
Kailang Yangca169cc2017-04-25 16:17:40 +08009613 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
9614 .type = HDA_FIXUP_FUNC,
9615 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
9616 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009617 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
9618 .type = HDA_FIXUP_FUNC,
9619 .v.func = alc662_fixup_aspire_ethos_hp,
9620 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009621 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
9622 .type = HDA_FIXUP_PINS,
9623 .v.pins = (const struct hda_pintbl[]) {
9624 { 0x15, 0x92130110 }, /* front speakers */
9625 { 0x18, 0x99130111 }, /* center/subwoofer */
9626 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
9627 { }
9628 },
9629 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +01009630 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009631 },
Kailang Yang5af290282020-01-17 14:04:01 +08009632 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
9633 .type = HDA_FIXUP_FUNC,
9634 .v.func = alc671_fixup_hp_headset_mic2,
9635 },
Jian-Hong Pand858c702020-03-17 16:28:07 +08009636 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
9637 .type = HDA_FIXUP_PINS,
9638 .v.pins = (const struct hda_pintbl[]) {
9639 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9640 { }
9641 },
9642 .chained = true,
9643 .chain_id = ALC662_FIXUP_USI_FUNC
9644 },
Jian-Hong Pana1244582020-03-17 16:28:09 +08009645 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
9646 .type = HDA_FIXUP_PINS,
9647 .v.pins = (const struct hda_pintbl[]) {
9648 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
9649 { 0x1b, 0x0221144f },
9650 { }
9651 },
9652 .chained = true,
9653 .chain_id = ALC662_FIXUP_USI_FUNC
9654 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009655};
9656
Takashi Iwaia9111322011-05-02 11:30:18 +02009657static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009658 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +02009659 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +01009660 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +01009661 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +02009662 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +02009663 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +02009664 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -04009665 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Jian-Hong Pana1244582020-03-17 16:28:09 +08009666 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +08009667 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +02009668 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9669 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +02009670 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009671 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +02009672 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +01009673 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +01009674 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +08009675 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9676 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +08009677 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009678 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Kaho Ng2da2dc92016-05-09 00:27:49 +08009679 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +02009680 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwaidb8948e2016-01-18 09:17:30 +01009681 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009682 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +02009683 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
David Henningsson8e54b4a2014-02-07 09:31:07 +01009684 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +01009685 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009686 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
9687 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +01009688 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +01009689 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +01009690 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +01009691 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +02009692 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -05009693 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +08009694 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +08009695 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +06009696 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +02009697 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009698 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +02009699 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009700 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009701 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +01009702 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009703 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Takashi Iwai53c334a2011-08-23 18:27:14 +02009704
9705#if 0
9706 /* Below is a quirk table taken from the old code.
9707 * Basically the device should work as is without the fixup table.
9708 * If BIOS doesn't give a proper info, enable the corresponding
9709 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009710 */
Takashi Iwai53c334a2011-08-23 18:27:14 +02009711 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
9712 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
9713 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
9714 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
9715 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9716 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9717 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9718 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
9719 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
9720 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9721 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
9722 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
9723 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
9724 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
9725 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
9726 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9727 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
9728 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
9729 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9730 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9731 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9732 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9733 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
9734 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
9735 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
9736 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9737 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
9738 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9739 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9740 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
9741 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9742 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9743 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
9744 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
9745 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
9746 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
9747 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
9748 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
9749 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
9750 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9751 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
9752 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
9753 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9754 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
9755 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
9756 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
9757 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
9758 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
9759 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9760 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
9761#endif
David Henningsson6cb3b702010-09-09 08:51:44 +02009762 {}
9763};
9764
Takashi Iwai1727a772013-01-10 09:52:52 +01009765static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009766 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
9767 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -08009768 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009769 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +02009770 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
9771 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
9772 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
9773 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
9774 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
9775 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
9776 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
9777 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009778 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02009779 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009780 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +02009781 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009782 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
9783 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
9784 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
9785 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
9786 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
9787 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
9788 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
9789 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +02009790 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009791 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
9792 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
9793 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
9794 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
9795 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02009796 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009797 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -08009798 {}
9799};
David Henningsson6cb3b702010-09-09 08:51:44 +02009800
Hui Wang532895c2014-05-29 15:59:19 +08009801static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009802 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9803 {0x17, 0x02211010},
9804 {0x18, 0x01a19030},
9805 {0x1a, 0x01813040},
9806 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +08009807 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9808 {0x16, 0x01813030},
9809 {0x17, 0x02211010},
9810 {0x18, 0x01a19040},
9811 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +02009812 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009813 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +02009814 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +02009815 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +08009816 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +02009817 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9818 {0x12, 0x99a30130},
9819 {0x14, 0x90170110},
9820 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08009821 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02009822 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9823 {0x12, 0x99a30140},
9824 {0x14, 0x90170110},
9825 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08009826 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02009827 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9828 {0x12, 0x99a30150},
9829 {0x14, 0x90170110},
9830 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08009831 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02009832 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +02009833 {0x14, 0x90170110},
9834 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08009835 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02009836 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
9837 {0x12, 0x90a60130},
9838 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08009839 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +08009840 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9841 {0x14, 0x01014010},
9842 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +08009843 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +08009844 {0x1b, 0x01813030},
9845 {0x21, 0x02211020}),
9846 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9847 {0x14, 0x01014010},
9848 {0x18, 0x01a19040},
9849 {0x1b, 0x01813030},
9850 {0x21, 0x02211020}),
9851 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
9852 {0x14, 0x01014020},
9853 {0x17, 0x90170110},
9854 {0x18, 0x01a19050},
9855 {0x1b, 0x01813040},
9856 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +08009857 {}
9858};
9859
Takashi Iwai1d045db2011-07-07 18:23:21 +02009860/*
9861 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009862static int patch_alc662(struct hda_codec *codec)
9863{
9864 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02009865 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009866
Takashi Iwai3de95172012-05-07 18:03:15 +02009867 err = alc_alloc_spec(codec, 0x0b);
9868 if (err < 0)
9869 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009870
Takashi Iwai3de95172012-05-07 18:03:15 +02009871 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02009872
Takashi Iwai225068a2015-05-29 10:42:14 +02009873 spec->shutup = alc_eapd_shutup;
9874
Takashi Iwai53c334a2011-08-23 18:27:14 +02009875 /* handle multiple HPs as is */
9876 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
9877
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +02009878 alc_fix_pll_init(codec, 0x20, 0x04, 15);
9879
Takashi Iwai7639a062015-03-03 10:07:24 +01009880 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +08009881 case 0x10ec0668:
9882 spec->init_hook = alc668_restore_default_value;
9883 break;
Kailang Yangf3f91852014-10-24 15:43:46 +08009884 }
Kailang Yang8663ff72012-06-29 09:35:52 +02009885
Takashi Iwaic9af7532019-05-10 11:01:43 +02009886 alc_pre_init(codec);
9887
Takashi Iwai1727a772013-01-10 09:52:52 +01009888 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +02009889 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +08009890 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +01009891 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +02009892
9893 alc_auto_parse_customize_define(codec);
9894
Takashi Iwai7504b6c2013-03-18 11:25:51 +01009895 if (has_cdefine_beep(codec))
9896 spec->gen.beep_nid = 0x01;
9897
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009898 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +01009899 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009900 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +08009901 err = alc_codec_rename(codec, "ALC272X");
9902 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009903 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009904 }
Kailang Yang274693f2009-12-03 10:07:50 +01009905
Takashi Iwaib9c51062011-08-24 18:08:07 +02009906 /* automatic parse from the BIOS config */
9907 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009908 if (err < 0)
9909 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009910
Takashi Iwai7504b6c2013-03-18 11:25:51 +01009911 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +01009912 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +01009913 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009914 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01009915 break;
9916 case 0x10ec0272:
9917 case 0x10ec0663:
9918 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +08009919 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009920 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01009921 break;
9922 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009923 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01009924 break;
9925 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009926 if (err < 0)
9927 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +01009928 }
Takashi Iwai2134ea42008-01-10 16:53:55 +01009929
Takashi Iwai1727a772013-01-10 09:52:52 +01009930 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009931
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009932 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009933
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009934 error:
9935 alc_free(codec);
9936 return err;
Kailang Yangb478b992011-05-18 11:51:15 +02009937}
9938
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009939/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02009940 * ALC680 support
9941 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02009942
Kailang Yangd1eb57f2010-06-23 16:25:26 +02009943static int alc680_parse_auto_config(struct hda_codec *codec)
9944{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009945 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +02009946}
9947
Kailang Yangd1eb57f2010-06-23 16:25:26 +02009948/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02009949 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02009950static int patch_alc680(struct hda_codec *codec)
9951{
Kailang Yangd1eb57f2010-06-23 16:25:26 +02009952 int err;
9953
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02009954 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02009955 err = alc_alloc_spec(codec, 0);
9956 if (err < 0)
9957 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02009958
Takashi Iwai1ebec5f2011-08-15 13:21:48 +02009959 /* automatic parse from the BIOS config */
9960 err = alc680_parse_auto_config(codec);
9961 if (err < 0) {
9962 alc_free(codec);
9963 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +02009964 }
9965
Kailang Yangd1eb57f2010-06-23 16:25:26 +02009966 return 0;
9967}
9968
9969/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07009970 * patch entries
9971 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +02009972static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +08009973 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02009974 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +08009975 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +08009976 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02009977 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
9978 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009979 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02009980 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +08009981 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +08009982 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02009983 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
9984 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +08009985 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02009986 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
9987 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
9988 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
9989 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
9990 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
9991 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
9992 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009993 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02009994 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
9995 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
9996 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
9997 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
9998 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
9999 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010000 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010001 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080010002 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010003 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010004 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010005 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10006 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10007 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010008 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080010009 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010010 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080010011 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080010012 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080010013 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010014 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10015 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10016 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10017 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10018 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10019 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10020 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10021 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10022 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10023 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10024 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10025 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10026 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10027 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080010028 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10029 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10030 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080010031 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010032 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010033 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10034 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10035 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10036 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10037 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10038 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10039 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10040 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10041 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10042 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10043 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
10044 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10045 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080010046 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080010047 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080010048 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070010049 {} /* terminator */
10050};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010051MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010052
10053MODULE_LICENSE("GPL");
10054MODULE_DESCRIPTION("Realtek HD-audio codec");
10055
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010056static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010057 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010058};
10059
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010060module_hda_codec_driver(realtek_driver);