1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
5 * HD audio interface patch for Realtek ALC codecs
6 *
7 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
9 * Takashi Iwai <tiwai@suse.de>
10 * Jonathan Woithe <jwoithe@just42.net>
11 */
12
13 #include <linux/init.h>
14 #include <linux/delay.h>
15 #include <linux/slab.h>
16 #include <linux/pci.h>
17 #include <linux/dmi.h>
18 #include <linux/module.h>
19 #include <linux/input.h>
20 #include <linux/leds.h>
21 #include <linux/ctype.h>
22 #include <sound/core.h>
23 #include <sound/jack.h>
24 #include <sound/hda_codec.h>
25 #include "hda_local.h"
26 #include "hda_auto_parser.h"
27 #include "hda_jack.h"
28 #include "hda_generic.h"
29 #include "hda_component.h"
30
31 /* keep halting ALC5505 DSP, for power saving */
32 #define HALT_REALTEK_ALC5505
33
34 /* extra amp-initialization sequence types */
35 enum {
36 ALC_INIT_UNDEFINED,
37 ALC_INIT_NONE,
38 ALC_INIT_DEFAULT,
39 };
40
41 enum {
42 ALC_HEADSET_MODE_UNKNOWN,
43 ALC_HEADSET_MODE_UNPLUGGED,
44 ALC_HEADSET_MODE_HEADSET,
45 ALC_HEADSET_MODE_MIC,
46 ALC_HEADSET_MODE_HEADPHONE,
47 };
48
49 enum {
50 ALC_HEADSET_TYPE_UNKNOWN,
51 ALC_HEADSET_TYPE_CTIA,
52 ALC_HEADSET_TYPE_OMTP,
53 };
54
55 enum {
56 ALC_KEY_MICMUTE_INDEX,
57 };
58
59 struct alc_customize_define {
60 unsigned int sku_cfg;
61 unsigned char port_connectivity;
62 unsigned char check_sum;
63 unsigned char customization;
64 unsigned char external_amp;
65 unsigned int enable_pcbeep:1;
66 unsigned int platform_type:1;
67 unsigned int swap:1;
68 unsigned int override:1;
69 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
70 };
71
72 struct alc_coef_led {
73 unsigned int idx;
74 unsigned int mask;
75 unsigned int on;
76 unsigned int off;
77 };
78
79 struct alc_spec {
80 struct hda_gen_spec gen; /* must be at head */
81
82 /* codec parameterization */
83 struct alc_customize_define cdefine;
84 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
85
86 /* GPIO bits */
87 unsigned int gpio_mask;
88 unsigned int gpio_dir;
89 unsigned int gpio_data;
90 bool gpio_write_delay; /* add a delay before writing gpio_data */
91
92 /* mute LED for HP laptops, see vref_mute_led_set() */
93 int mute_led_polarity;
94 int micmute_led_polarity;
95 hda_nid_t mute_led_nid;
96 hda_nid_t cap_mute_led_nid;
97
98 unsigned int gpio_mute_led_mask;
99 unsigned int gpio_mic_led_mask;
100 struct alc_coef_led mute_led_coef;
101 struct alc_coef_led mic_led_coef;
102 struct mutex coef_mutex;
103
104 hda_nid_t headset_mic_pin;
105 hda_nid_t headphone_mic_pin;
106 int current_headset_mode;
107 int current_headset_type;
108
109 /* hooks */
110 void (*init_hook)(struct hda_codec *codec);
111 #ifdef CONFIG_PM
112 void (*power_hook)(struct hda_codec *codec);
113 #endif
114 void (*shutup)(struct hda_codec *codec);
115
116 int init_amp;
117 int codec_variant; /* flag for other variants */
118 unsigned int has_alc5505_dsp:1;
119 unsigned int no_depop_delay:1;
120 unsigned int done_hp_init:1;
121 unsigned int no_shutup_pins:1;
122 unsigned int ultra_low_power:1;
123 unsigned int has_hs_key:1;
124 unsigned int no_internal_mic_pin:1;
125 unsigned int en_3kpull_low:1;
126
127 /* for PLL fix */
128 hda_nid_t pll_nid;
129 unsigned int pll_coef_idx, pll_coef_bit;
130 unsigned int coef0;
131 struct input_dev *kb_dev;
132 u8 alc_mute_keycode_map[1];
133
134 /* component binding */
135 struct component_match *match;
136 struct hda_component comps[HDA_MAX_COMPONENTS];
137 };
138
139 /*
140 * COEF access helper functions
141 */
142
coef_mutex_lock(struct hda_codec * codec)143 static void coef_mutex_lock(struct hda_codec *codec)
144 {
145 struct alc_spec *spec = codec->spec;
146
147 snd_hda_power_up_pm(codec);
148 mutex_lock(&spec->coef_mutex);
149 }
150
coef_mutex_unlock(struct hda_codec * codec)151 static void coef_mutex_unlock(struct hda_codec *codec)
152 {
153 struct alc_spec *spec = codec->spec;
154
155 mutex_unlock(&spec->coef_mutex);
156 snd_hda_power_down_pm(codec);
157 }
158
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)159 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 unsigned int coef_idx)
161 {
162 unsigned int val;
163
164 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
165 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
166 return val;
167 }
168
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)169 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
170 unsigned int coef_idx)
171 {
172 unsigned int val;
173
174 coef_mutex_lock(codec);
175 val = __alc_read_coefex_idx(codec, nid, coef_idx);
176 coef_mutex_unlock(codec);
177 return val;
178 }
179
180 #define alc_read_coef_idx(codec, coef_idx) \
181 alc_read_coefex_idx(codec, 0x20, coef_idx)
182
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)183 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
184 unsigned int coef_idx, unsigned int coef_val)
185 {
186 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
187 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
188 }
189
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)190 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
191 unsigned int coef_idx, unsigned int coef_val)
192 {
193 coef_mutex_lock(codec);
194 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
195 coef_mutex_unlock(codec);
196 }
197
198 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
199 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
200
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)201 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
202 unsigned int coef_idx, unsigned int mask,
203 unsigned int bits_set)
204 {
205 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
206
207 if (val != -1)
208 __alc_write_coefex_idx(codec, nid, coef_idx,
209 (val & ~mask) | bits_set);
210 }
211
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)212 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
213 unsigned int coef_idx, unsigned int mask,
214 unsigned int bits_set)
215 {
216 coef_mutex_lock(codec);
217 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
218 coef_mutex_unlock(codec);
219 }
220
221 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
222 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
223
224 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)225 static unsigned int alc_get_coef0(struct hda_codec *codec)
226 {
227 struct alc_spec *spec = codec->spec;
228
229 if (!spec->coef0)
230 spec->coef0 = alc_read_coef_idx(codec, 0);
231 return spec->coef0;
232 }
233
234 /* coef writes/updates batch */
235 struct coef_fw {
236 unsigned char nid;
237 unsigned char idx;
238 unsigned short mask;
239 unsigned short val;
240 };
241
242 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
243 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
244 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
245 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
246 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
247
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)248 static void alc_process_coef_fw(struct hda_codec *codec,
249 const struct coef_fw *fw)
250 {
251 coef_mutex_lock(codec);
252 for (; fw->nid; fw++) {
253 if (fw->mask == (unsigned short)-1)
254 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
255 else
256 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
257 fw->mask, fw->val);
258 }
259 coef_mutex_unlock(codec);
260 }
261
262 /*
263 * GPIO setup tables, used in initialization
264 */
265
266 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)267 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
268 {
269 struct alc_spec *spec = codec->spec;
270
271 spec->gpio_mask |= mask;
272 spec->gpio_dir |= mask;
273 spec->gpio_data |= mask;
274 }
275
alc_write_gpio_data(struct hda_codec * codec)276 static void alc_write_gpio_data(struct hda_codec *codec)
277 {
278 struct alc_spec *spec = codec->spec;
279
280 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
281 spec->gpio_data);
282 }
283
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)284 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
285 bool on)
286 {
287 struct alc_spec *spec = codec->spec;
288 unsigned int oldval = spec->gpio_data;
289
290 if (on)
291 spec->gpio_data |= mask;
292 else
293 spec->gpio_data &= ~mask;
294 if (oldval != spec->gpio_data)
295 alc_write_gpio_data(codec);
296 }
297
alc_write_gpio(struct hda_codec * codec)298 static void alc_write_gpio(struct hda_codec *codec)
299 {
300 struct alc_spec *spec = codec->spec;
301
302 if (!spec->gpio_mask)
303 return;
304
305 snd_hda_codec_write(codec, codec->core.afg, 0,
306 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
307 snd_hda_codec_write(codec, codec->core.afg, 0,
308 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
309 if (spec->gpio_write_delay)
310 msleep(1);
311 alc_write_gpio_data(codec);
312 }
313
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)314 static void alc_fixup_gpio(struct hda_codec *codec, int action,
315 unsigned int mask)
316 {
317 if (action == HDA_FIXUP_ACT_PRE_PROBE)
318 alc_setup_gpio(codec, mask);
319 }
320
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)321 static void alc_fixup_gpio1(struct hda_codec *codec,
322 const struct hda_fixup *fix, int action)
323 {
324 alc_fixup_gpio(codec, action, 0x01);
325 }
326
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)327 static void alc_fixup_gpio2(struct hda_codec *codec,
328 const struct hda_fixup *fix, int action)
329 {
330 alc_fixup_gpio(codec, action, 0x02);
331 }
332
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)333 static void alc_fixup_gpio3(struct hda_codec *codec,
334 const struct hda_fixup *fix, int action)
335 {
336 alc_fixup_gpio(codec, action, 0x03);
337 }
338
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)339 static void alc_fixup_gpio4(struct hda_codec *codec,
340 const struct hda_fixup *fix, int action)
341 {
342 alc_fixup_gpio(codec, action, 0x04);
343 }
344
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)345 static void alc_fixup_micmute_led(struct hda_codec *codec,
346 const struct hda_fixup *fix, int action)
347 {
348 if (action == HDA_FIXUP_ACT_PRE_PROBE)
349 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
350 }
351
352 /*
353 * Fix hardware PLL issue
354 * On some codecs, the analog PLL gating control must be off while
355 * the default value is 1.
356 */
alc_fix_pll(struct hda_codec * codec)357 static void alc_fix_pll(struct hda_codec *codec)
358 {
359 struct alc_spec *spec = codec->spec;
360
361 if (spec->pll_nid)
362 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
363 1 << spec->pll_coef_bit, 0);
364 }
365
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)366 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
367 unsigned int coef_idx, unsigned int coef_bit)
368 {
369 struct alc_spec *spec = codec->spec;
370 spec->pll_nid = nid;
371 spec->pll_coef_idx = coef_idx;
372 spec->pll_coef_bit = coef_bit;
373 alc_fix_pll(codec);
374 }
375
376 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)377 static void alc_update_knob_master(struct hda_codec *codec,
378 struct hda_jack_callback *jack)
379 {
380 unsigned int val;
381 struct snd_kcontrol *kctl;
382 struct snd_ctl_elem_value *uctl;
383
384 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
385 if (!kctl)
386 return;
387 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
388 if (!uctl)
389 return;
390 val = snd_hda_codec_read(codec, jack->nid, 0,
391 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
392 val &= HDA_AMP_VOLMASK;
393 uctl->value.integer.value[0] = val;
394 uctl->value.integer.value[1] = val;
395 kctl->put(kctl, uctl);
396 kfree(uctl);
397 }
398
alc880_unsol_event(struct hda_codec * codec,unsigned int res)399 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
400 {
401 /* For some reason, the res given from ALC880 is broken.
402 Here we adjust it properly. */
403 snd_hda_jack_unsol_event(codec, res >> 2);
404 }
405
406 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)407 static void alc_fill_eapd_coef(struct hda_codec *codec)
408 {
409 int coef;
410
411 coef = alc_get_coef0(codec);
412
413 switch (codec->core.vendor_id) {
414 case 0x10ec0262:
415 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
416 break;
417 case 0x10ec0267:
418 case 0x10ec0268:
419 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
420 break;
421 case 0x10ec0269:
422 if ((coef & 0x00f0) == 0x0010)
423 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
424 if ((coef & 0x00f0) == 0x0020)
425 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
426 if ((coef & 0x00f0) == 0x0030)
427 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
428 break;
429 case 0x10ec0280:
430 case 0x10ec0284:
431 case 0x10ec0290:
432 case 0x10ec0292:
433 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
434 break;
435 case 0x10ec0225:
436 case 0x10ec0295:
437 case 0x10ec0299:
438 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
439 fallthrough;
440 case 0x10ec0215:
441 case 0x10ec0285:
442 case 0x10ec0289:
443 alc_update_coef_idx(codec, 0x36, 1<<13, 0);
444 fallthrough;
445 case 0x10ec0230:
446 case 0x10ec0233:
447 case 0x10ec0235:
448 case 0x10ec0236:
449 case 0x10ec0245:
450 case 0x10ec0255:
451 case 0x10ec0256:
452 case 0x19e58326:
453 case 0x10ec0257:
454 case 0x10ec0282:
455 case 0x10ec0283:
456 case 0x10ec0286:
457 case 0x10ec0288:
458 case 0x10ec0298:
459 case 0x10ec0300:
460 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
461 break;
462 case 0x10ec0275:
463 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
464 break;
465 case 0x10ec0287:
466 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
467 alc_write_coef_idx(codec, 0x8, 0x4ab7);
468 break;
469 case 0x10ec0293:
470 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
471 break;
472 case 0x10ec0234:
473 case 0x10ec0274:
474 alc_write_coef_idx(codec, 0x6e, 0x0c25);
475 fallthrough;
476 case 0x10ec0294:
477 case 0x10ec0700:
478 case 0x10ec0701:
479 case 0x10ec0703:
480 case 0x10ec0711:
481 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
482 break;
483 case 0x10ec0662:
484 if ((coef & 0x00f0) == 0x0030)
485 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
486 break;
487 case 0x10ec0272:
488 case 0x10ec0273:
489 case 0x10ec0663:
490 case 0x10ec0665:
491 case 0x10ec0670:
492 case 0x10ec0671:
493 case 0x10ec0672:
494 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
495 break;
496 case 0x10ec0222:
497 case 0x10ec0623:
498 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
499 break;
500 case 0x10ec0668:
501 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
502 break;
503 case 0x10ec0867:
504 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
505 break;
506 case 0x10ec0888:
507 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
508 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
509 break;
510 case 0x10ec0892:
511 case 0x10ec0897:
512 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
513 break;
514 case 0x10ec0899:
515 case 0x10ec0900:
516 case 0x10ec0b00:
517 case 0x10ec1168:
518 case 0x10ec1220:
519 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
520 break;
521 }
522 }
523
524 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)525 static void alc888_coef_init(struct hda_codec *codec)
526 {
527 switch (alc_get_coef0(codec) & 0x00f0) {
528 /* alc888-VA */
529 case 0x00:
530 /* alc888-VB */
531 case 0x10:
532 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
533 break;
534 }
535 }
536
537 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)538 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
539 {
540 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
541 return;
542 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
543 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
544 on ? 2 : 0);
545 }
546
547 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)548 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
549 {
550 /* We currently only handle front, HP */
551 static const hda_nid_t pins[] = {
552 0x0f, 0x10, 0x14, 0x15, 0x17, 0
553 };
554 const hda_nid_t *p;
555 for (p = pins; *p; p++)
556 set_eapd(codec, *p, on);
557 }
558
559 static int find_ext_mic_pin(struct hda_codec *codec);
560
alc_headset_mic_no_shutup(struct hda_codec * codec)561 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
562 {
563 const struct hda_pincfg *pin;
564 int mic_pin = find_ext_mic_pin(codec);
565 int i;
566
567 /* don't shut up pins when unloading the driver; otherwise it breaks
568 * the default pin setup at the next load of the driver
569 */
570 if (codec->bus->shutdown)
571 return;
572
573 snd_array_for_each(&codec->init_pins, i, pin) {
574 /* use read here for syncing after issuing each verb */
575 if (pin->nid != mic_pin)
576 snd_hda_codec_read(codec, pin->nid, 0,
577 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
578 }
579
580 codec->pins_shutup = 1;
581 }
582
alc_shutup_pins(struct hda_codec * codec)583 static void alc_shutup_pins(struct hda_codec *codec)
584 {
585 struct alc_spec *spec = codec->spec;
586
587 switch (codec->core.vendor_id) {
588 case 0x10ec0236:
589 case 0x10ec0256:
590 case 0x10ec0257:
591 case 0x19e58326:
592 case 0x10ec0283:
593 case 0x10ec0285:
594 case 0x10ec0286:
595 case 0x10ec0287:
596 case 0x10ec0288:
597 case 0x10ec0295:
598 case 0x10ec0298:
599 alc_headset_mic_no_shutup(codec);
600 break;
601 default:
602 if (!spec->no_shutup_pins)
603 snd_hda_shutup_pins(codec);
604 break;
605 }
606 }
607
608 /* generic shutup callback;
609 * just turning off EAPD and a little pause for avoiding pop-noise
610 */
alc_eapd_shutup(struct hda_codec * codec)611 static void alc_eapd_shutup(struct hda_codec *codec)
612 {
613 struct alc_spec *spec = codec->spec;
614
615 alc_auto_setup_eapd(codec, false);
616 if (!spec->no_depop_delay)
617 msleep(200);
618 alc_shutup_pins(codec);
619 }
620
621 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)622 static void alc_auto_init_amp(struct hda_codec *codec, int type)
623 {
624 alc_auto_setup_eapd(codec, true);
625 alc_write_gpio(codec);
626 switch (type) {
627 case ALC_INIT_DEFAULT:
628 switch (codec->core.vendor_id) {
629 case 0x10ec0260:
630 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
631 break;
632 case 0x10ec0880:
633 case 0x10ec0882:
634 case 0x10ec0883:
635 case 0x10ec0885:
636 alc_update_coef_idx(codec, 7, 0, 0x2030);
637 break;
638 case 0x10ec0888:
639 alc888_coef_init(codec);
640 break;
641 }
642 break;
643 }
644 }
645
646 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)647 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
648 {
649 if (spec->gen.autocfg.hp_pins[0])
650 return spec->gen.autocfg.hp_pins[0];
651 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
652 return spec->gen.autocfg.line_out_pins[0];
653 return 0;
654 }
655
656 /*
657 * Realtek SSID verification
658 */
659
660 /* Could be any non-zero and even value. When used as fixup, tells
661 * the driver to ignore any present sku defines.
662 */
663 #define ALC_FIXUP_SKU_IGNORE (2)
664
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)665 static void alc_fixup_sku_ignore(struct hda_codec *codec,
666 const struct hda_fixup *fix, int action)
667 {
668 struct alc_spec *spec = codec->spec;
669 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
670 spec->cdefine.fixup = 1;
671 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
672 }
673 }
674
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)675 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
676 const struct hda_fixup *fix, int action)
677 {
678 struct alc_spec *spec = codec->spec;
679
680 if (action == HDA_FIXUP_ACT_PROBE) {
681 spec->no_depop_delay = 1;
682 codec->depop_delay = 0;
683 }
684 }
685
alc_auto_parse_customize_define(struct hda_codec * codec)686 static int alc_auto_parse_customize_define(struct hda_codec *codec)
687 {
688 unsigned int ass, tmp, i;
689 unsigned nid = 0;
690 struct alc_spec *spec = codec->spec;
691
692 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
693
694 if (spec->cdefine.fixup) {
695 ass = spec->cdefine.sku_cfg;
696 if (ass == ALC_FIXUP_SKU_IGNORE)
697 return -1;
698 goto do_sku;
699 }
700
701 if (!codec->bus->pci)
702 return -1;
703 ass = codec->core.subsystem_id & 0xffff;
704 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
705 goto do_sku;
706
707 nid = 0x1d;
708 if (codec->core.vendor_id == 0x10ec0260)
709 nid = 0x17;
710 ass = snd_hda_codec_get_pincfg(codec, nid);
711
712 if (!(ass & 1)) {
713 codec_info(codec, "%s: SKU not ready 0x%08x\n",
714 codec->core.chip_name, ass);
715 return -1;
716 }
717
718 /* check sum */
719 tmp = 0;
720 for (i = 1; i < 16; i++) {
721 if ((ass >> i) & 1)
722 tmp++;
723 }
724 if (((ass >> 16) & 0xf) != tmp)
725 return -1;
726
727 spec->cdefine.port_connectivity = ass >> 30;
728 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
729 spec->cdefine.check_sum = (ass >> 16) & 0xf;
730 spec->cdefine.customization = ass >> 8;
731 do_sku:
732 spec->cdefine.sku_cfg = ass;
733 spec->cdefine.external_amp = (ass & 0x38) >> 3;
734 spec->cdefine.platform_type = (ass & 0x4) >> 2;
735 spec->cdefine.swap = (ass & 0x2) >> 1;
736 spec->cdefine.override = ass & 0x1;
737
738 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
739 nid, spec->cdefine.sku_cfg);
740 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
741 spec->cdefine.port_connectivity);
742 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
743 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
744 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
745 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
746 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
747 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
748 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
749
750 return 0;
751 }
752
753 /* return the position of NID in the list, or -1 if not found */
find_idx_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)754 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
755 {
756 int i;
757 for (i = 0; i < nums; i++)
758 if (list[i] == nid)
759 return i;
760 return -1;
761 }
762 /* return true if the given NID is found in the list */
found_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)763 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
764 {
765 return find_idx_in_nid_list(nid, list, nums) >= 0;
766 }
767
768 /* check subsystem ID and set up device-specific initialization;
769 * return 1 if initialized, 0 if invalid SSID
770 */
771 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
772 * 31 ~ 16 : Manufacture ID
773 * 15 ~ 8 : SKU ID
774 * 7 ~ 0 : Assembly ID
775 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
776 */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)777 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
778 {
779 unsigned int ass, tmp, i;
780 unsigned nid;
781 struct alc_spec *spec = codec->spec;
782
783 if (spec->cdefine.fixup) {
784 ass = spec->cdefine.sku_cfg;
785 if (ass == ALC_FIXUP_SKU_IGNORE)
786 return 0;
787 goto do_sku;
788 }
789
790 ass = codec->core.subsystem_id & 0xffff;
791 if (codec->bus->pci &&
792 ass != codec->bus->pci->subsystem_device && (ass & 1))
793 goto do_sku;
794
795 /* invalid SSID, check the special NID pin defcfg instead */
796 /*
797 * 31~30 : port connectivity
798 * 29~21 : reserve
799 * 20 : PCBEEP input
800 * 19~16 : Check sum (15:1)
801 * 15~1 : Custom
802 * 0 : override
803 */
804 nid = 0x1d;
805 if (codec->core.vendor_id == 0x10ec0260)
806 nid = 0x17;
807 ass = snd_hda_codec_get_pincfg(codec, nid);
808 codec_dbg(codec,
809 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
810 ass, nid);
811 if (!(ass & 1))
812 return 0;
813 if ((ass >> 30) != 1) /* no physical connection */
814 return 0;
815
816 /* check sum */
817 tmp = 0;
818 for (i = 1; i < 16; i++) {
819 if ((ass >> i) & 1)
820 tmp++;
821 }
822 if (((ass >> 16) & 0xf) != tmp)
823 return 0;
824 do_sku:
825 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
826 ass & 0xffff, codec->core.vendor_id);
827 /*
828 * 0 : override
829 * 1 : Swap Jack
830 * 2 : 0 --> Desktop, 1 --> Laptop
831 * 3~5 : External Amplifier control
832 * 7~6 : Reserved
833 */
834 tmp = (ass & 0x38) >> 3; /* external Amp control */
835 if (spec->init_amp == ALC_INIT_UNDEFINED) {
836 switch (tmp) {
837 case 1:
838 alc_setup_gpio(codec, 0x01);
839 break;
840 case 3:
841 alc_setup_gpio(codec, 0x02);
842 break;
843 case 7:
844 alc_setup_gpio(codec, 0x04);
845 break;
846 case 5:
847 default:
848 spec->init_amp = ALC_INIT_DEFAULT;
849 break;
850 }
851 }
852
853 /* is laptop or Desktop and enable the function "Mute internal speaker
854 * when the external headphone out jack is plugged"
855 */
856 if (!(ass & 0x8000))
857 return 1;
858 /*
859 * 10~8 : Jack location
860 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
861 * 14~13: Resvered
862 * 15 : 1 --> enable the function "Mute internal speaker
863 * when the external headphone out jack is plugged"
864 */
865 if (!alc_get_hp_pin(spec)) {
866 hda_nid_t nid;
867 tmp = (ass >> 11) & 0x3; /* HP to chassis */
868 nid = ports[tmp];
869 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
870 spec->gen.autocfg.line_outs))
871 return 1;
872 spec->gen.autocfg.hp_pins[0] = nid;
873 }
874 return 1;
875 }
876
877 /* Check the validity of ALC subsystem-id
878 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
alc_ssid_check(struct hda_codec * codec,const hda_nid_t * ports)879 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
880 {
881 if (!alc_subsystem_id(codec, ports)) {
882 struct alc_spec *spec = codec->spec;
883 if (spec->init_amp == ALC_INIT_UNDEFINED) {
884 codec_dbg(codec,
885 "realtek: Enable default setup for auto mode as fallback\n");
886 spec->init_amp = ALC_INIT_DEFAULT;
887 }
888 }
889 }
890
891 /*
892 */
893
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)894 static void alc_fixup_inv_dmic(struct hda_codec *codec,
895 const struct hda_fixup *fix, int action)
896 {
897 struct alc_spec *spec = codec->spec;
898
899 spec->gen.inv_dmic_split = 1;
900 }
901
902
alc_build_controls(struct hda_codec * codec)903 static int alc_build_controls(struct hda_codec *codec)
904 {
905 int err;
906
907 err = snd_hda_gen_build_controls(codec);
908 if (err < 0)
909 return err;
910
911 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
912 return 0;
913 }
914
915
916 /*
917 * Common callbacks
918 */
919
alc_pre_init(struct hda_codec * codec)920 static void alc_pre_init(struct hda_codec *codec)
921 {
922 alc_fill_eapd_coef(codec);
923 }
924
925 #define is_s3_resume(codec) \
926 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
927 #define is_s4_resume(codec) \
928 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
929
alc_init(struct hda_codec * codec)930 static int alc_init(struct hda_codec *codec)
931 {
932 struct alc_spec *spec = codec->spec;
933
934 /* hibernation resume needs the full chip initialization */
935 if (is_s4_resume(codec))
936 alc_pre_init(codec);
937
938 if (spec->init_hook)
939 spec->init_hook(codec);
940
941 spec->gen.skip_verbs = 1; /* applied in below */
942 snd_hda_gen_init(codec);
943 alc_fix_pll(codec);
944 alc_auto_init_amp(codec, spec->init_amp);
945 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
946
947 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
948
949 return 0;
950 }
951
952 #define alc_free snd_hda_gen_free
953
954 #ifdef CONFIG_PM
alc_shutup(struct hda_codec * codec)955 static inline void alc_shutup(struct hda_codec *codec)
956 {
957 struct alc_spec *spec = codec->spec;
958
959 if (!snd_hda_get_bool_hint(codec, "shutup"))
960 return; /* disabled explicitly by hints */
961
962 if (spec && spec->shutup)
963 spec->shutup(codec);
964 else
965 alc_shutup_pins(codec);
966 }
967
alc_power_eapd(struct hda_codec * codec)968 static void alc_power_eapd(struct hda_codec *codec)
969 {
970 alc_auto_setup_eapd(codec, false);
971 }
972
alc_suspend(struct hda_codec * codec)973 static int alc_suspend(struct hda_codec *codec)
974 {
975 struct alc_spec *spec = codec->spec;
976 alc_shutup(codec);
977 if (spec && spec->power_hook)
978 spec->power_hook(codec);
979 return 0;
980 }
981
alc_resume(struct hda_codec * codec)982 static int alc_resume(struct hda_codec *codec)
983 {
984 struct alc_spec *spec = codec->spec;
985
986 if (!spec->no_depop_delay)
987 msleep(150); /* to avoid pop noise */
988 codec->patch_ops.init(codec);
989 snd_hda_regmap_sync(codec);
990 hda_call_check_power_status(codec, 0x01);
991 return 0;
992 }
993 #endif
994
995 /*
996 */
997 static const struct hda_codec_ops alc_patch_ops = {
998 .build_controls = alc_build_controls,
999 .build_pcms = snd_hda_gen_build_pcms,
1000 .init = alc_init,
1001 .free = alc_free,
1002 .unsol_event = snd_hda_jack_unsol_event,
1003 #ifdef CONFIG_PM
1004 .resume = alc_resume,
1005 .suspend = alc_suspend,
1006 .check_power_status = snd_hda_gen_check_power_status,
1007 #endif
1008 };
1009
1010
1011 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1012
1013 /*
1014 * Rename codecs appropriately from COEF value or subvendor id
1015 */
1016 struct alc_codec_rename_table {
1017 unsigned int vendor_id;
1018 unsigned short coef_mask;
1019 unsigned short coef_bits;
1020 const char *name;
1021 };
1022
1023 struct alc_codec_rename_pci_table {
1024 unsigned int codec_vendor_id;
1025 unsigned short pci_subvendor;
1026 unsigned short pci_subdevice;
1027 const char *name;
1028 };
1029
1030 static const struct alc_codec_rename_table rename_tbl[] = {
1031 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1032 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1033 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1034 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1035 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1036 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1037 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1038 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1039 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1040 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1041 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1042 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1043 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1044 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1045 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1046 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1047 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1048 { } /* terminator */
1049 };
1050
1051 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1052 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1053 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1054 { 0x10ec0283, 0x1028, 0, "ALC3223" },
1055 { 0x10ec0288, 0x1028, 0, "ALC3263" },
1056 { 0x10ec0292, 0x1028, 0, "ALC3226" },
1057 { 0x10ec0293, 0x1028, 0, "ALC3235" },
1058 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1059 { 0x10ec0668, 0x1028, 0, "ALC3661" },
1060 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1061 { 0x10ec0899, 0x1028, 0, "ALC3861" },
1062 { 0x10ec0298, 0x1028, 0, "ALC3266" },
1063 { 0x10ec0236, 0x1028, 0, "ALC3204" },
1064 { 0x10ec0256, 0x1028, 0, "ALC3246" },
1065 { 0x10ec0225, 0x1028, 0, "ALC3253" },
1066 { 0x10ec0295, 0x1028, 0, "ALC3254" },
1067 { 0x10ec0299, 0x1028, 0, "ALC3271" },
1068 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1069 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1070 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1071 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1072 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1073 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1074 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1075 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1076 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1077 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1078 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1079 { } /* terminator */
1080 };
1081
alc_codec_rename_from_preset(struct hda_codec * codec)1082 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1083 {
1084 const struct alc_codec_rename_table *p;
1085 const struct alc_codec_rename_pci_table *q;
1086
1087 for (p = rename_tbl; p->vendor_id; p++) {
1088 if (p->vendor_id != codec->core.vendor_id)
1089 continue;
1090 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1091 return alc_codec_rename(codec, p->name);
1092 }
1093
1094 if (!codec->bus->pci)
1095 return 0;
1096 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1097 if (q->codec_vendor_id != codec->core.vendor_id)
1098 continue;
1099 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1100 continue;
1101 if (!q->pci_subdevice ||
1102 q->pci_subdevice == codec->bus->pci->subsystem_device)
1103 return alc_codec_rename(codec, q->name);
1104 }
1105
1106 return 0;
1107 }
1108
1109
1110 /*
1111 * Digital-beep handlers
1112 */
1113 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1114
1115 /* additional beep mixers; private_value will be overwritten */
1116 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1117 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1118 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1119 };
1120
1121 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1122 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1123 int idx, int dir)
1124 {
1125 struct snd_kcontrol_new *knew;
1126 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1127 int i;
1128
1129 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1130 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1131 &alc_beep_mixer[i]);
1132 if (!knew)
1133 return -ENOMEM;
1134 knew->private_value = beep_amp;
1135 }
1136 return 0;
1137 }
1138
1139 static const struct snd_pci_quirk beep_allow_list[] = {
1140 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1141 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1142 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1143 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1144 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1145 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1146 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1147 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1148 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1149 /* denylist -- no beep available */
1150 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1151 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1152 {}
1153 };
1154
has_cdefine_beep(struct hda_codec * codec)1155 static inline int has_cdefine_beep(struct hda_codec *codec)
1156 {
1157 struct alc_spec *spec = codec->spec;
1158 const struct snd_pci_quirk *q;
1159 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1160 if (q)
1161 return q->value;
1162 return spec->cdefine.enable_pcbeep;
1163 }
1164 #else
1165 #define set_beep_amp(spec, nid, idx, dir) 0
1166 #define has_cdefine_beep(codec) 0
1167 #endif
1168
1169 /* parse the BIOS configuration and set up the alc_spec */
1170 /* return 1 if successful, 0 if the proper config is not found,
1171 * or a negative error code
1172 */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1173 static int alc_parse_auto_config(struct hda_codec *codec,
1174 const hda_nid_t *ignore_nids,
1175 const hda_nid_t *ssid_nids)
1176 {
1177 struct alc_spec *spec = codec->spec;
1178 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1179 int err;
1180
1181 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1182 spec->parse_flags);
1183 if (err < 0)
1184 return err;
1185
1186 if (ssid_nids)
1187 alc_ssid_check(codec, ssid_nids);
1188
1189 err = snd_hda_gen_parse_auto_config(codec, cfg);
1190 if (err < 0)
1191 return err;
1192
1193 return 1;
1194 }
1195
1196 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1197 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1198 {
1199 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1200 int err;
1201
1202 if (!spec)
1203 return -ENOMEM;
1204 codec->spec = spec;
1205 snd_hda_gen_spec_init(&spec->gen);
1206 spec->gen.mixer_nid = mixer_nid;
1207 spec->gen.own_eapd_ctl = 1;
1208 codec->single_adc_amp = 1;
1209 /* FIXME: do we need this for all Realtek codec models? */
1210 codec->spdif_status_reset = 1;
1211 codec->forced_resume = 1;
1212 codec->patch_ops = alc_patch_ops;
1213 mutex_init(&spec->coef_mutex);
1214
1215 err = alc_codec_rename_from_preset(codec);
1216 if (err < 0) {
1217 kfree(spec);
1218 return err;
1219 }
1220 return 0;
1221 }
1222
alc880_parse_auto_config(struct hda_codec * codec)1223 static int alc880_parse_auto_config(struct hda_codec *codec)
1224 {
1225 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1226 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1227 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1228 }
1229
1230 /*
1231 * ALC880 fix-ups
1232 */
1233 enum {
1234 ALC880_FIXUP_GPIO1,
1235 ALC880_FIXUP_GPIO2,
1236 ALC880_FIXUP_MEDION_RIM,
1237 ALC880_FIXUP_LG,
1238 ALC880_FIXUP_LG_LW25,
1239 ALC880_FIXUP_W810,
1240 ALC880_FIXUP_EAPD_COEF,
1241 ALC880_FIXUP_TCL_S700,
1242 ALC880_FIXUP_VOL_KNOB,
1243 ALC880_FIXUP_FUJITSU,
1244 ALC880_FIXUP_F1734,
1245 ALC880_FIXUP_UNIWILL,
1246 ALC880_FIXUP_UNIWILL_DIG,
1247 ALC880_FIXUP_Z71V,
1248 ALC880_FIXUP_ASUS_W5A,
1249 ALC880_FIXUP_3ST_BASE,
1250 ALC880_FIXUP_3ST,
1251 ALC880_FIXUP_3ST_DIG,
1252 ALC880_FIXUP_5ST_BASE,
1253 ALC880_FIXUP_5ST,
1254 ALC880_FIXUP_5ST_DIG,
1255 ALC880_FIXUP_6ST_BASE,
1256 ALC880_FIXUP_6ST,
1257 ALC880_FIXUP_6ST_DIG,
1258 ALC880_FIXUP_6ST_AUTOMUTE,
1259 };
1260
1261 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1262 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1263 const struct hda_fixup *fix, int action)
1264 {
1265 if (action == HDA_FIXUP_ACT_PROBE)
1266 snd_hda_jack_detect_enable_callback(codec, 0x21,
1267 alc_update_knob_master);
1268 }
1269
1270 static const struct hda_fixup alc880_fixups[] = {
1271 [ALC880_FIXUP_GPIO1] = {
1272 .type = HDA_FIXUP_FUNC,
1273 .v.func = alc_fixup_gpio1,
1274 },
1275 [ALC880_FIXUP_GPIO2] = {
1276 .type = HDA_FIXUP_FUNC,
1277 .v.func = alc_fixup_gpio2,
1278 },
1279 [ALC880_FIXUP_MEDION_RIM] = {
1280 .type = HDA_FIXUP_VERBS,
1281 .v.verbs = (const struct hda_verb[]) {
1282 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1283 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1284 { }
1285 },
1286 .chained = true,
1287 .chain_id = ALC880_FIXUP_GPIO2,
1288 },
1289 [ALC880_FIXUP_LG] = {
1290 .type = HDA_FIXUP_PINS,
1291 .v.pins = (const struct hda_pintbl[]) {
1292 /* disable bogus unused pins */
1293 { 0x16, 0x411111f0 },
1294 { 0x18, 0x411111f0 },
1295 { 0x1a, 0x411111f0 },
1296 { }
1297 }
1298 },
1299 [ALC880_FIXUP_LG_LW25] = {
1300 .type = HDA_FIXUP_PINS,
1301 .v.pins = (const struct hda_pintbl[]) {
1302 { 0x1a, 0x0181344f }, /* line-in */
1303 { 0x1b, 0x0321403f }, /* headphone */
1304 { }
1305 }
1306 },
1307 [ALC880_FIXUP_W810] = {
1308 .type = HDA_FIXUP_PINS,
1309 .v.pins = (const struct hda_pintbl[]) {
1310 /* disable bogus unused pins */
1311 { 0x17, 0x411111f0 },
1312 { }
1313 },
1314 .chained = true,
1315 .chain_id = ALC880_FIXUP_GPIO2,
1316 },
1317 [ALC880_FIXUP_EAPD_COEF] = {
1318 .type = HDA_FIXUP_VERBS,
1319 .v.verbs = (const struct hda_verb[]) {
1320 /* change to EAPD mode */
1321 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1322 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1323 {}
1324 },
1325 },
1326 [ALC880_FIXUP_TCL_S700] = {
1327 .type = HDA_FIXUP_VERBS,
1328 .v.verbs = (const struct hda_verb[]) {
1329 /* change to EAPD mode */
1330 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1331 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1332 {}
1333 },
1334 .chained = true,
1335 .chain_id = ALC880_FIXUP_GPIO2,
1336 },
1337 [ALC880_FIXUP_VOL_KNOB] = {
1338 .type = HDA_FIXUP_FUNC,
1339 .v.func = alc880_fixup_vol_knob,
1340 },
1341 [ALC880_FIXUP_FUJITSU] = {
1342 /* override all pins as BIOS on old Amilo is broken */
1343 .type = HDA_FIXUP_PINS,
1344 .v.pins = (const struct hda_pintbl[]) {
1345 { 0x14, 0x0121401f }, /* HP */
1346 { 0x15, 0x99030120 }, /* speaker */
1347 { 0x16, 0x99030130 }, /* bass speaker */
1348 { 0x17, 0x411111f0 }, /* N/A */
1349 { 0x18, 0x411111f0 }, /* N/A */
1350 { 0x19, 0x01a19950 }, /* mic-in */
1351 { 0x1a, 0x411111f0 }, /* N/A */
1352 { 0x1b, 0x411111f0 }, /* N/A */
1353 { 0x1c, 0x411111f0 }, /* N/A */
1354 { 0x1d, 0x411111f0 }, /* N/A */
1355 { 0x1e, 0x01454140 }, /* SPDIF out */
1356 { }
1357 },
1358 .chained = true,
1359 .chain_id = ALC880_FIXUP_VOL_KNOB,
1360 },
1361 [ALC880_FIXUP_F1734] = {
1362 /* almost compatible with FUJITSU, but no bass and SPDIF */
1363 .type = HDA_FIXUP_PINS,
1364 .v.pins = (const struct hda_pintbl[]) {
1365 { 0x14, 0x0121401f }, /* HP */
1366 { 0x15, 0x99030120 }, /* speaker */
1367 { 0x16, 0x411111f0 }, /* N/A */
1368 { 0x17, 0x411111f0 }, /* N/A */
1369 { 0x18, 0x411111f0 }, /* N/A */
1370 { 0x19, 0x01a19950 }, /* mic-in */
1371 { 0x1a, 0x411111f0 }, /* N/A */
1372 { 0x1b, 0x411111f0 }, /* N/A */
1373 { 0x1c, 0x411111f0 }, /* N/A */
1374 { 0x1d, 0x411111f0 }, /* N/A */
1375 { 0x1e, 0x411111f0 }, /* N/A */
1376 { }
1377 },
1378 .chained = true,
1379 .chain_id = ALC880_FIXUP_VOL_KNOB,
1380 },
1381 [ALC880_FIXUP_UNIWILL] = {
1382 /* need to fix HP and speaker pins to be parsed correctly */
1383 .type = HDA_FIXUP_PINS,
1384 .v.pins = (const struct hda_pintbl[]) {
1385 { 0x14, 0x0121411f }, /* HP */
1386 { 0x15, 0x99030120 }, /* speaker */
1387 { 0x16, 0x99030130 }, /* bass speaker */
1388 { }
1389 },
1390 },
1391 [ALC880_FIXUP_UNIWILL_DIG] = {
1392 .type = HDA_FIXUP_PINS,
1393 .v.pins = (const struct hda_pintbl[]) {
1394 /* disable bogus unused pins */
1395 { 0x17, 0x411111f0 },
1396 { 0x19, 0x411111f0 },
1397 { 0x1b, 0x411111f0 },
1398 { 0x1f, 0x411111f0 },
1399 { }
1400 }
1401 },
1402 [ALC880_FIXUP_Z71V] = {
1403 .type = HDA_FIXUP_PINS,
1404 .v.pins = (const struct hda_pintbl[]) {
1405 /* set up the whole pins as BIOS is utterly broken */
1406 { 0x14, 0x99030120 }, /* speaker */
1407 { 0x15, 0x0121411f }, /* HP */
1408 { 0x16, 0x411111f0 }, /* N/A */
1409 { 0x17, 0x411111f0 }, /* N/A */
1410 { 0x18, 0x01a19950 }, /* mic-in */
1411 { 0x19, 0x411111f0 }, /* N/A */
1412 { 0x1a, 0x01813031 }, /* line-in */
1413 { 0x1b, 0x411111f0 }, /* N/A */
1414 { 0x1c, 0x411111f0 }, /* N/A */
1415 { 0x1d, 0x411111f0 }, /* N/A */
1416 { 0x1e, 0x0144111e }, /* SPDIF */
1417 { }
1418 }
1419 },
1420 [ALC880_FIXUP_ASUS_W5A] = {
1421 .type = HDA_FIXUP_PINS,
1422 .v.pins = (const struct hda_pintbl[]) {
1423 /* set up the whole pins as BIOS is utterly broken */
1424 { 0x14, 0x0121411f }, /* HP */
1425 { 0x15, 0x411111f0 }, /* N/A */
1426 { 0x16, 0x411111f0 }, /* N/A */
1427 { 0x17, 0x411111f0 }, /* N/A */
1428 { 0x18, 0x90a60160 }, /* mic */
1429 { 0x19, 0x411111f0 }, /* N/A */
1430 { 0x1a, 0x411111f0 }, /* N/A */
1431 { 0x1b, 0x411111f0 }, /* N/A */
1432 { 0x1c, 0x411111f0 }, /* N/A */
1433 { 0x1d, 0x411111f0 }, /* N/A */
1434 { 0x1e, 0xb743111e }, /* SPDIF out */
1435 { }
1436 },
1437 .chained = true,
1438 .chain_id = ALC880_FIXUP_GPIO1,
1439 },
1440 [ALC880_FIXUP_3ST_BASE] = {
1441 .type = HDA_FIXUP_PINS,
1442 .v.pins = (const struct hda_pintbl[]) {
1443 { 0x14, 0x01014010 }, /* line-out */
1444 { 0x15, 0x411111f0 }, /* N/A */
1445 { 0x16, 0x411111f0 }, /* N/A */
1446 { 0x17, 0x411111f0 }, /* N/A */
1447 { 0x18, 0x01a19c30 }, /* mic-in */
1448 { 0x19, 0x0121411f }, /* HP */
1449 { 0x1a, 0x01813031 }, /* line-in */
1450 { 0x1b, 0x02a19c40 }, /* front-mic */
1451 { 0x1c, 0x411111f0 }, /* N/A */
1452 { 0x1d, 0x411111f0 }, /* N/A */
1453 /* 0x1e is filled in below */
1454 { 0x1f, 0x411111f0 }, /* N/A */
1455 { }
1456 }
1457 },
1458 [ALC880_FIXUP_3ST] = {
1459 .type = HDA_FIXUP_PINS,
1460 .v.pins = (const struct hda_pintbl[]) {
1461 { 0x1e, 0x411111f0 }, /* N/A */
1462 { }
1463 },
1464 .chained = true,
1465 .chain_id = ALC880_FIXUP_3ST_BASE,
1466 },
1467 [ALC880_FIXUP_3ST_DIG] = {
1468 .type = HDA_FIXUP_PINS,
1469 .v.pins = (const struct hda_pintbl[]) {
1470 { 0x1e, 0x0144111e }, /* SPDIF */
1471 { }
1472 },
1473 .chained = true,
1474 .chain_id = ALC880_FIXUP_3ST_BASE,
1475 },
1476 [ALC880_FIXUP_5ST_BASE] = {
1477 .type = HDA_FIXUP_PINS,
1478 .v.pins = (const struct hda_pintbl[]) {
1479 { 0x14, 0x01014010 }, /* front */
1480 { 0x15, 0x411111f0 }, /* N/A */
1481 { 0x16, 0x01011411 }, /* CLFE */
1482 { 0x17, 0x01016412 }, /* surr */
1483 { 0x18, 0x01a19c30 }, /* mic-in */
1484 { 0x19, 0x0121411f }, /* HP */
1485 { 0x1a, 0x01813031 }, /* line-in */
1486 { 0x1b, 0x02a19c40 }, /* front-mic */
1487 { 0x1c, 0x411111f0 }, /* N/A */
1488 { 0x1d, 0x411111f0 }, /* N/A */
1489 /* 0x1e is filled in below */
1490 { 0x1f, 0x411111f0 }, /* N/A */
1491 { }
1492 }
1493 },
1494 [ALC880_FIXUP_5ST] = {
1495 .type = HDA_FIXUP_PINS,
1496 .v.pins = (const struct hda_pintbl[]) {
1497 { 0x1e, 0x411111f0 }, /* N/A */
1498 { }
1499 },
1500 .chained = true,
1501 .chain_id = ALC880_FIXUP_5ST_BASE,
1502 },
1503 [ALC880_FIXUP_5ST_DIG] = {
1504 .type = HDA_FIXUP_PINS,
1505 .v.pins = (const struct hda_pintbl[]) {
1506 { 0x1e, 0x0144111e }, /* SPDIF */
1507 { }
1508 },
1509 .chained = true,
1510 .chain_id = ALC880_FIXUP_5ST_BASE,
1511 },
1512 [ALC880_FIXUP_6ST_BASE] = {
1513 .type = HDA_FIXUP_PINS,
1514 .v.pins = (const struct hda_pintbl[]) {
1515 { 0x14, 0x01014010 }, /* front */
1516 { 0x15, 0x01016412 }, /* surr */
1517 { 0x16, 0x01011411 }, /* CLFE */
1518 { 0x17, 0x01012414 }, /* side */
1519 { 0x18, 0x01a19c30 }, /* mic-in */
1520 { 0x19, 0x02a19c40 }, /* front-mic */
1521 { 0x1a, 0x01813031 }, /* line-in */
1522 { 0x1b, 0x0121411f }, /* HP */
1523 { 0x1c, 0x411111f0 }, /* N/A */
1524 { 0x1d, 0x411111f0 }, /* N/A */
1525 /* 0x1e is filled in below */
1526 { 0x1f, 0x411111f0 }, /* N/A */
1527 { }
1528 }
1529 },
1530 [ALC880_FIXUP_6ST] = {
1531 .type = HDA_FIXUP_PINS,
1532 .v.pins = (const struct hda_pintbl[]) {
1533 { 0x1e, 0x411111f0 }, /* N/A */
1534 { }
1535 },
1536 .chained = true,
1537 .chain_id = ALC880_FIXUP_6ST_BASE,
1538 },
1539 [ALC880_FIXUP_6ST_DIG] = {
1540 .type = HDA_FIXUP_PINS,
1541 .v.pins = (const struct hda_pintbl[]) {
1542 { 0x1e, 0x0144111e }, /* SPDIF */
1543 { }
1544 },
1545 .chained = true,
1546 .chain_id = ALC880_FIXUP_6ST_BASE,
1547 },
1548 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1549 .type = HDA_FIXUP_PINS,
1550 .v.pins = (const struct hda_pintbl[]) {
1551 { 0x1b, 0x0121401f }, /* HP with jack detect */
1552 { }
1553 },
1554 .chained_before = true,
1555 .chain_id = ALC880_FIXUP_6ST_BASE,
1556 },
1557 };
1558
1559 static const struct hda_quirk alc880_fixup_tbl[] = {
1560 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1561 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1562 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1563 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1564 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1565 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1566 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1567 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1568 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1569 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1570 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1571 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1572 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1573 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1574 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1575 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1576 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1577 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1578 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1579 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1580 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1581 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1582 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1583
1584 /* Below is the copied entries from alc880_quirks.c.
1585 * It's not quite sure whether BIOS sets the correct pin-config table
1586 * on these machines, thus they are kept to be compatible with
1587 * the old static quirks. Once when it's confirmed to work without
1588 * these overrides, it'd be better to remove.
1589 */
1590 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1591 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1592 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1593 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1594 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1595 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1596 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1597 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1598 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1599 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1600 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1601 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1602 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1603 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1604 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1605 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1606 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1607 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1608 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1609 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1610 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1611 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1612 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1613 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1615 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1616 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1617 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1618 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1619 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1620 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1621 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1622 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1623 /* default Intel */
1624 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1625 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1626 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1627 {}
1628 };
1629
1630 static const struct hda_model_fixup alc880_fixup_models[] = {
1631 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1632 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1633 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1634 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1635 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1636 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1637 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1638 {}
1639 };
1640
1641
1642 /*
1643 * OK, here we have finally the patch for ALC880
1644 */
patch_alc880(struct hda_codec * codec)1645 static int patch_alc880(struct hda_codec *codec)
1646 {
1647 struct alc_spec *spec;
1648 int err;
1649
1650 err = alc_alloc_spec(codec, 0x0b);
1651 if (err < 0)
1652 return err;
1653
1654 spec = codec->spec;
1655 spec->gen.need_dac_fix = 1;
1656 spec->gen.beep_nid = 0x01;
1657
1658 codec->patch_ops.unsol_event = alc880_unsol_event;
1659
1660 alc_pre_init(codec);
1661
1662 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1663 alc880_fixups);
1664 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1665
1666 /* automatic parse from the BIOS config */
1667 err = alc880_parse_auto_config(codec);
1668 if (err < 0)
1669 goto error;
1670
1671 if (!spec->gen.no_analog) {
1672 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1673 if (err < 0)
1674 goto error;
1675 }
1676
1677 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1678
1679 return 0;
1680
1681 error:
1682 alc_free(codec);
1683 return err;
1684 }
1685
1686
1687 /*
1688 * ALC260 support
1689 */
alc260_parse_auto_config(struct hda_codec * codec)1690 static int alc260_parse_auto_config(struct hda_codec *codec)
1691 {
1692 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1693 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1694 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1695 }
1696
1697 /*
1698 * Pin config fixes
1699 */
1700 enum {
1701 ALC260_FIXUP_HP_DC5750,
1702 ALC260_FIXUP_HP_PIN_0F,
1703 ALC260_FIXUP_COEF,
1704 ALC260_FIXUP_GPIO1,
1705 ALC260_FIXUP_GPIO1_TOGGLE,
1706 ALC260_FIXUP_REPLACER,
1707 ALC260_FIXUP_HP_B1900,
1708 ALC260_FIXUP_KN1,
1709 ALC260_FIXUP_FSC_S7020,
1710 ALC260_FIXUP_FSC_S7020_JWSE,
1711 ALC260_FIXUP_VAIO_PINS,
1712 };
1713
alc260_gpio1_automute(struct hda_codec * codec)1714 static void alc260_gpio1_automute(struct hda_codec *codec)
1715 {
1716 struct alc_spec *spec = codec->spec;
1717
1718 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1719 }
1720
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1721 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1722 const struct hda_fixup *fix, int action)
1723 {
1724 struct alc_spec *spec = codec->spec;
1725 if (action == HDA_FIXUP_ACT_PROBE) {
1726 /* although the machine has only one output pin, we need to
1727 * toggle GPIO1 according to the jack state
1728 */
1729 spec->gen.automute_hook = alc260_gpio1_automute;
1730 spec->gen.detect_hp = 1;
1731 spec->gen.automute_speaker = 1;
1732 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1733 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1734 snd_hda_gen_hp_automute);
1735 alc_setup_gpio(codec, 0x01);
1736 }
1737 }
1738
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1739 static void alc260_fixup_kn1(struct hda_codec *codec,
1740 const struct hda_fixup *fix, int action)
1741 {
1742 struct alc_spec *spec = codec->spec;
1743 static const struct hda_pintbl pincfgs[] = {
1744 { 0x0f, 0x02214000 }, /* HP/speaker */
1745 { 0x12, 0x90a60160 }, /* int mic */
1746 { 0x13, 0x02a19000 }, /* ext mic */
1747 { 0x18, 0x01446000 }, /* SPDIF out */
1748 /* disable bogus I/O pins */
1749 { 0x10, 0x411111f0 },
1750 { 0x11, 0x411111f0 },
1751 { 0x14, 0x411111f0 },
1752 { 0x15, 0x411111f0 },
1753 { 0x16, 0x411111f0 },
1754 { 0x17, 0x411111f0 },
1755 { 0x19, 0x411111f0 },
1756 { }
1757 };
1758
1759 switch (action) {
1760 case HDA_FIXUP_ACT_PRE_PROBE:
1761 snd_hda_apply_pincfgs(codec, pincfgs);
1762 spec->init_amp = ALC_INIT_NONE;
1763 break;
1764 }
1765 }
1766
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1767 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1768 const struct hda_fixup *fix, int action)
1769 {
1770 struct alc_spec *spec = codec->spec;
1771 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1772 spec->init_amp = ALC_INIT_NONE;
1773 }
1774
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1775 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1776 const struct hda_fixup *fix, int action)
1777 {
1778 struct alc_spec *spec = codec->spec;
1779 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1780 spec->gen.add_jack_modes = 1;
1781 spec->gen.hp_mic = 1;
1782 }
1783 }
1784
1785 static const struct hda_fixup alc260_fixups[] = {
1786 [ALC260_FIXUP_HP_DC5750] = {
1787 .type = HDA_FIXUP_PINS,
1788 .v.pins = (const struct hda_pintbl[]) {
1789 { 0x11, 0x90130110 }, /* speaker */
1790 { }
1791 }
1792 },
1793 [ALC260_FIXUP_HP_PIN_0F] = {
1794 .type = HDA_FIXUP_PINS,
1795 .v.pins = (const struct hda_pintbl[]) {
1796 { 0x0f, 0x01214000 }, /* HP */
1797 { }
1798 }
1799 },
1800 [ALC260_FIXUP_COEF] = {
1801 .type = HDA_FIXUP_VERBS,
1802 .v.verbs = (const struct hda_verb[]) {
1803 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1804 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1805 { }
1806 },
1807 },
1808 [ALC260_FIXUP_GPIO1] = {
1809 .type = HDA_FIXUP_FUNC,
1810 .v.func = alc_fixup_gpio1,
1811 },
1812 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1813 .type = HDA_FIXUP_FUNC,
1814 .v.func = alc260_fixup_gpio1_toggle,
1815 .chained = true,
1816 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1817 },
1818 [ALC260_FIXUP_REPLACER] = {
1819 .type = HDA_FIXUP_VERBS,
1820 .v.verbs = (const struct hda_verb[]) {
1821 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1822 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1823 { }
1824 },
1825 .chained = true,
1826 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1827 },
1828 [ALC260_FIXUP_HP_B1900] = {
1829 .type = HDA_FIXUP_FUNC,
1830 .v.func = alc260_fixup_gpio1_toggle,
1831 .chained = true,
1832 .chain_id = ALC260_FIXUP_COEF,
1833 },
1834 [ALC260_FIXUP_KN1] = {
1835 .type = HDA_FIXUP_FUNC,
1836 .v.func = alc260_fixup_kn1,
1837 },
1838 [ALC260_FIXUP_FSC_S7020] = {
1839 .type = HDA_FIXUP_FUNC,
1840 .v.func = alc260_fixup_fsc_s7020,
1841 },
1842 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1843 .type = HDA_FIXUP_FUNC,
1844 .v.func = alc260_fixup_fsc_s7020_jwse,
1845 .chained = true,
1846 .chain_id = ALC260_FIXUP_FSC_S7020,
1847 },
1848 [ALC260_FIXUP_VAIO_PINS] = {
1849 .type = HDA_FIXUP_PINS,
1850 .v.pins = (const struct hda_pintbl[]) {
1851 /* Pin configs are missing completely on some VAIOs */
1852 { 0x0f, 0x01211020 },
1853 { 0x10, 0x0001003f },
1854 { 0x11, 0x411111f0 },
1855 { 0x12, 0x01a15930 },
1856 { 0x13, 0x411111f0 },
1857 { 0x14, 0x411111f0 },
1858 { 0x15, 0x411111f0 },
1859 { 0x16, 0x411111f0 },
1860 { 0x17, 0x411111f0 },
1861 { 0x18, 0x411111f0 },
1862 { 0x19, 0x411111f0 },
1863 { }
1864 }
1865 },
1866 };
1867
1868 static const struct hda_quirk alc260_fixup_tbl[] = {
1869 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1870 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1871 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1872 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1873 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1874 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1875 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1876 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1877 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1878 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1879 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1880 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1881 {}
1882 };
1883
1884 static const struct hda_model_fixup alc260_fixup_models[] = {
1885 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1886 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1887 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1888 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1889 {}
1890 };
1891
1892 /*
1893 */
patch_alc260(struct hda_codec * codec)1894 static int patch_alc260(struct hda_codec *codec)
1895 {
1896 struct alc_spec *spec;
1897 int err;
1898
1899 err = alc_alloc_spec(codec, 0x07);
1900 if (err < 0)
1901 return err;
1902
1903 spec = codec->spec;
1904 /* as quite a few machines require HP amp for speaker outputs,
1905 * it's easier to enable it unconditionally; even if it's unneeded,
1906 * it's almost harmless.
1907 */
1908 spec->gen.prefer_hp_amp = 1;
1909 spec->gen.beep_nid = 0x01;
1910
1911 spec->shutup = alc_eapd_shutup;
1912
1913 alc_pre_init(codec);
1914
1915 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1916 alc260_fixups);
1917 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1918
1919 /* automatic parse from the BIOS config */
1920 err = alc260_parse_auto_config(codec);
1921 if (err < 0)
1922 goto error;
1923
1924 if (!spec->gen.no_analog) {
1925 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1926 if (err < 0)
1927 goto error;
1928 }
1929
1930 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1931
1932 return 0;
1933
1934 error:
1935 alc_free(codec);
1936 return err;
1937 }
1938
1939
1940 /*
1941 * ALC882/883/885/888/889 support
1942 *
1943 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1944 * configuration. Each pin widget can choose any input DACs and a mixer.
1945 * Each ADC is connected from a mixer of all inputs. This makes possible
1946 * 6-channel independent captures.
1947 *
1948 * In addition, an independent DAC for the multi-playback (not used in this
1949 * driver yet).
1950 */
1951
1952 /*
1953 * Pin config fixes
1954 */
1955 enum {
1956 ALC882_FIXUP_ABIT_AW9D_MAX,
1957 ALC882_FIXUP_LENOVO_Y530,
1958 ALC882_FIXUP_PB_M5210,
1959 ALC882_FIXUP_ACER_ASPIRE_7736,
1960 ALC882_FIXUP_ASUS_W90V,
1961 ALC889_FIXUP_CD,
1962 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1963 ALC889_FIXUP_VAIO_TT,
1964 ALC888_FIXUP_EEE1601,
1965 ALC886_FIXUP_EAPD,
1966 ALC882_FIXUP_EAPD,
1967 ALC883_FIXUP_EAPD,
1968 ALC883_FIXUP_ACER_EAPD,
1969 ALC882_FIXUP_GPIO1,
1970 ALC882_FIXUP_GPIO2,
1971 ALC882_FIXUP_GPIO3,
1972 ALC889_FIXUP_COEF,
1973 ALC882_FIXUP_ASUS_W2JC,
1974 ALC882_FIXUP_ACER_ASPIRE_4930G,
1975 ALC882_FIXUP_ACER_ASPIRE_8930G,
1976 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1977 ALC885_FIXUP_MACPRO_GPIO,
1978 ALC889_FIXUP_DAC_ROUTE,
1979 ALC889_FIXUP_MBP_VREF,
1980 ALC889_FIXUP_IMAC91_VREF,
1981 ALC889_FIXUP_MBA11_VREF,
1982 ALC889_FIXUP_MBA21_VREF,
1983 ALC889_FIXUP_MP11_VREF,
1984 ALC889_FIXUP_MP41_VREF,
1985 ALC882_FIXUP_INV_DMIC,
1986 ALC882_FIXUP_NO_PRIMARY_HP,
1987 ALC887_FIXUP_ASUS_BASS,
1988 ALC887_FIXUP_BASS_CHMAP,
1989 ALC1220_FIXUP_GB_DUAL_CODECS,
1990 ALC1220_FIXUP_GB_X570,
1991 ALC1220_FIXUP_CLEVO_P950,
1992 ALC1220_FIXUP_CLEVO_PB51ED,
1993 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1994 ALC887_FIXUP_ASUS_AUDIO,
1995 ALC887_FIXUP_ASUS_HMIC,
1996 ALCS1200A_FIXUP_MIC_VREF,
1997 ALC888VD_FIXUP_MIC_100VREF,
1998 };
1999
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)2000 static void alc889_fixup_coef(struct hda_codec *codec,
2001 const struct hda_fixup *fix, int action)
2002 {
2003 if (action != HDA_FIXUP_ACT_INIT)
2004 return;
2005 alc_update_coef_idx(codec, 7, 0, 0x2030);
2006 }
2007
2008 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2009 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2010 const struct hda_fixup *fix, int action)
2011 {
2012 struct alc_spec *spec = codec->spec;
2013
2014 spec->gpio_write_delay = true;
2015 alc_fixup_gpio3(codec, fix, action);
2016 }
2017
2018 /* Fix the connection of some pins for ALC889:
2019 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2020 * work correctly (bko#42740)
2021 */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2022 static void alc889_fixup_dac_route(struct hda_codec *codec,
2023 const struct hda_fixup *fix, int action)
2024 {
2025 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2026 /* fake the connections during parsing the tree */
2027 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2028 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2029 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2030 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2031 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2032 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2033 } else if (action == HDA_FIXUP_ACT_PROBE) {
2034 /* restore the connections */
2035 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2036 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2037 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2038 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2039 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2040 }
2041 }
2042
2043 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2044 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2045 const struct hda_fixup *fix, int action)
2046 {
2047 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2048 struct alc_spec *spec = codec->spec;
2049 int i;
2050
2051 if (action != HDA_FIXUP_ACT_INIT)
2052 return;
2053 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2054 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2055 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2056 continue;
2057 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2058 val |= AC_PINCTL_VREF_80;
2059 snd_hda_set_pin_ctl(codec, nids[i], val);
2060 spec->gen.keep_vref_in_automute = 1;
2061 break;
2062 }
2063 }
2064
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2065 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2066 const hda_nid_t *nids, int num_nids)
2067 {
2068 struct alc_spec *spec = codec->spec;
2069 int i;
2070
2071 for (i = 0; i < num_nids; i++) {
2072 unsigned int val;
2073 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2074 val |= AC_PINCTL_VREF_50;
2075 snd_hda_set_pin_ctl(codec, nids[i], val);
2076 }
2077 spec->gen.keep_vref_in_automute = 1;
2078 }
2079
2080 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2081 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2082 const struct hda_fixup *fix, int action)
2083 {
2084 static const hda_nid_t nids[] = { 0x18, 0x1a };
2085
2086 if (action == HDA_FIXUP_ACT_INIT)
2087 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2088 }
2089
2090 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2091 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2092 const struct hda_fixup *fix, int action)
2093 {
2094 static const hda_nid_t nids[] = { 0x18 };
2095
2096 if (action == HDA_FIXUP_ACT_INIT)
2097 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2098 }
2099
2100 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2101 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2102 const struct hda_fixup *fix, int action)
2103 {
2104 static const hda_nid_t nids[] = { 0x18, 0x19 };
2105
2106 if (action == HDA_FIXUP_ACT_INIT)
2107 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2108 }
2109
2110 /* Don't take HP output as primary
2111 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2112 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2113 */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2114 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2115 const struct hda_fixup *fix, int action)
2116 {
2117 struct alc_spec *spec = codec->spec;
2118 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2119 spec->gen.no_primary_hp = 1;
2120 spec->gen.no_multi_io = 1;
2121 }
2122 }
2123
2124 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2125 const struct hda_fixup *fix, int action);
2126
2127 /* For dual-codec configuration, we need to disable some features to avoid
2128 * conflicts of kctls and PCM streams
2129 */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2130 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2131 const struct hda_fixup *fix, int action)
2132 {
2133 struct alc_spec *spec = codec->spec;
2134
2135 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2136 return;
2137 /* disable vmaster */
2138 spec->gen.suppress_vmaster = 1;
2139 /* auto-mute and auto-mic switch don't work with multiple codecs */
2140 spec->gen.suppress_auto_mute = 1;
2141 spec->gen.suppress_auto_mic = 1;
2142 /* disable aamix as well */
2143 spec->gen.mixer_nid = 0;
2144 /* add location prefix to avoid conflicts */
2145 codec->force_pin_prefix = 1;
2146 }
2147
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2148 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2149 const char *newname)
2150 {
2151 struct snd_kcontrol *kctl;
2152
2153 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2154 if (kctl)
2155 snd_ctl_rename(codec->card, kctl, newname);
2156 }
2157
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2158 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2159 const struct hda_fixup *fix,
2160 int action)
2161 {
2162 alc_fixup_dual_codecs(codec, fix, action);
2163 switch (action) {
2164 case HDA_FIXUP_ACT_PRE_PROBE:
2165 /* override card longname to provide a unique UCM profile */
2166 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2167 break;
2168 case HDA_FIXUP_ACT_BUILD:
2169 /* rename Capture controls depending on the codec */
2170 rename_ctl(codec, "Capture Volume",
2171 codec->addr == 0 ?
2172 "Rear-Panel Capture Volume" :
2173 "Front-Panel Capture Volume");
2174 rename_ctl(codec, "Capture Switch",
2175 codec->addr == 0 ?
2176 "Rear-Panel Capture Switch" :
2177 "Front-Panel Capture Switch");
2178 break;
2179 }
2180 }
2181
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2182 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2183 const struct hda_fixup *fix,
2184 int action)
2185 {
2186 static const hda_nid_t conn1[] = { 0x0c };
2187 static const struct coef_fw gb_x570_coefs[] = {
2188 WRITE_COEF(0x07, 0x03c0),
2189 WRITE_COEF(0x1a, 0x01c1),
2190 WRITE_COEF(0x1b, 0x0202),
2191 WRITE_COEF(0x43, 0x3005),
2192 {}
2193 };
2194
2195 switch (action) {
2196 case HDA_FIXUP_ACT_PRE_PROBE:
2197 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2198 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2199 break;
2200 case HDA_FIXUP_ACT_INIT:
2201 alc_process_coef_fw(codec, gb_x570_coefs);
2202 break;
2203 }
2204 }
2205
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2206 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2207 const struct hda_fixup *fix,
2208 int action)
2209 {
2210 static const hda_nid_t conn1[] = { 0x0c };
2211
2212 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2213 return;
2214
2215 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2216 /* We therefore want to make sure 0x14 (front headphone) and
2217 * 0x1b (speakers) use the stereo DAC 0x02
2218 */
2219 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2220 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2221 }
2222
2223 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2224 const struct hda_fixup *fix, int action);
2225
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2226 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2227 const struct hda_fixup *fix,
2228 int action)
2229 {
2230 alc1220_fixup_clevo_p950(codec, fix, action);
2231 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2232 }
2233
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2234 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2235 struct hda_jack_callback *jack)
2236 {
2237 struct alc_spec *spec = codec->spec;
2238 unsigned int vref;
2239
2240 snd_hda_gen_hp_automute(codec, jack);
2241
2242 if (spec->gen.hp_jack_present)
2243 vref = AC_PINCTL_VREF_80;
2244 else
2245 vref = AC_PINCTL_VREF_HIZ;
2246 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2247 }
2248
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2249 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2250 const struct hda_fixup *fix, int action)
2251 {
2252 struct alc_spec *spec = codec->spec;
2253 if (action != HDA_FIXUP_ACT_PROBE)
2254 return;
2255 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2256 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2257 }
2258
2259 static const struct hda_fixup alc882_fixups[] = {
2260 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2261 .type = HDA_FIXUP_PINS,
2262 .v.pins = (const struct hda_pintbl[]) {
2263 { 0x15, 0x01080104 }, /* side */
2264 { 0x16, 0x01011012 }, /* rear */
2265 { 0x17, 0x01016011 }, /* clfe */
2266 { }
2267 }
2268 },
2269 [ALC882_FIXUP_LENOVO_Y530] = {
2270 .type = HDA_FIXUP_PINS,
2271 .v.pins = (const struct hda_pintbl[]) {
2272 { 0x15, 0x99130112 }, /* rear int speakers */
2273 { 0x16, 0x99130111 }, /* subwoofer */
2274 { }
2275 }
2276 },
2277 [ALC882_FIXUP_PB_M5210] = {
2278 .type = HDA_FIXUP_PINCTLS,
2279 .v.pins = (const struct hda_pintbl[]) {
2280 { 0x19, PIN_VREF50 },
2281 {}
2282 }
2283 },
2284 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2285 .type = HDA_FIXUP_FUNC,
2286 .v.func = alc_fixup_sku_ignore,
2287 },
2288 [ALC882_FIXUP_ASUS_W90V] = {
2289 .type = HDA_FIXUP_PINS,
2290 .v.pins = (const struct hda_pintbl[]) {
2291 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2292 { }
2293 }
2294 },
2295 [ALC889_FIXUP_CD] = {
2296 .type = HDA_FIXUP_PINS,
2297 .v.pins = (const struct hda_pintbl[]) {
2298 { 0x1c, 0x993301f0 }, /* CD */
2299 { }
2300 }
2301 },
2302 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2303 .type = HDA_FIXUP_PINS,
2304 .v.pins = (const struct hda_pintbl[]) {
2305 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2306 { }
2307 },
2308 .chained = true,
2309 .chain_id = ALC889_FIXUP_CD,
2310 },
2311 [ALC889_FIXUP_VAIO_TT] = {
2312 .type = HDA_FIXUP_PINS,
2313 .v.pins = (const struct hda_pintbl[]) {
2314 { 0x17, 0x90170111 }, /* hidden surround speaker */
2315 { }
2316 }
2317 },
2318 [ALC888_FIXUP_EEE1601] = {
2319 .type = HDA_FIXUP_VERBS,
2320 .v.verbs = (const struct hda_verb[]) {
2321 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2322 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2323 { }
2324 }
2325 },
2326 [ALC886_FIXUP_EAPD] = {
2327 .type = HDA_FIXUP_VERBS,
2328 .v.verbs = (const struct hda_verb[]) {
2329 /* change to EAPD mode */
2330 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2331 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2332 { }
2333 }
2334 },
2335 [ALC882_FIXUP_EAPD] = {
2336 .type = HDA_FIXUP_VERBS,
2337 .v.verbs = (const struct hda_verb[]) {
2338 /* change to EAPD mode */
2339 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2340 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2341 { }
2342 }
2343 },
2344 [ALC883_FIXUP_EAPD] = {
2345 .type = HDA_FIXUP_VERBS,
2346 .v.verbs = (const struct hda_verb[]) {
2347 /* change to EAPD mode */
2348 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2349 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2350 { }
2351 }
2352 },
2353 [ALC883_FIXUP_ACER_EAPD] = {
2354 .type = HDA_FIXUP_VERBS,
2355 .v.verbs = (const struct hda_verb[]) {
2356 /* eanable EAPD on Acer laptops */
2357 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2358 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2359 { }
2360 }
2361 },
2362 [ALC882_FIXUP_GPIO1] = {
2363 .type = HDA_FIXUP_FUNC,
2364 .v.func = alc_fixup_gpio1,
2365 },
2366 [ALC882_FIXUP_GPIO2] = {
2367 .type = HDA_FIXUP_FUNC,
2368 .v.func = alc_fixup_gpio2,
2369 },
2370 [ALC882_FIXUP_GPIO3] = {
2371 .type = HDA_FIXUP_FUNC,
2372 .v.func = alc_fixup_gpio3,
2373 },
2374 [ALC882_FIXUP_ASUS_W2JC] = {
2375 .type = HDA_FIXUP_FUNC,
2376 .v.func = alc_fixup_gpio1,
2377 .chained = true,
2378 .chain_id = ALC882_FIXUP_EAPD,
2379 },
2380 [ALC889_FIXUP_COEF] = {
2381 .type = HDA_FIXUP_FUNC,
2382 .v.func = alc889_fixup_coef,
2383 },
2384 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2385 .type = HDA_FIXUP_PINS,
2386 .v.pins = (const struct hda_pintbl[]) {
2387 { 0x16, 0x99130111 }, /* CLFE speaker */
2388 { 0x17, 0x99130112 }, /* surround speaker */
2389 { }
2390 },
2391 .chained = true,
2392 .chain_id = ALC882_FIXUP_GPIO1,
2393 },
2394 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2395 .type = HDA_FIXUP_PINS,
2396 .v.pins = (const struct hda_pintbl[]) {
2397 { 0x16, 0x99130111 }, /* CLFE speaker */
2398 { 0x1b, 0x99130112 }, /* surround speaker */
2399 { }
2400 },
2401 .chained = true,
2402 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2403 },
2404 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2405 /* additional init verbs for Acer Aspire 8930G */
2406 .type = HDA_FIXUP_VERBS,
2407 .v.verbs = (const struct hda_verb[]) {
2408 /* Enable all DACs */
2409 /* DAC DISABLE/MUTE 1? */
2410 /* setting bits 1-5 disables DAC nids 0x02-0x06
2411 * apparently. Init=0x38 */
2412 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2413 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2414 /* DAC DISABLE/MUTE 2? */
2415 /* some bit here disables the other DACs.
2416 * Init=0x4900 */
2417 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2418 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2419 /* DMIC fix
2420 * This laptop has a stereo digital microphone.
2421 * The mics are only 1cm apart which makes the stereo
2422 * useless. However, either the mic or the ALC889
2423 * makes the signal become a difference/sum signal
2424 * instead of standard stereo, which is annoying.
2425 * So instead we flip this bit which makes the
2426 * codec replicate the sum signal to both channels,
2427 * turning it into a normal mono mic.
2428 */
2429 /* DMIC_CONTROL? Init value = 0x0001 */
2430 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2431 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2432 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2433 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2434 { }
2435 },
2436 .chained = true,
2437 .chain_id = ALC882_FIXUP_GPIO1,
2438 },
2439 [ALC885_FIXUP_MACPRO_GPIO] = {
2440 .type = HDA_FIXUP_FUNC,
2441 .v.func = alc885_fixup_macpro_gpio,
2442 },
2443 [ALC889_FIXUP_DAC_ROUTE] = {
2444 .type = HDA_FIXUP_FUNC,
2445 .v.func = alc889_fixup_dac_route,
2446 },
2447 [ALC889_FIXUP_MBP_VREF] = {
2448 .type = HDA_FIXUP_FUNC,
2449 .v.func = alc889_fixup_mbp_vref,
2450 .chained = true,
2451 .chain_id = ALC882_FIXUP_GPIO1,
2452 },
2453 [ALC889_FIXUP_IMAC91_VREF] = {
2454 .type = HDA_FIXUP_FUNC,
2455 .v.func = alc889_fixup_imac91_vref,
2456 .chained = true,
2457 .chain_id = ALC882_FIXUP_GPIO1,
2458 },
2459 [ALC889_FIXUP_MBA11_VREF] = {
2460 .type = HDA_FIXUP_FUNC,
2461 .v.func = alc889_fixup_mba11_vref,
2462 .chained = true,
2463 .chain_id = ALC889_FIXUP_MBP_VREF,
2464 },
2465 [ALC889_FIXUP_MBA21_VREF] = {
2466 .type = HDA_FIXUP_FUNC,
2467 .v.func = alc889_fixup_mba21_vref,
2468 .chained = true,
2469 .chain_id = ALC889_FIXUP_MBP_VREF,
2470 },
2471 [ALC889_FIXUP_MP11_VREF] = {
2472 .type = HDA_FIXUP_FUNC,
2473 .v.func = alc889_fixup_mba11_vref,
2474 .chained = true,
2475 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2476 },
2477 [ALC889_FIXUP_MP41_VREF] = {
2478 .type = HDA_FIXUP_FUNC,
2479 .v.func = alc889_fixup_mbp_vref,
2480 .chained = true,
2481 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2482 },
2483 [ALC882_FIXUP_INV_DMIC] = {
2484 .type = HDA_FIXUP_FUNC,
2485 .v.func = alc_fixup_inv_dmic,
2486 },
2487 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2488 .type = HDA_FIXUP_FUNC,
2489 .v.func = alc882_fixup_no_primary_hp,
2490 },
2491 [ALC887_FIXUP_ASUS_BASS] = {
2492 .type = HDA_FIXUP_PINS,
2493 .v.pins = (const struct hda_pintbl[]) {
2494 {0x16, 0x99130130}, /* bass speaker */
2495 {}
2496 },
2497 .chained = true,
2498 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2499 },
2500 [ALC887_FIXUP_BASS_CHMAP] = {
2501 .type = HDA_FIXUP_FUNC,
2502 .v.func = alc_fixup_bass_chmap,
2503 },
2504 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2505 .type = HDA_FIXUP_FUNC,
2506 .v.func = alc1220_fixup_gb_dual_codecs,
2507 },
2508 [ALC1220_FIXUP_GB_X570] = {
2509 .type = HDA_FIXUP_FUNC,
2510 .v.func = alc1220_fixup_gb_x570,
2511 },
2512 [ALC1220_FIXUP_CLEVO_P950] = {
2513 .type = HDA_FIXUP_FUNC,
2514 .v.func = alc1220_fixup_clevo_p950,
2515 },
2516 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2517 .type = HDA_FIXUP_FUNC,
2518 .v.func = alc1220_fixup_clevo_pb51ed,
2519 },
2520 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2521 .type = HDA_FIXUP_PINS,
2522 .v.pins = (const struct hda_pintbl[]) {
2523 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2524 {}
2525 },
2526 .chained = true,
2527 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2528 },
2529 [ALC887_FIXUP_ASUS_AUDIO] = {
2530 .type = HDA_FIXUP_PINS,
2531 .v.pins = (const struct hda_pintbl[]) {
2532 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2533 { 0x19, 0x22219420 },
2534 {}
2535 },
2536 },
2537 [ALC887_FIXUP_ASUS_HMIC] = {
2538 .type = HDA_FIXUP_FUNC,
2539 .v.func = alc887_fixup_asus_jack,
2540 .chained = true,
2541 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2542 },
2543 [ALCS1200A_FIXUP_MIC_VREF] = {
2544 .type = HDA_FIXUP_PINCTLS,
2545 .v.pins = (const struct hda_pintbl[]) {
2546 { 0x18, PIN_VREF50 }, /* rear mic */
2547 { 0x19, PIN_VREF50 }, /* front mic */
2548 {}
2549 }
2550 },
2551 [ALC888VD_FIXUP_MIC_100VREF] = {
2552 .type = HDA_FIXUP_PINCTLS,
2553 .v.pins = (const struct hda_pintbl[]) {
2554 { 0x18, PIN_VREF100 }, /* headset mic */
2555 {}
2556 }
2557 },
2558 };
2559
2560 static const struct hda_quirk alc882_fixup_tbl[] = {
2561 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2562 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2563 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2564 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2565 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2566 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2567 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2568 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2569 ALC882_FIXUP_ACER_ASPIRE_4930G),
2570 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2571 ALC882_FIXUP_ACER_ASPIRE_4930G),
2572 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2573 ALC882_FIXUP_ACER_ASPIRE_8930G),
2574 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2575 ALC882_FIXUP_ACER_ASPIRE_8930G),
2576 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2577 ALC882_FIXUP_ACER_ASPIRE_4930G),
2578 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2579 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2580 ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2582 ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2584 ALC882_FIXUP_ACER_ASPIRE_4930G),
2585 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2586 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2587 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2588 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2589 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2590 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2591 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2592 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2593 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2594 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2595 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2596 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2597 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2598 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2599 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2600 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2601
2602 /* All Apple entries are in codec SSIDs */
2603 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2604 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2605 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2606 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2607 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2608 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2609 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2610 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2611 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2612 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2613 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2614 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2615 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2616 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2617 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2618 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2619 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2620 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2621 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2622 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2623 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2624 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2625
2626 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2627 SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2628 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2629 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2630 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2631 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2632 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2633 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2634 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2635 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2636 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2637 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2638 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2639 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2640 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2641 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2642 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2643 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2644 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2645 SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2661 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2662 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2663 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2664 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2665 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2666 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2667 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2668 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2669 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2670 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2671 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2672 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2673 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2674 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2675 SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2676 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2677 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2678 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2679 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2680 {}
2681 };
2682
2683 static const struct hda_model_fixup alc882_fixup_models[] = {
2684 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2685 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2686 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2687 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2688 {.id = ALC889_FIXUP_CD, .name = "cd"},
2689 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2690 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2691 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2692 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2693 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2694 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2695 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2696 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2697 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2698 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2699 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2700 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2701 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2702 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2703 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2704 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2705 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2706 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2707 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2708 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2709 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2710 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2711 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2712 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2713 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2714 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2715 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2716 {}
2717 };
2718
2719 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2720 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2721 {0x14, 0x01014010},
2722 {0x15, 0x01011012},
2723 {0x16, 0x01016011},
2724 {0x18, 0x01a19040},
2725 {0x19, 0x02a19050},
2726 {0x1a, 0x0181304f},
2727 {0x1b, 0x0221401f},
2728 {0x1e, 0x01456130}),
2729 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2730 {0x14, 0x01015010},
2731 {0x15, 0x01011012},
2732 {0x16, 0x01011011},
2733 {0x18, 0x01a11040},
2734 {0x19, 0x02a19050},
2735 {0x1a, 0x0181104f},
2736 {0x1b, 0x0221401f},
2737 {0x1e, 0x01451130}),
2738 {}
2739 };
2740
2741 /*
2742 * BIOS auto configuration
2743 */
2744 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2745 static int alc882_parse_auto_config(struct hda_codec *codec)
2746 {
2747 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2748 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2749 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2750 }
2751
2752 /*
2753 */
patch_alc882(struct hda_codec * codec)2754 static int patch_alc882(struct hda_codec *codec)
2755 {
2756 struct alc_spec *spec;
2757 int err;
2758
2759 err = alc_alloc_spec(codec, 0x0b);
2760 if (err < 0)
2761 return err;
2762
2763 spec = codec->spec;
2764
2765 switch (codec->core.vendor_id) {
2766 case 0x10ec0882:
2767 case 0x10ec0885:
2768 case 0x10ec0900:
2769 case 0x10ec0b00:
2770 case 0x10ec1220:
2771 break;
2772 default:
2773 /* ALC883 and variants */
2774 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2775 break;
2776 }
2777
2778 alc_pre_init(codec);
2779
2780 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2781 alc882_fixups);
2782 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2783 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2784
2785 alc_auto_parse_customize_define(codec);
2786
2787 if (has_cdefine_beep(codec))
2788 spec->gen.beep_nid = 0x01;
2789
2790 /* automatic parse from the BIOS config */
2791 err = alc882_parse_auto_config(codec);
2792 if (err < 0)
2793 goto error;
2794
2795 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2796 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2797 if (err < 0)
2798 goto error;
2799 }
2800
2801 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2802
2803 return 0;
2804
2805 error:
2806 alc_free(codec);
2807 return err;
2808 }
2809
2810
2811 /*
2812 * ALC262 support
2813 */
alc262_parse_auto_config(struct hda_codec * codec)2814 static int alc262_parse_auto_config(struct hda_codec *codec)
2815 {
2816 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2817 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2818 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2819 }
2820
2821 /*
2822 * Pin config fixes
2823 */
2824 enum {
2825 ALC262_FIXUP_FSC_H270,
2826 ALC262_FIXUP_FSC_S7110,
2827 ALC262_FIXUP_HP_Z200,
2828 ALC262_FIXUP_TYAN,
2829 ALC262_FIXUP_LENOVO_3000,
2830 ALC262_FIXUP_BENQ,
2831 ALC262_FIXUP_BENQ_T31,
2832 ALC262_FIXUP_INV_DMIC,
2833 ALC262_FIXUP_INTEL_BAYLEYBAY,
2834 };
2835
2836 static const struct hda_fixup alc262_fixups[] = {
2837 [ALC262_FIXUP_FSC_H270] = {
2838 .type = HDA_FIXUP_PINS,
2839 .v.pins = (const struct hda_pintbl[]) {
2840 { 0x14, 0x99130110 }, /* speaker */
2841 { 0x15, 0x0221142f }, /* front HP */
2842 { 0x1b, 0x0121141f }, /* rear HP */
2843 { }
2844 }
2845 },
2846 [ALC262_FIXUP_FSC_S7110] = {
2847 .type = HDA_FIXUP_PINS,
2848 .v.pins = (const struct hda_pintbl[]) {
2849 { 0x15, 0x90170110 }, /* speaker */
2850 { }
2851 },
2852 .chained = true,
2853 .chain_id = ALC262_FIXUP_BENQ,
2854 },
2855 [ALC262_FIXUP_HP_Z200] = {
2856 .type = HDA_FIXUP_PINS,
2857 .v.pins = (const struct hda_pintbl[]) {
2858 { 0x16, 0x99130120 }, /* internal speaker */
2859 { }
2860 }
2861 },
2862 [ALC262_FIXUP_TYAN] = {
2863 .type = HDA_FIXUP_PINS,
2864 .v.pins = (const struct hda_pintbl[]) {
2865 { 0x14, 0x1993e1f0 }, /* int AUX */
2866 { }
2867 }
2868 },
2869 [ALC262_FIXUP_LENOVO_3000] = {
2870 .type = HDA_FIXUP_PINCTLS,
2871 .v.pins = (const struct hda_pintbl[]) {
2872 { 0x19, PIN_VREF50 },
2873 {}
2874 },
2875 .chained = true,
2876 .chain_id = ALC262_FIXUP_BENQ,
2877 },
2878 [ALC262_FIXUP_BENQ] = {
2879 .type = HDA_FIXUP_VERBS,
2880 .v.verbs = (const struct hda_verb[]) {
2881 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2882 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2883 {}
2884 }
2885 },
2886 [ALC262_FIXUP_BENQ_T31] = {
2887 .type = HDA_FIXUP_VERBS,
2888 .v.verbs = (const struct hda_verb[]) {
2889 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2890 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2891 {}
2892 }
2893 },
2894 [ALC262_FIXUP_INV_DMIC] = {
2895 .type = HDA_FIXUP_FUNC,
2896 .v.func = alc_fixup_inv_dmic,
2897 },
2898 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2899 .type = HDA_FIXUP_FUNC,
2900 .v.func = alc_fixup_no_depop_delay,
2901 },
2902 };
2903
2904 static const struct hda_quirk alc262_fixup_tbl[] = {
2905 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2906 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2907 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2908 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2909 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2910 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2911 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2912 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2913 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2914 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2915 {}
2916 };
2917
2918 static const struct hda_model_fixup alc262_fixup_models[] = {
2919 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2920 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2921 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2922 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2923 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2924 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2925 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2926 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2927 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2928 {}
2929 };
2930
2931 /*
2932 */
patch_alc262(struct hda_codec * codec)2933 static int patch_alc262(struct hda_codec *codec)
2934 {
2935 struct alc_spec *spec;
2936 int err;
2937
2938 err = alc_alloc_spec(codec, 0x0b);
2939 if (err < 0)
2940 return err;
2941
2942 spec = codec->spec;
2943 spec->gen.shared_mic_vref_pin = 0x18;
2944
2945 spec->shutup = alc_eapd_shutup;
2946
2947 #if 0
2948 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2949 * under-run
2950 */
2951 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2952 #endif
2953 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2954
2955 alc_pre_init(codec);
2956
2957 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2958 alc262_fixups);
2959 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2960
2961 alc_auto_parse_customize_define(codec);
2962
2963 if (has_cdefine_beep(codec))
2964 spec->gen.beep_nid = 0x01;
2965
2966 /* automatic parse from the BIOS config */
2967 err = alc262_parse_auto_config(codec);
2968 if (err < 0)
2969 goto error;
2970
2971 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2972 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2973 if (err < 0)
2974 goto error;
2975 }
2976
2977 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2978
2979 return 0;
2980
2981 error:
2982 alc_free(codec);
2983 return err;
2984 }
2985
2986 /*
2987 * ALC268
2988 */
2989 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2990 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2991 struct snd_ctl_elem_value *ucontrol)
2992 {
2993 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2994 unsigned long pval;
2995 int err;
2996
2997 mutex_lock(&codec->control_mutex);
2998 pval = kcontrol->private_value;
2999 kcontrol->private_value = (pval & ~0xff) | 0x0f;
3000 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3001 if (err >= 0) {
3002 kcontrol->private_value = (pval & ~0xff) | 0x10;
3003 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3004 }
3005 kcontrol->private_value = pval;
3006 mutex_unlock(&codec->control_mutex);
3007 return err;
3008 }
3009
3010 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3011 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3012 {
3013 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3014 .name = "Beep Playback Switch",
3015 .subdevice = HDA_SUBDEV_AMP_FLAG,
3016 .info = snd_hda_mixer_amp_switch_info,
3017 .get = snd_hda_mixer_amp_switch_get,
3018 .put = alc268_beep_switch_put,
3019 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3020 },
3021 };
3022
3023 /* set PCBEEP vol = 0, mute connections */
3024 static const struct hda_verb alc268_beep_init_verbs[] = {
3025 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3026 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3027 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3028 { }
3029 };
3030
3031 enum {
3032 ALC268_FIXUP_INV_DMIC,
3033 ALC268_FIXUP_HP_EAPD,
3034 ALC268_FIXUP_SPDIF,
3035 };
3036
3037 static const struct hda_fixup alc268_fixups[] = {
3038 [ALC268_FIXUP_INV_DMIC] = {
3039 .type = HDA_FIXUP_FUNC,
3040 .v.func = alc_fixup_inv_dmic,
3041 },
3042 [ALC268_FIXUP_HP_EAPD] = {
3043 .type = HDA_FIXUP_VERBS,
3044 .v.verbs = (const struct hda_verb[]) {
3045 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3046 {}
3047 }
3048 },
3049 [ALC268_FIXUP_SPDIF] = {
3050 .type = HDA_FIXUP_PINS,
3051 .v.pins = (const struct hda_pintbl[]) {
3052 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3053 {}
3054 }
3055 },
3056 };
3057
3058 static const struct hda_model_fixup alc268_fixup_models[] = {
3059 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3060 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3061 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3062 {}
3063 };
3064
3065 static const struct hda_quirk alc268_fixup_tbl[] = {
3066 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3067 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3068 /* below is codec SSID since multiple Toshiba laptops have the
3069 * same PCI SSID 1179:ff00
3070 */
3071 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3072 {}
3073 };
3074
3075 /*
3076 * BIOS auto configuration
3077 */
alc268_parse_auto_config(struct hda_codec * codec)3078 static int alc268_parse_auto_config(struct hda_codec *codec)
3079 {
3080 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3081 return alc_parse_auto_config(codec, NULL, alc268_ssids);
3082 }
3083
3084 /*
3085 */
patch_alc268(struct hda_codec * codec)3086 static int patch_alc268(struct hda_codec *codec)
3087 {
3088 struct alc_spec *spec;
3089 int i, err;
3090
3091 /* ALC268 has no aa-loopback mixer */
3092 err = alc_alloc_spec(codec, 0);
3093 if (err < 0)
3094 return err;
3095
3096 spec = codec->spec;
3097 if (has_cdefine_beep(codec))
3098 spec->gen.beep_nid = 0x01;
3099
3100 spec->shutup = alc_eapd_shutup;
3101
3102 alc_pre_init(codec);
3103
3104 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3105 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3106
3107 /* automatic parse from the BIOS config */
3108 err = alc268_parse_auto_config(codec);
3109 if (err < 0)
3110 goto error;
3111
3112 if (err > 0 && !spec->gen.no_analog &&
3113 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3114 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3115 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3116 &alc268_beep_mixer[i])) {
3117 err = -ENOMEM;
3118 goto error;
3119 }
3120 }
3121 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3122 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3123 /* override the amp caps for beep generator */
3124 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3125 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3126 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3127 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3128 (0 << AC_AMPCAP_MUTE_SHIFT));
3129 }
3130
3131 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3132
3133 return 0;
3134
3135 error:
3136 alc_free(codec);
3137 return err;
3138 }
3139
3140 /*
3141 * ALC269
3142 */
3143
3144 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3145 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3146 };
3147
3148 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3149 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3150 };
3151
3152 /* different alc269-variants */
3153 enum {
3154 ALC269_TYPE_ALC269VA,
3155 ALC269_TYPE_ALC269VB,
3156 ALC269_TYPE_ALC269VC,
3157 ALC269_TYPE_ALC269VD,
3158 ALC269_TYPE_ALC280,
3159 ALC269_TYPE_ALC282,
3160 ALC269_TYPE_ALC283,
3161 ALC269_TYPE_ALC284,
3162 ALC269_TYPE_ALC293,
3163 ALC269_TYPE_ALC286,
3164 ALC269_TYPE_ALC298,
3165 ALC269_TYPE_ALC255,
3166 ALC269_TYPE_ALC256,
3167 ALC269_TYPE_ALC257,
3168 ALC269_TYPE_ALC215,
3169 ALC269_TYPE_ALC225,
3170 ALC269_TYPE_ALC245,
3171 ALC269_TYPE_ALC287,
3172 ALC269_TYPE_ALC294,
3173 ALC269_TYPE_ALC300,
3174 ALC269_TYPE_ALC623,
3175 ALC269_TYPE_ALC700,
3176 };
3177
3178 /*
3179 * BIOS auto configuration
3180 */
alc269_parse_auto_config(struct hda_codec * codec)3181 static int alc269_parse_auto_config(struct hda_codec *codec)
3182 {
3183 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3184 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3185 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3186 struct alc_spec *spec = codec->spec;
3187 const hda_nid_t *ssids;
3188
3189 switch (spec->codec_variant) {
3190 case ALC269_TYPE_ALC269VA:
3191 case ALC269_TYPE_ALC269VC:
3192 case ALC269_TYPE_ALC280:
3193 case ALC269_TYPE_ALC284:
3194 case ALC269_TYPE_ALC293:
3195 ssids = alc269va_ssids;
3196 break;
3197 case ALC269_TYPE_ALC269VB:
3198 case ALC269_TYPE_ALC269VD:
3199 case ALC269_TYPE_ALC282:
3200 case ALC269_TYPE_ALC283:
3201 case ALC269_TYPE_ALC286:
3202 case ALC269_TYPE_ALC298:
3203 case ALC269_TYPE_ALC255:
3204 case ALC269_TYPE_ALC256:
3205 case ALC269_TYPE_ALC257:
3206 case ALC269_TYPE_ALC215:
3207 case ALC269_TYPE_ALC225:
3208 case ALC269_TYPE_ALC245:
3209 case ALC269_TYPE_ALC287:
3210 case ALC269_TYPE_ALC294:
3211 case ALC269_TYPE_ALC300:
3212 case ALC269_TYPE_ALC623:
3213 case ALC269_TYPE_ALC700:
3214 ssids = alc269_ssids;
3215 break;
3216 default:
3217 ssids = alc269_ssids;
3218 break;
3219 }
3220
3221 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3222 }
3223
3224 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3225 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3226 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3227 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3228 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3229 {}
3230 };
3231
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3232 static void alc_headset_btn_callback(struct hda_codec *codec,
3233 struct hda_jack_callback *jack)
3234 {
3235 int report = 0;
3236
3237 if (jack->unsol_res & (7 << 13))
3238 report |= SND_JACK_BTN_0;
3239
3240 if (jack->unsol_res & (1 << 16 | 3 << 8))
3241 report |= SND_JACK_BTN_1;
3242
3243 /* Volume up key */
3244 if (jack->unsol_res & (7 << 23))
3245 report |= SND_JACK_BTN_2;
3246
3247 /* Volume down key */
3248 if (jack->unsol_res & (7 << 10))
3249 report |= SND_JACK_BTN_3;
3250
3251 snd_hda_jack_set_button_state(codec, jack->nid, report);
3252 }
3253
alc_disable_headset_jack_key(struct hda_codec * codec)3254 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3255 {
3256 struct alc_spec *spec = codec->spec;
3257
3258 if (!spec->has_hs_key)
3259 return;
3260
3261 switch (codec->core.vendor_id) {
3262 case 0x10ec0215:
3263 case 0x10ec0225:
3264 case 0x10ec0285:
3265 case 0x10ec0287:
3266 case 0x10ec0295:
3267 case 0x10ec0289:
3268 case 0x10ec0299:
3269 alc_write_coef_idx(codec, 0x48, 0x0);
3270 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3271 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3272 break;
3273 case 0x10ec0230:
3274 case 0x10ec0236:
3275 case 0x10ec0256:
3276 case 0x10ec0257:
3277 case 0x19e58326:
3278 alc_write_coef_idx(codec, 0x48, 0x0);
3279 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3280 break;
3281 }
3282 }
3283
alc_enable_headset_jack_key(struct hda_codec * codec)3284 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3285 {
3286 struct alc_spec *spec = codec->spec;
3287
3288 if (!spec->has_hs_key)
3289 return;
3290
3291 switch (codec->core.vendor_id) {
3292 case 0x10ec0215:
3293 case 0x10ec0225:
3294 case 0x10ec0285:
3295 case 0x10ec0287:
3296 case 0x10ec0295:
3297 case 0x10ec0289:
3298 case 0x10ec0299:
3299 alc_write_coef_idx(codec, 0x48, 0xd011);
3300 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3301 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3302 break;
3303 case 0x10ec0230:
3304 case 0x10ec0236:
3305 case 0x10ec0256:
3306 case 0x10ec0257:
3307 case 0x19e58326:
3308 alc_write_coef_idx(codec, 0x48, 0xd011);
3309 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3310 break;
3311 }
3312 }
3313
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3314 static void alc_fixup_headset_jack(struct hda_codec *codec,
3315 const struct hda_fixup *fix, int action)
3316 {
3317 struct alc_spec *spec = codec->spec;
3318 hda_nid_t hp_pin;
3319
3320 switch (action) {
3321 case HDA_FIXUP_ACT_PRE_PROBE:
3322 spec->has_hs_key = 1;
3323 snd_hda_jack_detect_enable_callback(codec, 0x55,
3324 alc_headset_btn_callback);
3325 break;
3326 case HDA_FIXUP_ACT_BUILD:
3327 hp_pin = alc_get_hp_pin(spec);
3328 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3329 alc_headset_btn_keymap,
3330 hp_pin))
3331 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3332 false, SND_JACK_HEADSET,
3333 alc_headset_btn_keymap);
3334
3335 alc_enable_headset_jack_key(codec);
3336 break;
3337 }
3338 }
3339
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3340 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3341 {
3342 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3343 }
3344
alc269_shutup(struct hda_codec * codec)3345 static void alc269_shutup(struct hda_codec *codec)
3346 {
3347 struct alc_spec *spec = codec->spec;
3348
3349 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3350 alc269vb_toggle_power_output(codec, 0);
3351 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3352 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3353 msleep(150);
3354 }
3355 alc_shutup_pins(codec);
3356 }
3357
3358 static const struct coef_fw alc282_coefs[] = {
3359 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3360 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3361 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3362 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3363 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3364 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3365 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3366 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3367 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3368 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3369 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3370 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3371 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3372 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3373 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3374 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3375 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3376 WRITE_COEF(0x63, 0x2902), /* PLL */
3377 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3378 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3379 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3380 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3381 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3382 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3383 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3384 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3385 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3386 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3387 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3388 {}
3389 };
3390
alc282_restore_default_value(struct hda_codec * codec)3391 static void alc282_restore_default_value(struct hda_codec *codec)
3392 {
3393 alc_process_coef_fw(codec, alc282_coefs);
3394 }
3395
alc282_init(struct hda_codec * codec)3396 static void alc282_init(struct hda_codec *codec)
3397 {
3398 struct alc_spec *spec = codec->spec;
3399 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3400 bool hp_pin_sense;
3401 int coef78;
3402
3403 alc282_restore_default_value(codec);
3404
3405 if (!hp_pin)
3406 return;
3407 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3408 coef78 = alc_read_coef_idx(codec, 0x78);
3409
3410 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3411 /* Headphone capless set to high power mode */
3412 alc_write_coef_idx(codec, 0x78, 0x9004);
3413
3414 if (hp_pin_sense)
3415 msleep(2);
3416
3417 snd_hda_codec_write(codec, hp_pin, 0,
3418 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3419
3420 if (hp_pin_sense)
3421 msleep(85);
3422
3423 snd_hda_codec_write(codec, hp_pin, 0,
3424 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3425
3426 if (hp_pin_sense)
3427 msleep(100);
3428
3429 /* Headphone capless set to normal mode */
3430 alc_write_coef_idx(codec, 0x78, coef78);
3431 }
3432
alc282_shutup(struct hda_codec * codec)3433 static void alc282_shutup(struct hda_codec *codec)
3434 {
3435 struct alc_spec *spec = codec->spec;
3436 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3437 bool hp_pin_sense;
3438 int coef78;
3439
3440 if (!hp_pin) {
3441 alc269_shutup(codec);
3442 return;
3443 }
3444
3445 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3446 coef78 = alc_read_coef_idx(codec, 0x78);
3447 alc_write_coef_idx(codec, 0x78, 0x9004);
3448
3449 if (hp_pin_sense)
3450 msleep(2);
3451
3452 snd_hda_codec_write(codec, hp_pin, 0,
3453 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3454
3455 if (hp_pin_sense)
3456 msleep(85);
3457
3458 if (!spec->no_shutup_pins)
3459 snd_hda_codec_write(codec, hp_pin, 0,
3460 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3461
3462 if (hp_pin_sense)
3463 msleep(100);
3464
3465 alc_auto_setup_eapd(codec, false);
3466 alc_shutup_pins(codec);
3467 alc_write_coef_idx(codec, 0x78, coef78);
3468 }
3469
3470 static const struct coef_fw alc283_coefs[] = {
3471 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3472 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3473 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3474 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3475 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3476 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3477 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3478 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3479 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3480 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3481 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3482 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3483 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3484 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3485 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3486 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3487 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3488 WRITE_COEF(0x2e, 0x2902), /* PLL */
3489 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3490 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3491 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3492 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3493 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3494 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3495 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3496 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3497 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3498 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3499 WRITE_COEF(0x49, 0x0), /* test mode */
3500 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3501 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3502 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3503 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3504 {}
3505 };
3506
alc283_restore_default_value(struct hda_codec * codec)3507 static void alc283_restore_default_value(struct hda_codec *codec)
3508 {
3509 alc_process_coef_fw(codec, alc283_coefs);
3510 }
3511
alc283_init(struct hda_codec * codec)3512 static void alc283_init(struct hda_codec *codec)
3513 {
3514 struct alc_spec *spec = codec->spec;
3515 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3516 bool hp_pin_sense;
3517
3518 alc283_restore_default_value(codec);
3519
3520 if (!hp_pin)
3521 return;
3522
3523 msleep(30);
3524 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3525
3526 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3527 /* Headphone capless set to high power mode */
3528 alc_write_coef_idx(codec, 0x43, 0x9004);
3529
3530 snd_hda_codec_write(codec, hp_pin, 0,
3531 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3532
3533 if (hp_pin_sense)
3534 msleep(85);
3535
3536 snd_hda_codec_write(codec, hp_pin, 0,
3537 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3538
3539 if (hp_pin_sense)
3540 msleep(85);
3541 /* Index 0x46 Combo jack auto switch control 2 */
3542 /* 3k pull low control for Headset jack. */
3543 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3544 /* Headphone capless set to normal mode */
3545 alc_write_coef_idx(codec, 0x43, 0x9614);
3546 }
3547
alc283_shutup(struct hda_codec * codec)3548 static void alc283_shutup(struct hda_codec *codec)
3549 {
3550 struct alc_spec *spec = codec->spec;
3551 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3552 bool hp_pin_sense;
3553
3554 if (!hp_pin) {
3555 alc269_shutup(codec);
3556 return;
3557 }
3558
3559 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3560
3561 alc_write_coef_idx(codec, 0x43, 0x9004);
3562
3563 /*depop hp during suspend*/
3564 alc_write_coef_idx(codec, 0x06, 0x2100);
3565
3566 snd_hda_codec_write(codec, hp_pin, 0,
3567 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3568
3569 if (hp_pin_sense)
3570 msleep(100);
3571
3572 if (!spec->no_shutup_pins)
3573 snd_hda_codec_write(codec, hp_pin, 0,
3574 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3575
3576 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3577
3578 if (hp_pin_sense)
3579 msleep(100);
3580 alc_auto_setup_eapd(codec, false);
3581 alc_shutup_pins(codec);
3582 alc_write_coef_idx(codec, 0x43, 0x9614);
3583 }
3584
alc256_init(struct hda_codec * codec)3585 static void alc256_init(struct hda_codec *codec)
3586 {
3587 struct alc_spec *spec = codec->spec;
3588 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3589 bool hp_pin_sense;
3590
3591 if (spec->ultra_low_power) {
3592 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3593 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3594 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3595 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3596 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3597 msleep(30);
3598 }
3599
3600 if (!hp_pin)
3601 hp_pin = 0x21;
3602
3603 msleep(30);
3604
3605 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3606
3607 if (hp_pin_sense) {
3608 msleep(2);
3609 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3610
3611 snd_hda_codec_write(codec, hp_pin, 0,
3612 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3613
3614 msleep(75);
3615
3616 snd_hda_codec_write(codec, hp_pin, 0,
3617 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3618
3619 msleep(75);
3620 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3621 }
3622 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3623 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3624 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3625 /*
3626 * Expose headphone mic (or possibly Line In on some machines) instead
3627 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3628 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3629 * this register.
3630 */
3631 alc_write_coef_idx(codec, 0x36, 0x5757);
3632 }
3633
alc256_shutup(struct hda_codec * codec)3634 static void alc256_shutup(struct hda_codec *codec)
3635 {
3636 struct alc_spec *spec = codec->spec;
3637 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3638 bool hp_pin_sense;
3639
3640 if (!hp_pin)
3641 hp_pin = 0x21;
3642
3643 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3644 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3645
3646 if (hp_pin_sense) {
3647 msleep(2);
3648
3649 snd_hda_codec_write(codec, hp_pin, 0,
3650 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3651
3652 msleep(75);
3653
3654 /* 3k pull low control for Headset jack. */
3655 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3656 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3657 * when booting with headset plugged. So skip setting it for the codec alc257
3658 */
3659 if (spec->en_3kpull_low)
3660 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3661
3662 if (!spec->no_shutup_pins)
3663 snd_hda_codec_write(codec, hp_pin, 0,
3664 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3665
3666 msleep(75);
3667 }
3668
3669 alc_auto_setup_eapd(codec, false);
3670 alc_shutup_pins(codec);
3671 if (spec->ultra_low_power) {
3672 msleep(50);
3673 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3674 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3675 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3676 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3677 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3678 msleep(30);
3679 }
3680 }
3681
alc285_hp_init(struct hda_codec * codec)3682 static void alc285_hp_init(struct hda_codec *codec)
3683 {
3684 struct alc_spec *spec = codec->spec;
3685 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3686 int i, val;
3687 int coef38, coef0d, coef36;
3688
3689 alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3690 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3691 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3692 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3693 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3694 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3695 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3696
3697 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3698
3699 if (hp_pin)
3700 snd_hda_codec_write(codec, hp_pin, 0,
3701 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3702
3703 msleep(130);
3704 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3705 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3706
3707 if (hp_pin)
3708 snd_hda_codec_write(codec, hp_pin, 0,
3709 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3710 msleep(10);
3711 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3712 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3713 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3714 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3715
3716 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3717 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3718 for (i = 0; i < 20 && val & 0x8000; i++) {
3719 msleep(50);
3720 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3721 } /* Wait for depop procedure finish */
3722
3723 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3724 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3725 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3726 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3727
3728 msleep(50);
3729 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3730 }
3731
alc225_init(struct hda_codec * codec)3732 static void alc225_init(struct hda_codec *codec)
3733 {
3734 struct alc_spec *spec = codec->spec;
3735 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3736 bool hp1_pin_sense, hp2_pin_sense;
3737
3738 if (spec->ultra_low_power) {
3739 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3740 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3741 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3742 msleep(30);
3743 }
3744
3745 if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3746 spec->codec_variant != ALC269_TYPE_ALC245)
3747 /* required only at boot or S3 and S4 resume time */
3748 if (!spec->done_hp_init ||
3749 is_s3_resume(codec) ||
3750 is_s4_resume(codec)) {
3751 alc285_hp_init(codec);
3752 spec->done_hp_init = true;
3753 }
3754
3755 if (!hp_pin)
3756 hp_pin = 0x21;
3757 msleep(30);
3758
3759 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3760 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3761
3762 if (hp1_pin_sense || hp2_pin_sense) {
3763 msleep(2);
3764 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3765
3766 if (hp1_pin_sense)
3767 snd_hda_codec_write(codec, hp_pin, 0,
3768 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3769 if (hp2_pin_sense)
3770 snd_hda_codec_write(codec, 0x16, 0,
3771 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3772 msleep(75);
3773
3774 if (hp1_pin_sense)
3775 snd_hda_codec_write(codec, hp_pin, 0,
3776 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3777 if (hp2_pin_sense)
3778 snd_hda_codec_write(codec, 0x16, 0,
3779 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3780
3781 msleep(75);
3782 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3783 }
3784 }
3785
alc225_shutup(struct hda_codec * codec)3786 static void alc225_shutup(struct hda_codec *codec)
3787 {
3788 struct alc_spec *spec = codec->spec;
3789 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3790 bool hp1_pin_sense, hp2_pin_sense;
3791
3792 if (!hp_pin)
3793 hp_pin = 0x21;
3794
3795 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3796 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3797
3798 if (hp1_pin_sense || hp2_pin_sense) {
3799 alc_disable_headset_jack_key(codec);
3800 /* 3k pull low control for Headset jack. */
3801 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3802 msleep(2);
3803
3804 if (hp1_pin_sense)
3805 snd_hda_codec_write(codec, hp_pin, 0,
3806 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3807 if (hp2_pin_sense)
3808 snd_hda_codec_write(codec, 0x16, 0,
3809 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3810
3811 msleep(75);
3812
3813 if (hp1_pin_sense)
3814 snd_hda_codec_write(codec, hp_pin, 0,
3815 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3816 if (hp2_pin_sense)
3817 snd_hda_codec_write(codec, 0x16, 0,
3818 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3819
3820 msleep(75);
3821 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3822 alc_enable_headset_jack_key(codec);
3823 }
3824 alc_auto_setup_eapd(codec, false);
3825 alc_shutup_pins(codec);
3826 if (spec->ultra_low_power) {
3827 msleep(50);
3828 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3829 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3830 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3831 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3832 msleep(30);
3833 }
3834 }
3835
alc_default_init(struct hda_codec * codec)3836 static void alc_default_init(struct hda_codec *codec)
3837 {
3838 struct alc_spec *spec = codec->spec;
3839 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3840 bool hp_pin_sense;
3841
3842 if (!hp_pin)
3843 return;
3844
3845 msleep(30);
3846
3847 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3848
3849 if (hp_pin_sense) {
3850 msleep(2);
3851
3852 snd_hda_codec_write(codec, hp_pin, 0,
3853 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3854
3855 msleep(75);
3856
3857 snd_hda_codec_write(codec, hp_pin, 0,
3858 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3859 msleep(75);
3860 }
3861 }
3862
alc_default_shutup(struct hda_codec * codec)3863 static void alc_default_shutup(struct hda_codec *codec)
3864 {
3865 struct alc_spec *spec = codec->spec;
3866 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3867 bool hp_pin_sense;
3868
3869 if (!hp_pin) {
3870 alc269_shutup(codec);
3871 return;
3872 }
3873
3874 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3875
3876 if (hp_pin_sense) {
3877 msleep(2);
3878
3879 snd_hda_codec_write(codec, hp_pin, 0,
3880 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3881
3882 msleep(75);
3883
3884 if (!spec->no_shutup_pins)
3885 snd_hda_codec_write(codec, hp_pin, 0,
3886 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3887
3888 msleep(75);
3889 }
3890 alc_auto_setup_eapd(codec, false);
3891 alc_shutup_pins(codec);
3892 }
3893
alc294_hp_init(struct hda_codec * codec)3894 static void alc294_hp_init(struct hda_codec *codec)
3895 {
3896 struct alc_spec *spec = codec->spec;
3897 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3898 int i, val;
3899
3900 if (!hp_pin)
3901 return;
3902
3903 snd_hda_codec_write(codec, hp_pin, 0,
3904 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3905
3906 msleep(100);
3907
3908 if (!spec->no_shutup_pins)
3909 snd_hda_codec_write(codec, hp_pin, 0,
3910 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3911
3912 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3913 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3914
3915 /* Wait for depop procedure finish */
3916 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3917 for (i = 0; i < 20 && val & 0x0080; i++) {
3918 msleep(50);
3919 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3920 }
3921 /* Set HP depop to auto mode */
3922 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3923 msleep(50);
3924 }
3925
alc294_init(struct hda_codec * codec)3926 static void alc294_init(struct hda_codec *codec)
3927 {
3928 struct alc_spec *spec = codec->spec;
3929
3930 /* required only at boot or S4 resume time */
3931 if (!spec->done_hp_init ||
3932 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3933 alc294_hp_init(codec);
3934 spec->done_hp_init = true;
3935 }
3936 alc_default_init(codec);
3937 }
3938
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)3939 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3940 unsigned int val)
3941 {
3942 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3943 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3944 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3945 }
3946
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)3947 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3948 {
3949 unsigned int val;
3950
3951 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3952 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3953 & 0xffff;
3954 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3955 << 16;
3956 return val;
3957 }
3958
alc5505_dsp_halt(struct hda_codec * codec)3959 static void alc5505_dsp_halt(struct hda_codec *codec)
3960 {
3961 unsigned int val;
3962
3963 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3964 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3965 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3966 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3967 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3968 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3969 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3970 val = alc5505_coef_get(codec, 0x6220);
3971 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3972 }
3973
alc5505_dsp_back_from_halt(struct hda_codec * codec)3974 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3975 {
3976 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3977 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3978 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3979 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3980 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3981 alc5505_coef_set(codec, 0x880c, 0x00000004);
3982 }
3983
alc5505_dsp_init(struct hda_codec * codec)3984 static void alc5505_dsp_init(struct hda_codec *codec)
3985 {
3986 unsigned int val;
3987
3988 alc5505_dsp_halt(codec);
3989 alc5505_dsp_back_from_halt(codec);
3990 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3991 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3992 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3993 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3994 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3995 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3996 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3997 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3998 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3999 alc5505_coef_set(codec, 0x61b8, 0x04163302);
4000 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4001 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4002 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4003
4004 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4005 if (val <= 3)
4006 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4007 else
4008 alc5505_coef_set(codec, 0x6220, 0x6002018f);
4009
4010 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4011 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4012 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4013 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4014 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4015 alc5505_coef_set(codec, 0x880c, 0x00000003);
4016 alc5505_coef_set(codec, 0x880c, 0x00000010);
4017
4018 #ifdef HALT_REALTEK_ALC5505
4019 alc5505_dsp_halt(codec);
4020 #endif
4021 }
4022
4023 #ifdef HALT_REALTEK_ALC5505
4024 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
4025 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
4026 #else
4027 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
4028 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
4029 #endif
4030
4031 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)4032 static int alc269_suspend(struct hda_codec *codec)
4033 {
4034 struct alc_spec *spec = codec->spec;
4035
4036 if (spec->has_alc5505_dsp)
4037 alc5505_dsp_suspend(codec);
4038
4039 return alc_suspend(codec);
4040 }
4041
alc269_resume(struct hda_codec * codec)4042 static int alc269_resume(struct hda_codec *codec)
4043 {
4044 struct alc_spec *spec = codec->spec;
4045
4046 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4047 alc269vb_toggle_power_output(codec, 0);
4048 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4049 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
4050 msleep(150);
4051 }
4052
4053 codec->patch_ops.init(codec);
4054
4055 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4056 alc269vb_toggle_power_output(codec, 1);
4057 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4058 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
4059 msleep(200);
4060 }
4061
4062 snd_hda_regmap_sync(codec);
4063 hda_call_check_power_status(codec, 0x01);
4064
4065 /* on some machine, the BIOS will clear the codec gpio data when enter
4066 * suspend, and won't restore the data after resume, so we restore it
4067 * in the driver.
4068 */
4069 if (spec->gpio_data)
4070 alc_write_gpio_data(codec);
4071
4072 if (spec->has_alc5505_dsp)
4073 alc5505_dsp_resume(codec);
4074
4075 return 0;
4076 }
4077 #endif /* CONFIG_PM */
4078
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4079 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4080 const struct hda_fixup *fix, int action)
4081 {
4082 struct alc_spec *spec = codec->spec;
4083
4084 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4085 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4086 }
4087
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4088 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4089 const struct hda_fixup *fix,
4090 int action)
4091 {
4092 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4093 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4094
4095 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4096 snd_hda_codec_set_pincfg(codec, 0x19,
4097 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4098 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4099 }
4100
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4101 static void alc269_fixup_hweq(struct hda_codec *codec,
4102 const struct hda_fixup *fix, int action)
4103 {
4104 if (action == HDA_FIXUP_ACT_INIT)
4105 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4106 }
4107
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4108 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4109 const struct hda_fixup *fix, int action)
4110 {
4111 struct alc_spec *spec = codec->spec;
4112
4113 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4114 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4115 }
4116
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4117 static void alc271_fixup_dmic(struct hda_codec *codec,
4118 const struct hda_fixup *fix, int action)
4119 {
4120 static const struct hda_verb verbs[] = {
4121 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4122 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4123 {}
4124 };
4125 unsigned int cfg;
4126
4127 if (strcmp(codec->core.chip_name, "ALC271X") &&
4128 strcmp(codec->core.chip_name, "ALC269VB"))
4129 return;
4130 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4131 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4132 snd_hda_sequence_write(codec, verbs);
4133 }
4134
4135 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4136 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4137 const struct hda_fixup *fix,
4138 int action)
4139 {
4140 if (action == HDA_FIXUP_ACT_INIT)
4141 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4142 }
4143
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4144 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4145 const struct hda_fixup *fix, int action)
4146 {
4147 struct alc_spec *spec = codec->spec;
4148
4149 if (action != HDA_FIXUP_ACT_PROBE)
4150 return;
4151
4152 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4153 * fix the sample rate of analog I/O to 44.1kHz
4154 */
4155 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4156 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4157 }
4158
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4159 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4160 const struct hda_fixup *fix, int action)
4161 {
4162 /* The digital-mic unit sends PDM (differential signal) instead of
4163 * the standard PCM, thus you can't record a valid mono stream as is.
4164 * Below is a workaround specific to ALC269 to control the dmic
4165 * signal source as mono.
4166 */
4167 if (action == HDA_FIXUP_ACT_INIT)
4168 alc_update_coef_idx(codec, 0x07, 0, 0x80);
4169 }
4170
alc269_quanta_automute(struct hda_codec * codec)4171 static void alc269_quanta_automute(struct hda_codec *codec)
4172 {
4173 snd_hda_gen_update_outputs(codec);
4174
4175 alc_write_coef_idx(codec, 0x0c, 0x680);
4176 alc_write_coef_idx(codec, 0x0c, 0x480);
4177 }
4178
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4179 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4180 const struct hda_fixup *fix, int action)
4181 {
4182 struct alc_spec *spec = codec->spec;
4183 if (action != HDA_FIXUP_ACT_PROBE)
4184 return;
4185 spec->gen.automute_hook = alc269_quanta_automute;
4186 }
4187
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4188 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4189 struct hda_jack_callback *jack)
4190 {
4191 struct alc_spec *spec = codec->spec;
4192 int vref;
4193 msleep(200);
4194 snd_hda_gen_hp_automute(codec, jack);
4195
4196 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4197 msleep(100);
4198 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4199 vref);
4200 msleep(500);
4201 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4202 vref);
4203 }
4204
4205 /*
4206 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4207 */
4208 struct hda_alc298_mbxinit {
4209 unsigned char value_0x23;
4210 unsigned char value_0x25;
4211 };
4212
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4213 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4214 const struct hda_alc298_mbxinit *initval,
4215 bool first)
4216 {
4217 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4218 alc_write_coef_idx(codec, 0x26, 0xb000);
4219
4220 if (first)
4221 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4222
4223 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4224 alc_write_coef_idx(codec, 0x26, 0xf000);
4225 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4226
4227 if (initval->value_0x23 != 0x1e)
4228 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4229
4230 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4231 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4232 }
4233
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4234 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4235 const struct hda_fixup *fix,
4236 int action)
4237 {
4238 /* Initialization magic */
4239 static const struct hda_alc298_mbxinit dac_init[] = {
4240 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4241 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4242 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4243 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4244 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4245 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4246 {0x2f, 0x00},
4247 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4248 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4249 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4250 {}
4251 };
4252 const struct hda_alc298_mbxinit *seq;
4253
4254 if (action != HDA_FIXUP_ACT_INIT)
4255 return;
4256
4257 /* Start */
4258 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4259 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4260 alc_write_coef_idx(codec, 0x26, 0xf000);
4261 alc_write_coef_idx(codec, 0x22, 0x31);
4262 alc_write_coef_idx(codec, 0x23, 0x0b);
4263 alc_write_coef_idx(codec, 0x25, 0x00);
4264 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4265 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4266
4267 for (seq = dac_init; seq->value_0x23; seq++)
4268 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4269 }
4270
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4271 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4272 const struct hda_fixup *fix, int action)
4273 {
4274 struct alc_spec *spec = codec->spec;
4275 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4276 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4277 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4278 }
4279 }
4280
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4281 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4282 bool polarity, bool on)
4283 {
4284 unsigned int pinval;
4285
4286 if (!pin)
4287 return;
4288 if (polarity)
4289 on = !on;
4290 pinval = snd_hda_codec_get_pin_target(codec, pin);
4291 pinval &= ~AC_PINCTL_VREFEN;
4292 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4293 /* temporarily power up/down for setting VREF */
4294 snd_hda_power_up_pm(codec);
4295 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4296 snd_hda_power_down_pm(codec);
4297 }
4298
4299 /* update mute-LED according to the speaker mute state via mic VREF pin */
vref_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4300 static int vref_mute_led_set(struct led_classdev *led_cdev,
4301 enum led_brightness brightness)
4302 {
4303 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4304 struct alc_spec *spec = codec->spec;
4305
4306 alc_update_vref_led(codec, spec->mute_led_nid,
4307 spec->mute_led_polarity, brightness);
4308 return 0;
4309 }
4310
4311 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4312 static unsigned int led_power_filter(struct hda_codec *codec,
4313 hda_nid_t nid,
4314 unsigned int power_state)
4315 {
4316 struct alc_spec *spec = codec->spec;
4317
4318 if (power_state != AC_PWRST_D3 || nid == 0 ||
4319 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4320 return power_state;
4321
4322 /* Set pin ctl again, it might have just been set to 0 */
4323 snd_hda_set_pin_ctl(codec, nid,
4324 snd_hda_codec_get_pin_target(codec, nid));
4325
4326 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4327 }
4328
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4329 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4330 const struct hda_fixup *fix, int action)
4331 {
4332 struct alc_spec *spec = codec->spec;
4333 const struct dmi_device *dev = NULL;
4334
4335 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4336 return;
4337
4338 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4339 int pol, pin;
4340 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4341 continue;
4342 if (pin < 0x0a || pin >= 0x10)
4343 break;
4344 spec->mute_led_polarity = pol;
4345 spec->mute_led_nid = pin - 0x0a + 0x18;
4346 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4347 codec->power_filter = led_power_filter;
4348 codec_dbg(codec,
4349 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4350 spec->mute_led_polarity);
4351 break;
4352 }
4353 }
4354
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4355 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4356 const struct hda_fixup *fix,
4357 int action, hda_nid_t pin)
4358 {
4359 struct alc_spec *spec = codec->spec;
4360
4361 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4362 spec->mute_led_polarity = 0;
4363 spec->mute_led_nid = pin;
4364 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4365 codec->power_filter = led_power_filter;
4366 }
4367 }
4368
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4369 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4370 const struct hda_fixup *fix, int action)
4371 {
4372 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4373 }
4374
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4375 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4376 const struct hda_fixup *fix, int action)
4377 {
4378 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4379 }
4380
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4381 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4382 const struct hda_fixup *fix, int action)
4383 {
4384 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4385 }
4386
4387 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4388 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4389 int polarity, bool enabled)
4390 {
4391 if (polarity)
4392 enabled = !enabled;
4393 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4394 }
4395
4396 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4397 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4398 enum led_brightness brightness)
4399 {
4400 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4401 struct alc_spec *spec = codec->spec;
4402
4403 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4404 spec->mute_led_polarity, !brightness);
4405 return 0;
4406 }
4407
4408 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4409 static int micmute_led_set(struct led_classdev *led_cdev,
4410 enum led_brightness brightness)
4411 {
4412 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4413 struct alc_spec *spec = codec->spec;
4414
4415 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4416 spec->micmute_led_polarity, !brightness);
4417 return 0;
4418 }
4419
4420 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
alc_fixup_hp_gpio_led(struct hda_codec * codec,int action,unsigned int mute_mask,unsigned int micmute_mask)4421 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4422 int action,
4423 unsigned int mute_mask,
4424 unsigned int micmute_mask)
4425 {
4426 struct alc_spec *spec = codec->spec;
4427
4428 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4429
4430 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4431 return;
4432 if (mute_mask) {
4433 spec->gpio_mute_led_mask = mute_mask;
4434 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4435 }
4436 if (micmute_mask) {
4437 spec->gpio_mic_led_mask = micmute_mask;
4438 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4439 }
4440 }
4441
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4442 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4443 const struct hda_fixup *fix, int action)
4444 {
4445 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4446 }
4447
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4448 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4449 const struct hda_fixup *fix, int action)
4450 {
4451 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4452 }
4453
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4454 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4455 const struct hda_fixup *fix, int action)
4456 {
4457 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4458 }
4459
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4460 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4461 const struct hda_fixup *fix, int action)
4462 {
4463 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4464 }
4465
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4466 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4467 const struct hda_fixup *fix, int action)
4468 {
4469 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4470 }
4471
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4472 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4473 const struct hda_fixup *fix, int action)
4474 {
4475 struct alc_spec *spec = codec->spec;
4476
4477 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4478 spec->micmute_led_polarity = 1;
4479 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4480 }
4481
4482 /* turn on/off mic-mute LED per capture hook via VREF change */
vref_micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4483 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4484 enum led_brightness brightness)
4485 {
4486 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4487 struct alc_spec *spec = codec->spec;
4488
4489 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4490 spec->micmute_led_polarity, brightness);
4491 return 0;
4492 }
4493
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4494 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4495 const struct hda_fixup *fix, int action)
4496 {
4497 struct alc_spec *spec = codec->spec;
4498
4499 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4500 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4501 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4502 * enable headphone amp
4503 */
4504 spec->gpio_mask |= 0x10;
4505 spec->gpio_dir |= 0x10;
4506 spec->cap_mute_led_nid = 0x18;
4507 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4508 codec->power_filter = led_power_filter;
4509 }
4510 }
4511
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4512 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4513 const struct hda_fixup *fix, int action)
4514 {
4515 struct alc_spec *spec = codec->spec;
4516
4517 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4518 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4519 spec->cap_mute_led_nid = 0x18;
4520 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4521 codec->power_filter = led_power_filter;
4522 }
4523 }
4524
4525 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4526 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4527 */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4528 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4529 const struct hda_fixup *fix, int action)
4530 {
4531 struct alc_spec *spec = codec->spec;
4532
4533 switch (action) {
4534 case HDA_FIXUP_ACT_PRE_PROBE:
4535 spec->gpio_mask |= 0x01;
4536 spec->gpio_dir |= 0x01;
4537 break;
4538 case HDA_FIXUP_ACT_INIT:
4539 /* need to toggle GPIO to enable the amp */
4540 alc_update_gpio_data(codec, 0x01, true);
4541 msleep(100);
4542 alc_update_gpio_data(codec, 0x01, false);
4543 break;
4544 }
4545 }
4546
4547 /* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
alc274_hp_envy_pcm_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)4548 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4549 struct hda_codec *codec,
4550 struct snd_pcm_substream *substream,
4551 int action)
4552 {
4553 switch (action) {
4554 case HDA_GEN_PCM_ACT_PREPARE:
4555 alc_update_gpio_data(codec, 0x04, true);
4556 break;
4557 case HDA_GEN_PCM_ACT_CLEANUP:
4558 alc_update_gpio_data(codec, 0x04, false);
4559 break;
4560 }
4561 }
4562
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4563 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4564 const struct hda_fixup *fix,
4565 int action)
4566 {
4567 struct alc_spec *spec = codec->spec;
4568
4569 if (action == HDA_FIXUP_ACT_PROBE) {
4570 spec->gpio_mask |= 0x04;
4571 spec->gpio_dir |= 0x04;
4572 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4573 }
4574 }
4575
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4576 static void alc_update_coef_led(struct hda_codec *codec,
4577 struct alc_coef_led *led,
4578 bool polarity, bool on)
4579 {
4580 if (polarity)
4581 on = !on;
4582 /* temporarily power up/down for setting COEF bit */
4583 alc_update_coef_idx(codec, led->idx, led->mask,
4584 on ? led->on : led->off);
4585 }
4586
4587 /* update mute-LED according to the speaker mute state via COEF bit */
coef_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4588 static int coef_mute_led_set(struct led_classdev *led_cdev,
4589 enum led_brightness brightness)
4590 {
4591 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4592 struct alc_spec *spec = codec->spec;
4593
4594 alc_update_coef_led(codec, &spec->mute_led_coef,
4595 spec->mute_led_polarity, brightness);
4596 return 0;
4597 }
4598
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4599 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4600 const struct hda_fixup *fix,
4601 int action)
4602 {
4603 struct alc_spec *spec = codec->spec;
4604
4605 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4606 spec->mute_led_polarity = 0;
4607 spec->mute_led_coef.idx = 0x0b;
4608 spec->mute_led_coef.mask = 1 << 3;
4609 spec->mute_led_coef.on = 1 << 3;
4610 spec->mute_led_coef.off = 0;
4611 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4612 }
4613 }
4614
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4615 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4616 const struct hda_fixup *fix,
4617 int action)
4618 {
4619 struct alc_spec *spec = codec->spec;
4620
4621 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4622 spec->mute_led_polarity = 0;
4623 spec->mute_led_coef.idx = 0x34;
4624 spec->mute_led_coef.mask = 1 << 5;
4625 spec->mute_led_coef.on = 0;
4626 spec->mute_led_coef.off = 1 << 5;
4627 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4628 }
4629 }
4630
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4631 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4632 const struct hda_fixup *fix, int action)
4633 {
4634 struct alc_spec *spec = codec->spec;
4635
4636 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4637 spec->mute_led_polarity = 0;
4638 spec->mute_led_coef.idx = 0x07;
4639 spec->mute_led_coef.mask = 1;
4640 spec->mute_led_coef.on = 1;
4641 spec->mute_led_coef.off = 0;
4642 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4643 }
4644 }
4645
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4646 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4647 const struct hda_fixup *fix,
4648 int action)
4649 {
4650 struct alc_spec *spec = codec->spec;
4651
4652 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4653 spec->mute_led_polarity = 0;
4654 spec->mute_led_coef.idx = 0x0b;
4655 spec->mute_led_coef.mask = 3 << 2;
4656 spec->mute_led_coef.on = 2 << 2;
4657 spec->mute_led_coef.off = 1 << 2;
4658 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4659 }
4660 }
4661
4662 /* turn on/off mic-mute LED per capture hook by coef bit */
coef_micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4663 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4664 enum led_brightness brightness)
4665 {
4666 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4667 struct alc_spec *spec = codec->spec;
4668
4669 alc_update_coef_led(codec, &spec->mic_led_coef,
4670 spec->micmute_led_polarity, brightness);
4671 return 0;
4672 }
4673
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4674 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4675 const struct hda_fixup *fix, int action)
4676 {
4677 struct alc_spec *spec = codec->spec;
4678
4679 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4680 spec->mic_led_coef.idx = 0x19;
4681 spec->mic_led_coef.mask = 1 << 13;
4682 spec->mic_led_coef.on = 1 << 13;
4683 spec->mic_led_coef.off = 0;
4684 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4685 }
4686 }
4687
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4688 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4689 const struct hda_fixup *fix, int action)
4690 {
4691 struct alc_spec *spec = codec->spec;
4692
4693 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4694 spec->micmute_led_polarity = 1;
4695 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4696 }
4697
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4698 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4699 const struct hda_fixup *fix, int action)
4700 {
4701 struct alc_spec *spec = codec->spec;
4702
4703 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4704 spec->mic_led_coef.idx = 0x35;
4705 spec->mic_led_coef.mask = 3 << 2;
4706 spec->mic_led_coef.on = 2 << 2;
4707 spec->mic_led_coef.off = 1 << 2;
4708 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4709 }
4710 }
4711
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4712 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4713 const struct hda_fixup *fix, int action)
4714 {
4715 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4716 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4717 }
4718
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4719 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4720 const struct hda_fixup *fix, int action)
4721 {
4722 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4723 alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4724 }
4725
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4726 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4727 const struct hda_fixup *fix, int action)
4728 {
4729 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4730 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4731 }
4732
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4733 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4734 const struct hda_fixup *fix, int action)
4735 {
4736 struct alc_spec *spec = codec->spec;
4737
4738 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4739 spec->cap_mute_led_nid = 0x1a;
4740 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4741 codec->power_filter = led_power_filter;
4742 }
4743 }
4744
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4745 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4746 const struct hda_fixup *fix, int action)
4747 {
4748 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4749 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4750 }
4751
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4752 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4753 const unsigned short coefs[2])
4754 {
4755 alc_write_coef_idx(codec, 0x23, coefs[0]);
4756 alc_write_coef_idx(codec, 0x25, coefs[1]);
4757 alc_write_coef_idx(codec, 0x26, 0xb011);
4758 }
4759
4760 struct alc298_samsung_amp_desc {
4761 unsigned char nid;
4762 unsigned short init_seq[2][2];
4763 };
4764
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4765 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4766 const struct hda_fixup *fix, int action)
4767 {
4768 int i, j;
4769 static const unsigned short init_seq[][2] = {
4770 { 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4771 { 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4772 { 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4773 { 0x41, 0x07 }, { 0x400, 0x1 }
4774 };
4775 static const struct alc298_samsung_amp_desc amps[] = {
4776 { 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4777 { 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4778 };
4779
4780 if (action != HDA_FIXUP_ACT_INIT)
4781 return;
4782
4783 for (i = 0; i < ARRAY_SIZE(amps); i++) {
4784 alc_write_coef_idx(codec, 0x22, amps[i].nid);
4785
4786 for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4787 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4788
4789 for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4790 alc298_samsung_write_coef_pack(codec, init_seq[j]);
4791 }
4792 }
4793
4794 #if IS_REACHABLE(CONFIG_INPUT)
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4795 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4796 struct hda_jack_callback *event)
4797 {
4798 struct alc_spec *spec = codec->spec;
4799
4800 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4801 send both key on and key off event for every interrupt. */
4802 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4803 input_sync(spec->kb_dev);
4804 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4805 input_sync(spec->kb_dev);
4806 }
4807
alc_register_micmute_input_device(struct hda_codec * codec)4808 static int alc_register_micmute_input_device(struct hda_codec *codec)
4809 {
4810 struct alc_spec *spec = codec->spec;
4811 int i;
4812
4813 spec->kb_dev = input_allocate_device();
4814 if (!spec->kb_dev) {
4815 codec_err(codec, "Out of memory (input_allocate_device)\n");
4816 return -ENOMEM;
4817 }
4818
4819 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4820
4821 spec->kb_dev->name = "Microphone Mute Button";
4822 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4823 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4824 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4825 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4826 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4827 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4828
4829 if (input_register_device(spec->kb_dev)) {
4830 codec_err(codec, "input_register_device failed\n");
4831 input_free_device(spec->kb_dev);
4832 spec->kb_dev = NULL;
4833 return -ENOMEM;
4834 }
4835
4836 return 0;
4837 }
4838
4839 /* GPIO1 = set according to SKU external amp
4840 * GPIO2 = mic mute hotkey
4841 * GPIO3 = mute LED
4842 * GPIO4 = mic mute LED
4843 */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4844 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4845 const struct hda_fixup *fix, int action)
4846 {
4847 struct alc_spec *spec = codec->spec;
4848
4849 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4850 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4851 spec->init_amp = ALC_INIT_DEFAULT;
4852 if (alc_register_micmute_input_device(codec) != 0)
4853 return;
4854
4855 spec->gpio_mask |= 0x06;
4856 spec->gpio_dir |= 0x02;
4857 spec->gpio_data |= 0x02;
4858 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4859 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4860 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4861 gpio2_mic_hotkey_event);
4862 return;
4863 }
4864
4865 if (!spec->kb_dev)
4866 return;
4867
4868 switch (action) {
4869 case HDA_FIXUP_ACT_FREE:
4870 input_unregister_device(spec->kb_dev);
4871 spec->kb_dev = NULL;
4872 }
4873 }
4874
4875 /* Line2 = mic mute hotkey
4876 * GPIO2 = mic mute LED
4877 */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4878 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4879 const struct hda_fixup *fix, int action)
4880 {
4881 struct alc_spec *spec = codec->spec;
4882
4883 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4884 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4885 spec->init_amp = ALC_INIT_DEFAULT;
4886 if (alc_register_micmute_input_device(codec) != 0)
4887 return;
4888
4889 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4890 gpio2_mic_hotkey_event);
4891 return;
4892 }
4893
4894 if (!spec->kb_dev)
4895 return;
4896
4897 switch (action) {
4898 case HDA_FIXUP_ACT_FREE:
4899 input_unregister_device(spec->kb_dev);
4900 spec->kb_dev = NULL;
4901 }
4902 }
4903 #else /* INPUT */
4904 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4905 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4906 #endif /* INPUT */
4907
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4908 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4909 const struct hda_fixup *fix, int action)
4910 {
4911 struct alc_spec *spec = codec->spec;
4912
4913 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4914 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4915 spec->cap_mute_led_nid = 0x18;
4916 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4917 }
4918 }
4919
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)4920 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
4921 {
4922 if (delay <= 0)
4923 delay = 75;
4924 snd_hda_codec_write(codec, 0x21, 0,
4925 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4926 msleep(delay);
4927 snd_hda_codec_write(codec, 0x21, 0,
4928 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4929 msleep(delay);
4930 }
4931
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)4932 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
4933 {
4934 if (delay <= 0)
4935 delay = 75;
4936 snd_hda_codec_write(codec, 0x21, 0,
4937 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4938 msleep(delay);
4939 snd_hda_codec_write(codec, 0x21, 0,
4940 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4941 msleep(delay);
4942 }
4943
4944 static const struct coef_fw alc225_pre_hsmode[] = {
4945 UPDATE_COEF(0x4a, 1<<8, 0),
4946 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4947 UPDATE_COEF(0x63, 3<<14, 3<<14),
4948 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4949 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4950 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4951 UPDATE_COEF(0x4a, 3<<10, 0),
4952 {}
4953 };
4954
alc_headset_mode_unplugged(struct hda_codec * codec)4955 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4956 {
4957 struct alc_spec *spec = codec->spec;
4958 static const struct coef_fw coef0255[] = {
4959 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4960 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4961 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4962 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4963 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4964 {}
4965 };
4966 static const struct coef_fw coef0256[] = {
4967 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4968 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4969 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4970 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4971 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4972 {}
4973 };
4974 static const struct coef_fw coef0233[] = {
4975 WRITE_COEF(0x1b, 0x0c0b),
4976 WRITE_COEF(0x45, 0xc429),
4977 UPDATE_COEF(0x35, 0x4000, 0),
4978 WRITE_COEF(0x06, 0x2104),
4979 WRITE_COEF(0x1a, 0x0001),
4980 WRITE_COEF(0x26, 0x0004),
4981 WRITE_COEF(0x32, 0x42a3),
4982 {}
4983 };
4984 static const struct coef_fw coef0288[] = {
4985 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4986 UPDATE_COEF(0x50, 0x2000, 0x2000),
4987 UPDATE_COEF(0x56, 0x0006, 0x0006),
4988 UPDATE_COEF(0x66, 0x0008, 0),
4989 UPDATE_COEF(0x67, 0x2000, 0),
4990 {}
4991 };
4992 static const struct coef_fw coef0298[] = {
4993 UPDATE_COEF(0x19, 0x1300, 0x0300),
4994 {}
4995 };
4996 static const struct coef_fw coef0292[] = {
4997 WRITE_COEF(0x76, 0x000e),
4998 WRITE_COEF(0x6c, 0x2400),
4999 WRITE_COEF(0x18, 0x7308),
5000 WRITE_COEF(0x6b, 0xc429),
5001 {}
5002 };
5003 static const struct coef_fw coef0293[] = {
5004 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5005 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5006 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5007 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5008 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5009 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5010 {}
5011 };
5012 static const struct coef_fw coef0668[] = {
5013 WRITE_COEF(0x15, 0x0d40),
5014 WRITE_COEF(0xb7, 0x802b),
5015 {}
5016 };
5017 static const struct coef_fw coef0225[] = {
5018 UPDATE_COEF(0x63, 3<<14, 0),
5019 {}
5020 };
5021 static const struct coef_fw coef0274[] = {
5022 UPDATE_COEF(0x4a, 0x0100, 0),
5023 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5024 UPDATE_COEF(0x6b, 0xf000, 0x5000),
5025 UPDATE_COEF(0x4a, 0x0010, 0),
5026 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5027 WRITE_COEF(0x45, 0x5289),
5028 UPDATE_COEF(0x4a, 0x0c00, 0),
5029 {}
5030 };
5031
5032 if (spec->no_internal_mic_pin) {
5033 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5034 return;
5035 }
5036
5037 switch (codec->core.vendor_id) {
5038 case 0x10ec0255:
5039 alc_process_coef_fw(codec, coef0255);
5040 break;
5041 case 0x10ec0230:
5042 case 0x10ec0236:
5043 case 0x10ec0256:
5044 case 0x19e58326:
5045 alc_hp_mute_disable(codec, 75);
5046 alc_process_coef_fw(codec, coef0256);
5047 break;
5048 case 0x10ec0234:
5049 case 0x10ec0274:
5050 case 0x10ec0294:
5051 alc_process_coef_fw(codec, coef0274);
5052 break;
5053 case 0x10ec0233:
5054 case 0x10ec0283:
5055 alc_process_coef_fw(codec, coef0233);
5056 break;
5057 case 0x10ec0286:
5058 case 0x10ec0288:
5059 alc_process_coef_fw(codec, coef0288);
5060 break;
5061 case 0x10ec0298:
5062 alc_process_coef_fw(codec, coef0298);
5063 alc_process_coef_fw(codec, coef0288);
5064 break;
5065 case 0x10ec0292:
5066 alc_process_coef_fw(codec, coef0292);
5067 break;
5068 case 0x10ec0293:
5069 alc_process_coef_fw(codec, coef0293);
5070 break;
5071 case 0x10ec0668:
5072 alc_process_coef_fw(codec, coef0668);
5073 break;
5074 case 0x10ec0215:
5075 case 0x10ec0225:
5076 case 0x10ec0285:
5077 case 0x10ec0295:
5078 case 0x10ec0289:
5079 case 0x10ec0299:
5080 alc_hp_mute_disable(codec, 75);
5081 alc_process_coef_fw(codec, alc225_pre_hsmode);
5082 alc_process_coef_fw(codec, coef0225);
5083 break;
5084 case 0x10ec0867:
5085 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5086 break;
5087 }
5088 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5089 }
5090
5091
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5092 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5093 hda_nid_t mic_pin)
5094 {
5095 static const struct coef_fw coef0255[] = {
5096 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5097 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5098 {}
5099 };
5100 static const struct coef_fw coef0256[] = {
5101 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5102 WRITE_COEFEX(0x57, 0x03, 0x09a3),
5103 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5104 {}
5105 };
5106 static const struct coef_fw coef0233[] = {
5107 UPDATE_COEF(0x35, 0, 1<<14),
5108 WRITE_COEF(0x06, 0x2100),
5109 WRITE_COEF(0x1a, 0x0021),
5110 WRITE_COEF(0x26, 0x008c),
5111 {}
5112 };
5113 static const struct coef_fw coef0288[] = {
5114 UPDATE_COEF(0x4f, 0x00c0, 0),
5115 UPDATE_COEF(0x50, 0x2000, 0),
5116 UPDATE_COEF(0x56, 0x0006, 0),
5117 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5118 UPDATE_COEF(0x66, 0x0008, 0x0008),
5119 UPDATE_COEF(0x67, 0x2000, 0x2000),
5120 {}
5121 };
5122 static const struct coef_fw coef0292[] = {
5123 WRITE_COEF(0x19, 0xa208),
5124 WRITE_COEF(0x2e, 0xacf0),
5125 {}
5126 };
5127 static const struct coef_fw coef0293[] = {
5128 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5129 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5130 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5131 {}
5132 };
5133 static const struct coef_fw coef0688[] = {
5134 WRITE_COEF(0xb7, 0x802b),
5135 WRITE_COEF(0xb5, 0x1040),
5136 UPDATE_COEF(0xc3, 0, 1<<12),
5137 {}
5138 };
5139 static const struct coef_fw coef0225[] = {
5140 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5141 UPDATE_COEF(0x4a, 3<<4, 2<<4),
5142 UPDATE_COEF(0x63, 3<<14, 0),
5143 {}
5144 };
5145 static const struct coef_fw coef0274[] = {
5146 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5147 UPDATE_COEF(0x4a, 0x0010, 0),
5148 UPDATE_COEF(0x6b, 0xf000, 0),
5149 {}
5150 };
5151
5152 switch (codec->core.vendor_id) {
5153 case 0x10ec0255:
5154 alc_write_coef_idx(codec, 0x45, 0xc489);
5155 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5156 alc_process_coef_fw(codec, coef0255);
5157 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5158 break;
5159 case 0x10ec0230:
5160 case 0x10ec0236:
5161 case 0x10ec0256:
5162 case 0x19e58326:
5163 alc_write_coef_idx(codec, 0x45, 0xc489);
5164 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5165 alc_process_coef_fw(codec, coef0256);
5166 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5167 break;
5168 case 0x10ec0234:
5169 case 0x10ec0274:
5170 case 0x10ec0294:
5171 alc_write_coef_idx(codec, 0x45, 0x4689);
5172 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5173 alc_process_coef_fw(codec, coef0274);
5174 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5175 break;
5176 case 0x10ec0233:
5177 case 0x10ec0283:
5178 alc_write_coef_idx(codec, 0x45, 0xc429);
5179 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5180 alc_process_coef_fw(codec, coef0233);
5181 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5182 break;
5183 case 0x10ec0286:
5184 case 0x10ec0288:
5185 case 0x10ec0298:
5186 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5187 alc_process_coef_fw(codec, coef0288);
5188 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5189 break;
5190 case 0x10ec0292:
5191 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5192 alc_process_coef_fw(codec, coef0292);
5193 break;
5194 case 0x10ec0293:
5195 /* Set to TRS mode */
5196 alc_write_coef_idx(codec, 0x45, 0xc429);
5197 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5198 alc_process_coef_fw(codec, coef0293);
5199 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5200 break;
5201 case 0x10ec0867:
5202 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5203 fallthrough;
5204 case 0x10ec0221:
5205 case 0x10ec0662:
5206 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5207 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5208 break;
5209 case 0x10ec0668:
5210 alc_write_coef_idx(codec, 0x11, 0x0001);
5211 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5212 alc_process_coef_fw(codec, coef0688);
5213 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5214 break;
5215 case 0x10ec0215:
5216 case 0x10ec0225:
5217 case 0x10ec0285:
5218 case 0x10ec0295:
5219 case 0x10ec0289:
5220 case 0x10ec0299:
5221 alc_process_coef_fw(codec, alc225_pre_hsmode);
5222 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5223 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5224 alc_process_coef_fw(codec, coef0225);
5225 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5226 break;
5227 }
5228 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5229 }
5230
alc_headset_mode_default(struct hda_codec * codec)5231 static void alc_headset_mode_default(struct hda_codec *codec)
5232 {
5233 static const struct coef_fw coef0225[] = {
5234 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5235 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5236 UPDATE_COEF(0x49, 3<<8, 0<<8),
5237 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5238 UPDATE_COEF(0x63, 3<<14, 0),
5239 UPDATE_COEF(0x67, 0xf000, 0x3000),
5240 {}
5241 };
5242 static const struct coef_fw coef0255[] = {
5243 WRITE_COEF(0x45, 0xc089),
5244 WRITE_COEF(0x45, 0xc489),
5245 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5246 WRITE_COEF(0x49, 0x0049),
5247 {}
5248 };
5249 static const struct coef_fw coef0256[] = {
5250 WRITE_COEF(0x45, 0xc489),
5251 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5252 WRITE_COEF(0x49, 0x0049),
5253 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5254 WRITE_COEF(0x06, 0x6100),
5255 {}
5256 };
5257 static const struct coef_fw coef0233[] = {
5258 WRITE_COEF(0x06, 0x2100),
5259 WRITE_COEF(0x32, 0x4ea3),
5260 {}
5261 };
5262 static const struct coef_fw coef0288[] = {
5263 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5264 UPDATE_COEF(0x50, 0x2000, 0x2000),
5265 UPDATE_COEF(0x56, 0x0006, 0x0006),
5266 UPDATE_COEF(0x66, 0x0008, 0),
5267 UPDATE_COEF(0x67, 0x2000, 0),
5268 {}
5269 };
5270 static const struct coef_fw coef0292[] = {
5271 WRITE_COEF(0x76, 0x000e),
5272 WRITE_COEF(0x6c, 0x2400),
5273 WRITE_COEF(0x6b, 0xc429),
5274 WRITE_COEF(0x18, 0x7308),
5275 {}
5276 };
5277 static const struct coef_fw coef0293[] = {
5278 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5279 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5280 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5281 {}
5282 };
5283 static const struct coef_fw coef0688[] = {
5284 WRITE_COEF(0x11, 0x0041),
5285 WRITE_COEF(0x15, 0x0d40),
5286 WRITE_COEF(0xb7, 0x802b),
5287 {}
5288 };
5289 static const struct coef_fw coef0274[] = {
5290 WRITE_COEF(0x45, 0x4289),
5291 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5292 UPDATE_COEF(0x6b, 0x0f00, 0),
5293 UPDATE_COEF(0x49, 0x0300, 0x0300),
5294 {}
5295 };
5296
5297 switch (codec->core.vendor_id) {
5298 case 0x10ec0215:
5299 case 0x10ec0225:
5300 case 0x10ec0285:
5301 case 0x10ec0295:
5302 case 0x10ec0289:
5303 case 0x10ec0299:
5304 alc_process_coef_fw(codec, alc225_pre_hsmode);
5305 alc_process_coef_fw(codec, coef0225);
5306 alc_hp_enable_unmute(codec, 75);
5307 break;
5308 case 0x10ec0255:
5309 alc_process_coef_fw(codec, coef0255);
5310 break;
5311 case 0x10ec0230:
5312 case 0x10ec0236:
5313 case 0x10ec0256:
5314 case 0x19e58326:
5315 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5316 alc_write_coef_idx(codec, 0x45, 0xc089);
5317 msleep(50);
5318 alc_process_coef_fw(codec, coef0256);
5319 alc_hp_enable_unmute(codec, 75);
5320 break;
5321 case 0x10ec0234:
5322 case 0x10ec0274:
5323 case 0x10ec0294:
5324 alc_process_coef_fw(codec, coef0274);
5325 break;
5326 case 0x10ec0233:
5327 case 0x10ec0283:
5328 alc_process_coef_fw(codec, coef0233);
5329 break;
5330 case 0x10ec0286:
5331 case 0x10ec0288:
5332 case 0x10ec0298:
5333 alc_process_coef_fw(codec, coef0288);
5334 break;
5335 case 0x10ec0292:
5336 alc_process_coef_fw(codec, coef0292);
5337 break;
5338 case 0x10ec0293:
5339 alc_process_coef_fw(codec, coef0293);
5340 break;
5341 case 0x10ec0668:
5342 alc_process_coef_fw(codec, coef0688);
5343 break;
5344 case 0x10ec0867:
5345 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5346 break;
5347 }
5348 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5349 }
5350
5351 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5352 static void alc_headset_mode_ctia(struct hda_codec *codec)
5353 {
5354 int val;
5355
5356 static const struct coef_fw coef0255[] = {
5357 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5358 WRITE_COEF(0x1b, 0x0c2b),
5359 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5360 {}
5361 };
5362 static const struct coef_fw coef0256[] = {
5363 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5364 WRITE_COEF(0x1b, 0x0e6b),
5365 {}
5366 };
5367 static const struct coef_fw coef0233[] = {
5368 WRITE_COEF(0x45, 0xd429),
5369 WRITE_COEF(0x1b, 0x0c2b),
5370 WRITE_COEF(0x32, 0x4ea3),
5371 {}
5372 };
5373 static const struct coef_fw coef0288[] = {
5374 UPDATE_COEF(0x50, 0x2000, 0x2000),
5375 UPDATE_COEF(0x56, 0x0006, 0x0006),
5376 UPDATE_COEF(0x66, 0x0008, 0),
5377 UPDATE_COEF(0x67, 0x2000, 0),
5378 {}
5379 };
5380 static const struct coef_fw coef0292[] = {
5381 WRITE_COEF(0x6b, 0xd429),
5382 WRITE_COEF(0x76, 0x0008),
5383 WRITE_COEF(0x18, 0x7388),
5384 {}
5385 };
5386 static const struct coef_fw coef0293[] = {
5387 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5388 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5389 {}
5390 };
5391 static const struct coef_fw coef0688[] = {
5392 WRITE_COEF(0x11, 0x0001),
5393 WRITE_COEF(0x15, 0x0d60),
5394 WRITE_COEF(0xc3, 0x0000),
5395 {}
5396 };
5397 static const struct coef_fw coef0225_1[] = {
5398 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5399 UPDATE_COEF(0x63, 3<<14, 2<<14),
5400 {}
5401 };
5402 static const struct coef_fw coef0225_2[] = {
5403 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5404 UPDATE_COEF(0x63, 3<<14, 1<<14),
5405 {}
5406 };
5407
5408 switch (codec->core.vendor_id) {
5409 case 0x10ec0255:
5410 alc_process_coef_fw(codec, coef0255);
5411 break;
5412 case 0x10ec0230:
5413 case 0x10ec0236:
5414 case 0x10ec0256:
5415 case 0x19e58326:
5416 alc_process_coef_fw(codec, coef0256);
5417 alc_hp_enable_unmute(codec, 75);
5418 break;
5419 case 0x10ec0234:
5420 case 0x10ec0274:
5421 case 0x10ec0294:
5422 alc_write_coef_idx(codec, 0x45, 0xd689);
5423 break;
5424 case 0x10ec0233:
5425 case 0x10ec0283:
5426 alc_process_coef_fw(codec, coef0233);
5427 break;
5428 case 0x10ec0298:
5429 val = alc_read_coef_idx(codec, 0x50);
5430 if (val & (1 << 12)) {
5431 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5432 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5433 msleep(300);
5434 } else {
5435 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5436 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5437 msleep(300);
5438 }
5439 break;
5440 case 0x10ec0286:
5441 case 0x10ec0288:
5442 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5443 msleep(300);
5444 alc_process_coef_fw(codec, coef0288);
5445 break;
5446 case 0x10ec0292:
5447 alc_process_coef_fw(codec, coef0292);
5448 break;
5449 case 0x10ec0293:
5450 alc_process_coef_fw(codec, coef0293);
5451 break;
5452 case 0x10ec0668:
5453 alc_process_coef_fw(codec, coef0688);
5454 break;
5455 case 0x10ec0215:
5456 case 0x10ec0225:
5457 case 0x10ec0285:
5458 case 0x10ec0295:
5459 case 0x10ec0289:
5460 case 0x10ec0299:
5461 val = alc_read_coef_idx(codec, 0x45);
5462 if (val & (1 << 9))
5463 alc_process_coef_fw(codec, coef0225_2);
5464 else
5465 alc_process_coef_fw(codec, coef0225_1);
5466 alc_hp_enable_unmute(codec, 75);
5467 break;
5468 case 0x10ec0867:
5469 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5470 break;
5471 }
5472 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5473 }
5474
5475 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5476 static void alc_headset_mode_omtp(struct hda_codec *codec)
5477 {
5478 static const struct coef_fw coef0255[] = {
5479 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5480 WRITE_COEF(0x1b, 0x0c2b),
5481 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5482 {}
5483 };
5484 static const struct coef_fw coef0256[] = {
5485 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5486 WRITE_COEF(0x1b, 0x0e6b),
5487 {}
5488 };
5489 static const struct coef_fw coef0233[] = {
5490 WRITE_COEF(0x45, 0xe429),
5491 WRITE_COEF(0x1b, 0x0c2b),
5492 WRITE_COEF(0x32, 0x4ea3),
5493 {}
5494 };
5495 static const struct coef_fw coef0288[] = {
5496 UPDATE_COEF(0x50, 0x2000, 0x2000),
5497 UPDATE_COEF(0x56, 0x0006, 0x0006),
5498 UPDATE_COEF(0x66, 0x0008, 0),
5499 UPDATE_COEF(0x67, 0x2000, 0),
5500 {}
5501 };
5502 static const struct coef_fw coef0292[] = {
5503 WRITE_COEF(0x6b, 0xe429),
5504 WRITE_COEF(0x76, 0x0008),
5505 WRITE_COEF(0x18, 0x7388),
5506 {}
5507 };
5508 static const struct coef_fw coef0293[] = {
5509 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5510 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5511 {}
5512 };
5513 static const struct coef_fw coef0688[] = {
5514 WRITE_COEF(0x11, 0x0001),
5515 WRITE_COEF(0x15, 0x0d50),
5516 WRITE_COEF(0xc3, 0x0000),
5517 {}
5518 };
5519 static const struct coef_fw coef0225[] = {
5520 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5521 UPDATE_COEF(0x63, 3<<14, 2<<14),
5522 {}
5523 };
5524
5525 switch (codec->core.vendor_id) {
5526 case 0x10ec0255:
5527 alc_process_coef_fw(codec, coef0255);
5528 break;
5529 case 0x10ec0230:
5530 case 0x10ec0236:
5531 case 0x10ec0256:
5532 case 0x19e58326:
5533 alc_process_coef_fw(codec, coef0256);
5534 alc_hp_enable_unmute(codec, 75);
5535 break;
5536 case 0x10ec0234:
5537 case 0x10ec0274:
5538 case 0x10ec0294:
5539 alc_write_coef_idx(codec, 0x45, 0xe689);
5540 break;
5541 case 0x10ec0233:
5542 case 0x10ec0283:
5543 alc_process_coef_fw(codec, coef0233);
5544 break;
5545 case 0x10ec0298:
5546 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5547 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5548 msleep(300);
5549 break;
5550 case 0x10ec0286:
5551 case 0x10ec0288:
5552 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5553 msleep(300);
5554 alc_process_coef_fw(codec, coef0288);
5555 break;
5556 case 0x10ec0292:
5557 alc_process_coef_fw(codec, coef0292);
5558 break;
5559 case 0x10ec0293:
5560 alc_process_coef_fw(codec, coef0293);
5561 break;
5562 case 0x10ec0668:
5563 alc_process_coef_fw(codec, coef0688);
5564 break;
5565 case 0x10ec0215:
5566 case 0x10ec0225:
5567 case 0x10ec0285:
5568 case 0x10ec0295:
5569 case 0x10ec0289:
5570 case 0x10ec0299:
5571 alc_process_coef_fw(codec, coef0225);
5572 alc_hp_enable_unmute(codec, 75);
5573 break;
5574 }
5575 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5576 }
5577
alc_determine_headset_type(struct hda_codec * codec)5578 static void alc_determine_headset_type(struct hda_codec *codec)
5579 {
5580 int val;
5581 bool is_ctia = false;
5582 struct alc_spec *spec = codec->spec;
5583 static const struct coef_fw coef0255[] = {
5584 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5585 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5586 conteol) */
5587 {}
5588 };
5589 static const struct coef_fw coef0288[] = {
5590 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5591 {}
5592 };
5593 static const struct coef_fw coef0298[] = {
5594 UPDATE_COEF(0x50, 0x2000, 0x2000),
5595 UPDATE_COEF(0x56, 0x0006, 0x0006),
5596 UPDATE_COEF(0x66, 0x0008, 0),
5597 UPDATE_COEF(0x67, 0x2000, 0),
5598 UPDATE_COEF(0x19, 0x1300, 0x1300),
5599 {}
5600 };
5601 static const struct coef_fw coef0293[] = {
5602 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5603 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5604 {}
5605 };
5606 static const struct coef_fw coef0688[] = {
5607 WRITE_COEF(0x11, 0x0001),
5608 WRITE_COEF(0xb7, 0x802b),
5609 WRITE_COEF(0x15, 0x0d60),
5610 WRITE_COEF(0xc3, 0x0c00),
5611 {}
5612 };
5613 static const struct coef_fw coef0274[] = {
5614 UPDATE_COEF(0x4a, 0x0010, 0),
5615 UPDATE_COEF(0x4a, 0x8000, 0),
5616 WRITE_COEF(0x45, 0xd289),
5617 UPDATE_COEF(0x49, 0x0300, 0x0300),
5618 {}
5619 };
5620
5621 if (spec->no_internal_mic_pin) {
5622 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5623 return;
5624 }
5625
5626 switch (codec->core.vendor_id) {
5627 case 0x10ec0255:
5628 alc_process_coef_fw(codec, coef0255);
5629 msleep(300);
5630 val = alc_read_coef_idx(codec, 0x46);
5631 is_ctia = (val & 0x0070) == 0x0070;
5632 break;
5633 case 0x10ec0230:
5634 case 0x10ec0236:
5635 case 0x10ec0256:
5636 case 0x19e58326:
5637 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5638 alc_write_coef_idx(codec, 0x06, 0x6104);
5639 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5640
5641 alc_process_coef_fw(codec, coef0255);
5642 msleep(300);
5643 val = alc_read_coef_idx(codec, 0x46);
5644 is_ctia = (val & 0x0070) == 0x0070;
5645 if (!is_ctia) {
5646 alc_write_coef_idx(codec, 0x45, 0xe089);
5647 msleep(100);
5648 val = alc_read_coef_idx(codec, 0x46);
5649 if ((val & 0x0070) == 0x0070)
5650 is_ctia = false;
5651 else
5652 is_ctia = true;
5653 }
5654 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5655 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5656 break;
5657 case 0x10ec0234:
5658 case 0x10ec0274:
5659 case 0x10ec0294:
5660 alc_process_coef_fw(codec, coef0274);
5661 msleep(850);
5662 val = alc_read_coef_idx(codec, 0x46);
5663 is_ctia = (val & 0x00f0) == 0x00f0;
5664 break;
5665 case 0x10ec0233:
5666 case 0x10ec0283:
5667 alc_write_coef_idx(codec, 0x45, 0xd029);
5668 msleep(300);
5669 val = alc_read_coef_idx(codec, 0x46);
5670 is_ctia = (val & 0x0070) == 0x0070;
5671 break;
5672 case 0x10ec0298:
5673 snd_hda_codec_write(codec, 0x21, 0,
5674 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5675 msleep(100);
5676 snd_hda_codec_write(codec, 0x21, 0,
5677 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5678 msleep(200);
5679
5680 val = alc_read_coef_idx(codec, 0x50);
5681 if (val & (1 << 12)) {
5682 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5683 alc_process_coef_fw(codec, coef0288);
5684 msleep(350);
5685 val = alc_read_coef_idx(codec, 0x50);
5686 is_ctia = (val & 0x0070) == 0x0070;
5687 } else {
5688 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5689 alc_process_coef_fw(codec, coef0288);
5690 msleep(350);
5691 val = alc_read_coef_idx(codec, 0x50);
5692 is_ctia = (val & 0x0070) == 0x0070;
5693 }
5694 alc_process_coef_fw(codec, coef0298);
5695 snd_hda_codec_write(codec, 0x21, 0,
5696 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5697 msleep(75);
5698 snd_hda_codec_write(codec, 0x21, 0,
5699 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5700 break;
5701 case 0x10ec0286:
5702 case 0x10ec0288:
5703 alc_process_coef_fw(codec, coef0288);
5704 msleep(350);
5705 val = alc_read_coef_idx(codec, 0x50);
5706 is_ctia = (val & 0x0070) == 0x0070;
5707 break;
5708 case 0x10ec0292:
5709 alc_write_coef_idx(codec, 0x6b, 0xd429);
5710 msleep(300);
5711 val = alc_read_coef_idx(codec, 0x6c);
5712 is_ctia = (val & 0x001c) == 0x001c;
5713 break;
5714 case 0x10ec0293:
5715 alc_process_coef_fw(codec, coef0293);
5716 msleep(300);
5717 val = alc_read_coef_idx(codec, 0x46);
5718 is_ctia = (val & 0x0070) == 0x0070;
5719 break;
5720 case 0x10ec0668:
5721 alc_process_coef_fw(codec, coef0688);
5722 msleep(300);
5723 val = alc_read_coef_idx(codec, 0xbe);
5724 is_ctia = (val & 0x1c02) == 0x1c02;
5725 break;
5726 case 0x10ec0215:
5727 case 0x10ec0225:
5728 case 0x10ec0285:
5729 case 0x10ec0295:
5730 case 0x10ec0289:
5731 case 0x10ec0299:
5732 alc_process_coef_fw(codec, alc225_pre_hsmode);
5733 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5734 val = alc_read_coef_idx(codec, 0x45);
5735 if (val & (1 << 9)) {
5736 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5737 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5738 msleep(800);
5739 val = alc_read_coef_idx(codec, 0x46);
5740 is_ctia = (val & 0x00f0) == 0x00f0;
5741 } else {
5742 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5743 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5744 msleep(800);
5745 val = alc_read_coef_idx(codec, 0x46);
5746 is_ctia = (val & 0x00f0) == 0x00f0;
5747 }
5748 if (!is_ctia) {
5749 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5750 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5751 msleep(100);
5752 val = alc_read_coef_idx(codec, 0x46);
5753 if ((val & 0x00f0) == 0x00f0)
5754 is_ctia = false;
5755 else
5756 is_ctia = true;
5757 }
5758 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5759 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5760 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5761 break;
5762 case 0x10ec0867:
5763 is_ctia = true;
5764 break;
5765 }
5766
5767 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5768 is_ctia ? "yes" : "no");
5769 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5770 }
5771
alc_update_headset_mode(struct hda_codec * codec)5772 static void alc_update_headset_mode(struct hda_codec *codec)
5773 {
5774 struct alc_spec *spec = codec->spec;
5775
5776 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5777 hda_nid_t hp_pin = alc_get_hp_pin(spec);
5778
5779 int new_headset_mode;
5780
5781 if (!snd_hda_jack_detect(codec, hp_pin))
5782 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5783 else if (mux_pin == spec->headset_mic_pin)
5784 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5785 else if (mux_pin == spec->headphone_mic_pin)
5786 new_headset_mode = ALC_HEADSET_MODE_MIC;
5787 else
5788 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5789
5790 if (new_headset_mode == spec->current_headset_mode) {
5791 snd_hda_gen_update_outputs(codec);
5792 return;
5793 }
5794
5795 switch (new_headset_mode) {
5796 case ALC_HEADSET_MODE_UNPLUGGED:
5797 alc_headset_mode_unplugged(codec);
5798 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5799 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5800 spec->gen.hp_jack_present = false;
5801 break;
5802 case ALC_HEADSET_MODE_HEADSET:
5803 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5804 alc_determine_headset_type(codec);
5805 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5806 alc_headset_mode_ctia(codec);
5807 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5808 alc_headset_mode_omtp(codec);
5809 spec->gen.hp_jack_present = true;
5810 break;
5811 case ALC_HEADSET_MODE_MIC:
5812 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5813 spec->gen.hp_jack_present = false;
5814 break;
5815 case ALC_HEADSET_MODE_HEADPHONE:
5816 alc_headset_mode_default(codec);
5817 spec->gen.hp_jack_present = true;
5818 break;
5819 }
5820 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5821 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5822 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5823 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5824 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5825 PIN_VREFHIZ);
5826 }
5827 spec->current_headset_mode = new_headset_mode;
5828
5829 snd_hda_gen_update_outputs(codec);
5830 }
5831
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5832 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5833 struct snd_kcontrol *kcontrol,
5834 struct snd_ctl_elem_value *ucontrol)
5835 {
5836 alc_update_headset_mode(codec);
5837 }
5838
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5839 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5840 struct hda_jack_callback *jack)
5841 {
5842 snd_hda_gen_hp_automute(codec, jack);
5843 alc_update_headset_mode(codec);
5844 }
5845
alc_probe_headset_mode(struct hda_codec * codec)5846 static void alc_probe_headset_mode(struct hda_codec *codec)
5847 {
5848 int i;
5849 struct alc_spec *spec = codec->spec;
5850 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5851
5852 /* Find mic pins */
5853 for (i = 0; i < cfg->num_inputs; i++) {
5854 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5855 spec->headset_mic_pin = cfg->inputs[i].pin;
5856 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5857 spec->headphone_mic_pin = cfg->inputs[i].pin;
5858 }
5859
5860 WARN_ON(spec->gen.cap_sync_hook);
5861 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5862 spec->gen.automute_hook = alc_update_headset_mode;
5863 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5864 }
5865
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5866 static void alc_fixup_headset_mode(struct hda_codec *codec,
5867 const struct hda_fixup *fix, int action)
5868 {
5869 struct alc_spec *spec = codec->spec;
5870
5871 switch (action) {
5872 case HDA_FIXUP_ACT_PRE_PROBE:
5873 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5874 break;
5875 case HDA_FIXUP_ACT_PROBE:
5876 alc_probe_headset_mode(codec);
5877 break;
5878 case HDA_FIXUP_ACT_INIT:
5879 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5880 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5881 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5882 }
5883 alc_update_headset_mode(codec);
5884 break;
5885 }
5886 }
5887
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5888 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5889 const struct hda_fixup *fix, int action)
5890 {
5891 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5892 struct alc_spec *spec = codec->spec;
5893 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5894 }
5895 else
5896 alc_fixup_headset_mode(codec, fix, action);
5897 }
5898
alc255_set_default_jack_type(struct hda_codec * codec)5899 static void alc255_set_default_jack_type(struct hda_codec *codec)
5900 {
5901 /* Set to iphone type */
5902 static const struct coef_fw alc255fw[] = {
5903 WRITE_COEF(0x1b, 0x880b),
5904 WRITE_COEF(0x45, 0xd089),
5905 WRITE_COEF(0x1b, 0x080b),
5906 WRITE_COEF(0x46, 0x0004),
5907 WRITE_COEF(0x1b, 0x0c0b),
5908 {}
5909 };
5910 static const struct coef_fw alc256fw[] = {
5911 WRITE_COEF(0x1b, 0x884b),
5912 WRITE_COEF(0x45, 0xd089),
5913 WRITE_COEF(0x1b, 0x084b),
5914 WRITE_COEF(0x46, 0x0004),
5915 WRITE_COEF(0x1b, 0x0c4b),
5916 {}
5917 };
5918 switch (codec->core.vendor_id) {
5919 case 0x10ec0255:
5920 alc_process_coef_fw(codec, alc255fw);
5921 break;
5922 case 0x10ec0230:
5923 case 0x10ec0236:
5924 case 0x10ec0256:
5925 case 0x19e58326:
5926 alc_process_coef_fw(codec, alc256fw);
5927 break;
5928 }
5929 msleep(30);
5930 }
5931
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)5932 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5933 const struct hda_fixup *fix, int action)
5934 {
5935 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5936 alc255_set_default_jack_type(codec);
5937 }
5938 alc_fixup_headset_mode(codec, fix, action);
5939 }
5940
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5941 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5942 const struct hda_fixup *fix, int action)
5943 {
5944 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5945 struct alc_spec *spec = codec->spec;
5946 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5947 alc255_set_default_jack_type(codec);
5948 }
5949 else
5950 alc_fixup_headset_mode(codec, fix, action);
5951 }
5952
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5953 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5954 struct hda_jack_callback *jack)
5955 {
5956 struct alc_spec *spec = codec->spec;
5957
5958 alc_update_headset_jack_cb(codec, jack);
5959 /* Headset Mic enable or disable, only for Dell Dino */
5960 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5961 }
5962
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)5963 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5964 const struct hda_fixup *fix, int action)
5965 {
5966 alc_fixup_headset_mode(codec, fix, action);
5967 if (action == HDA_FIXUP_ACT_PROBE) {
5968 struct alc_spec *spec = codec->spec;
5969 /* toggled via hp_automute_hook */
5970 spec->gpio_mask |= 0x40;
5971 spec->gpio_dir |= 0x40;
5972 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5973 }
5974 }
5975
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)5976 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5977 const struct hda_fixup *fix, int action)
5978 {
5979 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5980 struct alc_spec *spec = codec->spec;
5981 spec->gen.auto_mute_via_amp = 1;
5982 }
5983 }
5984
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)5985 static void alc_fixup_no_shutup(struct hda_codec *codec,
5986 const struct hda_fixup *fix, int action)
5987 {
5988 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5989 struct alc_spec *spec = codec->spec;
5990 spec->no_shutup_pins = 1;
5991 }
5992 }
5993
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)5994 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5995 const struct hda_fixup *fix, int action)
5996 {
5997 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5998 struct alc_spec *spec = codec->spec;
5999 /* Disable AA-loopback as it causes white noise */
6000 spec->gen.mixer_nid = 0;
6001 }
6002 }
6003
6004 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
alc_fixup_tpt440_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6005 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6006 const struct hda_fixup *fix, int action)
6007 {
6008 static const struct hda_pintbl pincfgs[] = {
6009 { 0x16, 0x21211010 }, /* dock headphone */
6010 { 0x19, 0x21a11010 }, /* dock mic */
6011 { }
6012 };
6013 struct alc_spec *spec = codec->spec;
6014
6015 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6016 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6017 codec->power_save_node = 0; /* avoid click noises */
6018 snd_hda_apply_pincfgs(codec, pincfgs);
6019 }
6020 }
6021
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6022 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6023 const struct hda_fixup *fix, int action)
6024 {
6025 static const struct hda_pintbl pincfgs[] = {
6026 { 0x17, 0x21211010 }, /* dock headphone */
6027 { 0x19, 0x21a11010 }, /* dock mic */
6028 { }
6029 };
6030 struct alc_spec *spec = codec->spec;
6031
6032 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6033 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6034 snd_hda_apply_pincfgs(codec, pincfgs);
6035 } else if (action == HDA_FIXUP_ACT_INIT) {
6036 /* Enable DOCK device */
6037 snd_hda_codec_write(codec, 0x17, 0,
6038 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6039 /* Enable DOCK device */
6040 snd_hda_codec_write(codec, 0x19, 0,
6041 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6042 }
6043 }
6044
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6045 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6046 const struct hda_fixup *fix, int action)
6047 {
6048 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6049 * the speaker output becomes too low by some reason on Thinkpads with
6050 * ALC298 codec
6051 */
6052 static const hda_nid_t preferred_pairs[] = {
6053 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6054 0
6055 };
6056 struct alc_spec *spec = codec->spec;
6057
6058 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6059 spec->gen.preferred_dacs = preferred_pairs;
6060 }
6061
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6062 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6063 const struct hda_fixup *fix, int action)
6064 {
6065 static const hda_nid_t preferred_pairs[] = {
6066 0x17, 0x02, 0x21, 0x03, 0
6067 };
6068 struct alc_spec *spec = codec->spec;
6069
6070 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6071 spec->gen.preferred_dacs = preferred_pairs;
6072 }
6073
alc_shutup_dell_xps13(struct hda_codec * codec)6074 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6075 {
6076 struct alc_spec *spec = codec->spec;
6077 int hp_pin = alc_get_hp_pin(spec);
6078
6079 /* Prevent pop noises when headphones are plugged in */
6080 snd_hda_codec_write(codec, hp_pin, 0,
6081 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6082 msleep(20);
6083 }
6084
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6085 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6086 const struct hda_fixup *fix, int action)
6087 {
6088 struct alc_spec *spec = codec->spec;
6089 struct hda_input_mux *imux = &spec->gen.input_mux;
6090 int i;
6091
6092 switch (action) {
6093 case HDA_FIXUP_ACT_PRE_PROBE:
6094 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6095 * it causes a click noise at start up
6096 */
6097 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6098 spec->shutup = alc_shutup_dell_xps13;
6099 break;
6100 case HDA_FIXUP_ACT_PROBE:
6101 /* Make the internal mic the default input source. */
6102 for (i = 0; i < imux->num_items; i++) {
6103 if (spec->gen.imux_pins[i] == 0x12) {
6104 spec->gen.cur_mux[0] = i;
6105 break;
6106 }
6107 }
6108 break;
6109 }
6110 }
6111
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6112 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6113 const struct hda_fixup *fix, int action)
6114 {
6115 struct alc_spec *spec = codec->spec;
6116
6117 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6118 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6119 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6120
6121 /* Disable boost for mic-in permanently. (This code is only called
6122 from quirks that guarantee that the headphone is at NID 0x1b.) */
6123 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6124 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6125 } else
6126 alc_fixup_headset_mode(codec, fix, action);
6127 }
6128
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6129 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6130 const struct hda_fixup *fix, int action)
6131 {
6132 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6133 alc_write_coef_idx(codec, 0xc4, 0x8000);
6134 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6135 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6136 }
6137 alc_fixup_headset_mode(codec, fix, action);
6138 }
6139
6140 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6141 static int find_ext_mic_pin(struct hda_codec *codec)
6142 {
6143 struct alc_spec *spec = codec->spec;
6144 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6145 hda_nid_t nid;
6146 unsigned int defcfg;
6147 int i;
6148
6149 for (i = 0; i < cfg->num_inputs; i++) {
6150 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6151 continue;
6152 nid = cfg->inputs[i].pin;
6153 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6154 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6155 continue;
6156 return nid;
6157 }
6158
6159 return 0;
6160 }
6161
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6162 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6163 const struct hda_fixup *fix,
6164 int action)
6165 {
6166 struct alc_spec *spec = codec->spec;
6167
6168 if (action == HDA_FIXUP_ACT_PROBE) {
6169 int mic_pin = find_ext_mic_pin(codec);
6170 int hp_pin = alc_get_hp_pin(spec);
6171
6172 if (snd_BUG_ON(!mic_pin || !hp_pin))
6173 return;
6174 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6175 }
6176 }
6177
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6178 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6179 const struct hda_fixup *fix,
6180 int action)
6181 {
6182 struct alc_spec *spec = codec->spec;
6183 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6184 int i;
6185
6186 /* The mic boosts on level 2 and 3 are too noisy
6187 on the internal mic input.
6188 Therefore limit the boost to 0 or 1. */
6189
6190 if (action != HDA_FIXUP_ACT_PROBE)
6191 return;
6192
6193 for (i = 0; i < cfg->num_inputs; i++) {
6194 hda_nid_t nid = cfg->inputs[i].pin;
6195 unsigned int defcfg;
6196 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6197 continue;
6198 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6199 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6200 continue;
6201
6202 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6203 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6204 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6205 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6206 (0 << AC_AMPCAP_MUTE_SHIFT));
6207 }
6208 }
6209
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6210 static void alc283_hp_automute_hook(struct hda_codec *codec,
6211 struct hda_jack_callback *jack)
6212 {
6213 struct alc_spec *spec = codec->spec;
6214 int vref;
6215
6216 msleep(200);
6217 snd_hda_gen_hp_automute(codec, jack);
6218
6219 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6220
6221 msleep(600);
6222 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6223 vref);
6224 }
6225
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6226 static void alc283_fixup_chromebook(struct hda_codec *codec,
6227 const struct hda_fixup *fix, int action)
6228 {
6229 struct alc_spec *spec = codec->spec;
6230
6231 switch (action) {
6232 case HDA_FIXUP_ACT_PRE_PROBE:
6233 snd_hda_override_wcaps(codec, 0x03, 0);
6234 /* Disable AA-loopback as it causes white noise */
6235 spec->gen.mixer_nid = 0;
6236 break;
6237 case HDA_FIXUP_ACT_INIT:
6238 /* MIC2-VREF control */
6239 /* Set to manual mode */
6240 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6241 /* Enable Line1 input control by verb */
6242 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6243 break;
6244 }
6245 }
6246
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6247 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6248 const struct hda_fixup *fix, int action)
6249 {
6250 struct alc_spec *spec = codec->spec;
6251
6252 switch (action) {
6253 case HDA_FIXUP_ACT_PRE_PROBE:
6254 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6255 break;
6256 case HDA_FIXUP_ACT_INIT:
6257 /* MIC2-VREF control */
6258 /* Set to manual mode */
6259 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6260 break;
6261 }
6262 }
6263
6264 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6265 static void asus_tx300_automute(struct hda_codec *codec)
6266 {
6267 struct alc_spec *spec = codec->spec;
6268 snd_hda_gen_update_outputs(codec);
6269 if (snd_hda_jack_detect(codec, 0x1b))
6270 spec->gen.mute_bits |= (1ULL << 0x14);
6271 }
6272
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6273 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6274 const struct hda_fixup *fix, int action)
6275 {
6276 struct alc_spec *spec = codec->spec;
6277 static const struct hda_pintbl dock_pins[] = {
6278 { 0x1b, 0x21114000 }, /* dock speaker pin */
6279 {}
6280 };
6281
6282 switch (action) {
6283 case HDA_FIXUP_ACT_PRE_PROBE:
6284 spec->init_amp = ALC_INIT_DEFAULT;
6285 /* TX300 needs to set up GPIO2 for the speaker amp */
6286 alc_setup_gpio(codec, 0x04);
6287 snd_hda_apply_pincfgs(codec, dock_pins);
6288 spec->gen.auto_mute_via_amp = 1;
6289 spec->gen.automute_hook = asus_tx300_automute;
6290 snd_hda_jack_detect_enable_callback(codec, 0x1b,
6291 snd_hda_gen_hp_automute);
6292 break;
6293 case HDA_FIXUP_ACT_PROBE:
6294 spec->init_amp = ALC_INIT_DEFAULT;
6295 break;
6296 case HDA_FIXUP_ACT_BUILD:
6297 /* this is a bit tricky; give more sane names for the main
6298 * (tablet) speaker and the dock speaker, respectively
6299 */
6300 rename_ctl(codec, "Speaker Playback Switch",
6301 "Dock Speaker Playback Switch");
6302 rename_ctl(codec, "Bass Speaker Playback Switch",
6303 "Speaker Playback Switch");
6304 break;
6305 }
6306 }
6307
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6308 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6309 const struct hda_fixup *fix, int action)
6310 {
6311 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6312 /* DAC node 0x03 is giving mono output. We therefore want to
6313 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6314 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6315 static const hda_nid_t conn1[] = { 0x0c };
6316 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6317 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6318 }
6319 }
6320
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6321 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6322 const struct hda_fixup *fix, int action)
6323 {
6324 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6325 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6326 we can't adjust the speaker's volume since this node does not has
6327 Amp-out capability. we change the speaker's route to:
6328 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6329 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6330 speaker's volume now. */
6331
6332 static const hda_nid_t conn1[] = { 0x0c };
6333 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6334 }
6335 }
6336
6337 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
alc295_fixup_disable_dac3(struct hda_codec * codec,const struct hda_fixup * fix,int action)6338 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6339 const struct hda_fixup *fix, int action)
6340 {
6341 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6342 static const hda_nid_t conn[] = { 0x02, 0x03 };
6343 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6344 }
6345 }
6346
6347 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
alc285_fixup_speaker2_to_dac1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6348 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6349 const struct hda_fixup *fix, int action)
6350 {
6351 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6352 static const hda_nid_t conn[] = { 0x02 };
6353 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6354 }
6355 }
6356
6357 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6358 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6359 struct hda_jack_callback *jack)
6360 {
6361 struct alc_spec *spec = codec->spec;
6362
6363 snd_hda_gen_hp_automute(codec, jack);
6364 /* mute_led_polarity is set to 0, so we pass inverted value here */
6365 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6366 !spec->gen.hp_jack_present);
6367 }
6368
6369 /* Manage GPIOs for HP EliteBook Folio 9480m.
6370 *
6371 * GPIO4 is the headphone amplifier power control
6372 * GPIO3 is the audio output mute indicator LED
6373 */
6374
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6375 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6376 const struct hda_fixup *fix,
6377 int action)
6378 {
6379 struct alc_spec *spec = codec->spec;
6380
6381 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6382 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6383 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6384 spec->gpio_mask |= 0x10;
6385 spec->gpio_dir |= 0x10;
6386 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6387 }
6388 }
6389
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6390 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6391 const struct hda_fixup *fix,
6392 int action)
6393 {
6394 struct alc_spec *spec = codec->spec;
6395
6396 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6397 spec->gpio_mask |= 0x04;
6398 spec->gpio_dir |= 0x04;
6399 /* set data bit low */
6400 }
6401 }
6402
6403 /* Quirk for Thinkpad X1 7th and 8th Gen
6404 * The following fixed routing needed
6405 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6406 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6407 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6408 */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6409 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6410 const struct hda_fixup *fix, int action)
6411 {
6412 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6413 static const hda_nid_t preferred_pairs[] = {
6414 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6415 };
6416 struct alc_spec *spec = codec->spec;
6417
6418 switch (action) {
6419 case HDA_FIXUP_ACT_PRE_PROBE:
6420 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6421 spec->gen.preferred_dacs = preferred_pairs;
6422 break;
6423 case HDA_FIXUP_ACT_BUILD:
6424 /* The generic parser creates somewhat unintuitive volume ctls
6425 * with the fixed routing above, and the shared DAC2 may be
6426 * confusing for PA.
6427 * Rename those to unique names so that PA doesn't touch them
6428 * and use only Master volume.
6429 */
6430 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6431 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6432 break;
6433 }
6434 }
6435
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6436 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6437 const struct hda_fixup *fix,
6438 int action)
6439 {
6440 alc_fixup_dual_codecs(codec, fix, action);
6441 switch (action) {
6442 case HDA_FIXUP_ACT_PRE_PROBE:
6443 /* override card longname to provide a unique UCM profile */
6444 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6445 break;
6446 case HDA_FIXUP_ACT_BUILD:
6447 /* rename Capture controls depending on the codec */
6448 rename_ctl(codec, "Capture Volume",
6449 codec->addr == 0 ?
6450 "Rear-Panel Capture Volume" :
6451 "Front-Panel Capture Volume");
6452 rename_ctl(codec, "Capture Switch",
6453 codec->addr == 0 ?
6454 "Rear-Panel Capture Switch" :
6455 "Front-Panel Capture Switch");
6456 break;
6457 }
6458 }
6459
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6460 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6461 const struct hda_fixup *fix, int action)
6462 {
6463 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6464 return;
6465
6466 codec->power_save_node = 1;
6467 }
6468
6469 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
alc274_fixup_bind_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6470 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6471 const struct hda_fixup *fix, int action)
6472 {
6473 struct alc_spec *spec = codec->spec;
6474 static const hda_nid_t preferred_pairs[] = {
6475 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6476 0
6477 };
6478
6479 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6480 return;
6481
6482 spec->gen.preferred_dacs = preferred_pairs;
6483 spec->gen.auto_mute_via_amp = 1;
6484 codec->power_save_node = 0;
6485 }
6486
6487 /* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
alc289_fixup_asus_ga401(struct hda_codec * codec,const struct hda_fixup * fix,int action)6488 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6489 const struct hda_fixup *fix, int action)
6490 {
6491 static const hda_nid_t preferred_pairs[] = {
6492 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6493 };
6494 struct alc_spec *spec = codec->spec;
6495
6496 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6497 spec->gen.preferred_dacs = preferred_pairs;
6498 spec->gen.obey_preferred_dacs = 1;
6499 }
6500 }
6501
6502 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
alc285_fixup_invalidate_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6503 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6504 const struct hda_fixup *fix, int action)
6505 {
6506 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6507 return;
6508
6509 snd_hda_override_wcaps(codec, 0x03, 0);
6510 }
6511
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6512 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6513 {
6514 switch (codec->core.vendor_id) {
6515 case 0x10ec0274:
6516 case 0x10ec0294:
6517 case 0x10ec0225:
6518 case 0x10ec0295:
6519 case 0x10ec0299:
6520 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6521 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6522 break;
6523 case 0x10ec0230:
6524 case 0x10ec0235:
6525 case 0x10ec0236:
6526 case 0x10ec0255:
6527 case 0x10ec0256:
6528 case 0x10ec0257:
6529 case 0x19e58326:
6530 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6531 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6532 break;
6533 }
6534 }
6535
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6536 static void alc295_fixup_chromebook(struct hda_codec *codec,
6537 const struct hda_fixup *fix, int action)
6538 {
6539 struct alc_spec *spec = codec->spec;
6540
6541 switch (action) {
6542 case HDA_FIXUP_ACT_PRE_PROBE:
6543 spec->ultra_low_power = true;
6544 break;
6545 case HDA_FIXUP_ACT_INIT:
6546 alc_combo_jack_hp_jd_restart(codec);
6547 break;
6548 }
6549 }
6550
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6551 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6552 const struct hda_fixup *fix, int action)
6553 {
6554 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6555 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6556 }
6557
6558
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6559 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6560 struct hda_jack_callback *cb)
6561 {
6562 /* The Windows driver sets the codec up in a very different way where
6563 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6564 */
6565 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6566 alc_write_coef_idx(codec, 0x10, 0x8a20);
6567 else
6568 alc_write_coef_idx(codec, 0x10, 0x0a20);
6569 }
6570
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6571 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6572 const struct hda_fixup *fix, int action)
6573 {
6574 /* Pin 0x21: headphones/headset mic */
6575 if (!is_jack_detectable(codec, 0x21))
6576 return;
6577
6578 switch (action) {
6579 case HDA_FIXUP_ACT_PRE_PROBE:
6580 snd_hda_jack_detect_enable_callback(codec, 0x21,
6581 alc294_gx502_toggle_output);
6582 break;
6583 case HDA_FIXUP_ACT_INIT:
6584 /* Make sure to start in a correct state, i.e. if
6585 * headphones have been plugged in before powering up the system
6586 */
6587 alc294_gx502_toggle_output(codec, NULL);
6588 break;
6589 }
6590 }
6591
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6592 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6593 struct hda_jack_callback *cb)
6594 {
6595 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6596 * responsible from changes between speakers and headphones
6597 */
6598 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6599 alc_write_coef_idx(codec, 0x10, 0x8420);
6600 else
6601 alc_write_coef_idx(codec, 0x10, 0x0a20);
6602 }
6603
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6604 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6605 const struct hda_fixup *fix, int action)
6606 {
6607 if (!is_jack_detectable(codec, 0x21))
6608 return;
6609
6610 switch (action) {
6611 case HDA_FIXUP_ACT_PRE_PROBE:
6612 snd_hda_jack_detect_enable_callback(codec, 0x21,
6613 alc294_gu502_toggle_output);
6614 break;
6615 case HDA_FIXUP_ACT_INIT:
6616 alc294_gu502_toggle_output(codec, NULL);
6617 break;
6618 }
6619 }
6620
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6621 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6622 const struct hda_fixup *fix, int action)
6623 {
6624 if (action != HDA_FIXUP_ACT_INIT)
6625 return;
6626
6627 msleep(100);
6628 alc_write_coef_idx(codec, 0x65, 0x0);
6629 }
6630
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6631 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6632 const struct hda_fixup *fix, int action)
6633 {
6634 switch (action) {
6635 case HDA_FIXUP_ACT_INIT:
6636 alc_combo_jack_hp_jd_restart(codec);
6637 break;
6638 }
6639 }
6640
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6641 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6642 const struct hda_fixup *fix, int action)
6643 {
6644 struct alc_spec *spec = codec->spec;
6645
6646 switch (action) {
6647 case HDA_FIXUP_ACT_PRE_PROBE:
6648 /* Mic RING SLEEVE swap for combo jack */
6649 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6650 spec->no_internal_mic_pin = true;
6651 break;
6652 case HDA_FIXUP_ACT_INIT:
6653 alc_combo_jack_hp_jd_restart(codec);
6654 break;
6655 }
6656 }
6657
6658 /* GPIO1 = amplifier on/off
6659 * GPIO3 = mic mute LED
6660 */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6661 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6662 const struct hda_fixup *fix, int action)
6663 {
6664 static const hda_nid_t conn[] = { 0x02 };
6665
6666 struct alc_spec *spec = codec->spec;
6667 static const struct hda_pintbl pincfgs[] = {
6668 { 0x14, 0x90170110 }, /* front/high speakers */
6669 { 0x17, 0x90170130 }, /* back/bass speakers */
6670 { }
6671 };
6672
6673 //enable micmute led
6674 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6675
6676 switch (action) {
6677 case HDA_FIXUP_ACT_PRE_PROBE:
6678 spec->micmute_led_polarity = 1;
6679 /* needed for amp of back speakers */
6680 spec->gpio_mask |= 0x01;
6681 spec->gpio_dir |= 0x01;
6682 snd_hda_apply_pincfgs(codec, pincfgs);
6683 /* share DAC to have unified volume control */
6684 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6685 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6686 break;
6687 case HDA_FIXUP_ACT_INIT:
6688 /* need to toggle GPIO to enable the amp of back speakers */
6689 alc_update_gpio_data(codec, 0x01, true);
6690 msleep(100);
6691 alc_update_gpio_data(codec, 0x01, false);
6692 break;
6693 }
6694 }
6695
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6696 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6697 const struct hda_fixup *fix, int action)
6698 {
6699 static const hda_nid_t conn[] = { 0x02 };
6700 static const struct hda_pintbl pincfgs[] = {
6701 { 0x14, 0x90170110 }, /* rear speaker */
6702 { }
6703 };
6704
6705 switch (action) {
6706 case HDA_FIXUP_ACT_PRE_PROBE:
6707 snd_hda_apply_pincfgs(codec, pincfgs);
6708 /* force front speaker to DAC1 */
6709 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6710 break;
6711 }
6712 }
6713
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6714 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6715 const struct hda_fixup *fix,
6716 int action)
6717 {
6718 static const struct coef_fw coefs[] = {
6719 WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6720 WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6721 WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6722 WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6723 WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6724 WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6725 WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6726 WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6727 WRITE_COEF(0x6e, 0x1005), { }
6728 };
6729
6730 static const struct hda_pintbl pincfgs[] = {
6731 { 0x12, 0xb7a60130 }, /* Internal microphone*/
6732 { 0x14, 0x90170150 }, /* B&O soundbar speakers */
6733 { 0x17, 0x90170153 }, /* Side speakers */
6734 { 0x19, 0x03a11040 }, /* Headset microphone */
6735 { }
6736 };
6737
6738 switch (action) {
6739 case HDA_FIXUP_ACT_PRE_PROBE:
6740 snd_hda_apply_pincfgs(codec, pincfgs);
6741
6742 /* Fixes volume control problem for side speakers */
6743 alc295_fixup_disable_dac3(codec, fix, action);
6744
6745 /* Fixes no sound from headset speaker */
6746 snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6747
6748 /* Auto-enable headset mic when plugged */
6749 snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6750
6751 /* Headset mic volume enhancement */
6752 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6753 break;
6754 case HDA_FIXUP_ACT_INIT:
6755 alc_process_coef_fw(codec, coefs);
6756 break;
6757 case HDA_FIXUP_ACT_BUILD:
6758 rename_ctl(codec, "Bass Speaker Playback Volume",
6759 "B&O-Tuned Playback Volume");
6760 rename_ctl(codec, "Front Playback Switch",
6761 "B&O Soundbar Playback Switch");
6762 rename_ctl(codec, "Bass Speaker Playback Switch",
6763 "Side Speaker Playback Switch");
6764 break;
6765 }
6766 }
6767
6768 /* for hda_fixup_thinkpad_acpi() */
6769 #include "thinkpad_helper.c"
6770
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6771 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6772 const struct hda_fixup *fix, int action)
6773 {
6774 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6775 hda_fixup_thinkpad_acpi(codec, fix, action);
6776 }
6777
6778 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
alc287_fixup_legion_15imhg05_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6779 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6780 const struct hda_fixup *fix,
6781 int action)
6782 {
6783 struct alc_spec *spec = codec->spec;
6784
6785 switch (action) {
6786 case HDA_FIXUP_ACT_PRE_PROBE:
6787 spec->gen.suppress_auto_mute = 1;
6788 break;
6789 }
6790 }
6791
comp_bind(struct device * dev)6792 static int comp_bind(struct device *dev)
6793 {
6794 struct hda_codec *cdc = dev_to_hda_codec(dev);
6795 struct alc_spec *spec = cdc->spec;
6796
6797 return component_bind_all(dev, spec->comps);
6798 }
6799
comp_unbind(struct device * dev)6800 static void comp_unbind(struct device *dev)
6801 {
6802 struct hda_codec *cdc = dev_to_hda_codec(dev);
6803 struct alc_spec *spec = cdc->spec;
6804
6805 component_unbind_all(dev, spec->comps);
6806 }
6807
6808 static const struct component_master_ops comp_master_ops = {
6809 .bind = comp_bind,
6810 .unbind = comp_unbind,
6811 };
6812
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)6813 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6814 struct snd_pcm_substream *sub, int action)
6815 {
6816 struct alc_spec *spec = cdc->spec;
6817 int i;
6818
6819 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6820 if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
6821 spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
6822 }
6823 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6824 if (spec->comps[i].dev && spec->comps[i].playback_hook)
6825 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6826 }
6827 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6828 if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
6829 spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
6830 }
6831 }
6832
6833 struct scodec_dev_name {
6834 const char *bus;
6835 const char *hid;
6836 int index;
6837 };
6838
6839 /* match the device name in a slightly relaxed manner */
comp_match_cs35l41_dev_name(struct device * dev,void * data)6840 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6841 {
6842 struct scodec_dev_name *p = data;
6843 const char *d = dev_name(dev);
6844 int n = strlen(p->bus);
6845 char tmp[32];
6846
6847 /* check the bus name */
6848 if (strncmp(d, p->bus, n))
6849 return 0;
6850 /* skip the bus number */
6851 if (isdigit(d[n]))
6852 n++;
6853 /* the rest must be exact matching */
6854 snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6855 return !strcmp(d + n, tmp);
6856 }
6857
comp_match_tas2781_dev_name(struct device * dev,void * data)6858 static int comp_match_tas2781_dev_name(struct device *dev,
6859 void *data)
6860 {
6861 struct scodec_dev_name *p = data;
6862 const char *d = dev_name(dev);
6863 int n = strlen(p->bus);
6864 char tmp[32];
6865
6866 /* check the bus name */
6867 if (strncmp(d, p->bus, n))
6868 return 0;
6869 /* skip the bus number */
6870 if (isdigit(d[n]))
6871 n++;
6872 /* the rest must be exact matching */
6873 snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
6874
6875 return !strcmp(d + n, tmp);
6876 }
6877
cs35l41_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,int count)6878 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6879 const char *hid, int count)
6880 {
6881 struct device *dev = hda_codec_dev(cdc);
6882 struct alc_spec *spec = cdc->spec;
6883 struct scodec_dev_name *rec;
6884 int ret, i;
6885
6886 switch (action) {
6887 case HDA_FIXUP_ACT_PRE_PROBE:
6888 for (i = 0; i < count; i++) {
6889 rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6890 if (!rec)
6891 return;
6892 rec->bus = bus;
6893 rec->hid = hid;
6894 rec->index = i;
6895 spec->comps[i].codec = cdc;
6896 component_match_add(dev, &spec->match,
6897 comp_match_cs35l41_dev_name, rec);
6898 }
6899 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6900 if (ret)
6901 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6902 else
6903 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6904 break;
6905 case HDA_FIXUP_ACT_FREE:
6906 component_master_del(dev, &comp_master_ops);
6907 break;
6908 }
6909 }
6910
tas2781_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid)6911 static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
6912 const char *bus, const char *hid)
6913 {
6914 struct device *dev = hda_codec_dev(cdc);
6915 struct alc_spec *spec = cdc->spec;
6916 struct scodec_dev_name *rec;
6917 int ret;
6918
6919 switch (action) {
6920 case HDA_FIXUP_ACT_PRE_PROBE:
6921 rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6922 if (!rec)
6923 return;
6924 rec->bus = bus;
6925 rec->hid = hid;
6926 rec->index = 0;
6927 spec->comps[0].codec = cdc;
6928 component_match_add(dev, &spec->match,
6929 comp_match_tas2781_dev_name, rec);
6930 ret = component_master_add_with_match(dev, &comp_master_ops,
6931 spec->match);
6932 if (ret)
6933 codec_err(cdc,
6934 "Fail to register component aggregator %d\n",
6935 ret);
6936 else
6937 spec->gen.pcm_playback_hook =
6938 comp_generic_playback_hook;
6939 break;
6940 case HDA_FIXUP_ACT_FREE:
6941 component_master_del(dev, &comp_master_ops);
6942 break;
6943 }
6944 }
6945
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6946 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6947 {
6948 cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6949 }
6950
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)6951 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6952 {
6953 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
6954 }
6955
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)6956 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6957 {
6958 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
6959 }
6960
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6961 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6962 int action)
6963 {
6964 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
6965 }
6966
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6967 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6968 int action)
6969 {
6970 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6971 }
6972
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6973 static void tas2781_fixup_i2c(struct hda_codec *cdc,
6974 const struct hda_fixup *fix, int action)
6975 {
6976 tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
6977 }
6978
6979 /* for alc295_fixup_hp_top_speakers */
6980 #include "hp_x360_helper.c"
6981
6982 /* for alc285_fixup_ideapad_s740_coef() */
6983 #include "ideapad_s740_helper.c"
6984
6985 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6986 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6987 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6988 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6989 {}
6990 };
6991
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)6992 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6993 const struct hda_fixup *fix,
6994 int action)
6995 {
6996 /*
6997 * A certain other OS sets these coeffs to different values. On at least
6998 * one TongFang barebone these settings might survive even a cold
6999 * reboot. So to restore a clean slate the values are explicitly reset
7000 * to default here. Without this, the external microphone is always in a
7001 * plugged-in state, while the internal microphone is always in an
7002 * unplugged state, breaking the ability to use the internal microphone.
7003 */
7004 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7005 }
7006
7007 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7008 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7009 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7010 WRITE_COEF(0x49, 0x0149),
7011 {}
7012 };
7013
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7014 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7015 const struct hda_fixup *fix,
7016 int action)
7017 {
7018 /*
7019 * The audio jack input and output is not detected on the ASRock NUC Box
7020 * 1100 series when cold booting without this fix. Warm rebooting from a
7021 * certain other OS makes the audio functional, as COEF settings are
7022 * preserved in this case. This fix sets these altered COEF values as
7023 * the default.
7024 */
7025 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7026 }
7027
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7028 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7029 const struct hda_fixup *fix,
7030 int action)
7031 {
7032 /*
7033 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7034 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7035 * needs an additional quirk for sound working after suspend and resume.
7036 */
7037 if (codec->core.vendor_id == 0x10ec0256) {
7038 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7039 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7040 } else {
7041 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7042 }
7043 }
7044
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7045 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7046 const struct hda_fixup *fix,
7047 int action)
7048 {
7049 struct alc_spec *spec = codec->spec;
7050 struct hda_input_mux *imux = &spec->gen.input_mux;
7051 int i;
7052
7053 alc269_fixup_limit_int_mic_boost(codec, fix, action);
7054
7055 switch (action) {
7056 case HDA_FIXUP_ACT_PRE_PROBE:
7057 /**
7058 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7059 * to Hi-Z to avoid pop noises at startup and when plugging and
7060 * unplugging headphones.
7061 */
7062 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7063 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7064 break;
7065 case HDA_FIXUP_ACT_PROBE:
7066 /**
7067 * Make the internal mic (0x12) the default input source to
7068 * prevent pop noises on cold boot.
7069 */
7070 for (i = 0; i < imux->num_items; i++) {
7071 if (spec->gen.imux_pins[i] == 0x12) {
7072 spec->gen.cur_mux[0] = i;
7073 break;
7074 }
7075 }
7076 break;
7077 }
7078 }
7079
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7080 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7081 const struct hda_fixup *fix, int action)
7082 {
7083 /*
7084 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7085 * unconnected.
7086 */
7087 static const struct hda_pintbl pincfgs[] = {
7088 { 0x17, 0x90170121 },
7089 { }
7090 };
7091 /*
7092 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7093 * DAC 0x02 and 0x03 would be fine.
7094 */
7095 static const hda_nid_t conn[] = { 0x02, 0x03 };
7096 /*
7097 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7098 * Headphones (0x21) are connected to DAC 0x03.
7099 */
7100 static const hda_nid_t preferred_pairs[] = {
7101 0x14, 0x02,
7102 0x17, 0x02,
7103 0x21, 0x03,
7104 0
7105 };
7106 struct alc_spec *spec = codec->spec;
7107
7108 switch (action) {
7109 case HDA_FIXUP_ACT_PRE_PROBE:
7110 snd_hda_apply_pincfgs(codec, pincfgs);
7111 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7112 spec->gen.preferred_dacs = preferred_pairs;
7113 break;
7114 }
7115 }
7116
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7117 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7118 const struct hda_fixup *fix, int action)
7119 {
7120 static const struct hda_pintbl pincfgs[] = {
7121 { 0x14, 0x90170151 },
7122 { 0x17, 0x90170150 },
7123 { }
7124 };
7125 static const hda_nid_t conn[] = { 0x02, 0x03 };
7126 static const hda_nid_t preferred_pairs[] = {
7127 0x14, 0x02,
7128 0x17, 0x03,
7129 0x21, 0x02,
7130 0
7131 };
7132 struct alc_spec *spec = codec->spec;
7133
7134 alc_fixup_no_shutup(codec, fix, action);
7135
7136 switch (action) {
7137 case HDA_FIXUP_ACT_PRE_PROBE:
7138 snd_hda_apply_pincfgs(codec, pincfgs);
7139 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7140 spec->gen.preferred_dacs = preferred_pairs;
7141 break;
7142 }
7143 }
7144
7145 /* Forcibly assign NID 0x03 to HP while NID 0x02 to SPK */
alc287_fixup_bind_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)7146 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7147 const struct hda_fixup *fix, int action)
7148 {
7149 struct alc_spec *spec = codec->spec;
7150 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7151 static const hda_nid_t preferred_pairs[] = {
7152 0x17, 0x02, 0x21, 0x03, 0
7153 };
7154
7155 if (action != HDA_FIXUP_ACT_PRE_PROBE)
7156 return;
7157
7158 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7159 spec->gen.preferred_dacs = preferred_pairs;
7160 spec->gen.auto_mute_via_amp = 1;
7161 if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7162 snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7163 0x0); /* Make sure 0x14 was disable */
7164 }
7165 }
7166 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7167 static void alc_fixup_headset_mic(struct hda_codec *codec,
7168 const struct hda_fixup *fix, int action)
7169 {
7170 struct alc_spec *spec = codec->spec;
7171 static const struct hda_pintbl pincfgs[] = {
7172 { 0x19, 0x03a1103c },
7173 { }
7174 };
7175
7176 switch (action) {
7177 case HDA_FIXUP_ACT_PRE_PROBE:
7178 snd_hda_apply_pincfgs(codec, pincfgs);
7179 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7180 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7181 break;
7182 }
7183 }
7184
7185
7186 enum {
7187 ALC269_FIXUP_GPIO2,
7188 ALC269_FIXUP_SONY_VAIO,
7189 ALC275_FIXUP_SONY_VAIO_GPIO2,
7190 ALC269_FIXUP_DELL_M101Z,
7191 ALC269_FIXUP_SKU_IGNORE,
7192 ALC269_FIXUP_ASUS_G73JW,
7193 ALC269_FIXUP_ASUS_N7601ZM_PINS,
7194 ALC269_FIXUP_ASUS_N7601ZM,
7195 ALC269_FIXUP_LENOVO_EAPD,
7196 ALC275_FIXUP_SONY_HWEQ,
7197 ALC275_FIXUP_SONY_DISABLE_AAMIX,
7198 ALC271_FIXUP_DMIC,
7199 ALC269_FIXUP_PCM_44K,
7200 ALC269_FIXUP_STEREO_DMIC,
7201 ALC269_FIXUP_HEADSET_MIC,
7202 ALC269_FIXUP_QUANTA_MUTE,
7203 ALC269_FIXUP_LIFEBOOK,
7204 ALC269_FIXUP_LIFEBOOK_EXTMIC,
7205 ALC269_FIXUP_LIFEBOOK_HP_PIN,
7206 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7207 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7208 ALC269_FIXUP_AMIC,
7209 ALC269_FIXUP_DMIC,
7210 ALC269VB_FIXUP_AMIC,
7211 ALC269VB_FIXUP_DMIC,
7212 ALC269_FIXUP_HP_MUTE_LED,
7213 ALC269_FIXUP_HP_MUTE_LED_MIC1,
7214 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7215 ALC269_FIXUP_HP_MUTE_LED_MIC3,
7216 ALC269_FIXUP_HP_GPIO_LED,
7217 ALC269_FIXUP_HP_GPIO_MIC1_LED,
7218 ALC269_FIXUP_HP_LINE1_MIC1_LED,
7219 ALC269_FIXUP_INV_DMIC,
7220 ALC269_FIXUP_LENOVO_DOCK,
7221 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7222 ALC269_FIXUP_NO_SHUTUP,
7223 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7224 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7225 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7226 ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7227 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7228 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7229 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7230 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7231 ALC269_FIXUP_HEADSET_MODE,
7232 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7233 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7234 ALC269_FIXUP_ASUS_X101_FUNC,
7235 ALC269_FIXUP_ASUS_X101_VERB,
7236 ALC269_FIXUP_ASUS_X101,
7237 ALC271_FIXUP_AMIC_MIC2,
7238 ALC271_FIXUP_HP_GATE_MIC_JACK,
7239 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7240 ALC269_FIXUP_ACER_AC700,
7241 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7242 ALC269VB_FIXUP_ASUS_ZENBOOK,
7243 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7244 ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7245 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7246 ALC269VB_FIXUP_ORDISSIMO_EVE2,
7247 ALC283_FIXUP_CHROME_BOOK,
7248 ALC283_FIXUP_SENSE_COMBO_JACK,
7249 ALC282_FIXUP_ASUS_TX300,
7250 ALC283_FIXUP_INT_MIC,
7251 ALC290_FIXUP_MONO_SPEAKERS,
7252 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7253 ALC290_FIXUP_SUBWOOFER,
7254 ALC290_FIXUP_SUBWOOFER_HSJACK,
7255 ALC269_FIXUP_THINKPAD_ACPI,
7256 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7257 ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7258 ALC269VC_FIXUP_INFINIX_Y4_MAX,
7259 ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7260 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7261 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7262 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7263 ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7264 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7265 ALC255_FIXUP_HEADSET_MODE,
7266 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7267 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7268 ALC292_FIXUP_TPT440_DOCK,
7269 ALC292_FIXUP_TPT440,
7270 ALC283_FIXUP_HEADSET_MIC,
7271 ALC255_FIXUP_MIC_MUTE_LED,
7272 ALC282_FIXUP_ASPIRE_V5_PINS,
7273 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7274 ALC280_FIXUP_HP_GPIO4,
7275 ALC286_FIXUP_HP_GPIO_LED,
7276 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7277 ALC280_FIXUP_HP_DOCK_PINS,
7278 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7279 ALC280_FIXUP_HP_9480M,
7280 ALC245_FIXUP_HP_X360_AMP,
7281 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7282 ALC285_FIXUP_HP_ENVY_X360,
7283 ALC288_FIXUP_DELL_HEADSET_MODE,
7284 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7285 ALC288_FIXUP_DELL_XPS_13,
7286 ALC288_FIXUP_DISABLE_AAMIX,
7287 ALC292_FIXUP_DELL_E7X_AAMIX,
7288 ALC292_FIXUP_DELL_E7X,
7289 ALC292_FIXUP_DISABLE_AAMIX,
7290 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7291 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7292 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7293 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7294 ALC275_FIXUP_DELL_XPS,
7295 ALC293_FIXUP_LENOVO_SPK_NOISE,
7296 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7297 ALC255_FIXUP_DELL_SPK_NOISE,
7298 ALC225_FIXUP_DISABLE_MIC_VREF,
7299 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7300 ALC295_FIXUP_DISABLE_DAC3,
7301 ALC285_FIXUP_SPEAKER2_TO_DAC1,
7302 ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7303 ALC285_FIXUP_ASUS_HEADSET_MIC,
7304 ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7305 ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7306 ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7307 ALC280_FIXUP_HP_HEADSET_MIC,
7308 ALC221_FIXUP_HP_FRONT_MIC,
7309 ALC292_FIXUP_TPT460,
7310 ALC298_FIXUP_SPK_VOLUME,
7311 ALC298_FIXUP_LENOVO_SPK_VOLUME,
7312 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7313 ALC269_FIXUP_ATIV_BOOK_8,
7314 ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7315 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7316 ALC256_FIXUP_ASUS_HEADSET_MODE,
7317 ALC256_FIXUP_ASUS_MIC,
7318 ALC256_FIXUP_ASUS_AIO_GPIO2,
7319 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7320 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7321 ALC233_FIXUP_LENOVO_MULTI_CODECS,
7322 ALC233_FIXUP_ACER_HEADSET_MIC,
7323 ALC294_FIXUP_LENOVO_MIC_LOCATION,
7324 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7325 ALC225_FIXUP_S3_POP_NOISE,
7326 ALC700_FIXUP_INTEL_REFERENCE,
7327 ALC274_FIXUP_DELL_BIND_DACS,
7328 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7329 ALC298_FIXUP_TPT470_DOCK_FIX,
7330 ALC298_FIXUP_TPT470_DOCK,
7331 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7332 ALC255_FIXUP_DELL_HEADSET_MIC,
7333 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7334 ALC298_FIXUP_HUAWEI_MBX_STEREO,
7335 ALC295_FIXUP_HP_X360,
7336 ALC221_FIXUP_HP_HEADSET_MIC,
7337 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7338 ALC295_FIXUP_HP_AUTO_MUTE,
7339 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7340 ALC294_FIXUP_ASUS_MIC,
7341 ALC294_FIXUP_ASUS_HEADSET_MIC,
7342 ALC294_FIXUP_ASUS_SPK,
7343 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7344 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7345 ALC255_FIXUP_ACER_HEADSET_MIC,
7346 ALC295_FIXUP_CHROME_BOOK,
7347 ALC225_FIXUP_HEADSET_JACK,
7348 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7349 ALC225_FIXUP_WYSE_AUTO_MUTE,
7350 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7351 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7352 ALC256_FIXUP_ASUS_HEADSET_MIC,
7353 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7354 ALC255_FIXUP_PREDATOR_SUBWOOFER,
7355 ALC299_FIXUP_PREDATOR_SPK,
7356 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7357 ALC289_FIXUP_DELL_SPK1,
7358 ALC289_FIXUP_DELL_SPK2,
7359 ALC289_FIXUP_DUAL_SPK,
7360 ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7361 ALC294_FIXUP_SPK2_TO_DAC1,
7362 ALC294_FIXUP_ASUS_DUAL_SPK,
7363 ALC285_FIXUP_THINKPAD_X1_GEN7,
7364 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7365 ALC294_FIXUP_ASUS_ALLY,
7366 ALC294_FIXUP_ASUS_ALLY_PINS,
7367 ALC294_FIXUP_ASUS_ALLY_VERBS,
7368 ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7369 ALC294_FIXUP_ASUS_HPE,
7370 ALC294_FIXUP_ASUS_COEF_1B,
7371 ALC294_FIXUP_ASUS_GX502_HP,
7372 ALC294_FIXUP_ASUS_GX502_PINS,
7373 ALC294_FIXUP_ASUS_GX502_VERBS,
7374 ALC294_FIXUP_ASUS_GU502_HP,
7375 ALC294_FIXUP_ASUS_GU502_PINS,
7376 ALC294_FIXUP_ASUS_GU502_VERBS,
7377 ALC294_FIXUP_ASUS_G513_PINS,
7378 ALC285_FIXUP_ASUS_G533Z_PINS,
7379 ALC285_FIXUP_HP_GPIO_LED,
7380 ALC285_FIXUP_HP_MUTE_LED,
7381 ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7382 ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7383 ALC236_FIXUP_HP_GPIO_LED,
7384 ALC236_FIXUP_HP_MUTE_LED,
7385 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7386 ALC236_FIXUP_LENOVO_INV_DMIC,
7387 ALC298_FIXUP_SAMSUNG_AMP,
7388 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7389 ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7390 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7391 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7392 ALC269VC_FIXUP_ACER_HEADSET_MIC,
7393 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7394 ALC289_FIXUP_ASUS_GA401,
7395 ALC289_FIXUP_ASUS_GA502,
7396 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7397 ALC285_FIXUP_HP_GPIO_AMP_INIT,
7398 ALC269_FIXUP_CZC_B20,
7399 ALC269_FIXUP_CZC_TMI,
7400 ALC269_FIXUP_CZC_L101,
7401 ALC269_FIXUP_LEMOTE_A1802,
7402 ALC269_FIXUP_LEMOTE_A190X,
7403 ALC256_FIXUP_INTEL_NUC8_RUGGED,
7404 ALC233_FIXUP_INTEL_NUC8_DMIC,
7405 ALC233_FIXUP_INTEL_NUC8_BOOST,
7406 ALC256_FIXUP_INTEL_NUC10,
7407 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7408 ALC274_FIXUP_HP_MIC,
7409 ALC274_FIXUP_HP_HEADSET_MIC,
7410 ALC274_FIXUP_HP_ENVY_GPIO,
7411 ALC256_FIXUP_ASUS_HPE,
7412 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7413 ALC287_FIXUP_HP_GPIO_LED,
7414 ALC256_FIXUP_HP_HEADSET_MIC,
7415 ALC245_FIXUP_HP_GPIO_LED,
7416 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7417 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7418 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7419 ALC256_FIXUP_ACER_HEADSET_MIC,
7420 ALC285_FIXUP_IDEAPAD_S740_COEF,
7421 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7422 ALC295_FIXUP_ASUS_DACS,
7423 ALC295_FIXUP_HP_OMEN,
7424 ALC285_FIXUP_HP_SPECTRE_X360,
7425 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7426 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7427 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7428 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7429 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7430 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7431 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7432 ALC298_FIXUP_LENOVO_C940_DUET7,
7433 ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7434 ALC287_FIXUP_13S_GEN2_SPEAKERS,
7435 ALC256_FIXUP_SET_COEF_DEFAULTS,
7436 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7437 ALC233_FIXUP_NO_AUDIO_JACK,
7438 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7439 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7440 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7441 ALC287_FIXUP_LEGION_16ACHG6,
7442 ALC287_FIXUP_CS35L41_I2C_2,
7443 ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7444 ALC245_FIXUP_CS35L41_SPI_2,
7445 ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7446 ALC245_FIXUP_CS35L41_SPI_4,
7447 ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7448 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7449 ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7450 ALC287_FIXUP_LEGION_16ITHG6,
7451 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7452 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7453 ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7454 ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7455 ALC236_FIXUP_DELL_DUAL_CODECS,
7456 ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7457 ALC287_FIXUP_TAS2781_I2C,
7458 ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7459 ALC245_FIXUP_HP_X360_MUTE_LEDS,
7460 ALC287_FIXUP_THINKPAD_I2S_SPK,
7461 ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7462 ALC2XX_FIXUP_HEADSET_MIC,
7463 ALC289_FIXUP_DELL_CS35L41_SPI_2,
7464 ALC294_FIXUP_CS35L41_I2C_2,
7465 };
7466
7467 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7468 * both have the very same PCI SSID, and we need to apply different fixups
7469 * depending on the codec ID
7470 */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7471 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7472 const struct hda_fixup *fix,
7473 int action)
7474 {
7475 int id;
7476
7477 if (codec->core.vendor_id == 0x10ec0298)
7478 id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7479 else
7480 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7481 __snd_hda_apply_fixup(codec, id, action, 0);
7482 }
7483
7484 /* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7485 * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7486 * so we need to apply a different fixup in this case. The only DuetITL codec
7487 * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7488 * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7489 * have matched correctly by their codecs.
7490 */
alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec * codec,const struct hda_fixup * fix,int action)7491 static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7492 const struct hda_fixup *fix,
7493 int action)
7494 {
7495 int id;
7496
7497 if (codec->core.subsystem_id == 0x17aa3802)
7498 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7499 else
7500 id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7501 __snd_hda_apply_fixup(codec, id, action, 0);
7502 }
7503
7504 static const struct hda_fixup alc269_fixups[] = {
7505 [ALC269_FIXUP_GPIO2] = {
7506 .type = HDA_FIXUP_FUNC,
7507 .v.func = alc_fixup_gpio2,
7508 },
7509 [ALC269_FIXUP_SONY_VAIO] = {
7510 .type = HDA_FIXUP_PINCTLS,
7511 .v.pins = (const struct hda_pintbl[]) {
7512 {0x19, PIN_VREFGRD},
7513 {}
7514 }
7515 },
7516 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7517 .type = HDA_FIXUP_FUNC,
7518 .v.func = alc275_fixup_gpio4_off,
7519 .chained = true,
7520 .chain_id = ALC269_FIXUP_SONY_VAIO
7521 },
7522 [ALC269_FIXUP_DELL_M101Z] = {
7523 .type = HDA_FIXUP_VERBS,
7524 .v.verbs = (const struct hda_verb[]) {
7525 /* Enables internal speaker */
7526 {0x20, AC_VERB_SET_COEF_INDEX, 13},
7527 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7528 {}
7529 }
7530 },
7531 [ALC269_FIXUP_SKU_IGNORE] = {
7532 .type = HDA_FIXUP_FUNC,
7533 .v.func = alc_fixup_sku_ignore,
7534 },
7535 [ALC269_FIXUP_ASUS_G73JW] = {
7536 .type = HDA_FIXUP_PINS,
7537 .v.pins = (const struct hda_pintbl[]) {
7538 { 0x17, 0x99130111 }, /* subwoofer */
7539 { }
7540 }
7541 },
7542 [ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7543 .type = HDA_FIXUP_PINS,
7544 .v.pins = (const struct hda_pintbl[]) {
7545 { 0x19, 0x03A11050 },
7546 { 0x1a, 0x03A11C30 },
7547 { 0x21, 0x03211420 },
7548 { }
7549 }
7550 },
7551 [ALC269_FIXUP_ASUS_N7601ZM] = {
7552 .type = HDA_FIXUP_VERBS,
7553 .v.verbs = (const struct hda_verb[]) {
7554 {0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7555 {0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7556 {0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7557 {0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7558 {0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7559 {0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7560 { }
7561 },
7562 .chained = true,
7563 .chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7564 },
7565 [ALC269_FIXUP_LENOVO_EAPD] = {
7566 .type = HDA_FIXUP_VERBS,
7567 .v.verbs = (const struct hda_verb[]) {
7568 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7569 {}
7570 }
7571 },
7572 [ALC275_FIXUP_SONY_HWEQ] = {
7573 .type = HDA_FIXUP_FUNC,
7574 .v.func = alc269_fixup_hweq,
7575 .chained = true,
7576 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7577 },
7578 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7579 .type = HDA_FIXUP_FUNC,
7580 .v.func = alc_fixup_disable_aamix,
7581 .chained = true,
7582 .chain_id = ALC269_FIXUP_SONY_VAIO
7583 },
7584 [ALC271_FIXUP_DMIC] = {
7585 .type = HDA_FIXUP_FUNC,
7586 .v.func = alc271_fixup_dmic,
7587 },
7588 [ALC269_FIXUP_PCM_44K] = {
7589 .type = HDA_FIXUP_FUNC,
7590 .v.func = alc269_fixup_pcm_44k,
7591 .chained = true,
7592 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7593 },
7594 [ALC269_FIXUP_STEREO_DMIC] = {
7595 .type = HDA_FIXUP_FUNC,
7596 .v.func = alc269_fixup_stereo_dmic,
7597 },
7598 [ALC269_FIXUP_HEADSET_MIC] = {
7599 .type = HDA_FIXUP_FUNC,
7600 .v.func = alc269_fixup_headset_mic,
7601 },
7602 [ALC269_FIXUP_QUANTA_MUTE] = {
7603 .type = HDA_FIXUP_FUNC,
7604 .v.func = alc269_fixup_quanta_mute,
7605 },
7606 [ALC269_FIXUP_LIFEBOOK] = {
7607 .type = HDA_FIXUP_PINS,
7608 .v.pins = (const struct hda_pintbl[]) {
7609 { 0x1a, 0x2101103f }, /* dock line-out */
7610 { 0x1b, 0x23a11040 }, /* dock mic-in */
7611 { }
7612 },
7613 .chained = true,
7614 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7615 },
7616 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7617 .type = HDA_FIXUP_PINS,
7618 .v.pins = (const struct hda_pintbl[]) {
7619 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7620 { }
7621 },
7622 },
7623 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7624 .type = HDA_FIXUP_PINS,
7625 .v.pins = (const struct hda_pintbl[]) {
7626 { 0x21, 0x0221102f }, /* HP out */
7627 { }
7628 },
7629 },
7630 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7631 .type = HDA_FIXUP_FUNC,
7632 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7633 },
7634 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7635 .type = HDA_FIXUP_FUNC,
7636 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7637 },
7638 [ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
7639 .type = HDA_FIXUP_PINS,
7640 .v.pins = (const struct hda_pintbl[]) {
7641 { 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
7642 { 0x1b, 0x90170152 }, /* use as internal speaker (back) */
7643 { }
7644 },
7645 .chained = true,
7646 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7647 },
7648 [ALC269VC_FIXUP_INFINIX_Y4_MAX] = {
7649 .type = HDA_FIXUP_PINS,
7650 .v.pins = (const struct hda_pintbl[]) {
7651 { 0x1b, 0x90170150 }, /* use as internal speaker */
7652 { }
7653 },
7654 .chained = true,
7655 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7656 },
7657 [ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7658 .type = HDA_FIXUP_PINS,
7659 .v.pins = (const struct hda_pintbl[]) {
7660 { 0x18, 0x03a19020 }, /* headset mic */
7661 { 0x1b, 0x90170150 }, /* speaker */
7662 { }
7663 },
7664 },
7665 [ALC269_FIXUP_AMIC] = {
7666 .type = HDA_FIXUP_PINS,
7667 .v.pins = (const struct hda_pintbl[]) {
7668 { 0x14, 0x99130110 }, /* speaker */
7669 { 0x15, 0x0121401f }, /* HP out */
7670 { 0x18, 0x01a19c20 }, /* mic */
7671 { 0x19, 0x99a3092f }, /* int-mic */
7672 { }
7673 },
7674 },
7675 [ALC269_FIXUP_DMIC] = {
7676 .type = HDA_FIXUP_PINS,
7677 .v.pins = (const struct hda_pintbl[]) {
7678 { 0x12, 0x99a3092f }, /* int-mic */
7679 { 0x14, 0x99130110 }, /* speaker */
7680 { 0x15, 0x0121401f }, /* HP out */
7681 { 0x18, 0x01a19c20 }, /* mic */
7682 { }
7683 },
7684 },
7685 [ALC269VB_FIXUP_AMIC] = {
7686 .type = HDA_FIXUP_PINS,
7687 .v.pins = (const struct hda_pintbl[]) {
7688 { 0x14, 0x99130110 }, /* speaker */
7689 { 0x18, 0x01a19c20 }, /* mic */
7690 { 0x19, 0x99a3092f }, /* int-mic */
7691 { 0x21, 0x0121401f }, /* HP out */
7692 { }
7693 },
7694 },
7695 [ALC269VB_FIXUP_DMIC] = {
7696 .type = HDA_FIXUP_PINS,
7697 .v.pins = (const struct hda_pintbl[]) {
7698 { 0x12, 0x99a3092f }, /* int-mic */
7699 { 0x14, 0x99130110 }, /* speaker */
7700 { 0x18, 0x01a19c20 }, /* mic */
7701 { 0x21, 0x0121401f }, /* HP out */
7702 { }
7703 },
7704 },
7705 [ALC269_FIXUP_HP_MUTE_LED] = {
7706 .type = HDA_FIXUP_FUNC,
7707 .v.func = alc269_fixup_hp_mute_led,
7708 },
7709 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7710 .type = HDA_FIXUP_FUNC,
7711 .v.func = alc269_fixup_hp_mute_led_mic1,
7712 },
7713 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7714 .type = HDA_FIXUP_FUNC,
7715 .v.func = alc269_fixup_hp_mute_led_mic2,
7716 },
7717 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7718 .type = HDA_FIXUP_FUNC,
7719 .v.func = alc269_fixup_hp_mute_led_mic3,
7720 .chained = true,
7721 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7722 },
7723 [ALC269_FIXUP_HP_GPIO_LED] = {
7724 .type = HDA_FIXUP_FUNC,
7725 .v.func = alc269_fixup_hp_gpio_led,
7726 },
7727 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7728 .type = HDA_FIXUP_FUNC,
7729 .v.func = alc269_fixup_hp_gpio_mic1_led,
7730 },
7731 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7732 .type = HDA_FIXUP_FUNC,
7733 .v.func = alc269_fixup_hp_line1_mic1_led,
7734 },
7735 [ALC269_FIXUP_INV_DMIC] = {
7736 .type = HDA_FIXUP_FUNC,
7737 .v.func = alc_fixup_inv_dmic,
7738 },
7739 [ALC269_FIXUP_NO_SHUTUP] = {
7740 .type = HDA_FIXUP_FUNC,
7741 .v.func = alc_fixup_no_shutup,
7742 },
7743 [ALC269_FIXUP_LENOVO_DOCK] = {
7744 .type = HDA_FIXUP_PINS,
7745 .v.pins = (const struct hda_pintbl[]) {
7746 { 0x19, 0x23a11040 }, /* dock mic */
7747 { 0x1b, 0x2121103f }, /* dock headphone */
7748 { }
7749 },
7750 .chained = true,
7751 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7752 },
7753 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7754 .type = HDA_FIXUP_FUNC,
7755 .v.func = alc269_fixup_limit_int_mic_boost,
7756 .chained = true,
7757 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7758 },
7759 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7760 .type = HDA_FIXUP_FUNC,
7761 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7762 .chained = true,
7763 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7764 },
7765 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7766 .type = HDA_FIXUP_PINS,
7767 .v.pins = (const struct hda_pintbl[]) {
7768 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7769 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7770 { }
7771 },
7772 .chained = true,
7773 .chain_id = ALC269_FIXUP_HEADSET_MODE
7774 },
7775 [ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
7776 .type = HDA_FIXUP_FUNC,
7777 .v.func = alc269_fixup_limit_int_mic_boost,
7778 .chained = true,
7779 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7780 },
7781 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7782 .type = HDA_FIXUP_PINS,
7783 .v.pins = (const struct hda_pintbl[]) {
7784 { 0x16, 0x21014020 }, /* dock line out */
7785 { 0x19, 0x21a19030 }, /* dock mic */
7786 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7787 { }
7788 },
7789 .chained = true,
7790 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7791 },
7792 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7793 .type = HDA_FIXUP_PINS,
7794 .v.pins = (const struct hda_pintbl[]) {
7795 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7796 { }
7797 },
7798 .chained = true,
7799 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7800 },
7801 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7802 .type = HDA_FIXUP_PINS,
7803 .v.pins = (const struct hda_pintbl[]) {
7804 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7805 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7806 { }
7807 },
7808 .chained = true,
7809 .chain_id = ALC269_FIXUP_HEADSET_MODE
7810 },
7811 [ALC269_FIXUP_HEADSET_MODE] = {
7812 .type = HDA_FIXUP_FUNC,
7813 .v.func = alc_fixup_headset_mode,
7814 .chained = true,
7815 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7816 },
7817 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7818 .type = HDA_FIXUP_FUNC,
7819 .v.func = alc_fixup_headset_mode_no_hp_mic,
7820 },
7821 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7822 .type = HDA_FIXUP_PINS,
7823 .v.pins = (const struct hda_pintbl[]) {
7824 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7825 { }
7826 },
7827 .chained = true,
7828 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7829 },
7830 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7831 .type = HDA_FIXUP_PINS,
7832 .v.pins = (const struct hda_pintbl[]) {
7833 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7834 { }
7835 },
7836 .chained = true,
7837 .chain_id = ALC269_FIXUP_HEADSET_MIC
7838 },
7839 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7840 .type = HDA_FIXUP_PINS,
7841 .v.pins = (const struct hda_pintbl[]) {
7842 {0x12, 0x90a60130},
7843 {0x13, 0x40000000},
7844 {0x14, 0x90170110},
7845 {0x18, 0x411111f0},
7846 {0x19, 0x04a11040},
7847 {0x1a, 0x411111f0},
7848 {0x1b, 0x90170112},
7849 {0x1d, 0x40759a05},
7850 {0x1e, 0x411111f0},
7851 {0x21, 0x04211020},
7852 { }
7853 },
7854 .chained = true,
7855 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7856 },
7857 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7858 .type = HDA_FIXUP_FUNC,
7859 .v.func = alc298_fixup_huawei_mbx_stereo,
7860 .chained = true,
7861 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7862 },
7863 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7864 .type = HDA_FIXUP_FUNC,
7865 .v.func = alc269_fixup_x101_headset_mic,
7866 },
7867 [ALC269_FIXUP_ASUS_X101_VERB] = {
7868 .type = HDA_FIXUP_VERBS,
7869 .v.verbs = (const struct hda_verb[]) {
7870 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7871 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7872 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7873 { }
7874 },
7875 .chained = true,
7876 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7877 },
7878 [ALC269_FIXUP_ASUS_X101] = {
7879 .type = HDA_FIXUP_PINS,
7880 .v.pins = (const struct hda_pintbl[]) {
7881 { 0x18, 0x04a1182c }, /* Headset mic */
7882 { }
7883 },
7884 .chained = true,
7885 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7886 },
7887 [ALC271_FIXUP_AMIC_MIC2] = {
7888 .type = HDA_FIXUP_PINS,
7889 .v.pins = (const struct hda_pintbl[]) {
7890 { 0x14, 0x99130110 }, /* speaker */
7891 { 0x19, 0x01a19c20 }, /* mic */
7892 { 0x1b, 0x99a7012f }, /* int-mic */
7893 { 0x21, 0x0121401f }, /* HP out */
7894 { }
7895 },
7896 },
7897 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7898 .type = HDA_FIXUP_FUNC,
7899 .v.func = alc271_hp_gate_mic_jack,
7900 .chained = true,
7901 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7902 },
7903 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7904 .type = HDA_FIXUP_FUNC,
7905 .v.func = alc269_fixup_limit_int_mic_boost,
7906 .chained = true,
7907 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7908 },
7909 [ALC269_FIXUP_ACER_AC700] = {
7910 .type = HDA_FIXUP_PINS,
7911 .v.pins = (const struct hda_pintbl[]) {
7912 { 0x12, 0x99a3092f }, /* int-mic */
7913 { 0x14, 0x99130110 }, /* speaker */
7914 { 0x18, 0x03a11c20 }, /* mic */
7915 { 0x1e, 0x0346101e }, /* SPDIF1 */
7916 { 0x21, 0x0321101f }, /* HP out */
7917 { }
7918 },
7919 .chained = true,
7920 .chain_id = ALC271_FIXUP_DMIC,
7921 },
7922 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7923 .type = HDA_FIXUP_FUNC,
7924 .v.func = alc269_fixup_limit_int_mic_boost,
7925 .chained = true,
7926 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7927 },
7928 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7929 .type = HDA_FIXUP_FUNC,
7930 .v.func = alc269_fixup_limit_int_mic_boost,
7931 .chained = true,
7932 .chain_id = ALC269VB_FIXUP_DMIC,
7933 },
7934 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7935 .type = HDA_FIXUP_VERBS,
7936 .v.verbs = (const struct hda_verb[]) {
7937 /* class-D output amp +5dB */
7938 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7939 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7940 {}
7941 },
7942 .chained = true,
7943 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7944 },
7945 [ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7946 .type = HDA_FIXUP_PINS,
7947 .v.pins = (const struct hda_pintbl[]) {
7948 { 0x18, 0x01a110f0 }, /* use as headset mic */
7949 { }
7950 },
7951 .chained = true,
7952 .chain_id = ALC269_FIXUP_HEADSET_MIC
7953 },
7954 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7955 .type = HDA_FIXUP_FUNC,
7956 .v.func = alc269_fixup_limit_int_mic_boost,
7957 .chained = true,
7958 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7959 },
7960 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7961 .type = HDA_FIXUP_PINS,
7962 .v.pins = (const struct hda_pintbl[]) {
7963 { 0x12, 0x99a3092f }, /* int-mic */
7964 { 0x18, 0x03a11d20 }, /* mic */
7965 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7966 { }
7967 },
7968 },
7969 [ALC283_FIXUP_CHROME_BOOK] = {
7970 .type = HDA_FIXUP_FUNC,
7971 .v.func = alc283_fixup_chromebook,
7972 },
7973 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7974 .type = HDA_FIXUP_FUNC,
7975 .v.func = alc283_fixup_sense_combo_jack,
7976 .chained = true,
7977 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7978 },
7979 [ALC282_FIXUP_ASUS_TX300] = {
7980 .type = HDA_FIXUP_FUNC,
7981 .v.func = alc282_fixup_asus_tx300,
7982 },
7983 [ALC283_FIXUP_INT_MIC] = {
7984 .type = HDA_FIXUP_VERBS,
7985 .v.verbs = (const struct hda_verb[]) {
7986 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7987 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7988 { }
7989 },
7990 .chained = true,
7991 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7992 },
7993 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7994 .type = HDA_FIXUP_PINS,
7995 .v.pins = (const struct hda_pintbl[]) {
7996 { 0x17, 0x90170112 }, /* subwoofer */
7997 { }
7998 },
7999 .chained = true,
8000 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8001 },
8002 [ALC290_FIXUP_SUBWOOFER] = {
8003 .type = HDA_FIXUP_PINS,
8004 .v.pins = (const struct hda_pintbl[]) {
8005 { 0x17, 0x90170112 }, /* subwoofer */
8006 { }
8007 },
8008 .chained = true,
8009 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8010 },
8011 [ALC290_FIXUP_MONO_SPEAKERS] = {
8012 .type = HDA_FIXUP_FUNC,
8013 .v.func = alc290_fixup_mono_speakers,
8014 },
8015 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8016 .type = HDA_FIXUP_FUNC,
8017 .v.func = alc290_fixup_mono_speakers,
8018 .chained = true,
8019 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8020 },
8021 [ALC269_FIXUP_THINKPAD_ACPI] = {
8022 .type = HDA_FIXUP_FUNC,
8023 .v.func = alc_fixup_thinkpad_acpi,
8024 .chained = true,
8025 .chain_id = ALC269_FIXUP_SKU_IGNORE,
8026 },
8027 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8028 .type = HDA_FIXUP_FUNC,
8029 .v.func = alc_fixup_inv_dmic,
8030 .chained = true,
8031 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8032 },
8033 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8034 .type = HDA_FIXUP_PINS,
8035 .v.pins = (const struct hda_pintbl[]) {
8036 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8037 { }
8038 },
8039 .chained = true,
8040 .chain_id = ALC255_FIXUP_HEADSET_MODE
8041 },
8042 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8043 .type = HDA_FIXUP_PINS,
8044 .v.pins = (const struct hda_pintbl[]) {
8045 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8046 { }
8047 },
8048 .chained = true,
8049 .chain_id = ALC255_FIXUP_HEADSET_MODE
8050 },
8051 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8052 .type = HDA_FIXUP_PINS,
8053 .v.pins = (const struct hda_pintbl[]) {
8054 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8055 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8056 { }
8057 },
8058 .chained = true,
8059 .chain_id = ALC255_FIXUP_HEADSET_MODE
8060 },
8061 [ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8062 .type = HDA_FIXUP_FUNC,
8063 .v.func = alc269_fixup_limit_int_mic_boost,
8064 .chained = true,
8065 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8066 },
8067 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8068 .type = HDA_FIXUP_PINS,
8069 .v.pins = (const struct hda_pintbl[]) {
8070 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8071 { }
8072 },
8073 .chained = true,
8074 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8075 },
8076 [ALC255_FIXUP_HEADSET_MODE] = {
8077 .type = HDA_FIXUP_FUNC,
8078 .v.func = alc_fixup_headset_mode_alc255,
8079 .chained = true,
8080 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8081 },
8082 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8083 .type = HDA_FIXUP_FUNC,
8084 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8085 },
8086 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8087 .type = HDA_FIXUP_PINS,
8088 .v.pins = (const struct hda_pintbl[]) {
8089 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8090 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8091 { }
8092 },
8093 .chained = true,
8094 .chain_id = ALC269_FIXUP_HEADSET_MODE
8095 },
8096 [ALC292_FIXUP_TPT440_DOCK] = {
8097 .type = HDA_FIXUP_FUNC,
8098 .v.func = alc_fixup_tpt440_dock,
8099 .chained = true,
8100 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8101 },
8102 [ALC292_FIXUP_TPT440] = {
8103 .type = HDA_FIXUP_FUNC,
8104 .v.func = alc_fixup_disable_aamix,
8105 .chained = true,
8106 .chain_id = ALC292_FIXUP_TPT440_DOCK,
8107 },
8108 [ALC283_FIXUP_HEADSET_MIC] = {
8109 .type = HDA_FIXUP_PINS,
8110 .v.pins = (const struct hda_pintbl[]) {
8111 { 0x19, 0x04a110f0 },
8112 { },
8113 },
8114 },
8115 [ALC255_FIXUP_MIC_MUTE_LED] = {
8116 .type = HDA_FIXUP_FUNC,
8117 .v.func = alc_fixup_micmute_led,
8118 },
8119 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
8120 .type = HDA_FIXUP_PINS,
8121 .v.pins = (const struct hda_pintbl[]) {
8122 { 0x12, 0x90a60130 },
8123 { 0x14, 0x90170110 },
8124 { 0x17, 0x40000008 },
8125 { 0x18, 0x411111f0 },
8126 { 0x19, 0x01a1913c },
8127 { 0x1a, 0x411111f0 },
8128 { 0x1b, 0x411111f0 },
8129 { 0x1d, 0x40f89b2d },
8130 { 0x1e, 0x411111f0 },
8131 { 0x21, 0x0321101f },
8132 { },
8133 },
8134 },
8135 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8136 .type = HDA_FIXUP_FUNC,
8137 .v.func = alc269vb_fixup_aspire_e1_coef,
8138 },
8139 [ALC280_FIXUP_HP_GPIO4] = {
8140 .type = HDA_FIXUP_FUNC,
8141 .v.func = alc280_fixup_hp_gpio4,
8142 },
8143 [ALC286_FIXUP_HP_GPIO_LED] = {
8144 .type = HDA_FIXUP_FUNC,
8145 .v.func = alc286_fixup_hp_gpio_led,
8146 },
8147 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8148 .type = HDA_FIXUP_FUNC,
8149 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8150 },
8151 [ALC280_FIXUP_HP_DOCK_PINS] = {
8152 .type = HDA_FIXUP_PINS,
8153 .v.pins = (const struct hda_pintbl[]) {
8154 { 0x1b, 0x21011020 }, /* line-out */
8155 { 0x1a, 0x01a1903c }, /* headset mic */
8156 { 0x18, 0x2181103f }, /* line-in */
8157 { },
8158 },
8159 .chained = true,
8160 .chain_id = ALC280_FIXUP_HP_GPIO4
8161 },
8162 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8163 .type = HDA_FIXUP_PINS,
8164 .v.pins = (const struct hda_pintbl[]) {
8165 { 0x1b, 0x21011020 }, /* line-out */
8166 { 0x18, 0x2181103f }, /* line-in */
8167 { },
8168 },
8169 .chained = true,
8170 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8171 },
8172 [ALC280_FIXUP_HP_9480M] = {
8173 .type = HDA_FIXUP_FUNC,
8174 .v.func = alc280_fixup_hp_9480m,
8175 },
8176 [ALC245_FIXUP_HP_X360_AMP] = {
8177 .type = HDA_FIXUP_FUNC,
8178 .v.func = alc245_fixup_hp_x360_amp,
8179 .chained = true,
8180 .chain_id = ALC245_FIXUP_HP_GPIO_LED
8181 },
8182 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
8183 .type = HDA_FIXUP_FUNC,
8184 .v.func = alc_fixup_headset_mode_dell_alc288,
8185 .chained = true,
8186 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8187 },
8188 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8189 .type = HDA_FIXUP_PINS,
8190 .v.pins = (const struct hda_pintbl[]) {
8191 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8192 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8193 { }
8194 },
8195 .chained = true,
8196 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8197 },
8198 [ALC288_FIXUP_DISABLE_AAMIX] = {
8199 .type = HDA_FIXUP_FUNC,
8200 .v.func = alc_fixup_disable_aamix,
8201 .chained = true,
8202 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8203 },
8204 [ALC288_FIXUP_DELL_XPS_13] = {
8205 .type = HDA_FIXUP_FUNC,
8206 .v.func = alc_fixup_dell_xps13,
8207 .chained = true,
8208 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
8209 },
8210 [ALC292_FIXUP_DISABLE_AAMIX] = {
8211 .type = HDA_FIXUP_FUNC,
8212 .v.func = alc_fixup_disable_aamix,
8213 .chained = true,
8214 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8215 },
8216 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8217 .type = HDA_FIXUP_FUNC,
8218 .v.func = alc_fixup_disable_aamix,
8219 .chained = true,
8220 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8221 },
8222 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8223 .type = HDA_FIXUP_FUNC,
8224 .v.func = alc_fixup_dell_xps13,
8225 .chained = true,
8226 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
8227 },
8228 [ALC292_FIXUP_DELL_E7X] = {
8229 .type = HDA_FIXUP_FUNC,
8230 .v.func = alc_fixup_micmute_led,
8231 /* micmute fixup must be applied at last */
8232 .chained_before = true,
8233 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8234 },
8235 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8236 .type = HDA_FIXUP_PINS,
8237 .v.pins = (const struct hda_pintbl[]) {
8238 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8239 { }
8240 },
8241 .chained_before = true,
8242 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8243 },
8244 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8245 .type = HDA_FIXUP_PINS,
8246 .v.pins = (const struct hda_pintbl[]) {
8247 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8248 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8249 { }
8250 },
8251 .chained = true,
8252 .chain_id = ALC269_FIXUP_HEADSET_MODE
8253 },
8254 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8255 .type = HDA_FIXUP_PINS,
8256 .v.pins = (const struct hda_pintbl[]) {
8257 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8258 { }
8259 },
8260 .chained = true,
8261 .chain_id = ALC269_FIXUP_HEADSET_MODE
8262 },
8263 [ALC275_FIXUP_DELL_XPS] = {
8264 .type = HDA_FIXUP_VERBS,
8265 .v.verbs = (const struct hda_verb[]) {
8266 /* Enables internal speaker */
8267 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8268 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8269 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8270 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8271 {}
8272 }
8273 },
8274 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8275 .type = HDA_FIXUP_FUNC,
8276 .v.func = alc_fixup_disable_aamix,
8277 .chained = true,
8278 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8279 },
8280 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8281 .type = HDA_FIXUP_FUNC,
8282 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8283 },
8284 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8285 .type = HDA_FIXUP_FUNC,
8286 .v.func = alc_fixup_inv_dmic,
8287 .chained = true,
8288 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8289 },
8290 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8291 .type = HDA_FIXUP_FUNC,
8292 .v.func = alc269_fixup_limit_int_mic_boost
8293 },
8294 [ALC255_FIXUP_DELL_SPK_NOISE] = {
8295 .type = HDA_FIXUP_FUNC,
8296 .v.func = alc_fixup_disable_aamix,
8297 .chained = true,
8298 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8299 },
8300 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
8301 .type = HDA_FIXUP_FUNC,
8302 .v.func = alc_fixup_disable_mic_vref,
8303 .chained = true,
8304 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8305 },
8306 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8307 .type = HDA_FIXUP_VERBS,
8308 .v.verbs = (const struct hda_verb[]) {
8309 /* Disable pass-through path for FRONT 14h */
8310 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8311 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8312 {}
8313 },
8314 .chained = true,
8315 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8316 },
8317 [ALC280_FIXUP_HP_HEADSET_MIC] = {
8318 .type = HDA_FIXUP_FUNC,
8319 .v.func = alc_fixup_disable_aamix,
8320 .chained = true,
8321 .chain_id = ALC269_FIXUP_HEADSET_MIC,
8322 },
8323 [ALC221_FIXUP_HP_FRONT_MIC] = {
8324 .type = HDA_FIXUP_PINS,
8325 .v.pins = (const struct hda_pintbl[]) {
8326 { 0x19, 0x02a19020 }, /* Front Mic */
8327 { }
8328 },
8329 },
8330 [ALC292_FIXUP_TPT460] = {
8331 .type = HDA_FIXUP_FUNC,
8332 .v.func = alc_fixup_tpt440_dock,
8333 .chained = true,
8334 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8335 },
8336 [ALC298_FIXUP_SPK_VOLUME] = {
8337 .type = HDA_FIXUP_FUNC,
8338 .v.func = alc298_fixup_speaker_volume,
8339 .chained = true,
8340 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8341 },
8342 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8343 .type = HDA_FIXUP_FUNC,
8344 .v.func = alc298_fixup_speaker_volume,
8345 },
8346 [ALC295_FIXUP_DISABLE_DAC3] = {
8347 .type = HDA_FIXUP_FUNC,
8348 .v.func = alc295_fixup_disable_dac3,
8349 },
8350 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8351 .type = HDA_FIXUP_FUNC,
8352 .v.func = alc285_fixup_speaker2_to_dac1,
8353 .chained = true,
8354 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8355 },
8356 [ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8357 .type = HDA_FIXUP_FUNC,
8358 .v.func = alc285_fixup_speaker2_to_dac1,
8359 .chained = true,
8360 .chain_id = ALC245_FIXUP_CS35L41_SPI_2
8361 },
8362 [ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8363 .type = HDA_FIXUP_PINS,
8364 .v.pins = (const struct hda_pintbl[]) {
8365 { 0x19, 0x03a11050 },
8366 { 0x1b, 0x03a11c30 },
8367 { }
8368 },
8369 .chained = true,
8370 .chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8371 },
8372 [ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8373 .type = HDA_FIXUP_PINS,
8374 .v.pins = (const struct hda_pintbl[]) {
8375 { 0x14, 0x90170120 },
8376 { }
8377 },
8378 .chained = true,
8379 .chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8380 },
8381 [ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8382 .type = HDA_FIXUP_FUNC,
8383 .v.func = alc285_fixup_speaker2_to_dac1,
8384 .chained = true,
8385 .chain_id = ALC287_FIXUP_CS35L41_I2C_2
8386 },
8387 [ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8388 .type = HDA_FIXUP_PINS,
8389 .v.pins = (const struct hda_pintbl[]) {
8390 { 0x19, 0x03a11050 },
8391 { 0x1b, 0x03a11c30 },
8392 { }
8393 },
8394 .chained = true,
8395 .chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8396 },
8397 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8398 .type = HDA_FIXUP_PINS,
8399 .v.pins = (const struct hda_pintbl[]) {
8400 { 0x1b, 0x90170151 },
8401 { }
8402 },
8403 .chained = true,
8404 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8405 },
8406 [ALC269_FIXUP_ATIV_BOOK_8] = {
8407 .type = HDA_FIXUP_FUNC,
8408 .v.func = alc_fixup_auto_mute_via_amp,
8409 .chained = true,
8410 .chain_id = ALC269_FIXUP_NO_SHUTUP
8411 },
8412 [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8413 .type = HDA_FIXUP_PINS,
8414 .v.pins = (const struct hda_pintbl[]) {
8415 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8416 { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8417 { }
8418 },
8419 .chained = true,
8420 .chain_id = ALC269_FIXUP_HEADSET_MODE
8421 },
8422 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8423 .type = HDA_FIXUP_PINS,
8424 .v.pins = (const struct hda_pintbl[]) {
8425 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8426 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8427 { }
8428 },
8429 .chained = true,
8430 .chain_id = ALC269_FIXUP_HEADSET_MODE
8431 },
8432 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8433 .type = HDA_FIXUP_FUNC,
8434 .v.func = alc_fixup_headset_mode,
8435 },
8436 [ALC256_FIXUP_ASUS_MIC] = {
8437 .type = HDA_FIXUP_PINS,
8438 .v.pins = (const struct hda_pintbl[]) {
8439 { 0x13, 0x90a60160 }, /* use as internal mic */
8440 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8441 { }
8442 },
8443 .chained = true,
8444 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8445 },
8446 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8447 .type = HDA_FIXUP_FUNC,
8448 /* Set up GPIO2 for the speaker amp */
8449 .v.func = alc_fixup_gpio4,
8450 },
8451 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8452 .type = HDA_FIXUP_PINS,
8453 .v.pins = (const struct hda_pintbl[]) {
8454 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8455 { }
8456 },
8457 .chained = true,
8458 .chain_id = ALC269_FIXUP_HEADSET_MIC
8459 },
8460 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8461 .type = HDA_FIXUP_VERBS,
8462 .v.verbs = (const struct hda_verb[]) {
8463 /* Enables internal speaker */
8464 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8465 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8466 {}
8467 },
8468 .chained = true,
8469 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8470 },
8471 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8472 .type = HDA_FIXUP_FUNC,
8473 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8474 .chained = true,
8475 .chain_id = ALC269_FIXUP_GPIO2
8476 },
8477 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
8478 .type = HDA_FIXUP_VERBS,
8479 .v.verbs = (const struct hda_verb[]) {
8480 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8481 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8482 { }
8483 },
8484 .chained = true,
8485 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8486 },
8487 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8488 .type = HDA_FIXUP_PINS,
8489 .v.pins = (const struct hda_pintbl[]) {
8490 /* Change the mic location from front to right, otherwise there are
8491 two front mics with the same name, pulseaudio can't handle them.
8492 This is just a temporary workaround, after applying this fixup,
8493 there will be one "Front Mic" and one "Mic" in this machine.
8494 */
8495 { 0x1a, 0x04a19040 },
8496 { }
8497 },
8498 },
8499 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8500 .type = HDA_FIXUP_PINS,
8501 .v.pins = (const struct hda_pintbl[]) {
8502 { 0x16, 0x0101102f }, /* Rear Headset HP */
8503 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8504 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8505 { 0x1b, 0x02011020 },
8506 { }
8507 },
8508 .chained = true,
8509 .chain_id = ALC225_FIXUP_S3_POP_NOISE
8510 },
8511 [ALC225_FIXUP_S3_POP_NOISE] = {
8512 .type = HDA_FIXUP_FUNC,
8513 .v.func = alc225_fixup_s3_pop_noise,
8514 .chained = true,
8515 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8516 },
8517 [ALC700_FIXUP_INTEL_REFERENCE] = {
8518 .type = HDA_FIXUP_VERBS,
8519 .v.verbs = (const struct hda_verb[]) {
8520 /* Enables internal speaker */
8521 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8522 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8523 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8524 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8525 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8526 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8527 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8528 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8529 {}
8530 }
8531 },
8532 [ALC274_FIXUP_DELL_BIND_DACS] = {
8533 .type = HDA_FIXUP_FUNC,
8534 .v.func = alc274_fixup_bind_dacs,
8535 .chained = true,
8536 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8537 },
8538 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8539 .type = HDA_FIXUP_PINS,
8540 .v.pins = (const struct hda_pintbl[]) {
8541 { 0x1b, 0x0401102f },
8542 { }
8543 },
8544 .chained = true,
8545 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
8546 },
8547 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
8548 .type = HDA_FIXUP_FUNC,
8549 .v.func = alc_fixup_tpt470_dock,
8550 .chained = true,
8551 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8552 },
8553 [ALC298_FIXUP_TPT470_DOCK] = {
8554 .type = HDA_FIXUP_FUNC,
8555 .v.func = alc_fixup_tpt470_dacs,
8556 .chained = true,
8557 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8558 },
8559 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8560 .type = HDA_FIXUP_PINS,
8561 .v.pins = (const struct hda_pintbl[]) {
8562 { 0x14, 0x0201101f },
8563 { }
8564 },
8565 .chained = true,
8566 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8567 },
8568 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
8569 .type = HDA_FIXUP_PINS,
8570 .v.pins = (const struct hda_pintbl[]) {
8571 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8572 { }
8573 },
8574 .chained = true,
8575 .chain_id = ALC269_FIXUP_HEADSET_MIC
8576 },
8577 [ALC295_FIXUP_HP_X360] = {
8578 .type = HDA_FIXUP_FUNC,
8579 .v.func = alc295_fixup_hp_top_speakers,
8580 .chained = true,
8581 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8582 },
8583 [ALC221_FIXUP_HP_HEADSET_MIC] = {
8584 .type = HDA_FIXUP_PINS,
8585 .v.pins = (const struct hda_pintbl[]) {
8586 { 0x19, 0x0181313f},
8587 { }
8588 },
8589 .chained = true,
8590 .chain_id = ALC269_FIXUP_HEADSET_MIC
8591 },
8592 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8593 .type = HDA_FIXUP_FUNC,
8594 .v.func = alc285_fixup_invalidate_dacs,
8595 .chained = true,
8596 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8597 },
8598 [ALC295_FIXUP_HP_AUTO_MUTE] = {
8599 .type = HDA_FIXUP_FUNC,
8600 .v.func = alc_fixup_auto_mute_via_amp,
8601 },
8602 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8603 .type = HDA_FIXUP_PINS,
8604 .v.pins = (const struct hda_pintbl[]) {
8605 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8606 { }
8607 },
8608 .chained = true,
8609 .chain_id = ALC269_FIXUP_HEADSET_MIC
8610 },
8611 [ALC294_FIXUP_ASUS_MIC] = {
8612 .type = HDA_FIXUP_PINS,
8613 .v.pins = (const struct hda_pintbl[]) {
8614 { 0x13, 0x90a60160 }, /* use as internal mic */
8615 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8616 { }
8617 },
8618 .chained = true,
8619 .chain_id = ALC269_FIXUP_HEADSET_MIC
8620 },
8621 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8622 .type = HDA_FIXUP_PINS,
8623 .v.pins = (const struct hda_pintbl[]) {
8624 { 0x19, 0x01a1103c }, /* use as headset mic */
8625 { }
8626 },
8627 .chained = true,
8628 .chain_id = ALC269_FIXUP_HEADSET_MIC
8629 },
8630 [ALC294_FIXUP_ASUS_SPK] = {
8631 .type = HDA_FIXUP_VERBS,
8632 .v.verbs = (const struct hda_verb[]) {
8633 /* Set EAPD high */
8634 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8635 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8636 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8637 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8638 { }
8639 },
8640 .chained = true,
8641 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8642 },
8643 [ALC295_FIXUP_CHROME_BOOK] = {
8644 .type = HDA_FIXUP_FUNC,
8645 .v.func = alc295_fixup_chromebook,
8646 .chained = true,
8647 .chain_id = ALC225_FIXUP_HEADSET_JACK
8648 },
8649 [ALC225_FIXUP_HEADSET_JACK] = {
8650 .type = HDA_FIXUP_FUNC,
8651 .v.func = alc_fixup_headset_jack,
8652 },
8653 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8654 .type = HDA_FIXUP_PINS,
8655 .v.pins = (const struct hda_pintbl[]) {
8656 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8657 { }
8658 },
8659 .chained = true,
8660 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8661 },
8662 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8663 .type = HDA_FIXUP_VERBS,
8664 .v.verbs = (const struct hda_verb[]) {
8665 /* Disable PCBEEP-IN passthrough */
8666 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8667 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8668 { }
8669 },
8670 .chained = true,
8671 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8672 },
8673 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8674 .type = HDA_FIXUP_PINS,
8675 .v.pins = (const struct hda_pintbl[]) {
8676 { 0x19, 0x03a11130 },
8677 { 0x1a, 0x90a60140 }, /* use as internal mic */
8678 { }
8679 },
8680 .chained = true,
8681 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8682 },
8683 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8684 .type = HDA_FIXUP_PINS,
8685 .v.pins = (const struct hda_pintbl[]) {
8686 { 0x16, 0x01011020 }, /* Rear Line out */
8687 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8688 { }
8689 },
8690 .chained = true,
8691 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8692 },
8693 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8694 .type = HDA_FIXUP_FUNC,
8695 .v.func = alc_fixup_auto_mute_via_amp,
8696 .chained = true,
8697 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8698 },
8699 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8700 .type = HDA_FIXUP_FUNC,
8701 .v.func = alc_fixup_disable_mic_vref,
8702 .chained = true,
8703 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8704 },
8705 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8706 .type = HDA_FIXUP_VERBS,
8707 .v.verbs = (const struct hda_verb[]) {
8708 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8709 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8710 { }
8711 },
8712 .chained = true,
8713 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8714 },
8715 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8716 .type = HDA_FIXUP_PINS,
8717 .v.pins = (const struct hda_pintbl[]) {
8718 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8719 { }
8720 },
8721 .chained = true,
8722 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8723 },
8724 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8725 .type = HDA_FIXUP_PINS,
8726 .v.pins = (const struct hda_pintbl[]) {
8727 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8728 { }
8729 },
8730 .chained = true,
8731 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8732 },
8733 [ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
8734 .type = HDA_FIXUP_PINS,
8735 .v.pins = (const struct hda_pintbl[]) {
8736 { 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
8737 { 0x1b, 0x90170152 } /* use as internal speaker (back) */
8738 }
8739 },
8740 [ALC299_FIXUP_PREDATOR_SPK] = {
8741 .type = HDA_FIXUP_PINS,
8742 .v.pins = (const struct hda_pintbl[]) {
8743 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8744 { }
8745 }
8746 },
8747 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8748 .type = HDA_FIXUP_PINS,
8749 .v.pins = (const struct hda_pintbl[]) {
8750 { 0x19, 0x04a11040 },
8751 { 0x21, 0x04211020 },
8752 { }
8753 },
8754 .chained = true,
8755 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8756 },
8757 [ALC289_FIXUP_DELL_SPK1] = {
8758 .type = HDA_FIXUP_PINS,
8759 .v.pins = (const struct hda_pintbl[]) {
8760 { 0x14, 0x90170140 },
8761 { }
8762 },
8763 .chained = true,
8764 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8765 },
8766 [ALC289_FIXUP_DELL_SPK2] = {
8767 .type = HDA_FIXUP_PINS,
8768 .v.pins = (const struct hda_pintbl[]) {
8769 { 0x17, 0x90170130 }, /* bass spk */
8770 { }
8771 },
8772 .chained = true,
8773 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8774 },
8775 [ALC289_FIXUP_DUAL_SPK] = {
8776 .type = HDA_FIXUP_FUNC,
8777 .v.func = alc285_fixup_speaker2_to_dac1,
8778 .chained = true,
8779 .chain_id = ALC289_FIXUP_DELL_SPK2
8780 },
8781 [ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8782 .type = HDA_FIXUP_FUNC,
8783 .v.func = alc285_fixup_speaker2_to_dac1,
8784 .chained = true,
8785 .chain_id = ALC289_FIXUP_DELL_SPK1
8786 },
8787 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8788 .type = HDA_FIXUP_FUNC,
8789 .v.func = alc285_fixup_speaker2_to_dac1,
8790 .chained = true,
8791 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8792 },
8793 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
8794 .type = HDA_FIXUP_FUNC,
8795 /* The GPIO must be pulled to initialize the AMP */
8796 .v.func = alc_fixup_gpio4,
8797 .chained = true,
8798 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8799 },
8800 [ALC294_FIXUP_ASUS_ALLY] = {
8801 .type = HDA_FIXUP_FUNC,
8802 .v.func = cs35l41_fixup_i2c_two,
8803 .chained = true,
8804 .chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8805 },
8806 [ALC294_FIXUP_ASUS_ALLY_PINS] = {
8807 .type = HDA_FIXUP_PINS,
8808 .v.pins = (const struct hda_pintbl[]) {
8809 { 0x19, 0x03a11050 },
8810 { 0x1a, 0x03a11c30 },
8811 { 0x21, 0x03211420 },
8812 { }
8813 },
8814 .chained = true,
8815 .chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8816 },
8817 [ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8818 .type = HDA_FIXUP_VERBS,
8819 .v.verbs = (const struct hda_verb[]) {
8820 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8821 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8822 { 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8823 { 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8824 { 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8825 { 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8826 { 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8827 { 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8828 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8829 { 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8830 { 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8831 { 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8832 { }
8833 },
8834 .chained = true,
8835 .chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8836 },
8837 [ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8838 .type = HDA_FIXUP_FUNC,
8839 .v.func = alc285_fixup_speaker2_to_dac1,
8840 },
8841 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8842 .type = HDA_FIXUP_FUNC,
8843 .v.func = alc285_fixup_thinkpad_x1_gen7,
8844 .chained = true,
8845 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8846 },
8847 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8848 .type = HDA_FIXUP_FUNC,
8849 .v.func = alc_fixup_headset_jack,
8850 .chained = true,
8851 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8852 },
8853 [ALC294_FIXUP_ASUS_HPE] = {
8854 .type = HDA_FIXUP_VERBS,
8855 .v.verbs = (const struct hda_verb[]) {
8856 /* Set EAPD high */
8857 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8858 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8859 { }
8860 },
8861 .chained = true,
8862 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8863 },
8864 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8865 .type = HDA_FIXUP_PINS,
8866 .v.pins = (const struct hda_pintbl[]) {
8867 { 0x19, 0x03a11050 }, /* front HP mic */
8868 { 0x1a, 0x01a11830 }, /* rear external mic */
8869 { 0x21, 0x03211020 }, /* front HP out */
8870 { }
8871 },
8872 .chained = true,
8873 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8874 },
8875 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8876 .type = HDA_FIXUP_VERBS,
8877 .v.verbs = (const struct hda_verb[]) {
8878 /* set 0x15 to HP-OUT ctrl */
8879 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8880 /* unmute the 0x15 amp */
8881 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8882 { }
8883 },
8884 .chained = true,
8885 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8886 },
8887 [ALC294_FIXUP_ASUS_GX502_HP] = {
8888 .type = HDA_FIXUP_FUNC,
8889 .v.func = alc294_fixup_gx502_hp,
8890 },
8891 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8892 .type = HDA_FIXUP_PINS,
8893 .v.pins = (const struct hda_pintbl[]) {
8894 { 0x19, 0x01a11050 }, /* rear HP mic */
8895 { 0x1a, 0x01a11830 }, /* rear external mic */
8896 { 0x21, 0x012110f0 }, /* rear HP out */
8897 { }
8898 },
8899 .chained = true,
8900 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8901 },
8902 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8903 .type = HDA_FIXUP_VERBS,
8904 .v.verbs = (const struct hda_verb[]) {
8905 /* set 0x15 to HP-OUT ctrl */
8906 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8907 /* unmute the 0x15 amp */
8908 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8909 /* set 0x1b to HP-OUT */
8910 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8911 { }
8912 },
8913 .chained = true,
8914 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8915 },
8916 [ALC294_FIXUP_ASUS_GU502_HP] = {
8917 .type = HDA_FIXUP_FUNC,
8918 .v.func = alc294_fixup_gu502_hp,
8919 },
8920 [ALC294_FIXUP_ASUS_G513_PINS] = {
8921 .type = HDA_FIXUP_PINS,
8922 .v.pins = (const struct hda_pintbl[]) {
8923 { 0x19, 0x03a11050 }, /* front HP mic */
8924 { 0x1a, 0x03a11c30 }, /* rear external mic */
8925 { 0x21, 0x03211420 }, /* front HP out */
8926 { }
8927 },
8928 },
8929 [ALC285_FIXUP_ASUS_G533Z_PINS] = {
8930 .type = HDA_FIXUP_PINS,
8931 .v.pins = (const struct hda_pintbl[]) {
8932 { 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8933 { 0x19, 0x03a19020 }, /* Mic Boost Volume */
8934 { 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8935 { 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8936 { 0x21, 0x03211420 },
8937 { }
8938 },
8939 },
8940 [ALC294_FIXUP_ASUS_COEF_1B] = {
8941 .type = HDA_FIXUP_VERBS,
8942 .v.verbs = (const struct hda_verb[]) {
8943 /* Set bit 10 to correct noisy output after reboot from
8944 * Windows 10 (due to pop noise reduction?)
8945 */
8946 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8947 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8948 { }
8949 },
8950 .chained = true,
8951 .chain_id = ALC289_FIXUP_ASUS_GA401,
8952 },
8953 [ALC285_FIXUP_HP_GPIO_LED] = {
8954 .type = HDA_FIXUP_FUNC,
8955 .v.func = alc285_fixup_hp_gpio_led,
8956 },
8957 [ALC285_FIXUP_HP_MUTE_LED] = {
8958 .type = HDA_FIXUP_FUNC,
8959 .v.func = alc285_fixup_hp_mute_led,
8960 },
8961 [ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8962 .type = HDA_FIXUP_FUNC,
8963 .v.func = alc285_fixup_hp_spectre_x360_mute_led,
8964 },
8965 [ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
8966 .type = HDA_FIXUP_FUNC,
8967 .v.func = alc236_fixup_hp_mute_led_coefbit2,
8968 },
8969 [ALC236_FIXUP_HP_GPIO_LED] = {
8970 .type = HDA_FIXUP_FUNC,
8971 .v.func = alc236_fixup_hp_gpio_led,
8972 },
8973 [ALC236_FIXUP_HP_MUTE_LED] = {
8974 .type = HDA_FIXUP_FUNC,
8975 .v.func = alc236_fixup_hp_mute_led,
8976 },
8977 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8978 .type = HDA_FIXUP_FUNC,
8979 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8980 },
8981 [ALC236_FIXUP_LENOVO_INV_DMIC] = {
8982 .type = HDA_FIXUP_FUNC,
8983 .v.func = alc_fixup_inv_dmic,
8984 .chained = true,
8985 .chain_id = ALC283_FIXUP_INT_MIC,
8986 },
8987 [ALC298_FIXUP_SAMSUNG_AMP] = {
8988 .type = HDA_FIXUP_FUNC,
8989 .v.func = alc298_fixup_samsung_amp,
8990 .chained = true,
8991 .chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8992 },
8993 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8994 .type = HDA_FIXUP_VERBS,
8995 .v.verbs = (const struct hda_verb[]) {
8996 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8997 { }
8998 },
8999 },
9000 [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9001 .type = HDA_FIXUP_VERBS,
9002 .v.verbs = (const struct hda_verb[]) {
9003 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9004 { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9005 { }
9006 },
9007 },
9008 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9009 .type = HDA_FIXUP_PINS,
9010 .v.pins = (const struct hda_pintbl[]) {
9011 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9012 { }
9013 },
9014 .chained = true,
9015 .chain_id = ALC269_FIXUP_HEADSET_MODE
9016 },
9017 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9018 .type = HDA_FIXUP_PINS,
9019 .v.pins = (const struct hda_pintbl[]) {
9020 { 0x14, 0x90100120 }, /* use as internal speaker */
9021 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9022 { 0x1a, 0x01011020 }, /* use as line out */
9023 { },
9024 },
9025 .chained = true,
9026 .chain_id = ALC269_FIXUP_HEADSET_MIC
9027 },
9028 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9029 .type = HDA_FIXUP_PINS,
9030 .v.pins = (const struct hda_pintbl[]) {
9031 { 0x18, 0x02a11030 }, /* use as headset mic */
9032 { }
9033 },
9034 .chained = true,
9035 .chain_id = ALC269_FIXUP_HEADSET_MIC
9036 },
9037 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9038 .type = HDA_FIXUP_PINS,
9039 .v.pins = (const struct hda_pintbl[]) {
9040 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9041 { }
9042 },
9043 .chained = true,
9044 .chain_id = ALC269_FIXUP_HEADSET_MIC
9045 },
9046 [ALC289_FIXUP_ASUS_GA401] = {
9047 .type = HDA_FIXUP_FUNC,
9048 .v.func = alc289_fixup_asus_ga401,
9049 .chained = true,
9050 .chain_id = ALC289_FIXUP_ASUS_GA502,
9051 },
9052 [ALC289_FIXUP_ASUS_GA502] = {
9053 .type = HDA_FIXUP_PINS,
9054 .v.pins = (const struct hda_pintbl[]) {
9055 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
9056 { }
9057 },
9058 },
9059 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9060 .type = HDA_FIXUP_PINS,
9061 .v.pins = (const struct hda_pintbl[]) {
9062 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9063 { }
9064 },
9065 .chained = true,
9066 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9067 },
9068 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9069 .type = HDA_FIXUP_FUNC,
9070 .v.func = alc285_fixup_hp_gpio_amp_init,
9071 .chained = true,
9072 .chain_id = ALC285_FIXUP_HP_GPIO_LED
9073 },
9074 [ALC269_FIXUP_CZC_B20] = {
9075 .type = HDA_FIXUP_PINS,
9076 .v.pins = (const struct hda_pintbl[]) {
9077 { 0x12, 0x411111f0 },
9078 { 0x14, 0x90170110 }, /* speaker */
9079 { 0x15, 0x032f1020 }, /* HP out */
9080 { 0x17, 0x411111f0 },
9081 { 0x18, 0x03ab1040 }, /* mic */
9082 { 0x19, 0xb7a7013f },
9083 { 0x1a, 0x0181305f },
9084 { 0x1b, 0x411111f0 },
9085 { 0x1d, 0x411111f0 },
9086 { 0x1e, 0x411111f0 },
9087 { }
9088 },
9089 .chain_id = ALC269_FIXUP_DMIC,
9090 },
9091 [ALC269_FIXUP_CZC_TMI] = {
9092 .type = HDA_FIXUP_PINS,
9093 .v.pins = (const struct hda_pintbl[]) {
9094 { 0x12, 0x4000c000 },
9095 { 0x14, 0x90170110 }, /* speaker */
9096 { 0x15, 0x0421401f }, /* HP out */
9097 { 0x17, 0x411111f0 },
9098 { 0x18, 0x04a19020 }, /* mic */
9099 { 0x19, 0x411111f0 },
9100 { 0x1a, 0x411111f0 },
9101 { 0x1b, 0x411111f0 },
9102 { 0x1d, 0x40448505 },
9103 { 0x1e, 0x411111f0 },
9104 { 0x20, 0x8000ffff },
9105 { }
9106 },
9107 .chain_id = ALC269_FIXUP_DMIC,
9108 },
9109 [ALC269_FIXUP_CZC_L101] = {
9110 .type = HDA_FIXUP_PINS,
9111 .v.pins = (const struct hda_pintbl[]) {
9112 { 0x12, 0x40000000 },
9113 { 0x14, 0x01014010 }, /* speaker */
9114 { 0x15, 0x411111f0 }, /* HP out */
9115 { 0x16, 0x411111f0 },
9116 { 0x18, 0x01a19020 }, /* mic */
9117 { 0x19, 0x02a19021 },
9118 { 0x1a, 0x0181302f },
9119 { 0x1b, 0x0221401f },
9120 { 0x1c, 0x411111f0 },
9121 { 0x1d, 0x4044c601 },
9122 { 0x1e, 0x411111f0 },
9123 { }
9124 },
9125 .chain_id = ALC269_FIXUP_DMIC,
9126 },
9127 [ALC269_FIXUP_LEMOTE_A1802] = {
9128 .type = HDA_FIXUP_PINS,
9129 .v.pins = (const struct hda_pintbl[]) {
9130 { 0x12, 0x40000000 },
9131 { 0x14, 0x90170110 }, /* speaker */
9132 { 0x17, 0x411111f0 },
9133 { 0x18, 0x03a19040 }, /* mic1 */
9134 { 0x19, 0x90a70130 }, /* mic2 */
9135 { 0x1a, 0x411111f0 },
9136 { 0x1b, 0x411111f0 },
9137 { 0x1d, 0x40489d2d },
9138 { 0x1e, 0x411111f0 },
9139 { 0x20, 0x0003ffff },
9140 { 0x21, 0x03214020 },
9141 { }
9142 },
9143 .chain_id = ALC269_FIXUP_DMIC,
9144 },
9145 [ALC269_FIXUP_LEMOTE_A190X] = {
9146 .type = HDA_FIXUP_PINS,
9147 .v.pins = (const struct hda_pintbl[]) {
9148 { 0x14, 0x99130110 }, /* speaker */
9149 { 0x15, 0x0121401f }, /* HP out */
9150 { 0x18, 0x01a19c20 }, /* rear mic */
9151 { 0x19, 0x99a3092f }, /* front mic */
9152 { 0x1b, 0x0201401f }, /* front lineout */
9153 { }
9154 },
9155 .chain_id = ALC269_FIXUP_DMIC,
9156 },
9157 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9158 .type = HDA_FIXUP_PINS,
9159 .v.pins = (const struct hda_pintbl[]) {
9160 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9161 { }
9162 },
9163 .chained = true,
9164 .chain_id = ALC269_FIXUP_HEADSET_MODE
9165 },
9166 [ALC256_FIXUP_INTEL_NUC10] = {
9167 .type = HDA_FIXUP_PINS,
9168 .v.pins = (const struct hda_pintbl[]) {
9169 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9170 { }
9171 },
9172 .chained = true,
9173 .chain_id = ALC269_FIXUP_HEADSET_MODE
9174 },
9175 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9176 .type = HDA_FIXUP_VERBS,
9177 .v.verbs = (const struct hda_verb[]) {
9178 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9179 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9180 { }
9181 },
9182 .chained = true,
9183 .chain_id = ALC289_FIXUP_ASUS_GA502
9184 },
9185 [ALC274_FIXUP_HP_MIC] = {
9186 .type = HDA_FIXUP_VERBS,
9187 .v.verbs = (const struct hda_verb[]) {
9188 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9189 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9190 { }
9191 },
9192 },
9193 [ALC274_FIXUP_HP_HEADSET_MIC] = {
9194 .type = HDA_FIXUP_FUNC,
9195 .v.func = alc274_fixup_hp_headset_mic,
9196 .chained = true,
9197 .chain_id = ALC274_FIXUP_HP_MIC
9198 },
9199 [ALC274_FIXUP_HP_ENVY_GPIO] = {
9200 .type = HDA_FIXUP_FUNC,
9201 .v.func = alc274_fixup_hp_envy_gpio,
9202 },
9203 [ALC256_FIXUP_ASUS_HPE] = {
9204 .type = HDA_FIXUP_VERBS,
9205 .v.verbs = (const struct hda_verb[]) {
9206 /* Set EAPD high */
9207 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9208 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9209 { }
9210 },
9211 .chained = true,
9212 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9213 },
9214 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9215 .type = HDA_FIXUP_FUNC,
9216 .v.func = alc_fixup_headset_jack,
9217 .chained = true,
9218 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
9219 },
9220 [ALC287_FIXUP_HP_GPIO_LED] = {
9221 .type = HDA_FIXUP_FUNC,
9222 .v.func = alc287_fixup_hp_gpio_led,
9223 },
9224 [ALC256_FIXUP_HP_HEADSET_MIC] = {
9225 .type = HDA_FIXUP_FUNC,
9226 .v.func = alc274_fixup_hp_headset_mic,
9227 },
9228 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9229 .type = HDA_FIXUP_FUNC,
9230 .v.func = alc_fixup_no_int_mic,
9231 .chained = true,
9232 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9233 },
9234 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9235 .type = HDA_FIXUP_PINS,
9236 .v.pins = (const struct hda_pintbl[]) {
9237 { 0x1b, 0x411111f0 },
9238 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9239 { },
9240 },
9241 .chained = true,
9242 .chain_id = ALC269_FIXUP_HEADSET_MODE
9243 },
9244 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9245 .type = HDA_FIXUP_FUNC,
9246 .v.func = alc269_fixup_limit_int_mic_boost,
9247 .chained = true,
9248 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9249 },
9250 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
9251 .type = HDA_FIXUP_PINS,
9252 .v.pins = (const struct hda_pintbl[]) {
9253 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9254 { 0x1a, 0x90a1092f }, /* use as internal mic */
9255 { }
9256 },
9257 .chained = true,
9258 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9259 },
9260 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9261 .type = HDA_FIXUP_FUNC,
9262 .v.func = alc285_fixup_ideapad_s740_coef,
9263 .chained = true,
9264 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9265 },
9266 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9267 .type = HDA_FIXUP_FUNC,
9268 .v.func = alc269_fixup_limit_int_mic_boost,
9269 .chained = true,
9270 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9271 },
9272 [ALC295_FIXUP_ASUS_DACS] = {
9273 .type = HDA_FIXUP_FUNC,
9274 .v.func = alc295_fixup_asus_dacs,
9275 },
9276 [ALC295_FIXUP_HP_OMEN] = {
9277 .type = HDA_FIXUP_PINS,
9278 .v.pins = (const struct hda_pintbl[]) {
9279 { 0x12, 0xb7a60130 },
9280 { 0x13, 0x40000000 },
9281 { 0x14, 0x411111f0 },
9282 { 0x16, 0x411111f0 },
9283 { 0x17, 0x90170110 },
9284 { 0x18, 0x411111f0 },
9285 { 0x19, 0x02a11030 },
9286 { 0x1a, 0x411111f0 },
9287 { 0x1b, 0x04a19030 },
9288 { 0x1d, 0x40600001 },
9289 { 0x1e, 0x411111f0 },
9290 { 0x21, 0x03211020 },
9291 {}
9292 },
9293 .chained = true,
9294 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9295 },
9296 [ALC285_FIXUP_HP_SPECTRE_X360] = {
9297 .type = HDA_FIXUP_FUNC,
9298 .v.func = alc285_fixup_hp_spectre_x360,
9299 },
9300 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9301 .type = HDA_FIXUP_FUNC,
9302 .v.func = alc285_fixup_hp_spectre_x360_eb1
9303 },
9304 [ALC285_FIXUP_HP_ENVY_X360] = {
9305 .type = HDA_FIXUP_FUNC,
9306 .v.func = alc285_fixup_hp_envy_x360,
9307 .chained = true,
9308 .chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9309 },
9310 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9311 .type = HDA_FIXUP_FUNC,
9312 .v.func = alc285_fixup_ideapad_s740_coef,
9313 .chained = true,
9314 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9315 },
9316 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9317 .type = HDA_FIXUP_FUNC,
9318 .v.func = alc_fixup_no_shutup,
9319 .chained = true,
9320 .chain_id = ALC283_FIXUP_HEADSET_MIC,
9321 },
9322 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9323 .type = HDA_FIXUP_PINS,
9324 .v.pins = (const struct hda_pintbl[]) {
9325 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9326 { }
9327 },
9328 .chained = true,
9329 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9330 },
9331 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9332 .type = HDA_FIXUP_FUNC,
9333 .v.func = alc269_fixup_limit_int_mic_boost,
9334 .chained = true,
9335 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9336 },
9337 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9338 .type = HDA_FIXUP_FUNC,
9339 .v.func = alc285_fixup_ideapad_s740_coef,
9340 .chained = true,
9341 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9342 },
9343 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9344 .type = HDA_FIXUP_FUNC,
9345 .v.func = alc287_fixup_legion_15imhg05_speakers,
9346 .chained = true,
9347 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9348 },
9349 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9350 .type = HDA_FIXUP_VERBS,
9351 //.v.verbs = legion_15imhg05_coefs,
9352 .v.verbs = (const struct hda_verb[]) {
9353 // set left speaker Legion 7i.
9354 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9355 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9356
9357 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9358 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9359 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9360 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9361 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9362
9363 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9364 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9365 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9366 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9367 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9368
9369 // set right speaker Legion 7i.
9370 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9371 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9372
9373 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9374 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9375 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9376 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9377 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9378
9379 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9380 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9381 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9382 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9383 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9384 {}
9385 },
9386 .chained = true,
9387 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9388 },
9389 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9390 .type = HDA_FIXUP_FUNC,
9391 .v.func = alc287_fixup_legion_15imhg05_speakers,
9392 .chained = true,
9393 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9394 },
9395 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9396 .type = HDA_FIXUP_VERBS,
9397 .v.verbs = (const struct hda_verb[]) {
9398 // set left speaker Yoga 7i.
9399 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9400 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9401
9402 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9403 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9404 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9405 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9406 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9407
9408 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9409 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9410 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9411 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9412 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9413
9414 // set right speaker Yoga 7i.
9415 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9416 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9417
9418 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9419 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9420 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9421 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9422 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9423
9424 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9425 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9426 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9427 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9428 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9429 {}
9430 },
9431 .chained = true,
9432 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9433 },
9434 [ALC298_FIXUP_LENOVO_C940_DUET7] = {
9435 .type = HDA_FIXUP_FUNC,
9436 .v.func = alc298_fixup_lenovo_c940_duet7,
9437 },
9438 [ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9439 .type = HDA_FIXUP_FUNC,
9440 .v.func = alc287_fixup_lenovo_14irp8_duetitl,
9441 },
9442 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9443 .type = HDA_FIXUP_VERBS,
9444 .v.verbs = (const struct hda_verb[]) {
9445 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9446 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9447 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9448 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9449 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9450 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9451 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9452 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9453 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9454 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9455 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9456 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9457 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9458 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9459 {}
9460 },
9461 .chained = true,
9462 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9463 },
9464 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9465 .type = HDA_FIXUP_FUNC,
9466 .v.func = alc256_fixup_set_coef_defaults,
9467 },
9468 [ALC245_FIXUP_HP_GPIO_LED] = {
9469 .type = HDA_FIXUP_FUNC,
9470 .v.func = alc245_fixup_hp_gpio_led,
9471 },
9472 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9473 .type = HDA_FIXUP_PINS,
9474 .v.pins = (const struct hda_pintbl[]) {
9475 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9476 { }
9477 },
9478 .chained = true,
9479 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9480 },
9481 [ALC233_FIXUP_NO_AUDIO_JACK] = {
9482 .type = HDA_FIXUP_FUNC,
9483 .v.func = alc233_fixup_no_audio_jack,
9484 },
9485 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9486 .type = HDA_FIXUP_FUNC,
9487 .v.func = alc256_fixup_mic_no_presence_and_resume,
9488 .chained = true,
9489 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9490 },
9491 [ALC287_FIXUP_LEGION_16ACHG6] = {
9492 .type = HDA_FIXUP_FUNC,
9493 .v.func = alc287_fixup_legion_16achg6_speakers,
9494 },
9495 [ALC287_FIXUP_CS35L41_I2C_2] = {
9496 .type = HDA_FIXUP_FUNC,
9497 .v.func = cs35l41_fixup_i2c_two,
9498 },
9499 [ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9500 .type = HDA_FIXUP_FUNC,
9501 .v.func = cs35l41_fixup_i2c_two,
9502 .chained = true,
9503 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9504 },
9505 [ALC245_FIXUP_CS35L41_SPI_2] = {
9506 .type = HDA_FIXUP_FUNC,
9507 .v.func = cs35l41_fixup_spi_two,
9508 },
9509 [ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9510 .type = HDA_FIXUP_FUNC,
9511 .v.func = cs35l41_fixup_spi_two,
9512 .chained = true,
9513 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9514 },
9515 [ALC245_FIXUP_CS35L41_SPI_4] = {
9516 .type = HDA_FIXUP_FUNC,
9517 .v.func = cs35l41_fixup_spi_four,
9518 },
9519 [ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9520 .type = HDA_FIXUP_FUNC,
9521 .v.func = cs35l41_fixup_spi_four,
9522 .chained = true,
9523 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9524 },
9525 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9526 .type = HDA_FIXUP_VERBS,
9527 .v.verbs = (const struct hda_verb[]) {
9528 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9529 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9530 { }
9531 },
9532 .chained = true,
9533 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9534 },
9535 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9536 .type = HDA_FIXUP_FUNC,
9537 .v.func = alc_fixup_dell4_mic_no_presence_quiet,
9538 .chained = true,
9539 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9540 },
9541 [ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9542 .type = HDA_FIXUP_PINS,
9543 .v.pins = (const struct hda_pintbl[]) {
9544 { 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9545 { }
9546 },
9547 .chained = true,
9548 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9549 },
9550 [ALC287_FIXUP_LEGION_16ITHG6] = {
9551 .type = HDA_FIXUP_FUNC,
9552 .v.func = alc287_fixup_legion_16ithg6_speakers,
9553 },
9554 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9555 .type = HDA_FIXUP_VERBS,
9556 .v.verbs = (const struct hda_verb[]) {
9557 // enable left speaker
9558 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9559 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9560
9561 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9562 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9563 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9564 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9565 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9566
9567 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9568 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9569 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9570 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9571 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9572
9573 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9574 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9575 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9576 { 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9577 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9578
9579 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9580 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9581 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9582 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9583 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9584
9585 // enable right speaker
9586 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9587 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9588
9589 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9590 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9591 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9592 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9593 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9594
9595 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9596 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9597 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9598 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9599 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9600
9601 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9602 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9603 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9604 { 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9605 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9606
9607 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9608 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9609 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9610 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9611 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9612
9613 { },
9614 },
9615 },
9616 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9617 .type = HDA_FIXUP_FUNC,
9618 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9619 .chained = true,
9620 .chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9621 },
9622 [ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9623 .type = HDA_FIXUP_FUNC,
9624 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9625 .chained = true,
9626 .chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9627 },
9628 [ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9629 .type = HDA_FIXUP_FUNC,
9630 .v.func = alc295_fixup_dell_inspiron_top_speakers,
9631 .chained = true,
9632 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9633 },
9634 [ALC236_FIXUP_DELL_DUAL_CODECS] = {
9635 .type = HDA_FIXUP_PINS,
9636 .v.func = alc1220_fixup_gb_dual_codecs,
9637 .chained = true,
9638 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9639 },
9640 [ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9641 .type = HDA_FIXUP_FUNC,
9642 .v.func = cs35l41_fixup_i2c_two,
9643 .chained = true,
9644 .chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9645 },
9646 [ALC287_FIXUP_TAS2781_I2C] = {
9647 .type = HDA_FIXUP_FUNC,
9648 .v.func = tas2781_fixup_i2c,
9649 .chained = true,
9650 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9651 },
9652 [ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9653 .type = HDA_FIXUP_FUNC,
9654 .v.func = alc245_fixup_hp_mute_led_coefbit,
9655 },
9656 [ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9657 .type = HDA_FIXUP_FUNC,
9658 .v.func = alc245_fixup_hp_mute_led_coefbit,
9659 .chained = true,
9660 .chain_id = ALC245_FIXUP_HP_GPIO_LED
9661 },
9662 [ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9663 .type = HDA_FIXUP_FUNC,
9664 .v.func = alc287_fixup_bind_dacs,
9665 .chained = true,
9666 .chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9667 },
9668 [ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9669 .type = HDA_FIXUP_FUNC,
9670 .v.func = alc287_fixup_bind_dacs,
9671 .chained = true,
9672 .chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9673 },
9674 [ALC2XX_FIXUP_HEADSET_MIC] = {
9675 .type = HDA_FIXUP_FUNC,
9676 .v.func = alc_fixup_headset_mic,
9677 },
9678 [ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9679 .type = HDA_FIXUP_FUNC,
9680 .v.func = cs35l41_fixup_spi_two,
9681 .chained = true,
9682 .chain_id = ALC289_FIXUP_DUAL_SPK
9683 },
9684 [ALC294_FIXUP_CS35L41_I2C_2] = {
9685 .type = HDA_FIXUP_FUNC,
9686 .v.func = cs35l41_fixup_i2c_two,
9687 },
9688 };
9689
9690 static const struct hda_quirk alc269_fixup_tbl[] = {
9691 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9692 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9693 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9694 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9695 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9696 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9697 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9698 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9699 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9700 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9701 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9702 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9703 SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9704 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9705 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9706 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9707 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9708 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9709 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9710 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9711 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9712 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9713 SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9714 SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9715 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9716 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9717 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9718 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9719 SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9720 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9721 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9722 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9723 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9724 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9725 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9726 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9727 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9728 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9729 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9730 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9731 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9732 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9733 SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9734 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9735 SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9736 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9737 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9738 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9739 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9740 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9741 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9742 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9743 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9744 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9745 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9746 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9747 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9748 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9749 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9750 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9751 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9752 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9753 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9754 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9755 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9756 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9757 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9758 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9759 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9760 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9761 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9762 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9763 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9764 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9765 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9766 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9767 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9768 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9769 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9770 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9771 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9772 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9773 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9774 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9775 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9776 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9777 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9778 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9779 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9780 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9781 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9782 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9783 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9784 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9785 SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9786 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9787 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9788 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9789 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9790 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9791 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9792 SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9793 SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9794 SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9795 SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9796 SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9797 SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9798 SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9799 SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9800 SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9801 SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9802 SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9803 SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9804 SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9805 SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9806 SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9807 SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9808 SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9809 SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9810 SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9811 SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9812 SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9813 SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9814 SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9815 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9816 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9817 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9818 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9819 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9820 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9821 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9822 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9823 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9824 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9825 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9826 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9827 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9828 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9829 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9830 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9831 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9832 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9833 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9834 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9835 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9836 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9837 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9838 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9839 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9840 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9841 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9842 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9843 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9844 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9845 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9846 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9847 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9848 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9849 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9850 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9851 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9852 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9853 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9854 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9855 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9856 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9857 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9858 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9859 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9860 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9861 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9862 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9863 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9864 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9865 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9866 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9867 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9868 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9869 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9870 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9871 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9872 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9873 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9874 SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9875 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9876 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9877 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9878 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9879 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9880 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9881 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9882 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9883 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9884 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9885 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9886 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9887 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9888 SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9889 SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9890 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9891 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9892 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9893 SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9894 SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
9895 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9896 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9897 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9898 SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9899 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9900 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9901 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9902 SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9903 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9904 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9905 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9906 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9907 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9908 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9909 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9910 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9911 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9912 SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9913 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9914 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9915 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9916 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9917 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9918 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9919 SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9920 SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9921 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9922 SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9923 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9924 SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9925 SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9926 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9927 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9928 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9929 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9930 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9931 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9932 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9933 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9934 SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9935 SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9936 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9937 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9938 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9939 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9940 SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9941 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9942 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9943 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9944 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9945 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9946 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9947 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9948 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9949 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9950 SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9951 SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9952 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9953 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9954 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9955 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9956 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9957 SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
9958 SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9959 SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9960 SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
9961 SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9962 SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9963 SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9964 SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9965 SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9966 SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9967 SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9968 SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
9969 SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9970 SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9971 SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9972 SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9973 SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
9974 SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9975 SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
9976 SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9977 SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
9978 SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9979 SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9980 SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9981 SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9982 SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9983 SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9984 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9985 SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9986 SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
9987 SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9988 SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
9989 SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9990 SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9991 SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9992 SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9993 SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
9994 SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
9995 SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9996 SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9997 SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9998 SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9999 SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10000 SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10001 SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10002 SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10003 SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10004 SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10005 SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10006 SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10007 SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10008 SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10009 SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10010 SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10011 SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10012 SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10013 SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10014 SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10015 SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10016 SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10017 SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10018 SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10019 SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10020 SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10021 SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10022 SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10023 SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10024 SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10025 SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10026 SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10027 SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10028 SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10029 SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10030 SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10031 SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10032 SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10033 SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10034 SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10035 SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10036 SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10037 SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10038 SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10039 SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10040 SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10041 SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10042 SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10043 SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10044 SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10045 SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10046 SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10047 SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10048 SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10049 SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10050 SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10051 SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10052 SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10053 SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10054 SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10055 SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10056 SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10057 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10058 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10059 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10060 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10061 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10062 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10063 SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10064 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10065 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10066 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10067 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10068 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10069 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10070 SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10071 SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10072 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10073 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10074 SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10075 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10076 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10077 SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10078 SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10079 SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10080 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10081 SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10082 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10083 SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA", ALC287_FIXUP_CS35L41_I2C_2),
10084 SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10085 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10086 SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10087 SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10088 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10089 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10090 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10091 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10092 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10093 SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally RC71L_RC71L", ALC294_FIXUP_ASUS_ALLY),
10094 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10095 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10096 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10097 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10098 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10099 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10100 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10101 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10102 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10103 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10104 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
10105 SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10106 SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10107 SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10108 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10109 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
10110 SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10111 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10112 SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10113 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10114 SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10115 SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10116 SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10117 SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10118 SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10119 SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10120 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10121 SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
10122 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10123 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10124 SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10125 SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10126 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10127 SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10128 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10129 SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10130 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10131 SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10132 SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10133 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10134 SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10135 SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10136 SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10137 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10138 SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
10139 SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10140 SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10141 SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10142 SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10143 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10144 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10145 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10146 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10147 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10148 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10149 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10150 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10151 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10152 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10153 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10154 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10155 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10156 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10157 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10158 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10159 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10160 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10161 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10162 SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10163 SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10164 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10165 SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10166 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10167 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10168 SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10169 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10170 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10171 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10172 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10173 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10174 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10175 SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10176 SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10177 SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10178 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10179 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10180 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10181 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10182 SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10183 SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10184 SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10185 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10186 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10187 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10188 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10189 SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10190 SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10191 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10192 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10193 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10194 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10195 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10196 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10197 SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10198 SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
10199 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10200 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10201 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10202 SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10203 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10204 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10205 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10206 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10207 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10208 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10209 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10210 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10211 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10212 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10213 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10214 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10215 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10216 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10217 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10218 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10219 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10220 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10221 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10222 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10223 SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10224 SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10225 SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10226 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10227 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10228 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10229 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10230 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10231 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10232 SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10233 SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10234 SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10235 SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10236 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10237 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10238 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10239 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10240 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10241 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10242 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10243 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10244 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10245 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10246 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10247 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10248 SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10249 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10250 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10251 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10252 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10253 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10254 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10255 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10256 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10257 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10258 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10259 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10260 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10261 SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10262 SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10263 SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10264 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10265 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10266 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10267 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10268 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10269 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10270 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10271 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10272 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10273 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10274 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10275 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10276 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10277 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10278 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10279 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10280 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10281 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10282 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10283 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10284 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10285 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10286 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10287 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10288 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10289 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10290 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10291 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10292 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10293 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10294 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10295 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10296 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10297 SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10298 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10299 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10300 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10301 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10302 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10303 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10304 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10305 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10306 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10307 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10308 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10309 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10310 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10311 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10312 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10313 SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10314 SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10315 SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10316 SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10317 SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10318 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10319 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10320 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10321 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10322 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10323 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10324 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10325 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10326 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10327 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10328 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10329 SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10330 SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10331 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10332 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10333 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10334 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10335 SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10336 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10337 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10338 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10339 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10340 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10341 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10342 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10343 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10344 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10345 SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10346 SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10347 SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10348 SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10349 SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10350 SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10351 SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10352 SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10353 SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10354 SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10355 SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10356 SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10357 SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10358 SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10359 SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10360 SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10361 SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10362 SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10363 SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10364 SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10365 SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10366 SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10367 SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10368 SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10369 SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10370 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10371 SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
10372 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10373 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10374 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10375 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10376 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10377 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10378 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10379 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10380 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10381 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10382 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10383 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10384 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10385 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10386 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10387 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10388 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10389 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10390 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10391 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10392 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10393 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10394 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10395 SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10396 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10397 SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10398 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10399 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10400 SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
10401 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10402 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10403 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10404 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10405 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10406 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10407 SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10408 SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10409 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10410 SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10411 SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10412 SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10413 SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10414 SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10415 SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10416 SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10417 SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10418 SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10419 SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10420 SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10421 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10422 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10423 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10424 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10425 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10426 SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10427 SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
10428 SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10429 SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX),
10430 SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX),
10431 SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
10432 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10433 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10434 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10435 SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10436 SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10437 SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10438 SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10439
10440 #if 0
10441 /* Below is a quirk table taken from the old code.
10442 * Basically the device should work as is without the fixup table.
10443 * If BIOS doesn't give a proper info, enable the corresponding
10444 * fixup entry.
10445 */
10446 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10447 ALC269_FIXUP_AMIC),
10448 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10449 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10450 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10451 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10452 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10453 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10454 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10455 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10456 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10457 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10458 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10459 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10460 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10461 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10462 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10463 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10464 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10465 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10466 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10467 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10468 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10469 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10470 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10471 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10472 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10473 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10474 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10475 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10476 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10477 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10478 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10479 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10480 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10481 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10482 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10483 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10484 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10485 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10486 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10487 #endif
10488 {}
10489 };
10490
10491 static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
10492 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10493 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10494 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10495 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10496 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10497 {}
10498 };
10499
10500 static const struct hda_model_fixup alc269_fixup_models[] = {
10501 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10502 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10503 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10504 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10505 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10506 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10507 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10508 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10509 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10510 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10511 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10512 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10513 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10514 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10515 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10516 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10517 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
10518 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10519 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10520 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10521 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10522 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10523 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10524 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10525 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10526 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10527 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10528 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10529 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10530 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10531 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10532 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10533 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10534 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10535 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10536 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10537 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10538 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10539 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10540 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10541 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10542 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10543 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10544 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10545 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10546 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10547 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10548 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10549 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10550 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10551 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10552 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10553 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10554 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10555 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10556 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10557 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10558 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10559 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10560 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10561 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10562 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10563 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10564 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10565 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10566 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10567 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10568 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10569 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10570 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10571 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10572 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10573 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10574 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10575 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10576 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10577 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10578 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10579 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10580 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10581 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10582 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10583 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10584 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10585 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10586 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10587 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10588 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10589 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10590 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10591 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10592 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10593 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10594 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10595 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10596 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10597 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10598 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10599 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10600 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10601 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10602 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10603 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10604 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10605 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10606 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10607 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10608 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10609 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10610 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10611 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10612 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10613 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10614 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10615 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10616 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10617 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10618 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10619 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10620 {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
10621 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10622 {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10623 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10624 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10625 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10626 {.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
10627 {}
10628 };
10629 #define ALC225_STANDARD_PINS \
10630 {0x21, 0x04211020}
10631
10632 #define ALC256_STANDARD_PINS \
10633 {0x12, 0x90a60140}, \
10634 {0x14, 0x90170110}, \
10635 {0x21, 0x02211020}
10636
10637 #define ALC282_STANDARD_PINS \
10638 {0x14, 0x90170110}
10639
10640 #define ALC290_STANDARD_PINS \
10641 {0x12, 0x99a30130}
10642
10643 #define ALC292_STANDARD_PINS \
10644 {0x14, 0x90170110}, \
10645 {0x15, 0x0221401f}
10646
10647 #define ALC295_STANDARD_PINS \
10648 {0x12, 0xb7a60130}, \
10649 {0x14, 0x90170110}, \
10650 {0x21, 0x04211020}
10651
10652 #define ALC298_STANDARD_PINS \
10653 {0x12, 0x90a60130}, \
10654 {0x21, 0x03211020}
10655
10656 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10657 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10658 {0x14, 0x01014020},
10659 {0x17, 0x90170110},
10660 {0x18, 0x02a11030},
10661 {0x19, 0x0181303F},
10662 {0x21, 0x0221102f}),
10663 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10664 {0x12, 0x90a601c0},
10665 {0x14, 0x90171120},
10666 {0x21, 0x02211030}),
10667 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10668 {0x14, 0x90170110},
10669 {0x1b, 0x90a70130},
10670 {0x21, 0x03211020}),
10671 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10672 {0x1a, 0x90a70130},
10673 {0x1b, 0x90170110},
10674 {0x21, 0x03211020}),
10675 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10676 ALC225_STANDARD_PINS,
10677 {0x12, 0xb7a60130},
10678 {0x14, 0x901701a0}),
10679 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10680 ALC225_STANDARD_PINS,
10681 {0x12, 0xb7a60130},
10682 {0x14, 0x901701b0}),
10683 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10684 ALC225_STANDARD_PINS,
10685 {0x12, 0xb7a60150},
10686 {0x14, 0x901701a0}),
10687 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10688 ALC225_STANDARD_PINS,
10689 {0x12, 0xb7a60150},
10690 {0x14, 0x901701b0}),
10691 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10692 ALC225_STANDARD_PINS,
10693 {0x12, 0xb7a60130},
10694 {0x1b, 0x90170110}),
10695 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10696 {0x1b, 0x01111010},
10697 {0x1e, 0x01451130},
10698 {0x21, 0x02211020}),
10699 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10700 {0x12, 0x90a60140},
10701 {0x14, 0x90170110},
10702 {0x19, 0x02a11030},
10703 {0x21, 0x02211020}),
10704 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10705 {0x14, 0x90170110},
10706 {0x19, 0x02a11030},
10707 {0x1a, 0x02a11040},
10708 {0x1b, 0x01014020},
10709 {0x21, 0x0221101f}),
10710 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10711 {0x14, 0x90170110},
10712 {0x19, 0x02a11030},
10713 {0x1a, 0x02a11040},
10714 {0x1b, 0x01011020},
10715 {0x21, 0x0221101f}),
10716 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10717 {0x14, 0x90170110},
10718 {0x19, 0x02a11020},
10719 {0x1a, 0x02a11030},
10720 {0x21, 0x0221101f}),
10721 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10722 {0x21, 0x02211010}),
10723 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10724 {0x14, 0x90170110},
10725 {0x19, 0x02a11020},
10726 {0x21, 0x02211030}),
10727 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10728 {0x14, 0x90170110},
10729 {0x21, 0x02211020}),
10730 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10731 {0x14, 0x90170130},
10732 {0x21, 0x02211040}),
10733 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10734 {0x12, 0x90a60140},
10735 {0x14, 0x90170110},
10736 {0x21, 0x02211020}),
10737 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10738 {0x12, 0x90a60160},
10739 {0x14, 0x90170120},
10740 {0x21, 0x02211030}),
10741 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10742 {0x14, 0x90170110},
10743 {0x1b, 0x02011020},
10744 {0x21, 0x0221101f}),
10745 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10746 {0x14, 0x90170110},
10747 {0x1b, 0x01011020},
10748 {0x21, 0x0221101f}),
10749 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10750 {0x14, 0x90170130},
10751 {0x1b, 0x01014020},
10752 {0x21, 0x0221103f}),
10753 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10754 {0x14, 0x90170130},
10755 {0x1b, 0x01011020},
10756 {0x21, 0x0221103f}),
10757 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10758 {0x14, 0x90170130},
10759 {0x1b, 0x02011020},
10760 {0x21, 0x0221103f}),
10761 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10762 {0x14, 0x90170150},
10763 {0x1b, 0x02011020},
10764 {0x21, 0x0221105f}),
10765 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10766 {0x14, 0x90170110},
10767 {0x1b, 0x01014020},
10768 {0x21, 0x0221101f}),
10769 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10770 {0x12, 0x90a60160},
10771 {0x14, 0x90170120},
10772 {0x17, 0x90170140},
10773 {0x21, 0x0321102f}),
10774 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10775 {0x12, 0x90a60160},
10776 {0x14, 0x90170130},
10777 {0x21, 0x02211040}),
10778 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10779 {0x12, 0x90a60160},
10780 {0x14, 0x90170140},
10781 {0x21, 0x02211050}),
10782 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10783 {0x12, 0x90a60170},
10784 {0x14, 0x90170120},
10785 {0x21, 0x02211030}),
10786 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10787 {0x12, 0x90a60170},
10788 {0x14, 0x90170130},
10789 {0x21, 0x02211040}),
10790 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10791 {0x12, 0x90a60170},
10792 {0x14, 0x90171130},
10793 {0x21, 0x02211040}),
10794 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10795 {0x12, 0x90a60170},
10796 {0x14, 0x90170140},
10797 {0x21, 0x02211050}),
10798 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10799 {0x12, 0x90a60180},
10800 {0x14, 0x90170130},
10801 {0x21, 0x02211040}),
10802 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10803 {0x12, 0x90a60180},
10804 {0x14, 0x90170120},
10805 {0x21, 0x02211030}),
10806 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10807 {0x1b, 0x01011020},
10808 {0x21, 0x02211010}),
10809 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10810 {0x14, 0x90170110},
10811 {0x1b, 0x90a70130},
10812 {0x21, 0x04211020}),
10813 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10814 {0x14, 0x90170110},
10815 {0x1b, 0x90a70130},
10816 {0x21, 0x03211020}),
10817 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10818 {0x12, 0x90a60130},
10819 {0x14, 0x90170110},
10820 {0x21, 0x03211020}),
10821 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10822 {0x12, 0x90a60130},
10823 {0x14, 0x90170110},
10824 {0x21, 0x04211020}),
10825 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10826 {0x1a, 0x90a70130},
10827 {0x1b, 0x90170110},
10828 {0x21, 0x03211020}),
10829 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10830 {0x14, 0x90170110},
10831 {0x19, 0x02a11020},
10832 {0x21, 0x0221101f}),
10833 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10834 {0x17, 0x90170110},
10835 {0x19, 0x03a11030},
10836 {0x21, 0x03211020}),
10837 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10838 {0x12, 0x90a60130},
10839 {0x14, 0x90170110},
10840 {0x15, 0x0421101f},
10841 {0x1a, 0x04a11020}),
10842 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10843 {0x12, 0x90a60140},
10844 {0x14, 0x90170110},
10845 {0x15, 0x0421101f},
10846 {0x18, 0x02811030},
10847 {0x1a, 0x04a1103f},
10848 {0x1b, 0x02011020}),
10849 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10850 ALC282_STANDARD_PINS,
10851 {0x12, 0x99a30130},
10852 {0x19, 0x03a11020},
10853 {0x21, 0x0321101f}),
10854 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10855 ALC282_STANDARD_PINS,
10856 {0x12, 0x99a30130},
10857 {0x19, 0x03a11020},
10858 {0x21, 0x03211040}),
10859 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10860 ALC282_STANDARD_PINS,
10861 {0x12, 0x99a30130},
10862 {0x19, 0x03a11030},
10863 {0x21, 0x03211020}),
10864 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10865 ALC282_STANDARD_PINS,
10866 {0x12, 0x99a30130},
10867 {0x19, 0x04a11020},
10868 {0x21, 0x0421101f}),
10869 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10870 ALC282_STANDARD_PINS,
10871 {0x12, 0x90a60140},
10872 {0x19, 0x04a11030},
10873 {0x21, 0x04211020}),
10874 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10875 ALC282_STANDARD_PINS,
10876 {0x12, 0x90a609c0},
10877 {0x18, 0x03a11830},
10878 {0x19, 0x04a19831},
10879 {0x1a, 0x0481303f},
10880 {0x1b, 0x04211020},
10881 {0x21, 0x0321101f}),
10882 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10883 ALC282_STANDARD_PINS,
10884 {0x12, 0x90a60940},
10885 {0x18, 0x03a11830},
10886 {0x19, 0x04a19831},
10887 {0x1a, 0x0481303f},
10888 {0x1b, 0x04211020},
10889 {0x21, 0x0321101f}),
10890 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10891 ALC282_STANDARD_PINS,
10892 {0x12, 0x90a60130},
10893 {0x21, 0x0321101f}),
10894 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10895 {0x12, 0x90a60160},
10896 {0x14, 0x90170120},
10897 {0x21, 0x02211030}),
10898 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10899 ALC282_STANDARD_PINS,
10900 {0x12, 0x90a60130},
10901 {0x19, 0x03a11020},
10902 {0x21, 0x0321101f}),
10903 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10904 {0x12, 0x90a60130},
10905 {0x14, 0x90170110},
10906 {0x19, 0x04a11040},
10907 {0x21, 0x04211020}),
10908 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10909 {0x14, 0x90170110},
10910 {0x19, 0x04a11040},
10911 {0x1d, 0x40600001},
10912 {0x21, 0x04211020}),
10913 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10914 {0x14, 0x90170110},
10915 {0x19, 0x04a11040},
10916 {0x21, 0x04211020}),
10917 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10918 {0x14, 0x90170110},
10919 {0x17, 0x90170111},
10920 {0x19, 0x03a11030},
10921 {0x21, 0x03211020}),
10922 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10923 {0x17, 0x90170110},
10924 {0x19, 0x03a11030},
10925 {0x21, 0x03211020}),
10926 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10927 {0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
10928 {0x19, 0x04a11040},
10929 {0x21, 0x04211020}),
10930 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10931 {0x12, 0x90a60130},
10932 {0x17, 0x90170110},
10933 {0x21, 0x02211020}),
10934 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
10935 {0x12, 0x90a60120},
10936 {0x14, 0x90170110},
10937 {0x21, 0x0321101f}),
10938 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10939 ALC290_STANDARD_PINS,
10940 {0x15, 0x04211040},
10941 {0x18, 0x90170112},
10942 {0x1a, 0x04a11020}),
10943 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10944 ALC290_STANDARD_PINS,
10945 {0x15, 0x04211040},
10946 {0x18, 0x90170110},
10947 {0x1a, 0x04a11020}),
10948 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10949 ALC290_STANDARD_PINS,
10950 {0x15, 0x0421101f},
10951 {0x1a, 0x04a11020}),
10952 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10953 ALC290_STANDARD_PINS,
10954 {0x15, 0x04211020},
10955 {0x1a, 0x04a11040}),
10956 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10957 ALC290_STANDARD_PINS,
10958 {0x14, 0x90170110},
10959 {0x15, 0x04211020},
10960 {0x1a, 0x04a11040}),
10961 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10962 ALC290_STANDARD_PINS,
10963 {0x14, 0x90170110},
10964 {0x15, 0x04211020},
10965 {0x1a, 0x04a11020}),
10966 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10967 ALC290_STANDARD_PINS,
10968 {0x14, 0x90170110},
10969 {0x15, 0x0421101f},
10970 {0x1a, 0x04a11020}),
10971 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10972 ALC292_STANDARD_PINS,
10973 {0x12, 0x90a60140},
10974 {0x16, 0x01014020},
10975 {0x19, 0x01a19030}),
10976 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10977 ALC292_STANDARD_PINS,
10978 {0x12, 0x90a60140},
10979 {0x16, 0x01014020},
10980 {0x18, 0x02a19031},
10981 {0x19, 0x01a1903e}),
10982 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
10983 ALC292_STANDARD_PINS,
10984 {0x12, 0x90a60140}),
10985 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10986 ALC292_STANDARD_PINS,
10987 {0x13, 0x90a60140},
10988 {0x16, 0x21014020},
10989 {0x19, 0x21a19030}),
10990 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10991 ALC292_STANDARD_PINS,
10992 {0x13, 0x90a60140}),
10993 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
10994 {0x17, 0x90170110},
10995 {0x21, 0x04211020}),
10996 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
10997 {0x14, 0x90170110},
10998 {0x1b, 0x90a70130},
10999 {0x21, 0x04211020}),
11000 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11001 {0x12, 0x90a60130},
11002 {0x17, 0x90170110},
11003 {0x21, 0x03211020}),
11004 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11005 {0x12, 0x90a60130},
11006 {0x17, 0x90170110},
11007 {0x21, 0x04211020}),
11008 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11009 {0x12, 0x90a60130},
11010 {0x17, 0x90170110},
11011 {0x21, 0x03211020}),
11012 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11013 {0x12, 0x90a60120},
11014 {0x17, 0x90170110},
11015 {0x21, 0x04211030}),
11016 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11017 {0x12, 0x90a60130},
11018 {0x17, 0x90170110},
11019 {0x21, 0x03211020}),
11020 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11021 {0x12, 0x90a60130},
11022 {0x17, 0x90170110},
11023 {0x21, 0x03211020}),
11024 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11025 ALC298_STANDARD_PINS,
11026 {0x17, 0x90170110}),
11027 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11028 ALC298_STANDARD_PINS,
11029 {0x17, 0x90170140}),
11030 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11031 ALC298_STANDARD_PINS,
11032 {0x17, 0x90170150}),
11033 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11034 {0x12, 0xb7a60140},
11035 {0x13, 0xb7a60150},
11036 {0x17, 0x90170110},
11037 {0x1a, 0x03011020},
11038 {0x21, 0x03211030}),
11039 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11040 {0x12, 0xb7a60140},
11041 {0x17, 0x90170110},
11042 {0x1a, 0x03a11030},
11043 {0x21, 0x03211020}),
11044 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11045 ALC225_STANDARD_PINS,
11046 {0x12, 0xb7a60130},
11047 {0x17, 0x90170110}),
11048 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11049 {0x14, 0x01014010},
11050 {0x17, 0x90170120},
11051 {0x18, 0x02a11030},
11052 {0x19, 0x02a1103f},
11053 {0x21, 0x0221101f}),
11054 {}
11055 };
11056
11057 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11058 * more machines, don't need to match all valid pins, just need to match
11059 * all the pins defined in the tbl. Just because of this reason, it is possible
11060 * that a single machine matches multiple tbls, so there is one limitation:
11061 * at most one tbl is allowed to define for the same vendor and same codec
11062 */
11063 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11064 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11065 {0x19, 0x40000000}),
11066 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11067 {0x19, 0x40000000},
11068 {0x1b, 0x40000000}),
11069 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
11070 {0x19, 0x40000000},
11071 {0x1b, 0x40000000}),
11072 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11073 {0x19, 0x40000000},
11074 {0x1a, 0x40000000}),
11075 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11076 {0x19, 0x40000000},
11077 {0x1a, 0x40000000}),
11078 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11079 {0x19, 0x40000000},
11080 {0x1a, 0x40000000}),
11081 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11082 {0x19, 0x40000000}),
11083 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
11084 {0x19, 0x40000000}),
11085 {}
11086 };
11087
alc269_fill_coef(struct hda_codec * codec)11088 static void alc269_fill_coef(struct hda_codec *codec)
11089 {
11090 struct alc_spec *spec = codec->spec;
11091 int val;
11092
11093 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11094 return;
11095
11096 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11097 alc_write_coef_idx(codec, 0xf, 0x960b);
11098 alc_write_coef_idx(codec, 0xe, 0x8817);
11099 }
11100
11101 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11102 alc_write_coef_idx(codec, 0xf, 0x960b);
11103 alc_write_coef_idx(codec, 0xe, 0x8814);
11104 }
11105
11106 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11107 /* Power up output pin */
11108 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11109 }
11110
11111 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11112 val = alc_read_coef_idx(codec, 0xd);
11113 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11114 /* Capless ramp up clock control */
11115 alc_write_coef_idx(codec, 0xd, val | (1<<10));
11116 }
11117 val = alc_read_coef_idx(codec, 0x17);
11118 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11119 /* Class D power on reset */
11120 alc_write_coef_idx(codec, 0x17, val | (1<<7));
11121 }
11122 }
11123
11124 /* HP */
11125 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11126 }
11127
11128 /*
11129 */
patch_alc269(struct hda_codec * codec)11130 static int patch_alc269(struct hda_codec *codec)
11131 {
11132 struct alc_spec *spec;
11133 int err;
11134
11135 err = alc_alloc_spec(codec, 0x0b);
11136 if (err < 0)
11137 return err;
11138
11139 spec = codec->spec;
11140 spec->gen.shared_mic_vref_pin = 0x18;
11141 codec->power_save_node = 0;
11142 spec->en_3kpull_low = true;
11143
11144 #ifdef CONFIG_PM
11145 codec->patch_ops.suspend = alc269_suspend;
11146 codec->patch_ops.resume = alc269_resume;
11147 #endif
11148 spec->shutup = alc_default_shutup;
11149 spec->init_hook = alc_default_init;
11150
11151 switch (codec->core.vendor_id) {
11152 case 0x10ec0269:
11153 spec->codec_variant = ALC269_TYPE_ALC269VA;
11154 switch (alc_get_coef0(codec) & 0x00f0) {
11155 case 0x0010:
11156 if (codec->bus->pci &&
11157 codec->bus->pci->subsystem_vendor == 0x1025 &&
11158 spec->cdefine.platform_type == 1)
11159 err = alc_codec_rename(codec, "ALC271X");
11160 spec->codec_variant = ALC269_TYPE_ALC269VB;
11161 break;
11162 case 0x0020:
11163 if (codec->bus->pci &&
11164 codec->bus->pci->subsystem_vendor == 0x17aa &&
11165 codec->bus->pci->subsystem_device == 0x21f3)
11166 err = alc_codec_rename(codec, "ALC3202");
11167 spec->codec_variant = ALC269_TYPE_ALC269VC;
11168 break;
11169 case 0x0030:
11170 spec->codec_variant = ALC269_TYPE_ALC269VD;
11171 break;
11172 default:
11173 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11174 }
11175 if (err < 0)
11176 goto error;
11177 spec->shutup = alc269_shutup;
11178 spec->init_hook = alc269_fill_coef;
11179 alc269_fill_coef(codec);
11180 break;
11181
11182 case 0x10ec0280:
11183 case 0x10ec0290:
11184 spec->codec_variant = ALC269_TYPE_ALC280;
11185 break;
11186 case 0x10ec0282:
11187 spec->codec_variant = ALC269_TYPE_ALC282;
11188 spec->shutup = alc282_shutup;
11189 spec->init_hook = alc282_init;
11190 break;
11191 case 0x10ec0233:
11192 case 0x10ec0283:
11193 spec->codec_variant = ALC269_TYPE_ALC283;
11194 spec->shutup = alc283_shutup;
11195 spec->init_hook = alc283_init;
11196 break;
11197 case 0x10ec0284:
11198 case 0x10ec0292:
11199 spec->codec_variant = ALC269_TYPE_ALC284;
11200 break;
11201 case 0x10ec0293:
11202 spec->codec_variant = ALC269_TYPE_ALC293;
11203 break;
11204 case 0x10ec0286:
11205 case 0x10ec0288:
11206 spec->codec_variant = ALC269_TYPE_ALC286;
11207 break;
11208 case 0x10ec0298:
11209 spec->codec_variant = ALC269_TYPE_ALC298;
11210 break;
11211 case 0x10ec0235:
11212 case 0x10ec0255:
11213 spec->codec_variant = ALC269_TYPE_ALC255;
11214 spec->shutup = alc256_shutup;
11215 spec->init_hook = alc256_init;
11216 break;
11217 case 0x10ec0230:
11218 case 0x10ec0236:
11219 case 0x10ec0256:
11220 case 0x19e58326:
11221 spec->codec_variant = ALC269_TYPE_ALC256;
11222 spec->shutup = alc256_shutup;
11223 spec->init_hook = alc256_init;
11224 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11225 if (codec->core.vendor_id == 0x10ec0236 &&
11226 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11227 spec->en_3kpull_low = false;
11228 break;
11229 case 0x10ec0257:
11230 spec->codec_variant = ALC269_TYPE_ALC257;
11231 spec->shutup = alc256_shutup;
11232 spec->init_hook = alc256_init;
11233 spec->gen.mixer_nid = 0;
11234 spec->en_3kpull_low = false;
11235 break;
11236 case 0x10ec0215:
11237 case 0x10ec0245:
11238 case 0x10ec0285:
11239 case 0x10ec0289:
11240 if (alc_get_coef0(codec) & 0x0010)
11241 spec->codec_variant = ALC269_TYPE_ALC245;
11242 else
11243 spec->codec_variant = ALC269_TYPE_ALC215;
11244 spec->shutup = alc225_shutup;
11245 spec->init_hook = alc225_init;
11246 spec->gen.mixer_nid = 0;
11247 break;
11248 case 0x10ec0225:
11249 case 0x10ec0295:
11250 case 0x10ec0299:
11251 spec->codec_variant = ALC269_TYPE_ALC225;
11252 spec->shutup = alc225_shutup;
11253 spec->init_hook = alc225_init;
11254 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11255 break;
11256 case 0x10ec0287:
11257 spec->codec_variant = ALC269_TYPE_ALC287;
11258 spec->shutup = alc225_shutup;
11259 spec->init_hook = alc225_init;
11260 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11261 break;
11262 case 0x10ec0234:
11263 case 0x10ec0274:
11264 case 0x10ec0294:
11265 spec->codec_variant = ALC269_TYPE_ALC294;
11266 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11267 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11268 spec->init_hook = alc294_init;
11269 break;
11270 case 0x10ec0300:
11271 spec->codec_variant = ALC269_TYPE_ALC300;
11272 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11273 break;
11274 case 0x10ec0623:
11275 spec->codec_variant = ALC269_TYPE_ALC623;
11276 break;
11277 case 0x10ec0700:
11278 case 0x10ec0701:
11279 case 0x10ec0703:
11280 case 0x10ec0711:
11281 spec->codec_variant = ALC269_TYPE_ALC700;
11282 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11283 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11284 spec->init_hook = alc294_init;
11285 break;
11286
11287 }
11288
11289 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11290 spec->has_alc5505_dsp = 1;
11291 spec->init_hook = alc5505_dsp_init;
11292 }
11293
11294 alc_pre_init(codec);
11295
11296 snd_hda_pick_fixup(codec, alc269_fixup_models,
11297 alc269_fixup_tbl, alc269_fixups);
11298 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11299 * the quirk breaks the latter (bko#214101).
11300 * Clear the wrong entry.
11301 */
11302 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11303 codec->core.vendor_id == 0x10ec0294) {
11304 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11305 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11306 }
11307
11308 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11309 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11310 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
11311 alc269_fixups);
11312 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11313
11314 alc_auto_parse_customize_define(codec);
11315
11316 if (has_cdefine_beep(codec))
11317 spec->gen.beep_nid = 0x01;
11318
11319 /* automatic parse from the BIOS config */
11320 err = alc269_parse_auto_config(codec);
11321 if (err < 0)
11322 goto error;
11323
11324 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11325 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11326 if (err < 0)
11327 goto error;
11328 }
11329
11330 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11331
11332 return 0;
11333
11334 error:
11335 alc_free(codec);
11336 return err;
11337 }
11338
11339 /*
11340 * ALC861
11341 */
11342
alc861_parse_auto_config(struct hda_codec * codec)11343 static int alc861_parse_auto_config(struct hda_codec *codec)
11344 {
11345 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11346 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11347 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11348 }
11349
11350 /* Pin config fixes */
11351 enum {
11352 ALC861_FIXUP_FSC_AMILO_PI1505,
11353 ALC861_FIXUP_AMP_VREF_0F,
11354 ALC861_FIXUP_NO_JACK_DETECT,
11355 ALC861_FIXUP_ASUS_A6RP,
11356 ALC660_FIXUP_ASUS_W7J,
11357 };
11358
11359 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
alc861_fixup_asus_amp_vref_0f(struct hda_codec * codec,const struct hda_fixup * fix,int action)11360 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11361 const struct hda_fixup *fix, int action)
11362 {
11363 struct alc_spec *spec = codec->spec;
11364 unsigned int val;
11365
11366 if (action != HDA_FIXUP_ACT_INIT)
11367 return;
11368 val = snd_hda_codec_get_pin_target(codec, 0x0f);
11369 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11370 val |= AC_PINCTL_IN_EN;
11371 val |= AC_PINCTL_VREF_50;
11372 snd_hda_set_pin_ctl(codec, 0x0f, val);
11373 spec->gen.keep_vref_in_automute = 1;
11374 }
11375
11376 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)11377 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11378 const struct hda_fixup *fix, int action)
11379 {
11380 if (action == HDA_FIXUP_ACT_PRE_PROBE)
11381 codec->no_jack_detect = 1;
11382 }
11383
11384 static const struct hda_fixup alc861_fixups[] = {
11385 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
11386 .type = HDA_FIXUP_PINS,
11387 .v.pins = (const struct hda_pintbl[]) {
11388 { 0x0b, 0x0221101f }, /* HP */
11389 { 0x0f, 0x90170310 }, /* speaker */
11390 { }
11391 }
11392 },
11393 [ALC861_FIXUP_AMP_VREF_0F] = {
11394 .type = HDA_FIXUP_FUNC,
11395 .v.func = alc861_fixup_asus_amp_vref_0f,
11396 },
11397 [ALC861_FIXUP_NO_JACK_DETECT] = {
11398 .type = HDA_FIXUP_FUNC,
11399 .v.func = alc_fixup_no_jack_detect,
11400 },
11401 [ALC861_FIXUP_ASUS_A6RP] = {
11402 .type = HDA_FIXUP_FUNC,
11403 .v.func = alc861_fixup_asus_amp_vref_0f,
11404 .chained = true,
11405 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11406 },
11407 [ALC660_FIXUP_ASUS_W7J] = {
11408 .type = HDA_FIXUP_VERBS,
11409 .v.verbs = (const struct hda_verb[]) {
11410 /* ASUS W7J needs a magic pin setup on unused NID 0x10
11411 * for enabling outputs
11412 */
11413 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11414 { }
11415 },
11416 }
11417 };
11418
11419 static const struct hda_quirk alc861_fixup_tbl[] = {
11420 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11421 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11422 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11423 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11424 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11425 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11426 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11427 {}
11428 };
11429
11430 /*
11431 */
patch_alc861(struct hda_codec * codec)11432 static int patch_alc861(struct hda_codec *codec)
11433 {
11434 struct alc_spec *spec;
11435 int err;
11436
11437 err = alc_alloc_spec(codec, 0x15);
11438 if (err < 0)
11439 return err;
11440
11441 spec = codec->spec;
11442 if (has_cdefine_beep(codec))
11443 spec->gen.beep_nid = 0x23;
11444
11445 #ifdef CONFIG_PM
11446 spec->power_hook = alc_power_eapd;
11447 #endif
11448
11449 alc_pre_init(codec);
11450
11451 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11452 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11453
11454 /* automatic parse from the BIOS config */
11455 err = alc861_parse_auto_config(codec);
11456 if (err < 0)
11457 goto error;
11458
11459 if (!spec->gen.no_analog) {
11460 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11461 if (err < 0)
11462 goto error;
11463 }
11464
11465 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11466
11467 return 0;
11468
11469 error:
11470 alc_free(codec);
11471 return err;
11472 }
11473
11474 /*
11475 * ALC861-VD support
11476 *
11477 * Based on ALC882
11478 *
11479 * In addition, an independent DAC
11480 */
alc861vd_parse_auto_config(struct hda_codec * codec)11481 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11482 {
11483 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11484 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11485 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11486 }
11487
11488 enum {
11489 ALC660VD_FIX_ASUS_GPIO1,
11490 ALC861VD_FIX_DALLAS,
11491 };
11492
11493 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)11494 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11495 const struct hda_fixup *fix, int action)
11496 {
11497 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11498 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11499 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11500 }
11501 }
11502
11503 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11504 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11505 const struct hda_fixup *fix, int action)
11506 {
11507 struct alc_spec *spec = codec->spec;
11508
11509 if (action == HDA_FIXUP_ACT_PRE_PROBE)
11510 spec->gpio_mask |= 0x02;
11511 alc_fixup_gpio(codec, action, 0x01);
11512 }
11513
11514 static const struct hda_fixup alc861vd_fixups[] = {
11515 [ALC660VD_FIX_ASUS_GPIO1] = {
11516 .type = HDA_FIXUP_FUNC,
11517 .v.func = alc660vd_fixup_asus_gpio1,
11518 },
11519 [ALC861VD_FIX_DALLAS] = {
11520 .type = HDA_FIXUP_FUNC,
11521 .v.func = alc861vd_fixup_dallas,
11522 },
11523 };
11524
11525 static const struct hda_quirk alc861vd_fixup_tbl[] = {
11526 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11527 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11528 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11529 {}
11530 };
11531
11532 /*
11533 */
patch_alc861vd(struct hda_codec * codec)11534 static int patch_alc861vd(struct hda_codec *codec)
11535 {
11536 struct alc_spec *spec;
11537 int err;
11538
11539 err = alc_alloc_spec(codec, 0x0b);
11540 if (err < 0)
11541 return err;
11542
11543 spec = codec->spec;
11544 if (has_cdefine_beep(codec))
11545 spec->gen.beep_nid = 0x23;
11546
11547 spec->shutup = alc_eapd_shutup;
11548
11549 alc_pre_init(codec);
11550
11551 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11552 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11553
11554 /* automatic parse from the BIOS config */
11555 err = alc861vd_parse_auto_config(codec);
11556 if (err < 0)
11557 goto error;
11558
11559 if (!spec->gen.no_analog) {
11560 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11561 if (err < 0)
11562 goto error;
11563 }
11564
11565 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11566
11567 return 0;
11568
11569 error:
11570 alc_free(codec);
11571 return err;
11572 }
11573
11574 /*
11575 * ALC662 support
11576 *
11577 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11578 * configuration. Each pin widget can choose any input DACs and a mixer.
11579 * Each ADC is connected from a mixer of all inputs. This makes possible
11580 * 6-channel independent captures.
11581 *
11582 * In addition, an independent DAC for the multi-playback (not used in this
11583 * driver yet).
11584 */
11585
11586 /*
11587 * BIOS auto configuration
11588 */
11589
alc662_parse_auto_config(struct hda_codec * codec)11590 static int alc662_parse_auto_config(struct hda_codec *codec)
11591 {
11592 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11593 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11594 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11595 const hda_nid_t *ssids;
11596
11597 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11598 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11599 codec->core.vendor_id == 0x10ec0671)
11600 ssids = alc663_ssids;
11601 else
11602 ssids = alc662_ssids;
11603 return alc_parse_auto_config(codec, alc662_ignore, ssids);
11604 }
11605
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)11606 static void alc272_fixup_mario(struct hda_codec *codec,
11607 const struct hda_fixup *fix, int action)
11608 {
11609 if (action != HDA_FIXUP_ACT_PRE_PROBE)
11610 return;
11611 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11612 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11613 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11614 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11615 (0 << AC_AMPCAP_MUTE_SHIFT)))
11616 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11617 }
11618
11619 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11620 { .channels = 2,
11621 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11622 { .channels = 4,
11623 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11624 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11625 { }
11626 };
11627
11628 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)11629 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11630 const struct hda_fixup *fix, int action)
11631 {
11632 if (action == HDA_FIXUP_ACT_BUILD) {
11633 struct alc_spec *spec = codec->spec;
11634 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11635 }
11636 }
11637
11638 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)11639 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11640 hda_nid_t nid,
11641 unsigned int power_state)
11642 {
11643 struct alc_spec *spec = codec->spec;
11644 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11645 return AC_PWRST_D0;
11646 return power_state;
11647 }
11648
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11649 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11650 const struct hda_fixup *fix, int action)
11651 {
11652 struct alc_spec *spec = codec->spec;
11653
11654 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11655 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11656 spec->mute_led_polarity = 1;
11657 codec->power_filter = gpio_led_power_filter;
11658 }
11659 }
11660
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11661 static void alc662_usi_automute_hook(struct hda_codec *codec,
11662 struct hda_jack_callback *jack)
11663 {
11664 struct alc_spec *spec = codec->spec;
11665 int vref;
11666 msleep(200);
11667 snd_hda_gen_hp_automute(codec, jack);
11668
11669 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11670 msleep(100);
11671 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11672 vref);
11673 }
11674
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11675 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11676 const struct hda_fixup *fix, int action)
11677 {
11678 struct alc_spec *spec = codec->spec;
11679 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11680 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11681 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11682 }
11683 }
11684
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)11685 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11686 struct hda_jack_callback *cb)
11687 {
11688 /* surround speakers at 0x1b already get muted automatically when
11689 * headphones are plugged in, but we have to mute/unmute the remaining
11690 * channels manually:
11691 * 0x15 - front left/front right
11692 * 0x18 - front center/ LFE
11693 */
11694 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11695 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11696 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11697 } else {
11698 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11699 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11700 }
11701 }
11702
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)11703 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11704 const struct hda_fixup *fix, int action)
11705 {
11706 /* Pin 0x1b: shared headphones jack and surround speakers */
11707 if (!is_jack_detectable(codec, 0x1b))
11708 return;
11709
11710 switch (action) {
11711 case HDA_FIXUP_ACT_PRE_PROBE:
11712 snd_hda_jack_detect_enable_callback(codec, 0x1b,
11713 alc662_aspire_ethos_mute_speakers);
11714 /* subwoofer needs an extra GPIO setting to become audible */
11715 alc_setup_gpio(codec, 0x02);
11716 break;
11717 case HDA_FIXUP_ACT_INIT:
11718 /* Make sure to start in a correct state, i.e. if
11719 * headphones have been plugged in before powering up the system
11720 */
11721 alc662_aspire_ethos_mute_speakers(codec, NULL);
11722 break;
11723 }
11724 }
11725
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)11726 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11727 const struct hda_fixup *fix, int action)
11728 {
11729 struct alc_spec *spec = codec->spec;
11730
11731 static const struct hda_pintbl pincfgs[] = {
11732 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11733 { 0x1b, 0x0181304f },
11734 { }
11735 };
11736
11737 switch (action) {
11738 case HDA_FIXUP_ACT_PRE_PROBE:
11739 spec->gen.mixer_nid = 0;
11740 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11741 snd_hda_apply_pincfgs(codec, pincfgs);
11742 break;
11743 case HDA_FIXUP_ACT_INIT:
11744 alc_write_coef_idx(codec, 0x19, 0xa054);
11745 break;
11746 }
11747 }
11748
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11749 static void alc897_hp_automute_hook(struct hda_codec *codec,
11750 struct hda_jack_callback *jack)
11751 {
11752 struct alc_spec *spec = codec->spec;
11753 int vref;
11754
11755 snd_hda_gen_hp_automute(codec, jack);
11756 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11757 snd_hda_set_pin_ctl(codec, 0x1b, vref);
11758 }
11759
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11760 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11761 const struct hda_fixup *fix, int action)
11762 {
11763 struct alc_spec *spec = codec->spec;
11764 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11765 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11766 spec->no_shutup_pins = 1;
11767 }
11768 if (action == HDA_FIXUP_ACT_PROBE) {
11769 snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
11770 }
11771 }
11772
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)11773 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11774 const struct hda_fixup *fix, int action)
11775 {
11776 struct alc_spec *spec = codec->spec;
11777
11778 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11779 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11780 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11781 }
11782 }
11783
11784 static const struct coef_fw alc668_coefs[] = {
11785 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
11786 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
11787 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
11788 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11789 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11790 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11791 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
11792 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
11793 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11794 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11795 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11796 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11797 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
11798 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11799 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
11800 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
11801 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11802 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11803 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11804 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11805 {}
11806 };
11807
alc668_restore_default_value(struct hda_codec * codec)11808 static void alc668_restore_default_value(struct hda_codec *codec)
11809 {
11810 alc_process_coef_fw(codec, alc668_coefs);
11811 }
11812
11813 enum {
11814 ALC662_FIXUP_ASPIRE,
11815 ALC662_FIXUP_LED_GPIO1,
11816 ALC662_FIXUP_IDEAPAD,
11817 ALC272_FIXUP_MARIO,
11818 ALC662_FIXUP_CZC_ET26,
11819 ALC662_FIXUP_CZC_P10T,
11820 ALC662_FIXUP_SKU_IGNORE,
11821 ALC662_FIXUP_HP_RP5800,
11822 ALC662_FIXUP_ASUS_MODE1,
11823 ALC662_FIXUP_ASUS_MODE2,
11824 ALC662_FIXUP_ASUS_MODE3,
11825 ALC662_FIXUP_ASUS_MODE4,
11826 ALC662_FIXUP_ASUS_MODE5,
11827 ALC662_FIXUP_ASUS_MODE6,
11828 ALC662_FIXUP_ASUS_MODE7,
11829 ALC662_FIXUP_ASUS_MODE8,
11830 ALC662_FIXUP_NO_JACK_DETECT,
11831 ALC662_FIXUP_ZOTAC_Z68,
11832 ALC662_FIXUP_INV_DMIC,
11833 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11834 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11835 ALC662_FIXUP_HEADSET_MODE,
11836 ALC668_FIXUP_HEADSET_MODE,
11837 ALC662_FIXUP_BASS_MODE4_CHMAP,
11838 ALC662_FIXUP_BASS_16,
11839 ALC662_FIXUP_BASS_1A,
11840 ALC662_FIXUP_BASS_CHMAP,
11841 ALC668_FIXUP_AUTO_MUTE,
11842 ALC668_FIXUP_DELL_DISABLE_AAMIX,
11843 ALC668_FIXUP_DELL_XPS13,
11844 ALC662_FIXUP_ASUS_Nx50,
11845 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11846 ALC668_FIXUP_ASUS_Nx51,
11847 ALC668_FIXUP_MIC_COEF,
11848 ALC668_FIXUP_ASUS_G751,
11849 ALC891_FIXUP_HEADSET_MODE,
11850 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11851 ALC662_FIXUP_ACER_VERITON,
11852 ALC892_FIXUP_ASROCK_MOBO,
11853 ALC662_FIXUP_USI_FUNC,
11854 ALC662_FIXUP_USI_HEADSET_MODE,
11855 ALC662_FIXUP_LENOVO_MULTI_CODECS,
11856 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11857 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11858 ALC671_FIXUP_HP_HEADSET_MIC2,
11859 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11860 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11861 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11862 ALC668_FIXUP_HEADSET_MIC,
11863 ALC668_FIXUP_MIC_DET_COEF,
11864 ALC897_FIXUP_LENOVO_HEADSET_MIC,
11865 ALC897_FIXUP_HEADSET_MIC_PIN,
11866 ALC897_FIXUP_HP_HSMIC_VERB,
11867 ALC897_FIXUP_LENOVO_HEADSET_MODE,
11868 ALC897_FIXUP_HEADSET_MIC_PIN2,
11869 ALC897_FIXUP_UNIS_H3C_X500S,
11870 ALC897_FIXUP_HEADSET_MIC_PIN3,
11871 };
11872
11873 static const struct hda_fixup alc662_fixups[] = {
11874 [ALC662_FIXUP_ASPIRE] = {
11875 .type = HDA_FIXUP_PINS,
11876 .v.pins = (const struct hda_pintbl[]) {
11877 { 0x15, 0x99130112 }, /* subwoofer */
11878 { }
11879 }
11880 },
11881 [ALC662_FIXUP_LED_GPIO1] = {
11882 .type = HDA_FIXUP_FUNC,
11883 .v.func = alc662_fixup_led_gpio1,
11884 },
11885 [ALC662_FIXUP_IDEAPAD] = {
11886 .type = HDA_FIXUP_PINS,
11887 .v.pins = (const struct hda_pintbl[]) {
11888 { 0x17, 0x99130112 }, /* subwoofer */
11889 { }
11890 },
11891 .chained = true,
11892 .chain_id = ALC662_FIXUP_LED_GPIO1,
11893 },
11894 [ALC272_FIXUP_MARIO] = {
11895 .type = HDA_FIXUP_FUNC,
11896 .v.func = alc272_fixup_mario,
11897 },
11898 [ALC662_FIXUP_CZC_ET26] = {
11899 .type = HDA_FIXUP_PINS,
11900 .v.pins = (const struct hda_pintbl[]) {
11901 {0x12, 0x403cc000},
11902 {0x14, 0x90170110}, /* speaker */
11903 {0x15, 0x411111f0},
11904 {0x16, 0x411111f0},
11905 {0x18, 0x01a19030}, /* mic */
11906 {0x19, 0x90a7013f}, /* int-mic */
11907 {0x1a, 0x01014020},
11908 {0x1b, 0x0121401f},
11909 {0x1c, 0x411111f0},
11910 {0x1d, 0x411111f0},
11911 {0x1e, 0x40478e35},
11912 {}
11913 },
11914 .chained = true,
11915 .chain_id = ALC662_FIXUP_SKU_IGNORE
11916 },
11917 [ALC662_FIXUP_CZC_P10T] = {
11918 .type = HDA_FIXUP_VERBS,
11919 .v.verbs = (const struct hda_verb[]) {
11920 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11921 {}
11922 }
11923 },
11924 [ALC662_FIXUP_SKU_IGNORE] = {
11925 .type = HDA_FIXUP_FUNC,
11926 .v.func = alc_fixup_sku_ignore,
11927 },
11928 [ALC662_FIXUP_HP_RP5800] = {
11929 .type = HDA_FIXUP_PINS,
11930 .v.pins = (const struct hda_pintbl[]) {
11931 { 0x14, 0x0221201f }, /* HP out */
11932 { }
11933 },
11934 .chained = true,
11935 .chain_id = ALC662_FIXUP_SKU_IGNORE
11936 },
11937 [ALC662_FIXUP_ASUS_MODE1] = {
11938 .type = HDA_FIXUP_PINS,
11939 .v.pins = (const struct hda_pintbl[]) {
11940 { 0x14, 0x99130110 }, /* speaker */
11941 { 0x18, 0x01a19c20 }, /* mic */
11942 { 0x19, 0x99a3092f }, /* int-mic */
11943 { 0x21, 0x0121401f }, /* HP out */
11944 { }
11945 },
11946 .chained = true,
11947 .chain_id = ALC662_FIXUP_SKU_IGNORE
11948 },
11949 [ALC662_FIXUP_ASUS_MODE2] = {
11950 .type = HDA_FIXUP_PINS,
11951 .v.pins = (const struct hda_pintbl[]) {
11952 { 0x14, 0x99130110 }, /* speaker */
11953 { 0x18, 0x01a19820 }, /* mic */
11954 { 0x19, 0x99a3092f }, /* int-mic */
11955 { 0x1b, 0x0121401f }, /* HP out */
11956 { }
11957 },
11958 .chained = true,
11959 .chain_id = ALC662_FIXUP_SKU_IGNORE
11960 },
11961 [ALC662_FIXUP_ASUS_MODE3] = {
11962 .type = HDA_FIXUP_PINS,
11963 .v.pins = (const struct hda_pintbl[]) {
11964 { 0x14, 0x99130110 }, /* speaker */
11965 { 0x15, 0x0121441f }, /* HP */
11966 { 0x18, 0x01a19840 }, /* mic */
11967 { 0x19, 0x99a3094f }, /* int-mic */
11968 { 0x21, 0x01211420 }, /* HP2 */
11969 { }
11970 },
11971 .chained = true,
11972 .chain_id = ALC662_FIXUP_SKU_IGNORE
11973 },
11974 [ALC662_FIXUP_ASUS_MODE4] = {
11975 .type = HDA_FIXUP_PINS,
11976 .v.pins = (const struct hda_pintbl[]) {
11977 { 0x14, 0x99130110 }, /* speaker */
11978 { 0x16, 0x99130111 }, /* speaker */
11979 { 0x18, 0x01a19840 }, /* mic */
11980 { 0x19, 0x99a3094f }, /* int-mic */
11981 { 0x21, 0x0121441f }, /* HP */
11982 { }
11983 },
11984 .chained = true,
11985 .chain_id = ALC662_FIXUP_SKU_IGNORE
11986 },
11987 [ALC662_FIXUP_ASUS_MODE5] = {
11988 .type = HDA_FIXUP_PINS,
11989 .v.pins = (const struct hda_pintbl[]) {
11990 { 0x14, 0x99130110 }, /* speaker */
11991 { 0x15, 0x0121441f }, /* HP */
11992 { 0x16, 0x99130111 }, /* speaker */
11993 { 0x18, 0x01a19840 }, /* mic */
11994 { 0x19, 0x99a3094f }, /* int-mic */
11995 { }
11996 },
11997 .chained = true,
11998 .chain_id = ALC662_FIXUP_SKU_IGNORE
11999 },
12000 [ALC662_FIXUP_ASUS_MODE6] = {
12001 .type = HDA_FIXUP_PINS,
12002 .v.pins = (const struct hda_pintbl[]) {
12003 { 0x14, 0x99130110 }, /* speaker */
12004 { 0x15, 0x01211420 }, /* HP2 */
12005 { 0x18, 0x01a19840 }, /* mic */
12006 { 0x19, 0x99a3094f }, /* int-mic */
12007 { 0x1b, 0x0121441f }, /* HP */
12008 { }
12009 },
12010 .chained = true,
12011 .chain_id = ALC662_FIXUP_SKU_IGNORE
12012 },
12013 [ALC662_FIXUP_ASUS_MODE7] = {
12014 .type = HDA_FIXUP_PINS,
12015 .v.pins = (const struct hda_pintbl[]) {
12016 { 0x14, 0x99130110 }, /* speaker */
12017 { 0x17, 0x99130111 }, /* speaker */
12018 { 0x18, 0x01a19840 }, /* mic */
12019 { 0x19, 0x99a3094f }, /* int-mic */
12020 { 0x1b, 0x01214020 }, /* HP */
12021 { 0x21, 0x0121401f }, /* HP */
12022 { }
12023 },
12024 .chained = true,
12025 .chain_id = ALC662_FIXUP_SKU_IGNORE
12026 },
12027 [ALC662_FIXUP_ASUS_MODE8] = {
12028 .type = HDA_FIXUP_PINS,
12029 .v.pins = (const struct hda_pintbl[]) {
12030 { 0x14, 0x99130110 }, /* speaker */
12031 { 0x12, 0x99a30970 }, /* int-mic */
12032 { 0x15, 0x01214020 }, /* HP */
12033 { 0x17, 0x99130111 }, /* speaker */
12034 { 0x18, 0x01a19840 }, /* mic */
12035 { 0x21, 0x0121401f }, /* HP */
12036 { }
12037 },
12038 .chained = true,
12039 .chain_id = ALC662_FIXUP_SKU_IGNORE
12040 },
12041 [ALC662_FIXUP_NO_JACK_DETECT] = {
12042 .type = HDA_FIXUP_FUNC,
12043 .v.func = alc_fixup_no_jack_detect,
12044 },
12045 [ALC662_FIXUP_ZOTAC_Z68] = {
12046 .type = HDA_FIXUP_PINS,
12047 .v.pins = (const struct hda_pintbl[]) {
12048 { 0x1b, 0x02214020 }, /* Front HP */
12049 { }
12050 }
12051 },
12052 [ALC662_FIXUP_INV_DMIC] = {
12053 .type = HDA_FIXUP_FUNC,
12054 .v.func = alc_fixup_inv_dmic,
12055 },
12056 [ALC668_FIXUP_DELL_XPS13] = {
12057 .type = HDA_FIXUP_FUNC,
12058 .v.func = alc_fixup_dell_xps13,
12059 .chained = true,
12060 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12061 },
12062 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12063 .type = HDA_FIXUP_FUNC,
12064 .v.func = alc_fixup_disable_aamix,
12065 .chained = true,
12066 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12067 },
12068 [ALC668_FIXUP_AUTO_MUTE] = {
12069 .type = HDA_FIXUP_FUNC,
12070 .v.func = alc_fixup_auto_mute_via_amp,
12071 .chained = true,
12072 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12073 },
12074 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12075 .type = HDA_FIXUP_PINS,
12076 .v.pins = (const struct hda_pintbl[]) {
12077 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12078 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12079 { }
12080 },
12081 .chained = true,
12082 .chain_id = ALC662_FIXUP_HEADSET_MODE
12083 },
12084 [ALC662_FIXUP_HEADSET_MODE] = {
12085 .type = HDA_FIXUP_FUNC,
12086 .v.func = alc_fixup_headset_mode_alc662,
12087 },
12088 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12089 .type = HDA_FIXUP_PINS,
12090 .v.pins = (const struct hda_pintbl[]) {
12091 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12092 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12093 { }
12094 },
12095 .chained = true,
12096 .chain_id = ALC668_FIXUP_HEADSET_MODE
12097 },
12098 [ALC668_FIXUP_HEADSET_MODE] = {
12099 .type = HDA_FIXUP_FUNC,
12100 .v.func = alc_fixup_headset_mode_alc668,
12101 },
12102 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12103 .type = HDA_FIXUP_FUNC,
12104 .v.func = alc_fixup_bass_chmap,
12105 .chained = true,
12106 .chain_id = ALC662_FIXUP_ASUS_MODE4
12107 },
12108 [ALC662_FIXUP_BASS_16] = {
12109 .type = HDA_FIXUP_PINS,
12110 .v.pins = (const struct hda_pintbl[]) {
12111 {0x16, 0x80106111}, /* bass speaker */
12112 {}
12113 },
12114 .chained = true,
12115 .chain_id = ALC662_FIXUP_BASS_CHMAP,
12116 },
12117 [ALC662_FIXUP_BASS_1A] = {
12118 .type = HDA_FIXUP_PINS,
12119 .v.pins = (const struct hda_pintbl[]) {
12120 {0x1a, 0x80106111}, /* bass speaker */
12121 {}
12122 },
12123 .chained = true,
12124 .chain_id = ALC662_FIXUP_BASS_CHMAP,
12125 },
12126 [ALC662_FIXUP_BASS_CHMAP] = {
12127 .type = HDA_FIXUP_FUNC,
12128 .v.func = alc_fixup_bass_chmap,
12129 },
12130 [ALC662_FIXUP_ASUS_Nx50] = {
12131 .type = HDA_FIXUP_FUNC,
12132 .v.func = alc_fixup_auto_mute_via_amp,
12133 .chained = true,
12134 .chain_id = ALC662_FIXUP_BASS_1A
12135 },
12136 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12137 .type = HDA_FIXUP_FUNC,
12138 .v.func = alc_fixup_headset_mode_alc668,
12139 .chain_id = ALC662_FIXUP_BASS_CHMAP
12140 },
12141 [ALC668_FIXUP_ASUS_Nx51] = {
12142 .type = HDA_FIXUP_PINS,
12143 .v.pins = (const struct hda_pintbl[]) {
12144 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12145 { 0x1a, 0x90170151 }, /* bass speaker */
12146 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12147 {}
12148 },
12149 .chained = true,
12150 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12151 },
12152 [ALC668_FIXUP_MIC_COEF] = {
12153 .type = HDA_FIXUP_VERBS,
12154 .v.verbs = (const struct hda_verb[]) {
12155 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12156 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12157 {}
12158 },
12159 },
12160 [ALC668_FIXUP_ASUS_G751] = {
12161 .type = HDA_FIXUP_PINS,
12162 .v.pins = (const struct hda_pintbl[]) {
12163 { 0x16, 0x0421101f }, /* HP */
12164 {}
12165 },
12166 .chained = true,
12167 .chain_id = ALC668_FIXUP_MIC_COEF
12168 },
12169 [ALC891_FIXUP_HEADSET_MODE] = {
12170 .type = HDA_FIXUP_FUNC,
12171 .v.func = alc_fixup_headset_mode,
12172 },
12173 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12174 .type = HDA_FIXUP_PINS,
12175 .v.pins = (const struct hda_pintbl[]) {
12176 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12177 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12178 { }
12179 },
12180 .chained = true,
12181 .chain_id = ALC891_FIXUP_HEADSET_MODE
12182 },
12183 [ALC662_FIXUP_ACER_VERITON] = {
12184 .type = HDA_FIXUP_PINS,
12185 .v.pins = (const struct hda_pintbl[]) {
12186 { 0x15, 0x50170120 }, /* no internal speaker */
12187 { }
12188 }
12189 },
12190 [ALC892_FIXUP_ASROCK_MOBO] = {
12191 .type = HDA_FIXUP_PINS,
12192 .v.pins = (const struct hda_pintbl[]) {
12193 { 0x15, 0x40f000f0 }, /* disabled */
12194 { 0x16, 0x40f000f0 }, /* disabled */
12195 { }
12196 }
12197 },
12198 [ALC662_FIXUP_USI_FUNC] = {
12199 .type = HDA_FIXUP_FUNC,
12200 .v.func = alc662_fixup_usi_headset_mic,
12201 },
12202 [ALC662_FIXUP_USI_HEADSET_MODE] = {
12203 .type = HDA_FIXUP_PINS,
12204 .v.pins = (const struct hda_pintbl[]) {
12205 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12206 { 0x18, 0x01a1903d },
12207 { }
12208 },
12209 .chained = true,
12210 .chain_id = ALC662_FIXUP_USI_FUNC
12211 },
12212 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12213 .type = HDA_FIXUP_FUNC,
12214 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12215 },
12216 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12217 .type = HDA_FIXUP_FUNC,
12218 .v.func = alc662_fixup_aspire_ethos_hp,
12219 },
12220 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12221 .type = HDA_FIXUP_PINS,
12222 .v.pins = (const struct hda_pintbl[]) {
12223 { 0x15, 0x92130110 }, /* front speakers */
12224 { 0x18, 0x99130111 }, /* center/subwoofer */
12225 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
12226 { }
12227 },
12228 .chained = true,
12229 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12230 },
12231 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
12232 .type = HDA_FIXUP_FUNC,
12233 .v.func = alc671_fixup_hp_headset_mic2,
12234 },
12235 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12236 .type = HDA_FIXUP_PINS,
12237 .v.pins = (const struct hda_pintbl[]) {
12238 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12239 { }
12240 },
12241 .chained = true,
12242 .chain_id = ALC662_FIXUP_USI_FUNC
12243 },
12244 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12245 .type = HDA_FIXUP_PINS,
12246 .v.pins = (const struct hda_pintbl[]) {
12247 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12248 { 0x1b, 0x0221144f },
12249 { }
12250 },
12251 .chained = true,
12252 .chain_id = ALC662_FIXUP_USI_FUNC
12253 },
12254 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12255 .type = HDA_FIXUP_PINS,
12256 .v.pins = (const struct hda_pintbl[]) {
12257 { 0x1b, 0x04a1112c },
12258 { }
12259 },
12260 .chained = true,
12261 .chain_id = ALC668_FIXUP_HEADSET_MIC
12262 },
12263 [ALC668_FIXUP_HEADSET_MIC] = {
12264 .type = HDA_FIXUP_FUNC,
12265 .v.func = alc269_fixup_headset_mic,
12266 .chained = true,
12267 .chain_id = ALC668_FIXUP_MIC_DET_COEF
12268 },
12269 [ALC668_FIXUP_MIC_DET_COEF] = {
12270 .type = HDA_FIXUP_VERBS,
12271 .v.verbs = (const struct hda_verb[]) {
12272 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12273 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12274 {}
12275 },
12276 },
12277 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12278 .type = HDA_FIXUP_FUNC,
12279 .v.func = alc897_fixup_lenovo_headset_mic,
12280 },
12281 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
12282 .type = HDA_FIXUP_PINS,
12283 .v.pins = (const struct hda_pintbl[]) {
12284 { 0x1a, 0x03a11050 },
12285 { }
12286 },
12287 .chained = true,
12288 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12289 },
12290 [ALC897_FIXUP_HP_HSMIC_VERB] = {
12291 .type = HDA_FIXUP_PINS,
12292 .v.pins = (const struct hda_pintbl[]) {
12293 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12294 { }
12295 },
12296 },
12297 [ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12298 .type = HDA_FIXUP_FUNC,
12299 .v.func = alc897_fixup_lenovo_headset_mode,
12300 },
12301 [ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12302 .type = HDA_FIXUP_PINS,
12303 .v.pins = (const struct hda_pintbl[]) {
12304 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12305 { }
12306 },
12307 .chained = true,
12308 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12309 },
12310 [ALC897_FIXUP_UNIS_H3C_X500S] = {
12311 .type = HDA_FIXUP_VERBS,
12312 .v.verbs = (const struct hda_verb[]) {
12313 { 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12314 {}
12315 },
12316 },
12317 [ALC897_FIXUP_HEADSET_MIC_PIN3] = {
12318 .type = HDA_FIXUP_PINS,
12319 .v.pins = (const struct hda_pintbl[]) {
12320 { 0x19, 0x03a11050 }, /* use as headset mic */
12321 { }
12322 },
12323 },
12324 };
12325
12326 static const struct hda_quirk alc662_fixup_tbl[] = {
12327 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12328 SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
12329 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12330 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12331 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12332 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12333 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12334 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12335 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12336 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12337 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12338 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12339 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12340 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12341 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12342 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12343 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12344 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12345 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12346 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12347 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12348 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12349 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12350 SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12351 SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12352 SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12353 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12354 SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12355 SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12356 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12357 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12358 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12359 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12360 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12361 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12362 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12363 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12364 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12365 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12366 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12367 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12368 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12369 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12370 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12371 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12372 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12373 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12374 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12375 SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12376 SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12377 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12378 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12379 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12380 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12381 SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12382 SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12383 SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12384 SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12385 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12386 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12387 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12388 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12389 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12390 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12391 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12392 SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12393
12394 #if 0
12395 /* Below is a quirk table taken from the old code.
12396 * Basically the device should work as is without the fixup table.
12397 * If BIOS doesn't give a proper info, enable the corresponding
12398 * fixup entry.
12399 */
12400 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12401 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12402 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12403 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12404 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12405 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12406 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12407 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12408 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12409 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12410 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12411 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12412 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12413 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12414 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12415 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12416 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12417 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12418 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12419 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12420 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12421 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12422 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12423 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12424 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12425 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12426 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12427 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12428 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12429 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12430 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12431 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12432 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12433 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12434 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12435 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12436 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12437 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12438 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12439 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12440 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12441 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12442 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12443 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12444 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12445 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12446 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12447 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12448 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12449 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12450 #endif
12451 {}
12452 };
12453
12454 static const struct hda_model_fixup alc662_fixup_models[] = {
12455 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12456 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12457 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
12458 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12459 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12460 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12461 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12462 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12463 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12464 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12465 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12466 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12467 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12468 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12469 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12470 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12471 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12472 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12473 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12474 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12475 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12476 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12477 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12478 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12479 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12480 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12481 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12482 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12483 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12484 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12485 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12486 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12487 {.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12488 {}
12489 };
12490
12491 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12492 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12493 {0x17, 0x02211010},
12494 {0x18, 0x01a19030},
12495 {0x1a, 0x01813040},
12496 {0x21, 0x01014020}),
12497 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12498 {0x16, 0x01813030},
12499 {0x17, 0x02211010},
12500 {0x18, 0x01a19040},
12501 {0x21, 0x01014020}),
12502 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12503 {0x14, 0x01014010},
12504 {0x18, 0x01a19020},
12505 {0x1a, 0x0181302f},
12506 {0x1b, 0x0221401f}),
12507 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12508 {0x12, 0x99a30130},
12509 {0x14, 0x90170110},
12510 {0x15, 0x0321101f},
12511 {0x16, 0x03011020}),
12512 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12513 {0x12, 0x99a30140},
12514 {0x14, 0x90170110},
12515 {0x15, 0x0321101f},
12516 {0x16, 0x03011020}),
12517 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12518 {0x12, 0x99a30150},
12519 {0x14, 0x90170110},
12520 {0x15, 0x0321101f},
12521 {0x16, 0x03011020}),
12522 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12523 {0x14, 0x90170110},
12524 {0x15, 0x0321101f},
12525 {0x16, 0x03011020}),
12526 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12527 {0x12, 0x90a60130},
12528 {0x14, 0x90170110},
12529 {0x15, 0x0321101f}),
12530 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12531 {0x14, 0x01014010},
12532 {0x17, 0x90170150},
12533 {0x19, 0x02a11060},
12534 {0x1b, 0x01813030},
12535 {0x21, 0x02211020}),
12536 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12537 {0x14, 0x01014010},
12538 {0x18, 0x01a19040},
12539 {0x1b, 0x01813030},
12540 {0x21, 0x02211020}),
12541 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12542 {0x14, 0x01014020},
12543 {0x17, 0x90170110},
12544 {0x18, 0x01a19050},
12545 {0x1b, 0x01813040},
12546 {0x21, 0x02211030}),
12547 {}
12548 };
12549
12550 /*
12551 */
patch_alc662(struct hda_codec * codec)12552 static int patch_alc662(struct hda_codec *codec)
12553 {
12554 struct alc_spec *spec;
12555 int err;
12556
12557 err = alc_alloc_spec(codec, 0x0b);
12558 if (err < 0)
12559 return err;
12560
12561 spec = codec->spec;
12562
12563 spec->shutup = alc_eapd_shutup;
12564
12565 /* handle multiple HPs as is */
12566 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12567
12568 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12569
12570 switch (codec->core.vendor_id) {
12571 case 0x10ec0668:
12572 spec->init_hook = alc668_restore_default_value;
12573 break;
12574 }
12575
12576 alc_pre_init(codec);
12577
12578 snd_hda_pick_fixup(codec, alc662_fixup_models,
12579 alc662_fixup_tbl, alc662_fixups);
12580 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12581 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12582
12583 alc_auto_parse_customize_define(codec);
12584
12585 if (has_cdefine_beep(codec))
12586 spec->gen.beep_nid = 0x01;
12587
12588 if ((alc_get_coef0(codec) & (1 << 14)) &&
12589 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12590 spec->cdefine.platform_type == 1) {
12591 err = alc_codec_rename(codec, "ALC272X");
12592 if (err < 0)
12593 goto error;
12594 }
12595
12596 /* automatic parse from the BIOS config */
12597 err = alc662_parse_auto_config(codec);
12598 if (err < 0)
12599 goto error;
12600
12601 if (!spec->gen.no_analog && spec->gen.beep_nid) {
12602 switch (codec->core.vendor_id) {
12603 case 0x10ec0662:
12604 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12605 break;
12606 case 0x10ec0272:
12607 case 0x10ec0663:
12608 case 0x10ec0665:
12609 case 0x10ec0668:
12610 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12611 break;
12612 case 0x10ec0273:
12613 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12614 break;
12615 }
12616 if (err < 0)
12617 goto error;
12618 }
12619
12620 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12621
12622 return 0;
12623
12624 error:
12625 alc_free(codec);
12626 return err;
12627 }
12628
12629 /*
12630 * ALC680 support
12631 */
12632
alc680_parse_auto_config(struct hda_codec * codec)12633 static int alc680_parse_auto_config(struct hda_codec *codec)
12634 {
12635 return alc_parse_auto_config(codec, NULL, NULL);
12636 }
12637
12638 /*
12639 */
patch_alc680(struct hda_codec * codec)12640 static int patch_alc680(struct hda_codec *codec)
12641 {
12642 int err;
12643
12644 /* ALC680 has no aa-loopback mixer */
12645 err = alc_alloc_spec(codec, 0);
12646 if (err < 0)
12647 return err;
12648
12649 /* automatic parse from the BIOS config */
12650 err = alc680_parse_auto_config(codec);
12651 if (err < 0) {
12652 alc_free(codec);
12653 return err;
12654 }
12655
12656 return 0;
12657 }
12658
12659 /*
12660 * patch entries
12661 */
12662 static const struct hda_device_id snd_hda_id_realtek[] = {
12663 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12664 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12665 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12666 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12667 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12668 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12669 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12670 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12671 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12672 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12673 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12674 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12675 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12676 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12677 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12678 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12679 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12680 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12681 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12682 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12683 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12684 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12685 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12686 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12687 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12688 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12689 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12690 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12691 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12692 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12693 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12694 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12695 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12696 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12697 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12698 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12699 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12700 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12701 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12702 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12703 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12704 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12705 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12706 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12707 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12708 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12709 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12710 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12711 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12712 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12713 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12714 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12715 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12716 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12717 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12718 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12719 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12720 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12721 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12722 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12723 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12724 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12725 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12726 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12727 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12728 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12729 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12730 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12731 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12732 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12733 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12734 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12735 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12736 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12737 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12738 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12739 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12740 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12741 HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12742 {} /* terminator */
12743 };
12744 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12745
12746 MODULE_LICENSE("GPL");
12747 MODULE_DESCRIPTION("Realtek HD-audio codec");
12748
12749 static struct hda_codec_driver realtek_driver = {
12750 .id = snd_hda_id_realtek,
12751 };
12752
12753 module_hda_codec_driver(realtek_driver);
12754