1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
5 * HD audio interface patch for Realtek ALC codecs
6 *
7 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
9 * Takashi Iwai <tiwai@suse.de>
10 * Jonathan Woithe <jwoithe@just42.net>
11 */
12
13 #include <linux/init.h>
14 #include <linux/delay.h>
15 #include <linux/slab.h>
16 #include <linux/pci.h>
17 #include <linux/dmi.h>
18 #include <linux/module.h>
19 #include <linux/input.h>
20 #include <linux/leds.h>
21 #include <linux/ctype.h>
22 #include <sound/core.h>
23 #include <sound/jack.h>
24 #include <sound/hda_codec.h>
25 #include "hda_local.h"
26 #include "hda_auto_parser.h"
27 #include "hda_jack.h"
28 #include "hda_generic.h"
29 #include "hda_component.h"
30
31 /* keep halting ALC5505 DSP, for power saving */
32 #define HALT_REALTEK_ALC5505
33
34 /* extra amp-initialization sequence types */
35 enum {
36 ALC_INIT_UNDEFINED,
37 ALC_INIT_NONE,
38 ALC_INIT_DEFAULT,
39 };
40
41 enum {
42 ALC_HEADSET_MODE_UNKNOWN,
43 ALC_HEADSET_MODE_UNPLUGGED,
44 ALC_HEADSET_MODE_HEADSET,
45 ALC_HEADSET_MODE_MIC,
46 ALC_HEADSET_MODE_HEADPHONE,
47 };
48
49 enum {
50 ALC_HEADSET_TYPE_UNKNOWN,
51 ALC_HEADSET_TYPE_CTIA,
52 ALC_HEADSET_TYPE_OMTP,
53 };
54
55 enum {
56 ALC_KEY_MICMUTE_INDEX,
57 };
58
59 struct alc_customize_define {
60 unsigned int sku_cfg;
61 unsigned char port_connectivity;
62 unsigned char check_sum;
63 unsigned char customization;
64 unsigned char external_amp;
65 unsigned int enable_pcbeep:1;
66 unsigned int platform_type:1;
67 unsigned int swap:1;
68 unsigned int override:1;
69 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
70 };
71
72 struct alc_coef_led {
73 unsigned int idx;
74 unsigned int mask;
75 unsigned int on;
76 unsigned int off;
77 };
78
79 struct alc_spec {
80 struct hda_gen_spec gen; /* must be at head */
81
82 /* codec parameterization */
83 struct alc_customize_define cdefine;
84 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
85
86 /* GPIO bits */
87 unsigned int gpio_mask;
88 unsigned int gpio_dir;
89 unsigned int gpio_data;
90 bool gpio_write_delay; /* add a delay before writing gpio_data */
91
92 /* mute LED for HP laptops, see vref_mute_led_set() */
93 int mute_led_polarity;
94 int micmute_led_polarity;
95 hda_nid_t mute_led_nid;
96 hda_nid_t cap_mute_led_nid;
97
98 unsigned int gpio_mute_led_mask;
99 unsigned int gpio_mic_led_mask;
100 struct alc_coef_led mute_led_coef;
101 struct alc_coef_led mic_led_coef;
102 struct mutex coef_mutex;
103
104 hda_nid_t headset_mic_pin;
105 hda_nid_t headphone_mic_pin;
106 int current_headset_mode;
107 int current_headset_type;
108
109 /* hooks */
110 void (*init_hook)(struct hda_codec *codec);
111 #ifdef CONFIG_PM
112 void (*power_hook)(struct hda_codec *codec);
113 #endif
114 void (*shutup)(struct hda_codec *codec);
115
116 int init_amp;
117 int codec_variant; /* flag for other variants */
118 unsigned int has_alc5505_dsp:1;
119 unsigned int no_depop_delay:1;
120 unsigned int done_hp_init:1;
121 unsigned int no_shutup_pins:1;
122 unsigned int ultra_low_power:1;
123 unsigned int has_hs_key:1;
124 unsigned int no_internal_mic_pin:1;
125 unsigned int en_3kpull_low:1;
126
127 /* for PLL fix */
128 hda_nid_t pll_nid;
129 unsigned int pll_coef_idx, pll_coef_bit;
130 unsigned int coef0;
131 struct input_dev *kb_dev;
132 u8 alc_mute_keycode_map[1];
133
134 /* component binding */
135 struct component_match *match;
136 struct hda_component comps[HDA_MAX_COMPONENTS];
137 };
138
139 /*
140 * COEF access helper functions
141 */
142
coef_mutex_lock(struct hda_codec * codec)143 static void coef_mutex_lock(struct hda_codec *codec)
144 {
145 struct alc_spec *spec = codec->spec;
146
147 snd_hda_power_up_pm(codec);
148 mutex_lock(&spec->coef_mutex);
149 }
150
coef_mutex_unlock(struct hda_codec * codec)151 static void coef_mutex_unlock(struct hda_codec *codec)
152 {
153 struct alc_spec *spec = codec->spec;
154
155 mutex_unlock(&spec->coef_mutex);
156 snd_hda_power_down_pm(codec);
157 }
158
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)159 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 unsigned int coef_idx)
161 {
162 unsigned int val;
163
164 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
165 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
166 return val;
167 }
168
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)169 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
170 unsigned int coef_idx)
171 {
172 unsigned int val;
173
174 coef_mutex_lock(codec);
175 val = __alc_read_coefex_idx(codec, nid, coef_idx);
176 coef_mutex_unlock(codec);
177 return val;
178 }
179
180 #define alc_read_coef_idx(codec, coef_idx) \
181 alc_read_coefex_idx(codec, 0x20, coef_idx)
182
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)183 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
184 unsigned int coef_idx, unsigned int coef_val)
185 {
186 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
187 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
188 }
189
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)190 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
191 unsigned int coef_idx, unsigned int coef_val)
192 {
193 coef_mutex_lock(codec);
194 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
195 coef_mutex_unlock(codec);
196 }
197
198 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
199 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
200
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)201 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
202 unsigned int coef_idx, unsigned int mask,
203 unsigned int bits_set)
204 {
205 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
206
207 if (val != -1)
208 __alc_write_coefex_idx(codec, nid, coef_idx,
209 (val & ~mask) | bits_set);
210 }
211
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)212 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
213 unsigned int coef_idx, unsigned int mask,
214 unsigned int bits_set)
215 {
216 coef_mutex_lock(codec);
217 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
218 coef_mutex_unlock(codec);
219 }
220
221 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
222 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
223
224 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)225 static unsigned int alc_get_coef0(struct hda_codec *codec)
226 {
227 struct alc_spec *spec = codec->spec;
228
229 if (!spec->coef0)
230 spec->coef0 = alc_read_coef_idx(codec, 0);
231 return spec->coef0;
232 }
233
234 /* coef writes/updates batch */
235 struct coef_fw {
236 unsigned char nid;
237 unsigned char idx;
238 unsigned short mask;
239 unsigned short val;
240 };
241
242 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
243 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
244 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
245 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
246 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
247
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)248 static void alc_process_coef_fw(struct hda_codec *codec,
249 const struct coef_fw *fw)
250 {
251 coef_mutex_lock(codec);
252 for (; fw->nid; fw++) {
253 if (fw->mask == (unsigned short)-1)
254 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
255 else
256 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
257 fw->mask, fw->val);
258 }
259 coef_mutex_unlock(codec);
260 }
261
262 /*
263 * GPIO setup tables, used in initialization
264 */
265
266 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)267 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
268 {
269 struct alc_spec *spec = codec->spec;
270
271 spec->gpio_mask |= mask;
272 spec->gpio_dir |= mask;
273 spec->gpio_data |= mask;
274 }
275
alc_write_gpio_data(struct hda_codec * codec)276 static void alc_write_gpio_data(struct hda_codec *codec)
277 {
278 struct alc_spec *spec = codec->spec;
279
280 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
281 spec->gpio_data);
282 }
283
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)284 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
285 bool on)
286 {
287 struct alc_spec *spec = codec->spec;
288 unsigned int oldval = spec->gpio_data;
289
290 if (on)
291 spec->gpio_data |= mask;
292 else
293 spec->gpio_data &= ~mask;
294 if (oldval != spec->gpio_data)
295 alc_write_gpio_data(codec);
296 }
297
alc_write_gpio(struct hda_codec * codec)298 static void alc_write_gpio(struct hda_codec *codec)
299 {
300 struct alc_spec *spec = codec->spec;
301
302 if (!spec->gpio_mask)
303 return;
304
305 snd_hda_codec_write(codec, codec->core.afg, 0,
306 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
307 snd_hda_codec_write(codec, codec->core.afg, 0,
308 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
309 if (spec->gpio_write_delay)
310 msleep(1);
311 alc_write_gpio_data(codec);
312 }
313
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)314 static void alc_fixup_gpio(struct hda_codec *codec, int action,
315 unsigned int mask)
316 {
317 if (action == HDA_FIXUP_ACT_PRE_PROBE)
318 alc_setup_gpio(codec, mask);
319 }
320
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)321 static void alc_fixup_gpio1(struct hda_codec *codec,
322 const struct hda_fixup *fix, int action)
323 {
324 alc_fixup_gpio(codec, action, 0x01);
325 }
326
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)327 static void alc_fixup_gpio2(struct hda_codec *codec,
328 const struct hda_fixup *fix, int action)
329 {
330 alc_fixup_gpio(codec, action, 0x02);
331 }
332
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)333 static void alc_fixup_gpio3(struct hda_codec *codec,
334 const struct hda_fixup *fix, int action)
335 {
336 alc_fixup_gpio(codec, action, 0x03);
337 }
338
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)339 static void alc_fixup_gpio4(struct hda_codec *codec,
340 const struct hda_fixup *fix, int action)
341 {
342 alc_fixup_gpio(codec, action, 0x04);
343 }
344
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)345 static void alc_fixup_micmute_led(struct hda_codec *codec,
346 const struct hda_fixup *fix, int action)
347 {
348 if (action == HDA_FIXUP_ACT_PRE_PROBE)
349 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
350 }
351
352 /*
353 * Fix hardware PLL issue
354 * On some codecs, the analog PLL gating control must be off while
355 * the default value is 1.
356 */
alc_fix_pll(struct hda_codec * codec)357 static void alc_fix_pll(struct hda_codec *codec)
358 {
359 struct alc_spec *spec = codec->spec;
360
361 if (spec->pll_nid)
362 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
363 1 << spec->pll_coef_bit, 0);
364 }
365
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)366 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
367 unsigned int coef_idx, unsigned int coef_bit)
368 {
369 struct alc_spec *spec = codec->spec;
370 spec->pll_nid = nid;
371 spec->pll_coef_idx = coef_idx;
372 spec->pll_coef_bit = coef_bit;
373 alc_fix_pll(codec);
374 }
375
376 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)377 static void alc_update_knob_master(struct hda_codec *codec,
378 struct hda_jack_callback *jack)
379 {
380 unsigned int val;
381 struct snd_kcontrol *kctl;
382 struct snd_ctl_elem_value *uctl;
383
384 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
385 if (!kctl)
386 return;
387 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
388 if (!uctl)
389 return;
390 val = snd_hda_codec_read(codec, jack->nid, 0,
391 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
392 val &= HDA_AMP_VOLMASK;
393 uctl->value.integer.value[0] = val;
394 uctl->value.integer.value[1] = val;
395 kctl->put(kctl, uctl);
396 kfree(uctl);
397 }
398
alc880_unsol_event(struct hda_codec * codec,unsigned int res)399 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
400 {
401 /* For some reason, the res given from ALC880 is broken.
402 Here we adjust it properly. */
403 snd_hda_jack_unsol_event(codec, res >> 2);
404 }
405
406 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)407 static void alc_fill_eapd_coef(struct hda_codec *codec)
408 {
409 int coef;
410
411 coef = alc_get_coef0(codec);
412
413 switch (codec->core.vendor_id) {
414 case 0x10ec0262:
415 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
416 break;
417 case 0x10ec0267:
418 case 0x10ec0268:
419 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
420 break;
421 case 0x10ec0269:
422 if ((coef & 0x00f0) == 0x0010)
423 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
424 if ((coef & 0x00f0) == 0x0020)
425 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
426 if ((coef & 0x00f0) == 0x0030)
427 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
428 break;
429 case 0x10ec0280:
430 case 0x10ec0284:
431 case 0x10ec0290:
432 case 0x10ec0292:
433 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
434 break;
435 case 0x10ec0225:
436 case 0x10ec0295:
437 case 0x10ec0299:
438 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
439 fallthrough;
440 case 0x10ec0215:
441 case 0x10ec0285:
442 case 0x10ec0289:
443 alc_update_coef_idx(codec, 0x36, 1<<13, 0);
444 fallthrough;
445 case 0x10ec0230:
446 case 0x10ec0233:
447 case 0x10ec0235:
448 case 0x10ec0236:
449 case 0x10ec0245:
450 case 0x10ec0255:
451 case 0x10ec0256:
452 case 0x19e58326:
453 case 0x10ec0257:
454 case 0x10ec0282:
455 case 0x10ec0283:
456 case 0x10ec0286:
457 case 0x10ec0288:
458 case 0x10ec0298:
459 case 0x10ec0300:
460 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
461 break;
462 case 0x10ec0275:
463 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
464 break;
465 case 0x10ec0287:
466 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
467 alc_write_coef_idx(codec, 0x8, 0x4ab7);
468 break;
469 case 0x10ec0293:
470 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
471 break;
472 case 0x10ec0234:
473 case 0x10ec0274:
474 alc_write_coef_idx(codec, 0x6e, 0x0c25);
475 fallthrough;
476 case 0x10ec0294:
477 case 0x10ec0700:
478 case 0x10ec0701:
479 case 0x10ec0703:
480 case 0x10ec0711:
481 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
482 break;
483 case 0x10ec0662:
484 if ((coef & 0x00f0) == 0x0030)
485 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
486 break;
487 case 0x10ec0272:
488 case 0x10ec0273:
489 case 0x10ec0663:
490 case 0x10ec0665:
491 case 0x10ec0670:
492 case 0x10ec0671:
493 case 0x10ec0672:
494 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
495 break;
496 case 0x10ec0222:
497 case 0x10ec0623:
498 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
499 break;
500 case 0x10ec0668:
501 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
502 break;
503 case 0x10ec0867:
504 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
505 break;
506 case 0x10ec0888:
507 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
508 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
509 break;
510 case 0x10ec0892:
511 case 0x10ec0897:
512 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
513 break;
514 case 0x10ec0899:
515 case 0x10ec0900:
516 case 0x10ec0b00:
517 case 0x10ec1168:
518 case 0x10ec1220:
519 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
520 break;
521 }
522 }
523
524 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)525 static void alc888_coef_init(struct hda_codec *codec)
526 {
527 switch (alc_get_coef0(codec) & 0x00f0) {
528 /* alc888-VA */
529 case 0x00:
530 /* alc888-VB */
531 case 0x10:
532 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
533 break;
534 }
535 }
536
537 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)538 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
539 {
540 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
541 return;
542 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
543 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
544 on ? 2 : 0);
545 }
546
547 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)548 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
549 {
550 /* We currently only handle front, HP */
551 static const hda_nid_t pins[] = {
552 0x0f, 0x10, 0x14, 0x15, 0x17, 0
553 };
554 const hda_nid_t *p;
555 for (p = pins; *p; p++)
556 set_eapd(codec, *p, on);
557 }
558
559 static int find_ext_mic_pin(struct hda_codec *codec);
560
alc_headset_mic_no_shutup(struct hda_codec * codec)561 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
562 {
563 const struct hda_pincfg *pin;
564 int mic_pin = find_ext_mic_pin(codec);
565 int i;
566
567 /* don't shut up pins when unloading the driver; otherwise it breaks
568 * the default pin setup at the next load of the driver
569 */
570 if (codec->bus->shutdown)
571 return;
572
573 snd_array_for_each(&codec->init_pins, i, pin) {
574 /* use read here for syncing after issuing each verb */
575 if (pin->nid != mic_pin)
576 snd_hda_codec_read(codec, pin->nid, 0,
577 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
578 }
579
580 codec->pins_shutup = 1;
581 }
582
alc_shutup_pins(struct hda_codec * codec)583 static void alc_shutup_pins(struct hda_codec *codec)
584 {
585 struct alc_spec *spec = codec->spec;
586
587 switch (codec->core.vendor_id) {
588 case 0x10ec0236:
589 case 0x10ec0256:
590 case 0x10ec0257:
591 case 0x19e58326:
592 case 0x10ec0283:
593 case 0x10ec0285:
594 case 0x10ec0286:
595 case 0x10ec0287:
596 case 0x10ec0288:
597 case 0x10ec0295:
598 case 0x10ec0298:
599 alc_headset_mic_no_shutup(codec);
600 break;
601 default:
602 if (!spec->no_shutup_pins)
603 snd_hda_shutup_pins(codec);
604 break;
605 }
606 }
607
608 /* generic shutup callback;
609 * just turning off EAPD and a little pause for avoiding pop-noise
610 */
alc_eapd_shutup(struct hda_codec * codec)611 static void alc_eapd_shutup(struct hda_codec *codec)
612 {
613 struct alc_spec *spec = codec->spec;
614
615 alc_auto_setup_eapd(codec, false);
616 if (!spec->no_depop_delay)
617 msleep(200);
618 alc_shutup_pins(codec);
619 }
620
621 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)622 static void alc_auto_init_amp(struct hda_codec *codec, int type)
623 {
624 alc_auto_setup_eapd(codec, true);
625 alc_write_gpio(codec);
626 switch (type) {
627 case ALC_INIT_DEFAULT:
628 switch (codec->core.vendor_id) {
629 case 0x10ec0260:
630 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
631 break;
632 case 0x10ec0880:
633 case 0x10ec0882:
634 case 0x10ec0883:
635 case 0x10ec0885:
636 alc_update_coef_idx(codec, 7, 0, 0x2030);
637 break;
638 case 0x10ec0888:
639 alc888_coef_init(codec);
640 break;
641 }
642 break;
643 }
644 }
645
646 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)647 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
648 {
649 if (spec->gen.autocfg.hp_pins[0])
650 return spec->gen.autocfg.hp_pins[0];
651 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
652 return spec->gen.autocfg.line_out_pins[0];
653 return 0;
654 }
655
656 /*
657 * Realtek SSID verification
658 */
659
660 /* Could be any non-zero and even value. When used as fixup, tells
661 * the driver to ignore any present sku defines.
662 */
663 #define ALC_FIXUP_SKU_IGNORE (2)
664
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)665 static void alc_fixup_sku_ignore(struct hda_codec *codec,
666 const struct hda_fixup *fix, int action)
667 {
668 struct alc_spec *spec = codec->spec;
669 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
670 spec->cdefine.fixup = 1;
671 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
672 }
673 }
674
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)675 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
676 const struct hda_fixup *fix, int action)
677 {
678 struct alc_spec *spec = codec->spec;
679
680 if (action == HDA_FIXUP_ACT_PROBE) {
681 spec->no_depop_delay = 1;
682 codec->depop_delay = 0;
683 }
684 }
685
alc_auto_parse_customize_define(struct hda_codec * codec)686 static int alc_auto_parse_customize_define(struct hda_codec *codec)
687 {
688 unsigned int ass, tmp, i;
689 unsigned nid = 0;
690 struct alc_spec *spec = codec->spec;
691
692 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
693
694 if (spec->cdefine.fixup) {
695 ass = spec->cdefine.sku_cfg;
696 if (ass == ALC_FIXUP_SKU_IGNORE)
697 return -1;
698 goto do_sku;
699 }
700
701 if (!codec->bus->pci)
702 return -1;
703 ass = codec->core.subsystem_id & 0xffff;
704 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
705 goto do_sku;
706
707 nid = 0x1d;
708 if (codec->core.vendor_id == 0x10ec0260)
709 nid = 0x17;
710 ass = snd_hda_codec_get_pincfg(codec, nid);
711
712 if (!(ass & 1)) {
713 codec_info(codec, "%s: SKU not ready 0x%08x\n",
714 codec->core.chip_name, ass);
715 return -1;
716 }
717
718 /* check sum */
719 tmp = 0;
720 for (i = 1; i < 16; i++) {
721 if ((ass >> i) & 1)
722 tmp++;
723 }
724 if (((ass >> 16) & 0xf) != tmp)
725 return -1;
726
727 spec->cdefine.port_connectivity = ass >> 30;
728 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
729 spec->cdefine.check_sum = (ass >> 16) & 0xf;
730 spec->cdefine.customization = ass >> 8;
731 do_sku:
732 spec->cdefine.sku_cfg = ass;
733 spec->cdefine.external_amp = (ass & 0x38) >> 3;
734 spec->cdefine.platform_type = (ass & 0x4) >> 2;
735 spec->cdefine.swap = (ass & 0x2) >> 1;
736 spec->cdefine.override = ass & 0x1;
737
738 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
739 nid, spec->cdefine.sku_cfg);
740 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
741 spec->cdefine.port_connectivity);
742 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
743 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
744 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
745 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
746 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
747 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
748 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
749
750 return 0;
751 }
752
753 /* return the position of NID in the list, or -1 if not found */
find_idx_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)754 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
755 {
756 int i;
757 for (i = 0; i < nums; i++)
758 if (list[i] == nid)
759 return i;
760 return -1;
761 }
762 /* return true if the given NID is found in the list */
found_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)763 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
764 {
765 return find_idx_in_nid_list(nid, list, nums) >= 0;
766 }
767
768 /* check subsystem ID and set up device-specific initialization;
769 * return 1 if initialized, 0 if invalid SSID
770 */
771 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
772 * 31 ~ 16 : Manufacture ID
773 * 15 ~ 8 : SKU ID
774 * 7 ~ 0 : Assembly ID
775 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
776 */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)777 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
778 {
779 unsigned int ass, tmp, i;
780 unsigned nid;
781 struct alc_spec *spec = codec->spec;
782
783 if (spec->cdefine.fixup) {
784 ass = spec->cdefine.sku_cfg;
785 if (ass == ALC_FIXUP_SKU_IGNORE)
786 return 0;
787 goto do_sku;
788 }
789
790 ass = codec->core.subsystem_id & 0xffff;
791 if (codec->bus->pci &&
792 ass != codec->bus->pci->subsystem_device && (ass & 1))
793 goto do_sku;
794
795 /* invalid SSID, check the special NID pin defcfg instead */
796 /*
797 * 31~30 : port connectivity
798 * 29~21 : reserve
799 * 20 : PCBEEP input
800 * 19~16 : Check sum (15:1)
801 * 15~1 : Custom
802 * 0 : override
803 */
804 nid = 0x1d;
805 if (codec->core.vendor_id == 0x10ec0260)
806 nid = 0x17;
807 ass = snd_hda_codec_get_pincfg(codec, nid);
808 codec_dbg(codec,
809 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
810 ass, nid);
811 if (!(ass & 1))
812 return 0;
813 if ((ass >> 30) != 1) /* no physical connection */
814 return 0;
815
816 /* check sum */
817 tmp = 0;
818 for (i = 1; i < 16; i++) {
819 if ((ass >> i) & 1)
820 tmp++;
821 }
822 if (((ass >> 16) & 0xf) != tmp)
823 return 0;
824 do_sku:
825 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
826 ass & 0xffff, codec->core.vendor_id);
827 /*
828 * 0 : override
829 * 1 : Swap Jack
830 * 2 : 0 --> Desktop, 1 --> Laptop
831 * 3~5 : External Amplifier control
832 * 7~6 : Reserved
833 */
834 tmp = (ass & 0x38) >> 3; /* external Amp control */
835 if (spec->init_amp == ALC_INIT_UNDEFINED) {
836 switch (tmp) {
837 case 1:
838 alc_setup_gpio(codec, 0x01);
839 break;
840 case 3:
841 alc_setup_gpio(codec, 0x02);
842 break;
843 case 7:
844 alc_setup_gpio(codec, 0x04);
845 break;
846 case 5:
847 default:
848 spec->init_amp = ALC_INIT_DEFAULT;
849 break;
850 }
851 }
852
853 /* is laptop or Desktop and enable the function "Mute internal speaker
854 * when the external headphone out jack is plugged"
855 */
856 if (!(ass & 0x8000))
857 return 1;
858 /*
859 * 10~8 : Jack location
860 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
861 * 14~13: Resvered
862 * 15 : 1 --> enable the function "Mute internal speaker
863 * when the external headphone out jack is plugged"
864 */
865 if (!alc_get_hp_pin(spec)) {
866 hda_nid_t nid;
867 tmp = (ass >> 11) & 0x3; /* HP to chassis */
868 nid = ports[tmp];
869 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
870 spec->gen.autocfg.line_outs))
871 return 1;
872 spec->gen.autocfg.hp_pins[0] = nid;
873 }
874 return 1;
875 }
876
877 /* Check the validity of ALC subsystem-id
878 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
alc_ssid_check(struct hda_codec * codec,const hda_nid_t * ports)879 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
880 {
881 if (!alc_subsystem_id(codec, ports)) {
882 struct alc_spec *spec = codec->spec;
883 if (spec->init_amp == ALC_INIT_UNDEFINED) {
884 codec_dbg(codec,
885 "realtek: Enable default setup for auto mode as fallback\n");
886 spec->init_amp = ALC_INIT_DEFAULT;
887 }
888 }
889 }
890
891 /*
892 */
893
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)894 static void alc_fixup_inv_dmic(struct hda_codec *codec,
895 const struct hda_fixup *fix, int action)
896 {
897 struct alc_spec *spec = codec->spec;
898
899 spec->gen.inv_dmic_split = 1;
900 }
901
902
alc_build_controls(struct hda_codec * codec)903 static int alc_build_controls(struct hda_codec *codec)
904 {
905 int err;
906
907 err = snd_hda_gen_build_controls(codec);
908 if (err < 0)
909 return err;
910
911 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
912 return 0;
913 }
914
915
916 /*
917 * Common callbacks
918 */
919
alc_pre_init(struct hda_codec * codec)920 static void alc_pre_init(struct hda_codec *codec)
921 {
922 alc_fill_eapd_coef(codec);
923 }
924
925 #define is_s3_resume(codec) \
926 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
927 #define is_s4_resume(codec) \
928 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
929
alc_init(struct hda_codec * codec)930 static int alc_init(struct hda_codec *codec)
931 {
932 struct alc_spec *spec = codec->spec;
933
934 /* hibernation resume needs the full chip initialization */
935 if (is_s4_resume(codec))
936 alc_pre_init(codec);
937
938 if (spec->init_hook)
939 spec->init_hook(codec);
940
941 spec->gen.skip_verbs = 1; /* applied in below */
942 snd_hda_gen_init(codec);
943 alc_fix_pll(codec);
944 alc_auto_init_amp(codec, spec->init_amp);
945 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
946
947 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
948
949 return 0;
950 }
951
952 #define alc_free snd_hda_gen_free
953
954 #ifdef CONFIG_PM
alc_shutup(struct hda_codec * codec)955 static inline void alc_shutup(struct hda_codec *codec)
956 {
957 struct alc_spec *spec = codec->spec;
958
959 if (!snd_hda_get_bool_hint(codec, "shutup"))
960 return; /* disabled explicitly by hints */
961
962 if (spec && spec->shutup)
963 spec->shutup(codec);
964 else
965 alc_shutup_pins(codec);
966 }
967
alc_power_eapd(struct hda_codec * codec)968 static void alc_power_eapd(struct hda_codec *codec)
969 {
970 alc_auto_setup_eapd(codec, false);
971 }
972
alc_suspend(struct hda_codec * codec)973 static int alc_suspend(struct hda_codec *codec)
974 {
975 struct alc_spec *spec = codec->spec;
976 alc_shutup(codec);
977 if (spec && spec->power_hook)
978 spec->power_hook(codec);
979 return 0;
980 }
981
alc_resume(struct hda_codec * codec)982 static int alc_resume(struct hda_codec *codec)
983 {
984 struct alc_spec *spec = codec->spec;
985
986 if (!spec->no_depop_delay)
987 msleep(150); /* to avoid pop noise */
988 codec->patch_ops.init(codec);
989 snd_hda_regmap_sync(codec);
990 hda_call_check_power_status(codec, 0x01);
991 return 0;
992 }
993 #endif
994
995 /*
996 */
997 static const struct hda_codec_ops alc_patch_ops = {
998 .build_controls = alc_build_controls,
999 .build_pcms = snd_hda_gen_build_pcms,
1000 .init = alc_init,
1001 .free = alc_free,
1002 .unsol_event = snd_hda_jack_unsol_event,
1003 #ifdef CONFIG_PM
1004 .resume = alc_resume,
1005 .suspend = alc_suspend,
1006 .check_power_status = snd_hda_gen_check_power_status,
1007 #endif
1008 };
1009
1010
1011 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1012
1013 /*
1014 * Rename codecs appropriately from COEF value or subvendor id
1015 */
1016 struct alc_codec_rename_table {
1017 unsigned int vendor_id;
1018 unsigned short coef_mask;
1019 unsigned short coef_bits;
1020 const char *name;
1021 };
1022
1023 struct alc_codec_rename_pci_table {
1024 unsigned int codec_vendor_id;
1025 unsigned short pci_subvendor;
1026 unsigned short pci_subdevice;
1027 const char *name;
1028 };
1029
1030 static const struct alc_codec_rename_table rename_tbl[] = {
1031 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1032 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1033 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1034 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1035 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1036 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1037 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1038 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1039 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1040 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1041 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1042 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1043 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1044 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1045 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1046 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1047 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1048 { } /* terminator */
1049 };
1050
1051 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1052 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1053 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1054 { 0x10ec0283, 0x1028, 0, "ALC3223" },
1055 { 0x10ec0288, 0x1028, 0, "ALC3263" },
1056 { 0x10ec0292, 0x1028, 0, "ALC3226" },
1057 { 0x10ec0293, 0x1028, 0, "ALC3235" },
1058 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1059 { 0x10ec0668, 0x1028, 0, "ALC3661" },
1060 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1061 { 0x10ec0899, 0x1028, 0, "ALC3861" },
1062 { 0x10ec0298, 0x1028, 0, "ALC3266" },
1063 { 0x10ec0236, 0x1028, 0, "ALC3204" },
1064 { 0x10ec0256, 0x1028, 0, "ALC3246" },
1065 { 0x10ec0225, 0x1028, 0, "ALC3253" },
1066 { 0x10ec0295, 0x1028, 0, "ALC3254" },
1067 { 0x10ec0299, 0x1028, 0, "ALC3271" },
1068 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1069 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1070 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1071 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1072 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1073 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1074 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1075 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1076 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1077 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1078 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1079 { } /* terminator */
1080 };
1081
alc_codec_rename_from_preset(struct hda_codec * codec)1082 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1083 {
1084 const struct alc_codec_rename_table *p;
1085 const struct alc_codec_rename_pci_table *q;
1086
1087 for (p = rename_tbl; p->vendor_id; p++) {
1088 if (p->vendor_id != codec->core.vendor_id)
1089 continue;
1090 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1091 return alc_codec_rename(codec, p->name);
1092 }
1093
1094 if (!codec->bus->pci)
1095 return 0;
1096 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1097 if (q->codec_vendor_id != codec->core.vendor_id)
1098 continue;
1099 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1100 continue;
1101 if (!q->pci_subdevice ||
1102 q->pci_subdevice == codec->bus->pci->subsystem_device)
1103 return alc_codec_rename(codec, q->name);
1104 }
1105
1106 return 0;
1107 }
1108
1109
1110 /*
1111 * Digital-beep handlers
1112 */
1113 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1114
1115 /* additional beep mixers; private_value will be overwritten */
1116 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1117 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1118 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1119 };
1120
1121 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1122 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1123 int idx, int dir)
1124 {
1125 struct snd_kcontrol_new *knew;
1126 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1127 int i;
1128
1129 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1130 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1131 &alc_beep_mixer[i]);
1132 if (!knew)
1133 return -ENOMEM;
1134 knew->private_value = beep_amp;
1135 }
1136 return 0;
1137 }
1138
1139 static const struct snd_pci_quirk beep_allow_list[] = {
1140 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1141 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1142 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1143 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1144 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1145 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1146 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1147 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1148 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1149 /* denylist -- no beep available */
1150 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1151 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1152 {}
1153 };
1154
has_cdefine_beep(struct hda_codec * codec)1155 static inline int has_cdefine_beep(struct hda_codec *codec)
1156 {
1157 struct alc_spec *spec = codec->spec;
1158 const struct snd_pci_quirk *q;
1159 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1160 if (q)
1161 return q->value;
1162 return spec->cdefine.enable_pcbeep;
1163 }
1164 #else
1165 #define set_beep_amp(spec, nid, idx, dir) 0
1166 #define has_cdefine_beep(codec) 0
1167 #endif
1168
1169 /* parse the BIOS configuration and set up the alc_spec */
1170 /* return 1 if successful, 0 if the proper config is not found,
1171 * or a negative error code
1172 */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1173 static int alc_parse_auto_config(struct hda_codec *codec,
1174 const hda_nid_t *ignore_nids,
1175 const hda_nid_t *ssid_nids)
1176 {
1177 struct alc_spec *spec = codec->spec;
1178 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1179 int err;
1180
1181 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1182 spec->parse_flags);
1183 if (err < 0)
1184 return err;
1185
1186 if (ssid_nids)
1187 alc_ssid_check(codec, ssid_nids);
1188
1189 err = snd_hda_gen_parse_auto_config(codec, cfg);
1190 if (err < 0)
1191 return err;
1192
1193 return 1;
1194 }
1195
1196 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1197 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1198 {
1199 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1200 int err;
1201
1202 if (!spec)
1203 return -ENOMEM;
1204 codec->spec = spec;
1205 snd_hda_gen_spec_init(&spec->gen);
1206 spec->gen.mixer_nid = mixer_nid;
1207 spec->gen.own_eapd_ctl = 1;
1208 codec->single_adc_amp = 1;
1209 /* FIXME: do we need this for all Realtek codec models? */
1210 codec->spdif_status_reset = 1;
1211 codec->forced_resume = 1;
1212 codec->patch_ops = alc_patch_ops;
1213 mutex_init(&spec->coef_mutex);
1214
1215 err = alc_codec_rename_from_preset(codec);
1216 if (err < 0) {
1217 kfree(spec);
1218 return err;
1219 }
1220 return 0;
1221 }
1222
alc880_parse_auto_config(struct hda_codec * codec)1223 static int alc880_parse_auto_config(struct hda_codec *codec)
1224 {
1225 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1226 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1227 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1228 }
1229
1230 /*
1231 * ALC880 fix-ups
1232 */
1233 enum {
1234 ALC880_FIXUP_GPIO1,
1235 ALC880_FIXUP_GPIO2,
1236 ALC880_FIXUP_MEDION_RIM,
1237 ALC880_FIXUP_LG,
1238 ALC880_FIXUP_LG_LW25,
1239 ALC880_FIXUP_W810,
1240 ALC880_FIXUP_EAPD_COEF,
1241 ALC880_FIXUP_TCL_S700,
1242 ALC880_FIXUP_VOL_KNOB,
1243 ALC880_FIXUP_FUJITSU,
1244 ALC880_FIXUP_F1734,
1245 ALC880_FIXUP_UNIWILL,
1246 ALC880_FIXUP_UNIWILL_DIG,
1247 ALC880_FIXUP_Z71V,
1248 ALC880_FIXUP_ASUS_W5A,
1249 ALC880_FIXUP_3ST_BASE,
1250 ALC880_FIXUP_3ST,
1251 ALC880_FIXUP_3ST_DIG,
1252 ALC880_FIXUP_5ST_BASE,
1253 ALC880_FIXUP_5ST,
1254 ALC880_FIXUP_5ST_DIG,
1255 ALC880_FIXUP_6ST_BASE,
1256 ALC880_FIXUP_6ST,
1257 ALC880_FIXUP_6ST_DIG,
1258 ALC880_FIXUP_6ST_AUTOMUTE,
1259 };
1260
1261 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1262 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1263 const struct hda_fixup *fix, int action)
1264 {
1265 if (action == HDA_FIXUP_ACT_PROBE)
1266 snd_hda_jack_detect_enable_callback(codec, 0x21,
1267 alc_update_knob_master);
1268 }
1269
1270 static const struct hda_fixup alc880_fixups[] = {
1271 [ALC880_FIXUP_GPIO1] = {
1272 .type = HDA_FIXUP_FUNC,
1273 .v.func = alc_fixup_gpio1,
1274 },
1275 [ALC880_FIXUP_GPIO2] = {
1276 .type = HDA_FIXUP_FUNC,
1277 .v.func = alc_fixup_gpio2,
1278 },
1279 [ALC880_FIXUP_MEDION_RIM] = {
1280 .type = HDA_FIXUP_VERBS,
1281 .v.verbs = (const struct hda_verb[]) {
1282 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1283 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1284 { }
1285 },
1286 .chained = true,
1287 .chain_id = ALC880_FIXUP_GPIO2,
1288 },
1289 [ALC880_FIXUP_LG] = {
1290 .type = HDA_FIXUP_PINS,
1291 .v.pins = (const struct hda_pintbl[]) {
1292 /* disable bogus unused pins */
1293 { 0x16, 0x411111f0 },
1294 { 0x18, 0x411111f0 },
1295 { 0x1a, 0x411111f0 },
1296 { }
1297 }
1298 },
1299 [ALC880_FIXUP_LG_LW25] = {
1300 .type = HDA_FIXUP_PINS,
1301 .v.pins = (const struct hda_pintbl[]) {
1302 { 0x1a, 0x0181344f }, /* line-in */
1303 { 0x1b, 0x0321403f }, /* headphone */
1304 { }
1305 }
1306 },
1307 [ALC880_FIXUP_W810] = {
1308 .type = HDA_FIXUP_PINS,
1309 .v.pins = (const struct hda_pintbl[]) {
1310 /* disable bogus unused pins */
1311 { 0x17, 0x411111f0 },
1312 { }
1313 },
1314 .chained = true,
1315 .chain_id = ALC880_FIXUP_GPIO2,
1316 },
1317 [ALC880_FIXUP_EAPD_COEF] = {
1318 .type = HDA_FIXUP_VERBS,
1319 .v.verbs = (const struct hda_verb[]) {
1320 /* change to EAPD mode */
1321 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1322 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1323 {}
1324 },
1325 },
1326 [ALC880_FIXUP_TCL_S700] = {
1327 .type = HDA_FIXUP_VERBS,
1328 .v.verbs = (const struct hda_verb[]) {
1329 /* change to EAPD mode */
1330 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1331 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1332 {}
1333 },
1334 .chained = true,
1335 .chain_id = ALC880_FIXUP_GPIO2,
1336 },
1337 [ALC880_FIXUP_VOL_KNOB] = {
1338 .type = HDA_FIXUP_FUNC,
1339 .v.func = alc880_fixup_vol_knob,
1340 },
1341 [ALC880_FIXUP_FUJITSU] = {
1342 /* override all pins as BIOS on old Amilo is broken */
1343 .type = HDA_FIXUP_PINS,
1344 .v.pins = (const struct hda_pintbl[]) {
1345 { 0x14, 0x0121401f }, /* HP */
1346 { 0x15, 0x99030120 }, /* speaker */
1347 { 0x16, 0x99030130 }, /* bass speaker */
1348 { 0x17, 0x411111f0 }, /* N/A */
1349 { 0x18, 0x411111f0 }, /* N/A */
1350 { 0x19, 0x01a19950 }, /* mic-in */
1351 { 0x1a, 0x411111f0 }, /* N/A */
1352 { 0x1b, 0x411111f0 }, /* N/A */
1353 { 0x1c, 0x411111f0 }, /* N/A */
1354 { 0x1d, 0x411111f0 }, /* N/A */
1355 { 0x1e, 0x01454140 }, /* SPDIF out */
1356 { }
1357 },
1358 .chained = true,
1359 .chain_id = ALC880_FIXUP_VOL_KNOB,
1360 },
1361 [ALC880_FIXUP_F1734] = {
1362 /* almost compatible with FUJITSU, but no bass and SPDIF */
1363 .type = HDA_FIXUP_PINS,
1364 .v.pins = (const struct hda_pintbl[]) {
1365 { 0x14, 0x0121401f }, /* HP */
1366 { 0x15, 0x99030120 }, /* speaker */
1367 { 0x16, 0x411111f0 }, /* N/A */
1368 { 0x17, 0x411111f0 }, /* N/A */
1369 { 0x18, 0x411111f0 }, /* N/A */
1370 { 0x19, 0x01a19950 }, /* mic-in */
1371 { 0x1a, 0x411111f0 }, /* N/A */
1372 { 0x1b, 0x411111f0 }, /* N/A */
1373 { 0x1c, 0x411111f0 }, /* N/A */
1374 { 0x1d, 0x411111f0 }, /* N/A */
1375 { 0x1e, 0x411111f0 }, /* N/A */
1376 { }
1377 },
1378 .chained = true,
1379 .chain_id = ALC880_FIXUP_VOL_KNOB,
1380 },
1381 [ALC880_FIXUP_UNIWILL] = {
1382 /* need to fix HP and speaker pins to be parsed correctly */
1383 .type = HDA_FIXUP_PINS,
1384 .v.pins = (const struct hda_pintbl[]) {
1385 { 0x14, 0x0121411f }, /* HP */
1386 { 0x15, 0x99030120 }, /* speaker */
1387 { 0x16, 0x99030130 }, /* bass speaker */
1388 { }
1389 },
1390 },
1391 [ALC880_FIXUP_UNIWILL_DIG] = {
1392 .type = HDA_FIXUP_PINS,
1393 .v.pins = (const struct hda_pintbl[]) {
1394 /* disable bogus unused pins */
1395 { 0x17, 0x411111f0 },
1396 { 0x19, 0x411111f0 },
1397 { 0x1b, 0x411111f0 },
1398 { 0x1f, 0x411111f0 },
1399 { }
1400 }
1401 },
1402 [ALC880_FIXUP_Z71V] = {
1403 .type = HDA_FIXUP_PINS,
1404 .v.pins = (const struct hda_pintbl[]) {
1405 /* set up the whole pins as BIOS is utterly broken */
1406 { 0x14, 0x99030120 }, /* speaker */
1407 { 0x15, 0x0121411f }, /* HP */
1408 { 0x16, 0x411111f0 }, /* N/A */
1409 { 0x17, 0x411111f0 }, /* N/A */
1410 { 0x18, 0x01a19950 }, /* mic-in */
1411 { 0x19, 0x411111f0 }, /* N/A */
1412 { 0x1a, 0x01813031 }, /* line-in */
1413 { 0x1b, 0x411111f0 }, /* N/A */
1414 { 0x1c, 0x411111f0 }, /* N/A */
1415 { 0x1d, 0x411111f0 }, /* N/A */
1416 { 0x1e, 0x0144111e }, /* SPDIF */
1417 { }
1418 }
1419 },
1420 [ALC880_FIXUP_ASUS_W5A] = {
1421 .type = HDA_FIXUP_PINS,
1422 .v.pins = (const struct hda_pintbl[]) {
1423 /* set up the whole pins as BIOS is utterly broken */
1424 { 0x14, 0x0121411f }, /* HP */
1425 { 0x15, 0x411111f0 }, /* N/A */
1426 { 0x16, 0x411111f0 }, /* N/A */
1427 { 0x17, 0x411111f0 }, /* N/A */
1428 { 0x18, 0x90a60160 }, /* mic */
1429 { 0x19, 0x411111f0 }, /* N/A */
1430 { 0x1a, 0x411111f0 }, /* N/A */
1431 { 0x1b, 0x411111f0 }, /* N/A */
1432 { 0x1c, 0x411111f0 }, /* N/A */
1433 { 0x1d, 0x411111f0 }, /* N/A */
1434 { 0x1e, 0xb743111e }, /* SPDIF out */
1435 { }
1436 },
1437 .chained = true,
1438 .chain_id = ALC880_FIXUP_GPIO1,
1439 },
1440 [ALC880_FIXUP_3ST_BASE] = {
1441 .type = HDA_FIXUP_PINS,
1442 .v.pins = (const struct hda_pintbl[]) {
1443 { 0x14, 0x01014010 }, /* line-out */
1444 { 0x15, 0x411111f0 }, /* N/A */
1445 { 0x16, 0x411111f0 }, /* N/A */
1446 { 0x17, 0x411111f0 }, /* N/A */
1447 { 0x18, 0x01a19c30 }, /* mic-in */
1448 { 0x19, 0x0121411f }, /* HP */
1449 { 0x1a, 0x01813031 }, /* line-in */
1450 { 0x1b, 0x02a19c40 }, /* front-mic */
1451 { 0x1c, 0x411111f0 }, /* N/A */
1452 { 0x1d, 0x411111f0 }, /* N/A */
1453 /* 0x1e is filled in below */
1454 { 0x1f, 0x411111f0 }, /* N/A */
1455 { }
1456 }
1457 },
1458 [ALC880_FIXUP_3ST] = {
1459 .type = HDA_FIXUP_PINS,
1460 .v.pins = (const struct hda_pintbl[]) {
1461 { 0x1e, 0x411111f0 }, /* N/A */
1462 { }
1463 },
1464 .chained = true,
1465 .chain_id = ALC880_FIXUP_3ST_BASE,
1466 },
1467 [ALC880_FIXUP_3ST_DIG] = {
1468 .type = HDA_FIXUP_PINS,
1469 .v.pins = (const struct hda_pintbl[]) {
1470 { 0x1e, 0x0144111e }, /* SPDIF */
1471 { }
1472 },
1473 .chained = true,
1474 .chain_id = ALC880_FIXUP_3ST_BASE,
1475 },
1476 [ALC880_FIXUP_5ST_BASE] = {
1477 .type = HDA_FIXUP_PINS,
1478 .v.pins = (const struct hda_pintbl[]) {
1479 { 0x14, 0x01014010 }, /* front */
1480 { 0x15, 0x411111f0 }, /* N/A */
1481 { 0x16, 0x01011411 }, /* CLFE */
1482 { 0x17, 0x01016412 }, /* surr */
1483 { 0x18, 0x01a19c30 }, /* mic-in */
1484 { 0x19, 0x0121411f }, /* HP */
1485 { 0x1a, 0x01813031 }, /* line-in */
1486 { 0x1b, 0x02a19c40 }, /* front-mic */
1487 { 0x1c, 0x411111f0 }, /* N/A */
1488 { 0x1d, 0x411111f0 }, /* N/A */
1489 /* 0x1e is filled in below */
1490 { 0x1f, 0x411111f0 }, /* N/A */
1491 { }
1492 }
1493 },
1494 [ALC880_FIXUP_5ST] = {
1495 .type = HDA_FIXUP_PINS,
1496 .v.pins = (const struct hda_pintbl[]) {
1497 { 0x1e, 0x411111f0 }, /* N/A */
1498 { }
1499 },
1500 .chained = true,
1501 .chain_id = ALC880_FIXUP_5ST_BASE,
1502 },
1503 [ALC880_FIXUP_5ST_DIG] = {
1504 .type = HDA_FIXUP_PINS,
1505 .v.pins = (const struct hda_pintbl[]) {
1506 { 0x1e, 0x0144111e }, /* SPDIF */
1507 { }
1508 },
1509 .chained = true,
1510 .chain_id = ALC880_FIXUP_5ST_BASE,
1511 },
1512 [ALC880_FIXUP_6ST_BASE] = {
1513 .type = HDA_FIXUP_PINS,
1514 .v.pins = (const struct hda_pintbl[]) {
1515 { 0x14, 0x01014010 }, /* front */
1516 { 0x15, 0x01016412 }, /* surr */
1517 { 0x16, 0x01011411 }, /* CLFE */
1518 { 0x17, 0x01012414 }, /* side */
1519 { 0x18, 0x01a19c30 }, /* mic-in */
1520 { 0x19, 0x02a19c40 }, /* front-mic */
1521 { 0x1a, 0x01813031 }, /* line-in */
1522 { 0x1b, 0x0121411f }, /* HP */
1523 { 0x1c, 0x411111f0 }, /* N/A */
1524 { 0x1d, 0x411111f0 }, /* N/A */
1525 /* 0x1e is filled in below */
1526 { 0x1f, 0x411111f0 }, /* N/A */
1527 { }
1528 }
1529 },
1530 [ALC880_FIXUP_6ST] = {
1531 .type = HDA_FIXUP_PINS,
1532 .v.pins = (const struct hda_pintbl[]) {
1533 { 0x1e, 0x411111f0 }, /* N/A */
1534 { }
1535 },
1536 .chained = true,
1537 .chain_id = ALC880_FIXUP_6ST_BASE,
1538 },
1539 [ALC880_FIXUP_6ST_DIG] = {
1540 .type = HDA_FIXUP_PINS,
1541 .v.pins = (const struct hda_pintbl[]) {
1542 { 0x1e, 0x0144111e }, /* SPDIF */
1543 { }
1544 },
1545 .chained = true,
1546 .chain_id = ALC880_FIXUP_6ST_BASE,
1547 },
1548 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1549 .type = HDA_FIXUP_PINS,
1550 .v.pins = (const struct hda_pintbl[]) {
1551 { 0x1b, 0x0121401f }, /* HP with jack detect */
1552 { }
1553 },
1554 .chained_before = true,
1555 .chain_id = ALC880_FIXUP_6ST_BASE,
1556 },
1557 };
1558
1559 static const struct hda_quirk alc880_fixup_tbl[] = {
1560 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1561 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1562 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1563 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1564 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1565 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1566 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1567 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1568 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1569 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1570 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1571 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1572 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1573 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1574 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1575 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1576 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1577 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1578 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1579 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1580 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1581 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1582 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1583
1584 /* Below is the copied entries from alc880_quirks.c.
1585 * It's not quite sure whether BIOS sets the correct pin-config table
1586 * on these machines, thus they are kept to be compatible with
1587 * the old static quirks. Once when it's confirmed to work without
1588 * these overrides, it'd be better to remove.
1589 */
1590 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1591 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1592 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1593 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1594 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1595 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1596 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1597 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1598 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1599 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1600 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1601 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1602 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1603 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1604 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1605 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1606 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1607 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1608 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1609 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1610 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1611 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1612 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1613 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1615 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1616 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1617 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1618 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1619 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1620 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1621 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1622 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1623 /* default Intel */
1624 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1625 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1626 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1627 {}
1628 };
1629
1630 static const struct hda_model_fixup alc880_fixup_models[] = {
1631 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1632 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1633 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1634 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1635 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1636 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1637 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1638 {}
1639 };
1640
1641
1642 /*
1643 * OK, here we have finally the patch for ALC880
1644 */
patch_alc880(struct hda_codec * codec)1645 static int patch_alc880(struct hda_codec *codec)
1646 {
1647 struct alc_spec *spec;
1648 int err;
1649
1650 err = alc_alloc_spec(codec, 0x0b);
1651 if (err < 0)
1652 return err;
1653
1654 spec = codec->spec;
1655 spec->gen.need_dac_fix = 1;
1656 spec->gen.beep_nid = 0x01;
1657
1658 codec->patch_ops.unsol_event = alc880_unsol_event;
1659
1660 alc_pre_init(codec);
1661
1662 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1663 alc880_fixups);
1664 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1665
1666 /* automatic parse from the BIOS config */
1667 err = alc880_parse_auto_config(codec);
1668 if (err < 0)
1669 goto error;
1670
1671 if (!spec->gen.no_analog) {
1672 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1673 if (err < 0)
1674 goto error;
1675 }
1676
1677 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1678
1679 return 0;
1680
1681 error:
1682 alc_free(codec);
1683 return err;
1684 }
1685
1686
1687 /*
1688 * ALC260 support
1689 */
alc260_parse_auto_config(struct hda_codec * codec)1690 static int alc260_parse_auto_config(struct hda_codec *codec)
1691 {
1692 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1693 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1694 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1695 }
1696
1697 /*
1698 * Pin config fixes
1699 */
1700 enum {
1701 ALC260_FIXUP_HP_DC5750,
1702 ALC260_FIXUP_HP_PIN_0F,
1703 ALC260_FIXUP_COEF,
1704 ALC260_FIXUP_GPIO1,
1705 ALC260_FIXUP_GPIO1_TOGGLE,
1706 ALC260_FIXUP_REPLACER,
1707 ALC260_FIXUP_HP_B1900,
1708 ALC260_FIXUP_KN1,
1709 ALC260_FIXUP_FSC_S7020,
1710 ALC260_FIXUP_FSC_S7020_JWSE,
1711 ALC260_FIXUP_VAIO_PINS,
1712 };
1713
alc260_gpio1_automute(struct hda_codec * codec)1714 static void alc260_gpio1_automute(struct hda_codec *codec)
1715 {
1716 struct alc_spec *spec = codec->spec;
1717
1718 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1719 }
1720
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1721 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1722 const struct hda_fixup *fix, int action)
1723 {
1724 struct alc_spec *spec = codec->spec;
1725 if (action == HDA_FIXUP_ACT_PROBE) {
1726 /* although the machine has only one output pin, we need to
1727 * toggle GPIO1 according to the jack state
1728 */
1729 spec->gen.automute_hook = alc260_gpio1_automute;
1730 spec->gen.detect_hp = 1;
1731 spec->gen.automute_speaker = 1;
1732 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1733 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1734 snd_hda_gen_hp_automute);
1735 alc_setup_gpio(codec, 0x01);
1736 }
1737 }
1738
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1739 static void alc260_fixup_kn1(struct hda_codec *codec,
1740 const struct hda_fixup *fix, int action)
1741 {
1742 struct alc_spec *spec = codec->spec;
1743 static const struct hda_pintbl pincfgs[] = {
1744 { 0x0f, 0x02214000 }, /* HP/speaker */
1745 { 0x12, 0x90a60160 }, /* int mic */
1746 { 0x13, 0x02a19000 }, /* ext mic */
1747 { 0x18, 0x01446000 }, /* SPDIF out */
1748 /* disable bogus I/O pins */
1749 { 0x10, 0x411111f0 },
1750 { 0x11, 0x411111f0 },
1751 { 0x14, 0x411111f0 },
1752 { 0x15, 0x411111f0 },
1753 { 0x16, 0x411111f0 },
1754 { 0x17, 0x411111f0 },
1755 { 0x19, 0x411111f0 },
1756 { }
1757 };
1758
1759 switch (action) {
1760 case HDA_FIXUP_ACT_PRE_PROBE:
1761 snd_hda_apply_pincfgs(codec, pincfgs);
1762 spec->init_amp = ALC_INIT_NONE;
1763 break;
1764 }
1765 }
1766
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1767 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1768 const struct hda_fixup *fix, int action)
1769 {
1770 struct alc_spec *spec = codec->spec;
1771 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1772 spec->init_amp = ALC_INIT_NONE;
1773 }
1774
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1775 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1776 const struct hda_fixup *fix, int action)
1777 {
1778 struct alc_spec *spec = codec->spec;
1779 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1780 spec->gen.add_jack_modes = 1;
1781 spec->gen.hp_mic = 1;
1782 }
1783 }
1784
1785 static const struct hda_fixup alc260_fixups[] = {
1786 [ALC260_FIXUP_HP_DC5750] = {
1787 .type = HDA_FIXUP_PINS,
1788 .v.pins = (const struct hda_pintbl[]) {
1789 { 0x11, 0x90130110 }, /* speaker */
1790 { }
1791 }
1792 },
1793 [ALC260_FIXUP_HP_PIN_0F] = {
1794 .type = HDA_FIXUP_PINS,
1795 .v.pins = (const struct hda_pintbl[]) {
1796 { 0x0f, 0x01214000 }, /* HP */
1797 { }
1798 }
1799 },
1800 [ALC260_FIXUP_COEF] = {
1801 .type = HDA_FIXUP_VERBS,
1802 .v.verbs = (const struct hda_verb[]) {
1803 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1804 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1805 { }
1806 },
1807 },
1808 [ALC260_FIXUP_GPIO1] = {
1809 .type = HDA_FIXUP_FUNC,
1810 .v.func = alc_fixup_gpio1,
1811 },
1812 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1813 .type = HDA_FIXUP_FUNC,
1814 .v.func = alc260_fixup_gpio1_toggle,
1815 .chained = true,
1816 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1817 },
1818 [ALC260_FIXUP_REPLACER] = {
1819 .type = HDA_FIXUP_VERBS,
1820 .v.verbs = (const struct hda_verb[]) {
1821 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1822 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1823 { }
1824 },
1825 .chained = true,
1826 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1827 },
1828 [ALC260_FIXUP_HP_B1900] = {
1829 .type = HDA_FIXUP_FUNC,
1830 .v.func = alc260_fixup_gpio1_toggle,
1831 .chained = true,
1832 .chain_id = ALC260_FIXUP_COEF,
1833 },
1834 [ALC260_FIXUP_KN1] = {
1835 .type = HDA_FIXUP_FUNC,
1836 .v.func = alc260_fixup_kn1,
1837 },
1838 [ALC260_FIXUP_FSC_S7020] = {
1839 .type = HDA_FIXUP_FUNC,
1840 .v.func = alc260_fixup_fsc_s7020,
1841 },
1842 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1843 .type = HDA_FIXUP_FUNC,
1844 .v.func = alc260_fixup_fsc_s7020_jwse,
1845 .chained = true,
1846 .chain_id = ALC260_FIXUP_FSC_S7020,
1847 },
1848 [ALC260_FIXUP_VAIO_PINS] = {
1849 .type = HDA_FIXUP_PINS,
1850 .v.pins = (const struct hda_pintbl[]) {
1851 /* Pin configs are missing completely on some VAIOs */
1852 { 0x0f, 0x01211020 },
1853 { 0x10, 0x0001003f },
1854 { 0x11, 0x411111f0 },
1855 { 0x12, 0x01a15930 },
1856 { 0x13, 0x411111f0 },
1857 { 0x14, 0x411111f0 },
1858 { 0x15, 0x411111f0 },
1859 { 0x16, 0x411111f0 },
1860 { 0x17, 0x411111f0 },
1861 { 0x18, 0x411111f0 },
1862 { 0x19, 0x411111f0 },
1863 { }
1864 }
1865 },
1866 };
1867
1868 static const struct hda_quirk alc260_fixup_tbl[] = {
1869 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1870 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1871 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1872 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1873 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1874 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1875 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1876 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1877 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1878 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1879 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1880 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1881 {}
1882 };
1883
1884 static const struct hda_model_fixup alc260_fixup_models[] = {
1885 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1886 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1887 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1888 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1889 {}
1890 };
1891
1892 /*
1893 */
patch_alc260(struct hda_codec * codec)1894 static int patch_alc260(struct hda_codec *codec)
1895 {
1896 struct alc_spec *spec;
1897 int err;
1898
1899 err = alc_alloc_spec(codec, 0x07);
1900 if (err < 0)
1901 return err;
1902
1903 spec = codec->spec;
1904 /* as quite a few machines require HP amp for speaker outputs,
1905 * it's easier to enable it unconditionally; even if it's unneeded,
1906 * it's almost harmless.
1907 */
1908 spec->gen.prefer_hp_amp = 1;
1909 spec->gen.beep_nid = 0x01;
1910
1911 spec->shutup = alc_eapd_shutup;
1912
1913 alc_pre_init(codec);
1914
1915 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1916 alc260_fixups);
1917 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1918
1919 /* automatic parse from the BIOS config */
1920 err = alc260_parse_auto_config(codec);
1921 if (err < 0)
1922 goto error;
1923
1924 if (!spec->gen.no_analog) {
1925 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1926 if (err < 0)
1927 goto error;
1928 }
1929
1930 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1931
1932 return 0;
1933
1934 error:
1935 alc_free(codec);
1936 return err;
1937 }
1938
1939
1940 /*
1941 * ALC882/883/885/888/889 support
1942 *
1943 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1944 * configuration. Each pin widget can choose any input DACs and a mixer.
1945 * Each ADC is connected from a mixer of all inputs. This makes possible
1946 * 6-channel independent captures.
1947 *
1948 * In addition, an independent DAC for the multi-playback (not used in this
1949 * driver yet).
1950 */
1951
1952 /*
1953 * Pin config fixes
1954 */
1955 enum {
1956 ALC882_FIXUP_ABIT_AW9D_MAX,
1957 ALC882_FIXUP_LENOVO_Y530,
1958 ALC882_FIXUP_PB_M5210,
1959 ALC882_FIXUP_ACER_ASPIRE_7736,
1960 ALC882_FIXUP_ASUS_W90V,
1961 ALC889_FIXUP_CD,
1962 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1963 ALC889_FIXUP_VAIO_TT,
1964 ALC888_FIXUP_EEE1601,
1965 ALC886_FIXUP_EAPD,
1966 ALC882_FIXUP_EAPD,
1967 ALC883_FIXUP_EAPD,
1968 ALC883_FIXUP_ACER_EAPD,
1969 ALC882_FIXUP_GPIO1,
1970 ALC882_FIXUP_GPIO2,
1971 ALC882_FIXUP_GPIO3,
1972 ALC889_FIXUP_COEF,
1973 ALC882_FIXUP_ASUS_W2JC,
1974 ALC882_FIXUP_ACER_ASPIRE_4930G,
1975 ALC882_FIXUP_ACER_ASPIRE_8930G,
1976 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1977 ALC885_FIXUP_MACPRO_GPIO,
1978 ALC889_FIXUP_DAC_ROUTE,
1979 ALC889_FIXUP_MBP_VREF,
1980 ALC889_FIXUP_IMAC91_VREF,
1981 ALC889_FIXUP_MBA11_VREF,
1982 ALC889_FIXUP_MBA21_VREF,
1983 ALC889_FIXUP_MP11_VREF,
1984 ALC889_FIXUP_MP41_VREF,
1985 ALC882_FIXUP_INV_DMIC,
1986 ALC882_FIXUP_NO_PRIMARY_HP,
1987 ALC887_FIXUP_ASUS_BASS,
1988 ALC887_FIXUP_BASS_CHMAP,
1989 ALC1220_FIXUP_GB_DUAL_CODECS,
1990 ALC1220_FIXUP_GB_X570,
1991 ALC1220_FIXUP_CLEVO_P950,
1992 ALC1220_FIXUP_CLEVO_PB51ED,
1993 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1994 ALC887_FIXUP_ASUS_AUDIO,
1995 ALC887_FIXUP_ASUS_HMIC,
1996 ALCS1200A_FIXUP_MIC_VREF,
1997 ALC888VD_FIXUP_MIC_100VREF,
1998 };
1999
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)2000 static void alc889_fixup_coef(struct hda_codec *codec,
2001 const struct hda_fixup *fix, int action)
2002 {
2003 if (action != HDA_FIXUP_ACT_INIT)
2004 return;
2005 alc_update_coef_idx(codec, 7, 0, 0x2030);
2006 }
2007
2008 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2009 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2010 const struct hda_fixup *fix, int action)
2011 {
2012 struct alc_spec *spec = codec->spec;
2013
2014 spec->gpio_write_delay = true;
2015 alc_fixup_gpio3(codec, fix, action);
2016 }
2017
2018 /* Fix the connection of some pins for ALC889:
2019 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2020 * work correctly (bko#42740)
2021 */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2022 static void alc889_fixup_dac_route(struct hda_codec *codec,
2023 const struct hda_fixup *fix, int action)
2024 {
2025 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2026 /* fake the connections during parsing the tree */
2027 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2028 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2029 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2030 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2031 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2032 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2033 } else if (action == HDA_FIXUP_ACT_PROBE) {
2034 /* restore the connections */
2035 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2036 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2037 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2038 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2039 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2040 }
2041 }
2042
2043 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2044 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2045 const struct hda_fixup *fix, int action)
2046 {
2047 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2048 struct alc_spec *spec = codec->spec;
2049 int i;
2050
2051 if (action != HDA_FIXUP_ACT_INIT)
2052 return;
2053 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2054 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2055 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2056 continue;
2057 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2058 val |= AC_PINCTL_VREF_80;
2059 snd_hda_set_pin_ctl(codec, nids[i], val);
2060 spec->gen.keep_vref_in_automute = 1;
2061 break;
2062 }
2063 }
2064
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2065 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2066 const hda_nid_t *nids, int num_nids)
2067 {
2068 struct alc_spec *spec = codec->spec;
2069 int i;
2070
2071 for (i = 0; i < num_nids; i++) {
2072 unsigned int val;
2073 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2074 val |= AC_PINCTL_VREF_50;
2075 snd_hda_set_pin_ctl(codec, nids[i], val);
2076 }
2077 spec->gen.keep_vref_in_automute = 1;
2078 }
2079
2080 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2081 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2082 const struct hda_fixup *fix, int action)
2083 {
2084 static const hda_nid_t nids[] = { 0x18, 0x1a };
2085
2086 if (action == HDA_FIXUP_ACT_INIT)
2087 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2088 }
2089
2090 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2091 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2092 const struct hda_fixup *fix, int action)
2093 {
2094 static const hda_nid_t nids[] = { 0x18 };
2095
2096 if (action == HDA_FIXUP_ACT_INIT)
2097 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2098 }
2099
2100 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2101 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2102 const struct hda_fixup *fix, int action)
2103 {
2104 static const hda_nid_t nids[] = { 0x18, 0x19 };
2105
2106 if (action == HDA_FIXUP_ACT_INIT)
2107 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2108 }
2109
2110 /* Don't take HP output as primary
2111 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2112 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2113 */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2114 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2115 const struct hda_fixup *fix, int action)
2116 {
2117 struct alc_spec *spec = codec->spec;
2118 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2119 spec->gen.no_primary_hp = 1;
2120 spec->gen.no_multi_io = 1;
2121 }
2122 }
2123
2124 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2125 const struct hda_fixup *fix, int action);
2126
2127 /* For dual-codec configuration, we need to disable some features to avoid
2128 * conflicts of kctls and PCM streams
2129 */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2130 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2131 const struct hda_fixup *fix, int action)
2132 {
2133 struct alc_spec *spec = codec->spec;
2134
2135 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2136 return;
2137 /* disable vmaster */
2138 spec->gen.suppress_vmaster = 1;
2139 /* auto-mute and auto-mic switch don't work with multiple codecs */
2140 spec->gen.suppress_auto_mute = 1;
2141 spec->gen.suppress_auto_mic = 1;
2142 /* disable aamix as well */
2143 spec->gen.mixer_nid = 0;
2144 /* add location prefix to avoid conflicts */
2145 codec->force_pin_prefix = 1;
2146 }
2147
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2148 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2149 const char *newname)
2150 {
2151 struct snd_kcontrol *kctl;
2152
2153 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2154 if (kctl)
2155 snd_ctl_rename(codec->card, kctl, newname);
2156 }
2157
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2158 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2159 const struct hda_fixup *fix,
2160 int action)
2161 {
2162 alc_fixup_dual_codecs(codec, fix, action);
2163 switch (action) {
2164 case HDA_FIXUP_ACT_PRE_PROBE:
2165 /* override card longname to provide a unique UCM profile */
2166 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2167 break;
2168 case HDA_FIXUP_ACT_BUILD:
2169 /* rename Capture controls depending on the codec */
2170 rename_ctl(codec, "Capture Volume",
2171 codec->addr == 0 ?
2172 "Rear-Panel Capture Volume" :
2173 "Front-Panel Capture Volume");
2174 rename_ctl(codec, "Capture Switch",
2175 codec->addr == 0 ?
2176 "Rear-Panel Capture Switch" :
2177 "Front-Panel Capture Switch");
2178 break;
2179 }
2180 }
2181
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2182 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2183 const struct hda_fixup *fix,
2184 int action)
2185 {
2186 static const hda_nid_t conn1[] = { 0x0c };
2187 static const struct coef_fw gb_x570_coefs[] = {
2188 WRITE_COEF(0x07, 0x03c0),
2189 WRITE_COEF(0x1a, 0x01c1),
2190 WRITE_COEF(0x1b, 0x0202),
2191 WRITE_COEF(0x43, 0x3005),
2192 {}
2193 };
2194
2195 switch (action) {
2196 case HDA_FIXUP_ACT_PRE_PROBE:
2197 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2198 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2199 break;
2200 case HDA_FIXUP_ACT_INIT:
2201 alc_process_coef_fw(codec, gb_x570_coefs);
2202 break;
2203 }
2204 }
2205
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2206 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2207 const struct hda_fixup *fix,
2208 int action)
2209 {
2210 static const hda_nid_t conn1[] = { 0x0c };
2211
2212 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2213 return;
2214
2215 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2216 /* We therefore want to make sure 0x14 (front headphone) and
2217 * 0x1b (speakers) use the stereo DAC 0x02
2218 */
2219 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2220 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2221 }
2222
2223 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2224 const struct hda_fixup *fix, int action);
2225
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2226 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2227 const struct hda_fixup *fix,
2228 int action)
2229 {
2230 alc1220_fixup_clevo_p950(codec, fix, action);
2231 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2232 }
2233
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2234 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2235 struct hda_jack_callback *jack)
2236 {
2237 struct alc_spec *spec = codec->spec;
2238 unsigned int vref;
2239
2240 snd_hda_gen_hp_automute(codec, jack);
2241
2242 if (spec->gen.hp_jack_present)
2243 vref = AC_PINCTL_VREF_80;
2244 else
2245 vref = AC_PINCTL_VREF_HIZ;
2246 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2247 }
2248
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2249 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2250 const struct hda_fixup *fix, int action)
2251 {
2252 struct alc_spec *spec = codec->spec;
2253 if (action != HDA_FIXUP_ACT_PROBE)
2254 return;
2255 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2256 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2257 }
2258
2259 static const struct hda_fixup alc882_fixups[] = {
2260 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2261 .type = HDA_FIXUP_PINS,
2262 .v.pins = (const struct hda_pintbl[]) {
2263 { 0x15, 0x01080104 }, /* side */
2264 { 0x16, 0x01011012 }, /* rear */
2265 { 0x17, 0x01016011 }, /* clfe */
2266 { }
2267 }
2268 },
2269 [ALC882_FIXUP_LENOVO_Y530] = {
2270 .type = HDA_FIXUP_PINS,
2271 .v.pins = (const struct hda_pintbl[]) {
2272 { 0x15, 0x99130112 }, /* rear int speakers */
2273 { 0x16, 0x99130111 }, /* subwoofer */
2274 { }
2275 }
2276 },
2277 [ALC882_FIXUP_PB_M5210] = {
2278 .type = HDA_FIXUP_PINCTLS,
2279 .v.pins = (const struct hda_pintbl[]) {
2280 { 0x19, PIN_VREF50 },
2281 {}
2282 }
2283 },
2284 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2285 .type = HDA_FIXUP_FUNC,
2286 .v.func = alc_fixup_sku_ignore,
2287 },
2288 [ALC882_FIXUP_ASUS_W90V] = {
2289 .type = HDA_FIXUP_PINS,
2290 .v.pins = (const struct hda_pintbl[]) {
2291 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2292 { }
2293 }
2294 },
2295 [ALC889_FIXUP_CD] = {
2296 .type = HDA_FIXUP_PINS,
2297 .v.pins = (const struct hda_pintbl[]) {
2298 { 0x1c, 0x993301f0 }, /* CD */
2299 { }
2300 }
2301 },
2302 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2303 .type = HDA_FIXUP_PINS,
2304 .v.pins = (const struct hda_pintbl[]) {
2305 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2306 { }
2307 },
2308 .chained = true,
2309 .chain_id = ALC889_FIXUP_CD,
2310 },
2311 [ALC889_FIXUP_VAIO_TT] = {
2312 .type = HDA_FIXUP_PINS,
2313 .v.pins = (const struct hda_pintbl[]) {
2314 { 0x17, 0x90170111 }, /* hidden surround speaker */
2315 { }
2316 }
2317 },
2318 [ALC888_FIXUP_EEE1601] = {
2319 .type = HDA_FIXUP_VERBS,
2320 .v.verbs = (const struct hda_verb[]) {
2321 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2322 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2323 { }
2324 }
2325 },
2326 [ALC886_FIXUP_EAPD] = {
2327 .type = HDA_FIXUP_VERBS,
2328 .v.verbs = (const struct hda_verb[]) {
2329 /* change to EAPD mode */
2330 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2331 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2332 { }
2333 }
2334 },
2335 [ALC882_FIXUP_EAPD] = {
2336 .type = HDA_FIXUP_VERBS,
2337 .v.verbs = (const struct hda_verb[]) {
2338 /* change to EAPD mode */
2339 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2340 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2341 { }
2342 }
2343 },
2344 [ALC883_FIXUP_EAPD] = {
2345 .type = HDA_FIXUP_VERBS,
2346 .v.verbs = (const struct hda_verb[]) {
2347 /* change to EAPD mode */
2348 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2349 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2350 { }
2351 }
2352 },
2353 [ALC883_FIXUP_ACER_EAPD] = {
2354 .type = HDA_FIXUP_VERBS,
2355 .v.verbs = (const struct hda_verb[]) {
2356 /* eanable EAPD on Acer laptops */
2357 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2358 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2359 { }
2360 }
2361 },
2362 [ALC882_FIXUP_GPIO1] = {
2363 .type = HDA_FIXUP_FUNC,
2364 .v.func = alc_fixup_gpio1,
2365 },
2366 [ALC882_FIXUP_GPIO2] = {
2367 .type = HDA_FIXUP_FUNC,
2368 .v.func = alc_fixup_gpio2,
2369 },
2370 [ALC882_FIXUP_GPIO3] = {
2371 .type = HDA_FIXUP_FUNC,
2372 .v.func = alc_fixup_gpio3,
2373 },
2374 [ALC882_FIXUP_ASUS_W2JC] = {
2375 .type = HDA_FIXUP_FUNC,
2376 .v.func = alc_fixup_gpio1,
2377 .chained = true,
2378 .chain_id = ALC882_FIXUP_EAPD,
2379 },
2380 [ALC889_FIXUP_COEF] = {
2381 .type = HDA_FIXUP_FUNC,
2382 .v.func = alc889_fixup_coef,
2383 },
2384 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2385 .type = HDA_FIXUP_PINS,
2386 .v.pins = (const struct hda_pintbl[]) {
2387 { 0x16, 0x99130111 }, /* CLFE speaker */
2388 { 0x17, 0x99130112 }, /* surround speaker */
2389 { }
2390 },
2391 .chained = true,
2392 .chain_id = ALC882_FIXUP_GPIO1,
2393 },
2394 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2395 .type = HDA_FIXUP_PINS,
2396 .v.pins = (const struct hda_pintbl[]) {
2397 { 0x16, 0x99130111 }, /* CLFE speaker */
2398 { 0x1b, 0x99130112 }, /* surround speaker */
2399 { }
2400 },
2401 .chained = true,
2402 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2403 },
2404 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2405 /* additional init verbs for Acer Aspire 8930G */
2406 .type = HDA_FIXUP_VERBS,
2407 .v.verbs = (const struct hda_verb[]) {
2408 /* Enable all DACs */
2409 /* DAC DISABLE/MUTE 1? */
2410 /* setting bits 1-5 disables DAC nids 0x02-0x06
2411 * apparently. Init=0x38 */
2412 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2413 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2414 /* DAC DISABLE/MUTE 2? */
2415 /* some bit here disables the other DACs.
2416 * Init=0x4900 */
2417 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2418 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2419 /* DMIC fix
2420 * This laptop has a stereo digital microphone.
2421 * The mics are only 1cm apart which makes the stereo
2422 * useless. However, either the mic or the ALC889
2423 * makes the signal become a difference/sum signal
2424 * instead of standard stereo, which is annoying.
2425 * So instead we flip this bit which makes the
2426 * codec replicate the sum signal to both channels,
2427 * turning it into a normal mono mic.
2428 */
2429 /* DMIC_CONTROL? Init value = 0x0001 */
2430 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2431 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2432 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2433 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2434 { }
2435 },
2436 .chained = true,
2437 .chain_id = ALC882_FIXUP_GPIO1,
2438 },
2439 [ALC885_FIXUP_MACPRO_GPIO] = {
2440 .type = HDA_FIXUP_FUNC,
2441 .v.func = alc885_fixup_macpro_gpio,
2442 },
2443 [ALC889_FIXUP_DAC_ROUTE] = {
2444 .type = HDA_FIXUP_FUNC,
2445 .v.func = alc889_fixup_dac_route,
2446 },
2447 [ALC889_FIXUP_MBP_VREF] = {
2448 .type = HDA_FIXUP_FUNC,
2449 .v.func = alc889_fixup_mbp_vref,
2450 .chained = true,
2451 .chain_id = ALC882_FIXUP_GPIO1,
2452 },
2453 [ALC889_FIXUP_IMAC91_VREF] = {
2454 .type = HDA_FIXUP_FUNC,
2455 .v.func = alc889_fixup_imac91_vref,
2456 .chained = true,
2457 .chain_id = ALC882_FIXUP_GPIO1,
2458 },
2459 [ALC889_FIXUP_MBA11_VREF] = {
2460 .type = HDA_FIXUP_FUNC,
2461 .v.func = alc889_fixup_mba11_vref,
2462 .chained = true,
2463 .chain_id = ALC889_FIXUP_MBP_VREF,
2464 },
2465 [ALC889_FIXUP_MBA21_VREF] = {
2466 .type = HDA_FIXUP_FUNC,
2467 .v.func = alc889_fixup_mba21_vref,
2468 .chained = true,
2469 .chain_id = ALC889_FIXUP_MBP_VREF,
2470 },
2471 [ALC889_FIXUP_MP11_VREF] = {
2472 .type = HDA_FIXUP_FUNC,
2473 .v.func = alc889_fixup_mba11_vref,
2474 .chained = true,
2475 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2476 },
2477 [ALC889_FIXUP_MP41_VREF] = {
2478 .type = HDA_FIXUP_FUNC,
2479 .v.func = alc889_fixup_mbp_vref,
2480 .chained = true,
2481 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2482 },
2483 [ALC882_FIXUP_INV_DMIC] = {
2484 .type = HDA_FIXUP_FUNC,
2485 .v.func = alc_fixup_inv_dmic,
2486 },
2487 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2488 .type = HDA_FIXUP_FUNC,
2489 .v.func = alc882_fixup_no_primary_hp,
2490 },
2491 [ALC887_FIXUP_ASUS_BASS] = {
2492 .type = HDA_FIXUP_PINS,
2493 .v.pins = (const struct hda_pintbl[]) {
2494 {0x16, 0x99130130}, /* bass speaker */
2495 {}
2496 },
2497 .chained = true,
2498 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2499 },
2500 [ALC887_FIXUP_BASS_CHMAP] = {
2501 .type = HDA_FIXUP_FUNC,
2502 .v.func = alc_fixup_bass_chmap,
2503 },
2504 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2505 .type = HDA_FIXUP_FUNC,
2506 .v.func = alc1220_fixup_gb_dual_codecs,
2507 },
2508 [ALC1220_FIXUP_GB_X570] = {
2509 .type = HDA_FIXUP_FUNC,
2510 .v.func = alc1220_fixup_gb_x570,
2511 },
2512 [ALC1220_FIXUP_CLEVO_P950] = {
2513 .type = HDA_FIXUP_FUNC,
2514 .v.func = alc1220_fixup_clevo_p950,
2515 },
2516 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2517 .type = HDA_FIXUP_FUNC,
2518 .v.func = alc1220_fixup_clevo_pb51ed,
2519 },
2520 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2521 .type = HDA_FIXUP_PINS,
2522 .v.pins = (const struct hda_pintbl[]) {
2523 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2524 {}
2525 },
2526 .chained = true,
2527 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2528 },
2529 [ALC887_FIXUP_ASUS_AUDIO] = {
2530 .type = HDA_FIXUP_PINS,
2531 .v.pins = (const struct hda_pintbl[]) {
2532 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2533 { 0x19, 0x22219420 },
2534 {}
2535 },
2536 },
2537 [ALC887_FIXUP_ASUS_HMIC] = {
2538 .type = HDA_FIXUP_FUNC,
2539 .v.func = alc887_fixup_asus_jack,
2540 .chained = true,
2541 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2542 },
2543 [ALCS1200A_FIXUP_MIC_VREF] = {
2544 .type = HDA_FIXUP_PINCTLS,
2545 .v.pins = (const struct hda_pintbl[]) {
2546 { 0x18, PIN_VREF50 }, /* rear mic */
2547 { 0x19, PIN_VREF50 }, /* front mic */
2548 {}
2549 }
2550 },
2551 [ALC888VD_FIXUP_MIC_100VREF] = {
2552 .type = HDA_FIXUP_PINCTLS,
2553 .v.pins = (const struct hda_pintbl[]) {
2554 { 0x18, PIN_VREF100 }, /* headset mic */
2555 {}
2556 }
2557 },
2558 };
2559
2560 static const struct hda_quirk alc882_fixup_tbl[] = {
2561 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2562 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2563 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2564 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2565 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2566 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2567 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2568 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2569 ALC882_FIXUP_ACER_ASPIRE_4930G),
2570 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2571 ALC882_FIXUP_ACER_ASPIRE_4930G),
2572 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2573 ALC882_FIXUP_ACER_ASPIRE_8930G),
2574 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2575 ALC882_FIXUP_ACER_ASPIRE_8930G),
2576 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2577 ALC882_FIXUP_ACER_ASPIRE_4930G),
2578 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2579 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2580 ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2582 ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2584 ALC882_FIXUP_ACER_ASPIRE_4930G),
2585 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2586 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2587 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2588 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2589 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2590 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2591 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2592 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2593 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2594 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2595 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2596 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2597 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2598 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2599 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2600 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2601
2602 /* All Apple entries are in codec SSIDs */
2603 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2604 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2605 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2606 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2607 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2608 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2609 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2610 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2611 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2612 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2613 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2614 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2615 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2616 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2617 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2618 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2619 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2620 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2621 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2622 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2623 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2624 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2625
2626 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2627 SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2628 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2629 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2630 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2631 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2632 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2633 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2634 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2635 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2636 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2637 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2638 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2639 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2640 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2641 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2642 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2643 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2644 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2645 SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2650 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2651 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2652 SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2653 SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2654 SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2655 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2661 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2662 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2663 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2664 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2665 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2666 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2667 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2668 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2669 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2670 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2671 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2672 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2673 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2674 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2675 SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2676 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2677 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2678 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2679 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2680 {}
2681 };
2682
2683 static const struct hda_model_fixup alc882_fixup_models[] = {
2684 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2685 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2686 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2687 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2688 {.id = ALC889_FIXUP_CD, .name = "cd"},
2689 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2690 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2691 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2692 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2693 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2694 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2695 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2696 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2697 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2698 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2699 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2700 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2701 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2702 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2703 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2704 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2705 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2706 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2707 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2708 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2709 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2710 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2711 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2712 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2713 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2714 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2715 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2716 {}
2717 };
2718
2719 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2720 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2721 {0x14, 0x01014010},
2722 {0x15, 0x01011012},
2723 {0x16, 0x01016011},
2724 {0x18, 0x01a19040},
2725 {0x19, 0x02a19050},
2726 {0x1a, 0x0181304f},
2727 {0x1b, 0x0221401f},
2728 {0x1e, 0x01456130}),
2729 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2730 {0x14, 0x01015010},
2731 {0x15, 0x01011012},
2732 {0x16, 0x01011011},
2733 {0x18, 0x01a11040},
2734 {0x19, 0x02a19050},
2735 {0x1a, 0x0181104f},
2736 {0x1b, 0x0221401f},
2737 {0x1e, 0x01451130}),
2738 {}
2739 };
2740
2741 /*
2742 * BIOS auto configuration
2743 */
2744 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2745 static int alc882_parse_auto_config(struct hda_codec *codec)
2746 {
2747 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2748 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2749 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2750 }
2751
2752 /*
2753 */
patch_alc882(struct hda_codec * codec)2754 static int patch_alc882(struct hda_codec *codec)
2755 {
2756 struct alc_spec *spec;
2757 int err;
2758
2759 err = alc_alloc_spec(codec, 0x0b);
2760 if (err < 0)
2761 return err;
2762
2763 spec = codec->spec;
2764
2765 switch (codec->core.vendor_id) {
2766 case 0x10ec0882:
2767 case 0x10ec0885:
2768 case 0x10ec0900:
2769 case 0x10ec0b00:
2770 case 0x10ec1220:
2771 break;
2772 default:
2773 /* ALC883 and variants */
2774 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2775 break;
2776 }
2777
2778 alc_pre_init(codec);
2779
2780 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2781 alc882_fixups);
2782 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2783 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2784
2785 alc_auto_parse_customize_define(codec);
2786
2787 if (has_cdefine_beep(codec))
2788 spec->gen.beep_nid = 0x01;
2789
2790 /* automatic parse from the BIOS config */
2791 err = alc882_parse_auto_config(codec);
2792 if (err < 0)
2793 goto error;
2794
2795 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2796 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2797 if (err < 0)
2798 goto error;
2799 }
2800
2801 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2802
2803 return 0;
2804
2805 error:
2806 alc_free(codec);
2807 return err;
2808 }
2809
2810
2811 /*
2812 * ALC262 support
2813 */
alc262_parse_auto_config(struct hda_codec * codec)2814 static int alc262_parse_auto_config(struct hda_codec *codec)
2815 {
2816 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2817 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2818 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2819 }
2820
2821 /*
2822 * Pin config fixes
2823 */
2824 enum {
2825 ALC262_FIXUP_FSC_H270,
2826 ALC262_FIXUP_FSC_S7110,
2827 ALC262_FIXUP_HP_Z200,
2828 ALC262_FIXUP_TYAN,
2829 ALC262_FIXUP_LENOVO_3000,
2830 ALC262_FIXUP_BENQ,
2831 ALC262_FIXUP_BENQ_T31,
2832 ALC262_FIXUP_INV_DMIC,
2833 ALC262_FIXUP_INTEL_BAYLEYBAY,
2834 };
2835
2836 static const struct hda_fixup alc262_fixups[] = {
2837 [ALC262_FIXUP_FSC_H270] = {
2838 .type = HDA_FIXUP_PINS,
2839 .v.pins = (const struct hda_pintbl[]) {
2840 { 0x14, 0x99130110 }, /* speaker */
2841 { 0x15, 0x0221142f }, /* front HP */
2842 { 0x1b, 0x0121141f }, /* rear HP */
2843 { }
2844 }
2845 },
2846 [ALC262_FIXUP_FSC_S7110] = {
2847 .type = HDA_FIXUP_PINS,
2848 .v.pins = (const struct hda_pintbl[]) {
2849 { 0x15, 0x90170110 }, /* speaker */
2850 { }
2851 },
2852 .chained = true,
2853 .chain_id = ALC262_FIXUP_BENQ,
2854 },
2855 [ALC262_FIXUP_HP_Z200] = {
2856 .type = HDA_FIXUP_PINS,
2857 .v.pins = (const struct hda_pintbl[]) {
2858 { 0x16, 0x99130120 }, /* internal speaker */
2859 { }
2860 }
2861 },
2862 [ALC262_FIXUP_TYAN] = {
2863 .type = HDA_FIXUP_PINS,
2864 .v.pins = (const struct hda_pintbl[]) {
2865 { 0x14, 0x1993e1f0 }, /* int AUX */
2866 { }
2867 }
2868 },
2869 [ALC262_FIXUP_LENOVO_3000] = {
2870 .type = HDA_FIXUP_PINCTLS,
2871 .v.pins = (const struct hda_pintbl[]) {
2872 { 0x19, PIN_VREF50 },
2873 {}
2874 },
2875 .chained = true,
2876 .chain_id = ALC262_FIXUP_BENQ,
2877 },
2878 [ALC262_FIXUP_BENQ] = {
2879 .type = HDA_FIXUP_VERBS,
2880 .v.verbs = (const struct hda_verb[]) {
2881 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2882 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2883 {}
2884 }
2885 },
2886 [ALC262_FIXUP_BENQ_T31] = {
2887 .type = HDA_FIXUP_VERBS,
2888 .v.verbs = (const struct hda_verb[]) {
2889 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2890 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2891 {}
2892 }
2893 },
2894 [ALC262_FIXUP_INV_DMIC] = {
2895 .type = HDA_FIXUP_FUNC,
2896 .v.func = alc_fixup_inv_dmic,
2897 },
2898 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2899 .type = HDA_FIXUP_FUNC,
2900 .v.func = alc_fixup_no_depop_delay,
2901 },
2902 };
2903
2904 static const struct hda_quirk alc262_fixup_tbl[] = {
2905 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2906 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2907 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2908 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2909 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2910 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2911 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2912 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2913 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2914 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2915 {}
2916 };
2917
2918 static const struct hda_model_fixup alc262_fixup_models[] = {
2919 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2920 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2921 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2922 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2923 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2924 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2925 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2926 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2927 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2928 {}
2929 };
2930
2931 /*
2932 */
patch_alc262(struct hda_codec * codec)2933 static int patch_alc262(struct hda_codec *codec)
2934 {
2935 struct alc_spec *spec;
2936 int err;
2937
2938 err = alc_alloc_spec(codec, 0x0b);
2939 if (err < 0)
2940 return err;
2941
2942 spec = codec->spec;
2943 spec->gen.shared_mic_vref_pin = 0x18;
2944
2945 spec->shutup = alc_eapd_shutup;
2946
2947 #if 0
2948 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2949 * under-run
2950 */
2951 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2952 #endif
2953 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2954
2955 alc_pre_init(codec);
2956
2957 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2958 alc262_fixups);
2959 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2960
2961 alc_auto_parse_customize_define(codec);
2962
2963 if (has_cdefine_beep(codec))
2964 spec->gen.beep_nid = 0x01;
2965
2966 /* automatic parse from the BIOS config */
2967 err = alc262_parse_auto_config(codec);
2968 if (err < 0)
2969 goto error;
2970
2971 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2972 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2973 if (err < 0)
2974 goto error;
2975 }
2976
2977 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2978
2979 return 0;
2980
2981 error:
2982 alc_free(codec);
2983 return err;
2984 }
2985
2986 /*
2987 * ALC268
2988 */
2989 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2990 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2991 struct snd_ctl_elem_value *ucontrol)
2992 {
2993 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2994 unsigned long pval;
2995 int err;
2996
2997 mutex_lock(&codec->control_mutex);
2998 pval = kcontrol->private_value;
2999 kcontrol->private_value = (pval & ~0xff) | 0x0f;
3000 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3001 if (err >= 0) {
3002 kcontrol->private_value = (pval & ~0xff) | 0x10;
3003 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3004 }
3005 kcontrol->private_value = pval;
3006 mutex_unlock(&codec->control_mutex);
3007 return err;
3008 }
3009
3010 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3011 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3012 {
3013 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3014 .name = "Beep Playback Switch",
3015 .subdevice = HDA_SUBDEV_AMP_FLAG,
3016 .info = snd_hda_mixer_amp_switch_info,
3017 .get = snd_hda_mixer_amp_switch_get,
3018 .put = alc268_beep_switch_put,
3019 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3020 },
3021 };
3022
3023 /* set PCBEEP vol = 0, mute connections */
3024 static const struct hda_verb alc268_beep_init_verbs[] = {
3025 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3026 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3027 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3028 { }
3029 };
3030
3031 enum {
3032 ALC268_FIXUP_INV_DMIC,
3033 ALC268_FIXUP_HP_EAPD,
3034 ALC268_FIXUP_SPDIF,
3035 };
3036
3037 static const struct hda_fixup alc268_fixups[] = {
3038 [ALC268_FIXUP_INV_DMIC] = {
3039 .type = HDA_FIXUP_FUNC,
3040 .v.func = alc_fixup_inv_dmic,
3041 },
3042 [ALC268_FIXUP_HP_EAPD] = {
3043 .type = HDA_FIXUP_VERBS,
3044 .v.verbs = (const struct hda_verb[]) {
3045 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3046 {}
3047 }
3048 },
3049 [ALC268_FIXUP_SPDIF] = {
3050 .type = HDA_FIXUP_PINS,
3051 .v.pins = (const struct hda_pintbl[]) {
3052 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3053 {}
3054 }
3055 },
3056 };
3057
3058 static const struct hda_model_fixup alc268_fixup_models[] = {
3059 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3060 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3061 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3062 {}
3063 };
3064
3065 static const struct hda_quirk alc268_fixup_tbl[] = {
3066 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3067 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3068 /* below is codec SSID since multiple Toshiba laptops have the
3069 * same PCI SSID 1179:ff00
3070 */
3071 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3072 {}
3073 };
3074
3075 /*
3076 * BIOS auto configuration
3077 */
alc268_parse_auto_config(struct hda_codec * codec)3078 static int alc268_parse_auto_config(struct hda_codec *codec)
3079 {
3080 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3081 return alc_parse_auto_config(codec, NULL, alc268_ssids);
3082 }
3083
3084 /*
3085 */
patch_alc268(struct hda_codec * codec)3086 static int patch_alc268(struct hda_codec *codec)
3087 {
3088 struct alc_spec *spec;
3089 int i, err;
3090
3091 /* ALC268 has no aa-loopback mixer */
3092 err = alc_alloc_spec(codec, 0);
3093 if (err < 0)
3094 return err;
3095
3096 spec = codec->spec;
3097 if (has_cdefine_beep(codec))
3098 spec->gen.beep_nid = 0x01;
3099
3100 spec->shutup = alc_eapd_shutup;
3101
3102 alc_pre_init(codec);
3103
3104 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3105 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3106
3107 /* automatic parse from the BIOS config */
3108 err = alc268_parse_auto_config(codec);
3109 if (err < 0)
3110 goto error;
3111
3112 if (err > 0 && !spec->gen.no_analog &&
3113 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3114 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3115 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3116 &alc268_beep_mixer[i])) {
3117 err = -ENOMEM;
3118 goto error;
3119 }
3120 }
3121 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3122 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3123 /* override the amp caps for beep generator */
3124 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3125 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3126 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3127 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3128 (0 << AC_AMPCAP_MUTE_SHIFT));
3129 }
3130
3131 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3132
3133 return 0;
3134
3135 error:
3136 alc_free(codec);
3137 return err;
3138 }
3139
3140 /*
3141 * ALC269
3142 */
3143
3144 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3145 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3146 };
3147
3148 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3149 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3150 };
3151
3152 /* different alc269-variants */
3153 enum {
3154 ALC269_TYPE_ALC269VA,
3155 ALC269_TYPE_ALC269VB,
3156 ALC269_TYPE_ALC269VC,
3157 ALC269_TYPE_ALC269VD,
3158 ALC269_TYPE_ALC280,
3159 ALC269_TYPE_ALC282,
3160 ALC269_TYPE_ALC283,
3161 ALC269_TYPE_ALC284,
3162 ALC269_TYPE_ALC293,
3163 ALC269_TYPE_ALC286,
3164 ALC269_TYPE_ALC298,
3165 ALC269_TYPE_ALC255,
3166 ALC269_TYPE_ALC256,
3167 ALC269_TYPE_ALC257,
3168 ALC269_TYPE_ALC215,
3169 ALC269_TYPE_ALC225,
3170 ALC269_TYPE_ALC245,
3171 ALC269_TYPE_ALC287,
3172 ALC269_TYPE_ALC294,
3173 ALC269_TYPE_ALC300,
3174 ALC269_TYPE_ALC623,
3175 ALC269_TYPE_ALC700,
3176 };
3177
3178 /*
3179 * BIOS auto configuration
3180 */
alc269_parse_auto_config(struct hda_codec * codec)3181 static int alc269_parse_auto_config(struct hda_codec *codec)
3182 {
3183 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3184 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3185 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3186 struct alc_spec *spec = codec->spec;
3187 const hda_nid_t *ssids;
3188
3189 switch (spec->codec_variant) {
3190 case ALC269_TYPE_ALC269VA:
3191 case ALC269_TYPE_ALC269VC:
3192 case ALC269_TYPE_ALC280:
3193 case ALC269_TYPE_ALC284:
3194 case ALC269_TYPE_ALC293:
3195 ssids = alc269va_ssids;
3196 break;
3197 case ALC269_TYPE_ALC269VB:
3198 case ALC269_TYPE_ALC269VD:
3199 case ALC269_TYPE_ALC282:
3200 case ALC269_TYPE_ALC283:
3201 case ALC269_TYPE_ALC286:
3202 case ALC269_TYPE_ALC298:
3203 case ALC269_TYPE_ALC255:
3204 case ALC269_TYPE_ALC256:
3205 case ALC269_TYPE_ALC257:
3206 case ALC269_TYPE_ALC215:
3207 case ALC269_TYPE_ALC225:
3208 case ALC269_TYPE_ALC245:
3209 case ALC269_TYPE_ALC287:
3210 case ALC269_TYPE_ALC294:
3211 case ALC269_TYPE_ALC300:
3212 case ALC269_TYPE_ALC623:
3213 case ALC269_TYPE_ALC700:
3214 ssids = alc269_ssids;
3215 break;
3216 default:
3217 ssids = alc269_ssids;
3218 break;
3219 }
3220
3221 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3222 }
3223
3224 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3225 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3226 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3227 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3228 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3229 {}
3230 };
3231
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3232 static void alc_headset_btn_callback(struct hda_codec *codec,
3233 struct hda_jack_callback *jack)
3234 {
3235 int report = 0;
3236
3237 if (jack->unsol_res & (7 << 13))
3238 report |= SND_JACK_BTN_0;
3239
3240 if (jack->unsol_res & (1 << 16 | 3 << 8))
3241 report |= SND_JACK_BTN_1;
3242
3243 /* Volume up key */
3244 if (jack->unsol_res & (7 << 23))
3245 report |= SND_JACK_BTN_2;
3246
3247 /* Volume down key */
3248 if (jack->unsol_res & (7 << 10))
3249 report |= SND_JACK_BTN_3;
3250
3251 snd_hda_jack_set_button_state(codec, jack->nid, report);
3252 }
3253
alc_disable_headset_jack_key(struct hda_codec * codec)3254 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3255 {
3256 struct alc_spec *spec = codec->spec;
3257
3258 if (!spec->has_hs_key)
3259 return;
3260
3261 switch (codec->core.vendor_id) {
3262 case 0x10ec0215:
3263 case 0x10ec0225:
3264 case 0x10ec0285:
3265 case 0x10ec0287:
3266 case 0x10ec0295:
3267 case 0x10ec0289:
3268 case 0x10ec0299:
3269 alc_write_coef_idx(codec, 0x48, 0x0);
3270 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3271 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3272 break;
3273 case 0x10ec0230:
3274 case 0x10ec0236:
3275 case 0x10ec0256:
3276 case 0x10ec0257:
3277 case 0x19e58326:
3278 alc_write_coef_idx(codec, 0x48, 0x0);
3279 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3280 break;
3281 }
3282 }
3283
alc_enable_headset_jack_key(struct hda_codec * codec)3284 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3285 {
3286 struct alc_spec *spec = codec->spec;
3287
3288 if (!spec->has_hs_key)
3289 return;
3290
3291 switch (codec->core.vendor_id) {
3292 case 0x10ec0215:
3293 case 0x10ec0225:
3294 case 0x10ec0285:
3295 case 0x10ec0287:
3296 case 0x10ec0295:
3297 case 0x10ec0289:
3298 case 0x10ec0299:
3299 alc_write_coef_idx(codec, 0x48, 0xd011);
3300 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3301 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3302 break;
3303 case 0x10ec0230:
3304 case 0x10ec0236:
3305 case 0x10ec0256:
3306 case 0x10ec0257:
3307 case 0x19e58326:
3308 alc_write_coef_idx(codec, 0x48, 0xd011);
3309 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3310 break;
3311 }
3312 }
3313
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3314 static void alc_fixup_headset_jack(struct hda_codec *codec,
3315 const struct hda_fixup *fix, int action)
3316 {
3317 struct alc_spec *spec = codec->spec;
3318 hda_nid_t hp_pin;
3319
3320 switch (action) {
3321 case HDA_FIXUP_ACT_PRE_PROBE:
3322 spec->has_hs_key = 1;
3323 snd_hda_jack_detect_enable_callback(codec, 0x55,
3324 alc_headset_btn_callback);
3325 break;
3326 case HDA_FIXUP_ACT_BUILD:
3327 hp_pin = alc_get_hp_pin(spec);
3328 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3329 alc_headset_btn_keymap,
3330 hp_pin))
3331 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3332 false, SND_JACK_HEADSET,
3333 alc_headset_btn_keymap);
3334
3335 alc_enable_headset_jack_key(codec);
3336 break;
3337 }
3338 }
3339
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3340 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3341 {
3342 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3343 }
3344
alc269_shutup(struct hda_codec * codec)3345 static void alc269_shutup(struct hda_codec *codec)
3346 {
3347 struct alc_spec *spec = codec->spec;
3348
3349 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3350 alc269vb_toggle_power_output(codec, 0);
3351 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3352 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3353 msleep(150);
3354 }
3355 alc_shutup_pins(codec);
3356 }
3357
3358 static const struct coef_fw alc282_coefs[] = {
3359 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3360 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3361 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3362 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3363 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3364 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3365 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3366 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3367 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3368 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3369 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3370 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3371 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3372 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3373 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3374 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3375 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3376 WRITE_COEF(0x63, 0x2902), /* PLL */
3377 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3378 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3379 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3380 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3381 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3382 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3383 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3384 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3385 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3386 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3387 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3388 {}
3389 };
3390
alc282_restore_default_value(struct hda_codec * codec)3391 static void alc282_restore_default_value(struct hda_codec *codec)
3392 {
3393 alc_process_coef_fw(codec, alc282_coefs);
3394 }
3395
alc282_init(struct hda_codec * codec)3396 static void alc282_init(struct hda_codec *codec)
3397 {
3398 struct alc_spec *spec = codec->spec;
3399 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3400 bool hp_pin_sense;
3401 int coef78;
3402
3403 alc282_restore_default_value(codec);
3404
3405 if (!hp_pin)
3406 return;
3407 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3408 coef78 = alc_read_coef_idx(codec, 0x78);
3409
3410 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3411 /* Headphone capless set to high power mode */
3412 alc_write_coef_idx(codec, 0x78, 0x9004);
3413
3414 if (hp_pin_sense)
3415 msleep(2);
3416
3417 snd_hda_codec_write(codec, hp_pin, 0,
3418 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3419
3420 if (hp_pin_sense)
3421 msleep(85);
3422
3423 snd_hda_codec_write(codec, hp_pin, 0,
3424 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3425
3426 if (hp_pin_sense)
3427 msleep(100);
3428
3429 /* Headphone capless set to normal mode */
3430 alc_write_coef_idx(codec, 0x78, coef78);
3431 }
3432
alc282_shutup(struct hda_codec * codec)3433 static void alc282_shutup(struct hda_codec *codec)
3434 {
3435 struct alc_spec *spec = codec->spec;
3436 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3437 bool hp_pin_sense;
3438 int coef78;
3439
3440 if (!hp_pin) {
3441 alc269_shutup(codec);
3442 return;
3443 }
3444
3445 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3446 coef78 = alc_read_coef_idx(codec, 0x78);
3447 alc_write_coef_idx(codec, 0x78, 0x9004);
3448
3449 if (hp_pin_sense)
3450 msleep(2);
3451
3452 snd_hda_codec_write(codec, hp_pin, 0,
3453 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3454
3455 if (hp_pin_sense)
3456 msleep(85);
3457
3458 if (!spec->no_shutup_pins)
3459 snd_hda_codec_write(codec, hp_pin, 0,
3460 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3461
3462 if (hp_pin_sense)
3463 msleep(100);
3464
3465 alc_auto_setup_eapd(codec, false);
3466 alc_shutup_pins(codec);
3467 alc_write_coef_idx(codec, 0x78, coef78);
3468 }
3469
3470 static const struct coef_fw alc283_coefs[] = {
3471 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3472 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3473 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3474 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3475 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3476 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3477 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3478 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3479 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3480 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3481 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3482 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3483 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3484 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3485 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3486 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3487 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3488 WRITE_COEF(0x2e, 0x2902), /* PLL */
3489 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3490 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3491 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3492 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3493 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3494 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3495 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3496 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3497 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3498 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3499 WRITE_COEF(0x49, 0x0), /* test mode */
3500 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3501 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3502 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3503 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3504 {}
3505 };
3506
alc283_restore_default_value(struct hda_codec * codec)3507 static void alc283_restore_default_value(struct hda_codec *codec)
3508 {
3509 alc_process_coef_fw(codec, alc283_coefs);
3510 }
3511
alc283_init(struct hda_codec * codec)3512 static void alc283_init(struct hda_codec *codec)
3513 {
3514 struct alc_spec *spec = codec->spec;
3515 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3516 bool hp_pin_sense;
3517
3518 alc283_restore_default_value(codec);
3519
3520 if (!hp_pin)
3521 return;
3522
3523 msleep(30);
3524 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3525
3526 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3527 /* Headphone capless set to high power mode */
3528 alc_write_coef_idx(codec, 0x43, 0x9004);
3529
3530 snd_hda_codec_write(codec, hp_pin, 0,
3531 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3532
3533 if (hp_pin_sense)
3534 msleep(85);
3535
3536 snd_hda_codec_write(codec, hp_pin, 0,
3537 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3538
3539 if (hp_pin_sense)
3540 msleep(85);
3541 /* Index 0x46 Combo jack auto switch control 2 */
3542 /* 3k pull low control for Headset jack. */
3543 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3544 /* Headphone capless set to normal mode */
3545 alc_write_coef_idx(codec, 0x43, 0x9614);
3546 }
3547
alc283_shutup(struct hda_codec * codec)3548 static void alc283_shutup(struct hda_codec *codec)
3549 {
3550 struct alc_spec *spec = codec->spec;
3551 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3552 bool hp_pin_sense;
3553
3554 if (!hp_pin) {
3555 alc269_shutup(codec);
3556 return;
3557 }
3558
3559 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3560
3561 alc_write_coef_idx(codec, 0x43, 0x9004);
3562
3563 /*depop hp during suspend*/
3564 alc_write_coef_idx(codec, 0x06, 0x2100);
3565
3566 snd_hda_codec_write(codec, hp_pin, 0,
3567 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3568
3569 if (hp_pin_sense)
3570 msleep(100);
3571
3572 if (!spec->no_shutup_pins)
3573 snd_hda_codec_write(codec, hp_pin, 0,
3574 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3575
3576 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3577
3578 if (hp_pin_sense)
3579 msleep(100);
3580 alc_auto_setup_eapd(codec, false);
3581 alc_shutup_pins(codec);
3582 alc_write_coef_idx(codec, 0x43, 0x9614);
3583 }
3584
alc256_init(struct hda_codec * codec)3585 static void alc256_init(struct hda_codec *codec)
3586 {
3587 struct alc_spec *spec = codec->spec;
3588 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3589 bool hp_pin_sense;
3590
3591 if (spec->ultra_low_power) {
3592 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3593 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3594 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3595 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3596 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3597 msleep(30);
3598 }
3599
3600 if (!hp_pin)
3601 hp_pin = 0x21;
3602
3603 msleep(30);
3604
3605 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3606
3607 if (hp_pin_sense) {
3608 msleep(2);
3609 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3610
3611 snd_hda_codec_write(codec, hp_pin, 0,
3612 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3613
3614 msleep(75);
3615
3616 snd_hda_codec_write(codec, hp_pin, 0,
3617 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3618
3619 msleep(75);
3620 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3621 }
3622 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3623 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3624 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3625 /*
3626 * Expose headphone mic (or possibly Line In on some machines) instead
3627 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3628 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3629 * this register.
3630 */
3631 alc_write_coef_idx(codec, 0x36, 0x5757);
3632 }
3633
alc256_shutup(struct hda_codec * codec)3634 static void alc256_shutup(struct hda_codec *codec)
3635 {
3636 struct alc_spec *spec = codec->spec;
3637 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3638 bool hp_pin_sense;
3639
3640 if (!hp_pin)
3641 hp_pin = 0x21;
3642
3643 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3644 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3645
3646 if (hp_pin_sense) {
3647 msleep(2);
3648
3649 snd_hda_codec_write(codec, hp_pin, 0,
3650 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3651
3652 msleep(75);
3653
3654 /* 3k pull low control for Headset jack. */
3655 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3656 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3657 * when booting with headset plugged. So skip setting it for the codec alc257
3658 */
3659 if (spec->en_3kpull_low)
3660 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3661
3662 if (!spec->no_shutup_pins)
3663 snd_hda_codec_write(codec, hp_pin, 0,
3664 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3665
3666 msleep(75);
3667 }
3668
3669 alc_auto_setup_eapd(codec, false);
3670 alc_shutup_pins(codec);
3671 if (spec->ultra_low_power) {
3672 msleep(50);
3673 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3674 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3675 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3676 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3677 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3678 msleep(30);
3679 }
3680 }
3681
alc285_hp_init(struct hda_codec * codec)3682 static void alc285_hp_init(struct hda_codec *codec)
3683 {
3684 struct alc_spec *spec = codec->spec;
3685 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3686 int i, val;
3687 int coef38, coef0d, coef36;
3688
3689 alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3690 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3691 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3692 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3693 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3694 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3695 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3696
3697 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3698
3699 if (hp_pin)
3700 snd_hda_codec_write(codec, hp_pin, 0,
3701 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3702
3703 msleep(130);
3704 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3705 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3706
3707 if (hp_pin)
3708 snd_hda_codec_write(codec, hp_pin, 0,
3709 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3710 msleep(10);
3711 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3712 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3713 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3714 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3715
3716 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3717 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3718 for (i = 0; i < 20 && val & 0x8000; i++) {
3719 msleep(50);
3720 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3721 } /* Wait for depop procedure finish */
3722
3723 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3724 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3725 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3726 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3727
3728 msleep(50);
3729 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3730 }
3731
alc225_init(struct hda_codec * codec)3732 static void alc225_init(struct hda_codec *codec)
3733 {
3734 struct alc_spec *spec = codec->spec;
3735 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3736 bool hp1_pin_sense, hp2_pin_sense;
3737
3738 if (spec->ultra_low_power) {
3739 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3740 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3741 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3742 msleep(30);
3743 }
3744
3745 if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3746 spec->codec_variant != ALC269_TYPE_ALC245)
3747 /* required only at boot or S3 and S4 resume time */
3748 if (!spec->done_hp_init ||
3749 is_s3_resume(codec) ||
3750 is_s4_resume(codec)) {
3751 alc285_hp_init(codec);
3752 spec->done_hp_init = true;
3753 }
3754
3755 if (!hp_pin)
3756 hp_pin = 0x21;
3757 msleep(30);
3758
3759 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3760 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3761
3762 if (hp1_pin_sense || hp2_pin_sense) {
3763 msleep(2);
3764 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3765
3766 if (hp1_pin_sense)
3767 snd_hda_codec_write(codec, hp_pin, 0,
3768 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3769 if (hp2_pin_sense)
3770 snd_hda_codec_write(codec, 0x16, 0,
3771 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3772 msleep(75);
3773
3774 if (hp1_pin_sense)
3775 snd_hda_codec_write(codec, hp_pin, 0,
3776 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3777 if (hp2_pin_sense)
3778 snd_hda_codec_write(codec, 0x16, 0,
3779 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3780
3781 msleep(75);
3782 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3783 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3784 }
3785 }
3786
alc225_shutup(struct hda_codec * codec)3787 static void alc225_shutup(struct hda_codec *codec)
3788 {
3789 struct alc_spec *spec = codec->spec;
3790 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3791 bool hp1_pin_sense, hp2_pin_sense;
3792
3793 if (!hp_pin)
3794 hp_pin = 0x21;
3795
3796 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3797 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3798
3799 if (hp1_pin_sense || hp2_pin_sense) {
3800 alc_disable_headset_jack_key(codec);
3801 /* 3k pull low control for Headset jack. */
3802 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3803 msleep(2);
3804
3805 if (hp1_pin_sense)
3806 snd_hda_codec_write(codec, hp_pin, 0,
3807 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3808 if (hp2_pin_sense)
3809 snd_hda_codec_write(codec, 0x16, 0,
3810 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3811
3812 msleep(75);
3813
3814 if (hp1_pin_sense)
3815 snd_hda_codec_write(codec, hp_pin, 0,
3816 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3817 if (hp2_pin_sense)
3818 snd_hda_codec_write(codec, 0x16, 0,
3819 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3820
3821 msleep(75);
3822 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3823 alc_enable_headset_jack_key(codec);
3824 }
3825 alc_auto_setup_eapd(codec, false);
3826 alc_shutup_pins(codec);
3827 if (spec->ultra_low_power) {
3828 msleep(50);
3829 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3830 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3831 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3832 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3833 msleep(30);
3834 }
3835 }
3836
alc_default_init(struct hda_codec * codec)3837 static void alc_default_init(struct hda_codec *codec)
3838 {
3839 struct alc_spec *spec = codec->spec;
3840 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3841 bool hp_pin_sense;
3842
3843 if (!hp_pin)
3844 return;
3845
3846 msleep(30);
3847
3848 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3849
3850 if (hp_pin_sense) {
3851 msleep(2);
3852
3853 snd_hda_codec_write(codec, hp_pin, 0,
3854 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3855
3856 msleep(75);
3857
3858 snd_hda_codec_write(codec, hp_pin, 0,
3859 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3860 msleep(75);
3861 }
3862 }
3863
alc_default_shutup(struct hda_codec * codec)3864 static void alc_default_shutup(struct hda_codec *codec)
3865 {
3866 struct alc_spec *spec = codec->spec;
3867 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3868 bool hp_pin_sense;
3869
3870 if (!hp_pin) {
3871 alc269_shutup(codec);
3872 return;
3873 }
3874
3875 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3876
3877 if (hp_pin_sense) {
3878 msleep(2);
3879
3880 snd_hda_codec_write(codec, hp_pin, 0,
3881 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3882
3883 msleep(75);
3884
3885 if (!spec->no_shutup_pins)
3886 snd_hda_codec_write(codec, hp_pin, 0,
3887 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3888
3889 msleep(75);
3890 }
3891 alc_auto_setup_eapd(codec, false);
3892 alc_shutup_pins(codec);
3893 }
3894
alc294_hp_init(struct hda_codec * codec)3895 static void alc294_hp_init(struct hda_codec *codec)
3896 {
3897 struct alc_spec *spec = codec->spec;
3898 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3899 int i, val;
3900
3901 if (!hp_pin)
3902 return;
3903
3904 snd_hda_codec_write(codec, hp_pin, 0,
3905 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3906
3907 msleep(100);
3908
3909 if (!spec->no_shutup_pins)
3910 snd_hda_codec_write(codec, hp_pin, 0,
3911 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3912
3913 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3914 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3915
3916 /* Wait for depop procedure finish */
3917 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3918 for (i = 0; i < 20 && val & 0x0080; i++) {
3919 msleep(50);
3920 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3921 }
3922 /* Set HP depop to auto mode */
3923 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3924 msleep(50);
3925 }
3926
alc294_init(struct hda_codec * codec)3927 static void alc294_init(struct hda_codec *codec)
3928 {
3929 struct alc_spec *spec = codec->spec;
3930
3931 /* required only at boot or S4 resume time */
3932 if (!spec->done_hp_init ||
3933 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3934 alc294_hp_init(codec);
3935 spec->done_hp_init = true;
3936 }
3937 alc_default_init(codec);
3938 }
3939
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)3940 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3941 unsigned int val)
3942 {
3943 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3944 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3945 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3946 }
3947
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)3948 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3949 {
3950 unsigned int val;
3951
3952 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3953 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3954 & 0xffff;
3955 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3956 << 16;
3957 return val;
3958 }
3959
alc5505_dsp_halt(struct hda_codec * codec)3960 static void alc5505_dsp_halt(struct hda_codec *codec)
3961 {
3962 unsigned int val;
3963
3964 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3965 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3966 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3967 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3968 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3969 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3970 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3971 val = alc5505_coef_get(codec, 0x6220);
3972 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3973 }
3974
alc5505_dsp_back_from_halt(struct hda_codec * codec)3975 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3976 {
3977 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3978 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3979 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3980 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3981 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3982 alc5505_coef_set(codec, 0x880c, 0x00000004);
3983 }
3984
alc5505_dsp_init(struct hda_codec * codec)3985 static void alc5505_dsp_init(struct hda_codec *codec)
3986 {
3987 unsigned int val;
3988
3989 alc5505_dsp_halt(codec);
3990 alc5505_dsp_back_from_halt(codec);
3991 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3992 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3993 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3994 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3995 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3996 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3997 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3998 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3999 alc5505_coef_set(codec, 0x61b8, 0x04173302);
4000 alc5505_coef_set(codec, 0x61b8, 0x04163302);
4001 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4002 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4003 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4004
4005 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4006 if (val <= 3)
4007 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4008 else
4009 alc5505_coef_set(codec, 0x6220, 0x6002018f);
4010
4011 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4012 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4013 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4014 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4015 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4016 alc5505_coef_set(codec, 0x880c, 0x00000003);
4017 alc5505_coef_set(codec, 0x880c, 0x00000010);
4018
4019 #ifdef HALT_REALTEK_ALC5505
4020 alc5505_dsp_halt(codec);
4021 #endif
4022 }
4023
4024 #ifdef HALT_REALTEK_ALC5505
4025 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
4026 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
4027 #else
4028 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
4029 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
4030 #endif
4031
4032 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)4033 static int alc269_suspend(struct hda_codec *codec)
4034 {
4035 struct alc_spec *spec = codec->spec;
4036
4037 if (spec->has_alc5505_dsp)
4038 alc5505_dsp_suspend(codec);
4039
4040 return alc_suspend(codec);
4041 }
4042
alc269_resume(struct hda_codec * codec)4043 static int alc269_resume(struct hda_codec *codec)
4044 {
4045 struct alc_spec *spec = codec->spec;
4046
4047 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4048 alc269vb_toggle_power_output(codec, 0);
4049 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4050 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
4051 msleep(150);
4052 }
4053
4054 codec->patch_ops.init(codec);
4055
4056 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4057 alc269vb_toggle_power_output(codec, 1);
4058 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4059 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
4060 msleep(200);
4061 }
4062
4063 snd_hda_regmap_sync(codec);
4064 hda_call_check_power_status(codec, 0x01);
4065
4066 /* on some machine, the BIOS will clear the codec gpio data when enter
4067 * suspend, and won't restore the data after resume, so we restore it
4068 * in the driver.
4069 */
4070 if (spec->gpio_data)
4071 alc_write_gpio_data(codec);
4072
4073 if (spec->has_alc5505_dsp)
4074 alc5505_dsp_resume(codec);
4075
4076 return 0;
4077 }
4078 #endif /* CONFIG_PM */
4079
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4080 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4081 const struct hda_fixup *fix, int action)
4082 {
4083 struct alc_spec *spec = codec->spec;
4084
4085 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4086 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4087 }
4088
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4089 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4090 const struct hda_fixup *fix,
4091 int action)
4092 {
4093 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4094 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4095
4096 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4097 snd_hda_codec_set_pincfg(codec, 0x19,
4098 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4099 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4100 }
4101
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4102 static void alc269_fixup_hweq(struct hda_codec *codec,
4103 const struct hda_fixup *fix, int action)
4104 {
4105 if (action == HDA_FIXUP_ACT_INIT)
4106 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4107 }
4108
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4109 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4110 const struct hda_fixup *fix, int action)
4111 {
4112 struct alc_spec *spec = codec->spec;
4113
4114 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4115 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4116 }
4117
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4118 static void alc271_fixup_dmic(struct hda_codec *codec,
4119 const struct hda_fixup *fix, int action)
4120 {
4121 static const struct hda_verb verbs[] = {
4122 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4123 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4124 {}
4125 };
4126 unsigned int cfg;
4127
4128 if (strcmp(codec->core.chip_name, "ALC271X") &&
4129 strcmp(codec->core.chip_name, "ALC269VB"))
4130 return;
4131 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4132 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4133 snd_hda_sequence_write(codec, verbs);
4134 }
4135
4136 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4137 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4138 const struct hda_fixup *fix,
4139 int action)
4140 {
4141 if (action == HDA_FIXUP_ACT_INIT)
4142 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4143 }
4144
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4145 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4146 const struct hda_fixup *fix, int action)
4147 {
4148 struct alc_spec *spec = codec->spec;
4149
4150 if (action != HDA_FIXUP_ACT_PROBE)
4151 return;
4152
4153 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4154 * fix the sample rate of analog I/O to 44.1kHz
4155 */
4156 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4157 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4158 }
4159
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4160 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4161 const struct hda_fixup *fix, int action)
4162 {
4163 /* The digital-mic unit sends PDM (differential signal) instead of
4164 * the standard PCM, thus you can't record a valid mono stream as is.
4165 * Below is a workaround specific to ALC269 to control the dmic
4166 * signal source as mono.
4167 */
4168 if (action == HDA_FIXUP_ACT_INIT)
4169 alc_update_coef_idx(codec, 0x07, 0, 0x80);
4170 }
4171
alc269_quanta_automute(struct hda_codec * codec)4172 static void alc269_quanta_automute(struct hda_codec *codec)
4173 {
4174 snd_hda_gen_update_outputs(codec);
4175
4176 alc_write_coef_idx(codec, 0x0c, 0x680);
4177 alc_write_coef_idx(codec, 0x0c, 0x480);
4178 }
4179
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4180 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4181 const struct hda_fixup *fix, int action)
4182 {
4183 struct alc_spec *spec = codec->spec;
4184 if (action != HDA_FIXUP_ACT_PROBE)
4185 return;
4186 spec->gen.automute_hook = alc269_quanta_automute;
4187 }
4188
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4189 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4190 struct hda_jack_callback *jack)
4191 {
4192 struct alc_spec *spec = codec->spec;
4193 int vref;
4194 msleep(200);
4195 snd_hda_gen_hp_automute(codec, jack);
4196
4197 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4198 msleep(100);
4199 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4200 vref);
4201 msleep(500);
4202 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4203 vref);
4204 }
4205
4206 /*
4207 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4208 */
4209 struct hda_alc298_mbxinit {
4210 unsigned char value_0x23;
4211 unsigned char value_0x25;
4212 };
4213
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4214 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4215 const struct hda_alc298_mbxinit *initval,
4216 bool first)
4217 {
4218 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4219 alc_write_coef_idx(codec, 0x26, 0xb000);
4220
4221 if (first)
4222 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4223
4224 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4225 alc_write_coef_idx(codec, 0x26, 0xf000);
4226 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4227
4228 if (initval->value_0x23 != 0x1e)
4229 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4230
4231 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4232 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4233 }
4234
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4235 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4236 const struct hda_fixup *fix,
4237 int action)
4238 {
4239 /* Initialization magic */
4240 static const struct hda_alc298_mbxinit dac_init[] = {
4241 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4242 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4243 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4244 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4245 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4246 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4247 {0x2f, 0x00},
4248 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4249 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4250 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4251 {}
4252 };
4253 const struct hda_alc298_mbxinit *seq;
4254
4255 if (action != HDA_FIXUP_ACT_INIT)
4256 return;
4257
4258 /* Start */
4259 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4260 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4261 alc_write_coef_idx(codec, 0x26, 0xf000);
4262 alc_write_coef_idx(codec, 0x22, 0x31);
4263 alc_write_coef_idx(codec, 0x23, 0x0b);
4264 alc_write_coef_idx(codec, 0x25, 0x00);
4265 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4266 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4267
4268 for (seq = dac_init; seq->value_0x23; seq++)
4269 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4270 }
4271
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4272 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4273 const struct hda_fixup *fix, int action)
4274 {
4275 struct alc_spec *spec = codec->spec;
4276 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4277 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4278 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4279 }
4280 }
4281
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4282 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4283 bool polarity, bool on)
4284 {
4285 unsigned int pinval;
4286
4287 if (!pin)
4288 return;
4289 if (polarity)
4290 on = !on;
4291 pinval = snd_hda_codec_get_pin_target(codec, pin);
4292 pinval &= ~AC_PINCTL_VREFEN;
4293 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4294 /* temporarily power up/down for setting VREF */
4295 snd_hda_power_up_pm(codec);
4296 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4297 snd_hda_power_down_pm(codec);
4298 }
4299
4300 /* 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)4301 static int vref_mute_led_set(struct led_classdev *led_cdev,
4302 enum led_brightness brightness)
4303 {
4304 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4305 struct alc_spec *spec = codec->spec;
4306
4307 alc_update_vref_led(codec, spec->mute_led_nid,
4308 spec->mute_led_polarity, brightness);
4309 return 0;
4310 }
4311
4312 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4313 static unsigned int led_power_filter(struct hda_codec *codec,
4314 hda_nid_t nid,
4315 unsigned int power_state)
4316 {
4317 struct alc_spec *spec = codec->spec;
4318
4319 if (power_state != AC_PWRST_D3 || nid == 0 ||
4320 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4321 return power_state;
4322
4323 /* Set pin ctl again, it might have just been set to 0 */
4324 snd_hda_set_pin_ctl(codec, nid,
4325 snd_hda_codec_get_pin_target(codec, nid));
4326
4327 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4328 }
4329
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4330 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4331 const struct hda_fixup *fix, int action)
4332 {
4333 struct alc_spec *spec = codec->spec;
4334 const struct dmi_device *dev = NULL;
4335
4336 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4337 return;
4338
4339 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4340 int pol, pin;
4341 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4342 continue;
4343 if (pin < 0x0a || pin >= 0x10)
4344 break;
4345 spec->mute_led_polarity = pol;
4346 spec->mute_led_nid = pin - 0x0a + 0x18;
4347 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4348 codec->power_filter = led_power_filter;
4349 codec_dbg(codec,
4350 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4351 spec->mute_led_polarity);
4352 break;
4353 }
4354 }
4355
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4356 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4357 const struct hda_fixup *fix,
4358 int action, hda_nid_t pin)
4359 {
4360 struct alc_spec *spec = codec->spec;
4361
4362 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4363 spec->mute_led_polarity = 0;
4364 spec->mute_led_nid = pin;
4365 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4366 codec->power_filter = led_power_filter;
4367 }
4368 }
4369
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4370 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4371 const struct hda_fixup *fix, int action)
4372 {
4373 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4374 }
4375
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4376 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4377 const struct hda_fixup *fix, int action)
4378 {
4379 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4380 }
4381
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4382 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4383 const struct hda_fixup *fix, int action)
4384 {
4385 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4386 }
4387
4388 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4389 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4390 int polarity, bool enabled)
4391 {
4392 if (polarity)
4393 enabled = !enabled;
4394 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4395 }
4396
4397 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4398 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4399 enum led_brightness brightness)
4400 {
4401 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4402 struct alc_spec *spec = codec->spec;
4403
4404 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4405 spec->mute_led_polarity, !brightness);
4406 return 0;
4407 }
4408
4409 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4410 static int micmute_led_set(struct led_classdev *led_cdev,
4411 enum led_brightness brightness)
4412 {
4413 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4414 struct alc_spec *spec = codec->spec;
4415
4416 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4417 spec->micmute_led_polarity, !brightness);
4418 return 0;
4419 }
4420
4421 /* 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)4422 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4423 int action,
4424 unsigned int mute_mask,
4425 unsigned int micmute_mask)
4426 {
4427 struct alc_spec *spec = codec->spec;
4428
4429 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4430
4431 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4432 return;
4433 if (mute_mask) {
4434 spec->gpio_mute_led_mask = mute_mask;
4435 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4436 }
4437 if (micmute_mask) {
4438 spec->gpio_mic_led_mask = micmute_mask;
4439 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4440 }
4441 }
4442
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4443 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4444 const struct hda_fixup *fix, int action)
4445 {
4446 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4447 }
4448
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4449 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4450 const struct hda_fixup *fix, int action)
4451 {
4452 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4453 }
4454
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4455 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4456 const struct hda_fixup *fix, int action)
4457 {
4458 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4459 }
4460
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4461 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4462 const struct hda_fixup *fix, int action)
4463 {
4464 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4465 }
4466
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4467 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4468 const struct hda_fixup *fix, int action)
4469 {
4470 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4471 }
4472
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4473 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4474 const struct hda_fixup *fix, int action)
4475 {
4476 struct alc_spec *spec = codec->spec;
4477
4478 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4479 spec->micmute_led_polarity = 1;
4480 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4481 }
4482
4483 /* 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)4484 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4485 enum led_brightness brightness)
4486 {
4487 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4488 struct alc_spec *spec = codec->spec;
4489
4490 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4491 spec->micmute_led_polarity, brightness);
4492 return 0;
4493 }
4494
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4495 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4496 const struct hda_fixup *fix, int action)
4497 {
4498 struct alc_spec *spec = codec->spec;
4499
4500 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4501 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4502 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4503 * enable headphone amp
4504 */
4505 spec->gpio_mask |= 0x10;
4506 spec->gpio_dir |= 0x10;
4507 spec->cap_mute_led_nid = 0x18;
4508 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4509 codec->power_filter = led_power_filter;
4510 }
4511 }
4512
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4513 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4514 const struct hda_fixup *fix, int action)
4515 {
4516 struct alc_spec *spec = codec->spec;
4517
4518 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4519 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4520 spec->cap_mute_led_nid = 0x18;
4521 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4522 codec->power_filter = led_power_filter;
4523 }
4524 }
4525
4526 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4527 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4528 */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4529 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4530 const struct hda_fixup *fix, int action)
4531 {
4532 struct alc_spec *spec = codec->spec;
4533
4534 switch (action) {
4535 case HDA_FIXUP_ACT_PRE_PROBE:
4536 spec->gpio_mask |= 0x01;
4537 spec->gpio_dir |= 0x01;
4538 break;
4539 case HDA_FIXUP_ACT_INIT:
4540 /* need to toggle GPIO to enable the amp */
4541 alc_update_gpio_data(codec, 0x01, true);
4542 msleep(100);
4543 alc_update_gpio_data(codec, 0x01, false);
4544 break;
4545 }
4546 }
4547
4548 /* 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)4549 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4550 struct hda_codec *codec,
4551 struct snd_pcm_substream *substream,
4552 int action)
4553 {
4554 switch (action) {
4555 case HDA_GEN_PCM_ACT_PREPARE:
4556 alc_update_gpio_data(codec, 0x04, true);
4557 break;
4558 case HDA_GEN_PCM_ACT_CLEANUP:
4559 alc_update_gpio_data(codec, 0x04, false);
4560 break;
4561 }
4562 }
4563
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4564 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4565 const struct hda_fixup *fix,
4566 int action)
4567 {
4568 struct alc_spec *spec = codec->spec;
4569
4570 if (action == HDA_FIXUP_ACT_PROBE) {
4571 spec->gpio_mask |= 0x04;
4572 spec->gpio_dir |= 0x04;
4573 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4574 }
4575 }
4576
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4577 static void alc_update_coef_led(struct hda_codec *codec,
4578 struct alc_coef_led *led,
4579 bool polarity, bool on)
4580 {
4581 if (polarity)
4582 on = !on;
4583 /* temporarily power up/down for setting COEF bit */
4584 alc_update_coef_idx(codec, led->idx, led->mask,
4585 on ? led->on : led->off);
4586 }
4587
4588 /* 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)4589 static int coef_mute_led_set(struct led_classdev *led_cdev,
4590 enum led_brightness brightness)
4591 {
4592 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4593 struct alc_spec *spec = codec->spec;
4594
4595 alc_update_coef_led(codec, &spec->mute_led_coef,
4596 spec->mute_led_polarity, brightness);
4597 return 0;
4598 }
4599
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4600 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4601 const struct hda_fixup *fix,
4602 int action)
4603 {
4604 struct alc_spec *spec = codec->spec;
4605
4606 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4607 spec->mute_led_polarity = 0;
4608 spec->mute_led_coef.idx = 0x0b;
4609 spec->mute_led_coef.mask = 1 << 3;
4610 spec->mute_led_coef.on = 1 << 3;
4611 spec->mute_led_coef.off = 0;
4612 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4613 }
4614 }
4615
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4616 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4617 const struct hda_fixup *fix,
4618 int action)
4619 {
4620 struct alc_spec *spec = codec->spec;
4621
4622 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4623 spec->mute_led_polarity = 0;
4624 spec->mute_led_coef.idx = 0x34;
4625 spec->mute_led_coef.mask = 1 << 5;
4626 spec->mute_led_coef.on = 0;
4627 spec->mute_led_coef.off = 1 << 5;
4628 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4629 }
4630 }
4631
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4632 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4633 const struct hda_fixup *fix, int action)
4634 {
4635 struct alc_spec *spec = codec->spec;
4636
4637 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4638 spec->mute_led_polarity = 0;
4639 spec->mute_led_coef.idx = 0x07;
4640 spec->mute_led_coef.mask = 1;
4641 spec->mute_led_coef.on = 1;
4642 spec->mute_led_coef.off = 0;
4643 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4644 }
4645 }
4646
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4647 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4648 const struct hda_fixup *fix,
4649 int action)
4650 {
4651 struct alc_spec *spec = codec->spec;
4652
4653 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4654 spec->mute_led_polarity = 0;
4655 spec->mute_led_coef.idx = 0x0b;
4656 spec->mute_led_coef.mask = 3 << 2;
4657 spec->mute_led_coef.on = 2 << 2;
4658 spec->mute_led_coef.off = 1 << 2;
4659 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4660 }
4661 }
4662
4663 /* 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)4664 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4665 enum led_brightness brightness)
4666 {
4667 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4668 struct alc_spec *spec = codec->spec;
4669
4670 alc_update_coef_led(codec, &spec->mic_led_coef,
4671 spec->micmute_led_polarity, brightness);
4672 return 0;
4673 }
4674
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4675 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4676 const struct hda_fixup *fix, int action)
4677 {
4678 struct alc_spec *spec = codec->spec;
4679
4680 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4681 spec->mic_led_coef.idx = 0x19;
4682 spec->mic_led_coef.mask = 1 << 13;
4683 spec->mic_led_coef.on = 1 << 13;
4684 spec->mic_led_coef.off = 0;
4685 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4686 }
4687 }
4688
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4689 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4690 const struct hda_fixup *fix, int action)
4691 {
4692 struct alc_spec *spec = codec->spec;
4693
4694 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4695 spec->micmute_led_polarity = 1;
4696 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4697 }
4698
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4699 static void alc236_fixup_hp_coef_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->mic_led_coef.idx = 0x35;
4706 spec->mic_led_coef.mask = 3 << 2;
4707 spec->mic_led_coef.on = 2 << 2;
4708 spec->mic_led_coef.off = 1 << 2;
4709 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4710 }
4711 }
4712
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4713 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4714 const struct hda_fixup *fix, int action)
4715 {
4716 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4717 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4718 }
4719
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4720 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4721 const struct hda_fixup *fix, int action)
4722 {
4723 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4724 alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4725 }
4726
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4727 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4728 const struct hda_fixup *fix, int action)
4729 {
4730 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4731 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4732 }
4733
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4734 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4735 const struct hda_fixup *fix, int action)
4736 {
4737 struct alc_spec *spec = codec->spec;
4738
4739 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4740 spec->cap_mute_led_nid = 0x1a;
4741 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4742 codec->power_filter = led_power_filter;
4743 }
4744 }
4745
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4746 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4747 const struct hda_fixup *fix, int action)
4748 {
4749 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4750 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4751 }
4752
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4753 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4754 const unsigned short coefs[2])
4755 {
4756 alc_write_coef_idx(codec, 0x23, coefs[0]);
4757 alc_write_coef_idx(codec, 0x25, coefs[1]);
4758 alc_write_coef_idx(codec, 0x26, 0xb011);
4759 }
4760
4761 struct alc298_samsung_amp_desc {
4762 unsigned char nid;
4763 unsigned short init_seq[2][2];
4764 };
4765
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4766 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4767 const struct hda_fixup *fix, int action)
4768 {
4769 int i, j;
4770 static const unsigned short init_seq[][2] = {
4771 { 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4772 { 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4773 { 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4774 { 0x41, 0x07 }, { 0x400, 0x1 }
4775 };
4776 static const struct alc298_samsung_amp_desc amps[] = {
4777 { 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4778 { 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4779 };
4780
4781 if (action != HDA_FIXUP_ACT_INIT)
4782 return;
4783
4784 for (i = 0; i < ARRAY_SIZE(amps); i++) {
4785 alc_write_coef_idx(codec, 0x22, amps[i].nid);
4786
4787 for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4788 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4789
4790 for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4791 alc298_samsung_write_coef_pack(codec, init_seq[j]);
4792 }
4793 }
4794
4795 #if IS_REACHABLE(CONFIG_INPUT)
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4796 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4797 struct hda_jack_callback *event)
4798 {
4799 struct alc_spec *spec = codec->spec;
4800
4801 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4802 send both key on and key off event for every interrupt. */
4803 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4804 input_sync(spec->kb_dev);
4805 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4806 input_sync(spec->kb_dev);
4807 }
4808
alc_register_micmute_input_device(struct hda_codec * codec)4809 static int alc_register_micmute_input_device(struct hda_codec *codec)
4810 {
4811 struct alc_spec *spec = codec->spec;
4812 int i;
4813
4814 spec->kb_dev = input_allocate_device();
4815 if (!spec->kb_dev) {
4816 codec_err(codec, "Out of memory (input_allocate_device)\n");
4817 return -ENOMEM;
4818 }
4819
4820 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4821
4822 spec->kb_dev->name = "Microphone Mute Button";
4823 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4824 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4825 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4826 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4827 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4828 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4829
4830 if (input_register_device(spec->kb_dev)) {
4831 codec_err(codec, "input_register_device failed\n");
4832 input_free_device(spec->kb_dev);
4833 spec->kb_dev = NULL;
4834 return -ENOMEM;
4835 }
4836
4837 return 0;
4838 }
4839
4840 /* GPIO1 = set according to SKU external amp
4841 * GPIO2 = mic mute hotkey
4842 * GPIO3 = mute LED
4843 * GPIO4 = mic mute LED
4844 */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4845 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4846 const struct hda_fixup *fix, int action)
4847 {
4848 struct alc_spec *spec = codec->spec;
4849
4850 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4851 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4852 spec->init_amp = ALC_INIT_DEFAULT;
4853 if (alc_register_micmute_input_device(codec) != 0)
4854 return;
4855
4856 spec->gpio_mask |= 0x06;
4857 spec->gpio_dir |= 0x02;
4858 spec->gpio_data |= 0x02;
4859 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4860 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4861 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4862 gpio2_mic_hotkey_event);
4863 return;
4864 }
4865
4866 if (!spec->kb_dev)
4867 return;
4868
4869 switch (action) {
4870 case HDA_FIXUP_ACT_FREE:
4871 input_unregister_device(spec->kb_dev);
4872 spec->kb_dev = NULL;
4873 }
4874 }
4875
4876 /* Line2 = mic mute hotkey
4877 * GPIO2 = mic mute LED
4878 */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4879 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4880 const struct hda_fixup *fix, int action)
4881 {
4882 struct alc_spec *spec = codec->spec;
4883
4884 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4885 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4886 spec->init_amp = ALC_INIT_DEFAULT;
4887 if (alc_register_micmute_input_device(codec) != 0)
4888 return;
4889
4890 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4891 gpio2_mic_hotkey_event);
4892 return;
4893 }
4894
4895 if (!spec->kb_dev)
4896 return;
4897
4898 switch (action) {
4899 case HDA_FIXUP_ACT_FREE:
4900 input_unregister_device(spec->kb_dev);
4901 spec->kb_dev = NULL;
4902 }
4903 }
4904 #else /* INPUT */
4905 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4906 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4907 #endif /* INPUT */
4908
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4909 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4910 const struct hda_fixup *fix, int action)
4911 {
4912 struct alc_spec *spec = codec->spec;
4913
4914 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4915 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4916 spec->cap_mute_led_nid = 0x18;
4917 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4918 }
4919 }
4920
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)4921 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
4922 {
4923 if (delay <= 0)
4924 delay = 75;
4925 snd_hda_codec_write(codec, 0x21, 0,
4926 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4927 msleep(delay);
4928 snd_hda_codec_write(codec, 0x21, 0,
4929 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4930 msleep(delay);
4931 }
4932
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)4933 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
4934 {
4935 if (delay <= 0)
4936 delay = 75;
4937 snd_hda_codec_write(codec, 0x21, 0,
4938 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4939 msleep(delay);
4940 snd_hda_codec_write(codec, 0x21, 0,
4941 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4942 msleep(delay);
4943 }
4944
4945 static const struct coef_fw alc225_pre_hsmode[] = {
4946 UPDATE_COEF(0x4a, 1<<8, 0),
4947 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4948 UPDATE_COEF(0x63, 3<<14, 3<<14),
4949 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4950 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4951 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4952 UPDATE_COEF(0x4a, 3<<10, 0),
4953 {}
4954 };
4955
alc_headset_mode_unplugged(struct hda_codec * codec)4956 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4957 {
4958 struct alc_spec *spec = codec->spec;
4959 static const struct coef_fw coef0255[] = {
4960 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4961 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4962 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4963 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4964 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4965 {}
4966 };
4967 static const struct coef_fw coef0256[] = {
4968 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4969 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4970 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4971 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4972 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4973 {}
4974 };
4975 static const struct coef_fw coef0233[] = {
4976 WRITE_COEF(0x1b, 0x0c0b),
4977 WRITE_COEF(0x45, 0xc429),
4978 UPDATE_COEF(0x35, 0x4000, 0),
4979 WRITE_COEF(0x06, 0x2104),
4980 WRITE_COEF(0x1a, 0x0001),
4981 WRITE_COEF(0x26, 0x0004),
4982 WRITE_COEF(0x32, 0x42a3),
4983 {}
4984 };
4985 static const struct coef_fw coef0288[] = {
4986 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4987 UPDATE_COEF(0x50, 0x2000, 0x2000),
4988 UPDATE_COEF(0x56, 0x0006, 0x0006),
4989 UPDATE_COEF(0x66, 0x0008, 0),
4990 UPDATE_COEF(0x67, 0x2000, 0),
4991 {}
4992 };
4993 static const struct coef_fw coef0298[] = {
4994 UPDATE_COEF(0x19, 0x1300, 0x0300),
4995 {}
4996 };
4997 static const struct coef_fw coef0292[] = {
4998 WRITE_COEF(0x76, 0x000e),
4999 WRITE_COEF(0x6c, 0x2400),
5000 WRITE_COEF(0x18, 0x7308),
5001 WRITE_COEF(0x6b, 0xc429),
5002 {}
5003 };
5004 static const struct coef_fw coef0293[] = {
5005 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5006 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5007 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5008 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5009 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5010 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5011 {}
5012 };
5013 static const struct coef_fw coef0668[] = {
5014 WRITE_COEF(0x15, 0x0d40),
5015 WRITE_COEF(0xb7, 0x802b),
5016 {}
5017 };
5018 static const struct coef_fw coef0225[] = {
5019 UPDATE_COEF(0x63, 3<<14, 0),
5020 {}
5021 };
5022 static const struct coef_fw coef0274[] = {
5023 UPDATE_COEF(0x4a, 0x0100, 0),
5024 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5025 UPDATE_COEF(0x6b, 0xf000, 0x5000),
5026 UPDATE_COEF(0x4a, 0x0010, 0),
5027 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5028 WRITE_COEF(0x45, 0x5289),
5029 UPDATE_COEF(0x4a, 0x0c00, 0),
5030 {}
5031 };
5032
5033 if (spec->no_internal_mic_pin) {
5034 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5035 return;
5036 }
5037
5038 switch (codec->core.vendor_id) {
5039 case 0x10ec0255:
5040 alc_process_coef_fw(codec, coef0255);
5041 break;
5042 case 0x10ec0230:
5043 case 0x10ec0236:
5044 case 0x10ec0256:
5045 case 0x19e58326:
5046 alc_hp_mute_disable(codec, 75);
5047 alc_process_coef_fw(codec, coef0256);
5048 break;
5049 case 0x10ec0234:
5050 case 0x10ec0274:
5051 case 0x10ec0294:
5052 alc_process_coef_fw(codec, coef0274);
5053 break;
5054 case 0x10ec0233:
5055 case 0x10ec0283:
5056 alc_process_coef_fw(codec, coef0233);
5057 break;
5058 case 0x10ec0286:
5059 case 0x10ec0288:
5060 alc_process_coef_fw(codec, coef0288);
5061 break;
5062 case 0x10ec0298:
5063 alc_process_coef_fw(codec, coef0298);
5064 alc_process_coef_fw(codec, coef0288);
5065 break;
5066 case 0x10ec0292:
5067 alc_process_coef_fw(codec, coef0292);
5068 break;
5069 case 0x10ec0293:
5070 alc_process_coef_fw(codec, coef0293);
5071 break;
5072 case 0x10ec0668:
5073 alc_process_coef_fw(codec, coef0668);
5074 break;
5075 case 0x10ec0215:
5076 case 0x10ec0225:
5077 case 0x10ec0285:
5078 case 0x10ec0295:
5079 case 0x10ec0289:
5080 case 0x10ec0299:
5081 alc_hp_mute_disable(codec, 75);
5082 alc_process_coef_fw(codec, alc225_pre_hsmode);
5083 alc_process_coef_fw(codec, coef0225);
5084 break;
5085 case 0x10ec0867:
5086 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5087 break;
5088 }
5089 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5090 }
5091
5092
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5093 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5094 hda_nid_t mic_pin)
5095 {
5096 static const struct coef_fw coef0255[] = {
5097 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5098 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5099 {}
5100 };
5101 static const struct coef_fw coef0256[] = {
5102 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5103 WRITE_COEFEX(0x57, 0x03, 0x09a3),
5104 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5105 {}
5106 };
5107 static const struct coef_fw coef0233[] = {
5108 UPDATE_COEF(0x35, 0, 1<<14),
5109 WRITE_COEF(0x06, 0x2100),
5110 WRITE_COEF(0x1a, 0x0021),
5111 WRITE_COEF(0x26, 0x008c),
5112 {}
5113 };
5114 static const struct coef_fw coef0288[] = {
5115 UPDATE_COEF(0x4f, 0x00c0, 0),
5116 UPDATE_COEF(0x50, 0x2000, 0),
5117 UPDATE_COEF(0x56, 0x0006, 0),
5118 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5119 UPDATE_COEF(0x66, 0x0008, 0x0008),
5120 UPDATE_COEF(0x67, 0x2000, 0x2000),
5121 {}
5122 };
5123 static const struct coef_fw coef0292[] = {
5124 WRITE_COEF(0x19, 0xa208),
5125 WRITE_COEF(0x2e, 0xacf0),
5126 {}
5127 };
5128 static const struct coef_fw coef0293[] = {
5129 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5130 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5131 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5132 {}
5133 };
5134 static const struct coef_fw coef0688[] = {
5135 WRITE_COEF(0xb7, 0x802b),
5136 WRITE_COEF(0xb5, 0x1040),
5137 UPDATE_COEF(0xc3, 0, 1<<12),
5138 {}
5139 };
5140 static const struct coef_fw coef0225[] = {
5141 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5142 UPDATE_COEF(0x4a, 3<<4, 2<<4),
5143 UPDATE_COEF(0x63, 3<<14, 0),
5144 {}
5145 };
5146 static const struct coef_fw coef0274[] = {
5147 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5148 UPDATE_COEF(0x4a, 0x0010, 0),
5149 UPDATE_COEF(0x6b, 0xf000, 0),
5150 {}
5151 };
5152
5153 switch (codec->core.vendor_id) {
5154 case 0x10ec0255:
5155 alc_write_coef_idx(codec, 0x45, 0xc489);
5156 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5157 alc_process_coef_fw(codec, coef0255);
5158 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5159 break;
5160 case 0x10ec0230:
5161 case 0x10ec0236:
5162 case 0x10ec0256:
5163 case 0x19e58326:
5164 alc_write_coef_idx(codec, 0x45, 0xc489);
5165 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5166 alc_process_coef_fw(codec, coef0256);
5167 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5168 break;
5169 case 0x10ec0234:
5170 case 0x10ec0274:
5171 case 0x10ec0294:
5172 alc_write_coef_idx(codec, 0x45, 0x4689);
5173 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5174 alc_process_coef_fw(codec, coef0274);
5175 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5176 break;
5177 case 0x10ec0233:
5178 case 0x10ec0283:
5179 alc_write_coef_idx(codec, 0x45, 0xc429);
5180 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5181 alc_process_coef_fw(codec, coef0233);
5182 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5183 break;
5184 case 0x10ec0286:
5185 case 0x10ec0288:
5186 case 0x10ec0298:
5187 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5188 alc_process_coef_fw(codec, coef0288);
5189 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5190 break;
5191 case 0x10ec0292:
5192 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5193 alc_process_coef_fw(codec, coef0292);
5194 break;
5195 case 0x10ec0293:
5196 /* Set to TRS mode */
5197 alc_write_coef_idx(codec, 0x45, 0xc429);
5198 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5199 alc_process_coef_fw(codec, coef0293);
5200 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5201 break;
5202 case 0x10ec0867:
5203 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5204 fallthrough;
5205 case 0x10ec0221:
5206 case 0x10ec0662:
5207 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5208 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5209 break;
5210 case 0x10ec0668:
5211 alc_write_coef_idx(codec, 0x11, 0x0001);
5212 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5213 alc_process_coef_fw(codec, coef0688);
5214 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5215 break;
5216 case 0x10ec0215:
5217 case 0x10ec0225:
5218 case 0x10ec0285:
5219 case 0x10ec0295:
5220 case 0x10ec0289:
5221 case 0x10ec0299:
5222 alc_process_coef_fw(codec, alc225_pre_hsmode);
5223 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5224 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5225 alc_process_coef_fw(codec, coef0225);
5226 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5227 break;
5228 }
5229 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5230 }
5231
alc_headset_mode_default(struct hda_codec * codec)5232 static void alc_headset_mode_default(struct hda_codec *codec)
5233 {
5234 static const struct coef_fw coef0225[] = {
5235 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5236 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5237 UPDATE_COEF(0x49, 3<<8, 0<<8),
5238 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5239 UPDATE_COEF(0x63, 3<<14, 0),
5240 UPDATE_COEF(0x67, 0xf000, 0x3000),
5241 {}
5242 };
5243 static const struct coef_fw coef0255[] = {
5244 WRITE_COEF(0x45, 0xc089),
5245 WRITE_COEF(0x45, 0xc489),
5246 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5247 WRITE_COEF(0x49, 0x0049),
5248 {}
5249 };
5250 static const struct coef_fw coef0256[] = {
5251 WRITE_COEF(0x45, 0xc489),
5252 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5253 WRITE_COEF(0x49, 0x0049),
5254 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5255 WRITE_COEF(0x06, 0x6100),
5256 {}
5257 };
5258 static const struct coef_fw coef0233[] = {
5259 WRITE_COEF(0x06, 0x2100),
5260 WRITE_COEF(0x32, 0x4ea3),
5261 {}
5262 };
5263 static const struct coef_fw coef0288[] = {
5264 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5265 UPDATE_COEF(0x50, 0x2000, 0x2000),
5266 UPDATE_COEF(0x56, 0x0006, 0x0006),
5267 UPDATE_COEF(0x66, 0x0008, 0),
5268 UPDATE_COEF(0x67, 0x2000, 0),
5269 {}
5270 };
5271 static const struct coef_fw coef0292[] = {
5272 WRITE_COEF(0x76, 0x000e),
5273 WRITE_COEF(0x6c, 0x2400),
5274 WRITE_COEF(0x6b, 0xc429),
5275 WRITE_COEF(0x18, 0x7308),
5276 {}
5277 };
5278 static const struct coef_fw coef0293[] = {
5279 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5280 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5281 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5282 {}
5283 };
5284 static const struct coef_fw coef0688[] = {
5285 WRITE_COEF(0x11, 0x0041),
5286 WRITE_COEF(0x15, 0x0d40),
5287 WRITE_COEF(0xb7, 0x802b),
5288 {}
5289 };
5290 static const struct coef_fw coef0274[] = {
5291 WRITE_COEF(0x45, 0x4289),
5292 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5293 UPDATE_COEF(0x6b, 0x0f00, 0),
5294 UPDATE_COEF(0x49, 0x0300, 0x0300),
5295 {}
5296 };
5297
5298 switch (codec->core.vendor_id) {
5299 case 0x10ec0215:
5300 case 0x10ec0225:
5301 case 0x10ec0285:
5302 case 0x10ec0295:
5303 case 0x10ec0289:
5304 case 0x10ec0299:
5305 alc_process_coef_fw(codec, alc225_pre_hsmode);
5306 alc_process_coef_fw(codec, coef0225);
5307 alc_hp_enable_unmute(codec, 75);
5308 break;
5309 case 0x10ec0255:
5310 alc_process_coef_fw(codec, coef0255);
5311 break;
5312 case 0x10ec0230:
5313 case 0x10ec0236:
5314 case 0x10ec0256:
5315 case 0x19e58326:
5316 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5317 alc_write_coef_idx(codec, 0x45, 0xc089);
5318 msleep(50);
5319 alc_process_coef_fw(codec, coef0256);
5320 alc_hp_enable_unmute(codec, 75);
5321 break;
5322 case 0x10ec0234:
5323 case 0x10ec0274:
5324 case 0x10ec0294:
5325 alc_process_coef_fw(codec, coef0274);
5326 break;
5327 case 0x10ec0233:
5328 case 0x10ec0283:
5329 alc_process_coef_fw(codec, coef0233);
5330 break;
5331 case 0x10ec0286:
5332 case 0x10ec0288:
5333 case 0x10ec0298:
5334 alc_process_coef_fw(codec, coef0288);
5335 break;
5336 case 0x10ec0292:
5337 alc_process_coef_fw(codec, coef0292);
5338 break;
5339 case 0x10ec0293:
5340 alc_process_coef_fw(codec, coef0293);
5341 break;
5342 case 0x10ec0668:
5343 alc_process_coef_fw(codec, coef0688);
5344 break;
5345 case 0x10ec0867:
5346 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5347 break;
5348 }
5349 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5350 }
5351
5352 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5353 static void alc_headset_mode_ctia(struct hda_codec *codec)
5354 {
5355 int val;
5356
5357 static const struct coef_fw coef0255[] = {
5358 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5359 WRITE_COEF(0x1b, 0x0c2b),
5360 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5361 {}
5362 };
5363 static const struct coef_fw coef0256[] = {
5364 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5365 WRITE_COEF(0x1b, 0x0e6b),
5366 {}
5367 };
5368 static const struct coef_fw coef0233[] = {
5369 WRITE_COEF(0x45, 0xd429),
5370 WRITE_COEF(0x1b, 0x0c2b),
5371 WRITE_COEF(0x32, 0x4ea3),
5372 {}
5373 };
5374 static const struct coef_fw coef0288[] = {
5375 UPDATE_COEF(0x50, 0x2000, 0x2000),
5376 UPDATE_COEF(0x56, 0x0006, 0x0006),
5377 UPDATE_COEF(0x66, 0x0008, 0),
5378 UPDATE_COEF(0x67, 0x2000, 0),
5379 {}
5380 };
5381 static const struct coef_fw coef0292[] = {
5382 WRITE_COEF(0x6b, 0xd429),
5383 WRITE_COEF(0x76, 0x0008),
5384 WRITE_COEF(0x18, 0x7388),
5385 {}
5386 };
5387 static const struct coef_fw coef0293[] = {
5388 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5389 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5390 {}
5391 };
5392 static const struct coef_fw coef0688[] = {
5393 WRITE_COEF(0x11, 0x0001),
5394 WRITE_COEF(0x15, 0x0d60),
5395 WRITE_COEF(0xc3, 0x0000),
5396 {}
5397 };
5398 static const struct coef_fw coef0225_1[] = {
5399 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5400 UPDATE_COEF(0x63, 3<<14, 2<<14),
5401 {}
5402 };
5403 static const struct coef_fw coef0225_2[] = {
5404 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5405 UPDATE_COEF(0x63, 3<<14, 1<<14),
5406 {}
5407 };
5408
5409 switch (codec->core.vendor_id) {
5410 case 0x10ec0255:
5411 alc_process_coef_fw(codec, coef0255);
5412 break;
5413 case 0x10ec0230:
5414 case 0x10ec0236:
5415 case 0x10ec0256:
5416 case 0x19e58326:
5417 alc_process_coef_fw(codec, coef0256);
5418 alc_hp_enable_unmute(codec, 75);
5419 break;
5420 case 0x10ec0234:
5421 case 0x10ec0274:
5422 case 0x10ec0294:
5423 alc_write_coef_idx(codec, 0x45, 0xd689);
5424 break;
5425 case 0x10ec0233:
5426 case 0x10ec0283:
5427 alc_process_coef_fw(codec, coef0233);
5428 break;
5429 case 0x10ec0298:
5430 val = alc_read_coef_idx(codec, 0x50);
5431 if (val & (1 << 12)) {
5432 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5433 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5434 msleep(300);
5435 } else {
5436 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5437 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5438 msleep(300);
5439 }
5440 break;
5441 case 0x10ec0286:
5442 case 0x10ec0288:
5443 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5444 msleep(300);
5445 alc_process_coef_fw(codec, coef0288);
5446 break;
5447 case 0x10ec0292:
5448 alc_process_coef_fw(codec, coef0292);
5449 break;
5450 case 0x10ec0293:
5451 alc_process_coef_fw(codec, coef0293);
5452 break;
5453 case 0x10ec0668:
5454 alc_process_coef_fw(codec, coef0688);
5455 break;
5456 case 0x10ec0215:
5457 case 0x10ec0225:
5458 case 0x10ec0285:
5459 case 0x10ec0295:
5460 case 0x10ec0289:
5461 case 0x10ec0299:
5462 val = alc_read_coef_idx(codec, 0x45);
5463 if (val & (1 << 9))
5464 alc_process_coef_fw(codec, coef0225_2);
5465 else
5466 alc_process_coef_fw(codec, coef0225_1);
5467 alc_hp_enable_unmute(codec, 75);
5468 break;
5469 case 0x10ec0867:
5470 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5471 break;
5472 }
5473 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5474 }
5475
5476 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5477 static void alc_headset_mode_omtp(struct hda_codec *codec)
5478 {
5479 static const struct coef_fw coef0255[] = {
5480 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5481 WRITE_COEF(0x1b, 0x0c2b),
5482 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5483 {}
5484 };
5485 static const struct coef_fw coef0256[] = {
5486 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5487 WRITE_COEF(0x1b, 0x0e6b),
5488 {}
5489 };
5490 static const struct coef_fw coef0233[] = {
5491 WRITE_COEF(0x45, 0xe429),
5492 WRITE_COEF(0x1b, 0x0c2b),
5493 WRITE_COEF(0x32, 0x4ea3),
5494 {}
5495 };
5496 static const struct coef_fw coef0288[] = {
5497 UPDATE_COEF(0x50, 0x2000, 0x2000),
5498 UPDATE_COEF(0x56, 0x0006, 0x0006),
5499 UPDATE_COEF(0x66, 0x0008, 0),
5500 UPDATE_COEF(0x67, 0x2000, 0),
5501 {}
5502 };
5503 static const struct coef_fw coef0292[] = {
5504 WRITE_COEF(0x6b, 0xe429),
5505 WRITE_COEF(0x76, 0x0008),
5506 WRITE_COEF(0x18, 0x7388),
5507 {}
5508 };
5509 static const struct coef_fw coef0293[] = {
5510 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5511 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5512 {}
5513 };
5514 static const struct coef_fw coef0688[] = {
5515 WRITE_COEF(0x11, 0x0001),
5516 WRITE_COEF(0x15, 0x0d50),
5517 WRITE_COEF(0xc3, 0x0000),
5518 {}
5519 };
5520 static const struct coef_fw coef0225[] = {
5521 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5522 UPDATE_COEF(0x63, 3<<14, 2<<14),
5523 {}
5524 };
5525
5526 switch (codec->core.vendor_id) {
5527 case 0x10ec0255:
5528 alc_process_coef_fw(codec, coef0255);
5529 break;
5530 case 0x10ec0230:
5531 case 0x10ec0236:
5532 case 0x10ec0256:
5533 case 0x19e58326:
5534 alc_process_coef_fw(codec, coef0256);
5535 alc_hp_enable_unmute(codec, 75);
5536 break;
5537 case 0x10ec0234:
5538 case 0x10ec0274:
5539 case 0x10ec0294:
5540 alc_write_coef_idx(codec, 0x45, 0xe689);
5541 break;
5542 case 0x10ec0233:
5543 case 0x10ec0283:
5544 alc_process_coef_fw(codec, coef0233);
5545 break;
5546 case 0x10ec0298:
5547 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5548 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5549 msleep(300);
5550 break;
5551 case 0x10ec0286:
5552 case 0x10ec0288:
5553 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5554 msleep(300);
5555 alc_process_coef_fw(codec, coef0288);
5556 break;
5557 case 0x10ec0292:
5558 alc_process_coef_fw(codec, coef0292);
5559 break;
5560 case 0x10ec0293:
5561 alc_process_coef_fw(codec, coef0293);
5562 break;
5563 case 0x10ec0668:
5564 alc_process_coef_fw(codec, coef0688);
5565 break;
5566 case 0x10ec0215:
5567 case 0x10ec0225:
5568 case 0x10ec0285:
5569 case 0x10ec0295:
5570 case 0x10ec0289:
5571 case 0x10ec0299:
5572 alc_process_coef_fw(codec, coef0225);
5573 alc_hp_enable_unmute(codec, 75);
5574 break;
5575 }
5576 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5577 }
5578
alc_determine_headset_type(struct hda_codec * codec)5579 static void alc_determine_headset_type(struct hda_codec *codec)
5580 {
5581 int val;
5582 bool is_ctia = false;
5583 struct alc_spec *spec = codec->spec;
5584 static const struct coef_fw coef0255[] = {
5585 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5586 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5587 conteol) */
5588 {}
5589 };
5590 static const struct coef_fw coef0288[] = {
5591 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5592 {}
5593 };
5594 static const struct coef_fw coef0298[] = {
5595 UPDATE_COEF(0x50, 0x2000, 0x2000),
5596 UPDATE_COEF(0x56, 0x0006, 0x0006),
5597 UPDATE_COEF(0x66, 0x0008, 0),
5598 UPDATE_COEF(0x67, 0x2000, 0),
5599 UPDATE_COEF(0x19, 0x1300, 0x1300),
5600 {}
5601 };
5602 static const struct coef_fw coef0293[] = {
5603 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5604 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5605 {}
5606 };
5607 static const struct coef_fw coef0688[] = {
5608 WRITE_COEF(0x11, 0x0001),
5609 WRITE_COEF(0xb7, 0x802b),
5610 WRITE_COEF(0x15, 0x0d60),
5611 WRITE_COEF(0xc3, 0x0c00),
5612 {}
5613 };
5614 static const struct coef_fw coef0274[] = {
5615 UPDATE_COEF(0x4a, 0x0010, 0),
5616 UPDATE_COEF(0x4a, 0x8000, 0),
5617 WRITE_COEF(0x45, 0xd289),
5618 UPDATE_COEF(0x49, 0x0300, 0x0300),
5619 {}
5620 };
5621
5622 if (spec->no_internal_mic_pin) {
5623 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5624 return;
5625 }
5626
5627 switch (codec->core.vendor_id) {
5628 case 0x10ec0255:
5629 alc_process_coef_fw(codec, coef0255);
5630 msleep(300);
5631 val = alc_read_coef_idx(codec, 0x46);
5632 is_ctia = (val & 0x0070) == 0x0070;
5633 break;
5634 case 0x10ec0230:
5635 case 0x10ec0236:
5636 case 0x10ec0256:
5637 case 0x19e58326:
5638 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5639 alc_write_coef_idx(codec, 0x06, 0x6104);
5640 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5641
5642 alc_process_coef_fw(codec, coef0255);
5643 msleep(300);
5644 val = alc_read_coef_idx(codec, 0x46);
5645 is_ctia = (val & 0x0070) == 0x0070;
5646 if (!is_ctia) {
5647 alc_write_coef_idx(codec, 0x45, 0xe089);
5648 msleep(100);
5649 val = alc_read_coef_idx(codec, 0x46);
5650 if ((val & 0x0070) == 0x0070)
5651 is_ctia = false;
5652 else
5653 is_ctia = true;
5654 }
5655 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5656 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5657 break;
5658 case 0x10ec0234:
5659 case 0x10ec0274:
5660 case 0x10ec0294:
5661 alc_process_coef_fw(codec, coef0274);
5662 msleep(850);
5663 val = alc_read_coef_idx(codec, 0x46);
5664 is_ctia = (val & 0x00f0) == 0x00f0;
5665 break;
5666 case 0x10ec0233:
5667 case 0x10ec0283:
5668 alc_write_coef_idx(codec, 0x45, 0xd029);
5669 msleep(300);
5670 val = alc_read_coef_idx(codec, 0x46);
5671 is_ctia = (val & 0x0070) == 0x0070;
5672 break;
5673 case 0x10ec0298:
5674 snd_hda_codec_write(codec, 0x21, 0,
5675 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5676 msleep(100);
5677 snd_hda_codec_write(codec, 0x21, 0,
5678 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5679 msleep(200);
5680
5681 val = alc_read_coef_idx(codec, 0x50);
5682 if (val & (1 << 12)) {
5683 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5684 alc_process_coef_fw(codec, coef0288);
5685 msleep(350);
5686 val = alc_read_coef_idx(codec, 0x50);
5687 is_ctia = (val & 0x0070) == 0x0070;
5688 } else {
5689 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5690 alc_process_coef_fw(codec, coef0288);
5691 msleep(350);
5692 val = alc_read_coef_idx(codec, 0x50);
5693 is_ctia = (val & 0x0070) == 0x0070;
5694 }
5695 alc_process_coef_fw(codec, coef0298);
5696 snd_hda_codec_write(codec, 0x21, 0,
5697 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5698 msleep(75);
5699 snd_hda_codec_write(codec, 0x21, 0,
5700 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5701 break;
5702 case 0x10ec0286:
5703 case 0x10ec0288:
5704 alc_process_coef_fw(codec, coef0288);
5705 msleep(350);
5706 val = alc_read_coef_idx(codec, 0x50);
5707 is_ctia = (val & 0x0070) == 0x0070;
5708 break;
5709 case 0x10ec0292:
5710 alc_write_coef_idx(codec, 0x6b, 0xd429);
5711 msleep(300);
5712 val = alc_read_coef_idx(codec, 0x6c);
5713 is_ctia = (val & 0x001c) == 0x001c;
5714 break;
5715 case 0x10ec0293:
5716 alc_process_coef_fw(codec, coef0293);
5717 msleep(300);
5718 val = alc_read_coef_idx(codec, 0x46);
5719 is_ctia = (val & 0x0070) == 0x0070;
5720 break;
5721 case 0x10ec0668:
5722 alc_process_coef_fw(codec, coef0688);
5723 msleep(300);
5724 val = alc_read_coef_idx(codec, 0xbe);
5725 is_ctia = (val & 0x1c02) == 0x1c02;
5726 break;
5727 case 0x10ec0215:
5728 case 0x10ec0225:
5729 case 0x10ec0285:
5730 case 0x10ec0295:
5731 case 0x10ec0289:
5732 case 0x10ec0299:
5733 alc_process_coef_fw(codec, alc225_pre_hsmode);
5734 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5735 val = alc_read_coef_idx(codec, 0x45);
5736 if (val & (1 << 9)) {
5737 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5738 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5739 msleep(800);
5740 val = alc_read_coef_idx(codec, 0x46);
5741 is_ctia = (val & 0x00f0) == 0x00f0;
5742 } else {
5743 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5744 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5745 msleep(800);
5746 val = alc_read_coef_idx(codec, 0x46);
5747 is_ctia = (val & 0x00f0) == 0x00f0;
5748 }
5749 if (!is_ctia) {
5750 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5751 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5752 msleep(100);
5753 val = alc_read_coef_idx(codec, 0x46);
5754 if ((val & 0x00f0) == 0x00f0)
5755 is_ctia = false;
5756 else
5757 is_ctia = true;
5758 }
5759 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5760 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5761 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5762 break;
5763 case 0x10ec0867:
5764 is_ctia = true;
5765 break;
5766 }
5767
5768 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5769 is_ctia ? "yes" : "no");
5770 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5771 }
5772
alc_update_headset_mode(struct hda_codec * codec)5773 static void alc_update_headset_mode(struct hda_codec *codec)
5774 {
5775 struct alc_spec *spec = codec->spec;
5776
5777 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5778 hda_nid_t hp_pin = alc_get_hp_pin(spec);
5779
5780 int new_headset_mode;
5781
5782 if (!snd_hda_jack_detect(codec, hp_pin))
5783 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5784 else if (mux_pin == spec->headset_mic_pin)
5785 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5786 else if (mux_pin == spec->headphone_mic_pin)
5787 new_headset_mode = ALC_HEADSET_MODE_MIC;
5788 else
5789 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5790
5791 if (new_headset_mode == spec->current_headset_mode) {
5792 snd_hda_gen_update_outputs(codec);
5793 return;
5794 }
5795
5796 switch (new_headset_mode) {
5797 case ALC_HEADSET_MODE_UNPLUGGED:
5798 alc_headset_mode_unplugged(codec);
5799 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5800 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5801 spec->gen.hp_jack_present = false;
5802 break;
5803 case ALC_HEADSET_MODE_HEADSET:
5804 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5805 alc_determine_headset_type(codec);
5806 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5807 alc_headset_mode_ctia(codec);
5808 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5809 alc_headset_mode_omtp(codec);
5810 spec->gen.hp_jack_present = true;
5811 break;
5812 case ALC_HEADSET_MODE_MIC:
5813 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5814 spec->gen.hp_jack_present = false;
5815 break;
5816 case ALC_HEADSET_MODE_HEADPHONE:
5817 alc_headset_mode_default(codec);
5818 spec->gen.hp_jack_present = true;
5819 break;
5820 }
5821 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5822 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5823 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5824 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5825 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5826 PIN_VREFHIZ);
5827 }
5828 spec->current_headset_mode = new_headset_mode;
5829
5830 snd_hda_gen_update_outputs(codec);
5831 }
5832
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5833 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5834 struct snd_kcontrol *kcontrol,
5835 struct snd_ctl_elem_value *ucontrol)
5836 {
5837 alc_update_headset_mode(codec);
5838 }
5839
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5840 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5841 struct hda_jack_callback *jack)
5842 {
5843 snd_hda_gen_hp_automute(codec, jack);
5844 alc_update_headset_mode(codec);
5845 }
5846
alc_probe_headset_mode(struct hda_codec * codec)5847 static void alc_probe_headset_mode(struct hda_codec *codec)
5848 {
5849 int i;
5850 struct alc_spec *spec = codec->spec;
5851 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5852
5853 /* Find mic pins */
5854 for (i = 0; i < cfg->num_inputs; i++) {
5855 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5856 spec->headset_mic_pin = cfg->inputs[i].pin;
5857 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5858 spec->headphone_mic_pin = cfg->inputs[i].pin;
5859 }
5860
5861 WARN_ON(spec->gen.cap_sync_hook);
5862 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5863 spec->gen.automute_hook = alc_update_headset_mode;
5864 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5865 }
5866
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5867 static void alc_fixup_headset_mode(struct hda_codec *codec,
5868 const struct hda_fixup *fix, int action)
5869 {
5870 struct alc_spec *spec = codec->spec;
5871
5872 switch (action) {
5873 case HDA_FIXUP_ACT_PRE_PROBE:
5874 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5875 break;
5876 case HDA_FIXUP_ACT_PROBE:
5877 alc_probe_headset_mode(codec);
5878 break;
5879 case HDA_FIXUP_ACT_INIT:
5880 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5881 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5882 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5883 }
5884 alc_update_headset_mode(codec);
5885 break;
5886 }
5887 }
5888
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5889 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5890 const struct hda_fixup *fix, int action)
5891 {
5892 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5893 struct alc_spec *spec = codec->spec;
5894 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5895 }
5896 else
5897 alc_fixup_headset_mode(codec, fix, action);
5898 }
5899
alc255_set_default_jack_type(struct hda_codec * codec)5900 static void alc255_set_default_jack_type(struct hda_codec *codec)
5901 {
5902 /* Set to iphone type */
5903 static const struct coef_fw alc255fw[] = {
5904 WRITE_COEF(0x1b, 0x880b),
5905 WRITE_COEF(0x45, 0xd089),
5906 WRITE_COEF(0x1b, 0x080b),
5907 WRITE_COEF(0x46, 0x0004),
5908 WRITE_COEF(0x1b, 0x0c0b),
5909 {}
5910 };
5911 static const struct coef_fw alc256fw[] = {
5912 WRITE_COEF(0x1b, 0x884b),
5913 WRITE_COEF(0x45, 0xd089),
5914 WRITE_COEF(0x1b, 0x084b),
5915 WRITE_COEF(0x46, 0x0004),
5916 WRITE_COEF(0x1b, 0x0c4b),
5917 {}
5918 };
5919 switch (codec->core.vendor_id) {
5920 case 0x10ec0255:
5921 alc_process_coef_fw(codec, alc255fw);
5922 break;
5923 case 0x10ec0230:
5924 case 0x10ec0236:
5925 case 0x10ec0256:
5926 case 0x19e58326:
5927 alc_process_coef_fw(codec, alc256fw);
5928 break;
5929 }
5930 msleep(30);
5931 }
5932
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)5933 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5934 const struct hda_fixup *fix, int action)
5935 {
5936 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5937 alc255_set_default_jack_type(codec);
5938 }
5939 alc_fixup_headset_mode(codec, fix, action);
5940 }
5941
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5942 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5943 const struct hda_fixup *fix, int action)
5944 {
5945 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5946 struct alc_spec *spec = codec->spec;
5947 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5948 alc255_set_default_jack_type(codec);
5949 }
5950 else
5951 alc_fixup_headset_mode(codec, fix, action);
5952 }
5953
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5954 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5955 struct hda_jack_callback *jack)
5956 {
5957 struct alc_spec *spec = codec->spec;
5958
5959 alc_update_headset_jack_cb(codec, jack);
5960 /* Headset Mic enable or disable, only for Dell Dino */
5961 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5962 }
5963
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)5964 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5965 const struct hda_fixup *fix, int action)
5966 {
5967 alc_fixup_headset_mode(codec, fix, action);
5968 if (action == HDA_FIXUP_ACT_PROBE) {
5969 struct alc_spec *spec = codec->spec;
5970 /* toggled via hp_automute_hook */
5971 spec->gpio_mask |= 0x40;
5972 spec->gpio_dir |= 0x40;
5973 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5974 }
5975 }
5976
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)5977 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5978 const struct hda_fixup *fix, int action)
5979 {
5980 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5981 struct alc_spec *spec = codec->spec;
5982 spec->gen.auto_mute_via_amp = 1;
5983 }
5984 }
5985
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)5986 static void alc_fixup_no_shutup(struct hda_codec *codec,
5987 const struct hda_fixup *fix, int action)
5988 {
5989 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5990 struct alc_spec *spec = codec->spec;
5991 spec->no_shutup_pins = 1;
5992 }
5993 }
5994
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)5995 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5996 const struct hda_fixup *fix, int action)
5997 {
5998 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5999 struct alc_spec *spec = codec->spec;
6000 /* Disable AA-loopback as it causes white noise */
6001 spec->gen.mixer_nid = 0;
6002 }
6003 }
6004
6005 /* 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)6006 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6007 const struct hda_fixup *fix, int action)
6008 {
6009 static const struct hda_pintbl pincfgs[] = {
6010 { 0x16, 0x21211010 }, /* dock headphone */
6011 { 0x19, 0x21a11010 }, /* dock mic */
6012 { }
6013 };
6014 struct alc_spec *spec = codec->spec;
6015
6016 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6017 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6018 codec->power_save_node = 0; /* avoid click noises */
6019 snd_hda_apply_pincfgs(codec, pincfgs);
6020 }
6021 }
6022
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6023 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6024 const struct hda_fixup *fix, int action)
6025 {
6026 static const struct hda_pintbl pincfgs[] = {
6027 { 0x17, 0x21211010 }, /* dock headphone */
6028 { 0x19, 0x21a11010 }, /* dock mic */
6029 { }
6030 };
6031 struct alc_spec *spec = codec->spec;
6032
6033 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6034 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6035 snd_hda_apply_pincfgs(codec, pincfgs);
6036 } else if (action == HDA_FIXUP_ACT_INIT) {
6037 /* Enable DOCK device */
6038 snd_hda_codec_write(codec, 0x17, 0,
6039 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6040 /* Enable DOCK device */
6041 snd_hda_codec_write(codec, 0x19, 0,
6042 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6043 }
6044 }
6045
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6046 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6047 const struct hda_fixup *fix, int action)
6048 {
6049 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6050 * the speaker output becomes too low by some reason on Thinkpads with
6051 * ALC298 codec
6052 */
6053 static const hda_nid_t preferred_pairs[] = {
6054 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6055 0
6056 };
6057 struct alc_spec *spec = codec->spec;
6058
6059 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6060 spec->gen.preferred_dacs = preferred_pairs;
6061 }
6062
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6063 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6064 const struct hda_fixup *fix, int action)
6065 {
6066 static const hda_nid_t preferred_pairs[] = {
6067 0x17, 0x02, 0x21, 0x03, 0
6068 };
6069 struct alc_spec *spec = codec->spec;
6070
6071 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6072 spec->gen.preferred_dacs = preferred_pairs;
6073 }
6074
alc_shutup_dell_xps13(struct hda_codec * codec)6075 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6076 {
6077 struct alc_spec *spec = codec->spec;
6078 int hp_pin = alc_get_hp_pin(spec);
6079
6080 /* Prevent pop noises when headphones are plugged in */
6081 snd_hda_codec_write(codec, hp_pin, 0,
6082 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6083 msleep(20);
6084 }
6085
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6086 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6087 const struct hda_fixup *fix, int action)
6088 {
6089 struct alc_spec *spec = codec->spec;
6090 struct hda_input_mux *imux = &spec->gen.input_mux;
6091 int i;
6092
6093 switch (action) {
6094 case HDA_FIXUP_ACT_PRE_PROBE:
6095 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6096 * it causes a click noise at start up
6097 */
6098 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6099 spec->shutup = alc_shutup_dell_xps13;
6100 break;
6101 case HDA_FIXUP_ACT_PROBE:
6102 /* Make the internal mic the default input source. */
6103 for (i = 0; i < imux->num_items; i++) {
6104 if (spec->gen.imux_pins[i] == 0x12) {
6105 spec->gen.cur_mux[0] = i;
6106 break;
6107 }
6108 }
6109 break;
6110 }
6111 }
6112
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6113 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6114 const struct hda_fixup *fix, int action)
6115 {
6116 struct alc_spec *spec = codec->spec;
6117
6118 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6119 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6120 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6121
6122 /* Disable boost for mic-in permanently. (This code is only called
6123 from quirks that guarantee that the headphone is at NID 0x1b.) */
6124 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6125 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6126 } else
6127 alc_fixup_headset_mode(codec, fix, action);
6128 }
6129
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6130 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6131 const struct hda_fixup *fix, int action)
6132 {
6133 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6134 alc_write_coef_idx(codec, 0xc4, 0x8000);
6135 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6136 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6137 }
6138 alc_fixup_headset_mode(codec, fix, action);
6139 }
6140
6141 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6142 static int find_ext_mic_pin(struct hda_codec *codec)
6143 {
6144 struct alc_spec *spec = codec->spec;
6145 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6146 hda_nid_t nid;
6147 unsigned int defcfg;
6148 int i;
6149
6150 for (i = 0; i < cfg->num_inputs; i++) {
6151 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6152 continue;
6153 nid = cfg->inputs[i].pin;
6154 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6155 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6156 continue;
6157 return nid;
6158 }
6159
6160 return 0;
6161 }
6162
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6163 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6164 const struct hda_fixup *fix,
6165 int action)
6166 {
6167 struct alc_spec *spec = codec->spec;
6168
6169 if (action == HDA_FIXUP_ACT_PROBE) {
6170 int mic_pin = find_ext_mic_pin(codec);
6171 int hp_pin = alc_get_hp_pin(spec);
6172
6173 if (snd_BUG_ON(!mic_pin || !hp_pin))
6174 return;
6175 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6176 }
6177 }
6178
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6179 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6180 const struct hda_fixup *fix,
6181 int action)
6182 {
6183 struct alc_spec *spec = codec->spec;
6184 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6185 int i;
6186
6187 /* The mic boosts on level 2 and 3 are too noisy
6188 on the internal mic input.
6189 Therefore limit the boost to 0 or 1. */
6190
6191 if (action != HDA_FIXUP_ACT_PROBE)
6192 return;
6193
6194 for (i = 0; i < cfg->num_inputs; i++) {
6195 hda_nid_t nid = cfg->inputs[i].pin;
6196 unsigned int defcfg;
6197 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6198 continue;
6199 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6200 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6201 continue;
6202
6203 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6204 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6205 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6206 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6207 (0 << AC_AMPCAP_MUTE_SHIFT));
6208 }
6209 }
6210
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6211 static void alc283_hp_automute_hook(struct hda_codec *codec,
6212 struct hda_jack_callback *jack)
6213 {
6214 struct alc_spec *spec = codec->spec;
6215 int vref;
6216
6217 msleep(200);
6218 snd_hda_gen_hp_automute(codec, jack);
6219
6220 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6221
6222 msleep(600);
6223 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6224 vref);
6225 }
6226
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6227 static void alc283_fixup_chromebook(struct hda_codec *codec,
6228 const struct hda_fixup *fix, int action)
6229 {
6230 struct alc_spec *spec = codec->spec;
6231
6232 switch (action) {
6233 case HDA_FIXUP_ACT_PRE_PROBE:
6234 snd_hda_override_wcaps(codec, 0x03, 0);
6235 /* Disable AA-loopback as it causes white noise */
6236 spec->gen.mixer_nid = 0;
6237 break;
6238 case HDA_FIXUP_ACT_INIT:
6239 /* MIC2-VREF control */
6240 /* Set to manual mode */
6241 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6242 /* Enable Line1 input control by verb */
6243 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6244 break;
6245 }
6246 }
6247
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6248 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6249 const struct hda_fixup *fix, int action)
6250 {
6251 struct alc_spec *spec = codec->spec;
6252
6253 switch (action) {
6254 case HDA_FIXUP_ACT_PRE_PROBE:
6255 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6256 break;
6257 case HDA_FIXUP_ACT_INIT:
6258 /* MIC2-VREF control */
6259 /* Set to manual mode */
6260 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6261 break;
6262 }
6263 }
6264
6265 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6266 static void asus_tx300_automute(struct hda_codec *codec)
6267 {
6268 struct alc_spec *spec = codec->spec;
6269 snd_hda_gen_update_outputs(codec);
6270 if (snd_hda_jack_detect(codec, 0x1b))
6271 spec->gen.mute_bits |= (1ULL << 0x14);
6272 }
6273
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6274 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6275 const struct hda_fixup *fix, int action)
6276 {
6277 struct alc_spec *spec = codec->spec;
6278 static const struct hda_pintbl dock_pins[] = {
6279 { 0x1b, 0x21114000 }, /* dock speaker pin */
6280 {}
6281 };
6282
6283 switch (action) {
6284 case HDA_FIXUP_ACT_PRE_PROBE:
6285 spec->init_amp = ALC_INIT_DEFAULT;
6286 /* TX300 needs to set up GPIO2 for the speaker amp */
6287 alc_setup_gpio(codec, 0x04);
6288 snd_hda_apply_pincfgs(codec, dock_pins);
6289 spec->gen.auto_mute_via_amp = 1;
6290 spec->gen.automute_hook = asus_tx300_automute;
6291 snd_hda_jack_detect_enable_callback(codec, 0x1b,
6292 snd_hda_gen_hp_automute);
6293 break;
6294 case HDA_FIXUP_ACT_PROBE:
6295 spec->init_amp = ALC_INIT_DEFAULT;
6296 break;
6297 case HDA_FIXUP_ACT_BUILD:
6298 /* this is a bit tricky; give more sane names for the main
6299 * (tablet) speaker and the dock speaker, respectively
6300 */
6301 rename_ctl(codec, "Speaker Playback Switch",
6302 "Dock Speaker Playback Switch");
6303 rename_ctl(codec, "Bass Speaker Playback Switch",
6304 "Speaker Playback Switch");
6305 break;
6306 }
6307 }
6308
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6309 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6310 const struct hda_fixup *fix, int action)
6311 {
6312 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6313 /* DAC node 0x03 is giving mono output. We therefore want to
6314 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6315 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6316 static const hda_nid_t conn1[] = { 0x0c };
6317 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6318 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6319 }
6320 }
6321
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6322 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6323 const struct hda_fixup *fix, int action)
6324 {
6325 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6326 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6327 we can't adjust the speaker's volume since this node does not has
6328 Amp-out capability. we change the speaker's route to:
6329 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6330 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6331 speaker's volume now. */
6332
6333 static const hda_nid_t conn1[] = { 0x0c };
6334 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6335 }
6336 }
6337
6338 /* 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)6339 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6340 const struct hda_fixup *fix, int action)
6341 {
6342 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6343 static const hda_nid_t conn[] = { 0x02, 0x03 };
6344 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6345 }
6346 }
6347
6348 /* 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)6349 static void alc285_fixup_speaker2_to_dac1(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 };
6354 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6355 }
6356 }
6357
6358 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6359 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6360 struct hda_jack_callback *jack)
6361 {
6362 struct alc_spec *spec = codec->spec;
6363
6364 snd_hda_gen_hp_automute(codec, jack);
6365 /* mute_led_polarity is set to 0, so we pass inverted value here */
6366 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6367 !spec->gen.hp_jack_present);
6368 }
6369
6370 /* Manage GPIOs for HP EliteBook Folio 9480m.
6371 *
6372 * GPIO4 is the headphone amplifier power control
6373 * GPIO3 is the audio output mute indicator LED
6374 */
6375
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6376 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6377 const struct hda_fixup *fix,
6378 int action)
6379 {
6380 struct alc_spec *spec = codec->spec;
6381
6382 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6383 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6384 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6385 spec->gpio_mask |= 0x10;
6386 spec->gpio_dir |= 0x10;
6387 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6388 }
6389 }
6390
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6391 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6392 const struct hda_fixup *fix,
6393 int action)
6394 {
6395 struct alc_spec *spec = codec->spec;
6396
6397 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6398 spec->gpio_mask |= 0x04;
6399 spec->gpio_dir |= 0x04;
6400 /* set data bit low */
6401 }
6402 }
6403
6404 /* Quirk for Thinkpad X1 7th and 8th Gen
6405 * The following fixed routing needed
6406 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6407 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6408 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6409 */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6410 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6411 const struct hda_fixup *fix, int action)
6412 {
6413 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6414 static const hda_nid_t preferred_pairs[] = {
6415 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6416 };
6417 struct alc_spec *spec = codec->spec;
6418
6419 switch (action) {
6420 case HDA_FIXUP_ACT_PRE_PROBE:
6421 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6422 spec->gen.preferred_dacs = preferred_pairs;
6423 break;
6424 case HDA_FIXUP_ACT_BUILD:
6425 /* The generic parser creates somewhat unintuitive volume ctls
6426 * with the fixed routing above, and the shared DAC2 may be
6427 * confusing for PA.
6428 * Rename those to unique names so that PA doesn't touch them
6429 * and use only Master volume.
6430 */
6431 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6432 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6433 break;
6434 }
6435 }
6436
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6437 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6438 const struct hda_fixup *fix,
6439 int action)
6440 {
6441 alc_fixup_dual_codecs(codec, fix, action);
6442 switch (action) {
6443 case HDA_FIXUP_ACT_PRE_PROBE:
6444 /* override card longname to provide a unique UCM profile */
6445 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6446 break;
6447 case HDA_FIXUP_ACT_BUILD:
6448 /* rename Capture controls depending on the codec */
6449 rename_ctl(codec, "Capture Volume",
6450 codec->addr == 0 ?
6451 "Rear-Panel Capture Volume" :
6452 "Front-Panel Capture Volume");
6453 rename_ctl(codec, "Capture Switch",
6454 codec->addr == 0 ?
6455 "Rear-Panel Capture Switch" :
6456 "Front-Panel Capture Switch");
6457 break;
6458 }
6459 }
6460
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6461 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6462 const struct hda_fixup *fix, int action)
6463 {
6464 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6465 return;
6466
6467 codec->power_save_node = 1;
6468 }
6469
6470 /* 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)6471 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6472 const struct hda_fixup *fix, int action)
6473 {
6474 struct alc_spec *spec = codec->spec;
6475 static const hda_nid_t preferred_pairs[] = {
6476 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6477 0
6478 };
6479
6480 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6481 return;
6482
6483 spec->gen.preferred_dacs = preferred_pairs;
6484 spec->gen.auto_mute_via_amp = 1;
6485 codec->power_save_node = 0;
6486 }
6487
6488 /* 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)6489 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6490 const struct hda_fixup *fix, int action)
6491 {
6492 static const hda_nid_t preferred_pairs[] = {
6493 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6494 };
6495 struct alc_spec *spec = codec->spec;
6496
6497 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6498 spec->gen.preferred_dacs = preferred_pairs;
6499 spec->gen.obey_preferred_dacs = 1;
6500 }
6501 }
6502
6503 /* 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)6504 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6505 const struct hda_fixup *fix, int action)
6506 {
6507 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6508 return;
6509
6510 snd_hda_override_wcaps(codec, 0x03, 0);
6511 }
6512
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6513 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6514 {
6515 switch (codec->core.vendor_id) {
6516 case 0x10ec0274:
6517 case 0x10ec0294:
6518 case 0x10ec0225:
6519 case 0x10ec0295:
6520 case 0x10ec0299:
6521 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6522 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6523 break;
6524 case 0x10ec0230:
6525 case 0x10ec0235:
6526 case 0x10ec0236:
6527 case 0x10ec0255:
6528 case 0x10ec0256:
6529 case 0x10ec0257:
6530 case 0x19e58326:
6531 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6532 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6533 break;
6534 }
6535 }
6536
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6537 static void alc295_fixup_chromebook(struct hda_codec *codec,
6538 const struct hda_fixup *fix, int action)
6539 {
6540 struct alc_spec *spec = codec->spec;
6541
6542 switch (action) {
6543 case HDA_FIXUP_ACT_PRE_PROBE:
6544 spec->ultra_low_power = true;
6545 break;
6546 case HDA_FIXUP_ACT_INIT:
6547 alc_combo_jack_hp_jd_restart(codec);
6548 break;
6549 }
6550 }
6551
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6552 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6553 const struct hda_fixup *fix, int action)
6554 {
6555 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6556 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6557 }
6558
6559
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6560 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6561 struct hda_jack_callback *cb)
6562 {
6563 /* The Windows driver sets the codec up in a very different way where
6564 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6565 */
6566 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6567 alc_write_coef_idx(codec, 0x10, 0x8a20);
6568 else
6569 alc_write_coef_idx(codec, 0x10, 0x0a20);
6570 }
6571
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6572 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6573 const struct hda_fixup *fix, int action)
6574 {
6575 /* Pin 0x21: headphones/headset mic */
6576 if (!is_jack_detectable(codec, 0x21))
6577 return;
6578
6579 switch (action) {
6580 case HDA_FIXUP_ACT_PRE_PROBE:
6581 snd_hda_jack_detect_enable_callback(codec, 0x21,
6582 alc294_gx502_toggle_output);
6583 break;
6584 case HDA_FIXUP_ACT_INIT:
6585 /* Make sure to start in a correct state, i.e. if
6586 * headphones have been plugged in before powering up the system
6587 */
6588 alc294_gx502_toggle_output(codec, NULL);
6589 break;
6590 }
6591 }
6592
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6593 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6594 struct hda_jack_callback *cb)
6595 {
6596 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6597 * responsible from changes between speakers and headphones
6598 */
6599 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6600 alc_write_coef_idx(codec, 0x10, 0x8420);
6601 else
6602 alc_write_coef_idx(codec, 0x10, 0x0a20);
6603 }
6604
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6605 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6606 const struct hda_fixup *fix, int action)
6607 {
6608 if (!is_jack_detectable(codec, 0x21))
6609 return;
6610
6611 switch (action) {
6612 case HDA_FIXUP_ACT_PRE_PROBE:
6613 snd_hda_jack_detect_enable_callback(codec, 0x21,
6614 alc294_gu502_toggle_output);
6615 break;
6616 case HDA_FIXUP_ACT_INIT:
6617 alc294_gu502_toggle_output(codec, NULL);
6618 break;
6619 }
6620 }
6621
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6622 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6623 const struct hda_fixup *fix, int action)
6624 {
6625 if (action != HDA_FIXUP_ACT_INIT)
6626 return;
6627
6628 msleep(100);
6629 alc_write_coef_idx(codec, 0x65, 0x0);
6630 }
6631
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6632 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6633 const struct hda_fixup *fix, int action)
6634 {
6635 switch (action) {
6636 case HDA_FIXUP_ACT_INIT:
6637 alc_combo_jack_hp_jd_restart(codec);
6638 break;
6639 }
6640 }
6641
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6642 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6643 const struct hda_fixup *fix, int action)
6644 {
6645 struct alc_spec *spec = codec->spec;
6646
6647 switch (action) {
6648 case HDA_FIXUP_ACT_PRE_PROBE:
6649 /* Mic RING SLEEVE swap for combo jack */
6650 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6651 spec->no_internal_mic_pin = true;
6652 break;
6653 case HDA_FIXUP_ACT_INIT:
6654 alc_combo_jack_hp_jd_restart(codec);
6655 break;
6656 }
6657 }
6658
6659 /* GPIO1 = amplifier on/off
6660 * GPIO3 = mic mute LED
6661 */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6662 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6663 const struct hda_fixup *fix, int action)
6664 {
6665 static const hda_nid_t conn[] = { 0x02 };
6666
6667 struct alc_spec *spec = codec->spec;
6668 static const struct hda_pintbl pincfgs[] = {
6669 { 0x14, 0x90170110 }, /* front/high speakers */
6670 { 0x17, 0x90170130 }, /* back/bass speakers */
6671 { }
6672 };
6673
6674 //enable micmute led
6675 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6676
6677 switch (action) {
6678 case HDA_FIXUP_ACT_PRE_PROBE:
6679 spec->micmute_led_polarity = 1;
6680 /* needed for amp of back speakers */
6681 spec->gpio_mask |= 0x01;
6682 spec->gpio_dir |= 0x01;
6683 snd_hda_apply_pincfgs(codec, pincfgs);
6684 /* share DAC to have unified volume control */
6685 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6686 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6687 break;
6688 case HDA_FIXUP_ACT_INIT:
6689 /* need to toggle GPIO to enable the amp of back speakers */
6690 alc_update_gpio_data(codec, 0x01, true);
6691 msleep(100);
6692 alc_update_gpio_data(codec, 0x01, false);
6693 break;
6694 }
6695 }
6696
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6697 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6698 const struct hda_fixup *fix, int action)
6699 {
6700 static const hda_nid_t conn[] = { 0x02 };
6701 static const struct hda_pintbl pincfgs[] = {
6702 { 0x14, 0x90170110 }, /* rear speaker */
6703 { }
6704 };
6705
6706 switch (action) {
6707 case HDA_FIXUP_ACT_PRE_PROBE:
6708 snd_hda_apply_pincfgs(codec, pincfgs);
6709 /* force front speaker to DAC1 */
6710 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6711 break;
6712 }
6713 }
6714
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6715 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6716 const struct hda_fixup *fix,
6717 int action)
6718 {
6719 static const struct coef_fw coefs[] = {
6720 WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6721 WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6722 WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6723 WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6724 WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6725 WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6726 WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6727 WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6728 WRITE_COEF(0x6e, 0x1005), { }
6729 };
6730
6731 static const struct hda_pintbl pincfgs[] = {
6732 { 0x12, 0xb7a60130 }, /* Internal microphone*/
6733 { 0x14, 0x90170150 }, /* B&O soundbar speakers */
6734 { 0x17, 0x90170153 }, /* Side speakers */
6735 { 0x19, 0x03a11040 }, /* Headset microphone */
6736 { }
6737 };
6738
6739 switch (action) {
6740 case HDA_FIXUP_ACT_PRE_PROBE:
6741 snd_hda_apply_pincfgs(codec, pincfgs);
6742
6743 /* Fixes volume control problem for side speakers */
6744 alc295_fixup_disable_dac3(codec, fix, action);
6745
6746 /* Fixes no sound from headset speaker */
6747 snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6748
6749 /* Auto-enable headset mic when plugged */
6750 snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6751
6752 /* Headset mic volume enhancement */
6753 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6754 break;
6755 case HDA_FIXUP_ACT_INIT:
6756 alc_process_coef_fw(codec, coefs);
6757 break;
6758 case HDA_FIXUP_ACT_BUILD:
6759 rename_ctl(codec, "Bass Speaker Playback Volume",
6760 "B&O-Tuned Playback Volume");
6761 rename_ctl(codec, "Front Playback Switch",
6762 "B&O Soundbar Playback Switch");
6763 rename_ctl(codec, "Bass Speaker Playback Switch",
6764 "Side Speaker Playback Switch");
6765 break;
6766 }
6767 }
6768
6769 /* for hda_fixup_thinkpad_acpi() */
6770 #include "thinkpad_helper.c"
6771
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6772 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6773 const struct hda_fixup *fix, int action)
6774 {
6775 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6776 hda_fixup_thinkpad_acpi(codec, fix, action);
6777 }
6778
6779 /* 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)6780 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6781 const struct hda_fixup *fix,
6782 int action)
6783 {
6784 struct alc_spec *spec = codec->spec;
6785
6786 switch (action) {
6787 case HDA_FIXUP_ACT_PRE_PROBE:
6788 spec->gen.suppress_auto_mute = 1;
6789 break;
6790 }
6791 }
6792
comp_bind(struct device * dev)6793 static int comp_bind(struct device *dev)
6794 {
6795 struct hda_codec *cdc = dev_to_hda_codec(dev);
6796 struct alc_spec *spec = cdc->spec;
6797
6798 return component_bind_all(dev, spec->comps);
6799 }
6800
comp_unbind(struct device * dev)6801 static void comp_unbind(struct device *dev)
6802 {
6803 struct hda_codec *cdc = dev_to_hda_codec(dev);
6804 struct alc_spec *spec = cdc->spec;
6805
6806 component_unbind_all(dev, spec->comps);
6807 }
6808
6809 static const struct component_master_ops comp_master_ops = {
6810 .bind = comp_bind,
6811 .unbind = comp_unbind,
6812 };
6813
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)6814 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6815 struct snd_pcm_substream *sub, int action)
6816 {
6817 struct alc_spec *spec = cdc->spec;
6818 int i;
6819
6820 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6821 if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
6822 spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
6823 }
6824 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6825 if (spec->comps[i].dev && spec->comps[i].playback_hook)
6826 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6827 }
6828 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6829 if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
6830 spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
6831 }
6832 }
6833
6834 struct scodec_dev_name {
6835 const char *bus;
6836 const char *hid;
6837 int index;
6838 };
6839
6840 /* match the device name in a slightly relaxed manner */
comp_match_cs35l41_dev_name(struct device * dev,void * data)6841 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6842 {
6843 struct scodec_dev_name *p = data;
6844 const char *d = dev_name(dev);
6845 int n = strlen(p->bus);
6846 char tmp[32];
6847
6848 /* check the bus name */
6849 if (strncmp(d, p->bus, n))
6850 return 0;
6851 /* skip the bus number */
6852 if (isdigit(d[n]))
6853 n++;
6854 /* the rest must be exact matching */
6855 snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6856 return !strcmp(d + n, tmp);
6857 }
6858
comp_match_tas2781_dev_name(struct device * dev,void * data)6859 static int comp_match_tas2781_dev_name(struct device *dev,
6860 void *data)
6861 {
6862 struct scodec_dev_name *p = data;
6863 const char *d = dev_name(dev);
6864 int n = strlen(p->bus);
6865 char tmp[32];
6866
6867 /* check the bus name */
6868 if (strncmp(d, p->bus, n))
6869 return 0;
6870 /* skip the bus number */
6871 if (isdigit(d[n]))
6872 n++;
6873 /* the rest must be exact matching */
6874 snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
6875
6876 return !strcmp(d + n, tmp);
6877 }
6878
cs35l41_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,int count)6879 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6880 const char *hid, int count)
6881 {
6882 struct device *dev = hda_codec_dev(cdc);
6883 struct alc_spec *spec = cdc->spec;
6884 struct scodec_dev_name *rec;
6885 int ret, i;
6886
6887 switch (action) {
6888 case HDA_FIXUP_ACT_PRE_PROBE:
6889 for (i = 0; i < count; i++) {
6890 rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6891 if (!rec)
6892 return;
6893 rec->bus = bus;
6894 rec->hid = hid;
6895 rec->index = i;
6896 spec->comps[i].codec = cdc;
6897 component_match_add(dev, &spec->match,
6898 comp_match_cs35l41_dev_name, rec);
6899 }
6900 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6901 if (ret)
6902 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6903 else
6904 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6905 break;
6906 case HDA_FIXUP_ACT_FREE:
6907 component_master_del(dev, &comp_master_ops);
6908 break;
6909 }
6910 }
6911
tas2781_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid)6912 static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
6913 const char *bus, const char *hid)
6914 {
6915 struct device *dev = hda_codec_dev(cdc);
6916 struct alc_spec *spec = cdc->spec;
6917 struct scodec_dev_name *rec;
6918 int ret;
6919
6920 switch (action) {
6921 case HDA_FIXUP_ACT_PRE_PROBE:
6922 rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6923 if (!rec)
6924 return;
6925 rec->bus = bus;
6926 rec->hid = hid;
6927 rec->index = 0;
6928 spec->comps[0].codec = cdc;
6929 component_match_add(dev, &spec->match,
6930 comp_match_tas2781_dev_name, rec);
6931 ret = component_master_add_with_match(dev, &comp_master_ops,
6932 spec->match);
6933 if (ret)
6934 codec_err(cdc,
6935 "Fail to register component aggregator %d\n",
6936 ret);
6937 else
6938 spec->gen.pcm_playback_hook =
6939 comp_generic_playback_hook;
6940 break;
6941 case HDA_FIXUP_ACT_FREE:
6942 component_master_del(dev, &comp_master_ops);
6943 break;
6944 }
6945 }
6946
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6947 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6948 {
6949 cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6950 }
6951
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)6952 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6953 {
6954 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
6955 }
6956
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)6957 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6958 {
6959 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
6960 }
6961
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6962 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6963 int action)
6964 {
6965 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
6966 }
6967
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6968 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6969 int action)
6970 {
6971 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6972 }
6973
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)6974 static void tas2781_fixup_i2c(struct hda_codec *cdc,
6975 const struct hda_fixup *fix, int action)
6976 {
6977 tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
6978 }
6979
6980 /* for alc295_fixup_hp_top_speakers */
6981 #include "hp_x360_helper.c"
6982
6983 /* for alc285_fixup_ideapad_s740_coef() */
6984 #include "ideapad_s740_helper.c"
6985
6986 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6987 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6988 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6989 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6990 {}
6991 };
6992
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)6993 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6994 const struct hda_fixup *fix,
6995 int action)
6996 {
6997 /*
6998 * A certain other OS sets these coeffs to different values. On at least
6999 * one TongFang barebone these settings might survive even a cold
7000 * reboot. So to restore a clean slate the values are explicitly reset
7001 * to default here. Without this, the external microphone is always in a
7002 * plugged-in state, while the internal microphone is always in an
7003 * unplugged state, breaking the ability to use the internal microphone.
7004 */
7005 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7006 }
7007
7008 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7009 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7010 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7011 WRITE_COEF(0x49, 0x0149),
7012 {}
7013 };
7014
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7015 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7016 const struct hda_fixup *fix,
7017 int action)
7018 {
7019 /*
7020 * The audio jack input and output is not detected on the ASRock NUC Box
7021 * 1100 series when cold booting without this fix. Warm rebooting from a
7022 * certain other OS makes the audio functional, as COEF settings are
7023 * preserved in this case. This fix sets these altered COEF values as
7024 * the default.
7025 */
7026 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7027 }
7028
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7029 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7030 const struct hda_fixup *fix,
7031 int action)
7032 {
7033 /*
7034 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7035 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7036 * needs an additional quirk for sound working after suspend and resume.
7037 */
7038 if (codec->core.vendor_id == 0x10ec0256) {
7039 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7040 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7041 } else {
7042 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7043 }
7044 }
7045
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7046 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7047 const struct hda_fixup *fix,
7048 int action)
7049 {
7050 struct alc_spec *spec = codec->spec;
7051 struct hda_input_mux *imux = &spec->gen.input_mux;
7052 int i;
7053
7054 alc269_fixup_limit_int_mic_boost(codec, fix, action);
7055
7056 switch (action) {
7057 case HDA_FIXUP_ACT_PRE_PROBE:
7058 /**
7059 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7060 * to Hi-Z to avoid pop noises at startup and when plugging and
7061 * unplugging headphones.
7062 */
7063 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7064 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7065 break;
7066 case HDA_FIXUP_ACT_PROBE:
7067 /**
7068 * Make the internal mic (0x12) the default input source to
7069 * prevent pop noises on cold boot.
7070 */
7071 for (i = 0; i < imux->num_items; i++) {
7072 if (spec->gen.imux_pins[i] == 0x12) {
7073 spec->gen.cur_mux[0] = i;
7074 break;
7075 }
7076 }
7077 break;
7078 }
7079 }
7080
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7081 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7082 const struct hda_fixup *fix, int action)
7083 {
7084 /*
7085 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7086 * unconnected.
7087 */
7088 static const struct hda_pintbl pincfgs[] = {
7089 { 0x17, 0x90170121 },
7090 { }
7091 };
7092 /*
7093 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7094 * DAC 0x02 and 0x03 would be fine.
7095 */
7096 static const hda_nid_t conn[] = { 0x02, 0x03 };
7097 /*
7098 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7099 * Headphones (0x21) are connected to DAC 0x03.
7100 */
7101 static const hda_nid_t preferred_pairs[] = {
7102 0x14, 0x02,
7103 0x17, 0x02,
7104 0x21, 0x03,
7105 0
7106 };
7107 struct alc_spec *spec = codec->spec;
7108
7109 switch (action) {
7110 case HDA_FIXUP_ACT_PRE_PROBE:
7111 snd_hda_apply_pincfgs(codec, pincfgs);
7112 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7113 spec->gen.preferred_dacs = preferred_pairs;
7114 break;
7115 }
7116 }
7117
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7118 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7119 const struct hda_fixup *fix, int action)
7120 {
7121 static const struct hda_pintbl pincfgs[] = {
7122 { 0x14, 0x90170151 },
7123 { 0x17, 0x90170150 },
7124 { }
7125 };
7126 static const hda_nid_t conn[] = { 0x02, 0x03 };
7127 static const hda_nid_t preferred_pairs[] = {
7128 0x14, 0x02,
7129 0x17, 0x03,
7130 0x21, 0x02,
7131 0
7132 };
7133 struct alc_spec *spec = codec->spec;
7134
7135 alc_fixup_no_shutup(codec, fix, action);
7136
7137 switch (action) {
7138 case HDA_FIXUP_ACT_PRE_PROBE:
7139 snd_hda_apply_pincfgs(codec, pincfgs);
7140 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7141 spec->gen.preferred_dacs = preferred_pairs;
7142 break;
7143 }
7144 }
7145
7146 /* 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)7147 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7148 const struct hda_fixup *fix, int action)
7149 {
7150 struct alc_spec *spec = codec->spec;
7151 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7152 static const hda_nid_t preferred_pairs[] = {
7153 0x17, 0x02, 0x21, 0x03, 0
7154 };
7155
7156 if (action != HDA_FIXUP_ACT_PRE_PROBE)
7157 return;
7158
7159 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7160 spec->gen.preferred_dacs = preferred_pairs;
7161 spec->gen.auto_mute_via_amp = 1;
7162 if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7163 snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7164 0x0); /* Make sure 0x14 was disable */
7165 }
7166 }
7167 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7168 static void alc_fixup_headset_mic(struct hda_codec *codec,
7169 const struct hda_fixup *fix, int action)
7170 {
7171 struct alc_spec *spec = codec->spec;
7172 static const struct hda_pintbl pincfgs[] = {
7173 { 0x19, 0x03a1103c },
7174 { }
7175 };
7176
7177 switch (action) {
7178 case HDA_FIXUP_ACT_PRE_PROBE:
7179 snd_hda_apply_pincfgs(codec, pincfgs);
7180 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7181 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7182 break;
7183 }
7184 }
7185
7186
7187 enum {
7188 ALC269_FIXUP_GPIO2,
7189 ALC269_FIXUP_SONY_VAIO,
7190 ALC275_FIXUP_SONY_VAIO_GPIO2,
7191 ALC269_FIXUP_DELL_M101Z,
7192 ALC269_FIXUP_SKU_IGNORE,
7193 ALC269_FIXUP_ASUS_G73JW,
7194 ALC269_FIXUP_ASUS_N7601ZM_PINS,
7195 ALC269_FIXUP_ASUS_N7601ZM,
7196 ALC269_FIXUP_LENOVO_EAPD,
7197 ALC275_FIXUP_SONY_HWEQ,
7198 ALC275_FIXUP_SONY_DISABLE_AAMIX,
7199 ALC271_FIXUP_DMIC,
7200 ALC269_FIXUP_PCM_44K,
7201 ALC269_FIXUP_STEREO_DMIC,
7202 ALC269_FIXUP_HEADSET_MIC,
7203 ALC269_FIXUP_QUANTA_MUTE,
7204 ALC269_FIXUP_LIFEBOOK,
7205 ALC269_FIXUP_LIFEBOOK_EXTMIC,
7206 ALC269_FIXUP_LIFEBOOK_HP_PIN,
7207 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7208 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7209 ALC269_FIXUP_AMIC,
7210 ALC269_FIXUP_DMIC,
7211 ALC269VB_FIXUP_AMIC,
7212 ALC269VB_FIXUP_DMIC,
7213 ALC269_FIXUP_HP_MUTE_LED,
7214 ALC269_FIXUP_HP_MUTE_LED_MIC1,
7215 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7216 ALC269_FIXUP_HP_MUTE_LED_MIC3,
7217 ALC269_FIXUP_HP_GPIO_LED,
7218 ALC269_FIXUP_HP_GPIO_MIC1_LED,
7219 ALC269_FIXUP_HP_LINE1_MIC1_LED,
7220 ALC269_FIXUP_INV_DMIC,
7221 ALC269_FIXUP_LENOVO_DOCK,
7222 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7223 ALC269_FIXUP_NO_SHUTUP,
7224 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7225 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7226 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7227 ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7228 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7229 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7230 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7231 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7232 ALC269_FIXUP_HEADSET_MODE,
7233 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7234 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7235 ALC269_FIXUP_ASUS_X101_FUNC,
7236 ALC269_FIXUP_ASUS_X101_VERB,
7237 ALC269_FIXUP_ASUS_X101,
7238 ALC271_FIXUP_AMIC_MIC2,
7239 ALC271_FIXUP_HP_GATE_MIC_JACK,
7240 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7241 ALC269_FIXUP_ACER_AC700,
7242 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7243 ALC269VB_FIXUP_ASUS_ZENBOOK,
7244 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7245 ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7246 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7247 ALC269VB_FIXUP_ORDISSIMO_EVE2,
7248 ALC283_FIXUP_CHROME_BOOK,
7249 ALC283_FIXUP_SENSE_COMBO_JACK,
7250 ALC282_FIXUP_ASUS_TX300,
7251 ALC283_FIXUP_INT_MIC,
7252 ALC290_FIXUP_MONO_SPEAKERS,
7253 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7254 ALC290_FIXUP_SUBWOOFER,
7255 ALC290_FIXUP_SUBWOOFER_HSJACK,
7256 ALC269_FIXUP_THINKPAD_ACPI,
7257 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7258 ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7259 ALC269VC_FIXUP_INFINIX_Y4_MAX,
7260 ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7261 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7262 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7263 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7264 ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7265 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7266 ALC255_FIXUP_HEADSET_MODE,
7267 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7268 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7269 ALC292_FIXUP_TPT440_DOCK,
7270 ALC292_FIXUP_TPT440,
7271 ALC283_FIXUP_HEADSET_MIC,
7272 ALC255_FIXUP_MIC_MUTE_LED,
7273 ALC282_FIXUP_ASPIRE_V5_PINS,
7274 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7275 ALC280_FIXUP_HP_GPIO4,
7276 ALC286_FIXUP_HP_GPIO_LED,
7277 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7278 ALC280_FIXUP_HP_DOCK_PINS,
7279 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7280 ALC280_FIXUP_HP_9480M,
7281 ALC245_FIXUP_HP_X360_AMP,
7282 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7283 ALC285_FIXUP_HP_ENVY_X360,
7284 ALC288_FIXUP_DELL_HEADSET_MODE,
7285 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7286 ALC288_FIXUP_DELL_XPS_13,
7287 ALC288_FIXUP_DISABLE_AAMIX,
7288 ALC292_FIXUP_DELL_E7X_AAMIX,
7289 ALC292_FIXUP_DELL_E7X,
7290 ALC292_FIXUP_DISABLE_AAMIX,
7291 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7292 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7293 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7294 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7295 ALC275_FIXUP_DELL_XPS,
7296 ALC293_FIXUP_LENOVO_SPK_NOISE,
7297 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7298 ALC255_FIXUP_DELL_SPK_NOISE,
7299 ALC225_FIXUP_DISABLE_MIC_VREF,
7300 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7301 ALC295_FIXUP_DISABLE_DAC3,
7302 ALC285_FIXUP_SPEAKER2_TO_DAC1,
7303 ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7304 ALC285_FIXUP_ASUS_HEADSET_MIC,
7305 ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7306 ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7307 ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7308 ALC280_FIXUP_HP_HEADSET_MIC,
7309 ALC221_FIXUP_HP_FRONT_MIC,
7310 ALC292_FIXUP_TPT460,
7311 ALC298_FIXUP_SPK_VOLUME,
7312 ALC298_FIXUP_LENOVO_SPK_VOLUME,
7313 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7314 ALC269_FIXUP_ATIV_BOOK_8,
7315 ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7316 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7317 ALC256_FIXUP_ASUS_HEADSET_MODE,
7318 ALC256_FIXUP_ASUS_MIC,
7319 ALC256_FIXUP_ASUS_AIO_GPIO2,
7320 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7321 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7322 ALC233_FIXUP_LENOVO_MULTI_CODECS,
7323 ALC233_FIXUP_ACER_HEADSET_MIC,
7324 ALC294_FIXUP_LENOVO_MIC_LOCATION,
7325 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7326 ALC225_FIXUP_S3_POP_NOISE,
7327 ALC700_FIXUP_INTEL_REFERENCE,
7328 ALC274_FIXUP_DELL_BIND_DACS,
7329 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7330 ALC298_FIXUP_TPT470_DOCK_FIX,
7331 ALC298_FIXUP_TPT470_DOCK,
7332 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7333 ALC255_FIXUP_DELL_HEADSET_MIC,
7334 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7335 ALC298_FIXUP_HUAWEI_MBX_STEREO,
7336 ALC295_FIXUP_HP_X360,
7337 ALC221_FIXUP_HP_HEADSET_MIC,
7338 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7339 ALC295_FIXUP_HP_AUTO_MUTE,
7340 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7341 ALC294_FIXUP_ASUS_MIC,
7342 ALC294_FIXUP_ASUS_HEADSET_MIC,
7343 ALC294_FIXUP_ASUS_SPK,
7344 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7345 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7346 ALC255_FIXUP_ACER_HEADSET_MIC,
7347 ALC295_FIXUP_CHROME_BOOK,
7348 ALC225_FIXUP_HEADSET_JACK,
7349 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7350 ALC225_FIXUP_WYSE_AUTO_MUTE,
7351 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7352 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7353 ALC256_FIXUP_ASUS_HEADSET_MIC,
7354 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7355 ALC255_FIXUP_PREDATOR_SUBWOOFER,
7356 ALC299_FIXUP_PREDATOR_SPK,
7357 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7358 ALC289_FIXUP_DELL_SPK1,
7359 ALC289_FIXUP_DELL_SPK2,
7360 ALC289_FIXUP_DUAL_SPK,
7361 ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7362 ALC294_FIXUP_SPK2_TO_DAC1,
7363 ALC294_FIXUP_ASUS_DUAL_SPK,
7364 ALC285_FIXUP_THINKPAD_X1_GEN7,
7365 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7366 ALC294_FIXUP_ASUS_ALLY,
7367 ALC294_FIXUP_ASUS_ALLY_PINS,
7368 ALC294_FIXUP_ASUS_ALLY_VERBS,
7369 ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7370 ALC294_FIXUP_ASUS_HPE,
7371 ALC294_FIXUP_ASUS_COEF_1B,
7372 ALC294_FIXUP_ASUS_GX502_HP,
7373 ALC294_FIXUP_ASUS_GX502_PINS,
7374 ALC294_FIXUP_ASUS_GX502_VERBS,
7375 ALC294_FIXUP_ASUS_GU502_HP,
7376 ALC294_FIXUP_ASUS_GU502_PINS,
7377 ALC294_FIXUP_ASUS_GU502_VERBS,
7378 ALC294_FIXUP_ASUS_G513_PINS,
7379 ALC285_FIXUP_ASUS_G533Z_PINS,
7380 ALC285_FIXUP_HP_GPIO_LED,
7381 ALC285_FIXUP_HP_MUTE_LED,
7382 ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7383 ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7384 ALC236_FIXUP_HP_GPIO_LED,
7385 ALC236_FIXUP_HP_MUTE_LED,
7386 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7387 ALC236_FIXUP_LENOVO_INV_DMIC,
7388 ALC298_FIXUP_SAMSUNG_AMP,
7389 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7390 ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7391 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7392 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7393 ALC269VC_FIXUP_ACER_HEADSET_MIC,
7394 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7395 ALC289_FIXUP_ASUS_GA401,
7396 ALC289_FIXUP_ASUS_GA502,
7397 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7398 ALC285_FIXUP_HP_GPIO_AMP_INIT,
7399 ALC269_FIXUP_CZC_B20,
7400 ALC269_FIXUP_CZC_TMI,
7401 ALC269_FIXUP_CZC_L101,
7402 ALC269_FIXUP_LEMOTE_A1802,
7403 ALC269_FIXUP_LEMOTE_A190X,
7404 ALC256_FIXUP_INTEL_NUC8_RUGGED,
7405 ALC233_FIXUP_INTEL_NUC8_DMIC,
7406 ALC233_FIXUP_INTEL_NUC8_BOOST,
7407 ALC256_FIXUP_INTEL_NUC10,
7408 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7409 ALC274_FIXUP_HP_MIC,
7410 ALC274_FIXUP_HP_HEADSET_MIC,
7411 ALC274_FIXUP_HP_ENVY_GPIO,
7412 ALC256_FIXUP_ASUS_HPE,
7413 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7414 ALC287_FIXUP_HP_GPIO_LED,
7415 ALC256_FIXUP_HP_HEADSET_MIC,
7416 ALC245_FIXUP_HP_GPIO_LED,
7417 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7418 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7419 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7420 ALC256_FIXUP_ACER_HEADSET_MIC,
7421 ALC285_FIXUP_IDEAPAD_S740_COEF,
7422 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7423 ALC295_FIXUP_ASUS_DACS,
7424 ALC295_FIXUP_HP_OMEN,
7425 ALC285_FIXUP_HP_SPECTRE_X360,
7426 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7427 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7428 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7429 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7430 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7431 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7432 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7433 ALC298_FIXUP_LENOVO_C940_DUET7,
7434 ALC287_FIXUP_LENOVO_14IRP8_DUETITL,
7435 ALC287_FIXUP_13S_GEN2_SPEAKERS,
7436 ALC256_FIXUP_SET_COEF_DEFAULTS,
7437 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7438 ALC233_FIXUP_NO_AUDIO_JACK,
7439 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7440 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7441 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7442 ALC287_FIXUP_LEGION_16ACHG6,
7443 ALC287_FIXUP_CS35L41_I2C_2,
7444 ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7445 ALC245_FIXUP_CS35L41_SPI_2,
7446 ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7447 ALC245_FIXUP_CS35L41_SPI_4,
7448 ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7449 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7450 ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7451 ALC287_FIXUP_LEGION_16ITHG6,
7452 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7453 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7454 ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7455 ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7456 ALC236_FIXUP_DELL_DUAL_CODECS,
7457 ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7458 ALC287_FIXUP_TAS2781_I2C,
7459 ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7460 ALC245_FIXUP_HP_X360_MUTE_LEDS,
7461 ALC287_FIXUP_THINKPAD_I2S_SPK,
7462 ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7463 ALC2XX_FIXUP_HEADSET_MIC,
7464 ALC289_FIXUP_DELL_CS35L41_SPI_2,
7465 ALC294_FIXUP_CS35L41_I2C_2,
7466 };
7467
7468 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7469 * both have the very same PCI SSID, and we need to apply different fixups
7470 * depending on the codec ID
7471 */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7472 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7473 const struct hda_fixup *fix,
7474 int action)
7475 {
7476 int id;
7477
7478 if (codec->core.vendor_id == 0x10ec0298)
7479 id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7480 else
7481 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7482 __snd_hda_apply_fixup(codec, id, action, 0);
7483 }
7484
7485 /* A special fixup for Lenovo Slim/Yoga Pro 9 14IRP8 and Yoga DuetITL 2021;
7486 * 14IRP8 PCI SSID will mistakenly be matched with the DuetITL codec SSID,
7487 * so we need to apply a different fixup in this case. The only DuetITL codec
7488 * SSID reported so far is the 17aa:3802 while the 14IRP8 has the 17aa:38be
7489 * and 17aa:38bf. If it weren't for the PCI SSID, the 14IRP8 models would
7490 * have matched correctly by their codecs.
7491 */
alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec * codec,const struct hda_fixup * fix,int action)7492 static void alc287_fixup_lenovo_14irp8_duetitl(struct hda_codec *codec,
7493 const struct hda_fixup *fix,
7494 int action)
7495 {
7496 int id;
7497
7498 if (codec->core.subsystem_id == 0x17aa3802)
7499 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */
7500 else
7501 id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */
7502 __snd_hda_apply_fixup(codec, id, action, 0);
7503 }
7504
7505 static const struct hda_fixup alc269_fixups[] = {
7506 [ALC269_FIXUP_GPIO2] = {
7507 .type = HDA_FIXUP_FUNC,
7508 .v.func = alc_fixup_gpio2,
7509 },
7510 [ALC269_FIXUP_SONY_VAIO] = {
7511 .type = HDA_FIXUP_PINCTLS,
7512 .v.pins = (const struct hda_pintbl[]) {
7513 {0x19, PIN_VREFGRD},
7514 {}
7515 }
7516 },
7517 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7518 .type = HDA_FIXUP_FUNC,
7519 .v.func = alc275_fixup_gpio4_off,
7520 .chained = true,
7521 .chain_id = ALC269_FIXUP_SONY_VAIO
7522 },
7523 [ALC269_FIXUP_DELL_M101Z] = {
7524 .type = HDA_FIXUP_VERBS,
7525 .v.verbs = (const struct hda_verb[]) {
7526 /* Enables internal speaker */
7527 {0x20, AC_VERB_SET_COEF_INDEX, 13},
7528 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7529 {}
7530 }
7531 },
7532 [ALC269_FIXUP_SKU_IGNORE] = {
7533 .type = HDA_FIXUP_FUNC,
7534 .v.func = alc_fixup_sku_ignore,
7535 },
7536 [ALC269_FIXUP_ASUS_G73JW] = {
7537 .type = HDA_FIXUP_PINS,
7538 .v.pins = (const struct hda_pintbl[]) {
7539 { 0x17, 0x99130111 }, /* subwoofer */
7540 { }
7541 }
7542 },
7543 [ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7544 .type = HDA_FIXUP_PINS,
7545 .v.pins = (const struct hda_pintbl[]) {
7546 { 0x19, 0x03A11050 },
7547 { 0x1a, 0x03A11C30 },
7548 { 0x21, 0x03211420 },
7549 { }
7550 }
7551 },
7552 [ALC269_FIXUP_ASUS_N7601ZM] = {
7553 .type = HDA_FIXUP_VERBS,
7554 .v.verbs = (const struct hda_verb[]) {
7555 {0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7556 {0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7557 {0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7558 {0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7559 {0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7560 {0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7561 { }
7562 },
7563 .chained = true,
7564 .chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7565 },
7566 [ALC269_FIXUP_LENOVO_EAPD] = {
7567 .type = HDA_FIXUP_VERBS,
7568 .v.verbs = (const struct hda_verb[]) {
7569 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7570 {}
7571 }
7572 },
7573 [ALC275_FIXUP_SONY_HWEQ] = {
7574 .type = HDA_FIXUP_FUNC,
7575 .v.func = alc269_fixup_hweq,
7576 .chained = true,
7577 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7578 },
7579 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7580 .type = HDA_FIXUP_FUNC,
7581 .v.func = alc_fixup_disable_aamix,
7582 .chained = true,
7583 .chain_id = ALC269_FIXUP_SONY_VAIO
7584 },
7585 [ALC271_FIXUP_DMIC] = {
7586 .type = HDA_FIXUP_FUNC,
7587 .v.func = alc271_fixup_dmic,
7588 },
7589 [ALC269_FIXUP_PCM_44K] = {
7590 .type = HDA_FIXUP_FUNC,
7591 .v.func = alc269_fixup_pcm_44k,
7592 .chained = true,
7593 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7594 },
7595 [ALC269_FIXUP_STEREO_DMIC] = {
7596 .type = HDA_FIXUP_FUNC,
7597 .v.func = alc269_fixup_stereo_dmic,
7598 },
7599 [ALC269_FIXUP_HEADSET_MIC] = {
7600 .type = HDA_FIXUP_FUNC,
7601 .v.func = alc269_fixup_headset_mic,
7602 },
7603 [ALC269_FIXUP_QUANTA_MUTE] = {
7604 .type = HDA_FIXUP_FUNC,
7605 .v.func = alc269_fixup_quanta_mute,
7606 },
7607 [ALC269_FIXUP_LIFEBOOK] = {
7608 .type = HDA_FIXUP_PINS,
7609 .v.pins = (const struct hda_pintbl[]) {
7610 { 0x1a, 0x2101103f }, /* dock line-out */
7611 { 0x1b, 0x23a11040 }, /* dock mic-in */
7612 { }
7613 },
7614 .chained = true,
7615 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7616 },
7617 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7618 .type = HDA_FIXUP_PINS,
7619 .v.pins = (const struct hda_pintbl[]) {
7620 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7621 { }
7622 },
7623 },
7624 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7625 .type = HDA_FIXUP_PINS,
7626 .v.pins = (const struct hda_pintbl[]) {
7627 { 0x21, 0x0221102f }, /* HP out */
7628 { }
7629 },
7630 },
7631 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7632 .type = HDA_FIXUP_FUNC,
7633 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7634 },
7635 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7636 .type = HDA_FIXUP_FUNC,
7637 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7638 },
7639 [ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
7640 .type = HDA_FIXUP_PINS,
7641 .v.pins = (const struct hda_pintbl[]) {
7642 { 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
7643 { 0x1b, 0x90170152 }, /* use as internal speaker (back) */
7644 { }
7645 },
7646 .chained = true,
7647 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7648 },
7649 [ALC269VC_FIXUP_INFINIX_Y4_MAX] = {
7650 .type = HDA_FIXUP_PINS,
7651 .v.pins = (const struct hda_pintbl[]) {
7652 { 0x1b, 0x90170150 }, /* use as internal speaker */
7653 { }
7654 },
7655 .chained = true,
7656 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7657 },
7658 [ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7659 .type = HDA_FIXUP_PINS,
7660 .v.pins = (const struct hda_pintbl[]) {
7661 { 0x18, 0x03a19020 }, /* headset mic */
7662 { 0x1b, 0x90170150 }, /* speaker */
7663 { }
7664 },
7665 },
7666 [ALC269_FIXUP_AMIC] = {
7667 .type = HDA_FIXUP_PINS,
7668 .v.pins = (const struct hda_pintbl[]) {
7669 { 0x14, 0x99130110 }, /* speaker */
7670 { 0x15, 0x0121401f }, /* HP out */
7671 { 0x18, 0x01a19c20 }, /* mic */
7672 { 0x19, 0x99a3092f }, /* int-mic */
7673 { }
7674 },
7675 },
7676 [ALC269_FIXUP_DMIC] = {
7677 .type = HDA_FIXUP_PINS,
7678 .v.pins = (const struct hda_pintbl[]) {
7679 { 0x12, 0x99a3092f }, /* int-mic */
7680 { 0x14, 0x99130110 }, /* speaker */
7681 { 0x15, 0x0121401f }, /* HP out */
7682 { 0x18, 0x01a19c20 }, /* mic */
7683 { }
7684 },
7685 },
7686 [ALC269VB_FIXUP_AMIC] = {
7687 .type = HDA_FIXUP_PINS,
7688 .v.pins = (const struct hda_pintbl[]) {
7689 { 0x14, 0x99130110 }, /* speaker */
7690 { 0x18, 0x01a19c20 }, /* mic */
7691 { 0x19, 0x99a3092f }, /* int-mic */
7692 { 0x21, 0x0121401f }, /* HP out */
7693 { }
7694 },
7695 },
7696 [ALC269VB_FIXUP_DMIC] = {
7697 .type = HDA_FIXUP_PINS,
7698 .v.pins = (const struct hda_pintbl[]) {
7699 { 0x12, 0x99a3092f }, /* int-mic */
7700 { 0x14, 0x99130110 }, /* speaker */
7701 { 0x18, 0x01a19c20 }, /* mic */
7702 { 0x21, 0x0121401f }, /* HP out */
7703 { }
7704 },
7705 },
7706 [ALC269_FIXUP_HP_MUTE_LED] = {
7707 .type = HDA_FIXUP_FUNC,
7708 .v.func = alc269_fixup_hp_mute_led,
7709 },
7710 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7711 .type = HDA_FIXUP_FUNC,
7712 .v.func = alc269_fixup_hp_mute_led_mic1,
7713 },
7714 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7715 .type = HDA_FIXUP_FUNC,
7716 .v.func = alc269_fixup_hp_mute_led_mic2,
7717 },
7718 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7719 .type = HDA_FIXUP_FUNC,
7720 .v.func = alc269_fixup_hp_mute_led_mic3,
7721 .chained = true,
7722 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7723 },
7724 [ALC269_FIXUP_HP_GPIO_LED] = {
7725 .type = HDA_FIXUP_FUNC,
7726 .v.func = alc269_fixup_hp_gpio_led,
7727 },
7728 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7729 .type = HDA_FIXUP_FUNC,
7730 .v.func = alc269_fixup_hp_gpio_mic1_led,
7731 },
7732 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7733 .type = HDA_FIXUP_FUNC,
7734 .v.func = alc269_fixup_hp_line1_mic1_led,
7735 },
7736 [ALC269_FIXUP_INV_DMIC] = {
7737 .type = HDA_FIXUP_FUNC,
7738 .v.func = alc_fixup_inv_dmic,
7739 },
7740 [ALC269_FIXUP_NO_SHUTUP] = {
7741 .type = HDA_FIXUP_FUNC,
7742 .v.func = alc_fixup_no_shutup,
7743 },
7744 [ALC269_FIXUP_LENOVO_DOCK] = {
7745 .type = HDA_FIXUP_PINS,
7746 .v.pins = (const struct hda_pintbl[]) {
7747 { 0x19, 0x23a11040 }, /* dock mic */
7748 { 0x1b, 0x2121103f }, /* dock headphone */
7749 { }
7750 },
7751 .chained = true,
7752 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7753 },
7754 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7755 .type = HDA_FIXUP_FUNC,
7756 .v.func = alc269_fixup_limit_int_mic_boost,
7757 .chained = true,
7758 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7759 },
7760 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7761 .type = HDA_FIXUP_FUNC,
7762 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7763 .chained = true,
7764 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7765 },
7766 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7767 .type = HDA_FIXUP_PINS,
7768 .v.pins = (const struct hda_pintbl[]) {
7769 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7770 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7771 { }
7772 },
7773 .chained = true,
7774 .chain_id = ALC269_FIXUP_HEADSET_MODE
7775 },
7776 [ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
7777 .type = HDA_FIXUP_FUNC,
7778 .v.func = alc269_fixup_limit_int_mic_boost,
7779 .chained = true,
7780 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7781 },
7782 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7783 .type = HDA_FIXUP_PINS,
7784 .v.pins = (const struct hda_pintbl[]) {
7785 { 0x16, 0x21014020 }, /* dock line out */
7786 { 0x19, 0x21a19030 }, /* dock mic */
7787 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7788 { }
7789 },
7790 .chained = true,
7791 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7792 },
7793 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7794 .type = HDA_FIXUP_PINS,
7795 .v.pins = (const struct hda_pintbl[]) {
7796 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7797 { }
7798 },
7799 .chained = true,
7800 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7801 },
7802 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7803 .type = HDA_FIXUP_PINS,
7804 .v.pins = (const struct hda_pintbl[]) {
7805 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7806 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7807 { }
7808 },
7809 .chained = true,
7810 .chain_id = ALC269_FIXUP_HEADSET_MODE
7811 },
7812 [ALC269_FIXUP_HEADSET_MODE] = {
7813 .type = HDA_FIXUP_FUNC,
7814 .v.func = alc_fixup_headset_mode,
7815 .chained = true,
7816 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7817 },
7818 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7819 .type = HDA_FIXUP_FUNC,
7820 .v.func = alc_fixup_headset_mode_no_hp_mic,
7821 },
7822 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7823 .type = HDA_FIXUP_PINS,
7824 .v.pins = (const struct hda_pintbl[]) {
7825 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7826 { }
7827 },
7828 .chained = true,
7829 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7830 },
7831 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7832 .type = HDA_FIXUP_PINS,
7833 .v.pins = (const struct hda_pintbl[]) {
7834 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7835 { }
7836 },
7837 .chained = true,
7838 .chain_id = ALC269_FIXUP_HEADSET_MIC
7839 },
7840 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7841 .type = HDA_FIXUP_PINS,
7842 .v.pins = (const struct hda_pintbl[]) {
7843 {0x12, 0x90a60130},
7844 {0x13, 0x40000000},
7845 {0x14, 0x90170110},
7846 {0x18, 0x411111f0},
7847 {0x19, 0x04a11040},
7848 {0x1a, 0x411111f0},
7849 {0x1b, 0x90170112},
7850 {0x1d, 0x40759a05},
7851 {0x1e, 0x411111f0},
7852 {0x21, 0x04211020},
7853 { }
7854 },
7855 .chained = true,
7856 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7857 },
7858 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7859 .type = HDA_FIXUP_FUNC,
7860 .v.func = alc298_fixup_huawei_mbx_stereo,
7861 .chained = true,
7862 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7863 },
7864 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7865 .type = HDA_FIXUP_FUNC,
7866 .v.func = alc269_fixup_x101_headset_mic,
7867 },
7868 [ALC269_FIXUP_ASUS_X101_VERB] = {
7869 .type = HDA_FIXUP_VERBS,
7870 .v.verbs = (const struct hda_verb[]) {
7871 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7872 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7873 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7874 { }
7875 },
7876 .chained = true,
7877 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7878 },
7879 [ALC269_FIXUP_ASUS_X101] = {
7880 .type = HDA_FIXUP_PINS,
7881 .v.pins = (const struct hda_pintbl[]) {
7882 { 0x18, 0x04a1182c }, /* Headset mic */
7883 { }
7884 },
7885 .chained = true,
7886 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7887 },
7888 [ALC271_FIXUP_AMIC_MIC2] = {
7889 .type = HDA_FIXUP_PINS,
7890 .v.pins = (const struct hda_pintbl[]) {
7891 { 0x14, 0x99130110 }, /* speaker */
7892 { 0x19, 0x01a19c20 }, /* mic */
7893 { 0x1b, 0x99a7012f }, /* int-mic */
7894 { 0x21, 0x0121401f }, /* HP out */
7895 { }
7896 },
7897 },
7898 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7899 .type = HDA_FIXUP_FUNC,
7900 .v.func = alc271_hp_gate_mic_jack,
7901 .chained = true,
7902 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7903 },
7904 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7905 .type = HDA_FIXUP_FUNC,
7906 .v.func = alc269_fixup_limit_int_mic_boost,
7907 .chained = true,
7908 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7909 },
7910 [ALC269_FIXUP_ACER_AC700] = {
7911 .type = HDA_FIXUP_PINS,
7912 .v.pins = (const struct hda_pintbl[]) {
7913 { 0x12, 0x99a3092f }, /* int-mic */
7914 { 0x14, 0x99130110 }, /* speaker */
7915 { 0x18, 0x03a11c20 }, /* mic */
7916 { 0x1e, 0x0346101e }, /* SPDIF1 */
7917 { 0x21, 0x0321101f }, /* HP out */
7918 { }
7919 },
7920 .chained = true,
7921 .chain_id = ALC271_FIXUP_DMIC,
7922 },
7923 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7924 .type = HDA_FIXUP_FUNC,
7925 .v.func = alc269_fixup_limit_int_mic_boost,
7926 .chained = true,
7927 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7928 },
7929 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7930 .type = HDA_FIXUP_FUNC,
7931 .v.func = alc269_fixup_limit_int_mic_boost,
7932 .chained = true,
7933 .chain_id = ALC269VB_FIXUP_DMIC,
7934 },
7935 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7936 .type = HDA_FIXUP_VERBS,
7937 .v.verbs = (const struct hda_verb[]) {
7938 /* class-D output amp +5dB */
7939 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7940 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7941 {}
7942 },
7943 .chained = true,
7944 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7945 },
7946 [ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7947 .type = HDA_FIXUP_PINS,
7948 .v.pins = (const struct hda_pintbl[]) {
7949 { 0x18, 0x01a110f0 }, /* use as headset mic */
7950 { }
7951 },
7952 .chained = true,
7953 .chain_id = ALC269_FIXUP_HEADSET_MIC
7954 },
7955 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7956 .type = HDA_FIXUP_FUNC,
7957 .v.func = alc269_fixup_limit_int_mic_boost,
7958 .chained = true,
7959 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7960 },
7961 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7962 .type = HDA_FIXUP_PINS,
7963 .v.pins = (const struct hda_pintbl[]) {
7964 { 0x12, 0x99a3092f }, /* int-mic */
7965 { 0x18, 0x03a11d20 }, /* mic */
7966 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7967 { }
7968 },
7969 },
7970 [ALC283_FIXUP_CHROME_BOOK] = {
7971 .type = HDA_FIXUP_FUNC,
7972 .v.func = alc283_fixup_chromebook,
7973 },
7974 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7975 .type = HDA_FIXUP_FUNC,
7976 .v.func = alc283_fixup_sense_combo_jack,
7977 .chained = true,
7978 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7979 },
7980 [ALC282_FIXUP_ASUS_TX300] = {
7981 .type = HDA_FIXUP_FUNC,
7982 .v.func = alc282_fixup_asus_tx300,
7983 },
7984 [ALC283_FIXUP_INT_MIC] = {
7985 .type = HDA_FIXUP_VERBS,
7986 .v.verbs = (const struct hda_verb[]) {
7987 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7988 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7989 { }
7990 },
7991 .chained = true,
7992 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7993 },
7994 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7995 .type = HDA_FIXUP_PINS,
7996 .v.pins = (const struct hda_pintbl[]) {
7997 { 0x17, 0x90170112 }, /* subwoofer */
7998 { }
7999 },
8000 .chained = true,
8001 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8002 },
8003 [ALC290_FIXUP_SUBWOOFER] = {
8004 .type = HDA_FIXUP_PINS,
8005 .v.pins = (const struct hda_pintbl[]) {
8006 { 0x17, 0x90170112 }, /* subwoofer */
8007 { }
8008 },
8009 .chained = true,
8010 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8011 },
8012 [ALC290_FIXUP_MONO_SPEAKERS] = {
8013 .type = HDA_FIXUP_FUNC,
8014 .v.func = alc290_fixup_mono_speakers,
8015 },
8016 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8017 .type = HDA_FIXUP_FUNC,
8018 .v.func = alc290_fixup_mono_speakers,
8019 .chained = true,
8020 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8021 },
8022 [ALC269_FIXUP_THINKPAD_ACPI] = {
8023 .type = HDA_FIXUP_FUNC,
8024 .v.func = alc_fixup_thinkpad_acpi,
8025 .chained = true,
8026 .chain_id = ALC269_FIXUP_SKU_IGNORE,
8027 },
8028 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8029 .type = HDA_FIXUP_FUNC,
8030 .v.func = alc_fixup_inv_dmic,
8031 .chained = true,
8032 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8033 },
8034 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8035 .type = HDA_FIXUP_PINS,
8036 .v.pins = (const struct hda_pintbl[]) {
8037 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8038 { }
8039 },
8040 .chained = true,
8041 .chain_id = ALC255_FIXUP_HEADSET_MODE
8042 },
8043 [ALC255_FIXUP_ASUS_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
8051 },
8052 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8053 .type = HDA_FIXUP_PINS,
8054 .v.pins = (const struct hda_pintbl[]) {
8055 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8056 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8057 { }
8058 },
8059 .chained = true,
8060 .chain_id = ALC255_FIXUP_HEADSET_MODE
8061 },
8062 [ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8063 .type = HDA_FIXUP_FUNC,
8064 .v.func = alc269_fixup_limit_int_mic_boost,
8065 .chained = true,
8066 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8067 },
8068 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8069 .type = HDA_FIXUP_PINS,
8070 .v.pins = (const struct hda_pintbl[]) {
8071 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8072 { }
8073 },
8074 .chained = true,
8075 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8076 },
8077 [ALC255_FIXUP_HEADSET_MODE] = {
8078 .type = HDA_FIXUP_FUNC,
8079 .v.func = alc_fixup_headset_mode_alc255,
8080 .chained = true,
8081 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8082 },
8083 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8084 .type = HDA_FIXUP_FUNC,
8085 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8086 },
8087 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8088 .type = HDA_FIXUP_PINS,
8089 .v.pins = (const struct hda_pintbl[]) {
8090 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8091 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8092 { }
8093 },
8094 .chained = true,
8095 .chain_id = ALC269_FIXUP_HEADSET_MODE
8096 },
8097 [ALC292_FIXUP_TPT440_DOCK] = {
8098 .type = HDA_FIXUP_FUNC,
8099 .v.func = alc_fixup_tpt440_dock,
8100 .chained = true,
8101 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8102 },
8103 [ALC292_FIXUP_TPT440] = {
8104 .type = HDA_FIXUP_FUNC,
8105 .v.func = alc_fixup_disable_aamix,
8106 .chained = true,
8107 .chain_id = ALC292_FIXUP_TPT440_DOCK,
8108 },
8109 [ALC283_FIXUP_HEADSET_MIC] = {
8110 .type = HDA_FIXUP_PINS,
8111 .v.pins = (const struct hda_pintbl[]) {
8112 { 0x19, 0x04a110f0 },
8113 { },
8114 },
8115 },
8116 [ALC255_FIXUP_MIC_MUTE_LED] = {
8117 .type = HDA_FIXUP_FUNC,
8118 .v.func = alc_fixup_micmute_led,
8119 },
8120 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
8121 .type = HDA_FIXUP_PINS,
8122 .v.pins = (const struct hda_pintbl[]) {
8123 { 0x12, 0x90a60130 },
8124 { 0x14, 0x90170110 },
8125 { 0x17, 0x40000008 },
8126 { 0x18, 0x411111f0 },
8127 { 0x19, 0x01a1913c },
8128 { 0x1a, 0x411111f0 },
8129 { 0x1b, 0x411111f0 },
8130 { 0x1d, 0x40f89b2d },
8131 { 0x1e, 0x411111f0 },
8132 { 0x21, 0x0321101f },
8133 { },
8134 },
8135 },
8136 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8137 .type = HDA_FIXUP_FUNC,
8138 .v.func = alc269vb_fixup_aspire_e1_coef,
8139 },
8140 [ALC280_FIXUP_HP_GPIO4] = {
8141 .type = HDA_FIXUP_FUNC,
8142 .v.func = alc280_fixup_hp_gpio4,
8143 },
8144 [ALC286_FIXUP_HP_GPIO_LED] = {
8145 .type = HDA_FIXUP_FUNC,
8146 .v.func = alc286_fixup_hp_gpio_led,
8147 },
8148 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8149 .type = HDA_FIXUP_FUNC,
8150 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8151 },
8152 [ALC280_FIXUP_HP_DOCK_PINS] = {
8153 .type = HDA_FIXUP_PINS,
8154 .v.pins = (const struct hda_pintbl[]) {
8155 { 0x1b, 0x21011020 }, /* line-out */
8156 { 0x1a, 0x01a1903c }, /* headset mic */
8157 { 0x18, 0x2181103f }, /* line-in */
8158 { },
8159 },
8160 .chained = true,
8161 .chain_id = ALC280_FIXUP_HP_GPIO4
8162 },
8163 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8164 .type = HDA_FIXUP_PINS,
8165 .v.pins = (const struct hda_pintbl[]) {
8166 { 0x1b, 0x21011020 }, /* line-out */
8167 { 0x18, 0x2181103f }, /* line-in */
8168 { },
8169 },
8170 .chained = true,
8171 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8172 },
8173 [ALC280_FIXUP_HP_9480M] = {
8174 .type = HDA_FIXUP_FUNC,
8175 .v.func = alc280_fixup_hp_9480m,
8176 },
8177 [ALC245_FIXUP_HP_X360_AMP] = {
8178 .type = HDA_FIXUP_FUNC,
8179 .v.func = alc245_fixup_hp_x360_amp,
8180 .chained = true,
8181 .chain_id = ALC245_FIXUP_HP_GPIO_LED
8182 },
8183 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
8184 .type = HDA_FIXUP_FUNC,
8185 .v.func = alc_fixup_headset_mode_dell_alc288,
8186 .chained = true,
8187 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8188 },
8189 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8190 .type = HDA_FIXUP_PINS,
8191 .v.pins = (const struct hda_pintbl[]) {
8192 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8193 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8194 { }
8195 },
8196 .chained = true,
8197 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8198 },
8199 [ALC288_FIXUP_DISABLE_AAMIX] = {
8200 .type = HDA_FIXUP_FUNC,
8201 .v.func = alc_fixup_disable_aamix,
8202 .chained = true,
8203 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8204 },
8205 [ALC288_FIXUP_DELL_XPS_13] = {
8206 .type = HDA_FIXUP_FUNC,
8207 .v.func = alc_fixup_dell_xps13,
8208 .chained = true,
8209 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
8210 },
8211 [ALC292_FIXUP_DISABLE_AAMIX] = {
8212 .type = HDA_FIXUP_FUNC,
8213 .v.func = alc_fixup_disable_aamix,
8214 .chained = true,
8215 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8216 },
8217 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8218 .type = HDA_FIXUP_FUNC,
8219 .v.func = alc_fixup_disable_aamix,
8220 .chained = true,
8221 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8222 },
8223 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8224 .type = HDA_FIXUP_FUNC,
8225 .v.func = alc_fixup_dell_xps13,
8226 .chained = true,
8227 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
8228 },
8229 [ALC292_FIXUP_DELL_E7X] = {
8230 .type = HDA_FIXUP_FUNC,
8231 .v.func = alc_fixup_micmute_led,
8232 /* micmute fixup must be applied at last */
8233 .chained_before = true,
8234 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8235 },
8236 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8237 .type = HDA_FIXUP_PINS,
8238 .v.pins = (const struct hda_pintbl[]) {
8239 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8240 { }
8241 },
8242 .chained_before = true,
8243 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8244 },
8245 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8246 .type = HDA_FIXUP_PINS,
8247 .v.pins = (const struct hda_pintbl[]) {
8248 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8249 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8250 { }
8251 },
8252 .chained = true,
8253 .chain_id = ALC269_FIXUP_HEADSET_MODE
8254 },
8255 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8256 .type = HDA_FIXUP_PINS,
8257 .v.pins = (const struct hda_pintbl[]) {
8258 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8259 { }
8260 },
8261 .chained = true,
8262 .chain_id = ALC269_FIXUP_HEADSET_MODE
8263 },
8264 [ALC275_FIXUP_DELL_XPS] = {
8265 .type = HDA_FIXUP_VERBS,
8266 .v.verbs = (const struct hda_verb[]) {
8267 /* Enables internal speaker */
8268 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8269 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8270 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8271 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8272 {}
8273 }
8274 },
8275 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8276 .type = HDA_FIXUP_FUNC,
8277 .v.func = alc_fixup_disable_aamix,
8278 .chained = true,
8279 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8280 },
8281 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8282 .type = HDA_FIXUP_FUNC,
8283 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8284 },
8285 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8286 .type = HDA_FIXUP_FUNC,
8287 .v.func = alc_fixup_inv_dmic,
8288 .chained = true,
8289 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8290 },
8291 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8292 .type = HDA_FIXUP_FUNC,
8293 .v.func = alc269_fixup_limit_int_mic_boost
8294 },
8295 [ALC255_FIXUP_DELL_SPK_NOISE] = {
8296 .type = HDA_FIXUP_FUNC,
8297 .v.func = alc_fixup_disable_aamix,
8298 .chained = true,
8299 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8300 },
8301 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
8302 .type = HDA_FIXUP_FUNC,
8303 .v.func = alc_fixup_disable_mic_vref,
8304 .chained = true,
8305 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8306 },
8307 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8308 .type = HDA_FIXUP_VERBS,
8309 .v.verbs = (const struct hda_verb[]) {
8310 /* Disable pass-through path for FRONT 14h */
8311 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8312 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8313 {}
8314 },
8315 .chained = true,
8316 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8317 },
8318 [ALC280_FIXUP_HP_HEADSET_MIC] = {
8319 .type = HDA_FIXUP_FUNC,
8320 .v.func = alc_fixup_disable_aamix,
8321 .chained = true,
8322 .chain_id = ALC269_FIXUP_HEADSET_MIC,
8323 },
8324 [ALC221_FIXUP_HP_FRONT_MIC] = {
8325 .type = HDA_FIXUP_PINS,
8326 .v.pins = (const struct hda_pintbl[]) {
8327 { 0x19, 0x02a19020 }, /* Front Mic */
8328 { }
8329 },
8330 },
8331 [ALC292_FIXUP_TPT460] = {
8332 .type = HDA_FIXUP_FUNC,
8333 .v.func = alc_fixup_tpt440_dock,
8334 .chained = true,
8335 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8336 },
8337 [ALC298_FIXUP_SPK_VOLUME] = {
8338 .type = HDA_FIXUP_FUNC,
8339 .v.func = alc298_fixup_speaker_volume,
8340 .chained = true,
8341 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8342 },
8343 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8344 .type = HDA_FIXUP_FUNC,
8345 .v.func = alc298_fixup_speaker_volume,
8346 },
8347 [ALC295_FIXUP_DISABLE_DAC3] = {
8348 .type = HDA_FIXUP_FUNC,
8349 .v.func = alc295_fixup_disable_dac3,
8350 },
8351 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8352 .type = HDA_FIXUP_FUNC,
8353 .v.func = alc285_fixup_speaker2_to_dac1,
8354 .chained = true,
8355 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8356 },
8357 [ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8358 .type = HDA_FIXUP_FUNC,
8359 .v.func = alc285_fixup_speaker2_to_dac1,
8360 .chained = true,
8361 .chain_id = ALC245_FIXUP_CS35L41_SPI_2
8362 },
8363 [ALC285_FIXUP_ASUS_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_SPEAKER2_TO_DAC1
8372 },
8373 [ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8374 .type = HDA_FIXUP_PINS,
8375 .v.pins = (const struct hda_pintbl[]) {
8376 { 0x14, 0x90170120 },
8377 { }
8378 },
8379 .chained = true,
8380 .chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8381 },
8382 [ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8383 .type = HDA_FIXUP_FUNC,
8384 .v.func = alc285_fixup_speaker2_to_dac1,
8385 .chained = true,
8386 .chain_id = ALC287_FIXUP_CS35L41_I2C_2
8387 },
8388 [ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8389 .type = HDA_FIXUP_PINS,
8390 .v.pins = (const struct hda_pintbl[]) {
8391 { 0x19, 0x03a11050 },
8392 { 0x1b, 0x03a11c30 },
8393 { }
8394 },
8395 .chained = true,
8396 .chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8397 },
8398 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8399 .type = HDA_FIXUP_PINS,
8400 .v.pins = (const struct hda_pintbl[]) {
8401 { 0x1b, 0x90170151 },
8402 { }
8403 },
8404 .chained = true,
8405 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8406 },
8407 [ALC269_FIXUP_ATIV_BOOK_8] = {
8408 .type = HDA_FIXUP_FUNC,
8409 .v.func = alc_fixup_auto_mute_via_amp,
8410 .chained = true,
8411 .chain_id = ALC269_FIXUP_NO_SHUTUP
8412 },
8413 [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8414 .type = HDA_FIXUP_PINS,
8415 .v.pins = (const struct hda_pintbl[]) {
8416 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8417 { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8418 { }
8419 },
8420 .chained = true,
8421 .chain_id = ALC269_FIXUP_HEADSET_MODE
8422 },
8423 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8424 .type = HDA_FIXUP_PINS,
8425 .v.pins = (const struct hda_pintbl[]) {
8426 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8427 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8428 { }
8429 },
8430 .chained = true,
8431 .chain_id = ALC269_FIXUP_HEADSET_MODE
8432 },
8433 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8434 .type = HDA_FIXUP_FUNC,
8435 .v.func = alc_fixup_headset_mode,
8436 },
8437 [ALC256_FIXUP_ASUS_MIC] = {
8438 .type = HDA_FIXUP_PINS,
8439 .v.pins = (const struct hda_pintbl[]) {
8440 { 0x13, 0x90a60160 }, /* use as internal mic */
8441 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8442 { }
8443 },
8444 .chained = true,
8445 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8446 },
8447 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8448 .type = HDA_FIXUP_FUNC,
8449 /* Set up GPIO2 for the speaker amp */
8450 .v.func = alc_fixup_gpio4,
8451 },
8452 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8453 .type = HDA_FIXUP_PINS,
8454 .v.pins = (const struct hda_pintbl[]) {
8455 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8456 { }
8457 },
8458 .chained = true,
8459 .chain_id = ALC269_FIXUP_HEADSET_MIC
8460 },
8461 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8462 .type = HDA_FIXUP_VERBS,
8463 .v.verbs = (const struct hda_verb[]) {
8464 /* Enables internal speaker */
8465 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8466 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8467 {}
8468 },
8469 .chained = true,
8470 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8471 },
8472 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8473 .type = HDA_FIXUP_FUNC,
8474 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8475 .chained = true,
8476 .chain_id = ALC269_FIXUP_GPIO2
8477 },
8478 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
8479 .type = HDA_FIXUP_VERBS,
8480 .v.verbs = (const struct hda_verb[]) {
8481 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8482 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8483 { }
8484 },
8485 .chained = true,
8486 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8487 },
8488 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8489 .type = HDA_FIXUP_PINS,
8490 .v.pins = (const struct hda_pintbl[]) {
8491 /* Change the mic location from front to right, otherwise there are
8492 two front mics with the same name, pulseaudio can't handle them.
8493 This is just a temporary workaround, after applying this fixup,
8494 there will be one "Front Mic" and one "Mic" in this machine.
8495 */
8496 { 0x1a, 0x04a19040 },
8497 { }
8498 },
8499 },
8500 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8501 .type = HDA_FIXUP_PINS,
8502 .v.pins = (const struct hda_pintbl[]) {
8503 { 0x16, 0x0101102f }, /* Rear Headset HP */
8504 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8505 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8506 { 0x1b, 0x02011020 },
8507 { }
8508 },
8509 .chained = true,
8510 .chain_id = ALC225_FIXUP_S3_POP_NOISE
8511 },
8512 [ALC225_FIXUP_S3_POP_NOISE] = {
8513 .type = HDA_FIXUP_FUNC,
8514 .v.func = alc225_fixup_s3_pop_noise,
8515 .chained = true,
8516 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8517 },
8518 [ALC700_FIXUP_INTEL_REFERENCE] = {
8519 .type = HDA_FIXUP_VERBS,
8520 .v.verbs = (const struct hda_verb[]) {
8521 /* Enables internal speaker */
8522 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8523 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8524 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8525 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8526 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8527 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8528 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8529 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8530 {}
8531 }
8532 },
8533 [ALC274_FIXUP_DELL_BIND_DACS] = {
8534 .type = HDA_FIXUP_FUNC,
8535 .v.func = alc274_fixup_bind_dacs,
8536 .chained = true,
8537 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8538 },
8539 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8540 .type = HDA_FIXUP_PINS,
8541 .v.pins = (const struct hda_pintbl[]) {
8542 { 0x1b, 0x0401102f },
8543 { }
8544 },
8545 .chained = true,
8546 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
8547 },
8548 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
8549 .type = HDA_FIXUP_FUNC,
8550 .v.func = alc_fixup_tpt470_dock,
8551 .chained = true,
8552 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8553 },
8554 [ALC298_FIXUP_TPT470_DOCK] = {
8555 .type = HDA_FIXUP_FUNC,
8556 .v.func = alc_fixup_tpt470_dacs,
8557 .chained = true,
8558 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8559 },
8560 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8561 .type = HDA_FIXUP_PINS,
8562 .v.pins = (const struct hda_pintbl[]) {
8563 { 0x14, 0x0201101f },
8564 { }
8565 },
8566 .chained = true,
8567 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8568 },
8569 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
8570 .type = HDA_FIXUP_PINS,
8571 .v.pins = (const struct hda_pintbl[]) {
8572 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8573 { }
8574 },
8575 .chained = true,
8576 .chain_id = ALC269_FIXUP_HEADSET_MIC
8577 },
8578 [ALC295_FIXUP_HP_X360] = {
8579 .type = HDA_FIXUP_FUNC,
8580 .v.func = alc295_fixup_hp_top_speakers,
8581 .chained = true,
8582 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8583 },
8584 [ALC221_FIXUP_HP_HEADSET_MIC] = {
8585 .type = HDA_FIXUP_PINS,
8586 .v.pins = (const struct hda_pintbl[]) {
8587 { 0x19, 0x0181313f},
8588 { }
8589 },
8590 .chained = true,
8591 .chain_id = ALC269_FIXUP_HEADSET_MIC
8592 },
8593 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8594 .type = HDA_FIXUP_FUNC,
8595 .v.func = alc285_fixup_invalidate_dacs,
8596 .chained = true,
8597 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8598 },
8599 [ALC295_FIXUP_HP_AUTO_MUTE] = {
8600 .type = HDA_FIXUP_FUNC,
8601 .v.func = alc_fixup_auto_mute_via_amp,
8602 },
8603 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8604 .type = HDA_FIXUP_PINS,
8605 .v.pins = (const struct hda_pintbl[]) {
8606 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8607 { }
8608 },
8609 .chained = true,
8610 .chain_id = ALC269_FIXUP_HEADSET_MIC
8611 },
8612 [ALC294_FIXUP_ASUS_MIC] = {
8613 .type = HDA_FIXUP_PINS,
8614 .v.pins = (const struct hda_pintbl[]) {
8615 { 0x13, 0x90a60160 }, /* use as internal mic */
8616 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8617 { }
8618 },
8619 .chained = true,
8620 .chain_id = ALC269_FIXUP_HEADSET_MIC
8621 },
8622 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8623 .type = HDA_FIXUP_PINS,
8624 .v.pins = (const struct hda_pintbl[]) {
8625 { 0x19, 0x01a1103c }, /* use as headset mic */
8626 { }
8627 },
8628 .chained = true,
8629 .chain_id = ALC269_FIXUP_HEADSET_MIC
8630 },
8631 [ALC294_FIXUP_ASUS_SPK] = {
8632 .type = HDA_FIXUP_VERBS,
8633 .v.verbs = (const struct hda_verb[]) {
8634 /* Set EAPD high */
8635 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8636 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8637 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8638 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8639 { }
8640 },
8641 .chained = true,
8642 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8643 },
8644 [ALC295_FIXUP_CHROME_BOOK] = {
8645 .type = HDA_FIXUP_FUNC,
8646 .v.func = alc295_fixup_chromebook,
8647 .chained = true,
8648 .chain_id = ALC225_FIXUP_HEADSET_JACK
8649 },
8650 [ALC225_FIXUP_HEADSET_JACK] = {
8651 .type = HDA_FIXUP_FUNC,
8652 .v.func = alc_fixup_headset_jack,
8653 },
8654 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8655 .type = HDA_FIXUP_PINS,
8656 .v.pins = (const struct hda_pintbl[]) {
8657 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8658 { }
8659 },
8660 .chained = true,
8661 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8662 },
8663 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8664 .type = HDA_FIXUP_VERBS,
8665 .v.verbs = (const struct hda_verb[]) {
8666 /* Disable PCBEEP-IN passthrough */
8667 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8668 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8669 { }
8670 },
8671 .chained = true,
8672 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8673 },
8674 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8675 .type = HDA_FIXUP_PINS,
8676 .v.pins = (const struct hda_pintbl[]) {
8677 { 0x19, 0x03a11130 },
8678 { 0x1a, 0x90a60140 }, /* use as internal mic */
8679 { }
8680 },
8681 .chained = true,
8682 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8683 },
8684 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8685 .type = HDA_FIXUP_PINS,
8686 .v.pins = (const struct hda_pintbl[]) {
8687 { 0x16, 0x01011020 }, /* Rear Line out */
8688 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8689 { }
8690 },
8691 .chained = true,
8692 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8693 },
8694 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8695 .type = HDA_FIXUP_FUNC,
8696 .v.func = alc_fixup_auto_mute_via_amp,
8697 .chained = true,
8698 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8699 },
8700 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8701 .type = HDA_FIXUP_FUNC,
8702 .v.func = alc_fixup_disable_mic_vref,
8703 .chained = true,
8704 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8705 },
8706 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8707 .type = HDA_FIXUP_VERBS,
8708 .v.verbs = (const struct hda_verb[]) {
8709 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8710 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8711 { }
8712 },
8713 .chained = true,
8714 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8715 },
8716 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8717 .type = HDA_FIXUP_PINS,
8718 .v.pins = (const struct hda_pintbl[]) {
8719 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8720 { }
8721 },
8722 .chained = true,
8723 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8724 },
8725 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8726 .type = HDA_FIXUP_PINS,
8727 .v.pins = (const struct hda_pintbl[]) {
8728 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8729 { }
8730 },
8731 .chained = true,
8732 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8733 },
8734 [ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
8735 .type = HDA_FIXUP_PINS,
8736 .v.pins = (const struct hda_pintbl[]) {
8737 { 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
8738 { 0x1b, 0x90170152 } /* use as internal speaker (back) */
8739 }
8740 },
8741 [ALC299_FIXUP_PREDATOR_SPK] = {
8742 .type = HDA_FIXUP_PINS,
8743 .v.pins = (const struct hda_pintbl[]) {
8744 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8745 { }
8746 }
8747 },
8748 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8749 .type = HDA_FIXUP_PINS,
8750 .v.pins = (const struct hda_pintbl[]) {
8751 { 0x19, 0x04a11040 },
8752 { 0x21, 0x04211020 },
8753 { }
8754 },
8755 .chained = true,
8756 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8757 },
8758 [ALC289_FIXUP_DELL_SPK1] = {
8759 .type = HDA_FIXUP_PINS,
8760 .v.pins = (const struct hda_pintbl[]) {
8761 { 0x14, 0x90170140 },
8762 { }
8763 },
8764 .chained = true,
8765 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8766 },
8767 [ALC289_FIXUP_DELL_SPK2] = {
8768 .type = HDA_FIXUP_PINS,
8769 .v.pins = (const struct hda_pintbl[]) {
8770 { 0x17, 0x90170130 }, /* bass spk */
8771 { }
8772 },
8773 .chained = true,
8774 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8775 },
8776 [ALC289_FIXUP_DUAL_SPK] = {
8777 .type = HDA_FIXUP_FUNC,
8778 .v.func = alc285_fixup_speaker2_to_dac1,
8779 .chained = true,
8780 .chain_id = ALC289_FIXUP_DELL_SPK2
8781 },
8782 [ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8783 .type = HDA_FIXUP_FUNC,
8784 .v.func = alc285_fixup_speaker2_to_dac1,
8785 .chained = true,
8786 .chain_id = ALC289_FIXUP_DELL_SPK1
8787 },
8788 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8789 .type = HDA_FIXUP_FUNC,
8790 .v.func = alc285_fixup_speaker2_to_dac1,
8791 .chained = true,
8792 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8793 },
8794 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
8795 .type = HDA_FIXUP_FUNC,
8796 /* The GPIO must be pulled to initialize the AMP */
8797 .v.func = alc_fixup_gpio4,
8798 .chained = true,
8799 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8800 },
8801 [ALC294_FIXUP_ASUS_ALLY] = {
8802 .type = HDA_FIXUP_FUNC,
8803 .v.func = cs35l41_fixup_i2c_two,
8804 .chained = true,
8805 .chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8806 },
8807 [ALC294_FIXUP_ASUS_ALLY_PINS] = {
8808 .type = HDA_FIXUP_PINS,
8809 .v.pins = (const struct hda_pintbl[]) {
8810 { 0x19, 0x03a11050 },
8811 { 0x1a, 0x03a11c30 },
8812 { 0x21, 0x03211420 },
8813 { }
8814 },
8815 .chained = true,
8816 .chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8817 },
8818 [ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8819 .type = HDA_FIXUP_VERBS,
8820 .v.verbs = (const struct hda_verb[]) {
8821 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8822 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8823 { 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8824 { 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8825 { 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8826 { 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8827 { 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8828 { 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8829 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8830 { 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8831 { 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8832 { 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8833 { }
8834 },
8835 .chained = true,
8836 .chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8837 },
8838 [ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8839 .type = HDA_FIXUP_FUNC,
8840 .v.func = alc285_fixup_speaker2_to_dac1,
8841 },
8842 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8843 .type = HDA_FIXUP_FUNC,
8844 .v.func = alc285_fixup_thinkpad_x1_gen7,
8845 .chained = true,
8846 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8847 },
8848 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8849 .type = HDA_FIXUP_FUNC,
8850 .v.func = alc_fixup_headset_jack,
8851 .chained = true,
8852 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8853 },
8854 [ALC294_FIXUP_ASUS_HPE] = {
8855 .type = HDA_FIXUP_VERBS,
8856 .v.verbs = (const struct hda_verb[]) {
8857 /* Set EAPD high */
8858 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8859 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8860 { }
8861 },
8862 .chained = true,
8863 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8864 },
8865 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8866 .type = HDA_FIXUP_PINS,
8867 .v.pins = (const struct hda_pintbl[]) {
8868 { 0x19, 0x03a11050 }, /* front HP mic */
8869 { 0x1a, 0x01a11830 }, /* rear external mic */
8870 { 0x21, 0x03211020 }, /* front HP out */
8871 { }
8872 },
8873 .chained = true,
8874 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8875 },
8876 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8877 .type = HDA_FIXUP_VERBS,
8878 .v.verbs = (const struct hda_verb[]) {
8879 /* set 0x15 to HP-OUT ctrl */
8880 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8881 /* unmute the 0x15 amp */
8882 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8883 { }
8884 },
8885 .chained = true,
8886 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8887 },
8888 [ALC294_FIXUP_ASUS_GX502_HP] = {
8889 .type = HDA_FIXUP_FUNC,
8890 .v.func = alc294_fixup_gx502_hp,
8891 },
8892 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8893 .type = HDA_FIXUP_PINS,
8894 .v.pins = (const struct hda_pintbl[]) {
8895 { 0x19, 0x01a11050 }, /* rear HP mic */
8896 { 0x1a, 0x01a11830 }, /* rear external mic */
8897 { 0x21, 0x012110f0 }, /* rear HP out */
8898 { }
8899 },
8900 .chained = true,
8901 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8902 },
8903 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8904 .type = HDA_FIXUP_VERBS,
8905 .v.verbs = (const struct hda_verb[]) {
8906 /* set 0x15 to HP-OUT ctrl */
8907 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8908 /* unmute the 0x15 amp */
8909 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8910 /* set 0x1b to HP-OUT */
8911 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8912 { }
8913 },
8914 .chained = true,
8915 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8916 },
8917 [ALC294_FIXUP_ASUS_GU502_HP] = {
8918 .type = HDA_FIXUP_FUNC,
8919 .v.func = alc294_fixup_gu502_hp,
8920 },
8921 [ALC294_FIXUP_ASUS_G513_PINS] = {
8922 .type = HDA_FIXUP_PINS,
8923 .v.pins = (const struct hda_pintbl[]) {
8924 { 0x19, 0x03a11050 }, /* front HP mic */
8925 { 0x1a, 0x03a11c30 }, /* rear external mic */
8926 { 0x21, 0x03211420 }, /* front HP out */
8927 { }
8928 },
8929 },
8930 [ALC285_FIXUP_ASUS_G533Z_PINS] = {
8931 .type = HDA_FIXUP_PINS,
8932 .v.pins = (const struct hda_pintbl[]) {
8933 { 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8934 { 0x19, 0x03a19020 }, /* Mic Boost Volume */
8935 { 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8936 { 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8937 { 0x21, 0x03211420 },
8938 { }
8939 },
8940 },
8941 [ALC294_FIXUP_ASUS_COEF_1B] = {
8942 .type = HDA_FIXUP_VERBS,
8943 .v.verbs = (const struct hda_verb[]) {
8944 /* Set bit 10 to correct noisy output after reboot from
8945 * Windows 10 (due to pop noise reduction?)
8946 */
8947 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8948 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8949 { }
8950 },
8951 .chained = true,
8952 .chain_id = ALC289_FIXUP_ASUS_GA401,
8953 },
8954 [ALC285_FIXUP_HP_GPIO_LED] = {
8955 .type = HDA_FIXUP_FUNC,
8956 .v.func = alc285_fixup_hp_gpio_led,
8957 },
8958 [ALC285_FIXUP_HP_MUTE_LED] = {
8959 .type = HDA_FIXUP_FUNC,
8960 .v.func = alc285_fixup_hp_mute_led,
8961 },
8962 [ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8963 .type = HDA_FIXUP_FUNC,
8964 .v.func = alc285_fixup_hp_spectre_x360_mute_led,
8965 },
8966 [ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
8967 .type = HDA_FIXUP_FUNC,
8968 .v.func = alc236_fixup_hp_mute_led_coefbit2,
8969 },
8970 [ALC236_FIXUP_HP_GPIO_LED] = {
8971 .type = HDA_FIXUP_FUNC,
8972 .v.func = alc236_fixup_hp_gpio_led,
8973 },
8974 [ALC236_FIXUP_HP_MUTE_LED] = {
8975 .type = HDA_FIXUP_FUNC,
8976 .v.func = alc236_fixup_hp_mute_led,
8977 },
8978 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8979 .type = HDA_FIXUP_FUNC,
8980 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8981 },
8982 [ALC236_FIXUP_LENOVO_INV_DMIC] = {
8983 .type = HDA_FIXUP_FUNC,
8984 .v.func = alc_fixup_inv_dmic,
8985 .chained = true,
8986 .chain_id = ALC283_FIXUP_INT_MIC,
8987 },
8988 [ALC298_FIXUP_SAMSUNG_AMP] = {
8989 .type = HDA_FIXUP_FUNC,
8990 .v.func = alc298_fixup_samsung_amp,
8991 .chained = true,
8992 .chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8993 },
8994 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8995 .type = HDA_FIXUP_VERBS,
8996 .v.verbs = (const struct hda_verb[]) {
8997 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8998 { }
8999 },
9000 },
9001 [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9002 .type = HDA_FIXUP_VERBS,
9003 .v.verbs = (const struct hda_verb[]) {
9004 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9005 { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9006 { }
9007 },
9008 },
9009 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9010 .type = HDA_FIXUP_PINS,
9011 .v.pins = (const struct hda_pintbl[]) {
9012 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9013 { }
9014 },
9015 .chained = true,
9016 .chain_id = ALC269_FIXUP_HEADSET_MODE
9017 },
9018 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9019 .type = HDA_FIXUP_PINS,
9020 .v.pins = (const struct hda_pintbl[]) {
9021 { 0x14, 0x90100120 }, /* use as internal speaker */
9022 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9023 { 0x1a, 0x01011020 }, /* use as line out */
9024 { },
9025 },
9026 .chained = true,
9027 .chain_id = ALC269_FIXUP_HEADSET_MIC
9028 },
9029 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9030 .type = HDA_FIXUP_PINS,
9031 .v.pins = (const struct hda_pintbl[]) {
9032 { 0x18, 0x02a11030 }, /* use as headset mic */
9033 { }
9034 },
9035 .chained = true,
9036 .chain_id = ALC269_FIXUP_HEADSET_MIC
9037 },
9038 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9039 .type = HDA_FIXUP_PINS,
9040 .v.pins = (const struct hda_pintbl[]) {
9041 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9042 { }
9043 },
9044 .chained = true,
9045 .chain_id = ALC269_FIXUP_HEADSET_MIC
9046 },
9047 [ALC289_FIXUP_ASUS_GA401] = {
9048 .type = HDA_FIXUP_FUNC,
9049 .v.func = alc289_fixup_asus_ga401,
9050 .chained = true,
9051 .chain_id = ALC289_FIXUP_ASUS_GA502,
9052 },
9053 [ALC289_FIXUP_ASUS_GA502] = {
9054 .type = HDA_FIXUP_PINS,
9055 .v.pins = (const struct hda_pintbl[]) {
9056 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
9057 { }
9058 },
9059 },
9060 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9061 .type = HDA_FIXUP_PINS,
9062 .v.pins = (const struct hda_pintbl[]) {
9063 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9064 { }
9065 },
9066 .chained = true,
9067 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9068 },
9069 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9070 .type = HDA_FIXUP_FUNC,
9071 .v.func = alc285_fixup_hp_gpio_amp_init,
9072 .chained = true,
9073 .chain_id = ALC285_FIXUP_HP_GPIO_LED
9074 },
9075 [ALC269_FIXUP_CZC_B20] = {
9076 .type = HDA_FIXUP_PINS,
9077 .v.pins = (const struct hda_pintbl[]) {
9078 { 0x12, 0x411111f0 },
9079 { 0x14, 0x90170110 }, /* speaker */
9080 { 0x15, 0x032f1020 }, /* HP out */
9081 { 0x17, 0x411111f0 },
9082 { 0x18, 0x03ab1040 }, /* mic */
9083 { 0x19, 0xb7a7013f },
9084 { 0x1a, 0x0181305f },
9085 { 0x1b, 0x411111f0 },
9086 { 0x1d, 0x411111f0 },
9087 { 0x1e, 0x411111f0 },
9088 { }
9089 },
9090 .chain_id = ALC269_FIXUP_DMIC,
9091 },
9092 [ALC269_FIXUP_CZC_TMI] = {
9093 .type = HDA_FIXUP_PINS,
9094 .v.pins = (const struct hda_pintbl[]) {
9095 { 0x12, 0x4000c000 },
9096 { 0x14, 0x90170110 }, /* speaker */
9097 { 0x15, 0x0421401f }, /* HP out */
9098 { 0x17, 0x411111f0 },
9099 { 0x18, 0x04a19020 }, /* mic */
9100 { 0x19, 0x411111f0 },
9101 { 0x1a, 0x411111f0 },
9102 { 0x1b, 0x411111f0 },
9103 { 0x1d, 0x40448505 },
9104 { 0x1e, 0x411111f0 },
9105 { 0x20, 0x8000ffff },
9106 { }
9107 },
9108 .chain_id = ALC269_FIXUP_DMIC,
9109 },
9110 [ALC269_FIXUP_CZC_L101] = {
9111 .type = HDA_FIXUP_PINS,
9112 .v.pins = (const struct hda_pintbl[]) {
9113 { 0x12, 0x40000000 },
9114 { 0x14, 0x01014010 }, /* speaker */
9115 { 0x15, 0x411111f0 }, /* HP out */
9116 { 0x16, 0x411111f0 },
9117 { 0x18, 0x01a19020 }, /* mic */
9118 { 0x19, 0x02a19021 },
9119 { 0x1a, 0x0181302f },
9120 { 0x1b, 0x0221401f },
9121 { 0x1c, 0x411111f0 },
9122 { 0x1d, 0x4044c601 },
9123 { 0x1e, 0x411111f0 },
9124 { }
9125 },
9126 .chain_id = ALC269_FIXUP_DMIC,
9127 },
9128 [ALC269_FIXUP_LEMOTE_A1802] = {
9129 .type = HDA_FIXUP_PINS,
9130 .v.pins = (const struct hda_pintbl[]) {
9131 { 0x12, 0x40000000 },
9132 { 0x14, 0x90170110 }, /* speaker */
9133 { 0x17, 0x411111f0 },
9134 { 0x18, 0x03a19040 }, /* mic1 */
9135 { 0x19, 0x90a70130 }, /* mic2 */
9136 { 0x1a, 0x411111f0 },
9137 { 0x1b, 0x411111f0 },
9138 { 0x1d, 0x40489d2d },
9139 { 0x1e, 0x411111f0 },
9140 { 0x20, 0x0003ffff },
9141 { 0x21, 0x03214020 },
9142 { }
9143 },
9144 .chain_id = ALC269_FIXUP_DMIC,
9145 },
9146 [ALC269_FIXUP_LEMOTE_A190X] = {
9147 .type = HDA_FIXUP_PINS,
9148 .v.pins = (const struct hda_pintbl[]) {
9149 { 0x14, 0x99130110 }, /* speaker */
9150 { 0x15, 0x0121401f }, /* HP out */
9151 { 0x18, 0x01a19c20 }, /* rear mic */
9152 { 0x19, 0x99a3092f }, /* front mic */
9153 { 0x1b, 0x0201401f }, /* front lineout */
9154 { }
9155 },
9156 .chain_id = ALC269_FIXUP_DMIC,
9157 },
9158 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9159 .type = HDA_FIXUP_PINS,
9160 .v.pins = (const struct hda_pintbl[]) {
9161 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9162 { }
9163 },
9164 .chained = true,
9165 .chain_id = ALC269_FIXUP_HEADSET_MODE
9166 },
9167 [ALC256_FIXUP_INTEL_NUC10] = {
9168 .type = HDA_FIXUP_PINS,
9169 .v.pins = (const struct hda_pintbl[]) {
9170 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9171 { }
9172 },
9173 .chained = true,
9174 .chain_id = ALC269_FIXUP_HEADSET_MODE
9175 },
9176 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9177 .type = HDA_FIXUP_VERBS,
9178 .v.verbs = (const struct hda_verb[]) {
9179 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9180 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9181 { }
9182 },
9183 .chained = true,
9184 .chain_id = ALC289_FIXUP_ASUS_GA502
9185 },
9186 [ALC274_FIXUP_HP_MIC] = {
9187 .type = HDA_FIXUP_VERBS,
9188 .v.verbs = (const struct hda_verb[]) {
9189 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9190 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9191 { }
9192 },
9193 },
9194 [ALC274_FIXUP_HP_HEADSET_MIC] = {
9195 .type = HDA_FIXUP_FUNC,
9196 .v.func = alc274_fixup_hp_headset_mic,
9197 .chained = true,
9198 .chain_id = ALC274_FIXUP_HP_MIC
9199 },
9200 [ALC274_FIXUP_HP_ENVY_GPIO] = {
9201 .type = HDA_FIXUP_FUNC,
9202 .v.func = alc274_fixup_hp_envy_gpio,
9203 },
9204 [ALC256_FIXUP_ASUS_HPE] = {
9205 .type = HDA_FIXUP_VERBS,
9206 .v.verbs = (const struct hda_verb[]) {
9207 /* Set EAPD high */
9208 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9209 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9210 { }
9211 },
9212 .chained = true,
9213 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9214 },
9215 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9216 .type = HDA_FIXUP_FUNC,
9217 .v.func = alc_fixup_headset_jack,
9218 .chained = true,
9219 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
9220 },
9221 [ALC287_FIXUP_HP_GPIO_LED] = {
9222 .type = HDA_FIXUP_FUNC,
9223 .v.func = alc287_fixup_hp_gpio_led,
9224 },
9225 [ALC256_FIXUP_HP_HEADSET_MIC] = {
9226 .type = HDA_FIXUP_FUNC,
9227 .v.func = alc274_fixup_hp_headset_mic,
9228 },
9229 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9230 .type = HDA_FIXUP_FUNC,
9231 .v.func = alc_fixup_no_int_mic,
9232 .chained = true,
9233 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9234 },
9235 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9236 .type = HDA_FIXUP_PINS,
9237 .v.pins = (const struct hda_pintbl[]) {
9238 { 0x1b, 0x411111f0 },
9239 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9240 { },
9241 },
9242 .chained = true,
9243 .chain_id = ALC269_FIXUP_HEADSET_MODE
9244 },
9245 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9246 .type = HDA_FIXUP_FUNC,
9247 .v.func = alc269_fixup_limit_int_mic_boost,
9248 .chained = true,
9249 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9250 },
9251 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
9252 .type = HDA_FIXUP_PINS,
9253 .v.pins = (const struct hda_pintbl[]) {
9254 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9255 { 0x1a, 0x90a1092f }, /* use as internal mic */
9256 { }
9257 },
9258 .chained = true,
9259 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9260 },
9261 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9262 .type = HDA_FIXUP_FUNC,
9263 .v.func = alc285_fixup_ideapad_s740_coef,
9264 .chained = true,
9265 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9266 },
9267 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9268 .type = HDA_FIXUP_FUNC,
9269 .v.func = alc269_fixup_limit_int_mic_boost,
9270 .chained = true,
9271 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9272 },
9273 [ALC295_FIXUP_ASUS_DACS] = {
9274 .type = HDA_FIXUP_FUNC,
9275 .v.func = alc295_fixup_asus_dacs,
9276 },
9277 [ALC295_FIXUP_HP_OMEN] = {
9278 .type = HDA_FIXUP_PINS,
9279 .v.pins = (const struct hda_pintbl[]) {
9280 { 0x12, 0xb7a60130 },
9281 { 0x13, 0x40000000 },
9282 { 0x14, 0x411111f0 },
9283 { 0x16, 0x411111f0 },
9284 { 0x17, 0x90170110 },
9285 { 0x18, 0x411111f0 },
9286 { 0x19, 0x02a11030 },
9287 { 0x1a, 0x411111f0 },
9288 { 0x1b, 0x04a19030 },
9289 { 0x1d, 0x40600001 },
9290 { 0x1e, 0x411111f0 },
9291 { 0x21, 0x03211020 },
9292 {}
9293 },
9294 .chained = true,
9295 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9296 },
9297 [ALC285_FIXUP_HP_SPECTRE_X360] = {
9298 .type = HDA_FIXUP_FUNC,
9299 .v.func = alc285_fixup_hp_spectre_x360,
9300 },
9301 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9302 .type = HDA_FIXUP_FUNC,
9303 .v.func = alc285_fixup_hp_spectre_x360_eb1
9304 },
9305 [ALC285_FIXUP_HP_ENVY_X360] = {
9306 .type = HDA_FIXUP_FUNC,
9307 .v.func = alc285_fixup_hp_envy_x360,
9308 .chained = true,
9309 .chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9310 },
9311 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9312 .type = HDA_FIXUP_FUNC,
9313 .v.func = alc285_fixup_ideapad_s740_coef,
9314 .chained = true,
9315 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9316 },
9317 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9318 .type = HDA_FIXUP_FUNC,
9319 .v.func = alc_fixup_no_shutup,
9320 .chained = true,
9321 .chain_id = ALC283_FIXUP_HEADSET_MIC,
9322 },
9323 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9324 .type = HDA_FIXUP_PINS,
9325 .v.pins = (const struct hda_pintbl[]) {
9326 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9327 { }
9328 },
9329 .chained = true,
9330 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9331 },
9332 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9333 .type = HDA_FIXUP_FUNC,
9334 .v.func = alc269_fixup_limit_int_mic_boost,
9335 .chained = true,
9336 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9337 },
9338 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9339 .type = HDA_FIXUP_FUNC,
9340 .v.func = alc285_fixup_ideapad_s740_coef,
9341 .chained = true,
9342 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9343 },
9344 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9345 .type = HDA_FIXUP_FUNC,
9346 .v.func = alc287_fixup_legion_15imhg05_speakers,
9347 .chained = true,
9348 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9349 },
9350 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9351 .type = HDA_FIXUP_VERBS,
9352 //.v.verbs = legion_15imhg05_coefs,
9353 .v.verbs = (const struct hda_verb[]) {
9354 // set left speaker Legion 7i.
9355 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9356 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9357
9358 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9359 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9360 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9361 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9362 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9363
9364 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9365 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9366 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9367 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9368 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9369
9370 // set right speaker Legion 7i.
9371 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9372 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9373
9374 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9375 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9376 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9377 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9378 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9379
9380 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9381 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9382 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9383 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9384 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9385 {}
9386 },
9387 .chained = true,
9388 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9389 },
9390 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9391 .type = HDA_FIXUP_FUNC,
9392 .v.func = alc287_fixup_legion_15imhg05_speakers,
9393 .chained = true,
9394 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9395 },
9396 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9397 .type = HDA_FIXUP_VERBS,
9398 .v.verbs = (const struct hda_verb[]) {
9399 // set left speaker Yoga 7i.
9400 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9401 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9402
9403 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9404 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9405 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9406 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9407 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9408
9409 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9410 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9411 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9412 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9413 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9414
9415 // set right speaker Yoga 7i.
9416 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9417 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9418
9419 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9420 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9421 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9422 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9423 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9424
9425 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9426 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9427 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9428 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9429 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9430 {}
9431 },
9432 .chained = true,
9433 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9434 },
9435 [ALC298_FIXUP_LENOVO_C940_DUET7] = {
9436 .type = HDA_FIXUP_FUNC,
9437 .v.func = alc298_fixup_lenovo_c940_duet7,
9438 },
9439 [ALC287_FIXUP_LENOVO_14IRP8_DUETITL] = {
9440 .type = HDA_FIXUP_FUNC,
9441 .v.func = alc287_fixup_lenovo_14irp8_duetitl,
9442 },
9443 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9444 .type = HDA_FIXUP_VERBS,
9445 .v.verbs = (const struct hda_verb[]) {
9446 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9447 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9448 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9449 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9450 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9451 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9452 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9453 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9454 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9455 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9456 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9457 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9458 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9459 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9460 {}
9461 },
9462 .chained = true,
9463 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9464 },
9465 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9466 .type = HDA_FIXUP_FUNC,
9467 .v.func = alc256_fixup_set_coef_defaults,
9468 },
9469 [ALC245_FIXUP_HP_GPIO_LED] = {
9470 .type = HDA_FIXUP_FUNC,
9471 .v.func = alc245_fixup_hp_gpio_led,
9472 },
9473 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9474 .type = HDA_FIXUP_PINS,
9475 .v.pins = (const struct hda_pintbl[]) {
9476 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9477 { }
9478 },
9479 .chained = true,
9480 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9481 },
9482 [ALC233_FIXUP_NO_AUDIO_JACK] = {
9483 .type = HDA_FIXUP_FUNC,
9484 .v.func = alc233_fixup_no_audio_jack,
9485 },
9486 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9487 .type = HDA_FIXUP_FUNC,
9488 .v.func = alc256_fixup_mic_no_presence_and_resume,
9489 .chained = true,
9490 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9491 },
9492 [ALC287_FIXUP_LEGION_16ACHG6] = {
9493 .type = HDA_FIXUP_FUNC,
9494 .v.func = alc287_fixup_legion_16achg6_speakers,
9495 },
9496 [ALC287_FIXUP_CS35L41_I2C_2] = {
9497 .type = HDA_FIXUP_FUNC,
9498 .v.func = cs35l41_fixup_i2c_two,
9499 },
9500 [ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9501 .type = HDA_FIXUP_FUNC,
9502 .v.func = cs35l41_fixup_i2c_two,
9503 .chained = true,
9504 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9505 },
9506 [ALC245_FIXUP_CS35L41_SPI_2] = {
9507 .type = HDA_FIXUP_FUNC,
9508 .v.func = cs35l41_fixup_spi_two,
9509 },
9510 [ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9511 .type = HDA_FIXUP_FUNC,
9512 .v.func = cs35l41_fixup_spi_two,
9513 .chained = true,
9514 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9515 },
9516 [ALC245_FIXUP_CS35L41_SPI_4] = {
9517 .type = HDA_FIXUP_FUNC,
9518 .v.func = cs35l41_fixup_spi_four,
9519 },
9520 [ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9521 .type = HDA_FIXUP_FUNC,
9522 .v.func = cs35l41_fixup_spi_four,
9523 .chained = true,
9524 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9525 },
9526 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9527 .type = HDA_FIXUP_VERBS,
9528 .v.verbs = (const struct hda_verb[]) {
9529 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9530 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9531 { }
9532 },
9533 .chained = true,
9534 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9535 },
9536 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9537 .type = HDA_FIXUP_FUNC,
9538 .v.func = alc_fixup_dell4_mic_no_presence_quiet,
9539 .chained = true,
9540 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9541 },
9542 [ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9543 .type = HDA_FIXUP_PINS,
9544 .v.pins = (const struct hda_pintbl[]) {
9545 { 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9546 { }
9547 },
9548 .chained = true,
9549 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9550 },
9551 [ALC287_FIXUP_LEGION_16ITHG6] = {
9552 .type = HDA_FIXUP_FUNC,
9553 .v.func = alc287_fixup_legion_16ithg6_speakers,
9554 },
9555 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9556 .type = HDA_FIXUP_VERBS,
9557 .v.verbs = (const struct hda_verb[]) {
9558 // enable left speaker
9559 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9560 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9561
9562 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9563 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9564 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9565 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9566 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9567
9568 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9569 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9570 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9571 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9572 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9573
9574 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9575 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9576 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9577 { 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9578 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9579
9580 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9581 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9582 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9583 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9584 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9585
9586 // enable right speaker
9587 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9588 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9589
9590 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9591 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9592 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9593 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9594 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9595
9596 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9597 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9598 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9599 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9600 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9601
9602 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9603 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9604 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9605 { 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9606 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9607
9608 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9609 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9610 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9611 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9612 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9613
9614 { },
9615 },
9616 },
9617 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9618 .type = HDA_FIXUP_FUNC,
9619 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9620 .chained = true,
9621 .chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9622 },
9623 [ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9624 .type = HDA_FIXUP_FUNC,
9625 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9626 .chained = true,
9627 .chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9628 },
9629 [ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9630 .type = HDA_FIXUP_FUNC,
9631 .v.func = alc295_fixup_dell_inspiron_top_speakers,
9632 .chained = true,
9633 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9634 },
9635 [ALC236_FIXUP_DELL_DUAL_CODECS] = {
9636 .type = HDA_FIXUP_PINS,
9637 .v.func = alc1220_fixup_gb_dual_codecs,
9638 .chained = true,
9639 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9640 },
9641 [ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9642 .type = HDA_FIXUP_FUNC,
9643 .v.func = cs35l41_fixup_i2c_two,
9644 .chained = true,
9645 .chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9646 },
9647 [ALC287_FIXUP_TAS2781_I2C] = {
9648 .type = HDA_FIXUP_FUNC,
9649 .v.func = tas2781_fixup_i2c,
9650 .chained = true,
9651 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9652 },
9653 [ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9654 .type = HDA_FIXUP_FUNC,
9655 .v.func = alc245_fixup_hp_mute_led_coefbit,
9656 },
9657 [ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9658 .type = HDA_FIXUP_FUNC,
9659 .v.func = alc245_fixup_hp_mute_led_coefbit,
9660 .chained = true,
9661 .chain_id = ALC245_FIXUP_HP_GPIO_LED
9662 },
9663 [ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9664 .type = HDA_FIXUP_FUNC,
9665 .v.func = alc287_fixup_bind_dacs,
9666 .chained = true,
9667 .chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9668 },
9669 [ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9670 .type = HDA_FIXUP_FUNC,
9671 .v.func = alc287_fixup_bind_dacs,
9672 .chained = true,
9673 .chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9674 },
9675 [ALC2XX_FIXUP_HEADSET_MIC] = {
9676 .type = HDA_FIXUP_FUNC,
9677 .v.func = alc_fixup_headset_mic,
9678 },
9679 [ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9680 .type = HDA_FIXUP_FUNC,
9681 .v.func = cs35l41_fixup_spi_two,
9682 .chained = true,
9683 .chain_id = ALC289_FIXUP_DUAL_SPK
9684 },
9685 [ALC294_FIXUP_CS35L41_I2C_2] = {
9686 .type = HDA_FIXUP_FUNC,
9687 .v.func = cs35l41_fixup_i2c_two,
9688 },
9689 };
9690
9691 static const struct hda_quirk alc269_fixup_tbl[] = {
9692 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9693 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9694 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9695 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9696 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9697 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9698 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9699 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9700 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9701 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9702 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9703 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9704 SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9705 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9706 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9707 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9708 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9709 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9710 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9711 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9712 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9713 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9714 SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9715 SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
9716 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9717 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9718 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9719 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9720 SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9721 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9722 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9723 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9724 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9725 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9726 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9727 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9728 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9729 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9730 SND_PCI_QUIRK(0x1025, 0x1360, "Acer Aspire A115", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9731 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9732 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9733 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9734 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9735 SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9736 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9737 SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9738 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9739 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9740 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9741 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9742 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9743 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9744 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9745 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9746 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9747 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9748 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9749 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9750 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9751 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9752 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9753 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9754 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9755 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9756 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9757 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9758 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9759 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9760 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9761 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9762 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9763 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9764 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9765 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9766 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9767 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9768 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9769 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9770 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9771 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9772 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9773 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9774 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9775 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9776 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9777 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9778 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9779 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9780 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9781 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9782 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9783 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9784 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9785 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9786 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9787 SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9788 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9789 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9790 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9791 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9792 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9793 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9794 SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9795 SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9796 SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9797 SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9798 SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9799 SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9800 SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9801 SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9802 SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9803 SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9804 SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9805 SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9806 SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9807 SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9808 SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9809 SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9810 SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9811 SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9812 SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9813 SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9814 SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9815 SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9816 SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9817 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9818 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9819 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9820 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9821 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9822 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9823 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9824 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9825 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9826 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9827 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9828 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9829 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9830 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9831 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9832 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9833 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9834 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9835 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9836 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9837 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9838 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9839 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9840 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9841 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9842 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9843 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9844 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9845 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9846 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9847 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9848 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9849 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9850 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9851 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9852 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9853 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9854 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9855 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9856 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9857 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9858 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9859 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9860 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9861 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9862 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9863 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9864 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9865 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9866 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9867 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9868 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9869 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9870 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9871 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9872 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9873 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9874 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9875 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9876 SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9877 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9878 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9879 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9880 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9881 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9882 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9883 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9884 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9885 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9886 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9887 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9888 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9889 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9890 SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9891 SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9892 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9893 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9894 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9895 SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9896 SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
9897 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9898 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9899 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9900 SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9901 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9902 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9903 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9904 SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9905 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9906 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9907 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9908 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9909 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9910 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9911 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9912 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9913 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9914 SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9915 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9916 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9917 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9918 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9919 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9920 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9921 SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9922 SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9923 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9924 SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9925 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9926 SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9927 SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9928 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9929 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9930 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9931 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9932 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9933 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9934 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9935 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9936 SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9937 SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9938 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9939 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9940 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9941 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9942 SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9943 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9944 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9945 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9946 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9947 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9948 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9949 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9950 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9951 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9952 SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9953 SND_PCI_QUIRK(0x103c, 0x887c, "HP Laptop 14s-fq1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9954 SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9955 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9956 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9957 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9958 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9959 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9960 SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
9961 SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9962 SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9963 SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
9964 SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9965 SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9966 SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9967 SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9968 SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9969 SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9970 SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9971 SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
9972 SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9973 SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9974 SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9975 SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9976 SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
9977 SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9978 SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
9979 SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9980 SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
9981 SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9982 SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9983 SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9984 SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9985 SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9986 SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9987 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9988 SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9989 SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
9990 SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9991 SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
9992 SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9993 SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9994 SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9995 SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9996 SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
9997 SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
9998 SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9999 SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10000 SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10001 SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10002 SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10003 SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10004 SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10005 SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10006 SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10007 SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10008 SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10009 SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10010 SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10011 SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10012 SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10013 SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10014 SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10015 SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10016 SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10017 SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10018 SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10019 SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10020 SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10021 SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10022 SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10023 SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10024 SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10025 SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10026 SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10027 SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10028 SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10029 SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10030 SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10031 SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10032 SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10033 SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10034 SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10035 SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10036 SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10037 SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10038 SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10039 SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10040 SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10041 SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10042 SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10043 SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10044 SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10045 SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10046 SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10047 SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10048 SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10049 SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10050 SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10051 SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10052 SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10053 SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10054 SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10055 SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10056 SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10057 SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10058 SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10059 SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10060 SND_PCI_QUIRK(0x103c, 0x8d01, "HP ZBook Power 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10061 SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED),
10062 SND_PCI_QUIRK(0x103c, 0x8d91, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10063 SND_PCI_QUIRK(0x103c, 0x8d92, "HP ZBook Firefly 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10064 SND_PCI_QUIRK(0x103c, 0x8e18, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10065 SND_PCI_QUIRK(0x103c, 0x8e19, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10066 SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10067 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10068 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10069 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10070 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10071 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10072 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10073 SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10074 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10075 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10076 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10077 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10078 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10079 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10080 SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10081 SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10082 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10083 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10084 SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10085 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10086 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10087 SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10088 SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10089 SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10090 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10091 SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10092 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10093 SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA", ALC287_FIXUP_CS35L41_I2C_2),
10094 SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301V", ALC285_FIXUP_ASUS_HEADSET_MIC),
10095 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10096 SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10097 SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10098 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10099 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10100 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10101 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10102 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10103 SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally RC71L_RC71L", ALC294_FIXUP_ASUS_ALLY),
10104 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10105 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10106 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10107 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10108 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10109 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10110 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10111 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10112 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10113 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10114 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
10115 SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10116 SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10117 SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10118 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10119 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
10120 SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10121 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10122 SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10123 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10124 SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10125 SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10126 SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10127 SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10128 SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10129 SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10130 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10131 SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
10132 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10133 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10134 SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10135 SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10136 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10137 SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10138 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10139 SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10140 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10141 SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10142 SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10143 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10144 SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10145 SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10146 SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10147 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10148 SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
10149 SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10150 SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10151 SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10152 SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
10153 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10154 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10155 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10156 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10157 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10158 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10159 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10160 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10161 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10162 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10163 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10164 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10165 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10166 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10167 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10168 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10169 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10170 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10171 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10172 SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10173 SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10174 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10175 SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10176 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10177 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10178 SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10179 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10180 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10181 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10182 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10183 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10184 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10185 SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10186 SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10187 SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10188 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10189 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10190 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10191 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10192 SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10193 SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10194 SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10195 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10196 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10197 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10198 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10199 SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10200 SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10201 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10202 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10203 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10204 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10205 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10206 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10207 SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10208 SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
10209 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10210 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10211 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10212 SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10213 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10214 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10215 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10216 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10217 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10218 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10219 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10220 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10221 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10222 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10223 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10224 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10225 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10226 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10227 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10228 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10229 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10230 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10231 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10232 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10233 SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10234 SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10235 SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10236 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10237 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10238 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10239 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10240 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10241 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10242 SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10243 SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10244 SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10245 SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10246 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10247 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10248 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10249 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10250 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10251 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10252 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10253 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10254 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10255 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10256 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10257 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10258 SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10259 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10260 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10261 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10262 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10263 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10264 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10265 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10266 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10267 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10268 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10269 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10270 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10271 SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10272 SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10273 SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10274 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10275 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10276 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10277 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10278 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10279 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10280 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10281 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10282 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10283 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10284 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10285 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10286 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10287 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10288 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10289 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10290 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10291 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10292 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10293 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10294 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10295 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10296 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10297 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10298 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10299 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10300 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10301 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10302 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10303 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10304 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10305 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10306 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10307 SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10308 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10309 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10310 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10311 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10312 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10313 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10314 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10315 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10316 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10317 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10318 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10319 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10320 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10321 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10322 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10323 SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10324 SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10325 SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10326 SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10327 SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10328 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10329 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10330 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10331 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10332 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10333 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10334 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10335 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10336 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10337 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10338 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10339 SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10340 SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10341 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8 / DuetITL 2021", ALC287_FIXUP_LENOVO_14IRP8_DUETITL),
10342 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10343 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10344 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10345 SND_PCI_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10346 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10347 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10348 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10349 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10350 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10351 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10352 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10353 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10354 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10355 SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10356 SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10357 SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10358 SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10359 SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10360 SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10361 SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10362 SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10363 SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10364 SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10365 SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10366 SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10367 SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10368 SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10369 SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10370 SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10371 SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10372 SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10373 SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10374 SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10375 SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10376 SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10377 SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10378 SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10379 SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10380 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10381 SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
10382 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10383 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10384 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10385 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10386 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10387 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10388 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10389 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10390 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10391 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10392 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10393 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10394 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10395 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10396 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10397 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10398 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10399 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10400 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10401 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10402 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10403 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10404 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10405 SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10406 SND_PCI_QUIRK(0x1849, 0x0269, "Positivo Master C6400", ALC269VB_FIXUP_ASUS_ZENBOOK),
10407 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10408 SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10409 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10410 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10411 SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
10412 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10413 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10414 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10415 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10416 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10417 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10418 SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10419 SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10420 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10421 SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10422 SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10423 SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10424 SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10425 SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10426 SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10427 SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10428 SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10429 SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10430 SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10431 SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10432 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10433 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10434 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10435 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10436 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10437 SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2),
10438 SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10439 SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
10440 SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10441 SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX),
10442 SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX),
10443 SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
10444 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10445 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10446 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10447 SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10448 SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10449 SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10450 SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10451 SND_PCI_QUIRK(0xf111, 0x000c, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10452
10453 #if 0
10454 /* Below is a quirk table taken from the old code.
10455 * Basically the device should work as is without the fixup table.
10456 * If BIOS doesn't give a proper info, enable the corresponding
10457 * fixup entry.
10458 */
10459 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10460 ALC269_FIXUP_AMIC),
10461 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10462 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10463 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10464 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10465 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10466 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10467 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10468 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10469 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10470 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10471 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10472 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10473 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10474 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10475 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10476 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10477 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10478 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10479 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10480 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10481 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10482 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10483 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10484 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10485 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10486 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10487 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10488 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10489 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10490 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10491 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10492 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10493 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10494 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10495 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10496 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10497 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10498 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10499 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10500 #endif
10501 {}
10502 };
10503
10504 static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
10505 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10506 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10507 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10508 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10509 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10510 {}
10511 };
10512
10513 static const struct hda_model_fixup alc269_fixup_models[] = {
10514 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10515 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10516 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10517 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10518 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10519 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10520 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10521 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10522 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10523 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10524 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10525 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10526 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10527 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10528 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10529 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10530 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
10531 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10532 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10533 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10534 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10535 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10536 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10537 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10538 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10539 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10540 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10541 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10542 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10543 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10544 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10545 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10546 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10547 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10548 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10549 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10550 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10551 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10552 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10553 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10554 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10555 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10556 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10557 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10558 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10559 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10560 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10561 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10562 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10563 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10564 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10565 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10566 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10567 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10568 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10569 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10570 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10571 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10572 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10573 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10574 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10575 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10576 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10577 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10578 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10579 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10580 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10581 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10582 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10583 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10584 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10585 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10586 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10587 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10588 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10589 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10590 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10591 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10592 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10593 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10594 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10595 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10596 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10597 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10598 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10599 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10600 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10601 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10602 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10603 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10604 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10605 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10606 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10607 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10608 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10609 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10610 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10611 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10612 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10613 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10614 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10615 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10616 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10617 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10618 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10619 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10620 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10621 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10622 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10623 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10624 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10625 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10626 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10627 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10628 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10629 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10630 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10631 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10632 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10633 {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
10634 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10635 {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10636 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10637 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10638 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10639 {.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
10640 {.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
10641 {}
10642 };
10643 #define ALC225_STANDARD_PINS \
10644 {0x21, 0x04211020}
10645
10646 #define ALC256_STANDARD_PINS \
10647 {0x12, 0x90a60140}, \
10648 {0x14, 0x90170110}, \
10649 {0x21, 0x02211020}
10650
10651 #define ALC282_STANDARD_PINS \
10652 {0x14, 0x90170110}
10653
10654 #define ALC290_STANDARD_PINS \
10655 {0x12, 0x99a30130}
10656
10657 #define ALC292_STANDARD_PINS \
10658 {0x14, 0x90170110}, \
10659 {0x15, 0x0221401f}
10660
10661 #define ALC295_STANDARD_PINS \
10662 {0x12, 0xb7a60130}, \
10663 {0x14, 0x90170110}, \
10664 {0x21, 0x04211020}
10665
10666 #define ALC298_STANDARD_PINS \
10667 {0x12, 0x90a60130}, \
10668 {0x21, 0x03211020}
10669
10670 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10671 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10672 {0x14, 0x01014020},
10673 {0x17, 0x90170110},
10674 {0x18, 0x02a11030},
10675 {0x19, 0x0181303F},
10676 {0x21, 0x0221102f}),
10677 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10678 {0x12, 0x90a601c0},
10679 {0x14, 0x90171120},
10680 {0x21, 0x02211030}),
10681 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10682 {0x14, 0x90170110},
10683 {0x1b, 0x90a70130},
10684 {0x21, 0x03211020}),
10685 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10686 {0x1a, 0x90a70130},
10687 {0x1b, 0x90170110},
10688 {0x21, 0x03211020}),
10689 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10690 ALC225_STANDARD_PINS,
10691 {0x12, 0xb7a60130},
10692 {0x14, 0x901701a0}),
10693 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10694 ALC225_STANDARD_PINS,
10695 {0x12, 0xb7a60130},
10696 {0x14, 0x901701b0}),
10697 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10698 ALC225_STANDARD_PINS,
10699 {0x12, 0xb7a60150},
10700 {0x14, 0x901701a0}),
10701 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10702 ALC225_STANDARD_PINS,
10703 {0x12, 0xb7a60150},
10704 {0x14, 0x901701b0}),
10705 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10706 ALC225_STANDARD_PINS,
10707 {0x12, 0xb7a60130},
10708 {0x1b, 0x90170110}),
10709 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10710 {0x1b, 0x01111010},
10711 {0x1e, 0x01451130},
10712 {0x21, 0x02211020}),
10713 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10714 {0x12, 0x90a60140},
10715 {0x14, 0x90170110},
10716 {0x19, 0x02a11030},
10717 {0x21, 0x02211020}),
10718 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10719 {0x14, 0x90170110},
10720 {0x19, 0x02a11030},
10721 {0x1a, 0x02a11040},
10722 {0x1b, 0x01014020},
10723 {0x21, 0x0221101f}),
10724 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10725 {0x14, 0x90170110},
10726 {0x19, 0x02a11030},
10727 {0x1a, 0x02a11040},
10728 {0x1b, 0x01011020},
10729 {0x21, 0x0221101f}),
10730 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10731 {0x14, 0x90170110},
10732 {0x19, 0x02a11020},
10733 {0x1a, 0x02a11030},
10734 {0x21, 0x0221101f}),
10735 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10736 {0x21, 0x02211010}),
10737 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10738 {0x14, 0x90170110},
10739 {0x19, 0x02a11020},
10740 {0x21, 0x02211030}),
10741 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10742 {0x14, 0x90170110},
10743 {0x21, 0x02211020}),
10744 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10745 {0x14, 0x90170130},
10746 {0x21, 0x02211040}),
10747 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10748 {0x12, 0x90a60140},
10749 {0x14, 0x90170110},
10750 {0x21, 0x02211020}),
10751 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10752 {0x12, 0x90a60160},
10753 {0x14, 0x90170120},
10754 {0x21, 0x02211030}),
10755 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10756 {0x14, 0x90170110},
10757 {0x1b, 0x02011020},
10758 {0x21, 0x0221101f}),
10759 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10760 {0x14, 0x90170110},
10761 {0x1b, 0x01011020},
10762 {0x21, 0x0221101f}),
10763 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10764 {0x14, 0x90170130},
10765 {0x1b, 0x01014020},
10766 {0x21, 0x0221103f}),
10767 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10768 {0x14, 0x90170130},
10769 {0x1b, 0x01011020},
10770 {0x21, 0x0221103f}),
10771 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10772 {0x14, 0x90170130},
10773 {0x1b, 0x02011020},
10774 {0x21, 0x0221103f}),
10775 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10776 {0x14, 0x90170150},
10777 {0x1b, 0x02011020},
10778 {0x21, 0x0221105f}),
10779 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10780 {0x14, 0x90170110},
10781 {0x1b, 0x01014020},
10782 {0x21, 0x0221101f}),
10783 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10784 {0x12, 0x90a60160},
10785 {0x14, 0x90170120},
10786 {0x17, 0x90170140},
10787 {0x21, 0x0321102f}),
10788 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10789 {0x12, 0x90a60160},
10790 {0x14, 0x90170130},
10791 {0x21, 0x02211040}),
10792 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10793 {0x12, 0x90a60160},
10794 {0x14, 0x90170140},
10795 {0x21, 0x02211050}),
10796 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10797 {0x12, 0x90a60170},
10798 {0x14, 0x90170120},
10799 {0x21, 0x02211030}),
10800 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10801 {0x12, 0x90a60170},
10802 {0x14, 0x90170130},
10803 {0x21, 0x02211040}),
10804 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10805 {0x12, 0x90a60170},
10806 {0x14, 0x90171130},
10807 {0x21, 0x02211040}),
10808 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10809 {0x12, 0x90a60170},
10810 {0x14, 0x90170140},
10811 {0x21, 0x02211050}),
10812 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10813 {0x12, 0x90a60180},
10814 {0x14, 0x90170130},
10815 {0x21, 0x02211040}),
10816 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10817 {0x12, 0x90a60180},
10818 {0x14, 0x90170120},
10819 {0x21, 0x02211030}),
10820 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10821 {0x1b, 0x01011020},
10822 {0x21, 0x02211010}),
10823 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10824 {0x14, 0x90170110},
10825 {0x1b, 0x90a70130},
10826 {0x21, 0x04211020}),
10827 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10828 {0x14, 0x90170110},
10829 {0x1b, 0x90a70130},
10830 {0x21, 0x03211020}),
10831 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10832 {0x12, 0x90a60130},
10833 {0x14, 0x90170110},
10834 {0x21, 0x03211020}),
10835 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10836 {0x12, 0x90a60130},
10837 {0x14, 0x90170110},
10838 {0x21, 0x04211020}),
10839 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10840 {0x1a, 0x90a70130},
10841 {0x1b, 0x90170110},
10842 {0x21, 0x03211020}),
10843 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10844 {0x14, 0x90170110},
10845 {0x19, 0x02a11020},
10846 {0x21, 0x0221101f}),
10847 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10848 {0x17, 0x90170110},
10849 {0x19, 0x03a11030},
10850 {0x21, 0x03211020}),
10851 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10852 {0x12, 0x90a60130},
10853 {0x14, 0x90170110},
10854 {0x15, 0x0421101f},
10855 {0x1a, 0x04a11020}),
10856 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10857 {0x12, 0x90a60140},
10858 {0x14, 0x90170110},
10859 {0x15, 0x0421101f},
10860 {0x18, 0x02811030},
10861 {0x1a, 0x04a1103f},
10862 {0x1b, 0x02011020}),
10863 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10864 ALC282_STANDARD_PINS,
10865 {0x12, 0x99a30130},
10866 {0x19, 0x03a11020},
10867 {0x21, 0x0321101f}),
10868 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10869 ALC282_STANDARD_PINS,
10870 {0x12, 0x99a30130},
10871 {0x19, 0x03a11020},
10872 {0x21, 0x03211040}),
10873 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10874 ALC282_STANDARD_PINS,
10875 {0x12, 0x99a30130},
10876 {0x19, 0x03a11030},
10877 {0x21, 0x03211020}),
10878 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10879 ALC282_STANDARD_PINS,
10880 {0x12, 0x99a30130},
10881 {0x19, 0x04a11020},
10882 {0x21, 0x0421101f}),
10883 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10884 ALC282_STANDARD_PINS,
10885 {0x12, 0x90a60140},
10886 {0x19, 0x04a11030},
10887 {0x21, 0x04211020}),
10888 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10889 ALC282_STANDARD_PINS,
10890 {0x12, 0x90a609c0},
10891 {0x18, 0x03a11830},
10892 {0x19, 0x04a19831},
10893 {0x1a, 0x0481303f},
10894 {0x1b, 0x04211020},
10895 {0x21, 0x0321101f}),
10896 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10897 ALC282_STANDARD_PINS,
10898 {0x12, 0x90a60940},
10899 {0x18, 0x03a11830},
10900 {0x19, 0x04a19831},
10901 {0x1a, 0x0481303f},
10902 {0x1b, 0x04211020},
10903 {0x21, 0x0321101f}),
10904 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10905 ALC282_STANDARD_PINS,
10906 {0x12, 0x90a60130},
10907 {0x21, 0x0321101f}),
10908 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10909 {0x12, 0x90a60160},
10910 {0x14, 0x90170120},
10911 {0x21, 0x02211030}),
10912 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10913 ALC282_STANDARD_PINS,
10914 {0x12, 0x90a60130},
10915 {0x19, 0x03a11020},
10916 {0x21, 0x0321101f}),
10917 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10918 {0x12, 0x90a60130},
10919 {0x14, 0x90170110},
10920 {0x19, 0x04a11040},
10921 {0x21, 0x04211020}),
10922 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10923 {0x14, 0x90170110},
10924 {0x19, 0x04a11040},
10925 {0x1d, 0x40600001},
10926 {0x21, 0x04211020}),
10927 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10928 {0x14, 0x90170110},
10929 {0x19, 0x04a11040},
10930 {0x21, 0x04211020}),
10931 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10932 {0x14, 0x90170110},
10933 {0x17, 0x90170111},
10934 {0x19, 0x03a11030},
10935 {0x21, 0x03211020}),
10936 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10937 {0x17, 0x90170110},
10938 {0x19, 0x03a11030},
10939 {0x21, 0x03211020}),
10940 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10941 {0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
10942 {0x19, 0x04a11040},
10943 {0x21, 0x04211020}),
10944 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10945 {0x12, 0x90a60130},
10946 {0x17, 0x90170110},
10947 {0x21, 0x02211020}),
10948 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
10949 {0x12, 0x90a60120},
10950 {0x14, 0x90170110},
10951 {0x21, 0x0321101f}),
10952 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10953 ALC290_STANDARD_PINS,
10954 {0x15, 0x04211040},
10955 {0x18, 0x90170112},
10956 {0x1a, 0x04a11020}),
10957 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10958 ALC290_STANDARD_PINS,
10959 {0x15, 0x04211040},
10960 {0x18, 0x90170110},
10961 {0x1a, 0x04a11020}),
10962 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10963 ALC290_STANDARD_PINS,
10964 {0x15, 0x0421101f},
10965 {0x1a, 0x04a11020}),
10966 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10967 ALC290_STANDARD_PINS,
10968 {0x15, 0x04211020},
10969 {0x1a, 0x04a11040}),
10970 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10971 ALC290_STANDARD_PINS,
10972 {0x14, 0x90170110},
10973 {0x15, 0x04211020},
10974 {0x1a, 0x04a11040}),
10975 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10976 ALC290_STANDARD_PINS,
10977 {0x14, 0x90170110},
10978 {0x15, 0x04211020},
10979 {0x1a, 0x04a11020}),
10980 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10981 ALC290_STANDARD_PINS,
10982 {0x14, 0x90170110},
10983 {0x15, 0x0421101f},
10984 {0x1a, 0x04a11020}),
10985 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10986 ALC292_STANDARD_PINS,
10987 {0x12, 0x90a60140},
10988 {0x16, 0x01014020},
10989 {0x19, 0x01a19030}),
10990 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10991 ALC292_STANDARD_PINS,
10992 {0x12, 0x90a60140},
10993 {0x16, 0x01014020},
10994 {0x18, 0x02a19031},
10995 {0x19, 0x01a1903e}),
10996 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
10997 ALC292_STANDARD_PINS,
10998 {0x12, 0x90a60140}),
10999 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11000 ALC292_STANDARD_PINS,
11001 {0x13, 0x90a60140},
11002 {0x16, 0x21014020},
11003 {0x19, 0x21a19030}),
11004 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11005 ALC292_STANDARD_PINS,
11006 {0x13, 0x90a60140}),
11007 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
11008 {0x17, 0x90170110},
11009 {0x21, 0x04211020}),
11010 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
11011 {0x14, 0x90170110},
11012 {0x1b, 0x90a70130},
11013 {0x21, 0x04211020}),
11014 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11015 {0x12, 0x90a60130},
11016 {0x17, 0x90170110},
11017 {0x21, 0x03211020}),
11018 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11019 {0x12, 0x90a60130},
11020 {0x17, 0x90170110},
11021 {0x21, 0x04211020}),
11022 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11023 {0x12, 0x90a60130},
11024 {0x17, 0x90170110},
11025 {0x21, 0x03211020}),
11026 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11027 {0x12, 0x90a60120},
11028 {0x17, 0x90170110},
11029 {0x21, 0x04211030}),
11030 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11031 {0x12, 0x90a60130},
11032 {0x17, 0x90170110},
11033 {0x21, 0x03211020}),
11034 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11035 {0x12, 0x90a60130},
11036 {0x17, 0x90170110},
11037 {0x21, 0x03211020}),
11038 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11039 ALC298_STANDARD_PINS,
11040 {0x17, 0x90170110}),
11041 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11042 ALC298_STANDARD_PINS,
11043 {0x17, 0x90170140}),
11044 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11045 ALC298_STANDARD_PINS,
11046 {0x17, 0x90170150}),
11047 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11048 {0x12, 0xb7a60140},
11049 {0x13, 0xb7a60150},
11050 {0x17, 0x90170110},
11051 {0x1a, 0x03011020},
11052 {0x21, 0x03211030}),
11053 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11054 {0x12, 0xb7a60140},
11055 {0x17, 0x90170110},
11056 {0x1a, 0x03a11030},
11057 {0x21, 0x03211020}),
11058 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11059 ALC225_STANDARD_PINS,
11060 {0x12, 0xb7a60130},
11061 {0x17, 0x90170110}),
11062 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11063 {0x14, 0x01014010},
11064 {0x17, 0x90170120},
11065 {0x18, 0x02a11030},
11066 {0x19, 0x02a1103f},
11067 {0x21, 0x0221101f}),
11068 {}
11069 };
11070
11071 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11072 * more machines, don't need to match all valid pins, just need to match
11073 * all the pins defined in the tbl. Just because of this reason, it is possible
11074 * that a single machine matches multiple tbls, so there is one limitation:
11075 * at most one tbl is allowed to define for the same vendor and same codec
11076 */
11077 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11078 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11079 {0x19, 0x40000000}),
11080 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11081 {0x19, 0x40000000},
11082 {0x1b, 0x40000000}),
11083 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
11084 {0x19, 0x40000000},
11085 {0x1b, 0x40000000}),
11086 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11087 {0x19, 0x40000000},
11088 {0x1a, 0x40000000}),
11089 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11090 {0x19, 0x40000000},
11091 {0x1a, 0x40000000}),
11092 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11093 {0x19, 0x40000000},
11094 {0x1a, 0x40000000}),
11095 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11096 {0x19, 0x40000000}),
11097 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
11098 {0x19, 0x40000000}),
11099 {}
11100 };
11101
alc269_fill_coef(struct hda_codec * codec)11102 static void alc269_fill_coef(struct hda_codec *codec)
11103 {
11104 struct alc_spec *spec = codec->spec;
11105 int val;
11106
11107 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11108 return;
11109
11110 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11111 alc_write_coef_idx(codec, 0xf, 0x960b);
11112 alc_write_coef_idx(codec, 0xe, 0x8817);
11113 }
11114
11115 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11116 alc_write_coef_idx(codec, 0xf, 0x960b);
11117 alc_write_coef_idx(codec, 0xe, 0x8814);
11118 }
11119
11120 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11121 /* Power up output pin */
11122 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11123 }
11124
11125 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11126 val = alc_read_coef_idx(codec, 0xd);
11127 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11128 /* Capless ramp up clock control */
11129 alc_write_coef_idx(codec, 0xd, val | (1<<10));
11130 }
11131 val = alc_read_coef_idx(codec, 0x17);
11132 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11133 /* Class D power on reset */
11134 alc_write_coef_idx(codec, 0x17, val | (1<<7));
11135 }
11136 }
11137
11138 /* HP */
11139 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11140 }
11141
11142 /*
11143 */
patch_alc269(struct hda_codec * codec)11144 static int patch_alc269(struct hda_codec *codec)
11145 {
11146 struct alc_spec *spec;
11147 int err;
11148
11149 err = alc_alloc_spec(codec, 0x0b);
11150 if (err < 0)
11151 return err;
11152
11153 spec = codec->spec;
11154 spec->gen.shared_mic_vref_pin = 0x18;
11155 codec->power_save_node = 0;
11156 spec->en_3kpull_low = true;
11157
11158 #ifdef CONFIG_PM
11159 codec->patch_ops.suspend = alc269_suspend;
11160 codec->patch_ops.resume = alc269_resume;
11161 #endif
11162 spec->shutup = alc_default_shutup;
11163 spec->init_hook = alc_default_init;
11164
11165 switch (codec->core.vendor_id) {
11166 case 0x10ec0269:
11167 spec->codec_variant = ALC269_TYPE_ALC269VA;
11168 switch (alc_get_coef0(codec) & 0x00f0) {
11169 case 0x0010:
11170 if (codec->bus->pci &&
11171 codec->bus->pci->subsystem_vendor == 0x1025 &&
11172 spec->cdefine.platform_type == 1)
11173 err = alc_codec_rename(codec, "ALC271X");
11174 spec->codec_variant = ALC269_TYPE_ALC269VB;
11175 break;
11176 case 0x0020:
11177 if (codec->bus->pci &&
11178 codec->bus->pci->subsystem_vendor == 0x17aa &&
11179 codec->bus->pci->subsystem_device == 0x21f3)
11180 err = alc_codec_rename(codec, "ALC3202");
11181 spec->codec_variant = ALC269_TYPE_ALC269VC;
11182 break;
11183 case 0x0030:
11184 spec->codec_variant = ALC269_TYPE_ALC269VD;
11185 break;
11186 default:
11187 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11188 }
11189 if (err < 0)
11190 goto error;
11191 spec->shutup = alc269_shutup;
11192 spec->init_hook = alc269_fill_coef;
11193 alc269_fill_coef(codec);
11194 break;
11195
11196 case 0x10ec0280:
11197 case 0x10ec0290:
11198 spec->codec_variant = ALC269_TYPE_ALC280;
11199 break;
11200 case 0x10ec0282:
11201 spec->codec_variant = ALC269_TYPE_ALC282;
11202 spec->shutup = alc282_shutup;
11203 spec->init_hook = alc282_init;
11204 break;
11205 case 0x10ec0233:
11206 case 0x10ec0283:
11207 spec->codec_variant = ALC269_TYPE_ALC283;
11208 spec->shutup = alc283_shutup;
11209 spec->init_hook = alc283_init;
11210 break;
11211 case 0x10ec0284:
11212 case 0x10ec0292:
11213 spec->codec_variant = ALC269_TYPE_ALC284;
11214 break;
11215 case 0x10ec0293:
11216 spec->codec_variant = ALC269_TYPE_ALC293;
11217 break;
11218 case 0x10ec0286:
11219 case 0x10ec0288:
11220 spec->codec_variant = ALC269_TYPE_ALC286;
11221 break;
11222 case 0x10ec0298:
11223 spec->codec_variant = ALC269_TYPE_ALC298;
11224 break;
11225 case 0x10ec0235:
11226 case 0x10ec0255:
11227 spec->codec_variant = ALC269_TYPE_ALC255;
11228 spec->shutup = alc256_shutup;
11229 spec->init_hook = alc256_init;
11230 break;
11231 case 0x10ec0230:
11232 case 0x10ec0236:
11233 case 0x10ec0256:
11234 case 0x19e58326:
11235 spec->codec_variant = ALC269_TYPE_ALC256;
11236 spec->shutup = alc256_shutup;
11237 spec->init_hook = alc256_init;
11238 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11239 if (codec->core.vendor_id == 0x10ec0236 &&
11240 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11241 spec->en_3kpull_low = false;
11242 break;
11243 case 0x10ec0257:
11244 spec->codec_variant = ALC269_TYPE_ALC257;
11245 spec->shutup = alc256_shutup;
11246 spec->init_hook = alc256_init;
11247 spec->gen.mixer_nid = 0;
11248 spec->en_3kpull_low = false;
11249 break;
11250 case 0x10ec0215:
11251 case 0x10ec0245:
11252 case 0x10ec0285:
11253 case 0x10ec0289:
11254 if (alc_get_coef0(codec) & 0x0010)
11255 spec->codec_variant = ALC269_TYPE_ALC245;
11256 else
11257 spec->codec_variant = ALC269_TYPE_ALC215;
11258 spec->shutup = alc225_shutup;
11259 spec->init_hook = alc225_init;
11260 spec->gen.mixer_nid = 0;
11261 break;
11262 case 0x10ec0225:
11263 case 0x10ec0295:
11264 case 0x10ec0299:
11265 spec->codec_variant = ALC269_TYPE_ALC225;
11266 spec->shutup = alc225_shutup;
11267 spec->init_hook = alc225_init;
11268 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11269 break;
11270 case 0x10ec0287:
11271 spec->codec_variant = ALC269_TYPE_ALC287;
11272 spec->shutup = alc225_shutup;
11273 spec->init_hook = alc225_init;
11274 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11275 break;
11276 case 0x10ec0234:
11277 case 0x10ec0274:
11278 case 0x10ec0294:
11279 spec->codec_variant = ALC269_TYPE_ALC294;
11280 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11281 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11282 spec->init_hook = alc294_init;
11283 break;
11284 case 0x10ec0300:
11285 spec->codec_variant = ALC269_TYPE_ALC300;
11286 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11287 break;
11288 case 0x10ec0623:
11289 spec->codec_variant = ALC269_TYPE_ALC623;
11290 break;
11291 case 0x10ec0700:
11292 case 0x10ec0701:
11293 case 0x10ec0703:
11294 case 0x10ec0711:
11295 spec->codec_variant = ALC269_TYPE_ALC700;
11296 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11297 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11298 spec->init_hook = alc294_init;
11299 break;
11300
11301 }
11302
11303 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11304 spec->has_alc5505_dsp = 1;
11305 spec->init_hook = alc5505_dsp_init;
11306 }
11307
11308 alc_pre_init(codec);
11309
11310 snd_hda_pick_fixup(codec, alc269_fixup_models,
11311 alc269_fixup_tbl, alc269_fixups);
11312 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11313 * the quirk breaks the latter (bko#214101).
11314 * Clear the wrong entry.
11315 */
11316 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11317 codec->core.vendor_id == 0x10ec0294) {
11318 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11319 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11320 }
11321
11322 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11323 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11324 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
11325 alc269_fixups);
11326 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11327
11328 alc_auto_parse_customize_define(codec);
11329
11330 if (has_cdefine_beep(codec))
11331 spec->gen.beep_nid = 0x01;
11332
11333 /* automatic parse from the BIOS config */
11334 err = alc269_parse_auto_config(codec);
11335 if (err < 0)
11336 goto error;
11337
11338 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11339 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11340 if (err < 0)
11341 goto error;
11342 }
11343
11344 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11345
11346 return 0;
11347
11348 error:
11349 alc_free(codec);
11350 return err;
11351 }
11352
11353 /*
11354 * ALC861
11355 */
11356
alc861_parse_auto_config(struct hda_codec * codec)11357 static int alc861_parse_auto_config(struct hda_codec *codec)
11358 {
11359 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11360 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11361 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11362 }
11363
11364 /* Pin config fixes */
11365 enum {
11366 ALC861_FIXUP_FSC_AMILO_PI1505,
11367 ALC861_FIXUP_AMP_VREF_0F,
11368 ALC861_FIXUP_NO_JACK_DETECT,
11369 ALC861_FIXUP_ASUS_A6RP,
11370 ALC660_FIXUP_ASUS_W7J,
11371 };
11372
11373 /* 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)11374 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11375 const struct hda_fixup *fix, int action)
11376 {
11377 struct alc_spec *spec = codec->spec;
11378 unsigned int val;
11379
11380 if (action != HDA_FIXUP_ACT_INIT)
11381 return;
11382 val = snd_hda_codec_get_pin_target(codec, 0x0f);
11383 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11384 val |= AC_PINCTL_IN_EN;
11385 val |= AC_PINCTL_VREF_50;
11386 snd_hda_set_pin_ctl(codec, 0x0f, val);
11387 spec->gen.keep_vref_in_automute = 1;
11388 }
11389
11390 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)11391 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11392 const struct hda_fixup *fix, int action)
11393 {
11394 if (action == HDA_FIXUP_ACT_PRE_PROBE)
11395 codec->no_jack_detect = 1;
11396 }
11397
11398 static const struct hda_fixup alc861_fixups[] = {
11399 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
11400 .type = HDA_FIXUP_PINS,
11401 .v.pins = (const struct hda_pintbl[]) {
11402 { 0x0b, 0x0221101f }, /* HP */
11403 { 0x0f, 0x90170310 }, /* speaker */
11404 { }
11405 }
11406 },
11407 [ALC861_FIXUP_AMP_VREF_0F] = {
11408 .type = HDA_FIXUP_FUNC,
11409 .v.func = alc861_fixup_asus_amp_vref_0f,
11410 },
11411 [ALC861_FIXUP_NO_JACK_DETECT] = {
11412 .type = HDA_FIXUP_FUNC,
11413 .v.func = alc_fixup_no_jack_detect,
11414 },
11415 [ALC861_FIXUP_ASUS_A6RP] = {
11416 .type = HDA_FIXUP_FUNC,
11417 .v.func = alc861_fixup_asus_amp_vref_0f,
11418 .chained = true,
11419 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11420 },
11421 [ALC660_FIXUP_ASUS_W7J] = {
11422 .type = HDA_FIXUP_VERBS,
11423 .v.verbs = (const struct hda_verb[]) {
11424 /* ASUS W7J needs a magic pin setup on unused NID 0x10
11425 * for enabling outputs
11426 */
11427 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11428 { }
11429 },
11430 }
11431 };
11432
11433 static const struct hda_quirk alc861_fixup_tbl[] = {
11434 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11435 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11436 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11437 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11438 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11439 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11440 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11441 {}
11442 };
11443
11444 /*
11445 */
patch_alc861(struct hda_codec * codec)11446 static int patch_alc861(struct hda_codec *codec)
11447 {
11448 struct alc_spec *spec;
11449 int err;
11450
11451 err = alc_alloc_spec(codec, 0x15);
11452 if (err < 0)
11453 return err;
11454
11455 spec = codec->spec;
11456 if (has_cdefine_beep(codec))
11457 spec->gen.beep_nid = 0x23;
11458
11459 #ifdef CONFIG_PM
11460 spec->power_hook = alc_power_eapd;
11461 #endif
11462
11463 alc_pre_init(codec);
11464
11465 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11466 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11467
11468 /* automatic parse from the BIOS config */
11469 err = alc861_parse_auto_config(codec);
11470 if (err < 0)
11471 goto error;
11472
11473 if (!spec->gen.no_analog) {
11474 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11475 if (err < 0)
11476 goto error;
11477 }
11478
11479 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11480
11481 return 0;
11482
11483 error:
11484 alc_free(codec);
11485 return err;
11486 }
11487
11488 /*
11489 * ALC861-VD support
11490 *
11491 * Based on ALC882
11492 *
11493 * In addition, an independent DAC
11494 */
alc861vd_parse_auto_config(struct hda_codec * codec)11495 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11496 {
11497 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11498 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11499 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11500 }
11501
11502 enum {
11503 ALC660VD_FIX_ASUS_GPIO1,
11504 ALC861VD_FIX_DALLAS,
11505 };
11506
11507 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)11508 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11509 const struct hda_fixup *fix, int action)
11510 {
11511 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11512 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11513 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11514 }
11515 }
11516
11517 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11518 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11519 const struct hda_fixup *fix, int action)
11520 {
11521 struct alc_spec *spec = codec->spec;
11522
11523 if (action == HDA_FIXUP_ACT_PRE_PROBE)
11524 spec->gpio_mask |= 0x02;
11525 alc_fixup_gpio(codec, action, 0x01);
11526 }
11527
11528 static const struct hda_fixup alc861vd_fixups[] = {
11529 [ALC660VD_FIX_ASUS_GPIO1] = {
11530 .type = HDA_FIXUP_FUNC,
11531 .v.func = alc660vd_fixup_asus_gpio1,
11532 },
11533 [ALC861VD_FIX_DALLAS] = {
11534 .type = HDA_FIXUP_FUNC,
11535 .v.func = alc861vd_fixup_dallas,
11536 },
11537 };
11538
11539 static const struct hda_quirk alc861vd_fixup_tbl[] = {
11540 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11541 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11542 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11543 {}
11544 };
11545
11546 /*
11547 */
patch_alc861vd(struct hda_codec * codec)11548 static int patch_alc861vd(struct hda_codec *codec)
11549 {
11550 struct alc_spec *spec;
11551 int err;
11552
11553 err = alc_alloc_spec(codec, 0x0b);
11554 if (err < 0)
11555 return err;
11556
11557 spec = codec->spec;
11558 if (has_cdefine_beep(codec))
11559 spec->gen.beep_nid = 0x23;
11560
11561 spec->shutup = alc_eapd_shutup;
11562
11563 alc_pre_init(codec);
11564
11565 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11566 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11567
11568 /* automatic parse from the BIOS config */
11569 err = alc861vd_parse_auto_config(codec);
11570 if (err < 0)
11571 goto error;
11572
11573 if (!spec->gen.no_analog) {
11574 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11575 if (err < 0)
11576 goto error;
11577 }
11578
11579 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11580
11581 return 0;
11582
11583 error:
11584 alc_free(codec);
11585 return err;
11586 }
11587
11588 /*
11589 * ALC662 support
11590 *
11591 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11592 * configuration. Each pin widget can choose any input DACs and a mixer.
11593 * Each ADC is connected from a mixer of all inputs. This makes possible
11594 * 6-channel independent captures.
11595 *
11596 * In addition, an independent DAC for the multi-playback (not used in this
11597 * driver yet).
11598 */
11599
11600 /*
11601 * BIOS auto configuration
11602 */
11603
alc662_parse_auto_config(struct hda_codec * codec)11604 static int alc662_parse_auto_config(struct hda_codec *codec)
11605 {
11606 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11607 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11608 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11609 const hda_nid_t *ssids;
11610
11611 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11612 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11613 codec->core.vendor_id == 0x10ec0671)
11614 ssids = alc663_ssids;
11615 else
11616 ssids = alc662_ssids;
11617 return alc_parse_auto_config(codec, alc662_ignore, ssids);
11618 }
11619
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)11620 static void alc272_fixup_mario(struct hda_codec *codec,
11621 const struct hda_fixup *fix, int action)
11622 {
11623 if (action != HDA_FIXUP_ACT_PRE_PROBE)
11624 return;
11625 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11626 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11627 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11628 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11629 (0 << AC_AMPCAP_MUTE_SHIFT)))
11630 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11631 }
11632
11633 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11634 { .channels = 2,
11635 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11636 { .channels = 4,
11637 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11638 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11639 { }
11640 };
11641
11642 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)11643 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11644 const struct hda_fixup *fix, int action)
11645 {
11646 if (action == HDA_FIXUP_ACT_BUILD) {
11647 struct alc_spec *spec = codec->spec;
11648 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11649 }
11650 }
11651
11652 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)11653 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11654 hda_nid_t nid,
11655 unsigned int power_state)
11656 {
11657 struct alc_spec *spec = codec->spec;
11658 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11659 return AC_PWRST_D0;
11660 return power_state;
11661 }
11662
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)11663 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11664 const struct hda_fixup *fix, int action)
11665 {
11666 struct alc_spec *spec = codec->spec;
11667
11668 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11669 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11670 spec->mute_led_polarity = 1;
11671 codec->power_filter = gpio_led_power_filter;
11672 }
11673 }
11674
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11675 static void alc662_usi_automute_hook(struct hda_codec *codec,
11676 struct hda_jack_callback *jack)
11677 {
11678 struct alc_spec *spec = codec->spec;
11679 int vref;
11680 msleep(200);
11681 snd_hda_gen_hp_automute(codec, jack);
11682
11683 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11684 msleep(100);
11685 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11686 vref);
11687 }
11688
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11689 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11690 const struct hda_fixup *fix, int action)
11691 {
11692 struct alc_spec *spec = codec->spec;
11693 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11694 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11695 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11696 }
11697 }
11698
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)11699 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11700 struct hda_jack_callback *cb)
11701 {
11702 /* surround speakers at 0x1b already get muted automatically when
11703 * headphones are plugged in, but we have to mute/unmute the remaining
11704 * channels manually:
11705 * 0x15 - front left/front right
11706 * 0x18 - front center/ LFE
11707 */
11708 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11709 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11710 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11711 } else {
11712 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11713 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11714 }
11715 }
11716
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)11717 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11718 const struct hda_fixup *fix, int action)
11719 {
11720 /* Pin 0x1b: shared headphones jack and surround speakers */
11721 if (!is_jack_detectable(codec, 0x1b))
11722 return;
11723
11724 switch (action) {
11725 case HDA_FIXUP_ACT_PRE_PROBE:
11726 snd_hda_jack_detect_enable_callback(codec, 0x1b,
11727 alc662_aspire_ethos_mute_speakers);
11728 /* subwoofer needs an extra GPIO setting to become audible */
11729 alc_setup_gpio(codec, 0x02);
11730 break;
11731 case HDA_FIXUP_ACT_INIT:
11732 /* Make sure to start in a correct state, i.e. if
11733 * headphones have been plugged in before powering up the system
11734 */
11735 alc662_aspire_ethos_mute_speakers(codec, NULL);
11736 break;
11737 }
11738 }
11739
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)11740 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11741 const struct hda_fixup *fix, int action)
11742 {
11743 struct alc_spec *spec = codec->spec;
11744
11745 static const struct hda_pintbl pincfgs[] = {
11746 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11747 { 0x1b, 0x0181304f },
11748 { }
11749 };
11750
11751 switch (action) {
11752 case HDA_FIXUP_ACT_PRE_PROBE:
11753 spec->gen.mixer_nid = 0;
11754 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11755 snd_hda_apply_pincfgs(codec, pincfgs);
11756 break;
11757 case HDA_FIXUP_ACT_INIT:
11758 alc_write_coef_idx(codec, 0x19, 0xa054);
11759 break;
11760 }
11761 }
11762
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)11763 static void alc897_hp_automute_hook(struct hda_codec *codec,
11764 struct hda_jack_callback *jack)
11765 {
11766 struct alc_spec *spec = codec->spec;
11767 int vref;
11768
11769 snd_hda_gen_hp_automute(codec, jack);
11770 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11771 snd_hda_set_pin_ctl(codec, 0x1b, vref);
11772 }
11773
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)11774 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11775 const struct hda_fixup *fix, int action)
11776 {
11777 struct alc_spec *spec = codec->spec;
11778 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11779 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11780 spec->no_shutup_pins = 1;
11781 }
11782 if (action == HDA_FIXUP_ACT_PROBE) {
11783 snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
11784 }
11785 }
11786
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)11787 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11788 const struct hda_fixup *fix, int action)
11789 {
11790 struct alc_spec *spec = codec->spec;
11791
11792 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11793 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11794 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11795 }
11796 }
11797
11798 static const struct coef_fw alc668_coefs[] = {
11799 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
11800 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
11801 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
11802 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11803 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11804 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11805 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
11806 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
11807 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11808 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11809 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11810 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11811 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
11812 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11813 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
11814 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
11815 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11816 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11817 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11818 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11819 {}
11820 };
11821
alc668_restore_default_value(struct hda_codec * codec)11822 static void alc668_restore_default_value(struct hda_codec *codec)
11823 {
11824 alc_process_coef_fw(codec, alc668_coefs);
11825 }
11826
11827 enum {
11828 ALC662_FIXUP_ASPIRE,
11829 ALC662_FIXUP_LED_GPIO1,
11830 ALC662_FIXUP_IDEAPAD,
11831 ALC272_FIXUP_MARIO,
11832 ALC662_FIXUP_CZC_ET26,
11833 ALC662_FIXUP_CZC_P10T,
11834 ALC662_FIXUP_SKU_IGNORE,
11835 ALC662_FIXUP_HP_RP5800,
11836 ALC662_FIXUP_ASUS_MODE1,
11837 ALC662_FIXUP_ASUS_MODE2,
11838 ALC662_FIXUP_ASUS_MODE3,
11839 ALC662_FIXUP_ASUS_MODE4,
11840 ALC662_FIXUP_ASUS_MODE5,
11841 ALC662_FIXUP_ASUS_MODE6,
11842 ALC662_FIXUP_ASUS_MODE7,
11843 ALC662_FIXUP_ASUS_MODE8,
11844 ALC662_FIXUP_NO_JACK_DETECT,
11845 ALC662_FIXUP_ZOTAC_Z68,
11846 ALC662_FIXUP_INV_DMIC,
11847 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11848 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11849 ALC662_FIXUP_HEADSET_MODE,
11850 ALC668_FIXUP_HEADSET_MODE,
11851 ALC662_FIXUP_BASS_MODE4_CHMAP,
11852 ALC662_FIXUP_BASS_16,
11853 ALC662_FIXUP_BASS_1A,
11854 ALC662_FIXUP_BASS_CHMAP,
11855 ALC668_FIXUP_AUTO_MUTE,
11856 ALC668_FIXUP_DELL_DISABLE_AAMIX,
11857 ALC668_FIXUP_DELL_XPS13,
11858 ALC662_FIXUP_ASUS_Nx50,
11859 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11860 ALC668_FIXUP_ASUS_Nx51,
11861 ALC668_FIXUP_MIC_COEF,
11862 ALC668_FIXUP_ASUS_G751,
11863 ALC891_FIXUP_HEADSET_MODE,
11864 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11865 ALC662_FIXUP_ACER_VERITON,
11866 ALC892_FIXUP_ASROCK_MOBO,
11867 ALC662_FIXUP_USI_FUNC,
11868 ALC662_FIXUP_USI_HEADSET_MODE,
11869 ALC662_FIXUP_LENOVO_MULTI_CODECS,
11870 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11871 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11872 ALC671_FIXUP_HP_HEADSET_MIC2,
11873 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11874 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11875 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11876 ALC668_FIXUP_HEADSET_MIC,
11877 ALC668_FIXUP_MIC_DET_COEF,
11878 ALC897_FIXUP_LENOVO_HEADSET_MIC,
11879 ALC897_FIXUP_HEADSET_MIC_PIN,
11880 ALC897_FIXUP_HP_HSMIC_VERB,
11881 ALC897_FIXUP_LENOVO_HEADSET_MODE,
11882 ALC897_FIXUP_HEADSET_MIC_PIN2,
11883 ALC897_FIXUP_UNIS_H3C_X500S,
11884 ALC897_FIXUP_HEADSET_MIC_PIN3,
11885 };
11886
11887 static const struct hda_fixup alc662_fixups[] = {
11888 [ALC662_FIXUP_ASPIRE] = {
11889 .type = HDA_FIXUP_PINS,
11890 .v.pins = (const struct hda_pintbl[]) {
11891 { 0x15, 0x99130112 }, /* subwoofer */
11892 { }
11893 }
11894 },
11895 [ALC662_FIXUP_LED_GPIO1] = {
11896 .type = HDA_FIXUP_FUNC,
11897 .v.func = alc662_fixup_led_gpio1,
11898 },
11899 [ALC662_FIXUP_IDEAPAD] = {
11900 .type = HDA_FIXUP_PINS,
11901 .v.pins = (const struct hda_pintbl[]) {
11902 { 0x17, 0x99130112 }, /* subwoofer */
11903 { }
11904 },
11905 .chained = true,
11906 .chain_id = ALC662_FIXUP_LED_GPIO1,
11907 },
11908 [ALC272_FIXUP_MARIO] = {
11909 .type = HDA_FIXUP_FUNC,
11910 .v.func = alc272_fixup_mario,
11911 },
11912 [ALC662_FIXUP_CZC_ET26] = {
11913 .type = HDA_FIXUP_PINS,
11914 .v.pins = (const struct hda_pintbl[]) {
11915 {0x12, 0x403cc000},
11916 {0x14, 0x90170110}, /* speaker */
11917 {0x15, 0x411111f0},
11918 {0x16, 0x411111f0},
11919 {0x18, 0x01a19030}, /* mic */
11920 {0x19, 0x90a7013f}, /* int-mic */
11921 {0x1a, 0x01014020},
11922 {0x1b, 0x0121401f},
11923 {0x1c, 0x411111f0},
11924 {0x1d, 0x411111f0},
11925 {0x1e, 0x40478e35},
11926 {}
11927 },
11928 .chained = true,
11929 .chain_id = ALC662_FIXUP_SKU_IGNORE
11930 },
11931 [ALC662_FIXUP_CZC_P10T] = {
11932 .type = HDA_FIXUP_VERBS,
11933 .v.verbs = (const struct hda_verb[]) {
11934 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11935 {}
11936 }
11937 },
11938 [ALC662_FIXUP_SKU_IGNORE] = {
11939 .type = HDA_FIXUP_FUNC,
11940 .v.func = alc_fixup_sku_ignore,
11941 },
11942 [ALC662_FIXUP_HP_RP5800] = {
11943 .type = HDA_FIXUP_PINS,
11944 .v.pins = (const struct hda_pintbl[]) {
11945 { 0x14, 0x0221201f }, /* HP out */
11946 { }
11947 },
11948 .chained = true,
11949 .chain_id = ALC662_FIXUP_SKU_IGNORE
11950 },
11951 [ALC662_FIXUP_ASUS_MODE1] = {
11952 .type = HDA_FIXUP_PINS,
11953 .v.pins = (const struct hda_pintbl[]) {
11954 { 0x14, 0x99130110 }, /* speaker */
11955 { 0x18, 0x01a19c20 }, /* mic */
11956 { 0x19, 0x99a3092f }, /* int-mic */
11957 { 0x21, 0x0121401f }, /* HP out */
11958 { }
11959 },
11960 .chained = true,
11961 .chain_id = ALC662_FIXUP_SKU_IGNORE
11962 },
11963 [ALC662_FIXUP_ASUS_MODE2] = {
11964 .type = HDA_FIXUP_PINS,
11965 .v.pins = (const struct hda_pintbl[]) {
11966 { 0x14, 0x99130110 }, /* speaker */
11967 { 0x18, 0x01a19820 }, /* mic */
11968 { 0x19, 0x99a3092f }, /* int-mic */
11969 { 0x1b, 0x0121401f }, /* HP out */
11970 { }
11971 },
11972 .chained = true,
11973 .chain_id = ALC662_FIXUP_SKU_IGNORE
11974 },
11975 [ALC662_FIXUP_ASUS_MODE3] = {
11976 .type = HDA_FIXUP_PINS,
11977 .v.pins = (const struct hda_pintbl[]) {
11978 { 0x14, 0x99130110 }, /* speaker */
11979 { 0x15, 0x0121441f }, /* HP */
11980 { 0x18, 0x01a19840 }, /* mic */
11981 { 0x19, 0x99a3094f }, /* int-mic */
11982 { 0x21, 0x01211420 }, /* HP2 */
11983 { }
11984 },
11985 .chained = true,
11986 .chain_id = ALC662_FIXUP_SKU_IGNORE
11987 },
11988 [ALC662_FIXUP_ASUS_MODE4] = {
11989 .type = HDA_FIXUP_PINS,
11990 .v.pins = (const struct hda_pintbl[]) {
11991 { 0x14, 0x99130110 }, /* speaker */
11992 { 0x16, 0x99130111 }, /* speaker */
11993 { 0x18, 0x01a19840 }, /* mic */
11994 { 0x19, 0x99a3094f }, /* int-mic */
11995 { 0x21, 0x0121441f }, /* HP */
11996 { }
11997 },
11998 .chained = true,
11999 .chain_id = ALC662_FIXUP_SKU_IGNORE
12000 },
12001 [ALC662_FIXUP_ASUS_MODE5] = {
12002 .type = HDA_FIXUP_PINS,
12003 .v.pins = (const struct hda_pintbl[]) {
12004 { 0x14, 0x99130110 }, /* speaker */
12005 { 0x15, 0x0121441f }, /* HP */
12006 { 0x16, 0x99130111 }, /* speaker */
12007 { 0x18, 0x01a19840 }, /* mic */
12008 { 0x19, 0x99a3094f }, /* int-mic */
12009 { }
12010 },
12011 .chained = true,
12012 .chain_id = ALC662_FIXUP_SKU_IGNORE
12013 },
12014 [ALC662_FIXUP_ASUS_MODE6] = {
12015 .type = HDA_FIXUP_PINS,
12016 .v.pins = (const struct hda_pintbl[]) {
12017 { 0x14, 0x99130110 }, /* speaker */
12018 { 0x15, 0x01211420 }, /* HP2 */
12019 { 0x18, 0x01a19840 }, /* mic */
12020 { 0x19, 0x99a3094f }, /* int-mic */
12021 { 0x1b, 0x0121441f }, /* HP */
12022 { }
12023 },
12024 .chained = true,
12025 .chain_id = ALC662_FIXUP_SKU_IGNORE
12026 },
12027 [ALC662_FIXUP_ASUS_MODE7] = {
12028 .type = HDA_FIXUP_PINS,
12029 .v.pins = (const struct hda_pintbl[]) {
12030 { 0x14, 0x99130110 }, /* speaker */
12031 { 0x17, 0x99130111 }, /* speaker */
12032 { 0x18, 0x01a19840 }, /* mic */
12033 { 0x19, 0x99a3094f }, /* int-mic */
12034 { 0x1b, 0x01214020 }, /* HP */
12035 { 0x21, 0x0121401f }, /* HP */
12036 { }
12037 },
12038 .chained = true,
12039 .chain_id = ALC662_FIXUP_SKU_IGNORE
12040 },
12041 [ALC662_FIXUP_ASUS_MODE8] = {
12042 .type = HDA_FIXUP_PINS,
12043 .v.pins = (const struct hda_pintbl[]) {
12044 { 0x14, 0x99130110 }, /* speaker */
12045 { 0x12, 0x99a30970 }, /* int-mic */
12046 { 0x15, 0x01214020 }, /* HP */
12047 { 0x17, 0x99130111 }, /* speaker */
12048 { 0x18, 0x01a19840 }, /* mic */
12049 { 0x21, 0x0121401f }, /* HP */
12050 { }
12051 },
12052 .chained = true,
12053 .chain_id = ALC662_FIXUP_SKU_IGNORE
12054 },
12055 [ALC662_FIXUP_NO_JACK_DETECT] = {
12056 .type = HDA_FIXUP_FUNC,
12057 .v.func = alc_fixup_no_jack_detect,
12058 },
12059 [ALC662_FIXUP_ZOTAC_Z68] = {
12060 .type = HDA_FIXUP_PINS,
12061 .v.pins = (const struct hda_pintbl[]) {
12062 { 0x1b, 0x02214020 }, /* Front HP */
12063 { }
12064 }
12065 },
12066 [ALC662_FIXUP_INV_DMIC] = {
12067 .type = HDA_FIXUP_FUNC,
12068 .v.func = alc_fixup_inv_dmic,
12069 },
12070 [ALC668_FIXUP_DELL_XPS13] = {
12071 .type = HDA_FIXUP_FUNC,
12072 .v.func = alc_fixup_dell_xps13,
12073 .chained = true,
12074 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12075 },
12076 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12077 .type = HDA_FIXUP_FUNC,
12078 .v.func = alc_fixup_disable_aamix,
12079 .chained = true,
12080 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12081 },
12082 [ALC668_FIXUP_AUTO_MUTE] = {
12083 .type = HDA_FIXUP_FUNC,
12084 .v.func = alc_fixup_auto_mute_via_amp,
12085 .chained = true,
12086 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12087 },
12088 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12089 .type = HDA_FIXUP_PINS,
12090 .v.pins = (const struct hda_pintbl[]) {
12091 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12092 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12093 { }
12094 },
12095 .chained = true,
12096 .chain_id = ALC662_FIXUP_HEADSET_MODE
12097 },
12098 [ALC662_FIXUP_HEADSET_MODE] = {
12099 .type = HDA_FIXUP_FUNC,
12100 .v.func = alc_fixup_headset_mode_alc662,
12101 },
12102 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12103 .type = HDA_FIXUP_PINS,
12104 .v.pins = (const struct hda_pintbl[]) {
12105 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12106 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12107 { }
12108 },
12109 .chained = true,
12110 .chain_id = ALC668_FIXUP_HEADSET_MODE
12111 },
12112 [ALC668_FIXUP_HEADSET_MODE] = {
12113 .type = HDA_FIXUP_FUNC,
12114 .v.func = alc_fixup_headset_mode_alc668,
12115 },
12116 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12117 .type = HDA_FIXUP_FUNC,
12118 .v.func = alc_fixup_bass_chmap,
12119 .chained = true,
12120 .chain_id = ALC662_FIXUP_ASUS_MODE4
12121 },
12122 [ALC662_FIXUP_BASS_16] = {
12123 .type = HDA_FIXUP_PINS,
12124 .v.pins = (const struct hda_pintbl[]) {
12125 {0x16, 0x80106111}, /* bass speaker */
12126 {}
12127 },
12128 .chained = true,
12129 .chain_id = ALC662_FIXUP_BASS_CHMAP,
12130 },
12131 [ALC662_FIXUP_BASS_1A] = {
12132 .type = HDA_FIXUP_PINS,
12133 .v.pins = (const struct hda_pintbl[]) {
12134 {0x1a, 0x80106111}, /* bass speaker */
12135 {}
12136 },
12137 .chained = true,
12138 .chain_id = ALC662_FIXUP_BASS_CHMAP,
12139 },
12140 [ALC662_FIXUP_BASS_CHMAP] = {
12141 .type = HDA_FIXUP_FUNC,
12142 .v.func = alc_fixup_bass_chmap,
12143 },
12144 [ALC662_FIXUP_ASUS_Nx50] = {
12145 .type = HDA_FIXUP_FUNC,
12146 .v.func = alc_fixup_auto_mute_via_amp,
12147 .chained = true,
12148 .chain_id = ALC662_FIXUP_BASS_1A
12149 },
12150 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12151 .type = HDA_FIXUP_FUNC,
12152 .v.func = alc_fixup_headset_mode_alc668,
12153 .chain_id = ALC662_FIXUP_BASS_CHMAP
12154 },
12155 [ALC668_FIXUP_ASUS_Nx51] = {
12156 .type = HDA_FIXUP_PINS,
12157 .v.pins = (const struct hda_pintbl[]) {
12158 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12159 { 0x1a, 0x90170151 }, /* bass speaker */
12160 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12161 {}
12162 },
12163 .chained = true,
12164 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12165 },
12166 [ALC668_FIXUP_MIC_COEF] = {
12167 .type = HDA_FIXUP_VERBS,
12168 .v.verbs = (const struct hda_verb[]) {
12169 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12170 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12171 {}
12172 },
12173 },
12174 [ALC668_FIXUP_ASUS_G751] = {
12175 .type = HDA_FIXUP_PINS,
12176 .v.pins = (const struct hda_pintbl[]) {
12177 { 0x16, 0x0421101f }, /* HP */
12178 {}
12179 },
12180 .chained = true,
12181 .chain_id = ALC668_FIXUP_MIC_COEF
12182 },
12183 [ALC891_FIXUP_HEADSET_MODE] = {
12184 .type = HDA_FIXUP_FUNC,
12185 .v.func = alc_fixup_headset_mode,
12186 },
12187 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12188 .type = HDA_FIXUP_PINS,
12189 .v.pins = (const struct hda_pintbl[]) {
12190 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12191 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12192 { }
12193 },
12194 .chained = true,
12195 .chain_id = ALC891_FIXUP_HEADSET_MODE
12196 },
12197 [ALC662_FIXUP_ACER_VERITON] = {
12198 .type = HDA_FIXUP_PINS,
12199 .v.pins = (const struct hda_pintbl[]) {
12200 { 0x15, 0x50170120 }, /* no internal speaker */
12201 { }
12202 }
12203 },
12204 [ALC892_FIXUP_ASROCK_MOBO] = {
12205 .type = HDA_FIXUP_PINS,
12206 .v.pins = (const struct hda_pintbl[]) {
12207 { 0x15, 0x40f000f0 }, /* disabled */
12208 { 0x16, 0x40f000f0 }, /* disabled */
12209 { }
12210 }
12211 },
12212 [ALC662_FIXUP_USI_FUNC] = {
12213 .type = HDA_FIXUP_FUNC,
12214 .v.func = alc662_fixup_usi_headset_mic,
12215 },
12216 [ALC662_FIXUP_USI_HEADSET_MODE] = {
12217 .type = HDA_FIXUP_PINS,
12218 .v.pins = (const struct hda_pintbl[]) {
12219 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12220 { 0x18, 0x01a1903d },
12221 { }
12222 },
12223 .chained = true,
12224 .chain_id = ALC662_FIXUP_USI_FUNC
12225 },
12226 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12227 .type = HDA_FIXUP_FUNC,
12228 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12229 },
12230 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12231 .type = HDA_FIXUP_FUNC,
12232 .v.func = alc662_fixup_aspire_ethos_hp,
12233 },
12234 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12235 .type = HDA_FIXUP_PINS,
12236 .v.pins = (const struct hda_pintbl[]) {
12237 { 0x15, 0x92130110 }, /* front speakers */
12238 { 0x18, 0x99130111 }, /* center/subwoofer */
12239 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
12240 { }
12241 },
12242 .chained = true,
12243 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12244 },
12245 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
12246 .type = HDA_FIXUP_FUNC,
12247 .v.func = alc671_fixup_hp_headset_mic2,
12248 },
12249 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12250 .type = HDA_FIXUP_PINS,
12251 .v.pins = (const struct hda_pintbl[]) {
12252 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12253 { }
12254 },
12255 .chained = true,
12256 .chain_id = ALC662_FIXUP_USI_FUNC
12257 },
12258 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12259 .type = HDA_FIXUP_PINS,
12260 .v.pins = (const struct hda_pintbl[]) {
12261 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12262 { 0x1b, 0x0221144f },
12263 { }
12264 },
12265 .chained = true,
12266 .chain_id = ALC662_FIXUP_USI_FUNC
12267 },
12268 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12269 .type = HDA_FIXUP_PINS,
12270 .v.pins = (const struct hda_pintbl[]) {
12271 { 0x1b, 0x04a1112c },
12272 { }
12273 },
12274 .chained = true,
12275 .chain_id = ALC668_FIXUP_HEADSET_MIC
12276 },
12277 [ALC668_FIXUP_HEADSET_MIC] = {
12278 .type = HDA_FIXUP_FUNC,
12279 .v.func = alc269_fixup_headset_mic,
12280 .chained = true,
12281 .chain_id = ALC668_FIXUP_MIC_DET_COEF
12282 },
12283 [ALC668_FIXUP_MIC_DET_COEF] = {
12284 .type = HDA_FIXUP_VERBS,
12285 .v.verbs = (const struct hda_verb[]) {
12286 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12287 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12288 {}
12289 },
12290 },
12291 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12292 .type = HDA_FIXUP_FUNC,
12293 .v.func = alc897_fixup_lenovo_headset_mic,
12294 },
12295 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
12296 .type = HDA_FIXUP_PINS,
12297 .v.pins = (const struct hda_pintbl[]) {
12298 { 0x1a, 0x03a11050 },
12299 { }
12300 },
12301 .chained = true,
12302 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12303 },
12304 [ALC897_FIXUP_HP_HSMIC_VERB] = {
12305 .type = HDA_FIXUP_PINS,
12306 .v.pins = (const struct hda_pintbl[]) {
12307 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12308 { }
12309 },
12310 },
12311 [ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12312 .type = HDA_FIXUP_FUNC,
12313 .v.func = alc897_fixup_lenovo_headset_mode,
12314 },
12315 [ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12316 .type = HDA_FIXUP_PINS,
12317 .v.pins = (const struct hda_pintbl[]) {
12318 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12319 { }
12320 },
12321 .chained = true,
12322 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12323 },
12324 [ALC897_FIXUP_UNIS_H3C_X500S] = {
12325 .type = HDA_FIXUP_VERBS,
12326 .v.verbs = (const struct hda_verb[]) {
12327 { 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12328 {}
12329 },
12330 },
12331 [ALC897_FIXUP_HEADSET_MIC_PIN3] = {
12332 .type = HDA_FIXUP_PINS,
12333 .v.pins = (const struct hda_pintbl[]) {
12334 { 0x19, 0x03a11050 }, /* use as headset mic */
12335 { }
12336 },
12337 },
12338 };
12339
12340 static const struct hda_quirk alc662_fixup_tbl[] = {
12341 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12342 SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
12343 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12344 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12345 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12346 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12347 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12348 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12349 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12350 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12351 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12352 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12353 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12354 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12355 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12356 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12357 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12358 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12359 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12360 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12361 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12362 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12363 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12364 SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12365 SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12366 SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12367 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12368 SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12369 SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12370 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12371 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12372 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12373 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12374 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12375 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12376 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12377 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12378 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12379 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12380 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12381 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12382 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12383 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12384 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12385 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12386 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12387 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12388 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12389 SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12390 SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12391 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12392 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12393 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12394 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12395 SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12396 SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12397 SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12398 SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12399 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12400 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12401 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12402 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12403 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12404 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12405 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12406 SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12407
12408 #if 0
12409 /* Below is a quirk table taken from the old code.
12410 * Basically the device should work as is without the fixup table.
12411 * If BIOS doesn't give a proper info, enable the corresponding
12412 * fixup entry.
12413 */
12414 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12415 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12416 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12417 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12418 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12419 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12420 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12421 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12422 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12423 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12424 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12425 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12426 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12427 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12428 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12429 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12430 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12431 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12432 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12433 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12434 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12435 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12436 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12437 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12438 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12439 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12440 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12441 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12442 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12443 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12444 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12445 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12446 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12447 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12448 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12449 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12450 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12451 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12452 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12453 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12454 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12455 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12456 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12457 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12458 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12459 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12460 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12461 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12462 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12463 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12464 #endif
12465 {}
12466 };
12467
12468 static const struct hda_model_fixup alc662_fixup_models[] = {
12469 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12470 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12471 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
12472 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12473 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12474 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12475 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12476 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12477 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12478 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12479 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12480 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12481 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12482 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12483 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12484 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12485 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12486 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12487 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12488 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12489 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12490 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12491 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12492 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12493 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12494 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12495 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12496 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12497 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12498 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12499 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12500 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12501 {.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12502 {}
12503 };
12504
12505 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12506 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12507 {0x17, 0x02211010},
12508 {0x18, 0x01a19030},
12509 {0x1a, 0x01813040},
12510 {0x21, 0x01014020}),
12511 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12512 {0x16, 0x01813030},
12513 {0x17, 0x02211010},
12514 {0x18, 0x01a19040},
12515 {0x21, 0x01014020}),
12516 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12517 {0x14, 0x01014010},
12518 {0x18, 0x01a19020},
12519 {0x1a, 0x0181302f},
12520 {0x1b, 0x0221401f}),
12521 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12522 {0x12, 0x99a30130},
12523 {0x14, 0x90170110},
12524 {0x15, 0x0321101f},
12525 {0x16, 0x03011020}),
12526 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12527 {0x12, 0x99a30140},
12528 {0x14, 0x90170110},
12529 {0x15, 0x0321101f},
12530 {0x16, 0x03011020}),
12531 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12532 {0x12, 0x99a30150},
12533 {0x14, 0x90170110},
12534 {0x15, 0x0321101f},
12535 {0x16, 0x03011020}),
12536 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12537 {0x14, 0x90170110},
12538 {0x15, 0x0321101f},
12539 {0x16, 0x03011020}),
12540 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12541 {0x12, 0x90a60130},
12542 {0x14, 0x90170110},
12543 {0x15, 0x0321101f}),
12544 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12545 {0x14, 0x01014010},
12546 {0x17, 0x90170150},
12547 {0x19, 0x02a11060},
12548 {0x1b, 0x01813030},
12549 {0x21, 0x02211020}),
12550 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12551 {0x14, 0x01014010},
12552 {0x18, 0x01a19040},
12553 {0x1b, 0x01813030},
12554 {0x21, 0x02211020}),
12555 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12556 {0x14, 0x01014020},
12557 {0x17, 0x90170110},
12558 {0x18, 0x01a19050},
12559 {0x1b, 0x01813040},
12560 {0x21, 0x02211030}),
12561 {}
12562 };
12563
12564 /*
12565 */
patch_alc662(struct hda_codec * codec)12566 static int patch_alc662(struct hda_codec *codec)
12567 {
12568 struct alc_spec *spec;
12569 int err;
12570
12571 err = alc_alloc_spec(codec, 0x0b);
12572 if (err < 0)
12573 return err;
12574
12575 spec = codec->spec;
12576
12577 spec->shutup = alc_eapd_shutup;
12578
12579 /* handle multiple HPs as is */
12580 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12581
12582 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12583
12584 switch (codec->core.vendor_id) {
12585 case 0x10ec0668:
12586 spec->init_hook = alc668_restore_default_value;
12587 break;
12588 }
12589
12590 alc_pre_init(codec);
12591
12592 snd_hda_pick_fixup(codec, alc662_fixup_models,
12593 alc662_fixup_tbl, alc662_fixups);
12594 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12595 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12596
12597 alc_auto_parse_customize_define(codec);
12598
12599 if (has_cdefine_beep(codec))
12600 spec->gen.beep_nid = 0x01;
12601
12602 if ((alc_get_coef0(codec) & (1 << 14)) &&
12603 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12604 spec->cdefine.platform_type == 1) {
12605 err = alc_codec_rename(codec, "ALC272X");
12606 if (err < 0)
12607 goto error;
12608 }
12609
12610 /* automatic parse from the BIOS config */
12611 err = alc662_parse_auto_config(codec);
12612 if (err < 0)
12613 goto error;
12614
12615 if (!spec->gen.no_analog && spec->gen.beep_nid) {
12616 switch (codec->core.vendor_id) {
12617 case 0x10ec0662:
12618 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12619 break;
12620 case 0x10ec0272:
12621 case 0x10ec0663:
12622 case 0x10ec0665:
12623 case 0x10ec0668:
12624 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12625 break;
12626 case 0x10ec0273:
12627 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12628 break;
12629 }
12630 if (err < 0)
12631 goto error;
12632 }
12633
12634 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12635
12636 return 0;
12637
12638 error:
12639 alc_free(codec);
12640 return err;
12641 }
12642
12643 /*
12644 * ALC680 support
12645 */
12646
alc680_parse_auto_config(struct hda_codec * codec)12647 static int alc680_parse_auto_config(struct hda_codec *codec)
12648 {
12649 return alc_parse_auto_config(codec, NULL, NULL);
12650 }
12651
12652 /*
12653 */
patch_alc680(struct hda_codec * codec)12654 static int patch_alc680(struct hda_codec *codec)
12655 {
12656 int err;
12657
12658 /* ALC680 has no aa-loopback mixer */
12659 err = alc_alloc_spec(codec, 0);
12660 if (err < 0)
12661 return err;
12662
12663 /* automatic parse from the BIOS config */
12664 err = alc680_parse_auto_config(codec);
12665 if (err < 0) {
12666 alc_free(codec);
12667 return err;
12668 }
12669
12670 return 0;
12671 }
12672
12673 /*
12674 * patch entries
12675 */
12676 static const struct hda_device_id snd_hda_id_realtek[] = {
12677 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12678 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12679 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12680 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12681 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12682 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12683 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12684 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12685 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12686 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12687 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12688 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12689 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12690 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12691 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12692 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12693 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12694 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12695 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12696 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12697 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12698 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12699 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12700 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12701 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12702 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12703 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12704 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12705 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12706 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12707 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12708 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12709 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12710 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12711 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12712 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12713 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12714 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12715 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12716 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12717 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12718 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12719 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12720 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12721 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12722 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12723 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12724 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12725 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12726 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12727 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12728 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12729 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12730 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12731 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12732 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12733 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12734 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12735 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12736 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12737 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12738 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12739 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12740 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12741 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12742 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12743 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12744 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12745 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12746 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12747 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12748 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12749 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12750 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12751 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12752 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12753 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12754 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12755 HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12756 {} /* terminator */
12757 };
12758 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12759
12760 MODULE_LICENSE("GPL");
12761 MODULE_DESCRIPTION("Realtek HD-audio codec");
12762
12763 static struct hda_codec_driver realtek_driver = {
12764 .id = snd_hda_id_realtek,
12765 };
12766
12767 module_hda_codec_driver(realtek_driver);
12768