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 case 0x10ec0294:
475 case 0x10ec0700:
476 case 0x10ec0701:
477 case 0x10ec0703:
478 case 0x10ec0711:
479 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
480 break;
481 case 0x10ec0662:
482 if ((coef & 0x00f0) == 0x0030)
483 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
484 break;
485 case 0x10ec0272:
486 case 0x10ec0273:
487 case 0x10ec0663:
488 case 0x10ec0665:
489 case 0x10ec0670:
490 case 0x10ec0671:
491 case 0x10ec0672:
492 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
493 break;
494 case 0x10ec0222:
495 case 0x10ec0623:
496 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
497 break;
498 case 0x10ec0668:
499 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
500 break;
501 case 0x10ec0867:
502 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
503 break;
504 case 0x10ec0888:
505 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
506 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
507 break;
508 case 0x10ec0892:
509 case 0x10ec0897:
510 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
511 break;
512 case 0x10ec0899:
513 case 0x10ec0900:
514 case 0x10ec0b00:
515 case 0x10ec1168:
516 case 0x10ec1220:
517 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
518 break;
519 }
520 }
521
522 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)523 static void alc888_coef_init(struct hda_codec *codec)
524 {
525 switch (alc_get_coef0(codec) & 0x00f0) {
526 /* alc888-VA */
527 case 0x00:
528 /* alc888-VB */
529 case 0x10:
530 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
531 break;
532 }
533 }
534
535 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)536 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
537 {
538 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
539 return;
540 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
541 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
542 on ? 2 : 0);
543 }
544
545 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)546 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
547 {
548 /* We currently only handle front, HP */
549 static const hda_nid_t pins[] = {
550 0x0f, 0x10, 0x14, 0x15, 0x17, 0
551 };
552 const hda_nid_t *p;
553 for (p = pins; *p; p++)
554 set_eapd(codec, *p, on);
555 }
556
557 static int find_ext_mic_pin(struct hda_codec *codec);
558
alc_headset_mic_no_shutup(struct hda_codec * codec)559 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
560 {
561 const struct hda_pincfg *pin;
562 int mic_pin = find_ext_mic_pin(codec);
563 int i;
564
565 /* don't shut up pins when unloading the driver; otherwise it breaks
566 * the default pin setup at the next load of the driver
567 */
568 if (codec->bus->shutdown)
569 return;
570
571 snd_array_for_each(&codec->init_pins, i, pin) {
572 /* use read here for syncing after issuing each verb */
573 if (pin->nid != mic_pin)
574 snd_hda_codec_read(codec, pin->nid, 0,
575 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
576 }
577
578 codec->pins_shutup = 1;
579 }
580
alc_shutup_pins(struct hda_codec * codec)581 static void alc_shutup_pins(struct hda_codec *codec)
582 {
583 struct alc_spec *spec = codec->spec;
584
585 switch (codec->core.vendor_id) {
586 case 0x10ec0236:
587 case 0x10ec0256:
588 case 0x10ec0257:
589 case 0x19e58326:
590 case 0x10ec0283:
591 case 0x10ec0285:
592 case 0x10ec0286:
593 case 0x10ec0287:
594 case 0x10ec0288:
595 case 0x10ec0295:
596 case 0x10ec0298:
597 alc_headset_mic_no_shutup(codec);
598 break;
599 default:
600 if (!spec->no_shutup_pins)
601 snd_hda_shutup_pins(codec);
602 break;
603 }
604 }
605
606 /* generic shutup callback;
607 * just turning off EAPD and a little pause for avoiding pop-noise
608 */
alc_eapd_shutup(struct hda_codec * codec)609 static void alc_eapd_shutup(struct hda_codec *codec)
610 {
611 struct alc_spec *spec = codec->spec;
612
613 alc_auto_setup_eapd(codec, false);
614 if (!spec->no_depop_delay)
615 msleep(200);
616 alc_shutup_pins(codec);
617 }
618
619 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)620 static void alc_auto_init_amp(struct hda_codec *codec, int type)
621 {
622 alc_auto_setup_eapd(codec, true);
623 alc_write_gpio(codec);
624 switch (type) {
625 case ALC_INIT_DEFAULT:
626 switch (codec->core.vendor_id) {
627 case 0x10ec0260:
628 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
629 break;
630 case 0x10ec0880:
631 case 0x10ec0882:
632 case 0x10ec0883:
633 case 0x10ec0885:
634 alc_update_coef_idx(codec, 7, 0, 0x2030);
635 break;
636 case 0x10ec0888:
637 alc888_coef_init(codec);
638 break;
639 }
640 break;
641 }
642 }
643
644 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)645 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
646 {
647 if (spec->gen.autocfg.hp_pins[0])
648 return spec->gen.autocfg.hp_pins[0];
649 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
650 return spec->gen.autocfg.line_out_pins[0];
651 return 0;
652 }
653
654 /*
655 * Realtek SSID verification
656 */
657
658 /* Could be any non-zero and even value. When used as fixup, tells
659 * the driver to ignore any present sku defines.
660 */
661 #define ALC_FIXUP_SKU_IGNORE (2)
662
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)663 static void alc_fixup_sku_ignore(struct hda_codec *codec,
664 const struct hda_fixup *fix, int action)
665 {
666 struct alc_spec *spec = codec->spec;
667 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
668 spec->cdefine.fixup = 1;
669 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
670 }
671 }
672
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)673 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
674 const struct hda_fixup *fix, int action)
675 {
676 struct alc_spec *spec = codec->spec;
677
678 if (action == HDA_FIXUP_ACT_PROBE) {
679 spec->no_depop_delay = 1;
680 codec->depop_delay = 0;
681 }
682 }
683
alc_auto_parse_customize_define(struct hda_codec * codec)684 static int alc_auto_parse_customize_define(struct hda_codec *codec)
685 {
686 unsigned int ass, tmp, i;
687 unsigned nid = 0;
688 struct alc_spec *spec = codec->spec;
689
690 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
691
692 if (spec->cdefine.fixup) {
693 ass = spec->cdefine.sku_cfg;
694 if (ass == ALC_FIXUP_SKU_IGNORE)
695 return -1;
696 goto do_sku;
697 }
698
699 if (!codec->bus->pci)
700 return -1;
701 ass = codec->core.subsystem_id & 0xffff;
702 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
703 goto do_sku;
704
705 nid = 0x1d;
706 if (codec->core.vendor_id == 0x10ec0260)
707 nid = 0x17;
708 ass = snd_hda_codec_get_pincfg(codec, nid);
709
710 if (!(ass & 1)) {
711 codec_info(codec, "%s: SKU not ready 0x%08x\n",
712 codec->core.chip_name, ass);
713 return -1;
714 }
715
716 /* check sum */
717 tmp = 0;
718 for (i = 1; i < 16; i++) {
719 if ((ass >> i) & 1)
720 tmp++;
721 }
722 if (((ass >> 16) & 0xf) != tmp)
723 return -1;
724
725 spec->cdefine.port_connectivity = ass >> 30;
726 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
727 spec->cdefine.check_sum = (ass >> 16) & 0xf;
728 spec->cdefine.customization = ass >> 8;
729 do_sku:
730 spec->cdefine.sku_cfg = ass;
731 spec->cdefine.external_amp = (ass & 0x38) >> 3;
732 spec->cdefine.platform_type = (ass & 0x4) >> 2;
733 spec->cdefine.swap = (ass & 0x2) >> 1;
734 spec->cdefine.override = ass & 0x1;
735
736 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
737 nid, spec->cdefine.sku_cfg);
738 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
739 spec->cdefine.port_connectivity);
740 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
741 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
742 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
743 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
744 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
745 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
746 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
747
748 return 0;
749 }
750
751 /* 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)752 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
753 {
754 int i;
755 for (i = 0; i < nums; i++)
756 if (list[i] == nid)
757 return i;
758 return -1;
759 }
760 /* 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)761 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
762 {
763 return find_idx_in_nid_list(nid, list, nums) >= 0;
764 }
765
766 /* check subsystem ID and set up device-specific initialization;
767 * return 1 if initialized, 0 if invalid SSID
768 */
769 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
770 * 31 ~ 16 : Manufacture ID
771 * 15 ~ 8 : SKU ID
772 * 7 ~ 0 : Assembly ID
773 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
774 */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)775 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
776 {
777 unsigned int ass, tmp, i;
778 unsigned nid;
779 struct alc_spec *spec = codec->spec;
780
781 if (spec->cdefine.fixup) {
782 ass = spec->cdefine.sku_cfg;
783 if (ass == ALC_FIXUP_SKU_IGNORE)
784 return 0;
785 goto do_sku;
786 }
787
788 ass = codec->core.subsystem_id & 0xffff;
789 if (codec->bus->pci &&
790 ass != codec->bus->pci->subsystem_device && (ass & 1))
791 goto do_sku;
792
793 /* invalid SSID, check the special NID pin defcfg instead */
794 /*
795 * 31~30 : port connectivity
796 * 29~21 : reserve
797 * 20 : PCBEEP input
798 * 19~16 : Check sum (15:1)
799 * 15~1 : Custom
800 * 0 : override
801 */
802 nid = 0x1d;
803 if (codec->core.vendor_id == 0x10ec0260)
804 nid = 0x17;
805 ass = snd_hda_codec_get_pincfg(codec, nid);
806 codec_dbg(codec,
807 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
808 ass, nid);
809 if (!(ass & 1))
810 return 0;
811 if ((ass >> 30) != 1) /* no physical connection */
812 return 0;
813
814 /* check sum */
815 tmp = 0;
816 for (i = 1; i < 16; i++) {
817 if ((ass >> i) & 1)
818 tmp++;
819 }
820 if (((ass >> 16) & 0xf) != tmp)
821 return 0;
822 do_sku:
823 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
824 ass & 0xffff, codec->core.vendor_id);
825 /*
826 * 0 : override
827 * 1 : Swap Jack
828 * 2 : 0 --> Desktop, 1 --> Laptop
829 * 3~5 : External Amplifier control
830 * 7~6 : Reserved
831 */
832 tmp = (ass & 0x38) >> 3; /* external Amp control */
833 if (spec->init_amp == ALC_INIT_UNDEFINED) {
834 switch (tmp) {
835 case 1:
836 alc_setup_gpio(codec, 0x01);
837 break;
838 case 3:
839 alc_setup_gpio(codec, 0x02);
840 break;
841 case 7:
842 alc_setup_gpio(codec, 0x04);
843 break;
844 case 5:
845 default:
846 spec->init_amp = ALC_INIT_DEFAULT;
847 break;
848 }
849 }
850
851 /* is laptop or Desktop and enable the function "Mute internal speaker
852 * when the external headphone out jack is plugged"
853 */
854 if (!(ass & 0x8000))
855 return 1;
856 /*
857 * 10~8 : Jack location
858 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
859 * 14~13: Resvered
860 * 15 : 1 --> enable the function "Mute internal speaker
861 * when the external headphone out jack is plugged"
862 */
863 if (!alc_get_hp_pin(spec)) {
864 hda_nid_t nid;
865 tmp = (ass >> 11) & 0x3; /* HP to chassis */
866 nid = ports[tmp];
867 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
868 spec->gen.autocfg.line_outs))
869 return 1;
870 spec->gen.autocfg.hp_pins[0] = nid;
871 }
872 return 1;
873 }
874
875 /* Check the validity of ALC subsystem-id
876 * 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)877 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
878 {
879 if (!alc_subsystem_id(codec, ports)) {
880 struct alc_spec *spec = codec->spec;
881 if (spec->init_amp == ALC_INIT_UNDEFINED) {
882 codec_dbg(codec,
883 "realtek: Enable default setup for auto mode as fallback\n");
884 spec->init_amp = ALC_INIT_DEFAULT;
885 }
886 }
887 }
888
889 /*
890 */
891
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)892 static void alc_fixup_inv_dmic(struct hda_codec *codec,
893 const struct hda_fixup *fix, int action)
894 {
895 struct alc_spec *spec = codec->spec;
896
897 spec->gen.inv_dmic_split = 1;
898 }
899
900
alc_build_controls(struct hda_codec * codec)901 static int alc_build_controls(struct hda_codec *codec)
902 {
903 int err;
904
905 err = snd_hda_gen_build_controls(codec);
906 if (err < 0)
907 return err;
908
909 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
910 return 0;
911 }
912
913
914 /*
915 * Common callbacks
916 */
917
alc_pre_init(struct hda_codec * codec)918 static void alc_pre_init(struct hda_codec *codec)
919 {
920 alc_fill_eapd_coef(codec);
921 }
922
923 #define is_s3_resume(codec) \
924 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
925 #define is_s4_resume(codec) \
926 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
927
alc_init(struct hda_codec * codec)928 static int alc_init(struct hda_codec *codec)
929 {
930 struct alc_spec *spec = codec->spec;
931
932 /* hibernation resume needs the full chip initialization */
933 if (is_s4_resume(codec))
934 alc_pre_init(codec);
935
936 if (spec->init_hook)
937 spec->init_hook(codec);
938
939 spec->gen.skip_verbs = 1; /* applied in below */
940 snd_hda_gen_init(codec);
941 alc_fix_pll(codec);
942 alc_auto_init_amp(codec, spec->init_amp);
943 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
944
945 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
946
947 return 0;
948 }
949
950 #define alc_free snd_hda_gen_free
951
952 #ifdef CONFIG_PM
alc_shutup(struct hda_codec * codec)953 static inline void alc_shutup(struct hda_codec *codec)
954 {
955 struct alc_spec *spec = codec->spec;
956
957 if (!snd_hda_get_bool_hint(codec, "shutup"))
958 return; /* disabled explicitly by hints */
959
960 if (spec && spec->shutup)
961 spec->shutup(codec);
962 else
963 alc_shutup_pins(codec);
964 }
965
alc_power_eapd(struct hda_codec * codec)966 static void alc_power_eapd(struct hda_codec *codec)
967 {
968 alc_auto_setup_eapd(codec, false);
969 }
970
alc_suspend(struct hda_codec * codec)971 static int alc_suspend(struct hda_codec *codec)
972 {
973 struct alc_spec *spec = codec->spec;
974 alc_shutup(codec);
975 if (spec && spec->power_hook)
976 spec->power_hook(codec);
977 return 0;
978 }
979
alc_resume(struct hda_codec * codec)980 static int alc_resume(struct hda_codec *codec)
981 {
982 struct alc_spec *spec = codec->spec;
983
984 if (!spec->no_depop_delay)
985 msleep(150); /* to avoid pop noise */
986 codec->patch_ops.init(codec);
987 snd_hda_regmap_sync(codec);
988 hda_call_check_power_status(codec, 0x01);
989 return 0;
990 }
991 #endif
992
993 /*
994 */
995 static const struct hda_codec_ops alc_patch_ops = {
996 .build_controls = alc_build_controls,
997 .build_pcms = snd_hda_gen_build_pcms,
998 .init = alc_init,
999 .free = alc_free,
1000 .unsol_event = snd_hda_jack_unsol_event,
1001 #ifdef CONFIG_PM
1002 .resume = alc_resume,
1003 .suspend = alc_suspend,
1004 .check_power_status = snd_hda_gen_check_power_status,
1005 #endif
1006 };
1007
1008
1009 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1010
1011 /*
1012 * Rename codecs appropriately from COEF value or subvendor id
1013 */
1014 struct alc_codec_rename_table {
1015 unsigned int vendor_id;
1016 unsigned short coef_mask;
1017 unsigned short coef_bits;
1018 const char *name;
1019 };
1020
1021 struct alc_codec_rename_pci_table {
1022 unsigned int codec_vendor_id;
1023 unsigned short pci_subvendor;
1024 unsigned short pci_subdevice;
1025 const char *name;
1026 };
1027
1028 static const struct alc_codec_rename_table rename_tbl[] = {
1029 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1030 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1031 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1032 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1033 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1034 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1035 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1036 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1037 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1038 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1039 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1040 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1041 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1042 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1043 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1044 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1045 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1046 { } /* terminator */
1047 };
1048
1049 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1050 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1051 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1052 { 0x10ec0283, 0x1028, 0, "ALC3223" },
1053 { 0x10ec0288, 0x1028, 0, "ALC3263" },
1054 { 0x10ec0292, 0x1028, 0, "ALC3226" },
1055 { 0x10ec0293, 0x1028, 0, "ALC3235" },
1056 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1057 { 0x10ec0668, 0x1028, 0, "ALC3661" },
1058 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1059 { 0x10ec0899, 0x1028, 0, "ALC3861" },
1060 { 0x10ec0298, 0x1028, 0, "ALC3266" },
1061 { 0x10ec0236, 0x1028, 0, "ALC3204" },
1062 { 0x10ec0256, 0x1028, 0, "ALC3246" },
1063 { 0x10ec0225, 0x1028, 0, "ALC3253" },
1064 { 0x10ec0295, 0x1028, 0, "ALC3254" },
1065 { 0x10ec0299, 0x1028, 0, "ALC3271" },
1066 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1067 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1068 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1069 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1070 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1071 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1072 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1073 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1074 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1075 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1076 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1077 { } /* terminator */
1078 };
1079
alc_codec_rename_from_preset(struct hda_codec * codec)1080 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1081 {
1082 const struct alc_codec_rename_table *p;
1083 const struct alc_codec_rename_pci_table *q;
1084
1085 for (p = rename_tbl; p->vendor_id; p++) {
1086 if (p->vendor_id != codec->core.vendor_id)
1087 continue;
1088 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1089 return alc_codec_rename(codec, p->name);
1090 }
1091
1092 if (!codec->bus->pci)
1093 return 0;
1094 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1095 if (q->codec_vendor_id != codec->core.vendor_id)
1096 continue;
1097 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1098 continue;
1099 if (!q->pci_subdevice ||
1100 q->pci_subdevice == codec->bus->pci->subsystem_device)
1101 return alc_codec_rename(codec, q->name);
1102 }
1103
1104 return 0;
1105 }
1106
1107
1108 /*
1109 * Digital-beep handlers
1110 */
1111 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1112
1113 /* additional beep mixers; private_value will be overwritten */
1114 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1115 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1116 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1117 };
1118
1119 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1120 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1121 int idx, int dir)
1122 {
1123 struct snd_kcontrol_new *knew;
1124 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1125 int i;
1126
1127 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1128 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1129 &alc_beep_mixer[i]);
1130 if (!knew)
1131 return -ENOMEM;
1132 knew->private_value = beep_amp;
1133 }
1134 return 0;
1135 }
1136
1137 static const struct snd_pci_quirk beep_allow_list[] = {
1138 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1139 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1140 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1141 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1142 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1143 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1144 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1145 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1146 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1147 /* denylist -- no beep available */
1148 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1149 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1150 {}
1151 };
1152
has_cdefine_beep(struct hda_codec * codec)1153 static inline int has_cdefine_beep(struct hda_codec *codec)
1154 {
1155 struct alc_spec *spec = codec->spec;
1156 const struct snd_pci_quirk *q;
1157 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1158 if (q)
1159 return q->value;
1160 return spec->cdefine.enable_pcbeep;
1161 }
1162 #else
1163 #define set_beep_amp(spec, nid, idx, dir) 0
1164 #define has_cdefine_beep(codec) 0
1165 #endif
1166
1167 /* parse the BIOS configuration and set up the alc_spec */
1168 /* return 1 if successful, 0 if the proper config is not found,
1169 * or a negative error code
1170 */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1171 static int alc_parse_auto_config(struct hda_codec *codec,
1172 const hda_nid_t *ignore_nids,
1173 const hda_nid_t *ssid_nids)
1174 {
1175 struct alc_spec *spec = codec->spec;
1176 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1177 int err;
1178
1179 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1180 spec->parse_flags);
1181 if (err < 0)
1182 return err;
1183
1184 if (ssid_nids)
1185 alc_ssid_check(codec, ssid_nids);
1186
1187 err = snd_hda_gen_parse_auto_config(codec, cfg);
1188 if (err < 0)
1189 return err;
1190
1191 return 1;
1192 }
1193
1194 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1195 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1196 {
1197 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1198 int err;
1199
1200 if (!spec)
1201 return -ENOMEM;
1202 codec->spec = spec;
1203 snd_hda_gen_spec_init(&spec->gen);
1204 spec->gen.mixer_nid = mixer_nid;
1205 spec->gen.own_eapd_ctl = 1;
1206 codec->single_adc_amp = 1;
1207 /* FIXME: do we need this for all Realtek codec models? */
1208 codec->spdif_status_reset = 1;
1209 codec->forced_resume = 1;
1210 codec->patch_ops = alc_patch_ops;
1211 mutex_init(&spec->coef_mutex);
1212
1213 err = alc_codec_rename_from_preset(codec);
1214 if (err < 0) {
1215 kfree(spec);
1216 return err;
1217 }
1218 return 0;
1219 }
1220
alc880_parse_auto_config(struct hda_codec * codec)1221 static int alc880_parse_auto_config(struct hda_codec *codec)
1222 {
1223 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1224 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1225 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1226 }
1227
1228 /*
1229 * ALC880 fix-ups
1230 */
1231 enum {
1232 ALC880_FIXUP_GPIO1,
1233 ALC880_FIXUP_GPIO2,
1234 ALC880_FIXUP_MEDION_RIM,
1235 ALC880_FIXUP_LG,
1236 ALC880_FIXUP_LG_LW25,
1237 ALC880_FIXUP_W810,
1238 ALC880_FIXUP_EAPD_COEF,
1239 ALC880_FIXUP_TCL_S700,
1240 ALC880_FIXUP_VOL_KNOB,
1241 ALC880_FIXUP_FUJITSU,
1242 ALC880_FIXUP_F1734,
1243 ALC880_FIXUP_UNIWILL,
1244 ALC880_FIXUP_UNIWILL_DIG,
1245 ALC880_FIXUP_Z71V,
1246 ALC880_FIXUP_ASUS_W5A,
1247 ALC880_FIXUP_3ST_BASE,
1248 ALC880_FIXUP_3ST,
1249 ALC880_FIXUP_3ST_DIG,
1250 ALC880_FIXUP_5ST_BASE,
1251 ALC880_FIXUP_5ST,
1252 ALC880_FIXUP_5ST_DIG,
1253 ALC880_FIXUP_6ST_BASE,
1254 ALC880_FIXUP_6ST,
1255 ALC880_FIXUP_6ST_DIG,
1256 ALC880_FIXUP_6ST_AUTOMUTE,
1257 };
1258
1259 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1260 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1261 const struct hda_fixup *fix, int action)
1262 {
1263 if (action == HDA_FIXUP_ACT_PROBE)
1264 snd_hda_jack_detect_enable_callback(codec, 0x21,
1265 alc_update_knob_master);
1266 }
1267
1268 static const struct hda_fixup alc880_fixups[] = {
1269 [ALC880_FIXUP_GPIO1] = {
1270 .type = HDA_FIXUP_FUNC,
1271 .v.func = alc_fixup_gpio1,
1272 },
1273 [ALC880_FIXUP_GPIO2] = {
1274 .type = HDA_FIXUP_FUNC,
1275 .v.func = alc_fixup_gpio2,
1276 },
1277 [ALC880_FIXUP_MEDION_RIM] = {
1278 .type = HDA_FIXUP_VERBS,
1279 .v.verbs = (const struct hda_verb[]) {
1280 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1281 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1282 { }
1283 },
1284 .chained = true,
1285 .chain_id = ALC880_FIXUP_GPIO2,
1286 },
1287 [ALC880_FIXUP_LG] = {
1288 .type = HDA_FIXUP_PINS,
1289 .v.pins = (const struct hda_pintbl[]) {
1290 /* disable bogus unused pins */
1291 { 0x16, 0x411111f0 },
1292 { 0x18, 0x411111f0 },
1293 { 0x1a, 0x411111f0 },
1294 { }
1295 }
1296 },
1297 [ALC880_FIXUP_LG_LW25] = {
1298 .type = HDA_FIXUP_PINS,
1299 .v.pins = (const struct hda_pintbl[]) {
1300 { 0x1a, 0x0181344f }, /* line-in */
1301 { 0x1b, 0x0321403f }, /* headphone */
1302 { }
1303 }
1304 },
1305 [ALC880_FIXUP_W810] = {
1306 .type = HDA_FIXUP_PINS,
1307 .v.pins = (const struct hda_pintbl[]) {
1308 /* disable bogus unused pins */
1309 { 0x17, 0x411111f0 },
1310 { }
1311 },
1312 .chained = true,
1313 .chain_id = ALC880_FIXUP_GPIO2,
1314 },
1315 [ALC880_FIXUP_EAPD_COEF] = {
1316 .type = HDA_FIXUP_VERBS,
1317 .v.verbs = (const struct hda_verb[]) {
1318 /* change to EAPD mode */
1319 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1320 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1321 {}
1322 },
1323 },
1324 [ALC880_FIXUP_TCL_S700] = {
1325 .type = HDA_FIXUP_VERBS,
1326 .v.verbs = (const struct hda_verb[]) {
1327 /* change to EAPD mode */
1328 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1329 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1330 {}
1331 },
1332 .chained = true,
1333 .chain_id = ALC880_FIXUP_GPIO2,
1334 },
1335 [ALC880_FIXUP_VOL_KNOB] = {
1336 .type = HDA_FIXUP_FUNC,
1337 .v.func = alc880_fixup_vol_knob,
1338 },
1339 [ALC880_FIXUP_FUJITSU] = {
1340 /* override all pins as BIOS on old Amilo is broken */
1341 .type = HDA_FIXUP_PINS,
1342 .v.pins = (const struct hda_pintbl[]) {
1343 { 0x14, 0x0121401f }, /* HP */
1344 { 0x15, 0x99030120 }, /* speaker */
1345 { 0x16, 0x99030130 }, /* bass speaker */
1346 { 0x17, 0x411111f0 }, /* N/A */
1347 { 0x18, 0x411111f0 }, /* N/A */
1348 { 0x19, 0x01a19950 }, /* mic-in */
1349 { 0x1a, 0x411111f0 }, /* N/A */
1350 { 0x1b, 0x411111f0 }, /* N/A */
1351 { 0x1c, 0x411111f0 }, /* N/A */
1352 { 0x1d, 0x411111f0 }, /* N/A */
1353 { 0x1e, 0x01454140 }, /* SPDIF out */
1354 { }
1355 },
1356 .chained = true,
1357 .chain_id = ALC880_FIXUP_VOL_KNOB,
1358 },
1359 [ALC880_FIXUP_F1734] = {
1360 /* almost compatible with FUJITSU, but no bass and SPDIF */
1361 .type = HDA_FIXUP_PINS,
1362 .v.pins = (const struct hda_pintbl[]) {
1363 { 0x14, 0x0121401f }, /* HP */
1364 { 0x15, 0x99030120 }, /* speaker */
1365 { 0x16, 0x411111f0 }, /* N/A */
1366 { 0x17, 0x411111f0 }, /* N/A */
1367 { 0x18, 0x411111f0 }, /* N/A */
1368 { 0x19, 0x01a19950 }, /* mic-in */
1369 { 0x1a, 0x411111f0 }, /* N/A */
1370 { 0x1b, 0x411111f0 }, /* N/A */
1371 { 0x1c, 0x411111f0 }, /* N/A */
1372 { 0x1d, 0x411111f0 }, /* N/A */
1373 { 0x1e, 0x411111f0 }, /* N/A */
1374 { }
1375 },
1376 .chained = true,
1377 .chain_id = ALC880_FIXUP_VOL_KNOB,
1378 },
1379 [ALC880_FIXUP_UNIWILL] = {
1380 /* need to fix HP and speaker pins to be parsed correctly */
1381 .type = HDA_FIXUP_PINS,
1382 .v.pins = (const struct hda_pintbl[]) {
1383 { 0x14, 0x0121411f }, /* HP */
1384 { 0x15, 0x99030120 }, /* speaker */
1385 { 0x16, 0x99030130 }, /* bass speaker */
1386 { }
1387 },
1388 },
1389 [ALC880_FIXUP_UNIWILL_DIG] = {
1390 .type = HDA_FIXUP_PINS,
1391 .v.pins = (const struct hda_pintbl[]) {
1392 /* disable bogus unused pins */
1393 { 0x17, 0x411111f0 },
1394 { 0x19, 0x411111f0 },
1395 { 0x1b, 0x411111f0 },
1396 { 0x1f, 0x411111f0 },
1397 { }
1398 }
1399 },
1400 [ALC880_FIXUP_Z71V] = {
1401 .type = HDA_FIXUP_PINS,
1402 .v.pins = (const struct hda_pintbl[]) {
1403 /* set up the whole pins as BIOS is utterly broken */
1404 { 0x14, 0x99030120 }, /* speaker */
1405 { 0x15, 0x0121411f }, /* HP */
1406 { 0x16, 0x411111f0 }, /* N/A */
1407 { 0x17, 0x411111f0 }, /* N/A */
1408 { 0x18, 0x01a19950 }, /* mic-in */
1409 { 0x19, 0x411111f0 }, /* N/A */
1410 { 0x1a, 0x01813031 }, /* line-in */
1411 { 0x1b, 0x411111f0 }, /* N/A */
1412 { 0x1c, 0x411111f0 }, /* N/A */
1413 { 0x1d, 0x411111f0 }, /* N/A */
1414 { 0x1e, 0x0144111e }, /* SPDIF */
1415 { }
1416 }
1417 },
1418 [ALC880_FIXUP_ASUS_W5A] = {
1419 .type = HDA_FIXUP_PINS,
1420 .v.pins = (const struct hda_pintbl[]) {
1421 /* set up the whole pins as BIOS is utterly broken */
1422 { 0x14, 0x0121411f }, /* HP */
1423 { 0x15, 0x411111f0 }, /* N/A */
1424 { 0x16, 0x411111f0 }, /* N/A */
1425 { 0x17, 0x411111f0 }, /* N/A */
1426 { 0x18, 0x90a60160 }, /* mic */
1427 { 0x19, 0x411111f0 }, /* N/A */
1428 { 0x1a, 0x411111f0 }, /* N/A */
1429 { 0x1b, 0x411111f0 }, /* N/A */
1430 { 0x1c, 0x411111f0 }, /* N/A */
1431 { 0x1d, 0x411111f0 }, /* N/A */
1432 { 0x1e, 0xb743111e }, /* SPDIF out */
1433 { }
1434 },
1435 .chained = true,
1436 .chain_id = ALC880_FIXUP_GPIO1,
1437 },
1438 [ALC880_FIXUP_3ST_BASE] = {
1439 .type = HDA_FIXUP_PINS,
1440 .v.pins = (const struct hda_pintbl[]) {
1441 { 0x14, 0x01014010 }, /* line-out */
1442 { 0x15, 0x411111f0 }, /* N/A */
1443 { 0x16, 0x411111f0 }, /* N/A */
1444 { 0x17, 0x411111f0 }, /* N/A */
1445 { 0x18, 0x01a19c30 }, /* mic-in */
1446 { 0x19, 0x0121411f }, /* HP */
1447 { 0x1a, 0x01813031 }, /* line-in */
1448 { 0x1b, 0x02a19c40 }, /* front-mic */
1449 { 0x1c, 0x411111f0 }, /* N/A */
1450 { 0x1d, 0x411111f0 }, /* N/A */
1451 /* 0x1e is filled in below */
1452 { 0x1f, 0x411111f0 }, /* N/A */
1453 { }
1454 }
1455 },
1456 [ALC880_FIXUP_3ST] = {
1457 .type = HDA_FIXUP_PINS,
1458 .v.pins = (const struct hda_pintbl[]) {
1459 { 0x1e, 0x411111f0 }, /* N/A */
1460 { }
1461 },
1462 .chained = true,
1463 .chain_id = ALC880_FIXUP_3ST_BASE,
1464 },
1465 [ALC880_FIXUP_3ST_DIG] = {
1466 .type = HDA_FIXUP_PINS,
1467 .v.pins = (const struct hda_pintbl[]) {
1468 { 0x1e, 0x0144111e }, /* SPDIF */
1469 { }
1470 },
1471 .chained = true,
1472 .chain_id = ALC880_FIXUP_3ST_BASE,
1473 },
1474 [ALC880_FIXUP_5ST_BASE] = {
1475 .type = HDA_FIXUP_PINS,
1476 .v.pins = (const struct hda_pintbl[]) {
1477 { 0x14, 0x01014010 }, /* front */
1478 { 0x15, 0x411111f0 }, /* N/A */
1479 { 0x16, 0x01011411 }, /* CLFE */
1480 { 0x17, 0x01016412 }, /* surr */
1481 { 0x18, 0x01a19c30 }, /* mic-in */
1482 { 0x19, 0x0121411f }, /* HP */
1483 { 0x1a, 0x01813031 }, /* line-in */
1484 { 0x1b, 0x02a19c40 }, /* front-mic */
1485 { 0x1c, 0x411111f0 }, /* N/A */
1486 { 0x1d, 0x411111f0 }, /* N/A */
1487 /* 0x1e is filled in below */
1488 { 0x1f, 0x411111f0 }, /* N/A */
1489 { }
1490 }
1491 },
1492 [ALC880_FIXUP_5ST] = {
1493 .type = HDA_FIXUP_PINS,
1494 .v.pins = (const struct hda_pintbl[]) {
1495 { 0x1e, 0x411111f0 }, /* N/A */
1496 { }
1497 },
1498 .chained = true,
1499 .chain_id = ALC880_FIXUP_5ST_BASE,
1500 },
1501 [ALC880_FIXUP_5ST_DIG] = {
1502 .type = HDA_FIXUP_PINS,
1503 .v.pins = (const struct hda_pintbl[]) {
1504 { 0x1e, 0x0144111e }, /* SPDIF */
1505 { }
1506 },
1507 .chained = true,
1508 .chain_id = ALC880_FIXUP_5ST_BASE,
1509 },
1510 [ALC880_FIXUP_6ST_BASE] = {
1511 .type = HDA_FIXUP_PINS,
1512 .v.pins = (const struct hda_pintbl[]) {
1513 { 0x14, 0x01014010 }, /* front */
1514 { 0x15, 0x01016412 }, /* surr */
1515 { 0x16, 0x01011411 }, /* CLFE */
1516 { 0x17, 0x01012414 }, /* side */
1517 { 0x18, 0x01a19c30 }, /* mic-in */
1518 { 0x19, 0x02a19c40 }, /* front-mic */
1519 { 0x1a, 0x01813031 }, /* line-in */
1520 { 0x1b, 0x0121411f }, /* HP */
1521 { 0x1c, 0x411111f0 }, /* N/A */
1522 { 0x1d, 0x411111f0 }, /* N/A */
1523 /* 0x1e is filled in below */
1524 { 0x1f, 0x411111f0 }, /* N/A */
1525 { }
1526 }
1527 },
1528 [ALC880_FIXUP_6ST] = {
1529 .type = HDA_FIXUP_PINS,
1530 .v.pins = (const struct hda_pintbl[]) {
1531 { 0x1e, 0x411111f0 }, /* N/A */
1532 { }
1533 },
1534 .chained = true,
1535 .chain_id = ALC880_FIXUP_6ST_BASE,
1536 },
1537 [ALC880_FIXUP_6ST_DIG] = {
1538 .type = HDA_FIXUP_PINS,
1539 .v.pins = (const struct hda_pintbl[]) {
1540 { 0x1e, 0x0144111e }, /* SPDIF */
1541 { }
1542 },
1543 .chained = true,
1544 .chain_id = ALC880_FIXUP_6ST_BASE,
1545 },
1546 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1547 .type = HDA_FIXUP_PINS,
1548 .v.pins = (const struct hda_pintbl[]) {
1549 { 0x1b, 0x0121401f }, /* HP with jack detect */
1550 { }
1551 },
1552 .chained_before = true,
1553 .chain_id = ALC880_FIXUP_6ST_BASE,
1554 },
1555 };
1556
1557 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1558 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1559 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1560 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1561 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1562 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1563 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1564 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1565 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1566 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1567 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1568 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1569 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1570 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1571 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1572 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1573 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1574 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1575 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1576 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1577 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1578 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1579 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1580 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1581
1582 /* Below is the copied entries from alc880_quirks.c.
1583 * It's not quite sure whether BIOS sets the correct pin-config table
1584 * on these machines, thus they are kept to be compatible with
1585 * the old static quirks. Once when it's confirmed to work without
1586 * these overrides, it'd be better to remove.
1587 */
1588 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1589 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1590 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1591 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1592 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1593 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1594 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1595 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1596 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1597 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1598 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1599 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1600 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1601 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1602 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1603 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1604 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1605 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1606 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1607 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1608 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1609 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1610 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1611 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1612 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1613 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1615 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1616 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1617 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1618 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1619 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1620 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1621 /* default Intel */
1622 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1623 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1624 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1625 {}
1626 };
1627
1628 static const struct hda_model_fixup alc880_fixup_models[] = {
1629 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1630 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1631 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1632 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1633 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1634 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1635 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1636 {}
1637 };
1638
1639
1640 /*
1641 * OK, here we have finally the patch for ALC880
1642 */
patch_alc880(struct hda_codec * codec)1643 static int patch_alc880(struct hda_codec *codec)
1644 {
1645 struct alc_spec *spec;
1646 int err;
1647
1648 err = alc_alloc_spec(codec, 0x0b);
1649 if (err < 0)
1650 return err;
1651
1652 spec = codec->spec;
1653 spec->gen.need_dac_fix = 1;
1654 spec->gen.beep_nid = 0x01;
1655
1656 codec->patch_ops.unsol_event = alc880_unsol_event;
1657
1658 alc_pre_init(codec);
1659
1660 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1661 alc880_fixups);
1662 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1663
1664 /* automatic parse from the BIOS config */
1665 err = alc880_parse_auto_config(codec);
1666 if (err < 0)
1667 goto error;
1668
1669 if (!spec->gen.no_analog) {
1670 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1671 if (err < 0)
1672 goto error;
1673 }
1674
1675 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1676
1677 return 0;
1678
1679 error:
1680 alc_free(codec);
1681 return err;
1682 }
1683
1684
1685 /*
1686 * ALC260 support
1687 */
alc260_parse_auto_config(struct hda_codec * codec)1688 static int alc260_parse_auto_config(struct hda_codec *codec)
1689 {
1690 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1691 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1692 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1693 }
1694
1695 /*
1696 * Pin config fixes
1697 */
1698 enum {
1699 ALC260_FIXUP_HP_DC5750,
1700 ALC260_FIXUP_HP_PIN_0F,
1701 ALC260_FIXUP_COEF,
1702 ALC260_FIXUP_GPIO1,
1703 ALC260_FIXUP_GPIO1_TOGGLE,
1704 ALC260_FIXUP_REPLACER,
1705 ALC260_FIXUP_HP_B1900,
1706 ALC260_FIXUP_KN1,
1707 ALC260_FIXUP_FSC_S7020,
1708 ALC260_FIXUP_FSC_S7020_JWSE,
1709 ALC260_FIXUP_VAIO_PINS,
1710 };
1711
alc260_gpio1_automute(struct hda_codec * codec)1712 static void alc260_gpio1_automute(struct hda_codec *codec)
1713 {
1714 struct alc_spec *spec = codec->spec;
1715
1716 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1717 }
1718
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1719 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1720 const struct hda_fixup *fix, int action)
1721 {
1722 struct alc_spec *spec = codec->spec;
1723 if (action == HDA_FIXUP_ACT_PROBE) {
1724 /* although the machine has only one output pin, we need to
1725 * toggle GPIO1 according to the jack state
1726 */
1727 spec->gen.automute_hook = alc260_gpio1_automute;
1728 spec->gen.detect_hp = 1;
1729 spec->gen.automute_speaker = 1;
1730 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1731 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1732 snd_hda_gen_hp_automute);
1733 alc_setup_gpio(codec, 0x01);
1734 }
1735 }
1736
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1737 static void alc260_fixup_kn1(struct hda_codec *codec,
1738 const struct hda_fixup *fix, int action)
1739 {
1740 struct alc_spec *spec = codec->spec;
1741 static const struct hda_pintbl pincfgs[] = {
1742 { 0x0f, 0x02214000 }, /* HP/speaker */
1743 { 0x12, 0x90a60160 }, /* int mic */
1744 { 0x13, 0x02a19000 }, /* ext mic */
1745 { 0x18, 0x01446000 }, /* SPDIF out */
1746 /* disable bogus I/O pins */
1747 { 0x10, 0x411111f0 },
1748 { 0x11, 0x411111f0 },
1749 { 0x14, 0x411111f0 },
1750 { 0x15, 0x411111f0 },
1751 { 0x16, 0x411111f0 },
1752 { 0x17, 0x411111f0 },
1753 { 0x19, 0x411111f0 },
1754 { }
1755 };
1756
1757 switch (action) {
1758 case HDA_FIXUP_ACT_PRE_PROBE:
1759 snd_hda_apply_pincfgs(codec, pincfgs);
1760 spec->init_amp = ALC_INIT_NONE;
1761 break;
1762 }
1763 }
1764
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1765 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1766 const struct hda_fixup *fix, int action)
1767 {
1768 struct alc_spec *spec = codec->spec;
1769 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1770 spec->init_amp = ALC_INIT_NONE;
1771 }
1772
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1773 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1774 const struct hda_fixup *fix, int action)
1775 {
1776 struct alc_spec *spec = codec->spec;
1777 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1778 spec->gen.add_jack_modes = 1;
1779 spec->gen.hp_mic = 1;
1780 }
1781 }
1782
1783 static const struct hda_fixup alc260_fixups[] = {
1784 [ALC260_FIXUP_HP_DC5750] = {
1785 .type = HDA_FIXUP_PINS,
1786 .v.pins = (const struct hda_pintbl[]) {
1787 { 0x11, 0x90130110 }, /* speaker */
1788 { }
1789 }
1790 },
1791 [ALC260_FIXUP_HP_PIN_0F] = {
1792 .type = HDA_FIXUP_PINS,
1793 .v.pins = (const struct hda_pintbl[]) {
1794 { 0x0f, 0x01214000 }, /* HP */
1795 { }
1796 }
1797 },
1798 [ALC260_FIXUP_COEF] = {
1799 .type = HDA_FIXUP_VERBS,
1800 .v.verbs = (const struct hda_verb[]) {
1801 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1802 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1803 { }
1804 },
1805 },
1806 [ALC260_FIXUP_GPIO1] = {
1807 .type = HDA_FIXUP_FUNC,
1808 .v.func = alc_fixup_gpio1,
1809 },
1810 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1811 .type = HDA_FIXUP_FUNC,
1812 .v.func = alc260_fixup_gpio1_toggle,
1813 .chained = true,
1814 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1815 },
1816 [ALC260_FIXUP_REPLACER] = {
1817 .type = HDA_FIXUP_VERBS,
1818 .v.verbs = (const struct hda_verb[]) {
1819 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1820 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1821 { }
1822 },
1823 .chained = true,
1824 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1825 },
1826 [ALC260_FIXUP_HP_B1900] = {
1827 .type = HDA_FIXUP_FUNC,
1828 .v.func = alc260_fixup_gpio1_toggle,
1829 .chained = true,
1830 .chain_id = ALC260_FIXUP_COEF,
1831 },
1832 [ALC260_FIXUP_KN1] = {
1833 .type = HDA_FIXUP_FUNC,
1834 .v.func = alc260_fixup_kn1,
1835 },
1836 [ALC260_FIXUP_FSC_S7020] = {
1837 .type = HDA_FIXUP_FUNC,
1838 .v.func = alc260_fixup_fsc_s7020,
1839 },
1840 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1841 .type = HDA_FIXUP_FUNC,
1842 .v.func = alc260_fixup_fsc_s7020_jwse,
1843 .chained = true,
1844 .chain_id = ALC260_FIXUP_FSC_S7020,
1845 },
1846 [ALC260_FIXUP_VAIO_PINS] = {
1847 .type = HDA_FIXUP_PINS,
1848 .v.pins = (const struct hda_pintbl[]) {
1849 /* Pin configs are missing completely on some VAIOs */
1850 { 0x0f, 0x01211020 },
1851 { 0x10, 0x0001003f },
1852 { 0x11, 0x411111f0 },
1853 { 0x12, 0x01a15930 },
1854 { 0x13, 0x411111f0 },
1855 { 0x14, 0x411111f0 },
1856 { 0x15, 0x411111f0 },
1857 { 0x16, 0x411111f0 },
1858 { 0x17, 0x411111f0 },
1859 { 0x18, 0x411111f0 },
1860 { 0x19, 0x411111f0 },
1861 { }
1862 }
1863 },
1864 };
1865
1866 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1867 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1868 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1869 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1870 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1871 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1872 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1873 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1874 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1875 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1876 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1877 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1878 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1879 {}
1880 };
1881
1882 static const struct hda_model_fixup alc260_fixup_models[] = {
1883 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1884 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1885 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1886 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1887 {}
1888 };
1889
1890 /*
1891 */
patch_alc260(struct hda_codec * codec)1892 static int patch_alc260(struct hda_codec *codec)
1893 {
1894 struct alc_spec *spec;
1895 int err;
1896
1897 err = alc_alloc_spec(codec, 0x07);
1898 if (err < 0)
1899 return err;
1900
1901 spec = codec->spec;
1902 /* as quite a few machines require HP amp for speaker outputs,
1903 * it's easier to enable it unconditionally; even if it's unneeded,
1904 * it's almost harmless.
1905 */
1906 spec->gen.prefer_hp_amp = 1;
1907 spec->gen.beep_nid = 0x01;
1908
1909 spec->shutup = alc_eapd_shutup;
1910
1911 alc_pre_init(codec);
1912
1913 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1914 alc260_fixups);
1915 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1916
1917 /* automatic parse from the BIOS config */
1918 err = alc260_parse_auto_config(codec);
1919 if (err < 0)
1920 goto error;
1921
1922 if (!spec->gen.no_analog) {
1923 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1924 if (err < 0)
1925 goto error;
1926 }
1927
1928 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1929
1930 return 0;
1931
1932 error:
1933 alc_free(codec);
1934 return err;
1935 }
1936
1937
1938 /*
1939 * ALC882/883/885/888/889 support
1940 *
1941 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1942 * configuration. Each pin widget can choose any input DACs and a mixer.
1943 * Each ADC is connected from a mixer of all inputs. This makes possible
1944 * 6-channel independent captures.
1945 *
1946 * In addition, an independent DAC for the multi-playback (not used in this
1947 * driver yet).
1948 */
1949
1950 /*
1951 * Pin config fixes
1952 */
1953 enum {
1954 ALC882_FIXUP_ABIT_AW9D_MAX,
1955 ALC882_FIXUP_LENOVO_Y530,
1956 ALC882_FIXUP_PB_M5210,
1957 ALC882_FIXUP_ACER_ASPIRE_7736,
1958 ALC882_FIXUP_ASUS_W90V,
1959 ALC889_FIXUP_CD,
1960 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1961 ALC889_FIXUP_VAIO_TT,
1962 ALC888_FIXUP_EEE1601,
1963 ALC886_FIXUP_EAPD,
1964 ALC882_FIXUP_EAPD,
1965 ALC883_FIXUP_EAPD,
1966 ALC883_FIXUP_ACER_EAPD,
1967 ALC882_FIXUP_GPIO1,
1968 ALC882_FIXUP_GPIO2,
1969 ALC882_FIXUP_GPIO3,
1970 ALC889_FIXUP_COEF,
1971 ALC882_FIXUP_ASUS_W2JC,
1972 ALC882_FIXUP_ACER_ASPIRE_4930G,
1973 ALC882_FIXUP_ACER_ASPIRE_8930G,
1974 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1975 ALC885_FIXUP_MACPRO_GPIO,
1976 ALC889_FIXUP_DAC_ROUTE,
1977 ALC889_FIXUP_MBP_VREF,
1978 ALC889_FIXUP_IMAC91_VREF,
1979 ALC889_FIXUP_MBA11_VREF,
1980 ALC889_FIXUP_MBA21_VREF,
1981 ALC889_FIXUP_MP11_VREF,
1982 ALC889_FIXUP_MP41_VREF,
1983 ALC882_FIXUP_INV_DMIC,
1984 ALC882_FIXUP_NO_PRIMARY_HP,
1985 ALC887_FIXUP_ASUS_BASS,
1986 ALC887_FIXUP_BASS_CHMAP,
1987 ALC1220_FIXUP_GB_DUAL_CODECS,
1988 ALC1220_FIXUP_GB_X570,
1989 ALC1220_FIXUP_CLEVO_P950,
1990 ALC1220_FIXUP_CLEVO_PB51ED,
1991 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1992 ALC887_FIXUP_ASUS_AUDIO,
1993 ALC887_FIXUP_ASUS_HMIC,
1994 ALCS1200A_FIXUP_MIC_VREF,
1995 ALC888VD_FIXUP_MIC_100VREF,
1996 };
1997
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)1998 static void alc889_fixup_coef(struct hda_codec *codec,
1999 const struct hda_fixup *fix, int action)
2000 {
2001 if (action != HDA_FIXUP_ACT_INIT)
2002 return;
2003 alc_update_coef_idx(codec, 7, 0, 0x2030);
2004 }
2005
2006 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2007 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2008 const struct hda_fixup *fix, int action)
2009 {
2010 struct alc_spec *spec = codec->spec;
2011
2012 spec->gpio_write_delay = true;
2013 alc_fixup_gpio3(codec, fix, action);
2014 }
2015
2016 /* Fix the connection of some pins for ALC889:
2017 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2018 * work correctly (bko#42740)
2019 */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2020 static void alc889_fixup_dac_route(struct hda_codec *codec,
2021 const struct hda_fixup *fix, int action)
2022 {
2023 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2024 /* fake the connections during parsing the tree */
2025 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2026 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2027 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2028 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2029 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2030 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2031 } else if (action == HDA_FIXUP_ACT_PROBE) {
2032 /* restore the connections */
2033 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2034 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2035 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2036 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2037 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2038 }
2039 }
2040
2041 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2042 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2043 const struct hda_fixup *fix, int action)
2044 {
2045 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2046 struct alc_spec *spec = codec->spec;
2047 int i;
2048
2049 if (action != HDA_FIXUP_ACT_INIT)
2050 return;
2051 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2052 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2053 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2054 continue;
2055 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2056 val |= AC_PINCTL_VREF_80;
2057 snd_hda_set_pin_ctl(codec, nids[i], val);
2058 spec->gen.keep_vref_in_automute = 1;
2059 break;
2060 }
2061 }
2062
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2063 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2064 const hda_nid_t *nids, int num_nids)
2065 {
2066 struct alc_spec *spec = codec->spec;
2067 int i;
2068
2069 for (i = 0; i < num_nids; i++) {
2070 unsigned int val;
2071 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2072 val |= AC_PINCTL_VREF_50;
2073 snd_hda_set_pin_ctl(codec, nids[i], val);
2074 }
2075 spec->gen.keep_vref_in_automute = 1;
2076 }
2077
2078 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2079 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2080 const struct hda_fixup *fix, int action)
2081 {
2082 static const hda_nid_t nids[] = { 0x18, 0x1a };
2083
2084 if (action == HDA_FIXUP_ACT_INIT)
2085 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2086 }
2087
2088 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2089 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2090 const struct hda_fixup *fix, int action)
2091 {
2092 static const hda_nid_t nids[] = { 0x18 };
2093
2094 if (action == HDA_FIXUP_ACT_INIT)
2095 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2096 }
2097
2098 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2099 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2100 const struct hda_fixup *fix, int action)
2101 {
2102 static const hda_nid_t nids[] = { 0x18, 0x19 };
2103
2104 if (action == HDA_FIXUP_ACT_INIT)
2105 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2106 }
2107
2108 /* Don't take HP output as primary
2109 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2110 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2111 */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2112 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2113 const struct hda_fixup *fix, int action)
2114 {
2115 struct alc_spec *spec = codec->spec;
2116 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2117 spec->gen.no_primary_hp = 1;
2118 spec->gen.no_multi_io = 1;
2119 }
2120 }
2121
2122 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2123 const struct hda_fixup *fix, int action);
2124
2125 /* For dual-codec configuration, we need to disable some features to avoid
2126 * conflicts of kctls and PCM streams
2127 */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2128 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2129 const struct hda_fixup *fix, int action)
2130 {
2131 struct alc_spec *spec = codec->spec;
2132
2133 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2134 return;
2135 /* disable vmaster */
2136 spec->gen.suppress_vmaster = 1;
2137 /* auto-mute and auto-mic switch don't work with multiple codecs */
2138 spec->gen.suppress_auto_mute = 1;
2139 spec->gen.suppress_auto_mic = 1;
2140 /* disable aamix as well */
2141 spec->gen.mixer_nid = 0;
2142 /* add location prefix to avoid conflicts */
2143 codec->force_pin_prefix = 1;
2144 }
2145
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2146 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2147 const char *newname)
2148 {
2149 struct snd_kcontrol *kctl;
2150
2151 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2152 if (kctl)
2153 snd_ctl_rename(codec->card, kctl, newname);
2154 }
2155
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2156 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2157 const struct hda_fixup *fix,
2158 int action)
2159 {
2160 alc_fixup_dual_codecs(codec, fix, action);
2161 switch (action) {
2162 case HDA_FIXUP_ACT_PRE_PROBE:
2163 /* override card longname to provide a unique UCM profile */
2164 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2165 break;
2166 case HDA_FIXUP_ACT_BUILD:
2167 /* rename Capture controls depending on the codec */
2168 rename_ctl(codec, "Capture Volume",
2169 codec->addr == 0 ?
2170 "Rear-Panel Capture Volume" :
2171 "Front-Panel Capture Volume");
2172 rename_ctl(codec, "Capture Switch",
2173 codec->addr == 0 ?
2174 "Rear-Panel Capture Switch" :
2175 "Front-Panel Capture Switch");
2176 break;
2177 }
2178 }
2179
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2180 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2181 const struct hda_fixup *fix,
2182 int action)
2183 {
2184 static const hda_nid_t conn1[] = { 0x0c };
2185 static const struct coef_fw gb_x570_coefs[] = {
2186 WRITE_COEF(0x07, 0x03c0),
2187 WRITE_COEF(0x1a, 0x01c1),
2188 WRITE_COEF(0x1b, 0x0202),
2189 WRITE_COEF(0x43, 0x3005),
2190 {}
2191 };
2192
2193 switch (action) {
2194 case HDA_FIXUP_ACT_PRE_PROBE:
2195 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2196 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2197 break;
2198 case HDA_FIXUP_ACT_INIT:
2199 alc_process_coef_fw(codec, gb_x570_coefs);
2200 break;
2201 }
2202 }
2203
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2204 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2205 const struct hda_fixup *fix,
2206 int action)
2207 {
2208 static const hda_nid_t conn1[] = { 0x0c };
2209
2210 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2211 return;
2212
2213 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2214 /* We therefore want to make sure 0x14 (front headphone) and
2215 * 0x1b (speakers) use the stereo DAC 0x02
2216 */
2217 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2218 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2219 }
2220
2221 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2222 const struct hda_fixup *fix, int action);
2223
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2224 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2225 const struct hda_fixup *fix,
2226 int action)
2227 {
2228 alc1220_fixup_clevo_p950(codec, fix, action);
2229 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2230 }
2231
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2232 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2233 struct hda_jack_callback *jack)
2234 {
2235 struct alc_spec *spec = codec->spec;
2236 unsigned int vref;
2237
2238 snd_hda_gen_hp_automute(codec, jack);
2239
2240 if (spec->gen.hp_jack_present)
2241 vref = AC_PINCTL_VREF_80;
2242 else
2243 vref = AC_PINCTL_VREF_HIZ;
2244 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2245 }
2246
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2247 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2248 const struct hda_fixup *fix, int action)
2249 {
2250 struct alc_spec *spec = codec->spec;
2251 if (action != HDA_FIXUP_ACT_PROBE)
2252 return;
2253 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2254 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2255 }
2256
2257 static const struct hda_fixup alc882_fixups[] = {
2258 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2259 .type = HDA_FIXUP_PINS,
2260 .v.pins = (const struct hda_pintbl[]) {
2261 { 0x15, 0x01080104 }, /* side */
2262 { 0x16, 0x01011012 }, /* rear */
2263 { 0x17, 0x01016011 }, /* clfe */
2264 { }
2265 }
2266 },
2267 [ALC882_FIXUP_LENOVO_Y530] = {
2268 .type = HDA_FIXUP_PINS,
2269 .v.pins = (const struct hda_pintbl[]) {
2270 { 0x15, 0x99130112 }, /* rear int speakers */
2271 { 0x16, 0x99130111 }, /* subwoofer */
2272 { }
2273 }
2274 },
2275 [ALC882_FIXUP_PB_M5210] = {
2276 .type = HDA_FIXUP_PINCTLS,
2277 .v.pins = (const struct hda_pintbl[]) {
2278 { 0x19, PIN_VREF50 },
2279 {}
2280 }
2281 },
2282 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2283 .type = HDA_FIXUP_FUNC,
2284 .v.func = alc_fixup_sku_ignore,
2285 },
2286 [ALC882_FIXUP_ASUS_W90V] = {
2287 .type = HDA_FIXUP_PINS,
2288 .v.pins = (const struct hda_pintbl[]) {
2289 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2290 { }
2291 }
2292 },
2293 [ALC889_FIXUP_CD] = {
2294 .type = HDA_FIXUP_PINS,
2295 .v.pins = (const struct hda_pintbl[]) {
2296 { 0x1c, 0x993301f0 }, /* CD */
2297 { }
2298 }
2299 },
2300 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2301 .type = HDA_FIXUP_PINS,
2302 .v.pins = (const struct hda_pintbl[]) {
2303 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2304 { }
2305 },
2306 .chained = true,
2307 .chain_id = ALC889_FIXUP_CD,
2308 },
2309 [ALC889_FIXUP_VAIO_TT] = {
2310 .type = HDA_FIXUP_PINS,
2311 .v.pins = (const struct hda_pintbl[]) {
2312 { 0x17, 0x90170111 }, /* hidden surround speaker */
2313 { }
2314 }
2315 },
2316 [ALC888_FIXUP_EEE1601] = {
2317 .type = HDA_FIXUP_VERBS,
2318 .v.verbs = (const struct hda_verb[]) {
2319 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2320 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2321 { }
2322 }
2323 },
2324 [ALC886_FIXUP_EAPD] = {
2325 .type = HDA_FIXUP_VERBS,
2326 .v.verbs = (const struct hda_verb[]) {
2327 /* change to EAPD mode */
2328 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2329 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2330 { }
2331 }
2332 },
2333 [ALC882_FIXUP_EAPD] = {
2334 .type = HDA_FIXUP_VERBS,
2335 .v.verbs = (const struct hda_verb[]) {
2336 /* change to EAPD mode */
2337 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2338 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2339 { }
2340 }
2341 },
2342 [ALC883_FIXUP_EAPD] = {
2343 .type = HDA_FIXUP_VERBS,
2344 .v.verbs = (const struct hda_verb[]) {
2345 /* change to EAPD mode */
2346 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2347 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2348 { }
2349 }
2350 },
2351 [ALC883_FIXUP_ACER_EAPD] = {
2352 .type = HDA_FIXUP_VERBS,
2353 .v.verbs = (const struct hda_verb[]) {
2354 /* eanable EAPD on Acer laptops */
2355 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2356 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2357 { }
2358 }
2359 },
2360 [ALC882_FIXUP_GPIO1] = {
2361 .type = HDA_FIXUP_FUNC,
2362 .v.func = alc_fixup_gpio1,
2363 },
2364 [ALC882_FIXUP_GPIO2] = {
2365 .type = HDA_FIXUP_FUNC,
2366 .v.func = alc_fixup_gpio2,
2367 },
2368 [ALC882_FIXUP_GPIO3] = {
2369 .type = HDA_FIXUP_FUNC,
2370 .v.func = alc_fixup_gpio3,
2371 },
2372 [ALC882_FIXUP_ASUS_W2JC] = {
2373 .type = HDA_FIXUP_FUNC,
2374 .v.func = alc_fixup_gpio1,
2375 .chained = true,
2376 .chain_id = ALC882_FIXUP_EAPD,
2377 },
2378 [ALC889_FIXUP_COEF] = {
2379 .type = HDA_FIXUP_FUNC,
2380 .v.func = alc889_fixup_coef,
2381 },
2382 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2383 .type = HDA_FIXUP_PINS,
2384 .v.pins = (const struct hda_pintbl[]) {
2385 { 0x16, 0x99130111 }, /* CLFE speaker */
2386 { 0x17, 0x99130112 }, /* surround speaker */
2387 { }
2388 },
2389 .chained = true,
2390 .chain_id = ALC882_FIXUP_GPIO1,
2391 },
2392 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2393 .type = HDA_FIXUP_PINS,
2394 .v.pins = (const struct hda_pintbl[]) {
2395 { 0x16, 0x99130111 }, /* CLFE speaker */
2396 { 0x1b, 0x99130112 }, /* surround speaker */
2397 { }
2398 },
2399 .chained = true,
2400 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2401 },
2402 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2403 /* additional init verbs for Acer Aspire 8930G */
2404 .type = HDA_FIXUP_VERBS,
2405 .v.verbs = (const struct hda_verb[]) {
2406 /* Enable all DACs */
2407 /* DAC DISABLE/MUTE 1? */
2408 /* setting bits 1-5 disables DAC nids 0x02-0x06
2409 * apparently. Init=0x38 */
2410 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2411 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2412 /* DAC DISABLE/MUTE 2? */
2413 /* some bit here disables the other DACs.
2414 * Init=0x4900 */
2415 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2416 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2417 /* DMIC fix
2418 * This laptop has a stereo digital microphone.
2419 * The mics are only 1cm apart which makes the stereo
2420 * useless. However, either the mic or the ALC889
2421 * makes the signal become a difference/sum signal
2422 * instead of standard stereo, which is annoying.
2423 * So instead we flip this bit which makes the
2424 * codec replicate the sum signal to both channels,
2425 * turning it into a normal mono mic.
2426 */
2427 /* DMIC_CONTROL? Init value = 0x0001 */
2428 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2429 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2430 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2431 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2432 { }
2433 },
2434 .chained = true,
2435 .chain_id = ALC882_FIXUP_GPIO1,
2436 },
2437 [ALC885_FIXUP_MACPRO_GPIO] = {
2438 .type = HDA_FIXUP_FUNC,
2439 .v.func = alc885_fixup_macpro_gpio,
2440 },
2441 [ALC889_FIXUP_DAC_ROUTE] = {
2442 .type = HDA_FIXUP_FUNC,
2443 .v.func = alc889_fixup_dac_route,
2444 },
2445 [ALC889_FIXUP_MBP_VREF] = {
2446 .type = HDA_FIXUP_FUNC,
2447 .v.func = alc889_fixup_mbp_vref,
2448 .chained = true,
2449 .chain_id = ALC882_FIXUP_GPIO1,
2450 },
2451 [ALC889_FIXUP_IMAC91_VREF] = {
2452 .type = HDA_FIXUP_FUNC,
2453 .v.func = alc889_fixup_imac91_vref,
2454 .chained = true,
2455 .chain_id = ALC882_FIXUP_GPIO1,
2456 },
2457 [ALC889_FIXUP_MBA11_VREF] = {
2458 .type = HDA_FIXUP_FUNC,
2459 .v.func = alc889_fixup_mba11_vref,
2460 .chained = true,
2461 .chain_id = ALC889_FIXUP_MBP_VREF,
2462 },
2463 [ALC889_FIXUP_MBA21_VREF] = {
2464 .type = HDA_FIXUP_FUNC,
2465 .v.func = alc889_fixup_mba21_vref,
2466 .chained = true,
2467 .chain_id = ALC889_FIXUP_MBP_VREF,
2468 },
2469 [ALC889_FIXUP_MP11_VREF] = {
2470 .type = HDA_FIXUP_FUNC,
2471 .v.func = alc889_fixup_mba11_vref,
2472 .chained = true,
2473 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2474 },
2475 [ALC889_FIXUP_MP41_VREF] = {
2476 .type = HDA_FIXUP_FUNC,
2477 .v.func = alc889_fixup_mbp_vref,
2478 .chained = true,
2479 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2480 },
2481 [ALC882_FIXUP_INV_DMIC] = {
2482 .type = HDA_FIXUP_FUNC,
2483 .v.func = alc_fixup_inv_dmic,
2484 },
2485 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2486 .type = HDA_FIXUP_FUNC,
2487 .v.func = alc882_fixup_no_primary_hp,
2488 },
2489 [ALC887_FIXUP_ASUS_BASS] = {
2490 .type = HDA_FIXUP_PINS,
2491 .v.pins = (const struct hda_pintbl[]) {
2492 {0x16, 0x99130130}, /* bass speaker */
2493 {}
2494 },
2495 .chained = true,
2496 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2497 },
2498 [ALC887_FIXUP_BASS_CHMAP] = {
2499 .type = HDA_FIXUP_FUNC,
2500 .v.func = alc_fixup_bass_chmap,
2501 },
2502 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2503 .type = HDA_FIXUP_FUNC,
2504 .v.func = alc1220_fixup_gb_dual_codecs,
2505 },
2506 [ALC1220_FIXUP_GB_X570] = {
2507 .type = HDA_FIXUP_FUNC,
2508 .v.func = alc1220_fixup_gb_x570,
2509 },
2510 [ALC1220_FIXUP_CLEVO_P950] = {
2511 .type = HDA_FIXUP_FUNC,
2512 .v.func = alc1220_fixup_clevo_p950,
2513 },
2514 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2515 .type = HDA_FIXUP_FUNC,
2516 .v.func = alc1220_fixup_clevo_pb51ed,
2517 },
2518 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2519 .type = HDA_FIXUP_PINS,
2520 .v.pins = (const struct hda_pintbl[]) {
2521 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2522 {}
2523 },
2524 .chained = true,
2525 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2526 },
2527 [ALC887_FIXUP_ASUS_AUDIO] = {
2528 .type = HDA_FIXUP_PINS,
2529 .v.pins = (const struct hda_pintbl[]) {
2530 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2531 { 0x19, 0x22219420 },
2532 {}
2533 },
2534 },
2535 [ALC887_FIXUP_ASUS_HMIC] = {
2536 .type = HDA_FIXUP_FUNC,
2537 .v.func = alc887_fixup_asus_jack,
2538 .chained = true,
2539 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2540 },
2541 [ALCS1200A_FIXUP_MIC_VREF] = {
2542 .type = HDA_FIXUP_PINCTLS,
2543 .v.pins = (const struct hda_pintbl[]) {
2544 { 0x18, PIN_VREF50 }, /* rear mic */
2545 { 0x19, PIN_VREF50 }, /* front mic */
2546 {}
2547 }
2548 },
2549 [ALC888VD_FIXUP_MIC_100VREF] = {
2550 .type = HDA_FIXUP_PINCTLS,
2551 .v.pins = (const struct hda_pintbl[]) {
2552 { 0x18, PIN_VREF100 }, /* headset mic */
2553 {}
2554 }
2555 },
2556 };
2557
2558 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2559 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2560 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2561 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2562 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2563 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2564 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2565 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2566 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2567 ALC882_FIXUP_ACER_ASPIRE_4930G),
2568 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2569 ALC882_FIXUP_ACER_ASPIRE_4930G),
2570 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2571 ALC882_FIXUP_ACER_ASPIRE_8930G),
2572 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2573 ALC882_FIXUP_ACER_ASPIRE_8930G),
2574 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2575 ALC882_FIXUP_ACER_ASPIRE_4930G),
2576 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2577 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2578 ALC882_FIXUP_ACER_ASPIRE_4930G),
2579 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2580 ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2582 ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2584 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2585 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2586 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2587 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2588 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2589 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2590 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2591 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2592 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2593 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2594 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2595 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2596 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2597 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2598 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2599
2600 /* All Apple entries are in codec SSIDs */
2601 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2602 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2603 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2604 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2605 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2606 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2607 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2608 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2609 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2610 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2611 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2612 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2613 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2614 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2615 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2616 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2617 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2618 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2619 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2620 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2621 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2622 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2623
2624 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2625 SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2626 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2627 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2628 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2629 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2630 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2631 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2632 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2633 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2634 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2635 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2636 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2637 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2638 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2639 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2640 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2641 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2642 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2643 SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2644 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2645 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2661 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2662 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2663 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2664 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2665 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2666 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2667 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2668 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2669 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2670 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2671 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2672 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2673 SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2674 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2675 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2676 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2677 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2678 {}
2679 };
2680
2681 static const struct hda_model_fixup alc882_fixup_models[] = {
2682 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2683 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2684 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2685 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2686 {.id = ALC889_FIXUP_CD, .name = "cd"},
2687 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2688 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2689 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2690 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2691 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2692 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2693 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2694 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2695 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2696 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2697 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2698 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2699 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2700 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2701 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2702 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2703 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2704 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2705 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2706 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2707 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2708 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2709 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2710 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2711 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2712 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2713 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2714 {}
2715 };
2716
2717 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2718 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2719 {0x14, 0x01014010},
2720 {0x15, 0x01011012},
2721 {0x16, 0x01016011},
2722 {0x18, 0x01a19040},
2723 {0x19, 0x02a19050},
2724 {0x1a, 0x0181304f},
2725 {0x1b, 0x0221401f},
2726 {0x1e, 0x01456130}),
2727 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2728 {0x14, 0x01015010},
2729 {0x15, 0x01011012},
2730 {0x16, 0x01011011},
2731 {0x18, 0x01a11040},
2732 {0x19, 0x02a19050},
2733 {0x1a, 0x0181104f},
2734 {0x1b, 0x0221401f},
2735 {0x1e, 0x01451130}),
2736 {}
2737 };
2738
2739 /*
2740 * BIOS auto configuration
2741 */
2742 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2743 static int alc882_parse_auto_config(struct hda_codec *codec)
2744 {
2745 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2746 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2747 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2748 }
2749
2750 /*
2751 */
patch_alc882(struct hda_codec * codec)2752 static int patch_alc882(struct hda_codec *codec)
2753 {
2754 struct alc_spec *spec;
2755 int err;
2756
2757 err = alc_alloc_spec(codec, 0x0b);
2758 if (err < 0)
2759 return err;
2760
2761 spec = codec->spec;
2762
2763 switch (codec->core.vendor_id) {
2764 case 0x10ec0882:
2765 case 0x10ec0885:
2766 case 0x10ec0900:
2767 case 0x10ec0b00:
2768 case 0x10ec1220:
2769 break;
2770 default:
2771 /* ALC883 and variants */
2772 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2773 break;
2774 }
2775
2776 alc_pre_init(codec);
2777
2778 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2779 alc882_fixups);
2780 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2781 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2782
2783 alc_auto_parse_customize_define(codec);
2784
2785 if (has_cdefine_beep(codec))
2786 spec->gen.beep_nid = 0x01;
2787
2788 /* automatic parse from the BIOS config */
2789 err = alc882_parse_auto_config(codec);
2790 if (err < 0)
2791 goto error;
2792
2793 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2794 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2795 if (err < 0)
2796 goto error;
2797 }
2798
2799 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2800
2801 return 0;
2802
2803 error:
2804 alc_free(codec);
2805 return err;
2806 }
2807
2808
2809 /*
2810 * ALC262 support
2811 */
alc262_parse_auto_config(struct hda_codec * codec)2812 static int alc262_parse_auto_config(struct hda_codec *codec)
2813 {
2814 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2815 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2816 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2817 }
2818
2819 /*
2820 * Pin config fixes
2821 */
2822 enum {
2823 ALC262_FIXUP_FSC_H270,
2824 ALC262_FIXUP_FSC_S7110,
2825 ALC262_FIXUP_HP_Z200,
2826 ALC262_FIXUP_TYAN,
2827 ALC262_FIXUP_LENOVO_3000,
2828 ALC262_FIXUP_BENQ,
2829 ALC262_FIXUP_BENQ_T31,
2830 ALC262_FIXUP_INV_DMIC,
2831 ALC262_FIXUP_INTEL_BAYLEYBAY,
2832 };
2833
2834 static const struct hda_fixup alc262_fixups[] = {
2835 [ALC262_FIXUP_FSC_H270] = {
2836 .type = HDA_FIXUP_PINS,
2837 .v.pins = (const struct hda_pintbl[]) {
2838 { 0x14, 0x99130110 }, /* speaker */
2839 { 0x15, 0x0221142f }, /* front HP */
2840 { 0x1b, 0x0121141f }, /* rear HP */
2841 { }
2842 }
2843 },
2844 [ALC262_FIXUP_FSC_S7110] = {
2845 .type = HDA_FIXUP_PINS,
2846 .v.pins = (const struct hda_pintbl[]) {
2847 { 0x15, 0x90170110 }, /* speaker */
2848 { }
2849 },
2850 .chained = true,
2851 .chain_id = ALC262_FIXUP_BENQ,
2852 },
2853 [ALC262_FIXUP_HP_Z200] = {
2854 .type = HDA_FIXUP_PINS,
2855 .v.pins = (const struct hda_pintbl[]) {
2856 { 0x16, 0x99130120 }, /* internal speaker */
2857 { }
2858 }
2859 },
2860 [ALC262_FIXUP_TYAN] = {
2861 .type = HDA_FIXUP_PINS,
2862 .v.pins = (const struct hda_pintbl[]) {
2863 { 0x14, 0x1993e1f0 }, /* int AUX */
2864 { }
2865 }
2866 },
2867 [ALC262_FIXUP_LENOVO_3000] = {
2868 .type = HDA_FIXUP_PINCTLS,
2869 .v.pins = (const struct hda_pintbl[]) {
2870 { 0x19, PIN_VREF50 },
2871 {}
2872 },
2873 .chained = true,
2874 .chain_id = ALC262_FIXUP_BENQ,
2875 },
2876 [ALC262_FIXUP_BENQ] = {
2877 .type = HDA_FIXUP_VERBS,
2878 .v.verbs = (const struct hda_verb[]) {
2879 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2880 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2881 {}
2882 }
2883 },
2884 [ALC262_FIXUP_BENQ_T31] = {
2885 .type = HDA_FIXUP_VERBS,
2886 .v.verbs = (const struct hda_verb[]) {
2887 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2888 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2889 {}
2890 }
2891 },
2892 [ALC262_FIXUP_INV_DMIC] = {
2893 .type = HDA_FIXUP_FUNC,
2894 .v.func = alc_fixup_inv_dmic,
2895 },
2896 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2897 .type = HDA_FIXUP_FUNC,
2898 .v.func = alc_fixup_no_depop_delay,
2899 },
2900 };
2901
2902 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2903 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2904 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2905 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2906 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2907 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2908 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2909 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2910 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2911 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2912 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2913 {}
2914 };
2915
2916 static const struct hda_model_fixup alc262_fixup_models[] = {
2917 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2918 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2919 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2920 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2921 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2922 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2923 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2924 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2925 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2926 {}
2927 };
2928
2929 /*
2930 */
patch_alc262(struct hda_codec * codec)2931 static int patch_alc262(struct hda_codec *codec)
2932 {
2933 struct alc_spec *spec;
2934 int err;
2935
2936 err = alc_alloc_spec(codec, 0x0b);
2937 if (err < 0)
2938 return err;
2939
2940 spec = codec->spec;
2941 spec->gen.shared_mic_vref_pin = 0x18;
2942
2943 spec->shutup = alc_eapd_shutup;
2944
2945 #if 0
2946 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2947 * under-run
2948 */
2949 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2950 #endif
2951 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2952
2953 alc_pre_init(codec);
2954
2955 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2956 alc262_fixups);
2957 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2958
2959 alc_auto_parse_customize_define(codec);
2960
2961 if (has_cdefine_beep(codec))
2962 spec->gen.beep_nid = 0x01;
2963
2964 /* automatic parse from the BIOS config */
2965 err = alc262_parse_auto_config(codec);
2966 if (err < 0)
2967 goto error;
2968
2969 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2970 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2971 if (err < 0)
2972 goto error;
2973 }
2974
2975 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2976
2977 return 0;
2978
2979 error:
2980 alc_free(codec);
2981 return err;
2982 }
2983
2984 /*
2985 * ALC268
2986 */
2987 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2988 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2989 struct snd_ctl_elem_value *ucontrol)
2990 {
2991 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2992 unsigned long pval;
2993 int err;
2994
2995 mutex_lock(&codec->control_mutex);
2996 pval = kcontrol->private_value;
2997 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2998 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2999 if (err >= 0) {
3000 kcontrol->private_value = (pval & ~0xff) | 0x10;
3001 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3002 }
3003 kcontrol->private_value = pval;
3004 mutex_unlock(&codec->control_mutex);
3005 return err;
3006 }
3007
3008 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3009 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3010 {
3011 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3012 .name = "Beep Playback Switch",
3013 .subdevice = HDA_SUBDEV_AMP_FLAG,
3014 .info = snd_hda_mixer_amp_switch_info,
3015 .get = snd_hda_mixer_amp_switch_get,
3016 .put = alc268_beep_switch_put,
3017 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3018 },
3019 };
3020
3021 /* set PCBEEP vol = 0, mute connections */
3022 static const struct hda_verb alc268_beep_init_verbs[] = {
3023 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3024 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3025 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3026 { }
3027 };
3028
3029 enum {
3030 ALC268_FIXUP_INV_DMIC,
3031 ALC268_FIXUP_HP_EAPD,
3032 ALC268_FIXUP_SPDIF,
3033 };
3034
3035 static const struct hda_fixup alc268_fixups[] = {
3036 [ALC268_FIXUP_INV_DMIC] = {
3037 .type = HDA_FIXUP_FUNC,
3038 .v.func = alc_fixup_inv_dmic,
3039 },
3040 [ALC268_FIXUP_HP_EAPD] = {
3041 .type = HDA_FIXUP_VERBS,
3042 .v.verbs = (const struct hda_verb[]) {
3043 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3044 {}
3045 }
3046 },
3047 [ALC268_FIXUP_SPDIF] = {
3048 .type = HDA_FIXUP_PINS,
3049 .v.pins = (const struct hda_pintbl[]) {
3050 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3051 {}
3052 }
3053 },
3054 };
3055
3056 static const struct hda_model_fixup alc268_fixup_models[] = {
3057 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3058 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3059 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3060 {}
3061 };
3062
3063 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3064 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3065 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3066 /* below is codec SSID since multiple Toshiba laptops have the
3067 * same PCI SSID 1179:ff00
3068 */
3069 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3070 {}
3071 };
3072
3073 /*
3074 * BIOS auto configuration
3075 */
alc268_parse_auto_config(struct hda_codec * codec)3076 static int alc268_parse_auto_config(struct hda_codec *codec)
3077 {
3078 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3079 return alc_parse_auto_config(codec, NULL, alc268_ssids);
3080 }
3081
3082 /*
3083 */
patch_alc268(struct hda_codec * codec)3084 static int patch_alc268(struct hda_codec *codec)
3085 {
3086 struct alc_spec *spec;
3087 int i, err;
3088
3089 /* ALC268 has no aa-loopback mixer */
3090 err = alc_alloc_spec(codec, 0);
3091 if (err < 0)
3092 return err;
3093
3094 spec = codec->spec;
3095 if (has_cdefine_beep(codec))
3096 spec->gen.beep_nid = 0x01;
3097
3098 spec->shutup = alc_eapd_shutup;
3099
3100 alc_pre_init(codec);
3101
3102 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3103 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3104
3105 /* automatic parse from the BIOS config */
3106 err = alc268_parse_auto_config(codec);
3107 if (err < 0)
3108 goto error;
3109
3110 if (err > 0 && !spec->gen.no_analog &&
3111 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3112 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3113 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3114 &alc268_beep_mixer[i])) {
3115 err = -ENOMEM;
3116 goto error;
3117 }
3118 }
3119 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3120 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3121 /* override the amp caps for beep generator */
3122 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3123 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3124 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3125 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3126 (0 << AC_AMPCAP_MUTE_SHIFT));
3127 }
3128
3129 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3130
3131 return 0;
3132
3133 error:
3134 alc_free(codec);
3135 return err;
3136 }
3137
3138 /*
3139 * ALC269
3140 */
3141
3142 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3143 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3144 };
3145
3146 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3147 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3148 };
3149
3150 /* different alc269-variants */
3151 enum {
3152 ALC269_TYPE_ALC269VA,
3153 ALC269_TYPE_ALC269VB,
3154 ALC269_TYPE_ALC269VC,
3155 ALC269_TYPE_ALC269VD,
3156 ALC269_TYPE_ALC280,
3157 ALC269_TYPE_ALC282,
3158 ALC269_TYPE_ALC283,
3159 ALC269_TYPE_ALC284,
3160 ALC269_TYPE_ALC293,
3161 ALC269_TYPE_ALC286,
3162 ALC269_TYPE_ALC298,
3163 ALC269_TYPE_ALC255,
3164 ALC269_TYPE_ALC256,
3165 ALC269_TYPE_ALC257,
3166 ALC269_TYPE_ALC215,
3167 ALC269_TYPE_ALC225,
3168 ALC269_TYPE_ALC245,
3169 ALC269_TYPE_ALC287,
3170 ALC269_TYPE_ALC294,
3171 ALC269_TYPE_ALC300,
3172 ALC269_TYPE_ALC623,
3173 ALC269_TYPE_ALC700,
3174 };
3175
3176 /*
3177 * BIOS auto configuration
3178 */
alc269_parse_auto_config(struct hda_codec * codec)3179 static int alc269_parse_auto_config(struct hda_codec *codec)
3180 {
3181 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3182 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3183 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3184 struct alc_spec *spec = codec->spec;
3185 const hda_nid_t *ssids;
3186
3187 switch (spec->codec_variant) {
3188 case ALC269_TYPE_ALC269VA:
3189 case ALC269_TYPE_ALC269VC:
3190 case ALC269_TYPE_ALC280:
3191 case ALC269_TYPE_ALC284:
3192 case ALC269_TYPE_ALC293:
3193 ssids = alc269va_ssids;
3194 break;
3195 case ALC269_TYPE_ALC269VB:
3196 case ALC269_TYPE_ALC269VD:
3197 case ALC269_TYPE_ALC282:
3198 case ALC269_TYPE_ALC283:
3199 case ALC269_TYPE_ALC286:
3200 case ALC269_TYPE_ALC298:
3201 case ALC269_TYPE_ALC255:
3202 case ALC269_TYPE_ALC256:
3203 case ALC269_TYPE_ALC257:
3204 case ALC269_TYPE_ALC215:
3205 case ALC269_TYPE_ALC225:
3206 case ALC269_TYPE_ALC245:
3207 case ALC269_TYPE_ALC287:
3208 case ALC269_TYPE_ALC294:
3209 case ALC269_TYPE_ALC300:
3210 case ALC269_TYPE_ALC623:
3211 case ALC269_TYPE_ALC700:
3212 ssids = alc269_ssids;
3213 break;
3214 default:
3215 ssids = alc269_ssids;
3216 break;
3217 }
3218
3219 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3220 }
3221
3222 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3223 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3224 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3225 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3226 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3227 {}
3228 };
3229
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3230 static void alc_headset_btn_callback(struct hda_codec *codec,
3231 struct hda_jack_callback *jack)
3232 {
3233 int report = 0;
3234
3235 if (jack->unsol_res & (7 << 13))
3236 report |= SND_JACK_BTN_0;
3237
3238 if (jack->unsol_res & (1 << 16 | 3 << 8))
3239 report |= SND_JACK_BTN_1;
3240
3241 /* Volume up key */
3242 if (jack->unsol_res & (7 << 23))
3243 report |= SND_JACK_BTN_2;
3244
3245 /* Volume down key */
3246 if (jack->unsol_res & (7 << 10))
3247 report |= SND_JACK_BTN_3;
3248
3249 snd_hda_jack_set_button_state(codec, jack->nid, report);
3250 }
3251
alc_disable_headset_jack_key(struct hda_codec * codec)3252 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3253 {
3254 struct alc_spec *spec = codec->spec;
3255
3256 if (!spec->has_hs_key)
3257 return;
3258
3259 switch (codec->core.vendor_id) {
3260 case 0x10ec0215:
3261 case 0x10ec0225:
3262 case 0x10ec0285:
3263 case 0x10ec0287:
3264 case 0x10ec0295:
3265 case 0x10ec0289:
3266 case 0x10ec0299:
3267 alc_write_coef_idx(codec, 0x48, 0x0);
3268 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3269 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3270 break;
3271 case 0x10ec0230:
3272 case 0x10ec0236:
3273 case 0x10ec0256:
3274 case 0x10ec0257:
3275 case 0x19e58326:
3276 alc_write_coef_idx(codec, 0x48, 0x0);
3277 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3278 break;
3279 }
3280 }
3281
alc_enable_headset_jack_key(struct hda_codec * codec)3282 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3283 {
3284 struct alc_spec *spec = codec->spec;
3285
3286 if (!spec->has_hs_key)
3287 return;
3288
3289 switch (codec->core.vendor_id) {
3290 case 0x10ec0215:
3291 case 0x10ec0225:
3292 case 0x10ec0285:
3293 case 0x10ec0287:
3294 case 0x10ec0295:
3295 case 0x10ec0289:
3296 case 0x10ec0299:
3297 alc_write_coef_idx(codec, 0x48, 0xd011);
3298 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3299 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3300 break;
3301 case 0x10ec0230:
3302 case 0x10ec0236:
3303 case 0x10ec0256:
3304 case 0x10ec0257:
3305 case 0x19e58326:
3306 alc_write_coef_idx(codec, 0x48, 0xd011);
3307 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3308 break;
3309 }
3310 }
3311
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3312 static void alc_fixup_headset_jack(struct hda_codec *codec,
3313 const struct hda_fixup *fix, int action)
3314 {
3315 struct alc_spec *spec = codec->spec;
3316 hda_nid_t hp_pin;
3317
3318 switch (action) {
3319 case HDA_FIXUP_ACT_PRE_PROBE:
3320 spec->has_hs_key = 1;
3321 snd_hda_jack_detect_enable_callback(codec, 0x55,
3322 alc_headset_btn_callback);
3323 break;
3324 case HDA_FIXUP_ACT_BUILD:
3325 hp_pin = alc_get_hp_pin(spec);
3326 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3327 alc_headset_btn_keymap,
3328 hp_pin))
3329 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3330 false, SND_JACK_HEADSET,
3331 alc_headset_btn_keymap);
3332
3333 alc_enable_headset_jack_key(codec);
3334 break;
3335 }
3336 }
3337
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3338 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3339 {
3340 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3341 }
3342
alc269_shutup(struct hda_codec * codec)3343 static void alc269_shutup(struct hda_codec *codec)
3344 {
3345 struct alc_spec *spec = codec->spec;
3346
3347 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3348 alc269vb_toggle_power_output(codec, 0);
3349 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3350 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3351 msleep(150);
3352 }
3353 alc_shutup_pins(codec);
3354 }
3355
3356 static const struct coef_fw alc282_coefs[] = {
3357 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3358 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3359 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3360 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3361 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3362 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3363 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3364 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3365 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3366 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3367 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3368 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3369 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3370 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3371 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3372 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3373 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3374 WRITE_COEF(0x63, 0x2902), /* PLL */
3375 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3376 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3377 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3378 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3379 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3380 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3381 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3382 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3383 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3384 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3385 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3386 {}
3387 };
3388
alc282_restore_default_value(struct hda_codec * codec)3389 static void alc282_restore_default_value(struct hda_codec *codec)
3390 {
3391 alc_process_coef_fw(codec, alc282_coefs);
3392 }
3393
alc282_init(struct hda_codec * codec)3394 static void alc282_init(struct hda_codec *codec)
3395 {
3396 struct alc_spec *spec = codec->spec;
3397 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3398 bool hp_pin_sense;
3399 int coef78;
3400
3401 alc282_restore_default_value(codec);
3402
3403 if (!hp_pin)
3404 return;
3405 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3406 coef78 = alc_read_coef_idx(codec, 0x78);
3407
3408 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3409 /* Headphone capless set to high power mode */
3410 alc_write_coef_idx(codec, 0x78, 0x9004);
3411
3412 if (hp_pin_sense)
3413 msleep(2);
3414
3415 snd_hda_codec_write(codec, hp_pin, 0,
3416 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3417
3418 if (hp_pin_sense)
3419 msleep(85);
3420
3421 snd_hda_codec_write(codec, hp_pin, 0,
3422 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3423
3424 if (hp_pin_sense)
3425 msleep(100);
3426
3427 /* Headphone capless set to normal mode */
3428 alc_write_coef_idx(codec, 0x78, coef78);
3429 }
3430
alc282_shutup(struct hda_codec * codec)3431 static void alc282_shutup(struct hda_codec *codec)
3432 {
3433 struct alc_spec *spec = codec->spec;
3434 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3435 bool hp_pin_sense;
3436 int coef78;
3437
3438 if (!hp_pin) {
3439 alc269_shutup(codec);
3440 return;
3441 }
3442
3443 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3444 coef78 = alc_read_coef_idx(codec, 0x78);
3445 alc_write_coef_idx(codec, 0x78, 0x9004);
3446
3447 if (hp_pin_sense)
3448 msleep(2);
3449
3450 snd_hda_codec_write(codec, hp_pin, 0,
3451 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3452
3453 if (hp_pin_sense)
3454 msleep(85);
3455
3456 if (!spec->no_shutup_pins)
3457 snd_hda_codec_write(codec, hp_pin, 0,
3458 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3459
3460 if (hp_pin_sense)
3461 msleep(100);
3462
3463 alc_auto_setup_eapd(codec, false);
3464 alc_shutup_pins(codec);
3465 alc_write_coef_idx(codec, 0x78, coef78);
3466 }
3467
3468 static const struct coef_fw alc283_coefs[] = {
3469 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3470 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3471 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3472 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3473 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3474 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3475 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3476 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3477 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3478 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3479 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3480 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3481 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3482 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3483 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3484 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3485 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3486 WRITE_COEF(0x2e, 0x2902), /* PLL */
3487 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3488 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3489 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3490 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3491 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3492 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3493 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3494 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3495 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3496 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3497 WRITE_COEF(0x49, 0x0), /* test mode */
3498 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3499 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3500 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3501 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3502 {}
3503 };
3504
alc283_restore_default_value(struct hda_codec * codec)3505 static void alc283_restore_default_value(struct hda_codec *codec)
3506 {
3507 alc_process_coef_fw(codec, alc283_coefs);
3508 }
3509
alc283_init(struct hda_codec * codec)3510 static void alc283_init(struct hda_codec *codec)
3511 {
3512 struct alc_spec *spec = codec->spec;
3513 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3514 bool hp_pin_sense;
3515
3516 alc283_restore_default_value(codec);
3517
3518 if (!hp_pin)
3519 return;
3520
3521 msleep(30);
3522 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3523
3524 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3525 /* Headphone capless set to high power mode */
3526 alc_write_coef_idx(codec, 0x43, 0x9004);
3527
3528 snd_hda_codec_write(codec, hp_pin, 0,
3529 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3530
3531 if (hp_pin_sense)
3532 msleep(85);
3533
3534 snd_hda_codec_write(codec, hp_pin, 0,
3535 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3536
3537 if (hp_pin_sense)
3538 msleep(85);
3539 /* Index 0x46 Combo jack auto switch control 2 */
3540 /* 3k pull low control for Headset jack. */
3541 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3542 /* Headphone capless set to normal mode */
3543 alc_write_coef_idx(codec, 0x43, 0x9614);
3544 }
3545
alc283_shutup(struct hda_codec * codec)3546 static void alc283_shutup(struct hda_codec *codec)
3547 {
3548 struct alc_spec *spec = codec->spec;
3549 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3550 bool hp_pin_sense;
3551
3552 if (!hp_pin) {
3553 alc269_shutup(codec);
3554 return;
3555 }
3556
3557 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3558
3559 alc_write_coef_idx(codec, 0x43, 0x9004);
3560
3561 /*depop hp during suspend*/
3562 alc_write_coef_idx(codec, 0x06, 0x2100);
3563
3564 snd_hda_codec_write(codec, hp_pin, 0,
3565 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3566
3567 if (hp_pin_sense)
3568 msleep(100);
3569
3570 if (!spec->no_shutup_pins)
3571 snd_hda_codec_write(codec, hp_pin, 0,
3572 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3573
3574 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3575
3576 if (hp_pin_sense)
3577 msleep(100);
3578 alc_auto_setup_eapd(codec, false);
3579 alc_shutup_pins(codec);
3580 alc_write_coef_idx(codec, 0x43, 0x9614);
3581 }
3582
alc256_init(struct hda_codec * codec)3583 static void alc256_init(struct hda_codec *codec)
3584 {
3585 struct alc_spec *spec = codec->spec;
3586 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3587 bool hp_pin_sense;
3588
3589 if (spec->ultra_low_power) {
3590 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3591 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3592 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3593 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3594 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3595 msleep(30);
3596 }
3597
3598 if (!hp_pin)
3599 hp_pin = 0x21;
3600
3601 msleep(30);
3602
3603 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3604
3605 if (hp_pin_sense)
3606 msleep(2);
3607
3608 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3609
3610 snd_hda_codec_write(codec, hp_pin, 0,
3611 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3612
3613 if (hp_pin_sense || spec->ultra_low_power)
3614 msleep(85);
3615
3616 snd_hda_codec_write(codec, hp_pin, 0,
3617 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3618
3619 if (hp_pin_sense || spec->ultra_low_power)
3620 msleep(100);
3621
3622 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3623 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3624 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3625 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3626 /*
3627 * Expose headphone mic (or possibly Line In on some machines) instead
3628 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3629 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3630 * this register.
3631 */
3632 alc_write_coef_idx(codec, 0x36, 0x5757);
3633 }
3634
alc256_shutup(struct hda_codec * codec)3635 static void alc256_shutup(struct hda_codec *codec)
3636 {
3637 struct alc_spec *spec = codec->spec;
3638 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3639 bool hp_pin_sense;
3640
3641 if (!hp_pin)
3642 hp_pin = 0x21;
3643
3644 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3645 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3646
3647 if (hp_pin_sense)
3648 msleep(2);
3649
3650 snd_hda_codec_write(codec, hp_pin, 0,
3651 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3652
3653 if (hp_pin_sense || spec->ultra_low_power)
3654 msleep(85);
3655
3656 /* 3k pull low control for Headset jack. */
3657 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3658 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3659 * when booting with headset plugged. So skip setting it for the codec alc257
3660 */
3661 if (spec->en_3kpull_low)
3662 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3663
3664 if (!spec->no_shutup_pins)
3665 snd_hda_codec_write(codec, hp_pin, 0,
3666 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3667
3668 if (hp_pin_sense || spec->ultra_low_power)
3669 msleep(100);
3670
3671 alc_auto_setup_eapd(codec, false);
3672 alc_shutup_pins(codec);
3673 if (spec->ultra_low_power) {
3674 msleep(50);
3675 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3676 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3677 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3678 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3679 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3680 msleep(30);
3681 }
3682 }
3683
alc285_hp_init(struct hda_codec * codec)3684 static void alc285_hp_init(struct hda_codec *codec)
3685 {
3686 struct alc_spec *spec = codec->spec;
3687 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3688 int i, val;
3689 int coef38, coef0d, coef36;
3690
3691 alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3692 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3693 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3694 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3695 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3696 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3697 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3698
3699 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3700
3701 if (hp_pin)
3702 snd_hda_codec_write(codec, hp_pin, 0,
3703 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3704
3705 msleep(130);
3706 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3707 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3708
3709 if (hp_pin)
3710 snd_hda_codec_write(codec, hp_pin, 0,
3711 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3712 msleep(10);
3713 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3714 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3715 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3716 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3717
3718 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3719 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3720 for (i = 0; i < 20 && val & 0x8000; i++) {
3721 msleep(50);
3722 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3723 } /* Wait for depop procedure finish */
3724
3725 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3726 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3727 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3728 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3729
3730 msleep(50);
3731 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3732 }
3733
alc225_init(struct hda_codec * codec)3734 static void alc225_init(struct hda_codec *codec)
3735 {
3736 struct alc_spec *spec = codec->spec;
3737 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3738 bool hp1_pin_sense, hp2_pin_sense;
3739
3740 if (spec->ultra_low_power) {
3741 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3742 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3743 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3744 msleep(30);
3745 }
3746
3747 if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3748 spec->codec_variant != ALC269_TYPE_ALC245)
3749 /* required only at boot or S3 and S4 resume time */
3750 if (!spec->done_hp_init ||
3751 is_s3_resume(codec) ||
3752 is_s4_resume(codec)) {
3753 alc285_hp_init(codec);
3754 spec->done_hp_init = true;
3755 }
3756
3757 if (!hp_pin)
3758 hp_pin = 0x21;
3759 msleep(30);
3760
3761 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3762 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3763
3764 if (hp1_pin_sense || hp2_pin_sense)
3765 msleep(2);
3766
3767 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3768
3769 if (hp1_pin_sense || spec->ultra_low_power)
3770 snd_hda_codec_write(codec, hp_pin, 0,
3771 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3772 if (hp2_pin_sense)
3773 snd_hda_codec_write(codec, 0x16, 0,
3774 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3775
3776 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3777 msleep(85);
3778
3779 if (hp1_pin_sense || spec->ultra_low_power)
3780 snd_hda_codec_write(codec, hp_pin, 0,
3781 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3782 if (hp2_pin_sense)
3783 snd_hda_codec_write(codec, 0x16, 0,
3784 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3785
3786 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3787 msleep(100);
3788
3789 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3790 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3791 }
3792
alc225_shutup(struct hda_codec * codec)3793 static void alc225_shutup(struct hda_codec *codec)
3794 {
3795 struct alc_spec *spec = codec->spec;
3796 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3797 bool hp1_pin_sense, hp2_pin_sense;
3798
3799 if (!hp_pin)
3800 hp_pin = 0x21;
3801
3802 alc_disable_headset_jack_key(codec);
3803 /* 3k pull low control for Headset jack. */
3804 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3805
3806 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3807 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3808
3809 if (hp1_pin_sense || hp2_pin_sense)
3810 msleep(2);
3811
3812 if (hp1_pin_sense || spec->ultra_low_power)
3813 snd_hda_codec_write(codec, hp_pin, 0,
3814 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3815 if (hp2_pin_sense)
3816 snd_hda_codec_write(codec, 0x16, 0,
3817 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3818
3819 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3820 msleep(85);
3821
3822 if (hp1_pin_sense || spec->ultra_low_power)
3823 snd_hda_codec_write(codec, hp_pin, 0,
3824 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3825 if (hp2_pin_sense)
3826 snd_hda_codec_write(codec, 0x16, 0,
3827 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3828
3829 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3830 msleep(100);
3831
3832 alc_auto_setup_eapd(codec, false);
3833 alc_shutup_pins(codec);
3834 if (spec->ultra_low_power) {
3835 msleep(50);
3836 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3837 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3838 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3839 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3840 msleep(30);
3841 }
3842
3843 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3844 alc_enable_headset_jack_key(codec);
3845 }
3846
alc_default_init(struct hda_codec * codec)3847 static void alc_default_init(struct hda_codec *codec)
3848 {
3849 struct alc_spec *spec = codec->spec;
3850 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3851 bool hp_pin_sense;
3852
3853 if (!hp_pin)
3854 return;
3855
3856 msleep(30);
3857
3858 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3859
3860 if (hp_pin_sense) {
3861 msleep(2);
3862
3863 snd_hda_codec_write(codec, hp_pin, 0,
3864 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3865
3866 msleep(75);
3867
3868 snd_hda_codec_write(codec, hp_pin, 0,
3869 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3870 msleep(75);
3871 }
3872 }
3873
alc_default_shutup(struct hda_codec * codec)3874 static void alc_default_shutup(struct hda_codec *codec)
3875 {
3876 struct alc_spec *spec = codec->spec;
3877 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3878 bool hp_pin_sense;
3879
3880 if (!hp_pin) {
3881 alc269_shutup(codec);
3882 return;
3883 }
3884
3885 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3886
3887 if (hp_pin_sense) {
3888 msleep(2);
3889
3890 snd_hda_codec_write(codec, hp_pin, 0,
3891 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3892
3893 msleep(75);
3894
3895 if (!spec->no_shutup_pins)
3896 snd_hda_codec_write(codec, hp_pin, 0,
3897 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3898
3899 msleep(75);
3900 }
3901 alc_auto_setup_eapd(codec, false);
3902 alc_shutup_pins(codec);
3903 }
3904
alc294_hp_init(struct hda_codec * codec)3905 static void alc294_hp_init(struct hda_codec *codec)
3906 {
3907 struct alc_spec *spec = codec->spec;
3908 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3909 int i, val;
3910
3911 if (!hp_pin)
3912 return;
3913
3914 snd_hda_codec_write(codec, hp_pin, 0,
3915 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3916
3917 msleep(100);
3918
3919 if (!spec->no_shutup_pins)
3920 snd_hda_codec_write(codec, hp_pin, 0,
3921 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3922
3923 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3924 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3925
3926 /* Wait for depop procedure finish */
3927 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3928 for (i = 0; i < 20 && val & 0x0080; i++) {
3929 msleep(50);
3930 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3931 }
3932 /* Set HP depop to auto mode */
3933 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3934 msleep(50);
3935 }
3936
alc294_init(struct hda_codec * codec)3937 static void alc294_init(struct hda_codec *codec)
3938 {
3939 struct alc_spec *spec = codec->spec;
3940
3941 /* required only at boot or S4 resume time */
3942 if (!spec->done_hp_init ||
3943 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3944 alc294_hp_init(codec);
3945 spec->done_hp_init = true;
3946 }
3947 alc_default_init(codec);
3948 }
3949
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)3950 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3951 unsigned int val)
3952 {
3953 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3954 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3955 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3956 }
3957
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)3958 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3959 {
3960 unsigned int val;
3961
3962 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3963 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3964 & 0xffff;
3965 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3966 << 16;
3967 return val;
3968 }
3969
alc5505_dsp_halt(struct hda_codec * codec)3970 static void alc5505_dsp_halt(struct hda_codec *codec)
3971 {
3972 unsigned int val;
3973
3974 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3975 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3976 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3977 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3978 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3979 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3980 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3981 val = alc5505_coef_get(codec, 0x6220);
3982 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3983 }
3984
alc5505_dsp_back_from_halt(struct hda_codec * codec)3985 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3986 {
3987 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3988 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3989 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3990 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3991 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3992 alc5505_coef_set(codec, 0x880c, 0x00000004);
3993 }
3994
alc5505_dsp_init(struct hda_codec * codec)3995 static void alc5505_dsp_init(struct hda_codec *codec)
3996 {
3997 unsigned int val;
3998
3999 alc5505_dsp_halt(codec);
4000 alc5505_dsp_back_from_halt(codec);
4001 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4002 alc5505_coef_set(codec, 0x61b0, 0x5b16);
4003 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4004 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4005 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4006 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4007 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4008 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4009 alc5505_coef_set(codec, 0x61b8, 0x04173302);
4010 alc5505_coef_set(codec, 0x61b8, 0x04163302);
4011 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4012 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4013 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4014
4015 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4016 if (val <= 3)
4017 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4018 else
4019 alc5505_coef_set(codec, 0x6220, 0x6002018f);
4020
4021 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4022 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4023 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4024 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4025 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4026 alc5505_coef_set(codec, 0x880c, 0x00000003);
4027 alc5505_coef_set(codec, 0x880c, 0x00000010);
4028
4029 #ifdef HALT_REALTEK_ALC5505
4030 alc5505_dsp_halt(codec);
4031 #endif
4032 }
4033
4034 #ifdef HALT_REALTEK_ALC5505
4035 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
4036 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
4037 #else
4038 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
4039 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
4040 #endif
4041
4042 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)4043 static int alc269_suspend(struct hda_codec *codec)
4044 {
4045 struct alc_spec *spec = codec->spec;
4046
4047 if (spec->has_alc5505_dsp)
4048 alc5505_dsp_suspend(codec);
4049
4050 return alc_suspend(codec);
4051 }
4052
alc269_resume(struct hda_codec * codec)4053 static int alc269_resume(struct hda_codec *codec)
4054 {
4055 struct alc_spec *spec = codec->spec;
4056
4057 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4058 alc269vb_toggle_power_output(codec, 0);
4059 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4060 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
4061 msleep(150);
4062 }
4063
4064 codec->patch_ops.init(codec);
4065
4066 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4067 alc269vb_toggle_power_output(codec, 1);
4068 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4069 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
4070 msleep(200);
4071 }
4072
4073 snd_hda_regmap_sync(codec);
4074 hda_call_check_power_status(codec, 0x01);
4075
4076 /* on some machine, the BIOS will clear the codec gpio data when enter
4077 * suspend, and won't restore the data after resume, so we restore it
4078 * in the driver.
4079 */
4080 if (spec->gpio_data)
4081 alc_write_gpio_data(codec);
4082
4083 if (spec->has_alc5505_dsp)
4084 alc5505_dsp_resume(codec);
4085
4086 return 0;
4087 }
4088 #endif /* CONFIG_PM */
4089
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4090 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4091 const struct hda_fixup *fix, int action)
4092 {
4093 struct alc_spec *spec = codec->spec;
4094
4095 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4096 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4097 }
4098
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4099 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4100 const struct hda_fixup *fix,
4101 int action)
4102 {
4103 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4104 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4105
4106 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4107 snd_hda_codec_set_pincfg(codec, 0x19,
4108 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4109 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4110 }
4111
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4112 static void alc269_fixup_hweq(struct hda_codec *codec,
4113 const struct hda_fixup *fix, int action)
4114 {
4115 if (action == HDA_FIXUP_ACT_INIT)
4116 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4117 }
4118
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4119 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4120 const struct hda_fixup *fix, int action)
4121 {
4122 struct alc_spec *spec = codec->spec;
4123
4124 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4125 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4126 }
4127
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4128 static void alc271_fixup_dmic(struct hda_codec *codec,
4129 const struct hda_fixup *fix, int action)
4130 {
4131 static const struct hda_verb verbs[] = {
4132 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4133 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4134 {}
4135 };
4136 unsigned int cfg;
4137
4138 if (strcmp(codec->core.chip_name, "ALC271X") &&
4139 strcmp(codec->core.chip_name, "ALC269VB"))
4140 return;
4141 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4142 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4143 snd_hda_sequence_write(codec, verbs);
4144 }
4145
4146 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4147 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4148 const struct hda_fixup *fix,
4149 int action)
4150 {
4151 if (action == HDA_FIXUP_ACT_INIT)
4152 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4153 }
4154
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4155 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4156 const struct hda_fixup *fix, int action)
4157 {
4158 struct alc_spec *spec = codec->spec;
4159
4160 if (action != HDA_FIXUP_ACT_PROBE)
4161 return;
4162
4163 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4164 * fix the sample rate of analog I/O to 44.1kHz
4165 */
4166 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4167 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4168 }
4169
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4170 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4171 const struct hda_fixup *fix, int action)
4172 {
4173 /* The digital-mic unit sends PDM (differential signal) instead of
4174 * the standard PCM, thus you can't record a valid mono stream as is.
4175 * Below is a workaround specific to ALC269 to control the dmic
4176 * signal source as mono.
4177 */
4178 if (action == HDA_FIXUP_ACT_INIT)
4179 alc_update_coef_idx(codec, 0x07, 0, 0x80);
4180 }
4181
alc269_quanta_automute(struct hda_codec * codec)4182 static void alc269_quanta_automute(struct hda_codec *codec)
4183 {
4184 snd_hda_gen_update_outputs(codec);
4185
4186 alc_write_coef_idx(codec, 0x0c, 0x680);
4187 alc_write_coef_idx(codec, 0x0c, 0x480);
4188 }
4189
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4190 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4191 const struct hda_fixup *fix, int action)
4192 {
4193 struct alc_spec *spec = codec->spec;
4194 if (action != HDA_FIXUP_ACT_PROBE)
4195 return;
4196 spec->gen.automute_hook = alc269_quanta_automute;
4197 }
4198
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4199 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4200 struct hda_jack_callback *jack)
4201 {
4202 struct alc_spec *spec = codec->spec;
4203 int vref;
4204 msleep(200);
4205 snd_hda_gen_hp_automute(codec, jack);
4206
4207 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4208 msleep(100);
4209 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4210 vref);
4211 msleep(500);
4212 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4213 vref);
4214 }
4215
4216 /*
4217 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4218 */
4219 struct hda_alc298_mbxinit {
4220 unsigned char value_0x23;
4221 unsigned char value_0x25;
4222 };
4223
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4224 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4225 const struct hda_alc298_mbxinit *initval,
4226 bool first)
4227 {
4228 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4229 alc_write_coef_idx(codec, 0x26, 0xb000);
4230
4231 if (first)
4232 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4233
4234 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4235 alc_write_coef_idx(codec, 0x26, 0xf000);
4236 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4237
4238 if (initval->value_0x23 != 0x1e)
4239 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4240
4241 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4242 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4243 }
4244
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4245 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4246 const struct hda_fixup *fix,
4247 int action)
4248 {
4249 /* Initialization magic */
4250 static const struct hda_alc298_mbxinit dac_init[] = {
4251 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4252 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4253 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4254 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4255 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4256 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4257 {0x2f, 0x00},
4258 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4259 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4260 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4261 {}
4262 };
4263 const struct hda_alc298_mbxinit *seq;
4264
4265 if (action != HDA_FIXUP_ACT_INIT)
4266 return;
4267
4268 /* Start */
4269 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4270 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4271 alc_write_coef_idx(codec, 0x26, 0xf000);
4272 alc_write_coef_idx(codec, 0x22, 0x31);
4273 alc_write_coef_idx(codec, 0x23, 0x0b);
4274 alc_write_coef_idx(codec, 0x25, 0x00);
4275 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4276 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4277
4278 for (seq = dac_init; seq->value_0x23; seq++)
4279 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4280 }
4281
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4282 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4283 const struct hda_fixup *fix, int action)
4284 {
4285 struct alc_spec *spec = codec->spec;
4286 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4287 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4288 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4289 }
4290 }
4291
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4292 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4293 bool polarity, bool on)
4294 {
4295 unsigned int pinval;
4296
4297 if (!pin)
4298 return;
4299 if (polarity)
4300 on = !on;
4301 pinval = snd_hda_codec_get_pin_target(codec, pin);
4302 pinval &= ~AC_PINCTL_VREFEN;
4303 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4304 /* temporarily power up/down for setting VREF */
4305 snd_hda_power_up_pm(codec);
4306 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4307 snd_hda_power_down_pm(codec);
4308 }
4309
4310 /* 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)4311 static int vref_mute_led_set(struct led_classdev *led_cdev,
4312 enum led_brightness brightness)
4313 {
4314 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4315 struct alc_spec *spec = codec->spec;
4316
4317 alc_update_vref_led(codec, spec->mute_led_nid,
4318 spec->mute_led_polarity, brightness);
4319 return 0;
4320 }
4321
4322 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4323 static unsigned int led_power_filter(struct hda_codec *codec,
4324 hda_nid_t nid,
4325 unsigned int power_state)
4326 {
4327 struct alc_spec *spec = codec->spec;
4328
4329 if (power_state != AC_PWRST_D3 || nid == 0 ||
4330 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4331 return power_state;
4332
4333 /* Set pin ctl again, it might have just been set to 0 */
4334 snd_hda_set_pin_ctl(codec, nid,
4335 snd_hda_codec_get_pin_target(codec, nid));
4336
4337 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4338 }
4339
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4340 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4341 const struct hda_fixup *fix, int action)
4342 {
4343 struct alc_spec *spec = codec->spec;
4344 const struct dmi_device *dev = NULL;
4345
4346 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4347 return;
4348
4349 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4350 int pol, pin;
4351 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4352 continue;
4353 if (pin < 0x0a || pin >= 0x10)
4354 break;
4355 spec->mute_led_polarity = pol;
4356 spec->mute_led_nid = pin - 0x0a + 0x18;
4357 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4358 codec->power_filter = led_power_filter;
4359 codec_dbg(codec,
4360 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4361 spec->mute_led_polarity);
4362 break;
4363 }
4364 }
4365
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4366 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4367 const struct hda_fixup *fix,
4368 int action, hda_nid_t pin)
4369 {
4370 struct alc_spec *spec = codec->spec;
4371
4372 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4373 spec->mute_led_polarity = 0;
4374 spec->mute_led_nid = pin;
4375 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4376 codec->power_filter = led_power_filter;
4377 }
4378 }
4379
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4380 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4381 const struct hda_fixup *fix, int action)
4382 {
4383 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4384 }
4385
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4386 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4387 const struct hda_fixup *fix, int action)
4388 {
4389 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4390 }
4391
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4392 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4393 const struct hda_fixup *fix, int action)
4394 {
4395 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4396 }
4397
4398 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4399 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4400 int polarity, bool enabled)
4401 {
4402 if (polarity)
4403 enabled = !enabled;
4404 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4405 }
4406
4407 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4408 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4409 enum led_brightness brightness)
4410 {
4411 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4412 struct alc_spec *spec = codec->spec;
4413
4414 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4415 spec->mute_led_polarity, !brightness);
4416 return 0;
4417 }
4418
4419 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4420 static int micmute_led_set(struct led_classdev *led_cdev,
4421 enum led_brightness brightness)
4422 {
4423 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4424 struct alc_spec *spec = codec->spec;
4425
4426 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4427 spec->micmute_led_polarity, !brightness);
4428 return 0;
4429 }
4430
4431 /* 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)4432 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4433 int action,
4434 unsigned int mute_mask,
4435 unsigned int micmute_mask)
4436 {
4437 struct alc_spec *spec = codec->spec;
4438
4439 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4440
4441 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4442 return;
4443 if (mute_mask) {
4444 spec->gpio_mute_led_mask = mute_mask;
4445 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4446 }
4447 if (micmute_mask) {
4448 spec->gpio_mic_led_mask = micmute_mask;
4449 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4450 }
4451 }
4452
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4453 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4454 const struct hda_fixup *fix, int action)
4455 {
4456 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4457 }
4458
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4459 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4460 const struct hda_fixup *fix, int action)
4461 {
4462 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4463 }
4464
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4465 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4466 const struct hda_fixup *fix, int action)
4467 {
4468 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4469 }
4470
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4471 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4472 const struct hda_fixup *fix, int action)
4473 {
4474 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4475 }
4476
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4477 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4478 const struct hda_fixup *fix, int action)
4479 {
4480 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4481 }
4482
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4483 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4484 const struct hda_fixup *fix, int action)
4485 {
4486 struct alc_spec *spec = codec->spec;
4487
4488 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4489 spec->micmute_led_polarity = 1;
4490 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4491 }
4492
4493 /* 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)4494 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4495 enum led_brightness brightness)
4496 {
4497 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4498 struct alc_spec *spec = codec->spec;
4499
4500 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4501 spec->micmute_led_polarity, brightness);
4502 return 0;
4503 }
4504
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4505 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4506 const struct hda_fixup *fix, int action)
4507 {
4508 struct alc_spec *spec = codec->spec;
4509
4510 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4511 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4512 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4513 * enable headphone amp
4514 */
4515 spec->gpio_mask |= 0x10;
4516 spec->gpio_dir |= 0x10;
4517 spec->cap_mute_led_nid = 0x18;
4518 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4519 codec->power_filter = led_power_filter;
4520 }
4521 }
4522
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4523 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4524 const struct hda_fixup *fix, int action)
4525 {
4526 struct alc_spec *spec = codec->spec;
4527
4528 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4529 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4530 spec->cap_mute_led_nid = 0x18;
4531 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4532 codec->power_filter = led_power_filter;
4533 }
4534 }
4535
4536 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4537 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4538 */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4539 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4540 const struct hda_fixup *fix, int action)
4541 {
4542 struct alc_spec *spec = codec->spec;
4543
4544 switch (action) {
4545 case HDA_FIXUP_ACT_PRE_PROBE:
4546 spec->gpio_mask |= 0x01;
4547 spec->gpio_dir |= 0x01;
4548 break;
4549 case HDA_FIXUP_ACT_INIT:
4550 /* need to toggle GPIO to enable the amp */
4551 alc_update_gpio_data(codec, 0x01, true);
4552 msleep(100);
4553 alc_update_gpio_data(codec, 0x01, false);
4554 break;
4555 }
4556 }
4557
4558 /* 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)4559 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4560 struct hda_codec *codec,
4561 struct snd_pcm_substream *substream,
4562 int action)
4563 {
4564 switch (action) {
4565 case HDA_GEN_PCM_ACT_PREPARE:
4566 alc_update_gpio_data(codec, 0x04, true);
4567 break;
4568 case HDA_GEN_PCM_ACT_CLEANUP:
4569 alc_update_gpio_data(codec, 0x04, false);
4570 break;
4571 }
4572 }
4573
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4574 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4575 const struct hda_fixup *fix,
4576 int action)
4577 {
4578 struct alc_spec *spec = codec->spec;
4579
4580 if (action == HDA_FIXUP_ACT_PROBE) {
4581 spec->gpio_mask |= 0x04;
4582 spec->gpio_dir |= 0x04;
4583 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4584 }
4585 }
4586
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4587 static void alc_update_coef_led(struct hda_codec *codec,
4588 struct alc_coef_led *led,
4589 bool polarity, bool on)
4590 {
4591 if (polarity)
4592 on = !on;
4593 /* temporarily power up/down for setting COEF bit */
4594 alc_update_coef_idx(codec, led->idx, led->mask,
4595 on ? led->on : led->off);
4596 }
4597
4598 /* 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)4599 static int coef_mute_led_set(struct led_classdev *led_cdev,
4600 enum led_brightness brightness)
4601 {
4602 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4603 struct alc_spec *spec = codec->spec;
4604
4605 alc_update_coef_led(codec, &spec->mute_led_coef,
4606 spec->mute_led_polarity, brightness);
4607 return 0;
4608 }
4609
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4610 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4611 const struct hda_fixup *fix,
4612 int action)
4613 {
4614 struct alc_spec *spec = codec->spec;
4615
4616 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4617 spec->mute_led_polarity = 0;
4618 spec->mute_led_coef.idx = 0x0b;
4619 spec->mute_led_coef.mask = 1 << 3;
4620 spec->mute_led_coef.on = 1 << 3;
4621 spec->mute_led_coef.off = 0;
4622 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4623 }
4624 }
4625
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4626 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4627 const struct hda_fixup *fix,
4628 int action)
4629 {
4630 struct alc_spec *spec = codec->spec;
4631
4632 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4633 spec->mute_led_polarity = 0;
4634 spec->mute_led_coef.idx = 0x34;
4635 spec->mute_led_coef.mask = 1 << 5;
4636 spec->mute_led_coef.on = 0;
4637 spec->mute_led_coef.off = 1 << 5;
4638 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4639 }
4640 }
4641
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4642 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4643 const struct hda_fixup *fix, int action)
4644 {
4645 struct alc_spec *spec = codec->spec;
4646
4647 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4648 spec->mute_led_polarity = 0;
4649 spec->mute_led_coef.idx = 0x07;
4650 spec->mute_led_coef.mask = 1;
4651 spec->mute_led_coef.on = 1;
4652 spec->mute_led_coef.off = 0;
4653 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4654 }
4655 }
4656
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4657 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4658 const struct hda_fixup *fix,
4659 int action)
4660 {
4661 struct alc_spec *spec = codec->spec;
4662
4663 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4664 spec->mute_led_polarity = 0;
4665 spec->mute_led_coef.idx = 0x0b;
4666 spec->mute_led_coef.mask = 3 << 2;
4667 spec->mute_led_coef.on = 2 << 2;
4668 spec->mute_led_coef.off = 1 << 2;
4669 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4670 }
4671 }
4672
4673 /* 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)4674 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4675 enum led_brightness brightness)
4676 {
4677 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4678 struct alc_spec *spec = codec->spec;
4679
4680 alc_update_coef_led(codec, &spec->mic_led_coef,
4681 spec->micmute_led_polarity, brightness);
4682 return 0;
4683 }
4684
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4685 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4686 const struct hda_fixup *fix, int action)
4687 {
4688 struct alc_spec *spec = codec->spec;
4689
4690 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4691 spec->mic_led_coef.idx = 0x19;
4692 spec->mic_led_coef.mask = 1 << 13;
4693 spec->mic_led_coef.on = 1 << 13;
4694 spec->mic_led_coef.off = 0;
4695 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4696 }
4697 }
4698
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4699 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4700 const struct hda_fixup *fix, int action)
4701 {
4702 struct alc_spec *spec = codec->spec;
4703
4704 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4705 spec->micmute_led_polarity = 1;
4706 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4707 }
4708
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4709 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4710 const struct hda_fixup *fix, int action)
4711 {
4712 struct alc_spec *spec = codec->spec;
4713
4714 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4715 spec->mic_led_coef.idx = 0x35;
4716 spec->mic_led_coef.mask = 3 << 2;
4717 spec->mic_led_coef.on = 2 << 2;
4718 spec->mic_led_coef.off = 1 << 2;
4719 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4720 }
4721 }
4722
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4723 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4724 const struct hda_fixup *fix, int action)
4725 {
4726 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4727 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4728 }
4729
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4730 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4731 const struct hda_fixup *fix, int action)
4732 {
4733 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4734 alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4735 }
4736
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4737 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4738 const struct hda_fixup *fix, int action)
4739 {
4740 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4741 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4742 }
4743
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4744 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4745 const struct hda_fixup *fix, int action)
4746 {
4747 struct alc_spec *spec = codec->spec;
4748
4749 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4750 spec->cap_mute_led_nid = 0x1a;
4751 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4752 codec->power_filter = led_power_filter;
4753 }
4754 }
4755
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4756 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4757 const struct hda_fixup *fix, int action)
4758 {
4759 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4760 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4761 }
4762
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4763 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4764 const unsigned short coefs[2])
4765 {
4766 alc_write_coef_idx(codec, 0x23, coefs[0]);
4767 alc_write_coef_idx(codec, 0x25, coefs[1]);
4768 alc_write_coef_idx(codec, 0x26, 0xb011);
4769 }
4770
4771 struct alc298_samsung_amp_desc {
4772 unsigned char nid;
4773 unsigned short init_seq[2][2];
4774 };
4775
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4776 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4777 const struct hda_fixup *fix, int action)
4778 {
4779 int i, j;
4780 static const unsigned short init_seq[][2] = {
4781 { 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4782 { 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4783 { 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4784 { 0x41, 0x07 }, { 0x400, 0x1 }
4785 };
4786 static const struct alc298_samsung_amp_desc amps[] = {
4787 { 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4788 { 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4789 };
4790
4791 if (action != HDA_FIXUP_ACT_INIT)
4792 return;
4793
4794 for (i = 0; i < ARRAY_SIZE(amps); i++) {
4795 alc_write_coef_idx(codec, 0x22, amps[i].nid);
4796
4797 for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4798 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4799
4800 for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4801 alc298_samsung_write_coef_pack(codec, init_seq[j]);
4802 }
4803 }
4804
4805 #if IS_REACHABLE(CONFIG_INPUT)
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4806 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4807 struct hda_jack_callback *event)
4808 {
4809 struct alc_spec *spec = codec->spec;
4810
4811 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4812 send both key on and key off event for every interrupt. */
4813 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4814 input_sync(spec->kb_dev);
4815 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4816 input_sync(spec->kb_dev);
4817 }
4818
alc_register_micmute_input_device(struct hda_codec * codec)4819 static int alc_register_micmute_input_device(struct hda_codec *codec)
4820 {
4821 struct alc_spec *spec = codec->spec;
4822 int i;
4823
4824 spec->kb_dev = input_allocate_device();
4825 if (!spec->kb_dev) {
4826 codec_err(codec, "Out of memory (input_allocate_device)\n");
4827 return -ENOMEM;
4828 }
4829
4830 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4831
4832 spec->kb_dev->name = "Microphone Mute Button";
4833 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4834 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4835 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4836 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4837 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4838 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4839
4840 if (input_register_device(spec->kb_dev)) {
4841 codec_err(codec, "input_register_device failed\n");
4842 input_free_device(spec->kb_dev);
4843 spec->kb_dev = NULL;
4844 return -ENOMEM;
4845 }
4846
4847 return 0;
4848 }
4849
4850 /* GPIO1 = set according to SKU external amp
4851 * GPIO2 = mic mute hotkey
4852 * GPIO3 = mute LED
4853 * GPIO4 = mic mute LED
4854 */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4855 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4856 const struct hda_fixup *fix, int action)
4857 {
4858 struct alc_spec *spec = codec->spec;
4859
4860 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4861 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4862 spec->init_amp = ALC_INIT_DEFAULT;
4863 if (alc_register_micmute_input_device(codec) != 0)
4864 return;
4865
4866 spec->gpio_mask |= 0x06;
4867 spec->gpio_dir |= 0x02;
4868 spec->gpio_data |= 0x02;
4869 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4870 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4871 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4872 gpio2_mic_hotkey_event);
4873 return;
4874 }
4875
4876 if (!spec->kb_dev)
4877 return;
4878
4879 switch (action) {
4880 case HDA_FIXUP_ACT_FREE:
4881 input_unregister_device(spec->kb_dev);
4882 spec->kb_dev = NULL;
4883 }
4884 }
4885
4886 /* Line2 = mic mute hotkey
4887 * GPIO2 = mic mute LED
4888 */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4889 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4890 const struct hda_fixup *fix, int action)
4891 {
4892 struct alc_spec *spec = codec->spec;
4893
4894 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4895 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4896 spec->init_amp = ALC_INIT_DEFAULT;
4897 if (alc_register_micmute_input_device(codec) != 0)
4898 return;
4899
4900 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4901 gpio2_mic_hotkey_event);
4902 return;
4903 }
4904
4905 if (!spec->kb_dev)
4906 return;
4907
4908 switch (action) {
4909 case HDA_FIXUP_ACT_FREE:
4910 input_unregister_device(spec->kb_dev);
4911 spec->kb_dev = NULL;
4912 }
4913 }
4914 #else /* INPUT */
4915 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4916 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4917 #endif /* INPUT */
4918
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4919 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4920 const struct hda_fixup *fix, int action)
4921 {
4922 struct alc_spec *spec = codec->spec;
4923
4924 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4925 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4926 spec->cap_mute_led_nid = 0x18;
4927 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4928 }
4929 }
4930
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)4931 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
4932 {
4933 if (delay <= 0)
4934 delay = 75;
4935 snd_hda_codec_write(codec, 0x21, 0,
4936 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4937 msleep(delay);
4938 snd_hda_codec_write(codec, 0x21, 0,
4939 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4940 msleep(delay);
4941 }
4942
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)4943 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
4944 {
4945 if (delay <= 0)
4946 delay = 75;
4947 snd_hda_codec_write(codec, 0x21, 0,
4948 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4949 msleep(delay);
4950 snd_hda_codec_write(codec, 0x21, 0,
4951 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4952 msleep(delay);
4953 }
4954
4955 static const struct coef_fw alc225_pre_hsmode[] = {
4956 UPDATE_COEF(0x4a, 1<<8, 0),
4957 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4958 UPDATE_COEF(0x63, 3<<14, 3<<14),
4959 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4960 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4961 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4962 UPDATE_COEF(0x4a, 3<<10, 0),
4963 {}
4964 };
4965
alc_headset_mode_unplugged(struct hda_codec * codec)4966 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4967 {
4968 struct alc_spec *spec = codec->spec;
4969 static const struct coef_fw coef0255[] = {
4970 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4971 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4972 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4973 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4974 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4975 {}
4976 };
4977 static const struct coef_fw coef0256[] = {
4978 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4979 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4980 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4981 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4982 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4983 {}
4984 };
4985 static const struct coef_fw coef0233[] = {
4986 WRITE_COEF(0x1b, 0x0c0b),
4987 WRITE_COEF(0x45, 0xc429),
4988 UPDATE_COEF(0x35, 0x4000, 0),
4989 WRITE_COEF(0x06, 0x2104),
4990 WRITE_COEF(0x1a, 0x0001),
4991 WRITE_COEF(0x26, 0x0004),
4992 WRITE_COEF(0x32, 0x42a3),
4993 {}
4994 };
4995 static const struct coef_fw coef0288[] = {
4996 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4997 UPDATE_COEF(0x50, 0x2000, 0x2000),
4998 UPDATE_COEF(0x56, 0x0006, 0x0006),
4999 UPDATE_COEF(0x66, 0x0008, 0),
5000 UPDATE_COEF(0x67, 0x2000, 0),
5001 {}
5002 };
5003 static const struct coef_fw coef0298[] = {
5004 UPDATE_COEF(0x19, 0x1300, 0x0300),
5005 {}
5006 };
5007 static const struct coef_fw coef0292[] = {
5008 WRITE_COEF(0x76, 0x000e),
5009 WRITE_COEF(0x6c, 0x2400),
5010 WRITE_COEF(0x18, 0x7308),
5011 WRITE_COEF(0x6b, 0xc429),
5012 {}
5013 };
5014 static const struct coef_fw coef0293[] = {
5015 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5016 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5017 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5018 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5019 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5020 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5021 {}
5022 };
5023 static const struct coef_fw coef0668[] = {
5024 WRITE_COEF(0x15, 0x0d40),
5025 WRITE_COEF(0xb7, 0x802b),
5026 {}
5027 };
5028 static const struct coef_fw coef0225[] = {
5029 UPDATE_COEF(0x63, 3<<14, 0),
5030 {}
5031 };
5032 static const struct coef_fw coef0274[] = {
5033 UPDATE_COEF(0x4a, 0x0100, 0),
5034 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5035 UPDATE_COEF(0x6b, 0xf000, 0x5000),
5036 UPDATE_COEF(0x4a, 0x0010, 0),
5037 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5038 WRITE_COEF(0x45, 0x5289),
5039 UPDATE_COEF(0x4a, 0x0c00, 0),
5040 {}
5041 };
5042
5043 if (spec->no_internal_mic_pin) {
5044 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5045 return;
5046 }
5047
5048 switch (codec->core.vendor_id) {
5049 case 0x10ec0255:
5050 alc_process_coef_fw(codec, coef0255);
5051 break;
5052 case 0x10ec0230:
5053 case 0x10ec0236:
5054 case 0x10ec0256:
5055 case 0x19e58326:
5056 alc_hp_mute_disable(codec, 75);
5057 alc_process_coef_fw(codec, coef0256);
5058 break;
5059 case 0x10ec0234:
5060 case 0x10ec0274:
5061 case 0x10ec0294:
5062 alc_process_coef_fw(codec, coef0274);
5063 break;
5064 case 0x10ec0233:
5065 case 0x10ec0283:
5066 alc_process_coef_fw(codec, coef0233);
5067 break;
5068 case 0x10ec0286:
5069 case 0x10ec0288:
5070 alc_process_coef_fw(codec, coef0288);
5071 break;
5072 case 0x10ec0298:
5073 alc_process_coef_fw(codec, coef0298);
5074 alc_process_coef_fw(codec, coef0288);
5075 break;
5076 case 0x10ec0292:
5077 alc_process_coef_fw(codec, coef0292);
5078 break;
5079 case 0x10ec0293:
5080 alc_process_coef_fw(codec, coef0293);
5081 break;
5082 case 0x10ec0668:
5083 alc_process_coef_fw(codec, coef0668);
5084 break;
5085 case 0x10ec0215:
5086 case 0x10ec0225:
5087 case 0x10ec0285:
5088 case 0x10ec0295:
5089 case 0x10ec0289:
5090 case 0x10ec0299:
5091 alc_hp_mute_disable(codec, 75);
5092 alc_process_coef_fw(codec, alc225_pre_hsmode);
5093 alc_process_coef_fw(codec, coef0225);
5094 break;
5095 case 0x10ec0867:
5096 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5097 break;
5098 }
5099 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5100 }
5101
5102
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5103 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5104 hda_nid_t mic_pin)
5105 {
5106 static const struct coef_fw coef0255[] = {
5107 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5108 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5109 {}
5110 };
5111 static const struct coef_fw coef0256[] = {
5112 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5113 WRITE_COEFEX(0x57, 0x03, 0x09a3),
5114 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5115 {}
5116 };
5117 static const struct coef_fw coef0233[] = {
5118 UPDATE_COEF(0x35, 0, 1<<14),
5119 WRITE_COEF(0x06, 0x2100),
5120 WRITE_COEF(0x1a, 0x0021),
5121 WRITE_COEF(0x26, 0x008c),
5122 {}
5123 };
5124 static const struct coef_fw coef0288[] = {
5125 UPDATE_COEF(0x4f, 0x00c0, 0),
5126 UPDATE_COEF(0x50, 0x2000, 0),
5127 UPDATE_COEF(0x56, 0x0006, 0),
5128 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5129 UPDATE_COEF(0x66, 0x0008, 0x0008),
5130 UPDATE_COEF(0x67, 0x2000, 0x2000),
5131 {}
5132 };
5133 static const struct coef_fw coef0292[] = {
5134 WRITE_COEF(0x19, 0xa208),
5135 WRITE_COEF(0x2e, 0xacf0),
5136 {}
5137 };
5138 static const struct coef_fw coef0293[] = {
5139 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5140 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5141 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5142 {}
5143 };
5144 static const struct coef_fw coef0688[] = {
5145 WRITE_COEF(0xb7, 0x802b),
5146 WRITE_COEF(0xb5, 0x1040),
5147 UPDATE_COEF(0xc3, 0, 1<<12),
5148 {}
5149 };
5150 static const struct coef_fw coef0225[] = {
5151 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5152 UPDATE_COEF(0x4a, 3<<4, 2<<4),
5153 UPDATE_COEF(0x63, 3<<14, 0),
5154 {}
5155 };
5156 static const struct coef_fw coef0274[] = {
5157 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5158 UPDATE_COEF(0x4a, 0x0010, 0),
5159 UPDATE_COEF(0x6b, 0xf000, 0),
5160 {}
5161 };
5162
5163 switch (codec->core.vendor_id) {
5164 case 0x10ec0255:
5165 alc_write_coef_idx(codec, 0x45, 0xc489);
5166 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5167 alc_process_coef_fw(codec, coef0255);
5168 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5169 break;
5170 case 0x10ec0230:
5171 case 0x10ec0236:
5172 case 0x10ec0256:
5173 case 0x19e58326:
5174 alc_write_coef_idx(codec, 0x45, 0xc489);
5175 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5176 alc_process_coef_fw(codec, coef0256);
5177 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5178 break;
5179 case 0x10ec0234:
5180 case 0x10ec0274:
5181 case 0x10ec0294:
5182 alc_write_coef_idx(codec, 0x45, 0x4689);
5183 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5184 alc_process_coef_fw(codec, coef0274);
5185 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5186 break;
5187 case 0x10ec0233:
5188 case 0x10ec0283:
5189 alc_write_coef_idx(codec, 0x45, 0xc429);
5190 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5191 alc_process_coef_fw(codec, coef0233);
5192 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5193 break;
5194 case 0x10ec0286:
5195 case 0x10ec0288:
5196 case 0x10ec0298:
5197 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5198 alc_process_coef_fw(codec, coef0288);
5199 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5200 break;
5201 case 0x10ec0292:
5202 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5203 alc_process_coef_fw(codec, coef0292);
5204 break;
5205 case 0x10ec0293:
5206 /* Set to TRS mode */
5207 alc_write_coef_idx(codec, 0x45, 0xc429);
5208 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5209 alc_process_coef_fw(codec, coef0293);
5210 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5211 break;
5212 case 0x10ec0867:
5213 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5214 fallthrough;
5215 case 0x10ec0221:
5216 case 0x10ec0662:
5217 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5218 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5219 break;
5220 case 0x10ec0668:
5221 alc_write_coef_idx(codec, 0x11, 0x0001);
5222 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5223 alc_process_coef_fw(codec, coef0688);
5224 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5225 break;
5226 case 0x10ec0215:
5227 case 0x10ec0225:
5228 case 0x10ec0285:
5229 case 0x10ec0295:
5230 case 0x10ec0289:
5231 case 0x10ec0299:
5232 alc_process_coef_fw(codec, alc225_pre_hsmode);
5233 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5234 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5235 alc_process_coef_fw(codec, coef0225);
5236 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5237 break;
5238 }
5239 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5240 }
5241
alc_headset_mode_default(struct hda_codec * codec)5242 static void alc_headset_mode_default(struct hda_codec *codec)
5243 {
5244 static const struct coef_fw coef0225[] = {
5245 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5246 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5247 UPDATE_COEF(0x49, 3<<8, 0<<8),
5248 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5249 UPDATE_COEF(0x63, 3<<14, 0),
5250 UPDATE_COEF(0x67, 0xf000, 0x3000),
5251 {}
5252 };
5253 static const struct coef_fw coef0255[] = {
5254 WRITE_COEF(0x45, 0xc089),
5255 WRITE_COEF(0x45, 0xc489),
5256 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5257 WRITE_COEF(0x49, 0x0049),
5258 {}
5259 };
5260 static const struct coef_fw coef0256[] = {
5261 WRITE_COEF(0x45, 0xc489),
5262 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5263 WRITE_COEF(0x49, 0x0049),
5264 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5265 WRITE_COEF(0x06, 0x6100),
5266 {}
5267 };
5268 static const struct coef_fw coef0233[] = {
5269 WRITE_COEF(0x06, 0x2100),
5270 WRITE_COEF(0x32, 0x4ea3),
5271 {}
5272 };
5273 static const struct coef_fw coef0288[] = {
5274 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5275 UPDATE_COEF(0x50, 0x2000, 0x2000),
5276 UPDATE_COEF(0x56, 0x0006, 0x0006),
5277 UPDATE_COEF(0x66, 0x0008, 0),
5278 UPDATE_COEF(0x67, 0x2000, 0),
5279 {}
5280 };
5281 static const struct coef_fw coef0292[] = {
5282 WRITE_COEF(0x76, 0x000e),
5283 WRITE_COEF(0x6c, 0x2400),
5284 WRITE_COEF(0x6b, 0xc429),
5285 WRITE_COEF(0x18, 0x7308),
5286 {}
5287 };
5288 static const struct coef_fw coef0293[] = {
5289 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5290 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5291 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5292 {}
5293 };
5294 static const struct coef_fw coef0688[] = {
5295 WRITE_COEF(0x11, 0x0041),
5296 WRITE_COEF(0x15, 0x0d40),
5297 WRITE_COEF(0xb7, 0x802b),
5298 {}
5299 };
5300 static const struct coef_fw coef0274[] = {
5301 WRITE_COEF(0x45, 0x4289),
5302 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5303 UPDATE_COEF(0x6b, 0x0f00, 0),
5304 UPDATE_COEF(0x49, 0x0300, 0x0300),
5305 {}
5306 };
5307
5308 switch (codec->core.vendor_id) {
5309 case 0x10ec0215:
5310 case 0x10ec0225:
5311 case 0x10ec0285:
5312 case 0x10ec0295:
5313 case 0x10ec0289:
5314 case 0x10ec0299:
5315 alc_process_coef_fw(codec, alc225_pre_hsmode);
5316 alc_process_coef_fw(codec, coef0225);
5317 alc_hp_enable_unmute(codec, 75);
5318 break;
5319 case 0x10ec0255:
5320 alc_process_coef_fw(codec, coef0255);
5321 break;
5322 case 0x10ec0230:
5323 case 0x10ec0236:
5324 case 0x10ec0256:
5325 case 0x19e58326:
5326 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5327 alc_write_coef_idx(codec, 0x45, 0xc089);
5328 msleep(50);
5329 alc_process_coef_fw(codec, coef0256);
5330 alc_hp_enable_unmute(codec, 75);
5331 break;
5332 case 0x10ec0234:
5333 case 0x10ec0274:
5334 case 0x10ec0294:
5335 alc_process_coef_fw(codec, coef0274);
5336 break;
5337 case 0x10ec0233:
5338 case 0x10ec0283:
5339 alc_process_coef_fw(codec, coef0233);
5340 break;
5341 case 0x10ec0286:
5342 case 0x10ec0288:
5343 case 0x10ec0298:
5344 alc_process_coef_fw(codec, coef0288);
5345 break;
5346 case 0x10ec0292:
5347 alc_process_coef_fw(codec, coef0292);
5348 break;
5349 case 0x10ec0293:
5350 alc_process_coef_fw(codec, coef0293);
5351 break;
5352 case 0x10ec0668:
5353 alc_process_coef_fw(codec, coef0688);
5354 break;
5355 case 0x10ec0867:
5356 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5357 break;
5358 }
5359 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5360 }
5361
5362 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5363 static void alc_headset_mode_ctia(struct hda_codec *codec)
5364 {
5365 int val;
5366
5367 static const struct coef_fw coef0255[] = {
5368 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5369 WRITE_COEF(0x1b, 0x0c2b),
5370 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5371 {}
5372 };
5373 static const struct coef_fw coef0256[] = {
5374 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5375 WRITE_COEF(0x1b, 0x0e6b),
5376 {}
5377 };
5378 static const struct coef_fw coef0233[] = {
5379 WRITE_COEF(0x45, 0xd429),
5380 WRITE_COEF(0x1b, 0x0c2b),
5381 WRITE_COEF(0x32, 0x4ea3),
5382 {}
5383 };
5384 static const struct coef_fw coef0288[] = {
5385 UPDATE_COEF(0x50, 0x2000, 0x2000),
5386 UPDATE_COEF(0x56, 0x0006, 0x0006),
5387 UPDATE_COEF(0x66, 0x0008, 0),
5388 UPDATE_COEF(0x67, 0x2000, 0),
5389 {}
5390 };
5391 static const struct coef_fw coef0292[] = {
5392 WRITE_COEF(0x6b, 0xd429),
5393 WRITE_COEF(0x76, 0x0008),
5394 WRITE_COEF(0x18, 0x7388),
5395 {}
5396 };
5397 static const struct coef_fw coef0293[] = {
5398 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5399 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5400 {}
5401 };
5402 static const struct coef_fw coef0688[] = {
5403 WRITE_COEF(0x11, 0x0001),
5404 WRITE_COEF(0x15, 0x0d60),
5405 WRITE_COEF(0xc3, 0x0000),
5406 {}
5407 };
5408 static const struct coef_fw coef0225_1[] = {
5409 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5410 UPDATE_COEF(0x63, 3<<14, 2<<14),
5411 {}
5412 };
5413 static const struct coef_fw coef0225_2[] = {
5414 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5415 UPDATE_COEF(0x63, 3<<14, 1<<14),
5416 {}
5417 };
5418
5419 switch (codec->core.vendor_id) {
5420 case 0x10ec0255:
5421 alc_process_coef_fw(codec, coef0255);
5422 break;
5423 case 0x10ec0230:
5424 case 0x10ec0236:
5425 case 0x10ec0256:
5426 case 0x19e58326:
5427 alc_process_coef_fw(codec, coef0256);
5428 alc_hp_enable_unmute(codec, 75);
5429 break;
5430 case 0x10ec0234:
5431 case 0x10ec0274:
5432 case 0x10ec0294:
5433 alc_write_coef_idx(codec, 0x45, 0xd689);
5434 break;
5435 case 0x10ec0233:
5436 case 0x10ec0283:
5437 alc_process_coef_fw(codec, coef0233);
5438 break;
5439 case 0x10ec0298:
5440 val = alc_read_coef_idx(codec, 0x50);
5441 if (val & (1 << 12)) {
5442 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5443 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5444 msleep(300);
5445 } else {
5446 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5447 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5448 msleep(300);
5449 }
5450 break;
5451 case 0x10ec0286:
5452 case 0x10ec0288:
5453 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5454 msleep(300);
5455 alc_process_coef_fw(codec, coef0288);
5456 break;
5457 case 0x10ec0292:
5458 alc_process_coef_fw(codec, coef0292);
5459 break;
5460 case 0x10ec0293:
5461 alc_process_coef_fw(codec, coef0293);
5462 break;
5463 case 0x10ec0668:
5464 alc_process_coef_fw(codec, coef0688);
5465 break;
5466 case 0x10ec0215:
5467 case 0x10ec0225:
5468 case 0x10ec0285:
5469 case 0x10ec0295:
5470 case 0x10ec0289:
5471 case 0x10ec0299:
5472 val = alc_read_coef_idx(codec, 0x45);
5473 if (val & (1 << 9))
5474 alc_process_coef_fw(codec, coef0225_2);
5475 else
5476 alc_process_coef_fw(codec, coef0225_1);
5477 alc_hp_enable_unmute(codec, 75);
5478 break;
5479 case 0x10ec0867:
5480 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5481 break;
5482 }
5483 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5484 }
5485
5486 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5487 static void alc_headset_mode_omtp(struct hda_codec *codec)
5488 {
5489 static const struct coef_fw coef0255[] = {
5490 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5491 WRITE_COEF(0x1b, 0x0c2b),
5492 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5493 {}
5494 };
5495 static const struct coef_fw coef0256[] = {
5496 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5497 WRITE_COEF(0x1b, 0x0e6b),
5498 {}
5499 };
5500 static const struct coef_fw coef0233[] = {
5501 WRITE_COEF(0x45, 0xe429),
5502 WRITE_COEF(0x1b, 0x0c2b),
5503 WRITE_COEF(0x32, 0x4ea3),
5504 {}
5505 };
5506 static const struct coef_fw coef0288[] = {
5507 UPDATE_COEF(0x50, 0x2000, 0x2000),
5508 UPDATE_COEF(0x56, 0x0006, 0x0006),
5509 UPDATE_COEF(0x66, 0x0008, 0),
5510 UPDATE_COEF(0x67, 0x2000, 0),
5511 {}
5512 };
5513 static const struct coef_fw coef0292[] = {
5514 WRITE_COEF(0x6b, 0xe429),
5515 WRITE_COEF(0x76, 0x0008),
5516 WRITE_COEF(0x18, 0x7388),
5517 {}
5518 };
5519 static const struct coef_fw coef0293[] = {
5520 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5521 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5522 {}
5523 };
5524 static const struct coef_fw coef0688[] = {
5525 WRITE_COEF(0x11, 0x0001),
5526 WRITE_COEF(0x15, 0x0d50),
5527 WRITE_COEF(0xc3, 0x0000),
5528 {}
5529 };
5530 static const struct coef_fw coef0225[] = {
5531 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5532 UPDATE_COEF(0x63, 3<<14, 2<<14),
5533 {}
5534 };
5535
5536 switch (codec->core.vendor_id) {
5537 case 0x10ec0255:
5538 alc_process_coef_fw(codec, coef0255);
5539 break;
5540 case 0x10ec0230:
5541 case 0x10ec0236:
5542 case 0x10ec0256:
5543 case 0x19e58326:
5544 alc_process_coef_fw(codec, coef0256);
5545 alc_hp_enable_unmute(codec, 75);
5546 break;
5547 case 0x10ec0234:
5548 case 0x10ec0274:
5549 case 0x10ec0294:
5550 alc_write_coef_idx(codec, 0x45, 0xe689);
5551 break;
5552 case 0x10ec0233:
5553 case 0x10ec0283:
5554 alc_process_coef_fw(codec, coef0233);
5555 break;
5556 case 0x10ec0298:
5557 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5558 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5559 msleep(300);
5560 break;
5561 case 0x10ec0286:
5562 case 0x10ec0288:
5563 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5564 msleep(300);
5565 alc_process_coef_fw(codec, coef0288);
5566 break;
5567 case 0x10ec0292:
5568 alc_process_coef_fw(codec, coef0292);
5569 break;
5570 case 0x10ec0293:
5571 alc_process_coef_fw(codec, coef0293);
5572 break;
5573 case 0x10ec0668:
5574 alc_process_coef_fw(codec, coef0688);
5575 break;
5576 case 0x10ec0215:
5577 case 0x10ec0225:
5578 case 0x10ec0285:
5579 case 0x10ec0295:
5580 case 0x10ec0289:
5581 case 0x10ec0299:
5582 alc_process_coef_fw(codec, coef0225);
5583 alc_hp_enable_unmute(codec, 75);
5584 break;
5585 }
5586 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5587 }
5588
alc_determine_headset_type(struct hda_codec * codec)5589 static void alc_determine_headset_type(struct hda_codec *codec)
5590 {
5591 int val;
5592 bool is_ctia = false;
5593 struct alc_spec *spec = codec->spec;
5594 static const struct coef_fw coef0255[] = {
5595 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5596 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5597 conteol) */
5598 {}
5599 };
5600 static const struct coef_fw coef0288[] = {
5601 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5602 {}
5603 };
5604 static const struct coef_fw coef0298[] = {
5605 UPDATE_COEF(0x50, 0x2000, 0x2000),
5606 UPDATE_COEF(0x56, 0x0006, 0x0006),
5607 UPDATE_COEF(0x66, 0x0008, 0),
5608 UPDATE_COEF(0x67, 0x2000, 0),
5609 UPDATE_COEF(0x19, 0x1300, 0x1300),
5610 {}
5611 };
5612 static const struct coef_fw coef0293[] = {
5613 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5614 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5615 {}
5616 };
5617 static const struct coef_fw coef0688[] = {
5618 WRITE_COEF(0x11, 0x0001),
5619 WRITE_COEF(0xb7, 0x802b),
5620 WRITE_COEF(0x15, 0x0d60),
5621 WRITE_COEF(0xc3, 0x0c00),
5622 {}
5623 };
5624 static const struct coef_fw coef0274[] = {
5625 UPDATE_COEF(0x4a, 0x0010, 0),
5626 UPDATE_COEF(0x4a, 0x8000, 0),
5627 WRITE_COEF(0x45, 0xd289),
5628 UPDATE_COEF(0x49, 0x0300, 0x0300),
5629 {}
5630 };
5631
5632 if (spec->no_internal_mic_pin) {
5633 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5634 return;
5635 }
5636
5637 switch (codec->core.vendor_id) {
5638 case 0x10ec0255:
5639 alc_process_coef_fw(codec, coef0255);
5640 msleep(300);
5641 val = alc_read_coef_idx(codec, 0x46);
5642 is_ctia = (val & 0x0070) == 0x0070;
5643 break;
5644 case 0x10ec0230:
5645 case 0x10ec0236:
5646 case 0x10ec0256:
5647 case 0x19e58326:
5648 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5649 alc_write_coef_idx(codec, 0x06, 0x6104);
5650 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5651
5652 alc_process_coef_fw(codec, coef0255);
5653 msleep(300);
5654 val = alc_read_coef_idx(codec, 0x46);
5655 is_ctia = (val & 0x0070) == 0x0070;
5656 if (!is_ctia) {
5657 alc_write_coef_idx(codec, 0x45, 0xe089);
5658 msleep(100);
5659 val = alc_read_coef_idx(codec, 0x46);
5660 if ((val & 0x0070) == 0x0070)
5661 is_ctia = false;
5662 else
5663 is_ctia = true;
5664 }
5665 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5666 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5667 break;
5668 case 0x10ec0234:
5669 case 0x10ec0274:
5670 case 0x10ec0294:
5671 alc_process_coef_fw(codec, coef0274);
5672 msleep(850);
5673 val = alc_read_coef_idx(codec, 0x46);
5674 is_ctia = (val & 0x00f0) == 0x00f0;
5675 break;
5676 case 0x10ec0233:
5677 case 0x10ec0283:
5678 alc_write_coef_idx(codec, 0x45, 0xd029);
5679 msleep(300);
5680 val = alc_read_coef_idx(codec, 0x46);
5681 is_ctia = (val & 0x0070) == 0x0070;
5682 break;
5683 case 0x10ec0298:
5684 snd_hda_codec_write(codec, 0x21, 0,
5685 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5686 msleep(100);
5687 snd_hda_codec_write(codec, 0x21, 0,
5688 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5689 msleep(200);
5690
5691 val = alc_read_coef_idx(codec, 0x50);
5692 if (val & (1 << 12)) {
5693 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5694 alc_process_coef_fw(codec, coef0288);
5695 msleep(350);
5696 val = alc_read_coef_idx(codec, 0x50);
5697 is_ctia = (val & 0x0070) == 0x0070;
5698 } else {
5699 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5700 alc_process_coef_fw(codec, coef0288);
5701 msleep(350);
5702 val = alc_read_coef_idx(codec, 0x50);
5703 is_ctia = (val & 0x0070) == 0x0070;
5704 }
5705 alc_process_coef_fw(codec, coef0298);
5706 snd_hda_codec_write(codec, 0x21, 0,
5707 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5708 msleep(75);
5709 snd_hda_codec_write(codec, 0x21, 0,
5710 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5711 break;
5712 case 0x10ec0286:
5713 case 0x10ec0288:
5714 alc_process_coef_fw(codec, coef0288);
5715 msleep(350);
5716 val = alc_read_coef_idx(codec, 0x50);
5717 is_ctia = (val & 0x0070) == 0x0070;
5718 break;
5719 case 0x10ec0292:
5720 alc_write_coef_idx(codec, 0x6b, 0xd429);
5721 msleep(300);
5722 val = alc_read_coef_idx(codec, 0x6c);
5723 is_ctia = (val & 0x001c) == 0x001c;
5724 break;
5725 case 0x10ec0293:
5726 alc_process_coef_fw(codec, coef0293);
5727 msleep(300);
5728 val = alc_read_coef_idx(codec, 0x46);
5729 is_ctia = (val & 0x0070) == 0x0070;
5730 break;
5731 case 0x10ec0668:
5732 alc_process_coef_fw(codec, coef0688);
5733 msleep(300);
5734 val = alc_read_coef_idx(codec, 0xbe);
5735 is_ctia = (val & 0x1c02) == 0x1c02;
5736 break;
5737 case 0x10ec0215:
5738 case 0x10ec0225:
5739 case 0x10ec0285:
5740 case 0x10ec0295:
5741 case 0x10ec0289:
5742 case 0x10ec0299:
5743 alc_process_coef_fw(codec, alc225_pre_hsmode);
5744 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5745 val = alc_read_coef_idx(codec, 0x45);
5746 if (val & (1 << 9)) {
5747 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5748 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5749 msleep(800);
5750 val = alc_read_coef_idx(codec, 0x46);
5751 is_ctia = (val & 0x00f0) == 0x00f0;
5752 } else {
5753 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5754 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5755 msleep(800);
5756 val = alc_read_coef_idx(codec, 0x46);
5757 is_ctia = (val & 0x00f0) == 0x00f0;
5758 }
5759 if (!is_ctia) {
5760 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5761 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5762 msleep(100);
5763 val = alc_read_coef_idx(codec, 0x46);
5764 if ((val & 0x00f0) == 0x00f0)
5765 is_ctia = false;
5766 else
5767 is_ctia = true;
5768 }
5769 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5770 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5771 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5772 break;
5773 case 0x10ec0867:
5774 is_ctia = true;
5775 break;
5776 }
5777
5778 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5779 is_ctia ? "yes" : "no");
5780 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5781 }
5782
alc_update_headset_mode(struct hda_codec * codec)5783 static void alc_update_headset_mode(struct hda_codec *codec)
5784 {
5785 struct alc_spec *spec = codec->spec;
5786
5787 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5788 hda_nid_t hp_pin = alc_get_hp_pin(spec);
5789
5790 int new_headset_mode;
5791
5792 if (!snd_hda_jack_detect(codec, hp_pin))
5793 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5794 else if (mux_pin == spec->headset_mic_pin)
5795 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5796 else if (mux_pin == spec->headphone_mic_pin)
5797 new_headset_mode = ALC_HEADSET_MODE_MIC;
5798 else
5799 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5800
5801 if (new_headset_mode == spec->current_headset_mode) {
5802 snd_hda_gen_update_outputs(codec);
5803 return;
5804 }
5805
5806 switch (new_headset_mode) {
5807 case ALC_HEADSET_MODE_UNPLUGGED:
5808 alc_headset_mode_unplugged(codec);
5809 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5810 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5811 spec->gen.hp_jack_present = false;
5812 break;
5813 case ALC_HEADSET_MODE_HEADSET:
5814 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5815 alc_determine_headset_type(codec);
5816 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5817 alc_headset_mode_ctia(codec);
5818 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5819 alc_headset_mode_omtp(codec);
5820 spec->gen.hp_jack_present = true;
5821 break;
5822 case ALC_HEADSET_MODE_MIC:
5823 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5824 spec->gen.hp_jack_present = false;
5825 break;
5826 case ALC_HEADSET_MODE_HEADPHONE:
5827 alc_headset_mode_default(codec);
5828 spec->gen.hp_jack_present = true;
5829 break;
5830 }
5831 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5832 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5833 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5834 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5835 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5836 PIN_VREFHIZ);
5837 }
5838 spec->current_headset_mode = new_headset_mode;
5839
5840 snd_hda_gen_update_outputs(codec);
5841 }
5842
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5843 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5844 struct snd_kcontrol *kcontrol,
5845 struct snd_ctl_elem_value *ucontrol)
5846 {
5847 alc_update_headset_mode(codec);
5848 }
5849
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5850 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5851 struct hda_jack_callback *jack)
5852 {
5853 snd_hda_gen_hp_automute(codec, jack);
5854 alc_update_headset_mode(codec);
5855 }
5856
alc_probe_headset_mode(struct hda_codec * codec)5857 static void alc_probe_headset_mode(struct hda_codec *codec)
5858 {
5859 int i;
5860 struct alc_spec *spec = codec->spec;
5861 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5862
5863 /* Find mic pins */
5864 for (i = 0; i < cfg->num_inputs; i++) {
5865 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5866 spec->headset_mic_pin = cfg->inputs[i].pin;
5867 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5868 spec->headphone_mic_pin = cfg->inputs[i].pin;
5869 }
5870
5871 WARN_ON(spec->gen.cap_sync_hook);
5872 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5873 spec->gen.automute_hook = alc_update_headset_mode;
5874 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5875 }
5876
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5877 static void alc_fixup_headset_mode(struct hda_codec *codec,
5878 const struct hda_fixup *fix, int action)
5879 {
5880 struct alc_spec *spec = codec->spec;
5881
5882 switch (action) {
5883 case HDA_FIXUP_ACT_PRE_PROBE:
5884 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5885 break;
5886 case HDA_FIXUP_ACT_PROBE:
5887 alc_probe_headset_mode(codec);
5888 break;
5889 case HDA_FIXUP_ACT_INIT:
5890 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5891 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5892 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5893 }
5894 alc_update_headset_mode(codec);
5895 break;
5896 }
5897 }
5898
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5899 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5900 const struct hda_fixup *fix, int action)
5901 {
5902 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5903 struct alc_spec *spec = codec->spec;
5904 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5905 }
5906 else
5907 alc_fixup_headset_mode(codec, fix, action);
5908 }
5909
alc255_set_default_jack_type(struct hda_codec * codec)5910 static void alc255_set_default_jack_type(struct hda_codec *codec)
5911 {
5912 /* Set to iphone type */
5913 static const struct coef_fw alc255fw[] = {
5914 WRITE_COEF(0x1b, 0x880b),
5915 WRITE_COEF(0x45, 0xd089),
5916 WRITE_COEF(0x1b, 0x080b),
5917 WRITE_COEF(0x46, 0x0004),
5918 WRITE_COEF(0x1b, 0x0c0b),
5919 {}
5920 };
5921 static const struct coef_fw alc256fw[] = {
5922 WRITE_COEF(0x1b, 0x884b),
5923 WRITE_COEF(0x45, 0xd089),
5924 WRITE_COEF(0x1b, 0x084b),
5925 WRITE_COEF(0x46, 0x0004),
5926 WRITE_COEF(0x1b, 0x0c4b),
5927 {}
5928 };
5929 switch (codec->core.vendor_id) {
5930 case 0x10ec0255:
5931 alc_process_coef_fw(codec, alc255fw);
5932 break;
5933 case 0x10ec0230:
5934 case 0x10ec0236:
5935 case 0x10ec0256:
5936 case 0x19e58326:
5937 alc_process_coef_fw(codec, alc256fw);
5938 break;
5939 }
5940 msleep(30);
5941 }
5942
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)5943 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5944 const struct hda_fixup *fix, int action)
5945 {
5946 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5947 alc255_set_default_jack_type(codec);
5948 }
5949 alc_fixup_headset_mode(codec, fix, action);
5950 }
5951
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5952 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5953 const struct hda_fixup *fix, int action)
5954 {
5955 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5956 struct alc_spec *spec = codec->spec;
5957 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5958 alc255_set_default_jack_type(codec);
5959 }
5960 else
5961 alc_fixup_headset_mode(codec, fix, action);
5962 }
5963
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5964 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5965 struct hda_jack_callback *jack)
5966 {
5967 struct alc_spec *spec = codec->spec;
5968
5969 alc_update_headset_jack_cb(codec, jack);
5970 /* Headset Mic enable or disable, only for Dell Dino */
5971 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5972 }
5973
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)5974 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5975 const struct hda_fixup *fix, int action)
5976 {
5977 alc_fixup_headset_mode(codec, fix, action);
5978 if (action == HDA_FIXUP_ACT_PROBE) {
5979 struct alc_spec *spec = codec->spec;
5980 /* toggled via hp_automute_hook */
5981 spec->gpio_mask |= 0x40;
5982 spec->gpio_dir |= 0x40;
5983 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5984 }
5985 }
5986
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)5987 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5988 const struct hda_fixup *fix, int action)
5989 {
5990 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5991 struct alc_spec *spec = codec->spec;
5992 spec->gen.auto_mute_via_amp = 1;
5993 }
5994 }
5995
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)5996 static void alc_fixup_no_shutup(struct hda_codec *codec,
5997 const struct hda_fixup *fix, int action)
5998 {
5999 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6000 struct alc_spec *spec = codec->spec;
6001 spec->no_shutup_pins = 1;
6002 }
6003 }
6004
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6005 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6006 const struct hda_fixup *fix, int action)
6007 {
6008 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6009 struct alc_spec *spec = codec->spec;
6010 /* Disable AA-loopback as it causes white noise */
6011 spec->gen.mixer_nid = 0;
6012 }
6013 }
6014
6015 /* 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)6016 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6017 const struct hda_fixup *fix, int action)
6018 {
6019 static const struct hda_pintbl pincfgs[] = {
6020 { 0x16, 0x21211010 }, /* dock headphone */
6021 { 0x19, 0x21a11010 }, /* dock mic */
6022 { }
6023 };
6024 struct alc_spec *spec = codec->spec;
6025
6026 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6027 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6028 codec->power_save_node = 0; /* avoid click noises */
6029 snd_hda_apply_pincfgs(codec, pincfgs);
6030 }
6031 }
6032
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6033 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6034 const struct hda_fixup *fix, int action)
6035 {
6036 static const struct hda_pintbl pincfgs[] = {
6037 { 0x17, 0x21211010 }, /* dock headphone */
6038 { 0x19, 0x21a11010 }, /* dock mic */
6039 { }
6040 };
6041 struct alc_spec *spec = codec->spec;
6042
6043 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6044 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6045 snd_hda_apply_pincfgs(codec, pincfgs);
6046 } else if (action == HDA_FIXUP_ACT_INIT) {
6047 /* Enable DOCK device */
6048 snd_hda_codec_write(codec, 0x17, 0,
6049 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6050 /* Enable DOCK device */
6051 snd_hda_codec_write(codec, 0x19, 0,
6052 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6053 }
6054 }
6055
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6056 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6057 const struct hda_fixup *fix, int action)
6058 {
6059 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6060 * the speaker output becomes too low by some reason on Thinkpads with
6061 * ALC298 codec
6062 */
6063 static const hda_nid_t preferred_pairs[] = {
6064 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6065 0
6066 };
6067 struct alc_spec *spec = codec->spec;
6068
6069 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6070 spec->gen.preferred_dacs = preferred_pairs;
6071 }
6072
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6073 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6074 const struct hda_fixup *fix, int action)
6075 {
6076 static const hda_nid_t preferred_pairs[] = {
6077 0x17, 0x02, 0x21, 0x03, 0
6078 };
6079 struct alc_spec *spec = codec->spec;
6080
6081 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6082 spec->gen.preferred_dacs = preferred_pairs;
6083 }
6084
alc_shutup_dell_xps13(struct hda_codec * codec)6085 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6086 {
6087 struct alc_spec *spec = codec->spec;
6088 int hp_pin = alc_get_hp_pin(spec);
6089
6090 /* Prevent pop noises when headphones are plugged in */
6091 snd_hda_codec_write(codec, hp_pin, 0,
6092 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6093 msleep(20);
6094 }
6095
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6096 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6097 const struct hda_fixup *fix, int action)
6098 {
6099 struct alc_spec *spec = codec->spec;
6100 struct hda_input_mux *imux = &spec->gen.input_mux;
6101 int i;
6102
6103 switch (action) {
6104 case HDA_FIXUP_ACT_PRE_PROBE:
6105 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6106 * it causes a click noise at start up
6107 */
6108 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6109 spec->shutup = alc_shutup_dell_xps13;
6110 break;
6111 case HDA_FIXUP_ACT_PROBE:
6112 /* Make the internal mic the default input source. */
6113 for (i = 0; i < imux->num_items; i++) {
6114 if (spec->gen.imux_pins[i] == 0x12) {
6115 spec->gen.cur_mux[0] = i;
6116 break;
6117 }
6118 }
6119 break;
6120 }
6121 }
6122
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6123 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6124 const struct hda_fixup *fix, int action)
6125 {
6126 struct alc_spec *spec = codec->spec;
6127
6128 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6129 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6130 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6131
6132 /* Disable boost for mic-in permanently. (This code is only called
6133 from quirks that guarantee that the headphone is at NID 0x1b.) */
6134 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6135 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6136 } else
6137 alc_fixup_headset_mode(codec, fix, action);
6138 }
6139
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6140 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6141 const struct hda_fixup *fix, int action)
6142 {
6143 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6144 alc_write_coef_idx(codec, 0xc4, 0x8000);
6145 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6146 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6147 }
6148 alc_fixup_headset_mode(codec, fix, action);
6149 }
6150
6151 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6152 static int find_ext_mic_pin(struct hda_codec *codec)
6153 {
6154 struct alc_spec *spec = codec->spec;
6155 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6156 hda_nid_t nid;
6157 unsigned int defcfg;
6158 int i;
6159
6160 for (i = 0; i < cfg->num_inputs; i++) {
6161 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6162 continue;
6163 nid = cfg->inputs[i].pin;
6164 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6165 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6166 continue;
6167 return nid;
6168 }
6169
6170 return 0;
6171 }
6172
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6173 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6174 const struct hda_fixup *fix,
6175 int action)
6176 {
6177 struct alc_spec *spec = codec->spec;
6178
6179 if (action == HDA_FIXUP_ACT_PROBE) {
6180 int mic_pin = find_ext_mic_pin(codec);
6181 int hp_pin = alc_get_hp_pin(spec);
6182
6183 if (snd_BUG_ON(!mic_pin || !hp_pin))
6184 return;
6185 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6186 }
6187 }
6188
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6189 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6190 const struct hda_fixup *fix,
6191 int action)
6192 {
6193 struct alc_spec *spec = codec->spec;
6194 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6195 int i;
6196
6197 /* The mic boosts on level 2 and 3 are too noisy
6198 on the internal mic input.
6199 Therefore limit the boost to 0 or 1. */
6200
6201 if (action != HDA_FIXUP_ACT_PROBE)
6202 return;
6203
6204 for (i = 0; i < cfg->num_inputs; i++) {
6205 hda_nid_t nid = cfg->inputs[i].pin;
6206 unsigned int defcfg;
6207 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6208 continue;
6209 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6210 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6211 continue;
6212
6213 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6214 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6215 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6216 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6217 (0 << AC_AMPCAP_MUTE_SHIFT));
6218 }
6219 }
6220
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6221 static void alc283_hp_automute_hook(struct hda_codec *codec,
6222 struct hda_jack_callback *jack)
6223 {
6224 struct alc_spec *spec = codec->spec;
6225 int vref;
6226
6227 msleep(200);
6228 snd_hda_gen_hp_automute(codec, jack);
6229
6230 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6231
6232 msleep(600);
6233 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6234 vref);
6235 }
6236
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6237 static void alc283_fixup_chromebook(struct hda_codec *codec,
6238 const struct hda_fixup *fix, int action)
6239 {
6240 struct alc_spec *spec = codec->spec;
6241
6242 switch (action) {
6243 case HDA_FIXUP_ACT_PRE_PROBE:
6244 snd_hda_override_wcaps(codec, 0x03, 0);
6245 /* Disable AA-loopback as it causes white noise */
6246 spec->gen.mixer_nid = 0;
6247 break;
6248 case HDA_FIXUP_ACT_INIT:
6249 /* MIC2-VREF control */
6250 /* Set to manual mode */
6251 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6252 /* Enable Line1 input control by verb */
6253 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6254 break;
6255 }
6256 }
6257
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6258 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6259 const struct hda_fixup *fix, int action)
6260 {
6261 struct alc_spec *spec = codec->spec;
6262
6263 switch (action) {
6264 case HDA_FIXUP_ACT_PRE_PROBE:
6265 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6266 break;
6267 case HDA_FIXUP_ACT_INIT:
6268 /* MIC2-VREF control */
6269 /* Set to manual mode */
6270 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6271 break;
6272 }
6273 }
6274
6275 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6276 static void asus_tx300_automute(struct hda_codec *codec)
6277 {
6278 struct alc_spec *spec = codec->spec;
6279 snd_hda_gen_update_outputs(codec);
6280 if (snd_hda_jack_detect(codec, 0x1b))
6281 spec->gen.mute_bits |= (1ULL << 0x14);
6282 }
6283
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6284 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6285 const struct hda_fixup *fix, int action)
6286 {
6287 struct alc_spec *spec = codec->spec;
6288 static const struct hda_pintbl dock_pins[] = {
6289 { 0x1b, 0x21114000 }, /* dock speaker pin */
6290 {}
6291 };
6292
6293 switch (action) {
6294 case HDA_FIXUP_ACT_PRE_PROBE:
6295 spec->init_amp = ALC_INIT_DEFAULT;
6296 /* TX300 needs to set up GPIO2 for the speaker amp */
6297 alc_setup_gpio(codec, 0x04);
6298 snd_hda_apply_pincfgs(codec, dock_pins);
6299 spec->gen.auto_mute_via_amp = 1;
6300 spec->gen.automute_hook = asus_tx300_automute;
6301 snd_hda_jack_detect_enable_callback(codec, 0x1b,
6302 snd_hda_gen_hp_automute);
6303 break;
6304 case HDA_FIXUP_ACT_PROBE:
6305 spec->init_amp = ALC_INIT_DEFAULT;
6306 break;
6307 case HDA_FIXUP_ACT_BUILD:
6308 /* this is a bit tricky; give more sane names for the main
6309 * (tablet) speaker and the dock speaker, respectively
6310 */
6311 rename_ctl(codec, "Speaker Playback Switch",
6312 "Dock Speaker Playback Switch");
6313 rename_ctl(codec, "Bass Speaker Playback Switch",
6314 "Speaker Playback Switch");
6315 break;
6316 }
6317 }
6318
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6319 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6320 const struct hda_fixup *fix, int action)
6321 {
6322 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6323 /* DAC node 0x03 is giving mono output. We therefore want to
6324 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6325 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6326 static const hda_nid_t conn1[] = { 0x0c };
6327 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6328 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6329 }
6330 }
6331
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6332 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6333 const struct hda_fixup *fix, int action)
6334 {
6335 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6336 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6337 we can't adjust the speaker's volume since this node does not has
6338 Amp-out capability. we change the speaker's route to:
6339 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6340 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6341 speaker's volume now. */
6342
6343 static const hda_nid_t conn1[] = { 0x0c };
6344 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6345 }
6346 }
6347
6348 /* 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)6349 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6350 const struct hda_fixup *fix, int action)
6351 {
6352 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6353 static const hda_nid_t conn[] = { 0x02, 0x03 };
6354 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6355 }
6356 }
6357
6358 /* 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)6359 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6360 const struct hda_fixup *fix, int action)
6361 {
6362 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6363 static const hda_nid_t conn[] = { 0x02 };
6364 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6365 }
6366 }
6367
6368 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6369 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6370 struct hda_jack_callback *jack)
6371 {
6372 struct alc_spec *spec = codec->spec;
6373
6374 snd_hda_gen_hp_automute(codec, jack);
6375 /* mute_led_polarity is set to 0, so we pass inverted value here */
6376 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6377 !spec->gen.hp_jack_present);
6378 }
6379
6380 /* Manage GPIOs for HP EliteBook Folio 9480m.
6381 *
6382 * GPIO4 is the headphone amplifier power control
6383 * GPIO3 is the audio output mute indicator LED
6384 */
6385
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6386 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6387 const struct hda_fixup *fix,
6388 int action)
6389 {
6390 struct alc_spec *spec = codec->spec;
6391
6392 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6393 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6394 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6395 spec->gpio_mask |= 0x10;
6396 spec->gpio_dir |= 0x10;
6397 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6398 }
6399 }
6400
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6401 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6402 const struct hda_fixup *fix,
6403 int action)
6404 {
6405 struct alc_spec *spec = codec->spec;
6406
6407 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6408 spec->gpio_mask |= 0x04;
6409 spec->gpio_dir |= 0x04;
6410 /* set data bit low */
6411 }
6412 }
6413
6414 /* Quirk for Thinkpad X1 7th and 8th Gen
6415 * The following fixed routing needed
6416 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6417 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6418 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6419 */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6420 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6421 const struct hda_fixup *fix, int action)
6422 {
6423 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6424 static const hda_nid_t preferred_pairs[] = {
6425 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6426 };
6427 struct alc_spec *spec = codec->spec;
6428
6429 switch (action) {
6430 case HDA_FIXUP_ACT_PRE_PROBE:
6431 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6432 spec->gen.preferred_dacs = preferred_pairs;
6433 break;
6434 case HDA_FIXUP_ACT_BUILD:
6435 /* The generic parser creates somewhat unintuitive volume ctls
6436 * with the fixed routing above, and the shared DAC2 may be
6437 * confusing for PA.
6438 * Rename those to unique names so that PA doesn't touch them
6439 * and use only Master volume.
6440 */
6441 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6442 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6443 break;
6444 }
6445 }
6446
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6447 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6448 const struct hda_fixup *fix,
6449 int action)
6450 {
6451 alc_fixup_dual_codecs(codec, fix, action);
6452 switch (action) {
6453 case HDA_FIXUP_ACT_PRE_PROBE:
6454 /* override card longname to provide a unique UCM profile */
6455 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6456 break;
6457 case HDA_FIXUP_ACT_BUILD:
6458 /* rename Capture controls depending on the codec */
6459 rename_ctl(codec, "Capture Volume",
6460 codec->addr == 0 ?
6461 "Rear-Panel Capture Volume" :
6462 "Front-Panel Capture Volume");
6463 rename_ctl(codec, "Capture Switch",
6464 codec->addr == 0 ?
6465 "Rear-Panel Capture Switch" :
6466 "Front-Panel Capture Switch");
6467 break;
6468 }
6469 }
6470
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6471 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6472 const struct hda_fixup *fix, int action)
6473 {
6474 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6475 return;
6476
6477 codec->power_save_node = 1;
6478 }
6479
6480 /* 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)6481 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6482 const struct hda_fixup *fix, int action)
6483 {
6484 struct alc_spec *spec = codec->spec;
6485 static const hda_nid_t preferred_pairs[] = {
6486 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6487 0
6488 };
6489
6490 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6491 return;
6492
6493 spec->gen.preferred_dacs = preferred_pairs;
6494 spec->gen.auto_mute_via_amp = 1;
6495 codec->power_save_node = 0;
6496 }
6497
6498 /* 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)6499 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6500 const struct hda_fixup *fix, int action)
6501 {
6502 static const hda_nid_t preferred_pairs[] = {
6503 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6504 };
6505 struct alc_spec *spec = codec->spec;
6506
6507 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6508 spec->gen.preferred_dacs = preferred_pairs;
6509 spec->gen.obey_preferred_dacs = 1;
6510 }
6511 }
6512
6513 /* 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)6514 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6515 const struct hda_fixup *fix, int action)
6516 {
6517 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6518 return;
6519
6520 snd_hda_override_wcaps(codec, 0x03, 0);
6521 }
6522
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6523 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6524 {
6525 switch (codec->core.vendor_id) {
6526 case 0x10ec0274:
6527 case 0x10ec0294:
6528 case 0x10ec0225:
6529 case 0x10ec0295:
6530 case 0x10ec0299:
6531 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6532 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6533 break;
6534 case 0x10ec0230:
6535 case 0x10ec0235:
6536 case 0x10ec0236:
6537 case 0x10ec0255:
6538 case 0x10ec0256:
6539 case 0x10ec0257:
6540 case 0x19e58326:
6541 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6542 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6543 break;
6544 }
6545 }
6546
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6547 static void alc295_fixup_chromebook(struct hda_codec *codec,
6548 const struct hda_fixup *fix, int action)
6549 {
6550 struct alc_spec *spec = codec->spec;
6551
6552 switch (action) {
6553 case HDA_FIXUP_ACT_PRE_PROBE:
6554 spec->ultra_low_power = true;
6555 break;
6556 case HDA_FIXUP_ACT_INIT:
6557 alc_combo_jack_hp_jd_restart(codec);
6558 break;
6559 }
6560 }
6561
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6562 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6563 const struct hda_fixup *fix, int action)
6564 {
6565 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6566 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6567 }
6568
6569
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6570 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6571 struct hda_jack_callback *cb)
6572 {
6573 /* The Windows driver sets the codec up in a very different way where
6574 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6575 */
6576 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6577 alc_write_coef_idx(codec, 0x10, 0x8a20);
6578 else
6579 alc_write_coef_idx(codec, 0x10, 0x0a20);
6580 }
6581
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6582 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6583 const struct hda_fixup *fix, int action)
6584 {
6585 /* Pin 0x21: headphones/headset mic */
6586 if (!is_jack_detectable(codec, 0x21))
6587 return;
6588
6589 switch (action) {
6590 case HDA_FIXUP_ACT_PRE_PROBE:
6591 snd_hda_jack_detect_enable_callback(codec, 0x21,
6592 alc294_gx502_toggle_output);
6593 break;
6594 case HDA_FIXUP_ACT_INIT:
6595 /* Make sure to start in a correct state, i.e. if
6596 * headphones have been plugged in before powering up the system
6597 */
6598 alc294_gx502_toggle_output(codec, NULL);
6599 break;
6600 }
6601 }
6602
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6603 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6604 struct hda_jack_callback *cb)
6605 {
6606 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6607 * responsible from changes between speakers and headphones
6608 */
6609 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6610 alc_write_coef_idx(codec, 0x10, 0x8420);
6611 else
6612 alc_write_coef_idx(codec, 0x10, 0x0a20);
6613 }
6614
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6615 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6616 const struct hda_fixup *fix, int action)
6617 {
6618 if (!is_jack_detectable(codec, 0x21))
6619 return;
6620
6621 switch (action) {
6622 case HDA_FIXUP_ACT_PRE_PROBE:
6623 snd_hda_jack_detect_enable_callback(codec, 0x21,
6624 alc294_gu502_toggle_output);
6625 break;
6626 case HDA_FIXUP_ACT_INIT:
6627 alc294_gu502_toggle_output(codec, NULL);
6628 break;
6629 }
6630 }
6631
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6632 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6633 const struct hda_fixup *fix, int action)
6634 {
6635 if (action != HDA_FIXUP_ACT_INIT)
6636 return;
6637
6638 msleep(100);
6639 alc_write_coef_idx(codec, 0x65, 0x0);
6640 }
6641
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6642 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6643 const struct hda_fixup *fix, int action)
6644 {
6645 switch (action) {
6646 case HDA_FIXUP_ACT_INIT:
6647 alc_combo_jack_hp_jd_restart(codec);
6648 break;
6649 }
6650 }
6651
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6652 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6653 const struct hda_fixup *fix, int action)
6654 {
6655 struct alc_spec *spec = codec->spec;
6656
6657 switch (action) {
6658 case HDA_FIXUP_ACT_PRE_PROBE:
6659 /* Mic RING SLEEVE swap for combo jack */
6660 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6661 spec->no_internal_mic_pin = true;
6662 break;
6663 case HDA_FIXUP_ACT_INIT:
6664 alc_combo_jack_hp_jd_restart(codec);
6665 break;
6666 }
6667 }
6668
6669 /* GPIO1 = amplifier on/off
6670 * GPIO3 = mic mute LED
6671 */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6672 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6673 const struct hda_fixup *fix, int action)
6674 {
6675 static const hda_nid_t conn[] = { 0x02 };
6676
6677 struct alc_spec *spec = codec->spec;
6678 static const struct hda_pintbl pincfgs[] = {
6679 { 0x14, 0x90170110 }, /* front/high speakers */
6680 { 0x17, 0x90170130 }, /* back/bass speakers */
6681 { }
6682 };
6683
6684 //enable micmute led
6685 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6686
6687 switch (action) {
6688 case HDA_FIXUP_ACT_PRE_PROBE:
6689 spec->micmute_led_polarity = 1;
6690 /* needed for amp of back speakers */
6691 spec->gpio_mask |= 0x01;
6692 spec->gpio_dir |= 0x01;
6693 snd_hda_apply_pincfgs(codec, pincfgs);
6694 /* share DAC to have unified volume control */
6695 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6696 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6697 break;
6698 case HDA_FIXUP_ACT_INIT:
6699 /* need to toggle GPIO to enable the amp of back speakers */
6700 alc_update_gpio_data(codec, 0x01, true);
6701 msleep(100);
6702 alc_update_gpio_data(codec, 0x01, false);
6703 break;
6704 }
6705 }
6706
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6707 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6708 const struct hda_fixup *fix, int action)
6709 {
6710 static const hda_nid_t conn[] = { 0x02 };
6711 static const struct hda_pintbl pincfgs[] = {
6712 { 0x14, 0x90170110 }, /* rear speaker */
6713 { }
6714 };
6715
6716 switch (action) {
6717 case HDA_FIXUP_ACT_PRE_PROBE:
6718 snd_hda_apply_pincfgs(codec, pincfgs);
6719 /* force front speaker to DAC1 */
6720 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6721 break;
6722 }
6723 }
6724
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6725 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6726 const struct hda_fixup *fix,
6727 int action)
6728 {
6729 static const struct coef_fw coefs[] = {
6730 WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6731 WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6732 WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6733 WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6734 WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6735 WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6736 WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6737 WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6738 WRITE_COEF(0x6e, 0x1005), { }
6739 };
6740
6741 static const struct hda_pintbl pincfgs[] = {
6742 { 0x12, 0xb7a60130 }, /* Internal microphone*/
6743 { 0x14, 0x90170150 }, /* B&O soundbar speakers */
6744 { 0x17, 0x90170153 }, /* Side speakers */
6745 { 0x19, 0x03a11040 }, /* Headset microphone */
6746 { }
6747 };
6748
6749 switch (action) {
6750 case HDA_FIXUP_ACT_PRE_PROBE:
6751 snd_hda_apply_pincfgs(codec, pincfgs);
6752
6753 /* Fixes volume control problem for side speakers */
6754 alc295_fixup_disable_dac3(codec, fix, action);
6755
6756 /* Fixes no sound from headset speaker */
6757 snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6758
6759 /* Auto-enable headset mic when plugged */
6760 snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6761
6762 /* Headset mic volume enhancement */
6763 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6764 break;
6765 case HDA_FIXUP_ACT_INIT:
6766 alc_process_coef_fw(codec, coefs);
6767 break;
6768 case HDA_FIXUP_ACT_BUILD:
6769 rename_ctl(codec, "Bass Speaker Playback Volume",
6770 "B&O-Tuned Playback Volume");
6771 rename_ctl(codec, "Front Playback Switch",
6772 "B&O Soundbar Playback Switch");
6773 rename_ctl(codec, "Bass Speaker Playback Switch",
6774 "Side Speaker Playback Switch");
6775 break;
6776 }
6777 }
6778
6779 /* for hda_fixup_thinkpad_acpi() */
6780 #include "thinkpad_helper.c"
6781
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6782 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6783 const struct hda_fixup *fix, int action)
6784 {
6785 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6786 hda_fixup_thinkpad_acpi(codec, fix, action);
6787 }
6788
6789 /* 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)6790 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6791 const struct hda_fixup *fix,
6792 int action)
6793 {
6794 struct alc_spec *spec = codec->spec;
6795
6796 switch (action) {
6797 case HDA_FIXUP_ACT_PRE_PROBE:
6798 spec->gen.suppress_auto_mute = 1;
6799 break;
6800 }
6801 }
6802
comp_bind(struct device * dev)6803 static int comp_bind(struct device *dev)
6804 {
6805 struct hda_codec *cdc = dev_to_hda_codec(dev);
6806 struct alc_spec *spec = cdc->spec;
6807
6808 return component_bind_all(dev, spec->comps);
6809 }
6810
comp_unbind(struct device * dev)6811 static void comp_unbind(struct device *dev)
6812 {
6813 struct hda_codec *cdc = dev_to_hda_codec(dev);
6814 struct alc_spec *spec = cdc->spec;
6815
6816 component_unbind_all(dev, spec->comps);
6817 }
6818
6819 static const struct component_master_ops comp_master_ops = {
6820 .bind = comp_bind,
6821 .unbind = comp_unbind,
6822 };
6823
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)6824 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6825 struct snd_pcm_substream *sub, int action)
6826 {
6827 struct alc_spec *spec = cdc->spec;
6828 int i;
6829
6830 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6831 if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
6832 spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
6833 }
6834 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6835 if (spec->comps[i].dev && spec->comps[i].playback_hook)
6836 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6837 }
6838 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6839 if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
6840 spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
6841 }
6842 }
6843
6844 struct scodec_dev_name {
6845 const char *bus;
6846 const char *hid;
6847 int index;
6848 };
6849
6850 /* match the device name in a slightly relaxed manner */
comp_match_cs35l41_dev_name(struct device * dev,void * data)6851 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6852 {
6853 struct scodec_dev_name *p = data;
6854 const char *d = dev_name(dev);
6855 int n = strlen(p->bus);
6856 char tmp[32];
6857
6858 /* check the bus name */
6859 if (strncmp(d, p->bus, n))
6860 return 0;
6861 /* skip the bus number */
6862 if (isdigit(d[n]))
6863 n++;
6864 /* the rest must be exact matching */
6865 snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6866 return !strcmp(d + n, tmp);
6867 }
6868
comp_match_tas2781_dev_name(struct device * dev,void * data)6869 static int comp_match_tas2781_dev_name(struct device *dev,
6870 void *data)
6871 {
6872 struct scodec_dev_name *p = data;
6873 const char *d = dev_name(dev);
6874 int n = strlen(p->bus);
6875 char tmp[32];
6876
6877 /* check the bus name */
6878 if (strncmp(d, p->bus, n))
6879 return 0;
6880 /* skip the bus number */
6881 if (isdigit(d[n]))
6882 n++;
6883 /* the rest must be exact matching */
6884 snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
6885
6886 return !strcmp(d + n, tmp);
6887 }
6888
cs35l41_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,int count)6889 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6890 const char *hid, int count)
6891 {
6892 struct device *dev = hda_codec_dev(cdc);
6893 struct alc_spec *spec = cdc->spec;
6894 struct scodec_dev_name *rec;
6895 int ret, i;
6896
6897 switch (action) {
6898 case HDA_FIXUP_ACT_PRE_PROBE:
6899 for (i = 0; i < count; i++) {
6900 rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6901 if (!rec)
6902 return;
6903 rec->bus = bus;
6904 rec->hid = hid;
6905 rec->index = i;
6906 spec->comps[i].codec = cdc;
6907 component_match_add(dev, &spec->match,
6908 comp_match_cs35l41_dev_name, rec);
6909 }
6910 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6911 if (ret)
6912 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6913 else
6914 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6915 break;
6916 case HDA_FIXUP_ACT_FREE:
6917 component_master_del(dev, &comp_master_ops);
6918 break;
6919 }
6920 }
6921
tas2781_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid)6922 static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
6923 const char *bus, const char *hid)
6924 {
6925 struct device *dev = hda_codec_dev(cdc);
6926 struct alc_spec *spec = cdc->spec;
6927 struct scodec_dev_name *rec;
6928 int ret;
6929
6930 switch (action) {
6931 case HDA_FIXUP_ACT_PRE_PROBE:
6932 rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6933 if (!rec)
6934 return;
6935 rec->bus = bus;
6936 rec->hid = hid;
6937 rec->index = 0;
6938 spec->comps[0].codec = cdc;
6939 component_match_add(dev, &spec->match,
6940 comp_match_tas2781_dev_name, rec);
6941 ret = component_master_add_with_match(dev, &comp_master_ops,
6942 spec->match);
6943 if (ret)
6944 codec_err(cdc,
6945 "Fail to register component aggregator %d\n",
6946 ret);
6947 else
6948 spec->gen.pcm_playback_hook =
6949 comp_generic_playback_hook;
6950 break;
6951 case HDA_FIXUP_ACT_FREE:
6952 component_master_del(dev, &comp_master_ops);
6953 break;
6954 }
6955 }
6956
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6957 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6958 {
6959 cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6960 }
6961
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)6962 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6963 {
6964 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
6965 }
6966
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)6967 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6968 {
6969 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
6970 }
6971
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6972 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6973 int action)
6974 {
6975 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
6976 }
6977
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6978 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6979 int action)
6980 {
6981 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6982 }
6983
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6984 static void tas2781_fixup_i2c(struct hda_codec *cdc,
6985 const struct hda_fixup *fix, int action)
6986 {
6987 tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
6988 }
6989
6990 /* for alc295_fixup_hp_top_speakers */
6991 #include "hp_x360_helper.c"
6992
6993 /* for alc285_fixup_ideapad_s740_coef() */
6994 #include "ideapad_s740_helper.c"
6995
6996 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6997 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6998 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6999 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7000 {}
7001 };
7002
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7003 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7004 const struct hda_fixup *fix,
7005 int action)
7006 {
7007 /*
7008 * A certain other OS sets these coeffs to different values. On at least
7009 * one TongFang barebone these settings might survive even a cold
7010 * reboot. So to restore a clean slate the values are explicitly reset
7011 * to default here. Without this, the external microphone is always in a
7012 * plugged-in state, while the internal microphone is always in an
7013 * unplugged state, breaking the ability to use the internal microphone.
7014 */
7015 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7016 }
7017
7018 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7019 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7020 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7021 WRITE_COEF(0x49, 0x0149),
7022 {}
7023 };
7024
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7025 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7026 const struct hda_fixup *fix,
7027 int action)
7028 {
7029 /*
7030 * The audio jack input and output is not detected on the ASRock NUC Box
7031 * 1100 series when cold booting without this fix. Warm rebooting from a
7032 * certain other OS makes the audio functional, as COEF settings are
7033 * preserved in this case. This fix sets these altered COEF values as
7034 * the default.
7035 */
7036 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7037 }
7038
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7039 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7040 const struct hda_fixup *fix,
7041 int action)
7042 {
7043 /*
7044 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7045 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7046 * needs an additional quirk for sound working after suspend and resume.
7047 */
7048 if (codec->core.vendor_id == 0x10ec0256) {
7049 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7050 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7051 } else {
7052 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7053 }
7054 }
7055
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7056 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7057 const struct hda_fixup *fix,
7058 int action)
7059 {
7060 struct alc_spec *spec = codec->spec;
7061 struct hda_input_mux *imux = &spec->gen.input_mux;
7062 int i;
7063
7064 alc269_fixup_limit_int_mic_boost(codec, fix, action);
7065
7066 switch (action) {
7067 case HDA_FIXUP_ACT_PRE_PROBE:
7068 /**
7069 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7070 * to Hi-Z to avoid pop noises at startup and when plugging and
7071 * unplugging headphones.
7072 */
7073 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7074 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7075 break;
7076 case HDA_FIXUP_ACT_PROBE:
7077 /**
7078 * Make the internal mic (0x12) the default input source to
7079 * prevent pop noises on cold boot.
7080 */
7081 for (i = 0; i < imux->num_items; i++) {
7082 if (spec->gen.imux_pins[i] == 0x12) {
7083 spec->gen.cur_mux[0] = i;
7084 break;
7085 }
7086 }
7087 break;
7088 }
7089 }
7090
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7091 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7092 const struct hda_fixup *fix, int action)
7093 {
7094 /*
7095 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7096 * unconnected.
7097 */
7098 static const struct hda_pintbl pincfgs[] = {
7099 { 0x17, 0x90170121 },
7100 { }
7101 };
7102 /*
7103 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7104 * DAC 0x02 and 0x03 would be fine.
7105 */
7106 static const hda_nid_t conn[] = { 0x02, 0x03 };
7107 /*
7108 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7109 * Headphones (0x21) are connected to DAC 0x03.
7110 */
7111 static const hda_nid_t preferred_pairs[] = {
7112 0x14, 0x02,
7113 0x17, 0x02,
7114 0x21, 0x03,
7115 0
7116 };
7117 struct alc_spec *spec = codec->spec;
7118
7119 switch (action) {
7120 case HDA_FIXUP_ACT_PRE_PROBE:
7121 snd_hda_apply_pincfgs(codec, pincfgs);
7122 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7123 spec->gen.preferred_dacs = preferred_pairs;
7124 break;
7125 }
7126 }
7127
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7128 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7129 const struct hda_fixup *fix, int action)
7130 {
7131 static const struct hda_pintbl pincfgs[] = {
7132 { 0x14, 0x90170151 },
7133 { 0x17, 0x90170150 },
7134 { }
7135 };
7136 static const hda_nid_t conn[] = { 0x02, 0x03 };
7137 static const hda_nid_t preferred_pairs[] = {
7138 0x14, 0x02,
7139 0x17, 0x03,
7140 0x21, 0x02,
7141 0
7142 };
7143 struct alc_spec *spec = codec->spec;
7144
7145 alc_fixup_no_shutup(codec, fix, action);
7146
7147 switch (action) {
7148 case HDA_FIXUP_ACT_PRE_PROBE:
7149 snd_hda_apply_pincfgs(codec, pincfgs);
7150 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7151 spec->gen.preferred_dacs = preferred_pairs;
7152 break;
7153 }
7154 }
7155
7156 /* 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)7157 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7158 const struct hda_fixup *fix, int action)
7159 {
7160 struct alc_spec *spec = codec->spec;
7161 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7162 static const hda_nid_t preferred_pairs[] = {
7163 0x17, 0x02, 0x21, 0x03, 0
7164 };
7165
7166 if (action != HDA_FIXUP_ACT_PRE_PROBE)
7167 return;
7168
7169 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7170 spec->gen.preferred_dacs = preferred_pairs;
7171 spec->gen.auto_mute_via_amp = 1;
7172 if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7173 snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7174 0x0); /* Make sure 0x14 was disable */
7175 }
7176 }
7177 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7178 static void alc_fixup_headset_mic(struct hda_codec *codec,
7179 const struct hda_fixup *fix, int action)
7180 {
7181 struct alc_spec *spec = codec->spec;
7182 static const struct hda_pintbl pincfgs[] = {
7183 { 0x19, 0x03a1103c },
7184 { }
7185 };
7186
7187 switch (action) {
7188 case HDA_FIXUP_ACT_PRE_PROBE:
7189 snd_hda_apply_pincfgs(codec, pincfgs);
7190 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7191 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7192 break;
7193 }
7194 }
7195
7196
7197 enum {
7198 ALC269_FIXUP_GPIO2,
7199 ALC269_FIXUP_SONY_VAIO,
7200 ALC275_FIXUP_SONY_VAIO_GPIO2,
7201 ALC269_FIXUP_DELL_M101Z,
7202 ALC269_FIXUP_SKU_IGNORE,
7203 ALC269_FIXUP_ASUS_G73JW,
7204 ALC269_FIXUP_ASUS_N7601ZM_PINS,
7205 ALC269_FIXUP_ASUS_N7601ZM,
7206 ALC269_FIXUP_LENOVO_EAPD,
7207 ALC275_FIXUP_SONY_HWEQ,
7208 ALC275_FIXUP_SONY_DISABLE_AAMIX,
7209 ALC271_FIXUP_DMIC,
7210 ALC269_FIXUP_PCM_44K,
7211 ALC269_FIXUP_STEREO_DMIC,
7212 ALC269_FIXUP_HEADSET_MIC,
7213 ALC269_FIXUP_QUANTA_MUTE,
7214 ALC269_FIXUP_LIFEBOOK,
7215 ALC269_FIXUP_LIFEBOOK_EXTMIC,
7216 ALC269_FIXUP_LIFEBOOK_HP_PIN,
7217 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7218 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7219 ALC269_FIXUP_AMIC,
7220 ALC269_FIXUP_DMIC,
7221 ALC269VB_FIXUP_AMIC,
7222 ALC269VB_FIXUP_DMIC,
7223 ALC269_FIXUP_HP_MUTE_LED,
7224 ALC269_FIXUP_HP_MUTE_LED_MIC1,
7225 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7226 ALC269_FIXUP_HP_MUTE_LED_MIC3,
7227 ALC269_FIXUP_HP_GPIO_LED,
7228 ALC269_FIXUP_HP_GPIO_MIC1_LED,
7229 ALC269_FIXUP_HP_LINE1_MIC1_LED,
7230 ALC269_FIXUP_INV_DMIC,
7231 ALC269_FIXUP_LENOVO_DOCK,
7232 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7233 ALC269_FIXUP_NO_SHUTUP,
7234 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7235 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7236 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7237 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7238 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7239 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7240 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7241 ALC269_FIXUP_HEADSET_MODE,
7242 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7243 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7244 ALC269_FIXUP_ASUS_X101_FUNC,
7245 ALC269_FIXUP_ASUS_X101_VERB,
7246 ALC269_FIXUP_ASUS_X101,
7247 ALC271_FIXUP_AMIC_MIC2,
7248 ALC271_FIXUP_HP_GATE_MIC_JACK,
7249 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7250 ALC269_FIXUP_ACER_AC700,
7251 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7252 ALC269VB_FIXUP_ASUS_ZENBOOK,
7253 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7254 ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7255 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7256 ALC269VB_FIXUP_ORDISSIMO_EVE2,
7257 ALC283_FIXUP_CHROME_BOOK,
7258 ALC283_FIXUP_SENSE_COMBO_JACK,
7259 ALC282_FIXUP_ASUS_TX300,
7260 ALC283_FIXUP_INT_MIC,
7261 ALC290_FIXUP_MONO_SPEAKERS,
7262 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7263 ALC290_FIXUP_SUBWOOFER,
7264 ALC290_FIXUP_SUBWOOFER_HSJACK,
7265 ALC269_FIXUP_THINKPAD_ACPI,
7266 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7267 ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7268 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7269 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7270 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7271 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7272 ALC255_FIXUP_HEADSET_MODE,
7273 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7274 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7275 ALC292_FIXUP_TPT440_DOCK,
7276 ALC292_FIXUP_TPT440,
7277 ALC283_FIXUP_HEADSET_MIC,
7278 ALC255_FIXUP_MIC_MUTE_LED,
7279 ALC282_FIXUP_ASPIRE_V5_PINS,
7280 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7281 ALC280_FIXUP_HP_GPIO4,
7282 ALC286_FIXUP_HP_GPIO_LED,
7283 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7284 ALC280_FIXUP_HP_DOCK_PINS,
7285 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7286 ALC280_FIXUP_HP_9480M,
7287 ALC245_FIXUP_HP_X360_AMP,
7288 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7289 ALC285_FIXUP_HP_ENVY_X360,
7290 ALC288_FIXUP_DELL_HEADSET_MODE,
7291 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7292 ALC288_FIXUP_DELL_XPS_13,
7293 ALC288_FIXUP_DISABLE_AAMIX,
7294 ALC292_FIXUP_DELL_E7X_AAMIX,
7295 ALC292_FIXUP_DELL_E7X,
7296 ALC292_FIXUP_DISABLE_AAMIX,
7297 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7298 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7299 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7300 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7301 ALC275_FIXUP_DELL_XPS,
7302 ALC293_FIXUP_LENOVO_SPK_NOISE,
7303 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7304 ALC255_FIXUP_DELL_SPK_NOISE,
7305 ALC225_FIXUP_DISABLE_MIC_VREF,
7306 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7307 ALC295_FIXUP_DISABLE_DAC3,
7308 ALC285_FIXUP_SPEAKER2_TO_DAC1,
7309 ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7310 ALC285_FIXUP_ASUS_HEADSET_MIC,
7311 ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7312 ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7313 ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7314 ALC280_FIXUP_HP_HEADSET_MIC,
7315 ALC221_FIXUP_HP_FRONT_MIC,
7316 ALC292_FIXUP_TPT460,
7317 ALC298_FIXUP_SPK_VOLUME,
7318 ALC298_FIXUP_LENOVO_SPK_VOLUME,
7319 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7320 ALC269_FIXUP_ATIV_BOOK_8,
7321 ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7322 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7323 ALC256_FIXUP_ASUS_HEADSET_MODE,
7324 ALC256_FIXUP_ASUS_MIC,
7325 ALC256_FIXUP_ASUS_AIO_GPIO2,
7326 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7327 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7328 ALC233_FIXUP_LENOVO_MULTI_CODECS,
7329 ALC233_FIXUP_ACER_HEADSET_MIC,
7330 ALC294_FIXUP_LENOVO_MIC_LOCATION,
7331 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7332 ALC225_FIXUP_S3_POP_NOISE,
7333 ALC700_FIXUP_INTEL_REFERENCE,
7334 ALC274_FIXUP_DELL_BIND_DACS,
7335 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7336 ALC298_FIXUP_TPT470_DOCK_FIX,
7337 ALC298_FIXUP_TPT470_DOCK,
7338 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7339 ALC255_FIXUP_DELL_HEADSET_MIC,
7340 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7341 ALC298_FIXUP_HUAWEI_MBX_STEREO,
7342 ALC295_FIXUP_HP_X360,
7343 ALC221_FIXUP_HP_HEADSET_MIC,
7344 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7345 ALC295_FIXUP_HP_AUTO_MUTE,
7346 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7347 ALC294_FIXUP_ASUS_MIC,
7348 ALC294_FIXUP_ASUS_HEADSET_MIC,
7349 ALC294_FIXUP_ASUS_SPK,
7350 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7351 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7352 ALC255_FIXUP_ACER_HEADSET_MIC,
7353 ALC295_FIXUP_CHROME_BOOK,
7354 ALC225_FIXUP_HEADSET_JACK,
7355 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7356 ALC225_FIXUP_WYSE_AUTO_MUTE,
7357 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7358 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7359 ALC256_FIXUP_ASUS_HEADSET_MIC,
7360 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7361 ALC255_FIXUP_PREDATOR_SUBWOOFER,
7362 ALC299_FIXUP_PREDATOR_SPK,
7363 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7364 ALC289_FIXUP_DELL_SPK1,
7365 ALC289_FIXUP_DELL_SPK2,
7366 ALC289_FIXUP_DUAL_SPK,
7367 ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7368 ALC294_FIXUP_SPK2_TO_DAC1,
7369 ALC294_FIXUP_ASUS_DUAL_SPK,
7370 ALC285_FIXUP_THINKPAD_X1_GEN7,
7371 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7372 ALC294_FIXUP_ASUS_ALLY,
7373 ALC294_FIXUP_ASUS_ALLY_PINS,
7374 ALC294_FIXUP_ASUS_ALLY_VERBS,
7375 ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7376 ALC294_FIXUP_ASUS_HPE,
7377 ALC294_FIXUP_ASUS_COEF_1B,
7378 ALC294_FIXUP_ASUS_GX502_HP,
7379 ALC294_FIXUP_ASUS_GX502_PINS,
7380 ALC294_FIXUP_ASUS_GX502_VERBS,
7381 ALC294_FIXUP_ASUS_GU502_HP,
7382 ALC294_FIXUP_ASUS_GU502_PINS,
7383 ALC294_FIXUP_ASUS_GU502_VERBS,
7384 ALC294_FIXUP_ASUS_G513_PINS,
7385 ALC285_FIXUP_ASUS_G533Z_PINS,
7386 ALC285_FIXUP_HP_GPIO_LED,
7387 ALC285_FIXUP_HP_MUTE_LED,
7388 ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7389 ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7390 ALC236_FIXUP_HP_GPIO_LED,
7391 ALC236_FIXUP_HP_MUTE_LED,
7392 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7393 ALC236_FIXUP_LENOVO_INV_DMIC,
7394 ALC298_FIXUP_SAMSUNG_AMP,
7395 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7396 ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7397 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7398 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7399 ALC269VC_FIXUP_ACER_HEADSET_MIC,
7400 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7401 ALC289_FIXUP_ASUS_GA401,
7402 ALC289_FIXUP_ASUS_GA502,
7403 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7404 ALC285_FIXUP_HP_GPIO_AMP_INIT,
7405 ALC269_FIXUP_CZC_B20,
7406 ALC269_FIXUP_CZC_TMI,
7407 ALC269_FIXUP_CZC_L101,
7408 ALC269_FIXUP_LEMOTE_A1802,
7409 ALC269_FIXUP_LEMOTE_A190X,
7410 ALC256_FIXUP_INTEL_NUC8_RUGGED,
7411 ALC233_FIXUP_INTEL_NUC8_DMIC,
7412 ALC233_FIXUP_INTEL_NUC8_BOOST,
7413 ALC256_FIXUP_INTEL_NUC10,
7414 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7415 ALC274_FIXUP_HP_MIC,
7416 ALC274_FIXUP_HP_HEADSET_MIC,
7417 ALC274_FIXUP_HP_ENVY_GPIO,
7418 ALC256_FIXUP_ASUS_HPE,
7419 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7420 ALC287_FIXUP_HP_GPIO_LED,
7421 ALC256_FIXUP_HP_HEADSET_MIC,
7422 ALC245_FIXUP_HP_GPIO_LED,
7423 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7424 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7425 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7426 ALC256_FIXUP_ACER_HEADSET_MIC,
7427 ALC285_FIXUP_IDEAPAD_S740_COEF,
7428 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7429 ALC295_FIXUP_ASUS_DACS,
7430 ALC295_FIXUP_HP_OMEN,
7431 ALC285_FIXUP_HP_SPECTRE_X360,
7432 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7433 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7434 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7435 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7436 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7437 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7438 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7439 ALC298_FIXUP_LENOVO_C940_DUET7,
7440 ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7441 ALC287_FIXUP_13S_GEN2_SPEAKERS,
7442 ALC256_FIXUP_SET_COEF_DEFAULTS,
7443 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7444 ALC233_FIXUP_NO_AUDIO_JACK,
7445 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7446 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7447 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7448 ALC287_FIXUP_LEGION_16ACHG6,
7449 ALC287_FIXUP_CS35L41_I2C_2,
7450 ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7451 ALC245_FIXUP_CS35L41_SPI_2,
7452 ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7453 ALC245_FIXUP_CS35L41_SPI_4,
7454 ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7455 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7456 ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7457 ALC287_FIXUP_LEGION_16ITHG6,
7458 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7459 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7460 ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7461 ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7462 ALC236_FIXUP_DELL_DUAL_CODECS,
7463 ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7464 ALC287_FIXUP_TAS2781_I2C,
7465 ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7466 ALC245_FIXUP_HP_X360_MUTE_LEDS,
7467 ALC287_FIXUP_THINKPAD_I2S_SPK,
7468 ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7469 ALC2XX_FIXUP_HEADSET_MIC,
7470 ALC289_FIXUP_DELL_CS35L41_SPI_2,
7471 ALC294_FIXUP_CS35L41_I2C_2,
7472 };
7473
7474 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7475 * both have the very same PCI SSID, and we need to apply different fixups
7476 * depending on the codec ID
7477 */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7478 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7479 const struct hda_fixup *fix,
7480 int action)
7481 {
7482 int id;
7483
7484 if (codec->core.vendor_id == 0x10ec0298)
7485 id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7486 else
7487 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7488 __snd_hda_apply_fixup(codec, id, action, 0);
7489 }
7490
7491 /* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7492 * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7493 * so we need to apply a different fixup in this case. The only DuetITL codec
7494 * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7495 * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7496 * have matched correctly by their codecs.
7497 */
alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec * codec,const struct hda_fixup * fix,int action)7498 static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7499 const struct hda_fixup *fix,
7500 int action)
7501 {
7502 int id;
7503
7504 if (codec->core.subsystem_id == 0x17aa3802)
7505 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7506 else
7507 id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7508 __snd_hda_apply_fixup(codec, id, action, 0);
7509 }
7510
7511 static const struct hda_fixup alc269_fixups[] = {
7512 [ALC269_FIXUP_GPIO2] = {
7513 .type = HDA_FIXUP_FUNC,
7514 .v.func = alc_fixup_gpio2,
7515 },
7516 [ALC269_FIXUP_SONY_VAIO] = {
7517 .type = HDA_FIXUP_PINCTLS,
7518 .v.pins = (const struct hda_pintbl[]) {
7519 {0x19, PIN_VREFGRD},
7520 {}
7521 }
7522 },
7523 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7524 .type = HDA_FIXUP_FUNC,
7525 .v.func = alc275_fixup_gpio4_off,
7526 .chained = true,
7527 .chain_id = ALC269_FIXUP_SONY_VAIO
7528 },
7529 [ALC269_FIXUP_DELL_M101Z] = {
7530 .type = HDA_FIXUP_VERBS,
7531 .v.verbs = (const struct hda_verb[]) {
7532 /* Enables internal speaker */
7533 {0x20, AC_VERB_SET_COEF_INDEX, 13},
7534 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7535 {}
7536 }
7537 },
7538 [ALC269_FIXUP_SKU_IGNORE] = {
7539 .type = HDA_FIXUP_FUNC,
7540 .v.func = alc_fixup_sku_ignore,
7541 },
7542 [ALC269_FIXUP_ASUS_G73JW] = {
7543 .type = HDA_FIXUP_PINS,
7544 .v.pins = (const struct hda_pintbl[]) {
7545 { 0x17, 0x99130111 }, /* subwoofer */
7546 { }
7547 }
7548 },
7549 [ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7550 .type = HDA_FIXUP_PINS,
7551 .v.pins = (const struct hda_pintbl[]) {
7552 { 0x19, 0x03A11050 },
7553 { 0x1a, 0x03A11C30 },
7554 { 0x21, 0x03211420 },
7555 { }
7556 }
7557 },
7558 [ALC269_FIXUP_ASUS_N7601ZM] = {
7559 .type = HDA_FIXUP_VERBS,
7560 .v.verbs = (const struct hda_verb[]) {
7561 {0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7562 {0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7563 {0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7564 {0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7565 {0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7566 {0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7567 { }
7568 },
7569 .chained = true,
7570 .chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7571 },
7572 [ALC269_FIXUP_LENOVO_EAPD] = {
7573 .type = HDA_FIXUP_VERBS,
7574 .v.verbs = (const struct hda_verb[]) {
7575 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7576 {}
7577 }
7578 },
7579 [ALC275_FIXUP_SONY_HWEQ] = {
7580 .type = HDA_FIXUP_FUNC,
7581 .v.func = alc269_fixup_hweq,
7582 .chained = true,
7583 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7584 },
7585 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7586 .type = HDA_FIXUP_FUNC,
7587 .v.func = alc_fixup_disable_aamix,
7588 .chained = true,
7589 .chain_id = ALC269_FIXUP_SONY_VAIO
7590 },
7591 [ALC271_FIXUP_DMIC] = {
7592 .type = HDA_FIXUP_FUNC,
7593 .v.func = alc271_fixup_dmic,
7594 },
7595 [ALC269_FIXUP_PCM_44K] = {
7596 .type = HDA_FIXUP_FUNC,
7597 .v.func = alc269_fixup_pcm_44k,
7598 .chained = true,
7599 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7600 },
7601 [ALC269_FIXUP_STEREO_DMIC] = {
7602 .type = HDA_FIXUP_FUNC,
7603 .v.func = alc269_fixup_stereo_dmic,
7604 },
7605 [ALC269_FIXUP_HEADSET_MIC] = {
7606 .type = HDA_FIXUP_FUNC,
7607 .v.func = alc269_fixup_headset_mic,
7608 },
7609 [ALC269_FIXUP_QUANTA_MUTE] = {
7610 .type = HDA_FIXUP_FUNC,
7611 .v.func = alc269_fixup_quanta_mute,
7612 },
7613 [ALC269_FIXUP_LIFEBOOK] = {
7614 .type = HDA_FIXUP_PINS,
7615 .v.pins = (const struct hda_pintbl[]) {
7616 { 0x1a, 0x2101103f }, /* dock line-out */
7617 { 0x1b, 0x23a11040 }, /* dock mic-in */
7618 { }
7619 },
7620 .chained = true,
7621 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7622 },
7623 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7624 .type = HDA_FIXUP_PINS,
7625 .v.pins = (const struct hda_pintbl[]) {
7626 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7627 { }
7628 },
7629 },
7630 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7631 .type = HDA_FIXUP_PINS,
7632 .v.pins = (const struct hda_pintbl[]) {
7633 { 0x21, 0x0221102f }, /* HP out */
7634 { }
7635 },
7636 },
7637 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7638 .type = HDA_FIXUP_FUNC,
7639 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7640 },
7641 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7642 .type = HDA_FIXUP_FUNC,
7643 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7644 },
7645 [ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7646 .type = HDA_FIXUP_PINS,
7647 .v.pins = (const struct hda_pintbl[]) {
7648 { 0x18, 0x03a19020 }, /* headset mic */
7649 { 0x1b, 0x90170150 }, /* speaker */
7650 { }
7651 },
7652 },
7653 [ALC269_FIXUP_AMIC] = {
7654 .type = HDA_FIXUP_PINS,
7655 .v.pins = (const struct hda_pintbl[]) {
7656 { 0x14, 0x99130110 }, /* speaker */
7657 { 0x15, 0x0121401f }, /* HP out */
7658 { 0x18, 0x01a19c20 }, /* mic */
7659 { 0x19, 0x99a3092f }, /* int-mic */
7660 { }
7661 },
7662 },
7663 [ALC269_FIXUP_DMIC] = {
7664 .type = HDA_FIXUP_PINS,
7665 .v.pins = (const struct hda_pintbl[]) {
7666 { 0x12, 0x99a3092f }, /* int-mic */
7667 { 0x14, 0x99130110 }, /* speaker */
7668 { 0x15, 0x0121401f }, /* HP out */
7669 { 0x18, 0x01a19c20 }, /* mic */
7670 { }
7671 },
7672 },
7673 [ALC269VB_FIXUP_AMIC] = {
7674 .type = HDA_FIXUP_PINS,
7675 .v.pins = (const struct hda_pintbl[]) {
7676 { 0x14, 0x99130110 }, /* speaker */
7677 { 0x18, 0x01a19c20 }, /* mic */
7678 { 0x19, 0x99a3092f }, /* int-mic */
7679 { 0x21, 0x0121401f }, /* HP out */
7680 { }
7681 },
7682 },
7683 [ALC269VB_FIXUP_DMIC] = {
7684 .type = HDA_FIXUP_PINS,
7685 .v.pins = (const struct hda_pintbl[]) {
7686 { 0x12, 0x99a3092f }, /* int-mic */
7687 { 0x14, 0x99130110 }, /* speaker */
7688 { 0x18, 0x01a19c20 }, /* mic */
7689 { 0x21, 0x0121401f }, /* HP out */
7690 { }
7691 },
7692 },
7693 [ALC269_FIXUP_HP_MUTE_LED] = {
7694 .type = HDA_FIXUP_FUNC,
7695 .v.func = alc269_fixup_hp_mute_led,
7696 },
7697 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7698 .type = HDA_FIXUP_FUNC,
7699 .v.func = alc269_fixup_hp_mute_led_mic1,
7700 },
7701 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7702 .type = HDA_FIXUP_FUNC,
7703 .v.func = alc269_fixup_hp_mute_led_mic2,
7704 },
7705 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7706 .type = HDA_FIXUP_FUNC,
7707 .v.func = alc269_fixup_hp_mute_led_mic3,
7708 .chained = true,
7709 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7710 },
7711 [ALC269_FIXUP_HP_GPIO_LED] = {
7712 .type = HDA_FIXUP_FUNC,
7713 .v.func = alc269_fixup_hp_gpio_led,
7714 },
7715 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7716 .type = HDA_FIXUP_FUNC,
7717 .v.func = alc269_fixup_hp_gpio_mic1_led,
7718 },
7719 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7720 .type = HDA_FIXUP_FUNC,
7721 .v.func = alc269_fixup_hp_line1_mic1_led,
7722 },
7723 [ALC269_FIXUP_INV_DMIC] = {
7724 .type = HDA_FIXUP_FUNC,
7725 .v.func = alc_fixup_inv_dmic,
7726 },
7727 [ALC269_FIXUP_NO_SHUTUP] = {
7728 .type = HDA_FIXUP_FUNC,
7729 .v.func = alc_fixup_no_shutup,
7730 },
7731 [ALC269_FIXUP_LENOVO_DOCK] = {
7732 .type = HDA_FIXUP_PINS,
7733 .v.pins = (const struct hda_pintbl[]) {
7734 { 0x19, 0x23a11040 }, /* dock mic */
7735 { 0x1b, 0x2121103f }, /* dock headphone */
7736 { }
7737 },
7738 .chained = true,
7739 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7740 },
7741 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7742 .type = HDA_FIXUP_FUNC,
7743 .v.func = alc269_fixup_limit_int_mic_boost,
7744 .chained = true,
7745 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7746 },
7747 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7748 .type = HDA_FIXUP_FUNC,
7749 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7750 .chained = true,
7751 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7752 },
7753 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7754 .type = HDA_FIXUP_PINS,
7755 .v.pins = (const struct hda_pintbl[]) {
7756 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7757 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7758 { }
7759 },
7760 .chained = true,
7761 .chain_id = ALC269_FIXUP_HEADSET_MODE
7762 },
7763 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7764 .type = HDA_FIXUP_PINS,
7765 .v.pins = (const struct hda_pintbl[]) {
7766 { 0x16, 0x21014020 }, /* dock line out */
7767 { 0x19, 0x21a19030 }, /* dock mic */
7768 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7769 { }
7770 },
7771 .chained = true,
7772 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7773 },
7774 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7775 .type = HDA_FIXUP_PINS,
7776 .v.pins = (const struct hda_pintbl[]) {
7777 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7778 { }
7779 },
7780 .chained = true,
7781 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7782 },
7783 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7784 .type = HDA_FIXUP_PINS,
7785 .v.pins = (const struct hda_pintbl[]) {
7786 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7787 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7788 { }
7789 },
7790 .chained = true,
7791 .chain_id = ALC269_FIXUP_HEADSET_MODE
7792 },
7793 [ALC269_FIXUP_HEADSET_MODE] = {
7794 .type = HDA_FIXUP_FUNC,
7795 .v.func = alc_fixup_headset_mode,
7796 .chained = true,
7797 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7798 },
7799 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7800 .type = HDA_FIXUP_FUNC,
7801 .v.func = alc_fixup_headset_mode_no_hp_mic,
7802 },
7803 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7804 .type = HDA_FIXUP_PINS,
7805 .v.pins = (const struct hda_pintbl[]) {
7806 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7807 { }
7808 },
7809 .chained = true,
7810 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7811 },
7812 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7813 .type = HDA_FIXUP_PINS,
7814 .v.pins = (const struct hda_pintbl[]) {
7815 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7816 { }
7817 },
7818 .chained = true,
7819 .chain_id = ALC269_FIXUP_HEADSET_MIC
7820 },
7821 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7822 .type = HDA_FIXUP_PINS,
7823 .v.pins = (const struct hda_pintbl[]) {
7824 {0x12, 0x90a60130},
7825 {0x13, 0x40000000},
7826 {0x14, 0x90170110},
7827 {0x18, 0x411111f0},
7828 {0x19, 0x04a11040},
7829 {0x1a, 0x411111f0},
7830 {0x1b, 0x90170112},
7831 {0x1d, 0x40759a05},
7832 {0x1e, 0x411111f0},
7833 {0x21, 0x04211020},
7834 { }
7835 },
7836 .chained = true,
7837 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7838 },
7839 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7840 .type = HDA_FIXUP_FUNC,
7841 .v.func = alc298_fixup_huawei_mbx_stereo,
7842 .chained = true,
7843 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7844 },
7845 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7846 .type = HDA_FIXUP_FUNC,
7847 .v.func = alc269_fixup_x101_headset_mic,
7848 },
7849 [ALC269_FIXUP_ASUS_X101_VERB] = {
7850 .type = HDA_FIXUP_VERBS,
7851 .v.verbs = (const struct hda_verb[]) {
7852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7853 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7854 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7855 { }
7856 },
7857 .chained = true,
7858 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7859 },
7860 [ALC269_FIXUP_ASUS_X101] = {
7861 .type = HDA_FIXUP_PINS,
7862 .v.pins = (const struct hda_pintbl[]) {
7863 { 0x18, 0x04a1182c }, /* Headset mic */
7864 { }
7865 },
7866 .chained = true,
7867 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7868 },
7869 [ALC271_FIXUP_AMIC_MIC2] = {
7870 .type = HDA_FIXUP_PINS,
7871 .v.pins = (const struct hda_pintbl[]) {
7872 { 0x14, 0x99130110 }, /* speaker */
7873 { 0x19, 0x01a19c20 }, /* mic */
7874 { 0x1b, 0x99a7012f }, /* int-mic */
7875 { 0x21, 0x0121401f }, /* HP out */
7876 { }
7877 },
7878 },
7879 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7880 .type = HDA_FIXUP_FUNC,
7881 .v.func = alc271_hp_gate_mic_jack,
7882 .chained = true,
7883 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7884 },
7885 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7886 .type = HDA_FIXUP_FUNC,
7887 .v.func = alc269_fixup_limit_int_mic_boost,
7888 .chained = true,
7889 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7890 },
7891 [ALC269_FIXUP_ACER_AC700] = {
7892 .type = HDA_FIXUP_PINS,
7893 .v.pins = (const struct hda_pintbl[]) {
7894 { 0x12, 0x99a3092f }, /* int-mic */
7895 { 0x14, 0x99130110 }, /* speaker */
7896 { 0x18, 0x03a11c20 }, /* mic */
7897 { 0x1e, 0x0346101e }, /* SPDIF1 */
7898 { 0x21, 0x0321101f }, /* HP out */
7899 { }
7900 },
7901 .chained = true,
7902 .chain_id = ALC271_FIXUP_DMIC,
7903 },
7904 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7905 .type = HDA_FIXUP_FUNC,
7906 .v.func = alc269_fixup_limit_int_mic_boost,
7907 .chained = true,
7908 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7909 },
7910 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7911 .type = HDA_FIXUP_FUNC,
7912 .v.func = alc269_fixup_limit_int_mic_boost,
7913 .chained = true,
7914 .chain_id = ALC269VB_FIXUP_DMIC,
7915 },
7916 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7917 .type = HDA_FIXUP_VERBS,
7918 .v.verbs = (const struct hda_verb[]) {
7919 /* class-D output amp +5dB */
7920 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7921 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7922 {}
7923 },
7924 .chained = true,
7925 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7926 },
7927 [ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7928 .type = HDA_FIXUP_PINS,
7929 .v.pins = (const struct hda_pintbl[]) {
7930 { 0x18, 0x01a110f0 }, /* use as headset mic */
7931 { }
7932 },
7933 .chained = true,
7934 .chain_id = ALC269_FIXUP_HEADSET_MIC
7935 },
7936 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7937 .type = HDA_FIXUP_FUNC,
7938 .v.func = alc269_fixup_limit_int_mic_boost,
7939 .chained = true,
7940 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7941 },
7942 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7943 .type = HDA_FIXUP_PINS,
7944 .v.pins = (const struct hda_pintbl[]) {
7945 { 0x12, 0x99a3092f }, /* int-mic */
7946 { 0x18, 0x03a11d20 }, /* mic */
7947 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7948 { }
7949 },
7950 },
7951 [ALC283_FIXUP_CHROME_BOOK] = {
7952 .type = HDA_FIXUP_FUNC,
7953 .v.func = alc283_fixup_chromebook,
7954 },
7955 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7956 .type = HDA_FIXUP_FUNC,
7957 .v.func = alc283_fixup_sense_combo_jack,
7958 .chained = true,
7959 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7960 },
7961 [ALC282_FIXUP_ASUS_TX300] = {
7962 .type = HDA_FIXUP_FUNC,
7963 .v.func = alc282_fixup_asus_tx300,
7964 },
7965 [ALC283_FIXUP_INT_MIC] = {
7966 .type = HDA_FIXUP_VERBS,
7967 .v.verbs = (const struct hda_verb[]) {
7968 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7969 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7970 { }
7971 },
7972 .chained = true,
7973 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7974 },
7975 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7976 .type = HDA_FIXUP_PINS,
7977 .v.pins = (const struct hda_pintbl[]) {
7978 { 0x17, 0x90170112 }, /* subwoofer */
7979 { }
7980 },
7981 .chained = true,
7982 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7983 },
7984 [ALC290_FIXUP_SUBWOOFER] = {
7985 .type = HDA_FIXUP_PINS,
7986 .v.pins = (const struct hda_pintbl[]) {
7987 { 0x17, 0x90170112 }, /* subwoofer */
7988 { }
7989 },
7990 .chained = true,
7991 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7992 },
7993 [ALC290_FIXUP_MONO_SPEAKERS] = {
7994 .type = HDA_FIXUP_FUNC,
7995 .v.func = alc290_fixup_mono_speakers,
7996 },
7997 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7998 .type = HDA_FIXUP_FUNC,
7999 .v.func = alc290_fixup_mono_speakers,
8000 .chained = true,
8001 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8002 },
8003 [ALC269_FIXUP_THINKPAD_ACPI] = {
8004 .type = HDA_FIXUP_FUNC,
8005 .v.func = alc_fixup_thinkpad_acpi,
8006 .chained = true,
8007 .chain_id = ALC269_FIXUP_SKU_IGNORE,
8008 },
8009 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8010 .type = HDA_FIXUP_FUNC,
8011 .v.func = alc_fixup_inv_dmic,
8012 .chained = true,
8013 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8014 },
8015 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8016 .type = HDA_FIXUP_PINS,
8017 .v.pins = (const struct hda_pintbl[]) {
8018 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8019 { }
8020 },
8021 .chained = true,
8022 .chain_id = ALC255_FIXUP_HEADSET_MODE
8023 },
8024 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8025 .type = HDA_FIXUP_PINS,
8026 .v.pins = (const struct hda_pintbl[]) {
8027 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8028 { }
8029 },
8030 .chained = true,
8031 .chain_id = ALC255_FIXUP_HEADSET_MODE
8032 },
8033 [ALC255_FIXUP_DELL1_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 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8038 { }
8039 },
8040 .chained = true,
8041 .chain_id = ALC255_FIXUP_HEADSET_MODE
8042 },
8043 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8044 .type = HDA_FIXUP_PINS,
8045 .v.pins = (const struct hda_pintbl[]) {
8046 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8047 { }
8048 },
8049 .chained = true,
8050 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8051 },
8052 [ALC255_FIXUP_HEADSET_MODE] = {
8053 .type = HDA_FIXUP_FUNC,
8054 .v.func = alc_fixup_headset_mode_alc255,
8055 .chained = true,
8056 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8057 },
8058 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8059 .type = HDA_FIXUP_FUNC,
8060 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8061 },
8062 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8063 .type = HDA_FIXUP_PINS,
8064 .v.pins = (const struct hda_pintbl[]) {
8065 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8066 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8067 { }
8068 },
8069 .chained = true,
8070 .chain_id = ALC269_FIXUP_HEADSET_MODE
8071 },
8072 [ALC292_FIXUP_TPT440_DOCK] = {
8073 .type = HDA_FIXUP_FUNC,
8074 .v.func = alc_fixup_tpt440_dock,
8075 .chained = true,
8076 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8077 },
8078 [ALC292_FIXUP_TPT440] = {
8079 .type = HDA_FIXUP_FUNC,
8080 .v.func = alc_fixup_disable_aamix,
8081 .chained = true,
8082 .chain_id = ALC292_FIXUP_TPT440_DOCK,
8083 },
8084 [ALC283_FIXUP_HEADSET_MIC] = {
8085 .type = HDA_FIXUP_PINS,
8086 .v.pins = (const struct hda_pintbl[]) {
8087 { 0x19, 0x04a110f0 },
8088 { },
8089 },
8090 },
8091 [ALC255_FIXUP_MIC_MUTE_LED] = {
8092 .type = HDA_FIXUP_FUNC,
8093 .v.func = alc_fixup_micmute_led,
8094 },
8095 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
8096 .type = HDA_FIXUP_PINS,
8097 .v.pins = (const struct hda_pintbl[]) {
8098 { 0x12, 0x90a60130 },
8099 { 0x14, 0x90170110 },
8100 { 0x17, 0x40000008 },
8101 { 0x18, 0x411111f0 },
8102 { 0x19, 0x01a1913c },
8103 { 0x1a, 0x411111f0 },
8104 { 0x1b, 0x411111f0 },
8105 { 0x1d, 0x40f89b2d },
8106 { 0x1e, 0x411111f0 },
8107 { 0x21, 0x0321101f },
8108 { },
8109 },
8110 },
8111 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8112 .type = HDA_FIXUP_FUNC,
8113 .v.func = alc269vb_fixup_aspire_e1_coef,
8114 },
8115 [ALC280_FIXUP_HP_GPIO4] = {
8116 .type = HDA_FIXUP_FUNC,
8117 .v.func = alc280_fixup_hp_gpio4,
8118 },
8119 [ALC286_FIXUP_HP_GPIO_LED] = {
8120 .type = HDA_FIXUP_FUNC,
8121 .v.func = alc286_fixup_hp_gpio_led,
8122 },
8123 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8124 .type = HDA_FIXUP_FUNC,
8125 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8126 },
8127 [ALC280_FIXUP_HP_DOCK_PINS] = {
8128 .type = HDA_FIXUP_PINS,
8129 .v.pins = (const struct hda_pintbl[]) {
8130 { 0x1b, 0x21011020 }, /* line-out */
8131 { 0x1a, 0x01a1903c }, /* headset mic */
8132 { 0x18, 0x2181103f }, /* line-in */
8133 { },
8134 },
8135 .chained = true,
8136 .chain_id = ALC280_FIXUP_HP_GPIO4
8137 },
8138 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8139 .type = HDA_FIXUP_PINS,
8140 .v.pins = (const struct hda_pintbl[]) {
8141 { 0x1b, 0x21011020 }, /* line-out */
8142 { 0x18, 0x2181103f }, /* line-in */
8143 { },
8144 },
8145 .chained = true,
8146 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8147 },
8148 [ALC280_FIXUP_HP_9480M] = {
8149 .type = HDA_FIXUP_FUNC,
8150 .v.func = alc280_fixup_hp_9480m,
8151 },
8152 [ALC245_FIXUP_HP_X360_AMP] = {
8153 .type = HDA_FIXUP_FUNC,
8154 .v.func = alc245_fixup_hp_x360_amp,
8155 .chained = true,
8156 .chain_id = ALC245_FIXUP_HP_GPIO_LED
8157 },
8158 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
8159 .type = HDA_FIXUP_FUNC,
8160 .v.func = alc_fixup_headset_mode_dell_alc288,
8161 .chained = true,
8162 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8163 },
8164 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8165 .type = HDA_FIXUP_PINS,
8166 .v.pins = (const struct hda_pintbl[]) {
8167 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8168 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8169 { }
8170 },
8171 .chained = true,
8172 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8173 },
8174 [ALC288_FIXUP_DISABLE_AAMIX] = {
8175 .type = HDA_FIXUP_FUNC,
8176 .v.func = alc_fixup_disable_aamix,
8177 .chained = true,
8178 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8179 },
8180 [ALC288_FIXUP_DELL_XPS_13] = {
8181 .type = HDA_FIXUP_FUNC,
8182 .v.func = alc_fixup_dell_xps13,
8183 .chained = true,
8184 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
8185 },
8186 [ALC292_FIXUP_DISABLE_AAMIX] = {
8187 .type = HDA_FIXUP_FUNC,
8188 .v.func = alc_fixup_disable_aamix,
8189 .chained = true,
8190 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8191 },
8192 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8193 .type = HDA_FIXUP_FUNC,
8194 .v.func = alc_fixup_disable_aamix,
8195 .chained = true,
8196 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8197 },
8198 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8199 .type = HDA_FIXUP_FUNC,
8200 .v.func = alc_fixup_dell_xps13,
8201 .chained = true,
8202 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
8203 },
8204 [ALC292_FIXUP_DELL_E7X] = {
8205 .type = HDA_FIXUP_FUNC,
8206 .v.func = alc_fixup_micmute_led,
8207 /* micmute fixup must be applied at last */
8208 .chained_before = true,
8209 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8210 },
8211 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8212 .type = HDA_FIXUP_PINS,
8213 .v.pins = (const struct hda_pintbl[]) {
8214 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8215 { }
8216 },
8217 .chained_before = true,
8218 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8219 },
8220 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8221 .type = HDA_FIXUP_PINS,
8222 .v.pins = (const struct hda_pintbl[]) {
8223 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8224 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8225 { }
8226 },
8227 .chained = true,
8228 .chain_id = ALC269_FIXUP_HEADSET_MODE
8229 },
8230 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8231 .type = HDA_FIXUP_PINS,
8232 .v.pins = (const struct hda_pintbl[]) {
8233 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8234 { }
8235 },
8236 .chained = true,
8237 .chain_id = ALC269_FIXUP_HEADSET_MODE
8238 },
8239 [ALC275_FIXUP_DELL_XPS] = {
8240 .type = HDA_FIXUP_VERBS,
8241 .v.verbs = (const struct hda_verb[]) {
8242 /* Enables internal speaker */
8243 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8244 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8245 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8246 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8247 {}
8248 }
8249 },
8250 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8251 .type = HDA_FIXUP_FUNC,
8252 .v.func = alc_fixup_disable_aamix,
8253 .chained = true,
8254 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8255 },
8256 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8257 .type = HDA_FIXUP_FUNC,
8258 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8259 },
8260 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8261 .type = HDA_FIXUP_FUNC,
8262 .v.func = alc_fixup_inv_dmic,
8263 .chained = true,
8264 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8265 },
8266 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8267 .type = HDA_FIXUP_FUNC,
8268 .v.func = alc269_fixup_limit_int_mic_boost
8269 },
8270 [ALC255_FIXUP_DELL_SPK_NOISE] = {
8271 .type = HDA_FIXUP_FUNC,
8272 .v.func = alc_fixup_disable_aamix,
8273 .chained = true,
8274 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8275 },
8276 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
8277 .type = HDA_FIXUP_FUNC,
8278 .v.func = alc_fixup_disable_mic_vref,
8279 .chained = true,
8280 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8281 },
8282 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8283 .type = HDA_FIXUP_VERBS,
8284 .v.verbs = (const struct hda_verb[]) {
8285 /* Disable pass-through path for FRONT 14h */
8286 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8287 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8288 {}
8289 },
8290 .chained = true,
8291 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8292 },
8293 [ALC280_FIXUP_HP_HEADSET_MIC] = {
8294 .type = HDA_FIXUP_FUNC,
8295 .v.func = alc_fixup_disable_aamix,
8296 .chained = true,
8297 .chain_id = ALC269_FIXUP_HEADSET_MIC,
8298 },
8299 [ALC221_FIXUP_HP_FRONT_MIC] = {
8300 .type = HDA_FIXUP_PINS,
8301 .v.pins = (const struct hda_pintbl[]) {
8302 { 0x19, 0x02a19020 }, /* Front Mic */
8303 { }
8304 },
8305 },
8306 [ALC292_FIXUP_TPT460] = {
8307 .type = HDA_FIXUP_FUNC,
8308 .v.func = alc_fixup_tpt440_dock,
8309 .chained = true,
8310 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8311 },
8312 [ALC298_FIXUP_SPK_VOLUME] = {
8313 .type = HDA_FIXUP_FUNC,
8314 .v.func = alc298_fixup_speaker_volume,
8315 .chained = true,
8316 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8317 },
8318 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8319 .type = HDA_FIXUP_FUNC,
8320 .v.func = alc298_fixup_speaker_volume,
8321 },
8322 [ALC295_FIXUP_DISABLE_DAC3] = {
8323 .type = HDA_FIXUP_FUNC,
8324 .v.func = alc295_fixup_disable_dac3,
8325 },
8326 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8327 .type = HDA_FIXUP_FUNC,
8328 .v.func = alc285_fixup_speaker2_to_dac1,
8329 .chained = true,
8330 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8331 },
8332 [ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8333 .type = HDA_FIXUP_FUNC,
8334 .v.func = alc285_fixup_speaker2_to_dac1,
8335 .chained = true,
8336 .chain_id = ALC245_FIXUP_CS35L41_SPI_2
8337 },
8338 [ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8339 .type = HDA_FIXUP_PINS,
8340 .v.pins = (const struct hda_pintbl[]) {
8341 { 0x19, 0x03a11050 },
8342 { 0x1b, 0x03a11c30 },
8343 { }
8344 },
8345 .chained = true,
8346 .chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8347 },
8348 [ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8349 .type = HDA_FIXUP_PINS,
8350 .v.pins = (const struct hda_pintbl[]) {
8351 { 0x14, 0x90170120 },
8352 { }
8353 },
8354 .chained = true,
8355 .chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8356 },
8357 [ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8358 .type = HDA_FIXUP_FUNC,
8359 .v.func = alc285_fixup_speaker2_to_dac1,
8360 .chained = true,
8361 .chain_id = ALC287_FIXUP_CS35L41_I2C_2
8362 },
8363 [ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8364 .type = HDA_FIXUP_PINS,
8365 .v.pins = (const struct hda_pintbl[]) {
8366 { 0x19, 0x03a11050 },
8367 { 0x1b, 0x03a11c30 },
8368 { }
8369 },
8370 .chained = true,
8371 .chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8372 },
8373 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8374 .type = HDA_FIXUP_PINS,
8375 .v.pins = (const struct hda_pintbl[]) {
8376 { 0x1b, 0x90170151 },
8377 { }
8378 },
8379 .chained = true,
8380 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8381 },
8382 [ALC269_FIXUP_ATIV_BOOK_8] = {
8383 .type = HDA_FIXUP_FUNC,
8384 .v.func = alc_fixup_auto_mute_via_amp,
8385 .chained = true,
8386 .chain_id = ALC269_FIXUP_NO_SHUTUP
8387 },
8388 [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8389 .type = HDA_FIXUP_PINS,
8390 .v.pins = (const struct hda_pintbl[]) {
8391 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8392 { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8393 { }
8394 },
8395 .chained = true,
8396 .chain_id = ALC269_FIXUP_HEADSET_MODE
8397 },
8398 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8399 .type = HDA_FIXUP_PINS,
8400 .v.pins = (const struct hda_pintbl[]) {
8401 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8402 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8403 { }
8404 },
8405 .chained = true,
8406 .chain_id = ALC269_FIXUP_HEADSET_MODE
8407 },
8408 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8409 .type = HDA_FIXUP_FUNC,
8410 .v.func = alc_fixup_headset_mode,
8411 },
8412 [ALC256_FIXUP_ASUS_MIC] = {
8413 .type = HDA_FIXUP_PINS,
8414 .v.pins = (const struct hda_pintbl[]) {
8415 { 0x13, 0x90a60160 }, /* use as internal mic */
8416 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8417 { }
8418 },
8419 .chained = true,
8420 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8421 },
8422 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8423 .type = HDA_FIXUP_FUNC,
8424 /* Set up GPIO2 for the speaker amp */
8425 .v.func = alc_fixup_gpio4,
8426 },
8427 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8428 .type = HDA_FIXUP_PINS,
8429 .v.pins = (const struct hda_pintbl[]) {
8430 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8431 { }
8432 },
8433 .chained = true,
8434 .chain_id = ALC269_FIXUP_HEADSET_MIC
8435 },
8436 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8437 .type = HDA_FIXUP_VERBS,
8438 .v.verbs = (const struct hda_verb[]) {
8439 /* Enables internal speaker */
8440 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8441 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8442 {}
8443 },
8444 .chained = true,
8445 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8446 },
8447 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8448 .type = HDA_FIXUP_FUNC,
8449 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8450 .chained = true,
8451 .chain_id = ALC269_FIXUP_GPIO2
8452 },
8453 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
8454 .type = HDA_FIXUP_VERBS,
8455 .v.verbs = (const struct hda_verb[]) {
8456 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8457 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8458 { }
8459 },
8460 .chained = true,
8461 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8462 },
8463 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8464 .type = HDA_FIXUP_PINS,
8465 .v.pins = (const struct hda_pintbl[]) {
8466 /* Change the mic location from front to right, otherwise there are
8467 two front mics with the same name, pulseaudio can't handle them.
8468 This is just a temporary workaround, after applying this fixup,
8469 there will be one "Front Mic" and one "Mic" in this machine.
8470 */
8471 { 0x1a, 0x04a19040 },
8472 { }
8473 },
8474 },
8475 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8476 .type = HDA_FIXUP_PINS,
8477 .v.pins = (const struct hda_pintbl[]) {
8478 { 0x16, 0x0101102f }, /* Rear Headset HP */
8479 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8480 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8481 { 0x1b, 0x02011020 },
8482 { }
8483 },
8484 .chained = true,
8485 .chain_id = ALC225_FIXUP_S3_POP_NOISE
8486 },
8487 [ALC225_FIXUP_S3_POP_NOISE] = {
8488 .type = HDA_FIXUP_FUNC,
8489 .v.func = alc225_fixup_s3_pop_noise,
8490 .chained = true,
8491 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8492 },
8493 [ALC700_FIXUP_INTEL_REFERENCE] = {
8494 .type = HDA_FIXUP_VERBS,
8495 .v.verbs = (const struct hda_verb[]) {
8496 /* Enables internal speaker */
8497 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8498 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8499 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8500 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8501 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8502 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8503 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8504 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8505 {}
8506 }
8507 },
8508 [ALC274_FIXUP_DELL_BIND_DACS] = {
8509 .type = HDA_FIXUP_FUNC,
8510 .v.func = alc274_fixup_bind_dacs,
8511 .chained = true,
8512 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8513 },
8514 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8515 .type = HDA_FIXUP_PINS,
8516 .v.pins = (const struct hda_pintbl[]) {
8517 { 0x1b, 0x0401102f },
8518 { }
8519 },
8520 .chained = true,
8521 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
8522 },
8523 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
8524 .type = HDA_FIXUP_FUNC,
8525 .v.func = alc_fixup_tpt470_dock,
8526 .chained = true,
8527 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8528 },
8529 [ALC298_FIXUP_TPT470_DOCK] = {
8530 .type = HDA_FIXUP_FUNC,
8531 .v.func = alc_fixup_tpt470_dacs,
8532 .chained = true,
8533 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8534 },
8535 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8536 .type = HDA_FIXUP_PINS,
8537 .v.pins = (const struct hda_pintbl[]) {
8538 { 0x14, 0x0201101f },
8539 { }
8540 },
8541 .chained = true,
8542 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8543 },
8544 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
8545 .type = HDA_FIXUP_PINS,
8546 .v.pins = (const struct hda_pintbl[]) {
8547 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8548 { }
8549 },
8550 .chained = true,
8551 .chain_id = ALC269_FIXUP_HEADSET_MIC
8552 },
8553 [ALC295_FIXUP_HP_X360] = {
8554 .type = HDA_FIXUP_FUNC,
8555 .v.func = alc295_fixup_hp_top_speakers,
8556 .chained = true,
8557 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8558 },
8559 [ALC221_FIXUP_HP_HEADSET_MIC] = {
8560 .type = HDA_FIXUP_PINS,
8561 .v.pins = (const struct hda_pintbl[]) {
8562 { 0x19, 0x0181313f},
8563 { }
8564 },
8565 .chained = true,
8566 .chain_id = ALC269_FIXUP_HEADSET_MIC
8567 },
8568 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8569 .type = HDA_FIXUP_FUNC,
8570 .v.func = alc285_fixup_invalidate_dacs,
8571 .chained = true,
8572 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8573 },
8574 [ALC295_FIXUP_HP_AUTO_MUTE] = {
8575 .type = HDA_FIXUP_FUNC,
8576 .v.func = alc_fixup_auto_mute_via_amp,
8577 },
8578 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8579 .type = HDA_FIXUP_PINS,
8580 .v.pins = (const struct hda_pintbl[]) {
8581 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8582 { }
8583 },
8584 .chained = true,
8585 .chain_id = ALC269_FIXUP_HEADSET_MIC
8586 },
8587 [ALC294_FIXUP_ASUS_MIC] = {
8588 .type = HDA_FIXUP_PINS,
8589 .v.pins = (const struct hda_pintbl[]) {
8590 { 0x13, 0x90a60160 }, /* use as internal mic */
8591 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8592 { }
8593 },
8594 .chained = true,
8595 .chain_id = ALC269_FIXUP_HEADSET_MIC
8596 },
8597 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8598 .type = HDA_FIXUP_PINS,
8599 .v.pins = (const struct hda_pintbl[]) {
8600 { 0x19, 0x01a1103c }, /* use as headset mic */
8601 { }
8602 },
8603 .chained = true,
8604 .chain_id = ALC269_FIXUP_HEADSET_MIC
8605 },
8606 [ALC294_FIXUP_ASUS_SPK] = {
8607 .type = HDA_FIXUP_VERBS,
8608 .v.verbs = (const struct hda_verb[]) {
8609 /* Set EAPD high */
8610 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8611 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8612 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8613 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8614 { }
8615 },
8616 .chained = true,
8617 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8618 },
8619 [ALC295_FIXUP_CHROME_BOOK] = {
8620 .type = HDA_FIXUP_FUNC,
8621 .v.func = alc295_fixup_chromebook,
8622 .chained = true,
8623 .chain_id = ALC225_FIXUP_HEADSET_JACK
8624 },
8625 [ALC225_FIXUP_HEADSET_JACK] = {
8626 .type = HDA_FIXUP_FUNC,
8627 .v.func = alc_fixup_headset_jack,
8628 },
8629 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8630 .type = HDA_FIXUP_PINS,
8631 .v.pins = (const struct hda_pintbl[]) {
8632 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8633 { }
8634 },
8635 .chained = true,
8636 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8637 },
8638 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8639 .type = HDA_FIXUP_VERBS,
8640 .v.verbs = (const struct hda_verb[]) {
8641 /* Disable PCBEEP-IN passthrough */
8642 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8643 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8644 { }
8645 },
8646 .chained = true,
8647 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8648 },
8649 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8650 .type = HDA_FIXUP_PINS,
8651 .v.pins = (const struct hda_pintbl[]) {
8652 { 0x19, 0x03a11130 },
8653 { 0x1a, 0x90a60140 }, /* use as internal mic */
8654 { }
8655 },
8656 .chained = true,
8657 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8658 },
8659 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8660 .type = HDA_FIXUP_PINS,
8661 .v.pins = (const struct hda_pintbl[]) {
8662 { 0x16, 0x01011020 }, /* Rear Line out */
8663 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8664 { }
8665 },
8666 .chained = true,
8667 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8668 },
8669 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8670 .type = HDA_FIXUP_FUNC,
8671 .v.func = alc_fixup_auto_mute_via_amp,
8672 .chained = true,
8673 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8674 },
8675 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8676 .type = HDA_FIXUP_FUNC,
8677 .v.func = alc_fixup_disable_mic_vref,
8678 .chained = true,
8679 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8680 },
8681 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8682 .type = HDA_FIXUP_VERBS,
8683 .v.verbs = (const struct hda_verb[]) {
8684 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8685 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8686 { }
8687 },
8688 .chained = true,
8689 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8690 },
8691 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8692 .type = HDA_FIXUP_PINS,
8693 .v.pins = (const struct hda_pintbl[]) {
8694 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8695 { }
8696 },
8697 .chained = true,
8698 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8699 },
8700 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8701 .type = HDA_FIXUP_PINS,
8702 .v.pins = (const struct hda_pintbl[]) {
8703 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8704 { }
8705 },
8706 .chained = true,
8707 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8708 },
8709 [ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
8710 .type = HDA_FIXUP_PINS,
8711 .v.pins = (const struct hda_pintbl[]) {
8712 { 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
8713 { 0x1b, 0x90170152 } /* use as internal speaker (back) */
8714 }
8715 },
8716 [ALC299_FIXUP_PREDATOR_SPK] = {
8717 .type = HDA_FIXUP_PINS,
8718 .v.pins = (const struct hda_pintbl[]) {
8719 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8720 { }
8721 }
8722 },
8723 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8724 .type = HDA_FIXUP_PINS,
8725 .v.pins = (const struct hda_pintbl[]) {
8726 { 0x19, 0x04a11040 },
8727 { 0x21, 0x04211020 },
8728 { }
8729 },
8730 .chained = true,
8731 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8732 },
8733 [ALC289_FIXUP_DELL_SPK1] = {
8734 .type = HDA_FIXUP_PINS,
8735 .v.pins = (const struct hda_pintbl[]) {
8736 { 0x14, 0x90170140 },
8737 { }
8738 },
8739 .chained = true,
8740 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8741 },
8742 [ALC289_FIXUP_DELL_SPK2] = {
8743 .type = HDA_FIXUP_PINS,
8744 .v.pins = (const struct hda_pintbl[]) {
8745 { 0x17, 0x90170130 }, /* bass spk */
8746 { }
8747 },
8748 .chained = true,
8749 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8750 },
8751 [ALC289_FIXUP_DUAL_SPK] = {
8752 .type = HDA_FIXUP_FUNC,
8753 .v.func = alc285_fixup_speaker2_to_dac1,
8754 .chained = true,
8755 .chain_id = ALC289_FIXUP_DELL_SPK2
8756 },
8757 [ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8758 .type = HDA_FIXUP_FUNC,
8759 .v.func = alc285_fixup_speaker2_to_dac1,
8760 .chained = true,
8761 .chain_id = ALC289_FIXUP_DELL_SPK1
8762 },
8763 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8764 .type = HDA_FIXUP_FUNC,
8765 .v.func = alc285_fixup_speaker2_to_dac1,
8766 .chained = true,
8767 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8768 },
8769 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
8770 .type = HDA_FIXUP_FUNC,
8771 /* The GPIO must be pulled to initialize the AMP */
8772 .v.func = alc_fixup_gpio4,
8773 .chained = true,
8774 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8775 },
8776 [ALC294_FIXUP_ASUS_ALLY] = {
8777 .type = HDA_FIXUP_FUNC,
8778 .v.func = cs35l41_fixup_i2c_two,
8779 .chained = true,
8780 .chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8781 },
8782 [ALC294_FIXUP_ASUS_ALLY_PINS] = {
8783 .type = HDA_FIXUP_PINS,
8784 .v.pins = (const struct hda_pintbl[]) {
8785 { 0x19, 0x03a11050 },
8786 { 0x1a, 0x03a11c30 },
8787 { 0x21, 0x03211420 },
8788 { }
8789 },
8790 .chained = true,
8791 .chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8792 },
8793 [ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8794 .type = HDA_FIXUP_VERBS,
8795 .v.verbs = (const struct hda_verb[]) {
8796 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8797 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8798 { 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8799 { 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8800 { 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8801 { 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8802 { 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8803 { 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8804 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8805 { 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8806 { 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8807 { 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8808 { }
8809 },
8810 .chained = true,
8811 .chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8812 },
8813 [ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8814 .type = HDA_FIXUP_FUNC,
8815 .v.func = alc285_fixup_speaker2_to_dac1,
8816 },
8817 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8818 .type = HDA_FIXUP_FUNC,
8819 .v.func = alc285_fixup_thinkpad_x1_gen7,
8820 .chained = true,
8821 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8822 },
8823 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8824 .type = HDA_FIXUP_FUNC,
8825 .v.func = alc_fixup_headset_jack,
8826 .chained = true,
8827 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8828 },
8829 [ALC294_FIXUP_ASUS_HPE] = {
8830 .type = HDA_FIXUP_VERBS,
8831 .v.verbs = (const struct hda_verb[]) {
8832 /* Set EAPD high */
8833 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8834 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8835 { }
8836 },
8837 .chained = true,
8838 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8839 },
8840 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8841 .type = HDA_FIXUP_PINS,
8842 .v.pins = (const struct hda_pintbl[]) {
8843 { 0x19, 0x03a11050 }, /* front HP mic */
8844 { 0x1a, 0x01a11830 }, /* rear external mic */
8845 { 0x21, 0x03211020 }, /* front HP out */
8846 { }
8847 },
8848 .chained = true,
8849 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8850 },
8851 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8852 .type = HDA_FIXUP_VERBS,
8853 .v.verbs = (const struct hda_verb[]) {
8854 /* set 0x15 to HP-OUT ctrl */
8855 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8856 /* unmute the 0x15 amp */
8857 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8858 { }
8859 },
8860 .chained = true,
8861 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8862 },
8863 [ALC294_FIXUP_ASUS_GX502_HP] = {
8864 .type = HDA_FIXUP_FUNC,
8865 .v.func = alc294_fixup_gx502_hp,
8866 },
8867 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8868 .type = HDA_FIXUP_PINS,
8869 .v.pins = (const struct hda_pintbl[]) {
8870 { 0x19, 0x01a11050 }, /* rear HP mic */
8871 { 0x1a, 0x01a11830 }, /* rear external mic */
8872 { 0x21, 0x012110f0 }, /* rear HP out */
8873 { }
8874 },
8875 .chained = true,
8876 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8877 },
8878 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8879 .type = HDA_FIXUP_VERBS,
8880 .v.verbs = (const struct hda_verb[]) {
8881 /* set 0x15 to HP-OUT ctrl */
8882 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8883 /* unmute the 0x15 amp */
8884 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8885 /* set 0x1b to HP-OUT */
8886 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8887 { }
8888 },
8889 .chained = true,
8890 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8891 },
8892 [ALC294_FIXUP_ASUS_GU502_HP] = {
8893 .type = HDA_FIXUP_FUNC,
8894 .v.func = alc294_fixup_gu502_hp,
8895 },
8896 [ALC294_FIXUP_ASUS_G513_PINS] = {
8897 .type = HDA_FIXUP_PINS,
8898 .v.pins = (const struct hda_pintbl[]) {
8899 { 0x19, 0x03a11050 }, /* front HP mic */
8900 { 0x1a, 0x03a11c30 }, /* rear external mic */
8901 { 0x21, 0x03211420 }, /* front HP out */
8902 { }
8903 },
8904 },
8905 [ALC285_FIXUP_ASUS_G533Z_PINS] = {
8906 .type = HDA_FIXUP_PINS,
8907 .v.pins = (const struct hda_pintbl[]) {
8908 { 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8909 { 0x19, 0x03a19020 }, /* Mic Boost Volume */
8910 { 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8911 { 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8912 { 0x21, 0x03211420 },
8913 { }
8914 },
8915 },
8916 [ALC294_FIXUP_ASUS_COEF_1B] = {
8917 .type = HDA_FIXUP_VERBS,
8918 .v.verbs = (const struct hda_verb[]) {
8919 /* Set bit 10 to correct noisy output after reboot from
8920 * Windows 10 (due to pop noise reduction?)
8921 */
8922 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8923 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8924 { }
8925 },
8926 .chained = true,
8927 .chain_id = ALC289_FIXUP_ASUS_GA401,
8928 },
8929 [ALC285_FIXUP_HP_GPIO_LED] = {
8930 .type = HDA_FIXUP_FUNC,
8931 .v.func = alc285_fixup_hp_gpio_led,
8932 },
8933 [ALC285_FIXUP_HP_MUTE_LED] = {
8934 .type = HDA_FIXUP_FUNC,
8935 .v.func = alc285_fixup_hp_mute_led,
8936 },
8937 [ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8938 .type = HDA_FIXUP_FUNC,
8939 .v.func = alc285_fixup_hp_spectre_x360_mute_led,
8940 },
8941 [ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
8942 .type = HDA_FIXUP_FUNC,
8943 .v.func = alc236_fixup_hp_mute_led_coefbit2,
8944 },
8945 [ALC236_FIXUP_HP_GPIO_LED] = {
8946 .type = HDA_FIXUP_FUNC,
8947 .v.func = alc236_fixup_hp_gpio_led,
8948 },
8949 [ALC236_FIXUP_HP_MUTE_LED] = {
8950 .type = HDA_FIXUP_FUNC,
8951 .v.func = alc236_fixup_hp_mute_led,
8952 },
8953 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8954 .type = HDA_FIXUP_FUNC,
8955 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8956 },
8957 [ALC236_FIXUP_LENOVO_INV_DMIC] = {
8958 .type = HDA_FIXUP_FUNC,
8959 .v.func = alc_fixup_inv_dmic,
8960 .chained = true,
8961 .chain_id = ALC283_FIXUP_INT_MIC,
8962 },
8963 [ALC298_FIXUP_SAMSUNG_AMP] = {
8964 .type = HDA_FIXUP_FUNC,
8965 .v.func = alc298_fixup_samsung_amp,
8966 .chained = true,
8967 .chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8968 },
8969 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8970 .type = HDA_FIXUP_VERBS,
8971 .v.verbs = (const struct hda_verb[]) {
8972 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8973 { }
8974 },
8975 },
8976 [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8977 .type = HDA_FIXUP_VERBS,
8978 .v.verbs = (const struct hda_verb[]) {
8979 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8980 { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8981 { }
8982 },
8983 },
8984 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8985 .type = HDA_FIXUP_PINS,
8986 .v.pins = (const struct hda_pintbl[]) {
8987 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8988 { }
8989 },
8990 .chained = true,
8991 .chain_id = ALC269_FIXUP_HEADSET_MODE
8992 },
8993 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8994 .type = HDA_FIXUP_PINS,
8995 .v.pins = (const struct hda_pintbl[]) {
8996 { 0x14, 0x90100120 }, /* use as internal speaker */
8997 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8998 { 0x1a, 0x01011020 }, /* use as line out */
8999 { },
9000 },
9001 .chained = true,
9002 .chain_id = ALC269_FIXUP_HEADSET_MIC
9003 },
9004 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9005 .type = HDA_FIXUP_PINS,
9006 .v.pins = (const struct hda_pintbl[]) {
9007 { 0x18, 0x02a11030 }, /* use as headset mic */
9008 { }
9009 },
9010 .chained = true,
9011 .chain_id = ALC269_FIXUP_HEADSET_MIC
9012 },
9013 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9014 .type = HDA_FIXUP_PINS,
9015 .v.pins = (const struct hda_pintbl[]) {
9016 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9017 { }
9018 },
9019 .chained = true,
9020 .chain_id = ALC269_FIXUP_HEADSET_MIC
9021 },
9022 [ALC289_FIXUP_ASUS_GA401] = {
9023 .type = HDA_FIXUP_FUNC,
9024 .v.func = alc289_fixup_asus_ga401,
9025 .chained = true,
9026 .chain_id = ALC289_FIXUP_ASUS_GA502,
9027 },
9028 [ALC289_FIXUP_ASUS_GA502] = {
9029 .type = HDA_FIXUP_PINS,
9030 .v.pins = (const struct hda_pintbl[]) {
9031 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
9032 { }
9033 },
9034 },
9035 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9036 .type = HDA_FIXUP_PINS,
9037 .v.pins = (const struct hda_pintbl[]) {
9038 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9039 { }
9040 },
9041 .chained = true,
9042 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9043 },
9044 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9045 .type = HDA_FIXUP_FUNC,
9046 .v.func = alc285_fixup_hp_gpio_amp_init,
9047 .chained = true,
9048 .chain_id = ALC285_FIXUP_HP_GPIO_LED
9049 },
9050 [ALC269_FIXUP_CZC_B20] = {
9051 .type = HDA_FIXUP_PINS,
9052 .v.pins = (const struct hda_pintbl[]) {
9053 { 0x12, 0x411111f0 },
9054 { 0x14, 0x90170110 }, /* speaker */
9055 { 0x15, 0x032f1020 }, /* HP out */
9056 { 0x17, 0x411111f0 },
9057 { 0x18, 0x03ab1040 }, /* mic */
9058 { 0x19, 0xb7a7013f },
9059 { 0x1a, 0x0181305f },
9060 { 0x1b, 0x411111f0 },
9061 { 0x1d, 0x411111f0 },
9062 { 0x1e, 0x411111f0 },
9063 { }
9064 },
9065 .chain_id = ALC269_FIXUP_DMIC,
9066 },
9067 [ALC269_FIXUP_CZC_TMI] = {
9068 .type = HDA_FIXUP_PINS,
9069 .v.pins = (const struct hda_pintbl[]) {
9070 { 0x12, 0x4000c000 },
9071 { 0x14, 0x90170110 }, /* speaker */
9072 { 0x15, 0x0421401f }, /* HP out */
9073 { 0x17, 0x411111f0 },
9074 { 0x18, 0x04a19020 }, /* mic */
9075 { 0x19, 0x411111f0 },
9076 { 0x1a, 0x411111f0 },
9077 { 0x1b, 0x411111f0 },
9078 { 0x1d, 0x40448505 },
9079 { 0x1e, 0x411111f0 },
9080 { 0x20, 0x8000ffff },
9081 { }
9082 },
9083 .chain_id = ALC269_FIXUP_DMIC,
9084 },
9085 [ALC269_FIXUP_CZC_L101] = {
9086 .type = HDA_FIXUP_PINS,
9087 .v.pins = (const struct hda_pintbl[]) {
9088 { 0x12, 0x40000000 },
9089 { 0x14, 0x01014010 }, /* speaker */
9090 { 0x15, 0x411111f0 }, /* HP out */
9091 { 0x16, 0x411111f0 },
9092 { 0x18, 0x01a19020 }, /* mic */
9093 { 0x19, 0x02a19021 },
9094 { 0x1a, 0x0181302f },
9095 { 0x1b, 0x0221401f },
9096 { 0x1c, 0x411111f0 },
9097 { 0x1d, 0x4044c601 },
9098 { 0x1e, 0x411111f0 },
9099 { }
9100 },
9101 .chain_id = ALC269_FIXUP_DMIC,
9102 },
9103 [ALC269_FIXUP_LEMOTE_A1802] = {
9104 .type = HDA_FIXUP_PINS,
9105 .v.pins = (const struct hda_pintbl[]) {
9106 { 0x12, 0x40000000 },
9107 { 0x14, 0x90170110 }, /* speaker */
9108 { 0x17, 0x411111f0 },
9109 { 0x18, 0x03a19040 }, /* mic1 */
9110 { 0x19, 0x90a70130 }, /* mic2 */
9111 { 0x1a, 0x411111f0 },
9112 { 0x1b, 0x411111f0 },
9113 { 0x1d, 0x40489d2d },
9114 { 0x1e, 0x411111f0 },
9115 { 0x20, 0x0003ffff },
9116 { 0x21, 0x03214020 },
9117 { }
9118 },
9119 .chain_id = ALC269_FIXUP_DMIC,
9120 },
9121 [ALC269_FIXUP_LEMOTE_A190X] = {
9122 .type = HDA_FIXUP_PINS,
9123 .v.pins = (const struct hda_pintbl[]) {
9124 { 0x14, 0x99130110 }, /* speaker */
9125 { 0x15, 0x0121401f }, /* HP out */
9126 { 0x18, 0x01a19c20 }, /* rear mic */
9127 { 0x19, 0x99a3092f }, /* front mic */
9128 { 0x1b, 0x0201401f }, /* front lineout */
9129 { }
9130 },
9131 .chain_id = ALC269_FIXUP_DMIC,
9132 },
9133 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9134 .type = HDA_FIXUP_PINS,
9135 .v.pins = (const struct hda_pintbl[]) {
9136 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9137 { }
9138 },
9139 .chained = true,
9140 .chain_id = ALC269_FIXUP_HEADSET_MODE
9141 },
9142 [ALC256_FIXUP_INTEL_NUC10] = {
9143 .type = HDA_FIXUP_PINS,
9144 .v.pins = (const struct hda_pintbl[]) {
9145 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9146 { }
9147 },
9148 .chained = true,
9149 .chain_id = ALC269_FIXUP_HEADSET_MODE
9150 },
9151 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9152 .type = HDA_FIXUP_VERBS,
9153 .v.verbs = (const struct hda_verb[]) {
9154 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9155 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9156 { }
9157 },
9158 .chained = true,
9159 .chain_id = ALC289_FIXUP_ASUS_GA502
9160 },
9161 [ALC274_FIXUP_HP_MIC] = {
9162 .type = HDA_FIXUP_VERBS,
9163 .v.verbs = (const struct hda_verb[]) {
9164 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9165 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9166 { }
9167 },
9168 },
9169 [ALC274_FIXUP_HP_HEADSET_MIC] = {
9170 .type = HDA_FIXUP_FUNC,
9171 .v.func = alc274_fixup_hp_headset_mic,
9172 .chained = true,
9173 .chain_id = ALC274_FIXUP_HP_MIC
9174 },
9175 [ALC274_FIXUP_HP_ENVY_GPIO] = {
9176 .type = HDA_FIXUP_FUNC,
9177 .v.func = alc274_fixup_hp_envy_gpio,
9178 },
9179 [ALC256_FIXUP_ASUS_HPE] = {
9180 .type = HDA_FIXUP_VERBS,
9181 .v.verbs = (const struct hda_verb[]) {
9182 /* Set EAPD high */
9183 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9184 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9185 { }
9186 },
9187 .chained = true,
9188 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9189 },
9190 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9191 .type = HDA_FIXUP_FUNC,
9192 .v.func = alc_fixup_headset_jack,
9193 .chained = true,
9194 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
9195 },
9196 [ALC287_FIXUP_HP_GPIO_LED] = {
9197 .type = HDA_FIXUP_FUNC,
9198 .v.func = alc287_fixup_hp_gpio_led,
9199 },
9200 [ALC256_FIXUP_HP_HEADSET_MIC] = {
9201 .type = HDA_FIXUP_FUNC,
9202 .v.func = alc274_fixup_hp_headset_mic,
9203 },
9204 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9205 .type = HDA_FIXUP_FUNC,
9206 .v.func = alc_fixup_no_int_mic,
9207 .chained = true,
9208 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9209 },
9210 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9211 .type = HDA_FIXUP_PINS,
9212 .v.pins = (const struct hda_pintbl[]) {
9213 { 0x1b, 0x411111f0 },
9214 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9215 { },
9216 },
9217 .chained = true,
9218 .chain_id = ALC269_FIXUP_HEADSET_MODE
9219 },
9220 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9221 .type = HDA_FIXUP_FUNC,
9222 .v.func = alc269_fixup_limit_int_mic_boost,
9223 .chained = true,
9224 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9225 },
9226 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
9227 .type = HDA_FIXUP_PINS,
9228 .v.pins = (const struct hda_pintbl[]) {
9229 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9230 { 0x1a, 0x90a1092f }, /* use as internal mic */
9231 { }
9232 },
9233 .chained = true,
9234 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9235 },
9236 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9237 .type = HDA_FIXUP_FUNC,
9238 .v.func = alc285_fixup_ideapad_s740_coef,
9239 .chained = true,
9240 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9241 },
9242 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9243 .type = HDA_FIXUP_FUNC,
9244 .v.func = alc269_fixup_limit_int_mic_boost,
9245 .chained = true,
9246 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9247 },
9248 [ALC295_FIXUP_ASUS_DACS] = {
9249 .type = HDA_FIXUP_FUNC,
9250 .v.func = alc295_fixup_asus_dacs,
9251 },
9252 [ALC295_FIXUP_HP_OMEN] = {
9253 .type = HDA_FIXUP_PINS,
9254 .v.pins = (const struct hda_pintbl[]) {
9255 { 0x12, 0xb7a60130 },
9256 { 0x13, 0x40000000 },
9257 { 0x14, 0x411111f0 },
9258 { 0x16, 0x411111f0 },
9259 { 0x17, 0x90170110 },
9260 { 0x18, 0x411111f0 },
9261 { 0x19, 0x02a11030 },
9262 { 0x1a, 0x411111f0 },
9263 { 0x1b, 0x04a19030 },
9264 { 0x1d, 0x40600001 },
9265 { 0x1e, 0x411111f0 },
9266 { 0x21, 0x03211020 },
9267 {}
9268 },
9269 .chained = true,
9270 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9271 },
9272 [ALC285_FIXUP_HP_SPECTRE_X360] = {
9273 .type = HDA_FIXUP_FUNC,
9274 .v.func = alc285_fixup_hp_spectre_x360,
9275 },
9276 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9277 .type = HDA_FIXUP_FUNC,
9278 .v.func = alc285_fixup_hp_spectre_x360_eb1
9279 },
9280 [ALC285_FIXUP_HP_ENVY_X360] = {
9281 .type = HDA_FIXUP_FUNC,
9282 .v.func = alc285_fixup_hp_envy_x360,
9283 .chained = true,
9284 .chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9285 },
9286 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9287 .type = HDA_FIXUP_FUNC,
9288 .v.func = alc285_fixup_ideapad_s740_coef,
9289 .chained = true,
9290 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9291 },
9292 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9293 .type = HDA_FIXUP_FUNC,
9294 .v.func = alc_fixup_no_shutup,
9295 .chained = true,
9296 .chain_id = ALC283_FIXUP_HEADSET_MIC,
9297 },
9298 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9299 .type = HDA_FIXUP_PINS,
9300 .v.pins = (const struct hda_pintbl[]) {
9301 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9302 { }
9303 },
9304 .chained = true,
9305 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9306 },
9307 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9308 .type = HDA_FIXUP_FUNC,
9309 .v.func = alc269_fixup_limit_int_mic_boost,
9310 .chained = true,
9311 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9312 },
9313 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9314 .type = HDA_FIXUP_FUNC,
9315 .v.func = alc285_fixup_ideapad_s740_coef,
9316 .chained = true,
9317 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9318 },
9319 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9320 .type = HDA_FIXUP_FUNC,
9321 .v.func = alc287_fixup_legion_15imhg05_speakers,
9322 .chained = true,
9323 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9324 },
9325 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9326 .type = HDA_FIXUP_VERBS,
9327 //.v.verbs = legion_15imhg05_coefs,
9328 .v.verbs = (const struct hda_verb[]) {
9329 // set left speaker Legion 7i.
9330 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9331 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9332
9333 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9334 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9335 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9336 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9337 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9338
9339 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9340 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9341 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9342 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9343 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9344
9345 // set right speaker Legion 7i.
9346 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9347 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9348
9349 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9350 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9351 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9352 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9353 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9354
9355 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9356 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9357 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9358 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9359 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9360 {}
9361 },
9362 .chained = true,
9363 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9364 },
9365 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9366 .type = HDA_FIXUP_FUNC,
9367 .v.func = alc287_fixup_legion_15imhg05_speakers,
9368 .chained = true,
9369 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9370 },
9371 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9372 .type = HDA_FIXUP_VERBS,
9373 .v.verbs = (const struct hda_verb[]) {
9374 // set left speaker Yoga 7i.
9375 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9376 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9377
9378 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9379 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9380 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9381 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9382 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9383
9384 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9385 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9386 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9387 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9388 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9389
9390 // set right speaker Yoga 7i.
9391 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9392 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9393
9394 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9395 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9396 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9397 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9398 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9399
9400 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9401 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9402 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9403 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9404 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9405 {}
9406 },
9407 .chained = true,
9408 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9409 },
9410 [ALC298_FIXUP_LENOVO_C940_DUET7] = {
9411 .type = HDA_FIXUP_FUNC,
9412 .v.func = alc298_fixup_lenovo_c940_duet7,
9413 },
9414 [ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9415 .type = HDA_FIXUP_FUNC,
9416 .v.func = alc287_fixup_lenovo_14irp8_duetitl,
9417 },
9418 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9419 .type = HDA_FIXUP_VERBS,
9420 .v.verbs = (const struct hda_verb[]) {
9421 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9422 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9423 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9424 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9425 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9426 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9427 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9428 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9429 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9430 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9431 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9432 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9433 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9434 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9435 {}
9436 },
9437 .chained = true,
9438 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9439 },
9440 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9441 .type = HDA_FIXUP_FUNC,
9442 .v.func = alc256_fixup_set_coef_defaults,
9443 },
9444 [ALC245_FIXUP_HP_GPIO_LED] = {
9445 .type = HDA_FIXUP_FUNC,
9446 .v.func = alc245_fixup_hp_gpio_led,
9447 },
9448 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9449 .type = HDA_FIXUP_PINS,
9450 .v.pins = (const struct hda_pintbl[]) {
9451 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9452 { }
9453 },
9454 .chained = true,
9455 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9456 },
9457 [ALC233_FIXUP_NO_AUDIO_JACK] = {
9458 .type = HDA_FIXUP_FUNC,
9459 .v.func = alc233_fixup_no_audio_jack,
9460 },
9461 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9462 .type = HDA_FIXUP_FUNC,
9463 .v.func = alc256_fixup_mic_no_presence_and_resume,
9464 .chained = true,
9465 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9466 },
9467 [ALC287_FIXUP_LEGION_16ACHG6] = {
9468 .type = HDA_FIXUP_FUNC,
9469 .v.func = alc287_fixup_legion_16achg6_speakers,
9470 },
9471 [ALC287_FIXUP_CS35L41_I2C_2] = {
9472 .type = HDA_FIXUP_FUNC,
9473 .v.func = cs35l41_fixup_i2c_two,
9474 },
9475 [ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9476 .type = HDA_FIXUP_FUNC,
9477 .v.func = cs35l41_fixup_i2c_two,
9478 .chained = true,
9479 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9480 },
9481 [ALC245_FIXUP_CS35L41_SPI_2] = {
9482 .type = HDA_FIXUP_FUNC,
9483 .v.func = cs35l41_fixup_spi_two,
9484 },
9485 [ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9486 .type = HDA_FIXUP_FUNC,
9487 .v.func = cs35l41_fixup_spi_two,
9488 .chained = true,
9489 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9490 },
9491 [ALC245_FIXUP_CS35L41_SPI_4] = {
9492 .type = HDA_FIXUP_FUNC,
9493 .v.func = cs35l41_fixup_spi_four,
9494 },
9495 [ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9496 .type = HDA_FIXUP_FUNC,
9497 .v.func = cs35l41_fixup_spi_four,
9498 .chained = true,
9499 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9500 },
9501 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9502 .type = HDA_FIXUP_VERBS,
9503 .v.verbs = (const struct hda_verb[]) {
9504 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9505 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9506 { }
9507 },
9508 .chained = true,
9509 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9510 },
9511 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9512 .type = HDA_FIXUP_FUNC,
9513 .v.func = alc_fixup_dell4_mic_no_presence_quiet,
9514 .chained = true,
9515 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9516 },
9517 [ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9518 .type = HDA_FIXUP_PINS,
9519 .v.pins = (const struct hda_pintbl[]) {
9520 { 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9521 { }
9522 },
9523 .chained = true,
9524 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9525 },
9526 [ALC287_FIXUP_LEGION_16ITHG6] = {
9527 .type = HDA_FIXUP_FUNC,
9528 .v.func = alc287_fixup_legion_16ithg6_speakers,
9529 },
9530 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9531 .type = HDA_FIXUP_VERBS,
9532 .v.verbs = (const struct hda_verb[]) {
9533 // enable left speaker
9534 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9535 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9536
9537 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9538 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9539 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9540 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9541 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9542
9543 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9544 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9545 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9546 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9547 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9548
9549 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9550 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9551 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9552 { 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9553 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9554
9555 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9556 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9557 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9558 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9559 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9560
9561 // enable right speaker
9562 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9563 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9564
9565 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9566 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9567 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9568 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9569 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9570
9571 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9572 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9573 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9574 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9575 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9576
9577 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9578 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9579 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9580 { 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9581 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9582
9583 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9584 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9585 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9586 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9587 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9588
9589 { },
9590 },
9591 },
9592 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9593 .type = HDA_FIXUP_FUNC,
9594 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9595 .chained = true,
9596 .chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9597 },
9598 [ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9599 .type = HDA_FIXUP_FUNC,
9600 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9601 .chained = true,
9602 .chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9603 },
9604 [ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9605 .type = HDA_FIXUP_FUNC,
9606 .v.func = alc295_fixup_dell_inspiron_top_speakers,
9607 .chained = true,
9608 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9609 },
9610 [ALC236_FIXUP_DELL_DUAL_CODECS] = {
9611 .type = HDA_FIXUP_PINS,
9612 .v.func = alc1220_fixup_gb_dual_codecs,
9613 .chained = true,
9614 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9615 },
9616 [ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9617 .type = HDA_FIXUP_FUNC,
9618 .v.func = cs35l41_fixup_i2c_two,
9619 .chained = true,
9620 .chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9621 },
9622 [ALC287_FIXUP_TAS2781_I2C] = {
9623 .type = HDA_FIXUP_FUNC,
9624 .v.func = tas2781_fixup_i2c,
9625 .chained = true,
9626 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9627 },
9628 [ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9629 .type = HDA_FIXUP_FUNC,
9630 .v.func = alc245_fixup_hp_mute_led_coefbit,
9631 },
9632 [ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9633 .type = HDA_FIXUP_FUNC,
9634 .v.func = alc245_fixup_hp_mute_led_coefbit,
9635 .chained = true,
9636 .chain_id = ALC245_FIXUP_HP_GPIO_LED
9637 },
9638 [ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9639 .type = HDA_FIXUP_FUNC,
9640 .v.func = alc287_fixup_bind_dacs,
9641 .chained = true,
9642 .chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9643 },
9644 [ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9645 .type = HDA_FIXUP_FUNC,
9646 .v.func = alc287_fixup_bind_dacs,
9647 .chained = true,
9648 .chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9649 },
9650 [ALC2XX_FIXUP_HEADSET_MIC] = {
9651 .type = HDA_FIXUP_FUNC,
9652 .v.func = alc_fixup_headset_mic,
9653 },
9654 [ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9655 .type = HDA_FIXUP_FUNC,
9656 .v.func = cs35l41_fixup_spi_two,
9657 .chained = true,
9658 .chain_id = ALC289_FIXUP_DUAL_SPK
9659 },
9660 [ALC294_FIXUP_CS35L41_I2C_2] = {
9661 .type = HDA_FIXUP_FUNC,
9662 .v.func = cs35l41_fixup_i2c_two,
9663 },
9664 };
9665
9666 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
9667 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9668 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9669 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9670 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9671 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9672 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9673 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9674 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9675 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9676 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9677 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9678 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9679 SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9680 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9681 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9682 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9683 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9684 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9685 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9686 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9687 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9688 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9689 SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9690 SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9691 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9692 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9693 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9694 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9695 SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9696 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9697 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9698 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9699 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9700 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9701 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9702 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9703 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9704 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9705 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9706 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9707 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9708 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9709 SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9710 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9711 SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9712 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9713 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9714 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9715 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9716 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9717 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9718 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9719 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9720 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9721 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9722 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9723 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9724 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9725 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9726 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9727 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9728 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9729 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9730 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9731 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9732 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9733 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9734 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9735 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9736 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9737 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9738 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9739 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9740 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9741 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9742 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9743 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9744 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9745 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9746 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9747 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9748 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9749 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9750 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9751 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9752 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9753 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9754 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9755 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9756 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9757 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9758 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9759 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9760 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9761 SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9762 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9763 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9764 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9765 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9766 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9767 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9768 SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9769 SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9770 SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9771 SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9772 SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9773 SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9774 SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9775 SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9776 SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9777 SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9778 SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9779 SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9780 SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9781 SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9782 SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9783 SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9784 SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9785 SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9786 SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9787 SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9788 SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9789 SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9790 SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9791 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9792 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9793 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9794 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9795 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9796 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9797 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9798 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9799 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9800 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9801 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9802 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9803 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9804 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9805 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9806 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9807 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9808 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9809 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9810 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9811 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9812 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9813 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9814 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9815 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9816 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9817 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9818 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9819 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9820 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9821 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9822 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9823 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9824 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9825 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9826 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9827 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9828 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9829 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9830 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9831 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9832 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9833 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9834 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9835 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9836 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9837 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9838 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9839 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9840 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9841 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9842 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9843 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9844 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9845 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9846 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9847 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9848 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9849 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9850 SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9851 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9852 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9853 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9854 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9855 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9856 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9857 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9858 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9859 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9860 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9861 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9862 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9863 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9864 SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9865 SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9866 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9867 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9868 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9869 SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9870 SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
9871 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9872 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9873 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9874 SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9875 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9876 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9877 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9878 SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9879 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9880 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9881 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9882 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9883 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9884 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9885 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9886 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9887 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9888 SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9889 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9890 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9891 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9892 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9893 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9894 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9895 SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9896 SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9897 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9898 SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9899 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9900 SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9901 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9902 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9903 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9904 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9905 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9906 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9907 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9908 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9909 SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9910 SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9911 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9912 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9913 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9914 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9915 SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9916 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9917 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9918 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9919 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9920 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9921 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9922 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9923 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9924 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9925 SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9926 SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9927 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9928 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9929 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9930 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9931 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9932 SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
9933 SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9934 SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9935 SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
9936 SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9937 SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9938 SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9939 SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9940 SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9941 SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9942 SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9943 SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
9944 SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9945 SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9946 SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9947 SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9948 SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
9949 SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9950 SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
9951 SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9952 SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
9953 SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9954 SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9955 SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9956 SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9957 SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9958 SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9959 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9960 SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9961 SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
9962 SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9963 SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
9964 SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9965 SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9966 SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9967 SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9968 SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
9969 SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
9970 SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9971 SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9972 SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9973 SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9974 SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9975 SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
9976 SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9977 SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9978 SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9979 SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9980 SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9981 SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9982 SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9983 SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9984 SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9985 SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9986 SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9987 SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9988 SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9989 SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9990 SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9991 SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
9992 SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
9993 SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
9994 SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
9995 SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
9996 SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
9997 SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
9998 SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9999 SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10000 SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10001 SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10002 SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10003 SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10004 SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10005 SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10006 SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10007 SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10008 SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10009 SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10010 SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10011 SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10012 SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10013 SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10014 SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10015 SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10016 SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10017 SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10018 SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10019 SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10020 SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10021 SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10022 SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10023 SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10024 SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10025 SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10026 SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10027 SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10028 SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10029 SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10030 SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10031 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10032 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10033 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10034 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10035 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10036 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10037 SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10038 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10039 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10040 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10041 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10042 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10043 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10044 SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10045 SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10046 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10047 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10048 SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10049 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10050 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10051 SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10052 SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10053 SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10054 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10055 SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10056 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10057 SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA", ALC287_FIXUP_CS35L41_I2C_2),
10058 SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10059 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10060 SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10061 SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10062 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10063 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10064 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10065 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10066 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10067 SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally RC71L_RC71L", ALC294_FIXUP_ASUS_ALLY),
10068 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10069 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10070 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10071 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10072 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10073 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10074 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10075 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10076 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10077 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10078 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
10079 SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10080 SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10081 SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10082 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10083 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
10084 SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10085 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10086 SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10087 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10088 SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10089 SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10090 SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10091 SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10092 SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10093 SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10094 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10095 SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
10096 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10097 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10098 SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10099 SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10100 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10101 SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10102 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10103 SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10104 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10105 SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10106 SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10107 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10108 SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10109 SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10110 SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10111 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10112 SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
10113 SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10114 SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10115 SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10116 SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10117 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10118 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10119 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10120 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10121 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10122 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10123 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10124 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10125 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10126 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10127 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10128 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10129 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10130 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10131 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10132 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10133 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10134 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10135 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10136 SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10137 SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10138 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10139 SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10140 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10141 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10142 SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10143 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10144 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10145 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10146 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10147 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10148 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10149 SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10150 SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10151 SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10152 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10153 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10154 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10155 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10156 SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10157 SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10158 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10159 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10160 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10161 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10162 SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10163 SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10164 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10165 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10166 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10167 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10168 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10169 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10170 SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10171 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10172 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10173 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10174 SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10175 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10176 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10177 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10178 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10179 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10180 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10181 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10182 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10183 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10184 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10185 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10186 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10187 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10188 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10189 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10190 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10191 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10192 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10193 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10194 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10195 SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10196 SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10197 SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10198 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10199 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10200 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10201 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10202 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10203 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10204 SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10205 SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10206 SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10207 SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10208 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10209 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10210 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10211 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10212 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10213 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10214 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10215 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10216 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10217 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10218 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10219 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10220 SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10221 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10222 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10223 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10224 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10225 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10226 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10227 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10228 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10229 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10230 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10231 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10232 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10233 SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10234 SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10235 SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10236 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10237 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10238 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10239 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10240 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10241 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10242 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10243 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10244 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10245 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10246 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10247 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10248 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10249 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10250 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10251 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10252 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10253 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10254 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10255 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10256 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10257 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10258 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10259 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10260 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10261 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10262 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10263 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10264 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10265 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10266 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10267 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10268 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10269 SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10270 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10271 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10272 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10273 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10274 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10275 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10276 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10277 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10278 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10279 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10280 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10281 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10282 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10283 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10284 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10285 SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10286 SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10287 SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10288 SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10289 SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10290 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10291 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10292 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10293 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10294 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10295 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10296 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10297 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10298 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10299 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10300 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10301 SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10302 SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10303 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10304 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10305 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10306 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10307 SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10308 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10309 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10310 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10311 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10312 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10313 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10314 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10315 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10316 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10317 SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10318 SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10319 SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10320 SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10321 SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10322 SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10323 SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10324 SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10325 SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10326 SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10327 SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10328 SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10329 SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10330 SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10331 SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10332 SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10333 SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10334 SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10335 SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10336 SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10337 SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10338 SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10339 SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10340 SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10341 SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10342 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10343 SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
10344 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10345 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10346 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10347 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10348 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10349 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10350 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10351 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10352 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10353 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10354 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10355 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10356 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10357 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10358 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10359 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10360 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10361 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10362 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10363 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10364 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10365 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10366 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10367 SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10368 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10369 SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10370 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10371 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10372 SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
10373 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10374 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10375 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10376 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10377 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10378 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10379 SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10380 SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10381 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10382 SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10383 SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10384 SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10385 SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10386 SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10387 SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10388 SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10389 SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10390 SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10391 SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10392 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10393 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10394 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10395 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10396 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10397 SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10398 SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10399 SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
10400 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10401 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10402 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10403 SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10404 SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10405 SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10406 SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10407
10408 #if 0
10409 /* Below is a quirk table taken from the old code.
10410 * Basically the device should work as is without the fixup table.
10411 * If BIOS doesn't give a proper info, enable the corresponding
10412 * fixup entry.
10413 */
10414 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10415 ALC269_FIXUP_AMIC),
10416 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10417 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10418 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10419 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10420 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10421 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10422 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10423 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10424 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10425 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10426 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10427 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10428 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10429 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10430 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10431 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10432 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10433 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10434 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10435 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10436 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10437 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10438 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10439 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10440 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10441 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10442 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10443 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10444 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10445 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10446 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10447 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10448 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10449 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10450 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10451 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10452 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10453 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10454 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10455 #endif
10456 {}
10457 };
10458
10459 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
10460 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10461 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10462 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10463 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10464 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10465 {}
10466 };
10467
10468 static const struct hda_model_fixup alc269_fixup_models[] = {
10469 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10470 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10471 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10472 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10473 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10474 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10475 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10476 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10477 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10478 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10479 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10480 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10481 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10482 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10483 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10484 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10485 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10486 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10487 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10488 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10489 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10490 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10491 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10492 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10493 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10494 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10495 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10496 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10497 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10498 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10499 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10500 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10501 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10502 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10503 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10504 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10505 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10506 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10507 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10508 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10509 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10510 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10511 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10512 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10513 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10514 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10515 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10516 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10517 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10518 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10519 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10520 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10521 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10522 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10523 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10524 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10525 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10526 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10527 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10528 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10529 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10530 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10531 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10532 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10533 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10534 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10535 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10536 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10537 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10538 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10539 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10540 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10541 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10542 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10543 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10544 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10545 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10546 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10547 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10548 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10549 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10550 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10551 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10552 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10553 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10554 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10555 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10556 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10557 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10558 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10559 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10560 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10561 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10562 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10563 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10564 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10565 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10566 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10567 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10568 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10569 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10570 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10571 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10572 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10573 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10574 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10575 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10576 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10577 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10578 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10579 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10580 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10581 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10582 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10583 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10584 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10585 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10586 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10587 {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
10588 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10589 {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10590 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10591 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10592 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10593 {.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
10594 {}
10595 };
10596 #define ALC225_STANDARD_PINS \
10597 {0x21, 0x04211020}
10598
10599 #define ALC256_STANDARD_PINS \
10600 {0x12, 0x90a60140}, \
10601 {0x14, 0x90170110}, \
10602 {0x21, 0x02211020}
10603
10604 #define ALC282_STANDARD_PINS \
10605 {0x14, 0x90170110}
10606
10607 #define ALC290_STANDARD_PINS \
10608 {0x12, 0x99a30130}
10609
10610 #define ALC292_STANDARD_PINS \
10611 {0x14, 0x90170110}, \
10612 {0x15, 0x0221401f}
10613
10614 #define ALC295_STANDARD_PINS \
10615 {0x12, 0xb7a60130}, \
10616 {0x14, 0x90170110}, \
10617 {0x21, 0x04211020}
10618
10619 #define ALC298_STANDARD_PINS \
10620 {0x12, 0x90a60130}, \
10621 {0x21, 0x03211020}
10622
10623 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10624 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10625 {0x14, 0x01014020},
10626 {0x17, 0x90170110},
10627 {0x18, 0x02a11030},
10628 {0x19, 0x0181303F},
10629 {0x21, 0x0221102f}),
10630 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10631 {0x12, 0x90a601c0},
10632 {0x14, 0x90171120},
10633 {0x21, 0x02211030}),
10634 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10635 {0x14, 0x90170110},
10636 {0x1b, 0x90a70130},
10637 {0x21, 0x03211020}),
10638 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10639 {0x1a, 0x90a70130},
10640 {0x1b, 0x90170110},
10641 {0x21, 0x03211020}),
10642 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10643 ALC225_STANDARD_PINS,
10644 {0x12, 0xb7a60130},
10645 {0x14, 0x901701a0}),
10646 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10647 ALC225_STANDARD_PINS,
10648 {0x12, 0xb7a60130},
10649 {0x14, 0x901701b0}),
10650 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10651 ALC225_STANDARD_PINS,
10652 {0x12, 0xb7a60150},
10653 {0x14, 0x901701a0}),
10654 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10655 ALC225_STANDARD_PINS,
10656 {0x12, 0xb7a60150},
10657 {0x14, 0x901701b0}),
10658 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10659 ALC225_STANDARD_PINS,
10660 {0x12, 0xb7a60130},
10661 {0x1b, 0x90170110}),
10662 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10663 {0x1b, 0x01111010},
10664 {0x1e, 0x01451130},
10665 {0x21, 0x02211020}),
10666 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10667 {0x12, 0x90a60140},
10668 {0x14, 0x90170110},
10669 {0x19, 0x02a11030},
10670 {0x21, 0x02211020}),
10671 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10672 {0x14, 0x90170110},
10673 {0x19, 0x02a11030},
10674 {0x1a, 0x02a11040},
10675 {0x1b, 0x01014020},
10676 {0x21, 0x0221101f}),
10677 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10678 {0x14, 0x90170110},
10679 {0x19, 0x02a11030},
10680 {0x1a, 0x02a11040},
10681 {0x1b, 0x01011020},
10682 {0x21, 0x0221101f}),
10683 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10684 {0x14, 0x90170110},
10685 {0x19, 0x02a11020},
10686 {0x1a, 0x02a11030},
10687 {0x21, 0x0221101f}),
10688 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10689 {0x21, 0x02211010}),
10690 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10691 {0x14, 0x90170110},
10692 {0x19, 0x02a11020},
10693 {0x21, 0x02211030}),
10694 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10695 {0x14, 0x90170110},
10696 {0x21, 0x02211020}),
10697 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10698 {0x14, 0x90170130},
10699 {0x21, 0x02211040}),
10700 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10701 {0x12, 0x90a60140},
10702 {0x14, 0x90170110},
10703 {0x21, 0x02211020}),
10704 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10705 {0x12, 0x90a60160},
10706 {0x14, 0x90170120},
10707 {0x21, 0x02211030}),
10708 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10709 {0x14, 0x90170110},
10710 {0x1b, 0x02011020},
10711 {0x21, 0x0221101f}),
10712 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10713 {0x14, 0x90170110},
10714 {0x1b, 0x01011020},
10715 {0x21, 0x0221101f}),
10716 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10717 {0x14, 0x90170130},
10718 {0x1b, 0x01014020},
10719 {0x21, 0x0221103f}),
10720 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10721 {0x14, 0x90170130},
10722 {0x1b, 0x01011020},
10723 {0x21, 0x0221103f}),
10724 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10725 {0x14, 0x90170130},
10726 {0x1b, 0x02011020},
10727 {0x21, 0x0221103f}),
10728 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10729 {0x14, 0x90170150},
10730 {0x1b, 0x02011020},
10731 {0x21, 0x0221105f}),
10732 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10733 {0x14, 0x90170110},
10734 {0x1b, 0x01014020},
10735 {0x21, 0x0221101f}),
10736 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10737 {0x12, 0x90a60160},
10738 {0x14, 0x90170120},
10739 {0x17, 0x90170140},
10740 {0x21, 0x0321102f}),
10741 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10742 {0x12, 0x90a60160},
10743 {0x14, 0x90170130},
10744 {0x21, 0x02211040}),
10745 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10746 {0x12, 0x90a60160},
10747 {0x14, 0x90170140},
10748 {0x21, 0x02211050}),
10749 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10750 {0x12, 0x90a60170},
10751 {0x14, 0x90170120},
10752 {0x21, 0x02211030}),
10753 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10754 {0x12, 0x90a60170},
10755 {0x14, 0x90170130},
10756 {0x21, 0x02211040}),
10757 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10758 {0x12, 0x90a60170},
10759 {0x14, 0x90171130},
10760 {0x21, 0x02211040}),
10761 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10762 {0x12, 0x90a60170},
10763 {0x14, 0x90170140},
10764 {0x21, 0x02211050}),
10765 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10766 {0x12, 0x90a60180},
10767 {0x14, 0x90170130},
10768 {0x21, 0x02211040}),
10769 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10770 {0x12, 0x90a60180},
10771 {0x14, 0x90170120},
10772 {0x21, 0x02211030}),
10773 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10774 {0x1b, 0x01011020},
10775 {0x21, 0x02211010}),
10776 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10777 {0x14, 0x90170110},
10778 {0x1b, 0x90a70130},
10779 {0x21, 0x04211020}),
10780 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10781 {0x14, 0x90170110},
10782 {0x1b, 0x90a70130},
10783 {0x21, 0x03211020}),
10784 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10785 {0x12, 0x90a60130},
10786 {0x14, 0x90170110},
10787 {0x21, 0x03211020}),
10788 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10789 {0x12, 0x90a60130},
10790 {0x14, 0x90170110},
10791 {0x21, 0x04211020}),
10792 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10793 {0x1a, 0x90a70130},
10794 {0x1b, 0x90170110},
10795 {0x21, 0x03211020}),
10796 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10797 {0x14, 0x90170110},
10798 {0x19, 0x02a11020},
10799 {0x21, 0x0221101f}),
10800 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10801 {0x17, 0x90170110},
10802 {0x19, 0x03a11030},
10803 {0x21, 0x03211020}),
10804 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10805 {0x12, 0x90a60130},
10806 {0x14, 0x90170110},
10807 {0x15, 0x0421101f},
10808 {0x1a, 0x04a11020}),
10809 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10810 {0x12, 0x90a60140},
10811 {0x14, 0x90170110},
10812 {0x15, 0x0421101f},
10813 {0x18, 0x02811030},
10814 {0x1a, 0x04a1103f},
10815 {0x1b, 0x02011020}),
10816 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10817 ALC282_STANDARD_PINS,
10818 {0x12, 0x99a30130},
10819 {0x19, 0x03a11020},
10820 {0x21, 0x0321101f}),
10821 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10822 ALC282_STANDARD_PINS,
10823 {0x12, 0x99a30130},
10824 {0x19, 0x03a11020},
10825 {0x21, 0x03211040}),
10826 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10827 ALC282_STANDARD_PINS,
10828 {0x12, 0x99a30130},
10829 {0x19, 0x03a11030},
10830 {0x21, 0x03211020}),
10831 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10832 ALC282_STANDARD_PINS,
10833 {0x12, 0x99a30130},
10834 {0x19, 0x04a11020},
10835 {0x21, 0x0421101f}),
10836 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10837 ALC282_STANDARD_PINS,
10838 {0x12, 0x90a60140},
10839 {0x19, 0x04a11030},
10840 {0x21, 0x04211020}),
10841 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10842 ALC282_STANDARD_PINS,
10843 {0x12, 0x90a609c0},
10844 {0x18, 0x03a11830},
10845 {0x19, 0x04a19831},
10846 {0x1a, 0x0481303f},
10847 {0x1b, 0x04211020},
10848 {0x21, 0x0321101f}),
10849 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10850 ALC282_STANDARD_PINS,
10851 {0x12, 0x90a60940},
10852 {0x18, 0x03a11830},
10853 {0x19, 0x04a19831},
10854 {0x1a, 0x0481303f},
10855 {0x1b, 0x04211020},
10856 {0x21, 0x0321101f}),
10857 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10858 ALC282_STANDARD_PINS,
10859 {0x12, 0x90a60130},
10860 {0x21, 0x0321101f}),
10861 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10862 {0x12, 0x90a60160},
10863 {0x14, 0x90170120},
10864 {0x21, 0x02211030}),
10865 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10866 ALC282_STANDARD_PINS,
10867 {0x12, 0x90a60130},
10868 {0x19, 0x03a11020},
10869 {0x21, 0x0321101f}),
10870 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10871 {0x12, 0x90a60130},
10872 {0x14, 0x90170110},
10873 {0x19, 0x04a11040},
10874 {0x21, 0x04211020}),
10875 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10876 {0x14, 0x90170110},
10877 {0x19, 0x04a11040},
10878 {0x1d, 0x40600001},
10879 {0x21, 0x04211020}),
10880 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10881 {0x14, 0x90170110},
10882 {0x19, 0x04a11040},
10883 {0x21, 0x04211020}),
10884 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10885 {0x14, 0x90170110},
10886 {0x17, 0x90170111},
10887 {0x19, 0x03a11030},
10888 {0x21, 0x03211020}),
10889 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10890 {0x17, 0x90170110},
10891 {0x19, 0x03a11030},
10892 {0x21, 0x03211020}),
10893 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10894 {0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
10895 {0x19, 0x04a11040},
10896 {0x21, 0x04211020}),
10897 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10898 {0x12, 0x90a60130},
10899 {0x17, 0x90170110},
10900 {0x21, 0x02211020}),
10901 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
10902 {0x12, 0x90a60120},
10903 {0x14, 0x90170110},
10904 {0x21, 0x0321101f}),
10905 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10906 ALC290_STANDARD_PINS,
10907 {0x15, 0x04211040},
10908 {0x18, 0x90170112},
10909 {0x1a, 0x04a11020}),
10910 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10911 ALC290_STANDARD_PINS,
10912 {0x15, 0x04211040},
10913 {0x18, 0x90170110},
10914 {0x1a, 0x04a11020}),
10915 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10916 ALC290_STANDARD_PINS,
10917 {0x15, 0x0421101f},
10918 {0x1a, 0x04a11020}),
10919 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10920 ALC290_STANDARD_PINS,
10921 {0x15, 0x04211020},
10922 {0x1a, 0x04a11040}),
10923 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10924 ALC290_STANDARD_PINS,
10925 {0x14, 0x90170110},
10926 {0x15, 0x04211020},
10927 {0x1a, 0x04a11040}),
10928 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10929 ALC290_STANDARD_PINS,
10930 {0x14, 0x90170110},
10931 {0x15, 0x04211020},
10932 {0x1a, 0x04a11020}),
10933 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10934 ALC290_STANDARD_PINS,
10935 {0x14, 0x90170110},
10936 {0x15, 0x0421101f},
10937 {0x1a, 0x04a11020}),
10938 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10939 ALC292_STANDARD_PINS,
10940 {0x12, 0x90a60140},
10941 {0x16, 0x01014020},
10942 {0x19, 0x01a19030}),
10943 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10944 ALC292_STANDARD_PINS,
10945 {0x12, 0x90a60140},
10946 {0x16, 0x01014020},
10947 {0x18, 0x02a19031},
10948 {0x19, 0x01a1903e}),
10949 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
10950 ALC292_STANDARD_PINS,
10951 {0x12, 0x90a60140}),
10952 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10953 ALC292_STANDARD_PINS,
10954 {0x13, 0x90a60140},
10955 {0x16, 0x21014020},
10956 {0x19, 0x21a19030}),
10957 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10958 ALC292_STANDARD_PINS,
10959 {0x13, 0x90a60140}),
10960 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
10961 {0x17, 0x90170110},
10962 {0x21, 0x04211020}),
10963 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
10964 {0x14, 0x90170110},
10965 {0x1b, 0x90a70130},
10966 {0x21, 0x04211020}),
10967 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10968 {0x12, 0x90a60130},
10969 {0x17, 0x90170110},
10970 {0x21, 0x03211020}),
10971 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10972 {0x12, 0x90a60130},
10973 {0x17, 0x90170110},
10974 {0x21, 0x04211020}),
10975 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10976 {0x12, 0x90a60130},
10977 {0x17, 0x90170110},
10978 {0x21, 0x03211020}),
10979 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10980 {0x12, 0x90a60120},
10981 {0x17, 0x90170110},
10982 {0x21, 0x04211030}),
10983 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10984 {0x12, 0x90a60130},
10985 {0x17, 0x90170110},
10986 {0x21, 0x03211020}),
10987 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10988 {0x12, 0x90a60130},
10989 {0x17, 0x90170110},
10990 {0x21, 0x03211020}),
10991 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10992 ALC298_STANDARD_PINS,
10993 {0x17, 0x90170110}),
10994 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10995 ALC298_STANDARD_PINS,
10996 {0x17, 0x90170140}),
10997 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10998 ALC298_STANDARD_PINS,
10999 {0x17, 0x90170150}),
11000 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11001 {0x12, 0xb7a60140},
11002 {0x13, 0xb7a60150},
11003 {0x17, 0x90170110},
11004 {0x1a, 0x03011020},
11005 {0x21, 0x03211030}),
11006 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11007 {0x12, 0xb7a60140},
11008 {0x17, 0x90170110},
11009 {0x1a, 0x03a11030},
11010 {0x21, 0x03211020}),
11011 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11012 ALC225_STANDARD_PINS,
11013 {0x12, 0xb7a60130},
11014 {0x17, 0x90170110}),
11015 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11016 {0x14, 0x01014010},
11017 {0x17, 0x90170120},
11018 {0x18, 0x02a11030},
11019 {0x19, 0x02a1103f},
11020 {0x21, 0x0221101f}),
11021 {}
11022 };
11023
11024 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11025 * more machines, don't need to match all valid pins, just need to match
11026 * all the pins defined in the tbl. Just because of this reason, it is possible
11027 * that a single machine matches multiple tbls, so there is one limitation:
11028 * at most one tbl is allowed to define for the same vendor and same codec
11029 */
11030 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11031 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11032 {0x19, 0x40000000}),
11033 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11034 {0x19, 0x40000000},
11035 {0x1b, 0x40000000}),
11036 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11037 {0x19, 0x40000000},
11038 {0x1b, 0x40000000}),
11039 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11040 {0x19, 0x40000000},
11041 {0x1a, 0x40000000}),
11042 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11043 {0x19, 0x40000000},
11044 {0x1a, 0x40000000}),
11045 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
11046 {0x19, 0x40000000},
11047 {0x1a, 0x40000000}),
11048 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11049 {0x19, 0x40000000}),
11050 {}
11051 };
11052
alc269_fill_coef(struct hda_codec * codec)11053 static void alc269_fill_coef(struct hda_codec *codec)
11054 {
11055 struct alc_spec *spec = codec->spec;
11056 int val;
11057
11058 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11059 return;
11060
11061 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11062 alc_write_coef_idx(codec, 0xf, 0x960b);
11063 alc_write_coef_idx(codec, 0xe, 0x8817);
11064 }
11065
11066 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11067 alc_write_coef_idx(codec, 0xf, 0x960b);
11068 alc_write_coef_idx(codec, 0xe, 0x8814);
11069 }
11070
11071 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11072 /* Power up output pin */
11073 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11074 }
11075
11076 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11077 val = alc_read_coef_idx(codec, 0xd);
11078 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11079 /* Capless ramp up clock control */
11080 alc_write_coef_idx(codec, 0xd, val | (1<<10));
11081 }
11082 val = alc_read_coef_idx(codec, 0x17);
11083 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11084 /* Class D power on reset */
11085 alc_write_coef_idx(codec, 0x17, val | (1<<7));
11086 }
11087 }
11088
11089 /* HP */
11090 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11091 }
11092
11093 /*
11094 */
patch_alc269(struct hda_codec * codec)11095 static int patch_alc269(struct hda_codec *codec)
11096 {
11097 struct alc_spec *spec;
11098 int err;
11099
11100 err = alc_alloc_spec(codec, 0x0b);
11101 if (err < 0)
11102 return err;
11103
11104 spec = codec->spec;
11105 spec->gen.shared_mic_vref_pin = 0x18;
11106 codec->power_save_node = 0;
11107 spec->en_3kpull_low = true;
11108
11109 #ifdef CONFIG_PM
11110 codec->patch_ops.suspend = alc269_suspend;
11111 codec->patch_ops.resume = alc269_resume;
11112 #endif
11113 spec->shutup = alc_default_shutup;
11114 spec->init_hook = alc_default_init;
11115
11116 switch (codec->core.vendor_id) {
11117 case 0x10ec0269:
11118 spec->codec_variant = ALC269_TYPE_ALC269VA;
11119 switch (alc_get_coef0(codec) & 0x00f0) {
11120 case 0x0010:
11121 if (codec->bus->pci &&
11122 codec->bus->pci->subsystem_vendor == 0x1025 &&
11123 spec->cdefine.platform_type == 1)
11124 err = alc_codec_rename(codec, "ALC271X");
11125 spec->codec_variant = ALC269_TYPE_ALC269VB;
11126 break;
11127 case 0x0020:
11128 if (codec->bus->pci &&
11129 codec->bus->pci->subsystem_vendor == 0x17aa &&
11130 codec->bus->pci->subsystem_device == 0x21f3)
11131 err = alc_codec_rename(codec, "ALC3202");
11132 spec->codec_variant = ALC269_TYPE_ALC269VC;
11133 break;
11134 case 0x0030:
11135 spec->codec_variant = ALC269_TYPE_ALC269VD;
11136 break;
11137 default:
11138 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11139 }
11140 if (err < 0)
11141 goto error;
11142 spec->shutup = alc269_shutup;
11143 spec->init_hook = alc269_fill_coef;
11144 alc269_fill_coef(codec);
11145 break;
11146
11147 case 0x10ec0280:
11148 case 0x10ec0290:
11149 spec->codec_variant = ALC269_TYPE_ALC280;
11150 break;
11151 case 0x10ec0282:
11152 spec->codec_variant = ALC269_TYPE_ALC282;
11153 spec->shutup = alc282_shutup;
11154 spec->init_hook = alc282_init;
11155 break;
11156 case 0x10ec0233:
11157 case 0x10ec0283:
11158 spec->codec_variant = ALC269_TYPE_ALC283;
11159 spec->shutup = alc283_shutup;
11160 spec->init_hook = alc283_init;
11161 break;
11162 case 0x10ec0284:
11163 case 0x10ec0292:
11164 spec->codec_variant = ALC269_TYPE_ALC284;
11165 break;
11166 case 0x10ec0293:
11167 spec->codec_variant = ALC269_TYPE_ALC293;
11168 break;
11169 case 0x10ec0286:
11170 case 0x10ec0288:
11171 spec->codec_variant = ALC269_TYPE_ALC286;
11172 break;
11173 case 0x10ec0298:
11174 spec->codec_variant = ALC269_TYPE_ALC298;
11175 break;
11176 case 0x10ec0235:
11177 case 0x10ec0255:
11178 spec->codec_variant = ALC269_TYPE_ALC255;
11179 spec->shutup = alc256_shutup;
11180 spec->init_hook = alc256_init;
11181 break;
11182 case 0x10ec0230:
11183 case 0x10ec0236:
11184 case 0x10ec0256:
11185 case 0x19e58326:
11186 spec->codec_variant = ALC269_TYPE_ALC256;
11187 spec->shutup = alc256_shutup;
11188 spec->init_hook = alc256_init;
11189 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11190 if (codec->core.vendor_id == 0x10ec0236 &&
11191 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11192 spec->en_3kpull_low = false;
11193 break;
11194 case 0x10ec0257:
11195 spec->codec_variant = ALC269_TYPE_ALC257;
11196 spec->shutup = alc256_shutup;
11197 spec->init_hook = alc256_init;
11198 spec->gen.mixer_nid = 0;
11199 spec->en_3kpull_low = false;
11200 break;
11201 case 0x10ec0215:
11202 case 0x10ec0245:
11203 case 0x10ec0285:
11204 case 0x10ec0289:
11205 if (alc_get_coef0(codec) & 0x0010)
11206 spec->codec_variant = ALC269_TYPE_ALC245;
11207 else
11208 spec->codec_variant = ALC269_TYPE_ALC215;
11209 spec->shutup = alc225_shutup;
11210 spec->init_hook = alc225_init;
11211 spec->gen.mixer_nid = 0;
11212 break;
11213 case 0x10ec0225:
11214 case 0x10ec0295:
11215 case 0x10ec0299:
11216 spec->codec_variant = ALC269_TYPE_ALC225;
11217 spec->shutup = alc225_shutup;
11218 spec->init_hook = alc225_init;
11219 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11220 break;
11221 case 0x10ec0287:
11222 spec->codec_variant = ALC269_TYPE_ALC287;
11223 spec->shutup = alc225_shutup;
11224 spec->init_hook = alc225_init;
11225 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11226 break;
11227 case 0x10ec0234:
11228 case 0x10ec0274:
11229 case 0x10ec0294:
11230 spec->codec_variant = ALC269_TYPE_ALC294;
11231 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11232 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11233 spec->init_hook = alc294_init;
11234 break;
11235 case 0x10ec0300:
11236 spec->codec_variant = ALC269_TYPE_ALC300;
11237 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11238 break;
11239 case 0x10ec0623:
11240 spec->codec_variant = ALC269_TYPE_ALC623;
11241 break;
11242 case 0x10ec0700:
11243 case 0x10ec0701:
11244 case 0x10ec0703:
11245 case 0x10ec0711:
11246 spec->codec_variant = ALC269_TYPE_ALC700;
11247 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11248 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11249 spec->init_hook = alc294_init;
11250 break;
11251
11252 }
11253
11254 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11255 spec->has_alc5505_dsp = 1;
11256 spec->init_hook = alc5505_dsp_init;
11257 }
11258
11259 alc_pre_init(codec);
11260
11261 snd_hda_pick_fixup(codec, alc269_fixup_models,
11262 alc269_fixup_tbl, alc269_fixups);
11263 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11264 * the quirk breaks the latter (bko#214101).
11265 * Clear the wrong entry.
11266 */
11267 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11268 codec->core.vendor_id == 0x10ec0294) {
11269 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11270 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11271 }
11272
11273 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11274 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11275 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
11276 alc269_fixups);
11277 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11278
11279 alc_auto_parse_customize_define(codec);
11280
11281 if (has_cdefine_beep(codec))
11282 spec->gen.beep_nid = 0x01;
11283
11284 /* automatic parse from the BIOS config */
11285 err = alc269_parse_auto_config(codec);
11286 if (err < 0)
11287 goto error;
11288
11289 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11290 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11291 if (err < 0)
11292 goto error;
11293 }
11294
11295 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11296
11297 return 0;
11298
11299 error:
11300 alc_free(codec);
11301 return err;
11302 }
11303
11304 /*
11305 * ALC861
11306 */
11307
alc861_parse_auto_config(struct hda_codec * codec)11308 static int alc861_parse_auto_config(struct hda_codec *codec)
11309 {
11310 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11311 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11312 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11313 }
11314
11315 /* Pin config fixes */
11316 enum {
11317 ALC861_FIXUP_FSC_AMILO_PI1505,
11318 ALC861_FIXUP_AMP_VREF_0F,
11319 ALC861_FIXUP_NO_JACK_DETECT,
11320 ALC861_FIXUP_ASUS_A6RP,
11321 ALC660_FIXUP_ASUS_W7J,
11322 };
11323
11324 /* 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)11325 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11326 const struct hda_fixup *fix, int action)
11327 {
11328 struct alc_spec *spec = codec->spec;
11329 unsigned int val;
11330
11331 if (action != HDA_FIXUP_ACT_INIT)
11332 return;
11333 val = snd_hda_codec_get_pin_target(codec, 0x0f);
11334 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11335 val |= AC_PINCTL_IN_EN;
11336 val |= AC_PINCTL_VREF_50;
11337 snd_hda_set_pin_ctl(codec, 0x0f, val);
11338 spec->gen.keep_vref_in_automute = 1;
11339 }
11340
11341 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)11342 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11343 const struct hda_fixup *fix, int action)
11344 {
11345 if (action == HDA_FIXUP_ACT_PRE_PROBE)
11346 codec->no_jack_detect = 1;
11347 }
11348
11349 static const struct hda_fixup alc861_fixups[] = {
11350 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
11351 .type = HDA_FIXUP_PINS,
11352 .v.pins = (const struct hda_pintbl[]) {
11353 { 0x0b, 0x0221101f }, /* HP */
11354 { 0x0f, 0x90170310 }, /* speaker */
11355 { }
11356 }
11357 },
11358 [ALC861_FIXUP_AMP_VREF_0F] = {
11359 .type = HDA_FIXUP_FUNC,
11360 .v.func = alc861_fixup_asus_amp_vref_0f,
11361 },
11362 [ALC861_FIXUP_NO_JACK_DETECT] = {
11363 .type = HDA_FIXUP_FUNC,
11364 .v.func = alc_fixup_no_jack_detect,
11365 },
11366 [ALC861_FIXUP_ASUS_A6RP] = {
11367 .type = HDA_FIXUP_FUNC,
11368 .v.func = alc861_fixup_asus_amp_vref_0f,
11369 .chained = true,
11370 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11371 },
11372 [ALC660_FIXUP_ASUS_W7J] = {
11373 .type = HDA_FIXUP_VERBS,
11374 .v.verbs = (const struct hda_verb[]) {
11375 /* ASUS W7J needs a magic pin setup on unused NID 0x10
11376 * for enabling outputs
11377 */
11378 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11379 { }
11380 },
11381 }
11382 };
11383
11384 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
11385 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11386 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11387 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11388 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11389 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11390 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11391 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11392 {}
11393 };
11394
11395 /*
11396 */
patch_alc861(struct hda_codec * codec)11397 static int patch_alc861(struct hda_codec *codec)
11398 {
11399 struct alc_spec *spec;
11400 int err;
11401
11402 err = alc_alloc_spec(codec, 0x15);
11403 if (err < 0)
11404 return err;
11405
11406 spec = codec->spec;
11407 if (has_cdefine_beep(codec))
11408 spec->gen.beep_nid = 0x23;
11409
11410 #ifdef CONFIG_PM
11411 spec->power_hook = alc_power_eapd;
11412 #endif
11413
11414 alc_pre_init(codec);
11415
11416 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11417 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11418
11419 /* automatic parse from the BIOS config */
11420 err = alc861_parse_auto_config(codec);
11421 if (err < 0)
11422 goto error;
11423
11424 if (!spec->gen.no_analog) {
11425 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11426 if (err < 0)
11427 goto error;
11428 }
11429
11430 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11431
11432 return 0;
11433
11434 error:
11435 alc_free(codec);
11436 return err;
11437 }
11438
11439 /*
11440 * ALC861-VD support
11441 *
11442 * Based on ALC882
11443 *
11444 * In addition, an independent DAC
11445 */
alc861vd_parse_auto_config(struct hda_codec * codec)11446 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11447 {
11448 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11449 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11450 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11451 }
11452
11453 enum {
11454 ALC660VD_FIX_ASUS_GPIO1,
11455 ALC861VD_FIX_DALLAS,
11456 };
11457
11458 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)11459 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11460 const struct hda_fixup *fix, int action)
11461 {
11462 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11463 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11464 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11465 }
11466 }
11467
11468 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11469 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11470 const struct hda_fixup *fix, int action)
11471 {
11472 struct alc_spec *spec = codec->spec;
11473
11474 if (action == HDA_FIXUP_ACT_PRE_PROBE)
11475 spec->gpio_mask |= 0x02;
11476 alc_fixup_gpio(codec, action, 0x01);
11477 }
11478
11479 static const struct hda_fixup alc861vd_fixups[] = {
11480 [ALC660VD_FIX_ASUS_GPIO1] = {
11481 .type = HDA_FIXUP_FUNC,
11482 .v.func = alc660vd_fixup_asus_gpio1,
11483 },
11484 [ALC861VD_FIX_DALLAS] = {
11485 .type = HDA_FIXUP_FUNC,
11486 .v.func = alc861vd_fixup_dallas,
11487 },
11488 };
11489
11490 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
11491 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11492 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11493 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11494 {}
11495 };
11496
11497 /*
11498 */
patch_alc861vd(struct hda_codec * codec)11499 static int patch_alc861vd(struct hda_codec *codec)
11500 {
11501 struct alc_spec *spec;
11502 int err;
11503
11504 err = alc_alloc_spec(codec, 0x0b);
11505 if (err < 0)
11506 return err;
11507
11508 spec = codec->spec;
11509 if (has_cdefine_beep(codec))
11510 spec->gen.beep_nid = 0x23;
11511
11512 spec->shutup = alc_eapd_shutup;
11513
11514 alc_pre_init(codec);
11515
11516 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11517 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11518
11519 /* automatic parse from the BIOS config */
11520 err = alc861vd_parse_auto_config(codec);
11521 if (err < 0)
11522 goto error;
11523
11524 if (!spec->gen.no_analog) {
11525 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11526 if (err < 0)
11527 goto error;
11528 }
11529
11530 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11531
11532 return 0;
11533
11534 error:
11535 alc_free(codec);
11536 return err;
11537 }
11538
11539 /*
11540 * ALC662 support
11541 *
11542 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11543 * configuration. Each pin widget can choose any input DACs and a mixer.
11544 * Each ADC is connected from a mixer of all inputs. This makes possible
11545 * 6-channel independent captures.
11546 *
11547 * In addition, an independent DAC for the multi-playback (not used in this
11548 * driver yet).
11549 */
11550
11551 /*
11552 * BIOS auto configuration
11553 */
11554
alc662_parse_auto_config(struct hda_codec * codec)11555 static int alc662_parse_auto_config(struct hda_codec *codec)
11556 {
11557 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11558 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11559 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11560 const hda_nid_t *ssids;
11561
11562 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11563 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11564 codec->core.vendor_id == 0x10ec0671)
11565 ssids = alc663_ssids;
11566 else
11567 ssids = alc662_ssids;
11568 return alc_parse_auto_config(codec, alc662_ignore, ssids);
11569 }
11570
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)11571 static void alc272_fixup_mario(struct hda_codec *codec,
11572 const struct hda_fixup *fix, int action)
11573 {
11574 if (action != HDA_FIXUP_ACT_PRE_PROBE)
11575 return;
11576 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11577 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11578 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11579 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11580 (0 << AC_AMPCAP_MUTE_SHIFT)))
11581 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11582 }
11583
11584 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11585 { .channels = 2,
11586 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11587 { .channels = 4,
11588 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11589 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11590 { }
11591 };
11592
11593 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)11594 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11595 const struct hda_fixup *fix, int action)
11596 {
11597 if (action == HDA_FIXUP_ACT_BUILD) {
11598 struct alc_spec *spec = codec->spec;
11599 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11600 }
11601 }
11602
11603 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)11604 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11605 hda_nid_t nid,
11606 unsigned int power_state)
11607 {
11608 struct alc_spec *spec = codec->spec;
11609 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11610 return AC_PWRST_D0;
11611 return power_state;
11612 }
11613
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11614 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11615 const struct hda_fixup *fix, int action)
11616 {
11617 struct alc_spec *spec = codec->spec;
11618
11619 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11620 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11621 spec->mute_led_polarity = 1;
11622 codec->power_filter = gpio_led_power_filter;
11623 }
11624 }
11625
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11626 static void alc662_usi_automute_hook(struct hda_codec *codec,
11627 struct hda_jack_callback *jack)
11628 {
11629 struct alc_spec *spec = codec->spec;
11630 int vref;
11631 msleep(200);
11632 snd_hda_gen_hp_automute(codec, jack);
11633
11634 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11635 msleep(100);
11636 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11637 vref);
11638 }
11639
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11640 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11641 const struct hda_fixup *fix, int action)
11642 {
11643 struct alc_spec *spec = codec->spec;
11644 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11645 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11646 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11647 }
11648 }
11649
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)11650 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11651 struct hda_jack_callback *cb)
11652 {
11653 /* surround speakers at 0x1b already get muted automatically when
11654 * headphones are plugged in, but we have to mute/unmute the remaining
11655 * channels manually:
11656 * 0x15 - front left/front right
11657 * 0x18 - front center/ LFE
11658 */
11659 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11660 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11661 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11662 } else {
11663 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11664 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11665 }
11666 }
11667
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)11668 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11669 const struct hda_fixup *fix, int action)
11670 {
11671 /* Pin 0x1b: shared headphones jack and surround speakers */
11672 if (!is_jack_detectable(codec, 0x1b))
11673 return;
11674
11675 switch (action) {
11676 case HDA_FIXUP_ACT_PRE_PROBE:
11677 snd_hda_jack_detect_enable_callback(codec, 0x1b,
11678 alc662_aspire_ethos_mute_speakers);
11679 /* subwoofer needs an extra GPIO setting to become audible */
11680 alc_setup_gpio(codec, 0x02);
11681 break;
11682 case HDA_FIXUP_ACT_INIT:
11683 /* Make sure to start in a correct state, i.e. if
11684 * headphones have been plugged in before powering up the system
11685 */
11686 alc662_aspire_ethos_mute_speakers(codec, NULL);
11687 break;
11688 }
11689 }
11690
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)11691 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11692 const struct hda_fixup *fix, int action)
11693 {
11694 struct alc_spec *spec = codec->spec;
11695
11696 static const struct hda_pintbl pincfgs[] = {
11697 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11698 { 0x1b, 0x0181304f },
11699 { }
11700 };
11701
11702 switch (action) {
11703 case HDA_FIXUP_ACT_PRE_PROBE:
11704 spec->gen.mixer_nid = 0;
11705 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11706 snd_hda_apply_pincfgs(codec, pincfgs);
11707 break;
11708 case HDA_FIXUP_ACT_INIT:
11709 alc_write_coef_idx(codec, 0x19, 0xa054);
11710 break;
11711 }
11712 }
11713
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11714 static void alc897_hp_automute_hook(struct hda_codec *codec,
11715 struct hda_jack_callback *jack)
11716 {
11717 struct alc_spec *spec = codec->spec;
11718 int vref;
11719
11720 snd_hda_gen_hp_automute(codec, jack);
11721 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11722 snd_hda_set_pin_ctl(codec, 0x1b, vref);
11723 }
11724
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11725 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11726 const struct hda_fixup *fix, int action)
11727 {
11728 struct alc_spec *spec = codec->spec;
11729 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11730 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11731 spec->no_shutup_pins = 1;
11732 }
11733 if (action == HDA_FIXUP_ACT_PROBE) {
11734 snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
11735 }
11736 }
11737
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)11738 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11739 const struct hda_fixup *fix, int action)
11740 {
11741 struct alc_spec *spec = codec->spec;
11742
11743 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11744 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11745 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11746 }
11747 }
11748
11749 static const struct coef_fw alc668_coefs[] = {
11750 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
11751 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
11752 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
11753 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11754 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11755 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11756 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
11757 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
11758 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11759 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11760 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11761 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11762 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
11763 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11764 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
11765 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
11766 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11767 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11768 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11769 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11770 {}
11771 };
11772
alc668_restore_default_value(struct hda_codec * codec)11773 static void alc668_restore_default_value(struct hda_codec *codec)
11774 {
11775 alc_process_coef_fw(codec, alc668_coefs);
11776 }
11777
11778 enum {
11779 ALC662_FIXUP_ASPIRE,
11780 ALC662_FIXUP_LED_GPIO1,
11781 ALC662_FIXUP_IDEAPAD,
11782 ALC272_FIXUP_MARIO,
11783 ALC662_FIXUP_CZC_ET26,
11784 ALC662_FIXUP_CZC_P10T,
11785 ALC662_FIXUP_SKU_IGNORE,
11786 ALC662_FIXUP_HP_RP5800,
11787 ALC662_FIXUP_ASUS_MODE1,
11788 ALC662_FIXUP_ASUS_MODE2,
11789 ALC662_FIXUP_ASUS_MODE3,
11790 ALC662_FIXUP_ASUS_MODE4,
11791 ALC662_FIXUP_ASUS_MODE5,
11792 ALC662_FIXUP_ASUS_MODE6,
11793 ALC662_FIXUP_ASUS_MODE7,
11794 ALC662_FIXUP_ASUS_MODE8,
11795 ALC662_FIXUP_NO_JACK_DETECT,
11796 ALC662_FIXUP_ZOTAC_Z68,
11797 ALC662_FIXUP_INV_DMIC,
11798 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11799 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11800 ALC662_FIXUP_HEADSET_MODE,
11801 ALC668_FIXUP_HEADSET_MODE,
11802 ALC662_FIXUP_BASS_MODE4_CHMAP,
11803 ALC662_FIXUP_BASS_16,
11804 ALC662_FIXUP_BASS_1A,
11805 ALC662_FIXUP_BASS_CHMAP,
11806 ALC668_FIXUP_AUTO_MUTE,
11807 ALC668_FIXUP_DELL_DISABLE_AAMIX,
11808 ALC668_FIXUP_DELL_XPS13,
11809 ALC662_FIXUP_ASUS_Nx50,
11810 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11811 ALC668_FIXUP_ASUS_Nx51,
11812 ALC668_FIXUP_MIC_COEF,
11813 ALC668_FIXUP_ASUS_G751,
11814 ALC891_FIXUP_HEADSET_MODE,
11815 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11816 ALC662_FIXUP_ACER_VERITON,
11817 ALC892_FIXUP_ASROCK_MOBO,
11818 ALC662_FIXUP_USI_FUNC,
11819 ALC662_FIXUP_USI_HEADSET_MODE,
11820 ALC662_FIXUP_LENOVO_MULTI_CODECS,
11821 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11822 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11823 ALC671_FIXUP_HP_HEADSET_MIC2,
11824 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11825 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11826 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11827 ALC668_FIXUP_HEADSET_MIC,
11828 ALC668_FIXUP_MIC_DET_COEF,
11829 ALC897_FIXUP_LENOVO_HEADSET_MIC,
11830 ALC897_FIXUP_HEADSET_MIC_PIN,
11831 ALC897_FIXUP_HP_HSMIC_VERB,
11832 ALC897_FIXUP_LENOVO_HEADSET_MODE,
11833 ALC897_FIXUP_HEADSET_MIC_PIN2,
11834 ALC897_FIXUP_UNIS_H3C_X500S,
11835 ALC897_FIXUP_HEADSET_MIC_PIN3,
11836 };
11837
11838 static const struct hda_fixup alc662_fixups[] = {
11839 [ALC662_FIXUP_ASPIRE] = {
11840 .type = HDA_FIXUP_PINS,
11841 .v.pins = (const struct hda_pintbl[]) {
11842 { 0x15, 0x99130112 }, /* subwoofer */
11843 { }
11844 }
11845 },
11846 [ALC662_FIXUP_LED_GPIO1] = {
11847 .type = HDA_FIXUP_FUNC,
11848 .v.func = alc662_fixup_led_gpio1,
11849 },
11850 [ALC662_FIXUP_IDEAPAD] = {
11851 .type = HDA_FIXUP_PINS,
11852 .v.pins = (const struct hda_pintbl[]) {
11853 { 0x17, 0x99130112 }, /* subwoofer */
11854 { }
11855 },
11856 .chained = true,
11857 .chain_id = ALC662_FIXUP_LED_GPIO1,
11858 },
11859 [ALC272_FIXUP_MARIO] = {
11860 .type = HDA_FIXUP_FUNC,
11861 .v.func = alc272_fixup_mario,
11862 },
11863 [ALC662_FIXUP_CZC_ET26] = {
11864 .type = HDA_FIXUP_PINS,
11865 .v.pins = (const struct hda_pintbl[]) {
11866 {0x12, 0x403cc000},
11867 {0x14, 0x90170110}, /* speaker */
11868 {0x15, 0x411111f0},
11869 {0x16, 0x411111f0},
11870 {0x18, 0x01a19030}, /* mic */
11871 {0x19, 0x90a7013f}, /* int-mic */
11872 {0x1a, 0x01014020},
11873 {0x1b, 0x0121401f},
11874 {0x1c, 0x411111f0},
11875 {0x1d, 0x411111f0},
11876 {0x1e, 0x40478e35},
11877 {}
11878 },
11879 .chained = true,
11880 .chain_id = ALC662_FIXUP_SKU_IGNORE
11881 },
11882 [ALC662_FIXUP_CZC_P10T] = {
11883 .type = HDA_FIXUP_VERBS,
11884 .v.verbs = (const struct hda_verb[]) {
11885 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11886 {}
11887 }
11888 },
11889 [ALC662_FIXUP_SKU_IGNORE] = {
11890 .type = HDA_FIXUP_FUNC,
11891 .v.func = alc_fixup_sku_ignore,
11892 },
11893 [ALC662_FIXUP_HP_RP5800] = {
11894 .type = HDA_FIXUP_PINS,
11895 .v.pins = (const struct hda_pintbl[]) {
11896 { 0x14, 0x0221201f }, /* HP out */
11897 { }
11898 },
11899 .chained = true,
11900 .chain_id = ALC662_FIXUP_SKU_IGNORE
11901 },
11902 [ALC662_FIXUP_ASUS_MODE1] = {
11903 .type = HDA_FIXUP_PINS,
11904 .v.pins = (const struct hda_pintbl[]) {
11905 { 0x14, 0x99130110 }, /* speaker */
11906 { 0x18, 0x01a19c20 }, /* mic */
11907 { 0x19, 0x99a3092f }, /* int-mic */
11908 { 0x21, 0x0121401f }, /* HP out */
11909 { }
11910 },
11911 .chained = true,
11912 .chain_id = ALC662_FIXUP_SKU_IGNORE
11913 },
11914 [ALC662_FIXUP_ASUS_MODE2] = {
11915 .type = HDA_FIXUP_PINS,
11916 .v.pins = (const struct hda_pintbl[]) {
11917 { 0x14, 0x99130110 }, /* speaker */
11918 { 0x18, 0x01a19820 }, /* mic */
11919 { 0x19, 0x99a3092f }, /* int-mic */
11920 { 0x1b, 0x0121401f }, /* HP out */
11921 { }
11922 },
11923 .chained = true,
11924 .chain_id = ALC662_FIXUP_SKU_IGNORE
11925 },
11926 [ALC662_FIXUP_ASUS_MODE3] = {
11927 .type = HDA_FIXUP_PINS,
11928 .v.pins = (const struct hda_pintbl[]) {
11929 { 0x14, 0x99130110 }, /* speaker */
11930 { 0x15, 0x0121441f }, /* HP */
11931 { 0x18, 0x01a19840 }, /* mic */
11932 { 0x19, 0x99a3094f }, /* int-mic */
11933 { 0x21, 0x01211420 }, /* HP2 */
11934 { }
11935 },
11936 .chained = true,
11937 .chain_id = ALC662_FIXUP_SKU_IGNORE
11938 },
11939 [ALC662_FIXUP_ASUS_MODE4] = {
11940 .type = HDA_FIXUP_PINS,
11941 .v.pins = (const struct hda_pintbl[]) {
11942 { 0x14, 0x99130110 }, /* speaker */
11943 { 0x16, 0x99130111 }, /* speaker */
11944 { 0x18, 0x01a19840 }, /* mic */
11945 { 0x19, 0x99a3094f }, /* int-mic */
11946 { 0x21, 0x0121441f }, /* HP */
11947 { }
11948 },
11949 .chained = true,
11950 .chain_id = ALC662_FIXUP_SKU_IGNORE
11951 },
11952 [ALC662_FIXUP_ASUS_MODE5] = {
11953 .type = HDA_FIXUP_PINS,
11954 .v.pins = (const struct hda_pintbl[]) {
11955 { 0x14, 0x99130110 }, /* speaker */
11956 { 0x15, 0x0121441f }, /* HP */
11957 { 0x16, 0x99130111 }, /* speaker */
11958 { 0x18, 0x01a19840 }, /* mic */
11959 { 0x19, 0x99a3094f }, /* int-mic */
11960 { }
11961 },
11962 .chained = true,
11963 .chain_id = ALC662_FIXUP_SKU_IGNORE
11964 },
11965 [ALC662_FIXUP_ASUS_MODE6] = {
11966 .type = HDA_FIXUP_PINS,
11967 .v.pins = (const struct hda_pintbl[]) {
11968 { 0x14, 0x99130110 }, /* speaker */
11969 { 0x15, 0x01211420 }, /* HP2 */
11970 { 0x18, 0x01a19840 }, /* mic */
11971 { 0x19, 0x99a3094f }, /* int-mic */
11972 { 0x1b, 0x0121441f }, /* HP */
11973 { }
11974 },
11975 .chained = true,
11976 .chain_id = ALC662_FIXUP_SKU_IGNORE
11977 },
11978 [ALC662_FIXUP_ASUS_MODE7] = {
11979 .type = HDA_FIXUP_PINS,
11980 .v.pins = (const struct hda_pintbl[]) {
11981 { 0x14, 0x99130110 }, /* speaker */
11982 { 0x17, 0x99130111 }, /* speaker */
11983 { 0x18, 0x01a19840 }, /* mic */
11984 { 0x19, 0x99a3094f }, /* int-mic */
11985 { 0x1b, 0x01214020 }, /* HP */
11986 { 0x21, 0x0121401f }, /* HP */
11987 { }
11988 },
11989 .chained = true,
11990 .chain_id = ALC662_FIXUP_SKU_IGNORE
11991 },
11992 [ALC662_FIXUP_ASUS_MODE8] = {
11993 .type = HDA_FIXUP_PINS,
11994 .v.pins = (const struct hda_pintbl[]) {
11995 { 0x14, 0x99130110 }, /* speaker */
11996 { 0x12, 0x99a30970 }, /* int-mic */
11997 { 0x15, 0x01214020 }, /* HP */
11998 { 0x17, 0x99130111 }, /* speaker */
11999 { 0x18, 0x01a19840 }, /* mic */
12000 { 0x21, 0x0121401f }, /* HP */
12001 { }
12002 },
12003 .chained = true,
12004 .chain_id = ALC662_FIXUP_SKU_IGNORE
12005 },
12006 [ALC662_FIXUP_NO_JACK_DETECT] = {
12007 .type = HDA_FIXUP_FUNC,
12008 .v.func = alc_fixup_no_jack_detect,
12009 },
12010 [ALC662_FIXUP_ZOTAC_Z68] = {
12011 .type = HDA_FIXUP_PINS,
12012 .v.pins = (const struct hda_pintbl[]) {
12013 { 0x1b, 0x02214020 }, /* Front HP */
12014 { }
12015 }
12016 },
12017 [ALC662_FIXUP_INV_DMIC] = {
12018 .type = HDA_FIXUP_FUNC,
12019 .v.func = alc_fixup_inv_dmic,
12020 },
12021 [ALC668_FIXUP_DELL_XPS13] = {
12022 .type = HDA_FIXUP_FUNC,
12023 .v.func = alc_fixup_dell_xps13,
12024 .chained = true,
12025 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12026 },
12027 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12028 .type = HDA_FIXUP_FUNC,
12029 .v.func = alc_fixup_disable_aamix,
12030 .chained = true,
12031 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12032 },
12033 [ALC668_FIXUP_AUTO_MUTE] = {
12034 .type = HDA_FIXUP_FUNC,
12035 .v.func = alc_fixup_auto_mute_via_amp,
12036 .chained = true,
12037 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12038 },
12039 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12040 .type = HDA_FIXUP_PINS,
12041 .v.pins = (const struct hda_pintbl[]) {
12042 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12043 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12044 { }
12045 },
12046 .chained = true,
12047 .chain_id = ALC662_FIXUP_HEADSET_MODE
12048 },
12049 [ALC662_FIXUP_HEADSET_MODE] = {
12050 .type = HDA_FIXUP_FUNC,
12051 .v.func = alc_fixup_headset_mode_alc662,
12052 },
12053 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12054 .type = HDA_FIXUP_PINS,
12055 .v.pins = (const struct hda_pintbl[]) {
12056 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12057 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12058 { }
12059 },
12060 .chained = true,
12061 .chain_id = ALC668_FIXUP_HEADSET_MODE
12062 },
12063 [ALC668_FIXUP_HEADSET_MODE] = {
12064 .type = HDA_FIXUP_FUNC,
12065 .v.func = alc_fixup_headset_mode_alc668,
12066 },
12067 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12068 .type = HDA_FIXUP_FUNC,
12069 .v.func = alc_fixup_bass_chmap,
12070 .chained = true,
12071 .chain_id = ALC662_FIXUP_ASUS_MODE4
12072 },
12073 [ALC662_FIXUP_BASS_16] = {
12074 .type = HDA_FIXUP_PINS,
12075 .v.pins = (const struct hda_pintbl[]) {
12076 {0x16, 0x80106111}, /* bass speaker */
12077 {}
12078 },
12079 .chained = true,
12080 .chain_id = ALC662_FIXUP_BASS_CHMAP,
12081 },
12082 [ALC662_FIXUP_BASS_1A] = {
12083 .type = HDA_FIXUP_PINS,
12084 .v.pins = (const struct hda_pintbl[]) {
12085 {0x1a, 0x80106111}, /* bass speaker */
12086 {}
12087 },
12088 .chained = true,
12089 .chain_id = ALC662_FIXUP_BASS_CHMAP,
12090 },
12091 [ALC662_FIXUP_BASS_CHMAP] = {
12092 .type = HDA_FIXUP_FUNC,
12093 .v.func = alc_fixup_bass_chmap,
12094 },
12095 [ALC662_FIXUP_ASUS_Nx50] = {
12096 .type = HDA_FIXUP_FUNC,
12097 .v.func = alc_fixup_auto_mute_via_amp,
12098 .chained = true,
12099 .chain_id = ALC662_FIXUP_BASS_1A
12100 },
12101 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12102 .type = HDA_FIXUP_FUNC,
12103 .v.func = alc_fixup_headset_mode_alc668,
12104 .chain_id = ALC662_FIXUP_BASS_CHMAP
12105 },
12106 [ALC668_FIXUP_ASUS_Nx51] = {
12107 .type = HDA_FIXUP_PINS,
12108 .v.pins = (const struct hda_pintbl[]) {
12109 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12110 { 0x1a, 0x90170151 }, /* bass speaker */
12111 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12112 {}
12113 },
12114 .chained = true,
12115 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12116 },
12117 [ALC668_FIXUP_MIC_COEF] = {
12118 .type = HDA_FIXUP_VERBS,
12119 .v.verbs = (const struct hda_verb[]) {
12120 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12121 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12122 {}
12123 },
12124 },
12125 [ALC668_FIXUP_ASUS_G751] = {
12126 .type = HDA_FIXUP_PINS,
12127 .v.pins = (const struct hda_pintbl[]) {
12128 { 0x16, 0x0421101f }, /* HP */
12129 {}
12130 },
12131 .chained = true,
12132 .chain_id = ALC668_FIXUP_MIC_COEF
12133 },
12134 [ALC891_FIXUP_HEADSET_MODE] = {
12135 .type = HDA_FIXUP_FUNC,
12136 .v.func = alc_fixup_headset_mode,
12137 },
12138 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12139 .type = HDA_FIXUP_PINS,
12140 .v.pins = (const struct hda_pintbl[]) {
12141 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12142 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12143 { }
12144 },
12145 .chained = true,
12146 .chain_id = ALC891_FIXUP_HEADSET_MODE
12147 },
12148 [ALC662_FIXUP_ACER_VERITON] = {
12149 .type = HDA_FIXUP_PINS,
12150 .v.pins = (const struct hda_pintbl[]) {
12151 { 0x15, 0x50170120 }, /* no internal speaker */
12152 { }
12153 }
12154 },
12155 [ALC892_FIXUP_ASROCK_MOBO] = {
12156 .type = HDA_FIXUP_PINS,
12157 .v.pins = (const struct hda_pintbl[]) {
12158 { 0x15, 0x40f000f0 }, /* disabled */
12159 { 0x16, 0x40f000f0 }, /* disabled */
12160 { }
12161 }
12162 },
12163 [ALC662_FIXUP_USI_FUNC] = {
12164 .type = HDA_FIXUP_FUNC,
12165 .v.func = alc662_fixup_usi_headset_mic,
12166 },
12167 [ALC662_FIXUP_USI_HEADSET_MODE] = {
12168 .type = HDA_FIXUP_PINS,
12169 .v.pins = (const struct hda_pintbl[]) {
12170 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12171 { 0x18, 0x01a1903d },
12172 { }
12173 },
12174 .chained = true,
12175 .chain_id = ALC662_FIXUP_USI_FUNC
12176 },
12177 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12178 .type = HDA_FIXUP_FUNC,
12179 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12180 },
12181 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12182 .type = HDA_FIXUP_FUNC,
12183 .v.func = alc662_fixup_aspire_ethos_hp,
12184 },
12185 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12186 .type = HDA_FIXUP_PINS,
12187 .v.pins = (const struct hda_pintbl[]) {
12188 { 0x15, 0x92130110 }, /* front speakers */
12189 { 0x18, 0x99130111 }, /* center/subwoofer */
12190 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
12191 { }
12192 },
12193 .chained = true,
12194 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12195 },
12196 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
12197 .type = HDA_FIXUP_FUNC,
12198 .v.func = alc671_fixup_hp_headset_mic2,
12199 },
12200 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12201 .type = HDA_FIXUP_PINS,
12202 .v.pins = (const struct hda_pintbl[]) {
12203 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12204 { }
12205 },
12206 .chained = true,
12207 .chain_id = ALC662_FIXUP_USI_FUNC
12208 },
12209 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12210 .type = HDA_FIXUP_PINS,
12211 .v.pins = (const struct hda_pintbl[]) {
12212 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12213 { 0x1b, 0x0221144f },
12214 { }
12215 },
12216 .chained = true,
12217 .chain_id = ALC662_FIXUP_USI_FUNC
12218 },
12219 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12220 .type = HDA_FIXUP_PINS,
12221 .v.pins = (const struct hda_pintbl[]) {
12222 { 0x1b, 0x04a1112c },
12223 { }
12224 },
12225 .chained = true,
12226 .chain_id = ALC668_FIXUP_HEADSET_MIC
12227 },
12228 [ALC668_FIXUP_HEADSET_MIC] = {
12229 .type = HDA_FIXUP_FUNC,
12230 .v.func = alc269_fixup_headset_mic,
12231 .chained = true,
12232 .chain_id = ALC668_FIXUP_MIC_DET_COEF
12233 },
12234 [ALC668_FIXUP_MIC_DET_COEF] = {
12235 .type = HDA_FIXUP_VERBS,
12236 .v.verbs = (const struct hda_verb[]) {
12237 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12238 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12239 {}
12240 },
12241 },
12242 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12243 .type = HDA_FIXUP_FUNC,
12244 .v.func = alc897_fixup_lenovo_headset_mic,
12245 },
12246 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
12247 .type = HDA_FIXUP_PINS,
12248 .v.pins = (const struct hda_pintbl[]) {
12249 { 0x1a, 0x03a11050 },
12250 { }
12251 },
12252 .chained = true,
12253 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12254 },
12255 [ALC897_FIXUP_HP_HSMIC_VERB] = {
12256 .type = HDA_FIXUP_PINS,
12257 .v.pins = (const struct hda_pintbl[]) {
12258 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12259 { }
12260 },
12261 },
12262 [ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12263 .type = HDA_FIXUP_FUNC,
12264 .v.func = alc897_fixup_lenovo_headset_mode,
12265 },
12266 [ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12267 .type = HDA_FIXUP_PINS,
12268 .v.pins = (const struct hda_pintbl[]) {
12269 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12270 { }
12271 },
12272 .chained = true,
12273 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12274 },
12275 [ALC897_FIXUP_UNIS_H3C_X500S] = {
12276 .type = HDA_FIXUP_VERBS,
12277 .v.verbs = (const struct hda_verb[]) {
12278 { 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12279 {}
12280 },
12281 },
12282 [ALC897_FIXUP_HEADSET_MIC_PIN3] = {
12283 .type = HDA_FIXUP_PINS,
12284 .v.pins = (const struct hda_pintbl[]) {
12285 { 0x19, 0x03a11050 }, /* use as headset mic */
12286 { }
12287 },
12288 },
12289 };
12290
12291 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
12292 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12293 SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
12294 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12295 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12296 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12297 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12298 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12299 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12300 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12301 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12302 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12303 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12304 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12305 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12306 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12307 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12308 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12309 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12310 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12311 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12312 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12313 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12314 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12315 SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12316 SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12317 SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12318 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12319 SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12320 SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12321 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12322 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12323 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12324 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12325 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12326 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12327 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12328 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12329 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12330 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12331 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12332 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12333 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12334 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12335 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12336 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12337 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12338 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12339 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12340 SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12341 SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12342 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12343 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12344 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12345 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12346 SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12347 SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12348 SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12349 SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12350 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12351 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12352 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12353 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12354 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12355 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12356 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12357 SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12358
12359 #if 0
12360 /* Below is a quirk table taken from the old code.
12361 * Basically the device should work as is without the fixup table.
12362 * If BIOS doesn't give a proper info, enable the corresponding
12363 * fixup entry.
12364 */
12365 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12366 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12367 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12368 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12369 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12370 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12371 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12372 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12373 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12374 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12375 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12376 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12377 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12378 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12379 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12380 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12381 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12382 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12383 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12384 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12385 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12386 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12387 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12388 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12389 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12390 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12391 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12392 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12393 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12394 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12395 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12396 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12397 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12398 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12399 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12400 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12401 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12402 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12403 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12404 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12405 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12406 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12407 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12408 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12409 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12410 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12411 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12412 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12413 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12414 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12415 #endif
12416 {}
12417 };
12418
12419 static const struct hda_model_fixup alc662_fixup_models[] = {
12420 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12421 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12422 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
12423 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12424 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12425 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12426 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12427 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12428 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12429 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12430 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12431 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12432 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12433 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12434 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12435 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12436 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12437 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12438 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12439 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12440 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12441 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12442 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12443 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12444 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12445 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12446 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12447 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12448 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12449 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12450 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12451 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12452 {.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12453 {}
12454 };
12455
12456 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12457 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12458 {0x17, 0x02211010},
12459 {0x18, 0x01a19030},
12460 {0x1a, 0x01813040},
12461 {0x21, 0x01014020}),
12462 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12463 {0x16, 0x01813030},
12464 {0x17, 0x02211010},
12465 {0x18, 0x01a19040},
12466 {0x21, 0x01014020}),
12467 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12468 {0x14, 0x01014010},
12469 {0x18, 0x01a19020},
12470 {0x1a, 0x0181302f},
12471 {0x1b, 0x0221401f}),
12472 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12473 {0x12, 0x99a30130},
12474 {0x14, 0x90170110},
12475 {0x15, 0x0321101f},
12476 {0x16, 0x03011020}),
12477 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12478 {0x12, 0x99a30140},
12479 {0x14, 0x90170110},
12480 {0x15, 0x0321101f},
12481 {0x16, 0x03011020}),
12482 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12483 {0x12, 0x99a30150},
12484 {0x14, 0x90170110},
12485 {0x15, 0x0321101f},
12486 {0x16, 0x03011020}),
12487 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12488 {0x14, 0x90170110},
12489 {0x15, 0x0321101f},
12490 {0x16, 0x03011020}),
12491 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12492 {0x12, 0x90a60130},
12493 {0x14, 0x90170110},
12494 {0x15, 0x0321101f}),
12495 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12496 {0x14, 0x01014010},
12497 {0x17, 0x90170150},
12498 {0x19, 0x02a11060},
12499 {0x1b, 0x01813030},
12500 {0x21, 0x02211020}),
12501 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12502 {0x14, 0x01014010},
12503 {0x18, 0x01a19040},
12504 {0x1b, 0x01813030},
12505 {0x21, 0x02211020}),
12506 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12507 {0x14, 0x01014020},
12508 {0x17, 0x90170110},
12509 {0x18, 0x01a19050},
12510 {0x1b, 0x01813040},
12511 {0x21, 0x02211030}),
12512 {}
12513 };
12514
12515 /*
12516 */
patch_alc662(struct hda_codec * codec)12517 static int patch_alc662(struct hda_codec *codec)
12518 {
12519 struct alc_spec *spec;
12520 int err;
12521
12522 err = alc_alloc_spec(codec, 0x0b);
12523 if (err < 0)
12524 return err;
12525
12526 spec = codec->spec;
12527
12528 spec->shutup = alc_eapd_shutup;
12529
12530 /* handle multiple HPs as is */
12531 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12532
12533 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12534
12535 switch (codec->core.vendor_id) {
12536 case 0x10ec0668:
12537 spec->init_hook = alc668_restore_default_value;
12538 break;
12539 }
12540
12541 alc_pre_init(codec);
12542
12543 snd_hda_pick_fixup(codec, alc662_fixup_models,
12544 alc662_fixup_tbl, alc662_fixups);
12545 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12546 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12547
12548 alc_auto_parse_customize_define(codec);
12549
12550 if (has_cdefine_beep(codec))
12551 spec->gen.beep_nid = 0x01;
12552
12553 if ((alc_get_coef0(codec) & (1 << 14)) &&
12554 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12555 spec->cdefine.platform_type == 1) {
12556 err = alc_codec_rename(codec, "ALC272X");
12557 if (err < 0)
12558 goto error;
12559 }
12560
12561 /* automatic parse from the BIOS config */
12562 err = alc662_parse_auto_config(codec);
12563 if (err < 0)
12564 goto error;
12565
12566 if (!spec->gen.no_analog && spec->gen.beep_nid) {
12567 switch (codec->core.vendor_id) {
12568 case 0x10ec0662:
12569 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12570 break;
12571 case 0x10ec0272:
12572 case 0x10ec0663:
12573 case 0x10ec0665:
12574 case 0x10ec0668:
12575 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12576 break;
12577 case 0x10ec0273:
12578 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12579 break;
12580 }
12581 if (err < 0)
12582 goto error;
12583 }
12584
12585 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12586
12587 return 0;
12588
12589 error:
12590 alc_free(codec);
12591 return err;
12592 }
12593
12594 /*
12595 * ALC680 support
12596 */
12597
alc680_parse_auto_config(struct hda_codec * codec)12598 static int alc680_parse_auto_config(struct hda_codec *codec)
12599 {
12600 return alc_parse_auto_config(codec, NULL, NULL);
12601 }
12602
12603 /*
12604 */
patch_alc680(struct hda_codec * codec)12605 static int patch_alc680(struct hda_codec *codec)
12606 {
12607 int err;
12608
12609 /* ALC680 has no aa-loopback mixer */
12610 err = alc_alloc_spec(codec, 0);
12611 if (err < 0)
12612 return err;
12613
12614 /* automatic parse from the BIOS config */
12615 err = alc680_parse_auto_config(codec);
12616 if (err < 0) {
12617 alc_free(codec);
12618 return err;
12619 }
12620
12621 return 0;
12622 }
12623
12624 /*
12625 * patch entries
12626 */
12627 static const struct hda_device_id snd_hda_id_realtek[] = {
12628 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12629 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12630 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12631 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12632 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12633 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12634 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12635 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12636 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12637 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12638 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12639 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12640 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12641 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12642 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12643 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12644 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12645 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12646 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12647 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12648 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12649 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12650 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12651 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12652 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12653 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12654 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12655 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12656 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12657 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12658 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12659 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12660 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12661 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12662 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12663 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12664 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12665 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12666 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12667 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12668 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12669 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12670 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12671 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12672 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12673 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12674 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12675 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12676 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12677 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12678 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12679 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12680 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12681 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12682 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12683 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12684 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12685 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12686 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12687 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12688 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12689 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12690 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12691 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12692 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12693 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12694 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12695 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12696 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12697 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12698 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12699 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12700 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12701 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12702 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12703 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12704 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12705 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12706 HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12707 {} /* terminator */
12708 };
12709 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12710
12711 MODULE_LICENSE("GPL");
12712 MODULE_DESCRIPTION("Realtek HD-audio codec");
12713
12714 static struct hda_codec_driver realtek_driver = {
12715 .id = snd_hda_id_realtek,
12716 };
12717
12718 module_hda_codec_driver(realtek_driver);
12719