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/acpi.h>
14 #include <linux/cleanup.h>
15 #include <linux/init.h>
16 #include <linux/delay.h>
17 #include <linux/slab.h>
18 #include <linux/pci.h>
19 #include <linux/dmi.h>
20 #include <linux/module.h>
21 #include <linux/i2c.h>
22 #include <linux/input.h>
23 #include <linux/leds.h>
24 #include <linux/ctype.h>
25 #include <linux/spi/spi.h>
26 #include <sound/core.h>
27 #include <sound/jack.h>
28 #include <sound/hda_codec.h>
29 #include "hda_local.h"
30 #include "hda_auto_parser.h"
31 #include "hda_jack.h"
32 #include "hda_generic.h"
33 #include "hda_component.h"
34
35 /* keep halting ALC5505 DSP, for power saving */
36 #define HALT_REALTEK_ALC5505
37
38 /* extra amp-initialization sequence types */
39 enum {
40 ALC_INIT_UNDEFINED,
41 ALC_INIT_NONE,
42 ALC_INIT_DEFAULT,
43 };
44
45 enum {
46 ALC_HEADSET_MODE_UNKNOWN,
47 ALC_HEADSET_MODE_UNPLUGGED,
48 ALC_HEADSET_MODE_HEADSET,
49 ALC_HEADSET_MODE_MIC,
50 ALC_HEADSET_MODE_HEADPHONE,
51 };
52
53 enum {
54 ALC_HEADSET_TYPE_UNKNOWN,
55 ALC_HEADSET_TYPE_CTIA,
56 ALC_HEADSET_TYPE_OMTP,
57 };
58
59 enum {
60 ALC_KEY_MICMUTE_INDEX,
61 };
62
63 struct alc_customize_define {
64 unsigned int sku_cfg;
65 unsigned char port_connectivity;
66 unsigned char check_sum;
67 unsigned char customization;
68 unsigned char external_amp;
69 unsigned int enable_pcbeep:1;
70 unsigned int platform_type:1;
71 unsigned int swap:1;
72 unsigned int override:1;
73 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
74 };
75
76 struct alc_coef_led {
77 unsigned int idx;
78 unsigned int mask;
79 unsigned int on;
80 unsigned int off;
81 };
82
83 struct alc_spec {
84 struct hda_gen_spec gen; /* must be at head */
85
86 /* codec parameterization */
87 struct alc_customize_define cdefine;
88 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
89
90 /* GPIO bits */
91 unsigned int gpio_mask;
92 unsigned int gpio_dir;
93 unsigned int gpio_data;
94 bool gpio_write_delay; /* add a delay before writing gpio_data */
95
96 /* mute LED for HP laptops, see vref_mute_led_set() */
97 int mute_led_polarity;
98 int micmute_led_polarity;
99 hda_nid_t mute_led_nid;
100 hda_nid_t cap_mute_led_nid;
101
102 unsigned int gpio_mute_led_mask;
103 unsigned int gpio_mic_led_mask;
104 struct alc_coef_led mute_led_coef;
105 struct alc_coef_led mic_led_coef;
106 struct mutex coef_mutex;
107
108 hda_nid_t headset_mic_pin;
109 hda_nid_t headphone_mic_pin;
110 int current_headset_mode;
111 int current_headset_type;
112
113 /* hooks */
114 void (*init_hook)(struct hda_codec *codec);
115 void (*power_hook)(struct hda_codec *codec);
116 void (*shutup)(struct hda_codec *codec);
117
118 int init_amp;
119 int codec_variant; /* flag for other variants */
120 unsigned int has_alc5505_dsp:1;
121 unsigned int no_depop_delay:1;
122 unsigned int done_hp_init:1;
123 unsigned int no_shutup_pins:1;
124 unsigned int ultra_low_power:1;
125 unsigned int has_hs_key:1;
126 unsigned int no_internal_mic_pin:1;
127 unsigned int en_3kpull_low:1;
128 int num_speaker_amps;
129
130 /* for PLL fix */
131 hda_nid_t pll_nid;
132 unsigned int pll_coef_idx, pll_coef_bit;
133 unsigned int coef0;
134 struct input_dev *kb_dev;
135 u8 alc_mute_keycode_map[1];
136
137 /* component binding */
138 struct hda_component_parent comps;
139 };
140
141 /*
142 * COEF access helper functions
143 */
144
coef_mutex_lock(struct hda_codec * codec)145 static void coef_mutex_lock(struct hda_codec *codec)
146 {
147 struct alc_spec *spec = codec->spec;
148
149 snd_hda_power_up_pm(codec);
150 mutex_lock(&spec->coef_mutex);
151 }
152
coef_mutex_unlock(struct hda_codec * codec)153 static void coef_mutex_unlock(struct hda_codec *codec)
154 {
155 struct alc_spec *spec = codec->spec;
156
157 mutex_unlock(&spec->coef_mutex);
158 snd_hda_power_down_pm(codec);
159 }
160
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)161 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
162 unsigned int coef_idx)
163 {
164 unsigned int val;
165
166 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
167 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
168 return val;
169 }
170
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)171 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
172 unsigned int coef_idx)
173 {
174 unsigned int val;
175
176 coef_mutex_lock(codec);
177 val = __alc_read_coefex_idx(codec, nid, coef_idx);
178 coef_mutex_unlock(codec);
179 return val;
180 }
181
182 #define alc_read_coef_idx(codec, coef_idx) \
183 alc_read_coefex_idx(codec, 0x20, coef_idx)
184
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)185 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
186 unsigned int coef_idx, unsigned int coef_val)
187 {
188 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
189 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
190 }
191
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)192 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
193 unsigned int coef_idx, unsigned int coef_val)
194 {
195 coef_mutex_lock(codec);
196 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
197 coef_mutex_unlock(codec);
198 }
199
200 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
201 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
202
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)203 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
204 unsigned int coef_idx, unsigned int mask,
205 unsigned int bits_set)
206 {
207 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
208
209 if (val != -1)
210 __alc_write_coefex_idx(codec, nid, coef_idx,
211 (val & ~mask) | bits_set);
212 }
213
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)214 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
215 unsigned int coef_idx, unsigned int mask,
216 unsigned int bits_set)
217 {
218 coef_mutex_lock(codec);
219 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
220 coef_mutex_unlock(codec);
221 }
222
223 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
224 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
225
226 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)227 static unsigned int alc_get_coef0(struct hda_codec *codec)
228 {
229 struct alc_spec *spec = codec->spec;
230
231 if (!spec->coef0)
232 spec->coef0 = alc_read_coef_idx(codec, 0);
233 return spec->coef0;
234 }
235
236 /* coef writes/updates batch */
237 struct coef_fw {
238 unsigned char nid;
239 unsigned char idx;
240 unsigned short mask;
241 unsigned short val;
242 };
243
244 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
245 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
246 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
247 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
248 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
249
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)250 static void alc_process_coef_fw(struct hda_codec *codec,
251 const struct coef_fw *fw)
252 {
253 coef_mutex_lock(codec);
254 for (; fw->nid; fw++) {
255 if (fw->mask == (unsigned short)-1)
256 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
257 else
258 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
259 fw->mask, fw->val);
260 }
261 coef_mutex_unlock(codec);
262 }
263
264 /*
265 * GPIO setup tables, used in initialization
266 */
267
268 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)269 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
270 {
271 struct alc_spec *spec = codec->spec;
272
273 spec->gpio_mask |= mask;
274 spec->gpio_dir |= mask;
275 spec->gpio_data |= mask;
276 }
277
alc_write_gpio_data(struct hda_codec * codec)278 static void alc_write_gpio_data(struct hda_codec *codec)
279 {
280 struct alc_spec *spec = codec->spec;
281
282 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
283 spec->gpio_data);
284 }
285
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)286 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
287 bool on)
288 {
289 struct alc_spec *spec = codec->spec;
290 unsigned int oldval = spec->gpio_data;
291
292 if (on)
293 spec->gpio_data |= mask;
294 else
295 spec->gpio_data &= ~mask;
296 if (oldval != spec->gpio_data)
297 alc_write_gpio_data(codec);
298 }
299
alc_write_gpio(struct hda_codec * codec)300 static void alc_write_gpio(struct hda_codec *codec)
301 {
302 struct alc_spec *spec = codec->spec;
303
304 if (!spec->gpio_mask)
305 return;
306
307 snd_hda_codec_write(codec, codec->core.afg, 0,
308 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
309 snd_hda_codec_write(codec, codec->core.afg, 0,
310 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
311 if (spec->gpio_write_delay)
312 msleep(1);
313 alc_write_gpio_data(codec);
314 }
315
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)316 static void alc_fixup_gpio(struct hda_codec *codec, int action,
317 unsigned int mask)
318 {
319 if (action == HDA_FIXUP_ACT_PRE_PROBE)
320 alc_setup_gpio(codec, mask);
321 }
322
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)323 static void alc_fixup_gpio1(struct hda_codec *codec,
324 const struct hda_fixup *fix, int action)
325 {
326 alc_fixup_gpio(codec, action, 0x01);
327 }
328
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)329 static void alc_fixup_gpio2(struct hda_codec *codec,
330 const struct hda_fixup *fix, int action)
331 {
332 alc_fixup_gpio(codec, action, 0x02);
333 }
334
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)335 static void alc_fixup_gpio3(struct hda_codec *codec,
336 const struct hda_fixup *fix, int action)
337 {
338 alc_fixup_gpio(codec, action, 0x03);
339 }
340
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)341 static void alc_fixup_gpio4(struct hda_codec *codec,
342 const struct hda_fixup *fix, int action)
343 {
344 alc_fixup_gpio(codec, action, 0x04);
345 }
346
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)347 static void alc_fixup_micmute_led(struct hda_codec *codec,
348 const struct hda_fixup *fix, int action)
349 {
350 if (action == HDA_FIXUP_ACT_PRE_PROBE)
351 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
352 }
353
354 /*
355 * Fix hardware PLL issue
356 * On some codecs, the analog PLL gating control must be off while
357 * the default value is 1.
358 */
alc_fix_pll(struct hda_codec * codec)359 static void alc_fix_pll(struct hda_codec *codec)
360 {
361 struct alc_spec *spec = codec->spec;
362
363 if (spec->pll_nid)
364 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
365 1 << spec->pll_coef_bit, 0);
366 }
367
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)368 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
369 unsigned int coef_idx, unsigned int coef_bit)
370 {
371 struct alc_spec *spec = codec->spec;
372 spec->pll_nid = nid;
373 spec->pll_coef_idx = coef_idx;
374 spec->pll_coef_bit = coef_bit;
375 alc_fix_pll(codec);
376 }
377
378 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)379 static void alc_update_knob_master(struct hda_codec *codec,
380 struct hda_jack_callback *jack)
381 {
382 unsigned int val;
383 struct snd_kcontrol *kctl;
384 struct snd_ctl_elem_value *uctl;
385
386 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
387 if (!kctl)
388 return;
389 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
390 if (!uctl)
391 return;
392 val = snd_hda_codec_read(codec, jack->nid, 0,
393 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
394 val &= HDA_AMP_VOLMASK;
395 uctl->value.integer.value[0] = val;
396 uctl->value.integer.value[1] = val;
397 kctl->put(kctl, uctl);
398 kfree(uctl);
399 }
400
alc880_unsol_event(struct hda_codec * codec,unsigned int res)401 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
402 {
403 /* For some reason, the res given from ALC880 is broken.
404 Here we adjust it properly. */
405 snd_hda_jack_unsol_event(codec, res >> 2);
406 }
407
408 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)409 static void alc_fill_eapd_coef(struct hda_codec *codec)
410 {
411 int coef;
412
413 coef = alc_get_coef0(codec);
414
415 switch (codec->core.vendor_id) {
416 case 0x10ec0262:
417 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
418 break;
419 case 0x10ec0267:
420 case 0x10ec0268:
421 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
422 break;
423 case 0x10ec0269:
424 if ((coef & 0x00f0) == 0x0010)
425 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
426 if ((coef & 0x00f0) == 0x0020)
427 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
428 if ((coef & 0x00f0) == 0x0030)
429 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
430 break;
431 case 0x10ec0280:
432 case 0x10ec0284:
433 case 0x10ec0290:
434 case 0x10ec0292:
435 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
436 break;
437 case 0x10ec0225:
438 case 0x10ec0295:
439 case 0x10ec0299:
440 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
441 fallthrough;
442 case 0x10ec0215:
443 case 0x10ec0285:
444 case 0x10ec0289:
445 alc_update_coef_idx(codec, 0x36, 1<<13, 0);
446 fallthrough;
447 case 0x10ec0230:
448 case 0x10ec0233:
449 case 0x10ec0235:
450 case 0x10ec0236:
451 case 0x10ec0245:
452 case 0x10ec0255:
453 case 0x10ec0256:
454 case 0x19e58326:
455 case 0x10ec0257:
456 case 0x10ec0282:
457 case 0x10ec0283:
458 case 0x10ec0286:
459 case 0x10ec0288:
460 case 0x10ec0298:
461 case 0x10ec0300:
462 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
463 break;
464 case 0x10ec0275:
465 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
466 break;
467 case 0x10ec0287:
468 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
469 alc_write_coef_idx(codec, 0x8, 0x4ab7);
470 break;
471 case 0x10ec0293:
472 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
473 break;
474 case 0x10ec0234:
475 case 0x10ec0274:
476 alc_write_coef_idx(codec, 0x6e, 0x0c25);
477 fallthrough;
478 case 0x10ec0294:
479 case 0x10ec0700:
480 case 0x10ec0701:
481 case 0x10ec0703:
482 case 0x10ec0711:
483 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
484 break;
485 case 0x10ec0662:
486 if ((coef & 0x00f0) == 0x0030)
487 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
488 break;
489 case 0x10ec0272:
490 case 0x10ec0273:
491 case 0x10ec0663:
492 case 0x10ec0665:
493 case 0x10ec0670:
494 case 0x10ec0671:
495 case 0x10ec0672:
496 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
497 break;
498 case 0x10ec0222:
499 case 0x10ec0623:
500 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
501 break;
502 case 0x10ec0668:
503 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
504 break;
505 case 0x10ec0867:
506 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
507 break;
508 case 0x10ec0888:
509 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
510 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
511 break;
512 case 0x10ec0892:
513 case 0x10ec0897:
514 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
515 break;
516 case 0x10ec0899:
517 case 0x10ec0900:
518 case 0x10ec0b00:
519 case 0x10ec1168:
520 case 0x10ec1220:
521 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
522 break;
523 }
524 }
525
526 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)527 static void alc888_coef_init(struct hda_codec *codec)
528 {
529 switch (alc_get_coef0(codec) & 0x00f0) {
530 /* alc888-VA */
531 case 0x00:
532 /* alc888-VB */
533 case 0x10:
534 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
535 break;
536 }
537 }
538
539 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)540 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
541 {
542 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
543 return;
544 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
545 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
546 on ? 2 : 0);
547 }
548
549 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)550 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
551 {
552 /* We currently only handle front, HP */
553 static const hda_nid_t pins[] = {
554 0x0f, 0x10, 0x14, 0x15, 0x17, 0
555 };
556 const hda_nid_t *p;
557 for (p = pins; *p; p++)
558 set_eapd(codec, *p, on);
559 }
560
561 static int find_ext_mic_pin(struct hda_codec *codec);
562
alc_headset_mic_no_shutup(struct hda_codec * codec)563 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
564 {
565 const struct hda_pincfg *pin;
566 int mic_pin = find_ext_mic_pin(codec);
567 int i;
568
569 /* don't shut up pins when unloading the driver; otherwise it breaks
570 * the default pin setup at the next load of the driver
571 */
572 if (codec->bus->shutdown)
573 return;
574
575 snd_array_for_each(&codec->init_pins, i, pin) {
576 /* use read here for syncing after issuing each verb */
577 if (pin->nid != mic_pin)
578 snd_hda_codec_read(codec, pin->nid, 0,
579 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
580 }
581
582 codec->pins_shutup = 1;
583 }
584
alc_shutup_pins(struct hda_codec * codec)585 static void alc_shutup_pins(struct hda_codec *codec)
586 {
587 struct alc_spec *spec = codec->spec;
588
589 switch (codec->core.vendor_id) {
590 case 0x10ec0236:
591 case 0x10ec0256:
592 case 0x10ec0257:
593 case 0x19e58326:
594 case 0x10ec0283:
595 case 0x10ec0285:
596 case 0x10ec0286:
597 case 0x10ec0287:
598 case 0x10ec0288:
599 case 0x10ec0295:
600 case 0x10ec0298:
601 alc_headset_mic_no_shutup(codec);
602 break;
603 default:
604 if (!spec->no_shutup_pins)
605 snd_hda_shutup_pins(codec);
606 break;
607 }
608 }
609
610 /* generic shutup callback;
611 * just turning off EAPD and a little pause for avoiding pop-noise
612 */
alc_eapd_shutup(struct hda_codec * codec)613 static void alc_eapd_shutup(struct hda_codec *codec)
614 {
615 struct alc_spec *spec = codec->spec;
616
617 alc_auto_setup_eapd(codec, false);
618 if (!spec->no_depop_delay)
619 msleep(200);
620 alc_shutup_pins(codec);
621 }
622
623 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)624 static void alc_auto_init_amp(struct hda_codec *codec, int type)
625 {
626 alc_auto_setup_eapd(codec, true);
627 alc_write_gpio(codec);
628 switch (type) {
629 case ALC_INIT_DEFAULT:
630 switch (codec->core.vendor_id) {
631 case 0x10ec0260:
632 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
633 break;
634 case 0x10ec0880:
635 case 0x10ec0882:
636 case 0x10ec0883:
637 case 0x10ec0885:
638 alc_update_coef_idx(codec, 7, 0, 0x2030);
639 break;
640 case 0x10ec0888:
641 alc888_coef_init(codec);
642 break;
643 }
644 break;
645 }
646 }
647
648 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)649 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
650 {
651 if (spec->gen.autocfg.hp_pins[0])
652 return spec->gen.autocfg.hp_pins[0];
653 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
654 return spec->gen.autocfg.line_out_pins[0];
655 return 0;
656 }
657
658 /*
659 * Realtek SSID verification
660 */
661
662 /* Could be any non-zero and even value. When used as fixup, tells
663 * the driver to ignore any present sku defines.
664 */
665 #define ALC_FIXUP_SKU_IGNORE (2)
666
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)667 static void alc_fixup_sku_ignore(struct hda_codec *codec,
668 const struct hda_fixup *fix, int action)
669 {
670 struct alc_spec *spec = codec->spec;
671 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
672 spec->cdefine.fixup = 1;
673 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
674 }
675 }
676
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)677 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
678 const struct hda_fixup *fix, int action)
679 {
680 struct alc_spec *spec = codec->spec;
681
682 if (action == HDA_FIXUP_ACT_PROBE) {
683 spec->no_depop_delay = 1;
684 codec->depop_delay = 0;
685 }
686 }
687
alc_auto_parse_customize_define(struct hda_codec * codec)688 static int alc_auto_parse_customize_define(struct hda_codec *codec)
689 {
690 unsigned int ass, tmp, i;
691 unsigned nid = 0;
692 struct alc_spec *spec = codec->spec;
693
694 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
695
696 if (spec->cdefine.fixup) {
697 ass = spec->cdefine.sku_cfg;
698 if (ass == ALC_FIXUP_SKU_IGNORE)
699 return -1;
700 goto do_sku;
701 }
702
703 if (!codec->bus->pci)
704 return -1;
705 ass = codec->core.subsystem_id & 0xffff;
706 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
707 goto do_sku;
708
709 nid = 0x1d;
710 if (codec->core.vendor_id == 0x10ec0260)
711 nid = 0x17;
712 ass = snd_hda_codec_get_pincfg(codec, nid);
713
714 if (!(ass & 1)) {
715 codec_info(codec, "%s: SKU not ready 0x%08x\n",
716 codec->core.chip_name, ass);
717 return -1;
718 }
719
720 /* check sum */
721 tmp = 0;
722 for (i = 1; i < 16; i++) {
723 if ((ass >> i) & 1)
724 tmp++;
725 }
726 if (((ass >> 16) & 0xf) != tmp)
727 return -1;
728
729 spec->cdefine.port_connectivity = ass >> 30;
730 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
731 spec->cdefine.check_sum = (ass >> 16) & 0xf;
732 spec->cdefine.customization = ass >> 8;
733 do_sku:
734 spec->cdefine.sku_cfg = ass;
735 spec->cdefine.external_amp = (ass & 0x38) >> 3;
736 spec->cdefine.platform_type = (ass & 0x4) >> 2;
737 spec->cdefine.swap = (ass & 0x2) >> 1;
738 spec->cdefine.override = ass & 0x1;
739
740 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
741 nid, spec->cdefine.sku_cfg);
742 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
743 spec->cdefine.port_connectivity);
744 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
745 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
746 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
747 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
748 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
749 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
750 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
751
752 return 0;
753 }
754
755 /* 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)756 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
757 {
758 int i;
759 for (i = 0; i < nums; i++)
760 if (list[i] == nid)
761 return i;
762 return -1;
763 }
764 /* 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)765 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
766 {
767 return find_idx_in_nid_list(nid, list, nums) >= 0;
768 }
769
770 /* check subsystem ID and set up device-specific initialization;
771 * return 1 if initialized, 0 if invalid SSID
772 */
773 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
774 * 31 ~ 16 : Manufacture ID
775 * 15 ~ 8 : SKU ID
776 * 7 ~ 0 : Assembly ID
777 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
778 */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)779 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
780 {
781 unsigned int ass, tmp, i;
782 unsigned nid;
783 struct alc_spec *spec = codec->spec;
784
785 if (spec->cdefine.fixup) {
786 ass = spec->cdefine.sku_cfg;
787 if (ass == ALC_FIXUP_SKU_IGNORE)
788 return 0;
789 goto do_sku;
790 }
791
792 ass = codec->core.subsystem_id & 0xffff;
793 if (codec->bus->pci &&
794 ass != codec->bus->pci->subsystem_device && (ass & 1))
795 goto do_sku;
796
797 /* invalid SSID, check the special NID pin defcfg instead */
798 /*
799 * 31~30 : port connectivity
800 * 29~21 : reserve
801 * 20 : PCBEEP input
802 * 19~16 : Check sum (15:1)
803 * 15~1 : Custom
804 * 0 : override
805 */
806 nid = 0x1d;
807 if (codec->core.vendor_id == 0x10ec0260)
808 nid = 0x17;
809 ass = snd_hda_codec_get_pincfg(codec, nid);
810 codec_dbg(codec,
811 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
812 ass, nid);
813 if (!(ass & 1))
814 return 0;
815 if ((ass >> 30) != 1) /* no physical connection */
816 return 0;
817
818 /* check sum */
819 tmp = 0;
820 for (i = 1; i < 16; i++) {
821 if ((ass >> i) & 1)
822 tmp++;
823 }
824 if (((ass >> 16) & 0xf) != tmp)
825 return 0;
826 do_sku:
827 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
828 ass & 0xffff, codec->core.vendor_id);
829 /*
830 * 0 : override
831 * 1 : Swap Jack
832 * 2 : 0 --> Desktop, 1 --> Laptop
833 * 3~5 : External Amplifier control
834 * 7~6 : Reserved
835 */
836 tmp = (ass & 0x38) >> 3; /* external Amp control */
837 if (spec->init_amp == ALC_INIT_UNDEFINED) {
838 switch (tmp) {
839 case 1:
840 alc_setup_gpio(codec, 0x01);
841 break;
842 case 3:
843 alc_setup_gpio(codec, 0x02);
844 break;
845 case 7:
846 alc_setup_gpio(codec, 0x04);
847 break;
848 case 5:
849 default:
850 spec->init_amp = ALC_INIT_DEFAULT;
851 break;
852 }
853 }
854
855 /* is laptop or Desktop and enable the function "Mute internal speaker
856 * when the external headphone out jack is plugged"
857 */
858 if (!(ass & 0x8000))
859 return 1;
860 /*
861 * 10~8 : Jack location
862 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
863 * 14~13: Resvered
864 * 15 : 1 --> enable the function "Mute internal speaker
865 * when the external headphone out jack is plugged"
866 */
867 if (!alc_get_hp_pin(spec)) {
868 hda_nid_t nid;
869 tmp = (ass >> 11) & 0x3; /* HP to chassis */
870 nid = ports[tmp];
871 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
872 spec->gen.autocfg.line_outs))
873 return 1;
874 spec->gen.autocfg.hp_pins[0] = nid;
875 }
876 return 1;
877 }
878
879 /* Check the validity of ALC subsystem-id
880 * 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)881 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
882 {
883 if (!alc_subsystem_id(codec, ports)) {
884 struct alc_spec *spec = codec->spec;
885 if (spec->init_amp == ALC_INIT_UNDEFINED) {
886 codec_dbg(codec,
887 "realtek: Enable default setup for auto mode as fallback\n");
888 spec->init_amp = ALC_INIT_DEFAULT;
889 }
890 }
891 }
892
893 /*
894 */
895
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)896 static void alc_fixup_inv_dmic(struct hda_codec *codec,
897 const struct hda_fixup *fix, int action)
898 {
899 struct alc_spec *spec = codec->spec;
900
901 spec->gen.inv_dmic_split = 1;
902 }
903
904
alc_build_controls(struct hda_codec * codec)905 static int alc_build_controls(struct hda_codec *codec)
906 {
907 int err;
908
909 err = snd_hda_gen_build_controls(codec);
910 if (err < 0)
911 return err;
912
913 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
914 return 0;
915 }
916
917
918 /*
919 * Common callbacks
920 */
921
alc_pre_init(struct hda_codec * codec)922 static void alc_pre_init(struct hda_codec *codec)
923 {
924 alc_fill_eapd_coef(codec);
925 }
926
927 #define is_s3_resume(codec) \
928 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
929 #define is_s4_resume(codec) \
930 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
931 #define is_s4_suspend(codec) \
932 ((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE)
933
alc_init(struct hda_codec * codec)934 static int alc_init(struct hda_codec *codec)
935 {
936 struct alc_spec *spec = codec->spec;
937
938 /* hibernation resume needs the full chip initialization */
939 if (is_s4_resume(codec))
940 alc_pre_init(codec);
941
942 if (spec->init_hook)
943 spec->init_hook(codec);
944
945 spec->gen.skip_verbs = 1; /* applied in below */
946 snd_hda_gen_init(codec);
947 alc_fix_pll(codec);
948 alc_auto_init_amp(codec, spec->init_amp);
949 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
950
951 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
952
953 return 0;
954 }
955
956 /* forward declaration */
957 static const struct component_master_ops comp_master_ops;
958
alc_free(struct hda_codec * codec)959 static void alc_free(struct hda_codec *codec)
960 {
961 struct alc_spec *spec = codec->spec;
962
963 if (spec)
964 hda_component_manager_free(&spec->comps, &comp_master_ops);
965
966 snd_hda_gen_free(codec);
967 }
968
alc_shutup(struct hda_codec * codec)969 static inline void alc_shutup(struct hda_codec *codec)
970 {
971 struct alc_spec *spec = codec->spec;
972
973 if (!snd_hda_get_bool_hint(codec, "shutup"))
974 return; /* disabled explicitly by hints */
975
976 if (spec && spec->shutup)
977 spec->shutup(codec);
978 else
979 alc_shutup_pins(codec);
980 }
981
alc_power_eapd(struct hda_codec * codec)982 static void alc_power_eapd(struct hda_codec *codec)
983 {
984 alc_auto_setup_eapd(codec, false);
985 }
986
alc_suspend(struct hda_codec * codec)987 static int alc_suspend(struct hda_codec *codec)
988 {
989 struct alc_spec *spec = codec->spec;
990 alc_shutup(codec);
991 if (spec && spec->power_hook)
992 spec->power_hook(codec);
993 return 0;
994 }
995
alc_resume(struct hda_codec * codec)996 static int alc_resume(struct hda_codec *codec)
997 {
998 struct alc_spec *spec = codec->spec;
999
1000 if (!spec->no_depop_delay)
1001 msleep(150); /* to avoid pop noise */
1002 codec->patch_ops.init(codec);
1003 snd_hda_regmap_sync(codec);
1004 hda_call_check_power_status(codec, 0x01);
1005 return 0;
1006 }
1007
1008 /*
1009 */
1010 static const struct hda_codec_ops alc_patch_ops = {
1011 .build_controls = alc_build_controls,
1012 .build_pcms = snd_hda_gen_build_pcms,
1013 .init = alc_init,
1014 .free = alc_free,
1015 .unsol_event = snd_hda_jack_unsol_event,
1016 .resume = alc_resume,
1017 .suspend = alc_suspend,
1018 .check_power_status = snd_hda_gen_check_power_status,
1019 };
1020
1021
1022 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1023
1024 /*
1025 * Rename codecs appropriately from COEF value or subvendor id
1026 */
1027 struct alc_codec_rename_table {
1028 unsigned int vendor_id;
1029 unsigned short coef_mask;
1030 unsigned short coef_bits;
1031 const char *name;
1032 };
1033
1034 struct alc_codec_rename_pci_table {
1035 unsigned int codec_vendor_id;
1036 unsigned short pci_subvendor;
1037 unsigned short pci_subdevice;
1038 const char *name;
1039 };
1040
1041 static const struct alc_codec_rename_table rename_tbl[] = {
1042 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1043 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1044 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1045 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1046 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1047 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1048 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1049 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1050 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1051 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1052 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1053 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1054 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1055 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1056 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1057 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1058 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1059 { } /* terminator */
1060 };
1061
1062 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1063 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1064 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1065 { 0x10ec0283, 0x1028, 0, "ALC3223" },
1066 { 0x10ec0288, 0x1028, 0, "ALC3263" },
1067 { 0x10ec0292, 0x1028, 0, "ALC3226" },
1068 { 0x10ec0293, 0x1028, 0, "ALC3235" },
1069 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1070 { 0x10ec0668, 0x1028, 0, "ALC3661" },
1071 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1072 { 0x10ec0899, 0x1028, 0, "ALC3861" },
1073 { 0x10ec0298, 0x1028, 0, "ALC3266" },
1074 { 0x10ec0236, 0x1028, 0, "ALC3204" },
1075 { 0x10ec0256, 0x1028, 0, "ALC3246" },
1076 { 0x10ec0225, 0x1028, 0, "ALC3253" },
1077 { 0x10ec0295, 0x1028, 0, "ALC3254" },
1078 { 0x10ec0299, 0x1028, 0, "ALC3271" },
1079 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1080 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1081 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1082 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1083 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1084 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1085 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1086 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1087 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1088 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1089 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1090 { } /* terminator */
1091 };
1092
alc_codec_rename_from_preset(struct hda_codec * codec)1093 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1094 {
1095 const struct alc_codec_rename_table *p;
1096 const struct alc_codec_rename_pci_table *q;
1097
1098 for (p = rename_tbl; p->vendor_id; p++) {
1099 if (p->vendor_id != codec->core.vendor_id)
1100 continue;
1101 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1102 return alc_codec_rename(codec, p->name);
1103 }
1104
1105 if (!codec->bus->pci)
1106 return 0;
1107 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1108 if (q->codec_vendor_id != codec->core.vendor_id)
1109 continue;
1110 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1111 continue;
1112 if (!q->pci_subdevice ||
1113 q->pci_subdevice == codec->bus->pci->subsystem_device)
1114 return alc_codec_rename(codec, q->name);
1115 }
1116
1117 return 0;
1118 }
1119
1120
1121 /*
1122 * Digital-beep handlers
1123 */
1124 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1125
1126 /* additional beep mixers; private_value will be overwritten */
1127 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1128 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1129 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1130 };
1131
1132 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1133 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1134 int idx, int dir)
1135 {
1136 struct snd_kcontrol_new *knew;
1137 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1138 int i;
1139
1140 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1141 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1142 &alc_beep_mixer[i]);
1143 if (!knew)
1144 return -ENOMEM;
1145 knew->private_value = beep_amp;
1146 }
1147 return 0;
1148 }
1149
1150 static const struct snd_pci_quirk beep_allow_list[] = {
1151 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1152 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1153 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1154 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1155 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1156 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1157 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1158 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1159 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1160 /* denylist -- no beep available */
1161 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1162 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1163 {}
1164 };
1165
has_cdefine_beep(struct hda_codec * codec)1166 static inline int has_cdefine_beep(struct hda_codec *codec)
1167 {
1168 struct alc_spec *spec = codec->spec;
1169 const struct snd_pci_quirk *q;
1170 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1171 if (q)
1172 return q->value;
1173 return spec->cdefine.enable_pcbeep;
1174 }
1175 #else
1176 #define set_beep_amp(spec, nid, idx, dir) 0
1177 #define has_cdefine_beep(codec) 0
1178 #endif
1179
1180 /* parse the BIOS configuration and set up the alc_spec */
1181 /* return 1 if successful, 0 if the proper config is not found,
1182 * or a negative error code
1183 */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1184 static int alc_parse_auto_config(struct hda_codec *codec,
1185 const hda_nid_t *ignore_nids,
1186 const hda_nid_t *ssid_nids)
1187 {
1188 struct alc_spec *spec = codec->spec;
1189 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1190 int err;
1191
1192 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1193 spec->parse_flags);
1194 if (err < 0)
1195 return err;
1196
1197 if (ssid_nids)
1198 alc_ssid_check(codec, ssid_nids);
1199
1200 err = snd_hda_gen_parse_auto_config(codec, cfg);
1201 if (err < 0)
1202 return err;
1203
1204 return 1;
1205 }
1206
1207 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1208 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1209 {
1210 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1211 int err;
1212
1213 if (!spec)
1214 return -ENOMEM;
1215 codec->spec = spec;
1216 snd_hda_gen_spec_init(&spec->gen);
1217 spec->gen.mixer_nid = mixer_nid;
1218 spec->gen.own_eapd_ctl = 1;
1219 codec->single_adc_amp = 1;
1220 /* FIXME: do we need this for all Realtek codec models? */
1221 codec->spdif_status_reset = 1;
1222 codec->forced_resume = 1;
1223 codec->patch_ops = alc_patch_ops;
1224 mutex_init(&spec->coef_mutex);
1225
1226 err = alc_codec_rename_from_preset(codec);
1227 if (err < 0) {
1228 kfree(spec);
1229 return err;
1230 }
1231 return 0;
1232 }
1233
alc880_parse_auto_config(struct hda_codec * codec)1234 static int alc880_parse_auto_config(struct hda_codec *codec)
1235 {
1236 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1237 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1238 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1239 }
1240
1241 /*
1242 * ALC880 fix-ups
1243 */
1244 enum {
1245 ALC880_FIXUP_GPIO1,
1246 ALC880_FIXUP_GPIO2,
1247 ALC880_FIXUP_MEDION_RIM,
1248 ALC880_FIXUP_LG,
1249 ALC880_FIXUP_LG_LW25,
1250 ALC880_FIXUP_W810,
1251 ALC880_FIXUP_EAPD_COEF,
1252 ALC880_FIXUP_TCL_S700,
1253 ALC880_FIXUP_VOL_KNOB,
1254 ALC880_FIXUP_FUJITSU,
1255 ALC880_FIXUP_F1734,
1256 ALC880_FIXUP_UNIWILL,
1257 ALC880_FIXUP_UNIWILL_DIG,
1258 ALC880_FIXUP_Z71V,
1259 ALC880_FIXUP_ASUS_W5A,
1260 ALC880_FIXUP_3ST_BASE,
1261 ALC880_FIXUP_3ST,
1262 ALC880_FIXUP_3ST_DIG,
1263 ALC880_FIXUP_5ST_BASE,
1264 ALC880_FIXUP_5ST,
1265 ALC880_FIXUP_5ST_DIG,
1266 ALC880_FIXUP_6ST_BASE,
1267 ALC880_FIXUP_6ST,
1268 ALC880_FIXUP_6ST_DIG,
1269 ALC880_FIXUP_6ST_AUTOMUTE,
1270 };
1271
1272 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1273 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1274 const struct hda_fixup *fix, int action)
1275 {
1276 if (action == HDA_FIXUP_ACT_PROBE)
1277 snd_hda_jack_detect_enable_callback(codec, 0x21,
1278 alc_update_knob_master);
1279 }
1280
1281 static const struct hda_fixup alc880_fixups[] = {
1282 [ALC880_FIXUP_GPIO1] = {
1283 .type = HDA_FIXUP_FUNC,
1284 .v.func = alc_fixup_gpio1,
1285 },
1286 [ALC880_FIXUP_GPIO2] = {
1287 .type = HDA_FIXUP_FUNC,
1288 .v.func = alc_fixup_gpio2,
1289 },
1290 [ALC880_FIXUP_MEDION_RIM] = {
1291 .type = HDA_FIXUP_VERBS,
1292 .v.verbs = (const struct hda_verb[]) {
1293 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1294 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1295 { }
1296 },
1297 .chained = true,
1298 .chain_id = ALC880_FIXUP_GPIO2,
1299 },
1300 [ALC880_FIXUP_LG] = {
1301 .type = HDA_FIXUP_PINS,
1302 .v.pins = (const struct hda_pintbl[]) {
1303 /* disable bogus unused pins */
1304 { 0x16, 0x411111f0 },
1305 { 0x18, 0x411111f0 },
1306 { 0x1a, 0x411111f0 },
1307 { }
1308 }
1309 },
1310 [ALC880_FIXUP_LG_LW25] = {
1311 .type = HDA_FIXUP_PINS,
1312 .v.pins = (const struct hda_pintbl[]) {
1313 { 0x1a, 0x0181344f }, /* line-in */
1314 { 0x1b, 0x0321403f }, /* headphone */
1315 { }
1316 }
1317 },
1318 [ALC880_FIXUP_W810] = {
1319 .type = HDA_FIXUP_PINS,
1320 .v.pins = (const struct hda_pintbl[]) {
1321 /* disable bogus unused pins */
1322 { 0x17, 0x411111f0 },
1323 { }
1324 },
1325 .chained = true,
1326 .chain_id = ALC880_FIXUP_GPIO2,
1327 },
1328 [ALC880_FIXUP_EAPD_COEF] = {
1329 .type = HDA_FIXUP_VERBS,
1330 .v.verbs = (const struct hda_verb[]) {
1331 /* change to EAPD mode */
1332 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1333 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1334 {}
1335 },
1336 },
1337 [ALC880_FIXUP_TCL_S700] = {
1338 .type = HDA_FIXUP_VERBS,
1339 .v.verbs = (const struct hda_verb[]) {
1340 /* change to EAPD mode */
1341 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1342 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1343 {}
1344 },
1345 .chained = true,
1346 .chain_id = ALC880_FIXUP_GPIO2,
1347 },
1348 [ALC880_FIXUP_VOL_KNOB] = {
1349 .type = HDA_FIXUP_FUNC,
1350 .v.func = alc880_fixup_vol_knob,
1351 },
1352 [ALC880_FIXUP_FUJITSU] = {
1353 /* override all pins as BIOS on old Amilo is broken */
1354 .type = HDA_FIXUP_PINS,
1355 .v.pins = (const struct hda_pintbl[]) {
1356 { 0x14, 0x0121401f }, /* HP */
1357 { 0x15, 0x99030120 }, /* speaker */
1358 { 0x16, 0x99030130 }, /* bass speaker */
1359 { 0x17, 0x411111f0 }, /* N/A */
1360 { 0x18, 0x411111f0 }, /* N/A */
1361 { 0x19, 0x01a19950 }, /* mic-in */
1362 { 0x1a, 0x411111f0 }, /* N/A */
1363 { 0x1b, 0x411111f0 }, /* N/A */
1364 { 0x1c, 0x411111f0 }, /* N/A */
1365 { 0x1d, 0x411111f0 }, /* N/A */
1366 { 0x1e, 0x01454140 }, /* SPDIF out */
1367 { }
1368 },
1369 .chained = true,
1370 .chain_id = ALC880_FIXUP_VOL_KNOB,
1371 },
1372 [ALC880_FIXUP_F1734] = {
1373 /* almost compatible with FUJITSU, but no bass and SPDIF */
1374 .type = HDA_FIXUP_PINS,
1375 .v.pins = (const struct hda_pintbl[]) {
1376 { 0x14, 0x0121401f }, /* HP */
1377 { 0x15, 0x99030120 }, /* speaker */
1378 { 0x16, 0x411111f0 }, /* N/A */
1379 { 0x17, 0x411111f0 }, /* N/A */
1380 { 0x18, 0x411111f0 }, /* N/A */
1381 { 0x19, 0x01a19950 }, /* mic-in */
1382 { 0x1a, 0x411111f0 }, /* N/A */
1383 { 0x1b, 0x411111f0 }, /* N/A */
1384 { 0x1c, 0x411111f0 }, /* N/A */
1385 { 0x1d, 0x411111f0 }, /* N/A */
1386 { 0x1e, 0x411111f0 }, /* N/A */
1387 { }
1388 },
1389 .chained = true,
1390 .chain_id = ALC880_FIXUP_VOL_KNOB,
1391 },
1392 [ALC880_FIXUP_UNIWILL] = {
1393 /* need to fix HP and speaker pins to be parsed correctly */
1394 .type = HDA_FIXUP_PINS,
1395 .v.pins = (const struct hda_pintbl[]) {
1396 { 0x14, 0x0121411f }, /* HP */
1397 { 0x15, 0x99030120 }, /* speaker */
1398 { 0x16, 0x99030130 }, /* bass speaker */
1399 { }
1400 },
1401 },
1402 [ALC880_FIXUP_UNIWILL_DIG] = {
1403 .type = HDA_FIXUP_PINS,
1404 .v.pins = (const struct hda_pintbl[]) {
1405 /* disable bogus unused pins */
1406 { 0x17, 0x411111f0 },
1407 { 0x19, 0x411111f0 },
1408 { 0x1b, 0x411111f0 },
1409 { 0x1f, 0x411111f0 },
1410 { }
1411 }
1412 },
1413 [ALC880_FIXUP_Z71V] = {
1414 .type = HDA_FIXUP_PINS,
1415 .v.pins = (const struct hda_pintbl[]) {
1416 /* set up the whole pins as BIOS is utterly broken */
1417 { 0x14, 0x99030120 }, /* speaker */
1418 { 0x15, 0x0121411f }, /* HP */
1419 { 0x16, 0x411111f0 }, /* N/A */
1420 { 0x17, 0x411111f0 }, /* N/A */
1421 { 0x18, 0x01a19950 }, /* mic-in */
1422 { 0x19, 0x411111f0 }, /* N/A */
1423 { 0x1a, 0x01813031 }, /* line-in */
1424 { 0x1b, 0x411111f0 }, /* N/A */
1425 { 0x1c, 0x411111f0 }, /* N/A */
1426 { 0x1d, 0x411111f0 }, /* N/A */
1427 { 0x1e, 0x0144111e }, /* SPDIF */
1428 { }
1429 }
1430 },
1431 [ALC880_FIXUP_ASUS_W5A] = {
1432 .type = HDA_FIXUP_PINS,
1433 .v.pins = (const struct hda_pintbl[]) {
1434 /* set up the whole pins as BIOS is utterly broken */
1435 { 0x14, 0x0121411f }, /* HP */
1436 { 0x15, 0x411111f0 }, /* N/A */
1437 { 0x16, 0x411111f0 }, /* N/A */
1438 { 0x17, 0x411111f0 }, /* N/A */
1439 { 0x18, 0x90a60160 }, /* mic */
1440 { 0x19, 0x411111f0 }, /* N/A */
1441 { 0x1a, 0x411111f0 }, /* N/A */
1442 { 0x1b, 0x411111f0 }, /* N/A */
1443 { 0x1c, 0x411111f0 }, /* N/A */
1444 { 0x1d, 0x411111f0 }, /* N/A */
1445 { 0x1e, 0xb743111e }, /* SPDIF out */
1446 { }
1447 },
1448 .chained = true,
1449 .chain_id = ALC880_FIXUP_GPIO1,
1450 },
1451 [ALC880_FIXUP_3ST_BASE] = {
1452 .type = HDA_FIXUP_PINS,
1453 .v.pins = (const struct hda_pintbl[]) {
1454 { 0x14, 0x01014010 }, /* line-out */
1455 { 0x15, 0x411111f0 }, /* N/A */
1456 { 0x16, 0x411111f0 }, /* N/A */
1457 { 0x17, 0x411111f0 }, /* N/A */
1458 { 0x18, 0x01a19c30 }, /* mic-in */
1459 { 0x19, 0x0121411f }, /* HP */
1460 { 0x1a, 0x01813031 }, /* line-in */
1461 { 0x1b, 0x02a19c40 }, /* front-mic */
1462 { 0x1c, 0x411111f0 }, /* N/A */
1463 { 0x1d, 0x411111f0 }, /* N/A */
1464 /* 0x1e is filled in below */
1465 { 0x1f, 0x411111f0 }, /* N/A */
1466 { }
1467 }
1468 },
1469 [ALC880_FIXUP_3ST] = {
1470 .type = HDA_FIXUP_PINS,
1471 .v.pins = (const struct hda_pintbl[]) {
1472 { 0x1e, 0x411111f0 }, /* N/A */
1473 { }
1474 },
1475 .chained = true,
1476 .chain_id = ALC880_FIXUP_3ST_BASE,
1477 },
1478 [ALC880_FIXUP_3ST_DIG] = {
1479 .type = HDA_FIXUP_PINS,
1480 .v.pins = (const struct hda_pintbl[]) {
1481 { 0x1e, 0x0144111e }, /* SPDIF */
1482 { }
1483 },
1484 .chained = true,
1485 .chain_id = ALC880_FIXUP_3ST_BASE,
1486 },
1487 [ALC880_FIXUP_5ST_BASE] = {
1488 .type = HDA_FIXUP_PINS,
1489 .v.pins = (const struct hda_pintbl[]) {
1490 { 0x14, 0x01014010 }, /* front */
1491 { 0x15, 0x411111f0 }, /* N/A */
1492 { 0x16, 0x01011411 }, /* CLFE */
1493 { 0x17, 0x01016412 }, /* surr */
1494 { 0x18, 0x01a19c30 }, /* mic-in */
1495 { 0x19, 0x0121411f }, /* HP */
1496 { 0x1a, 0x01813031 }, /* line-in */
1497 { 0x1b, 0x02a19c40 }, /* front-mic */
1498 { 0x1c, 0x411111f0 }, /* N/A */
1499 { 0x1d, 0x411111f0 }, /* N/A */
1500 /* 0x1e is filled in below */
1501 { 0x1f, 0x411111f0 }, /* N/A */
1502 { }
1503 }
1504 },
1505 [ALC880_FIXUP_5ST] = {
1506 .type = HDA_FIXUP_PINS,
1507 .v.pins = (const struct hda_pintbl[]) {
1508 { 0x1e, 0x411111f0 }, /* N/A */
1509 { }
1510 },
1511 .chained = true,
1512 .chain_id = ALC880_FIXUP_5ST_BASE,
1513 },
1514 [ALC880_FIXUP_5ST_DIG] = {
1515 .type = HDA_FIXUP_PINS,
1516 .v.pins = (const struct hda_pintbl[]) {
1517 { 0x1e, 0x0144111e }, /* SPDIF */
1518 { }
1519 },
1520 .chained = true,
1521 .chain_id = ALC880_FIXUP_5ST_BASE,
1522 },
1523 [ALC880_FIXUP_6ST_BASE] = {
1524 .type = HDA_FIXUP_PINS,
1525 .v.pins = (const struct hda_pintbl[]) {
1526 { 0x14, 0x01014010 }, /* front */
1527 { 0x15, 0x01016412 }, /* surr */
1528 { 0x16, 0x01011411 }, /* CLFE */
1529 { 0x17, 0x01012414 }, /* side */
1530 { 0x18, 0x01a19c30 }, /* mic-in */
1531 { 0x19, 0x02a19c40 }, /* front-mic */
1532 { 0x1a, 0x01813031 }, /* line-in */
1533 { 0x1b, 0x0121411f }, /* HP */
1534 { 0x1c, 0x411111f0 }, /* N/A */
1535 { 0x1d, 0x411111f0 }, /* N/A */
1536 /* 0x1e is filled in below */
1537 { 0x1f, 0x411111f0 }, /* N/A */
1538 { }
1539 }
1540 },
1541 [ALC880_FIXUP_6ST] = {
1542 .type = HDA_FIXUP_PINS,
1543 .v.pins = (const struct hda_pintbl[]) {
1544 { 0x1e, 0x411111f0 }, /* N/A */
1545 { }
1546 },
1547 .chained = true,
1548 .chain_id = ALC880_FIXUP_6ST_BASE,
1549 },
1550 [ALC880_FIXUP_6ST_DIG] = {
1551 .type = HDA_FIXUP_PINS,
1552 .v.pins = (const struct hda_pintbl[]) {
1553 { 0x1e, 0x0144111e }, /* SPDIF */
1554 { }
1555 },
1556 .chained = true,
1557 .chain_id = ALC880_FIXUP_6ST_BASE,
1558 },
1559 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1560 .type = HDA_FIXUP_PINS,
1561 .v.pins = (const struct hda_pintbl[]) {
1562 { 0x1b, 0x0121401f }, /* HP with jack detect */
1563 { }
1564 },
1565 .chained_before = true,
1566 .chain_id = ALC880_FIXUP_6ST_BASE,
1567 },
1568 };
1569
1570 static const struct hda_quirk alc880_fixup_tbl[] = {
1571 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1572 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1573 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1574 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1575 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1576 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1577 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1578 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1579 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1580 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1581 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1582 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1583 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1584 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1585 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1586 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1587 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1588 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1589 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1590 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1591 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1592 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1593 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1594
1595 /* Below is the copied entries from alc880_quirks.c.
1596 * It's not quite sure whether BIOS sets the correct pin-config table
1597 * on these machines, thus they are kept to be compatible with
1598 * the old static quirks. Once when it's confirmed to work without
1599 * these overrides, it'd be better to remove.
1600 */
1601 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1602 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1603 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1604 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1605 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1606 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1607 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1608 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1609 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1610 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1611 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1612 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1613 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1614 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1615 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1616 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1617 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1618 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1619 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1620 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1621 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1622 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1623 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1624 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1625 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1626 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1627 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1628 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1629 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1630 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1631 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1632 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1633 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1634 /* default Intel */
1635 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1636 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1637 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1638 {}
1639 };
1640
1641 static const struct hda_model_fixup alc880_fixup_models[] = {
1642 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1643 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1644 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1645 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1646 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1647 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1648 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1649 {}
1650 };
1651
1652
1653 /*
1654 * OK, here we have finally the patch for ALC880
1655 */
patch_alc880(struct hda_codec * codec)1656 static int patch_alc880(struct hda_codec *codec)
1657 {
1658 struct alc_spec *spec;
1659 int err;
1660
1661 err = alc_alloc_spec(codec, 0x0b);
1662 if (err < 0)
1663 return err;
1664
1665 spec = codec->spec;
1666 spec->gen.need_dac_fix = 1;
1667 spec->gen.beep_nid = 0x01;
1668
1669 codec->patch_ops.unsol_event = alc880_unsol_event;
1670
1671 alc_pre_init(codec);
1672
1673 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1674 alc880_fixups);
1675 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1676
1677 /* automatic parse from the BIOS config */
1678 err = alc880_parse_auto_config(codec);
1679 if (err < 0)
1680 goto error;
1681
1682 if (!spec->gen.no_analog) {
1683 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1684 if (err < 0)
1685 goto error;
1686 }
1687
1688 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1689
1690 return 0;
1691
1692 error:
1693 alc_free(codec);
1694 return err;
1695 }
1696
1697
1698 /*
1699 * ALC260 support
1700 */
alc260_parse_auto_config(struct hda_codec * codec)1701 static int alc260_parse_auto_config(struct hda_codec *codec)
1702 {
1703 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1704 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1705 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1706 }
1707
1708 /*
1709 * Pin config fixes
1710 */
1711 enum {
1712 ALC260_FIXUP_HP_DC5750,
1713 ALC260_FIXUP_HP_PIN_0F,
1714 ALC260_FIXUP_COEF,
1715 ALC260_FIXUP_GPIO1,
1716 ALC260_FIXUP_GPIO1_TOGGLE,
1717 ALC260_FIXUP_REPLACER,
1718 ALC260_FIXUP_HP_B1900,
1719 ALC260_FIXUP_KN1,
1720 ALC260_FIXUP_FSC_S7020,
1721 ALC260_FIXUP_FSC_S7020_JWSE,
1722 ALC260_FIXUP_VAIO_PINS,
1723 };
1724
alc260_gpio1_automute(struct hda_codec * codec)1725 static void alc260_gpio1_automute(struct hda_codec *codec)
1726 {
1727 struct alc_spec *spec = codec->spec;
1728
1729 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1730 }
1731
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1732 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1733 const struct hda_fixup *fix, int action)
1734 {
1735 struct alc_spec *spec = codec->spec;
1736 if (action == HDA_FIXUP_ACT_PROBE) {
1737 /* although the machine has only one output pin, we need to
1738 * toggle GPIO1 according to the jack state
1739 */
1740 spec->gen.automute_hook = alc260_gpio1_automute;
1741 spec->gen.detect_hp = 1;
1742 spec->gen.automute_speaker = 1;
1743 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1744 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1745 snd_hda_gen_hp_automute);
1746 alc_setup_gpio(codec, 0x01);
1747 }
1748 }
1749
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1750 static void alc260_fixup_kn1(struct hda_codec *codec,
1751 const struct hda_fixup *fix, int action)
1752 {
1753 struct alc_spec *spec = codec->spec;
1754 static const struct hda_pintbl pincfgs[] = {
1755 { 0x0f, 0x02214000 }, /* HP/speaker */
1756 { 0x12, 0x90a60160 }, /* int mic */
1757 { 0x13, 0x02a19000 }, /* ext mic */
1758 { 0x18, 0x01446000 }, /* SPDIF out */
1759 /* disable bogus I/O pins */
1760 { 0x10, 0x411111f0 },
1761 { 0x11, 0x411111f0 },
1762 { 0x14, 0x411111f0 },
1763 { 0x15, 0x411111f0 },
1764 { 0x16, 0x411111f0 },
1765 { 0x17, 0x411111f0 },
1766 { 0x19, 0x411111f0 },
1767 { }
1768 };
1769
1770 switch (action) {
1771 case HDA_FIXUP_ACT_PRE_PROBE:
1772 snd_hda_apply_pincfgs(codec, pincfgs);
1773 spec->init_amp = ALC_INIT_NONE;
1774 break;
1775 }
1776 }
1777
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1778 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1779 const struct hda_fixup *fix, int action)
1780 {
1781 struct alc_spec *spec = codec->spec;
1782 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1783 spec->init_amp = ALC_INIT_NONE;
1784 }
1785
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1786 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1787 const struct hda_fixup *fix, int action)
1788 {
1789 struct alc_spec *spec = codec->spec;
1790 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1791 spec->gen.add_jack_modes = 1;
1792 spec->gen.hp_mic = 1;
1793 }
1794 }
1795
1796 static const struct hda_fixup alc260_fixups[] = {
1797 [ALC260_FIXUP_HP_DC5750] = {
1798 .type = HDA_FIXUP_PINS,
1799 .v.pins = (const struct hda_pintbl[]) {
1800 { 0x11, 0x90130110 }, /* speaker */
1801 { }
1802 }
1803 },
1804 [ALC260_FIXUP_HP_PIN_0F] = {
1805 .type = HDA_FIXUP_PINS,
1806 .v.pins = (const struct hda_pintbl[]) {
1807 { 0x0f, 0x01214000 }, /* HP */
1808 { }
1809 }
1810 },
1811 [ALC260_FIXUP_COEF] = {
1812 .type = HDA_FIXUP_VERBS,
1813 .v.verbs = (const struct hda_verb[]) {
1814 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1815 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1816 { }
1817 },
1818 },
1819 [ALC260_FIXUP_GPIO1] = {
1820 .type = HDA_FIXUP_FUNC,
1821 .v.func = alc_fixup_gpio1,
1822 },
1823 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1824 .type = HDA_FIXUP_FUNC,
1825 .v.func = alc260_fixup_gpio1_toggle,
1826 .chained = true,
1827 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1828 },
1829 [ALC260_FIXUP_REPLACER] = {
1830 .type = HDA_FIXUP_VERBS,
1831 .v.verbs = (const struct hda_verb[]) {
1832 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1833 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1834 { }
1835 },
1836 .chained = true,
1837 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1838 },
1839 [ALC260_FIXUP_HP_B1900] = {
1840 .type = HDA_FIXUP_FUNC,
1841 .v.func = alc260_fixup_gpio1_toggle,
1842 .chained = true,
1843 .chain_id = ALC260_FIXUP_COEF,
1844 },
1845 [ALC260_FIXUP_KN1] = {
1846 .type = HDA_FIXUP_FUNC,
1847 .v.func = alc260_fixup_kn1,
1848 },
1849 [ALC260_FIXUP_FSC_S7020] = {
1850 .type = HDA_FIXUP_FUNC,
1851 .v.func = alc260_fixup_fsc_s7020,
1852 },
1853 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1854 .type = HDA_FIXUP_FUNC,
1855 .v.func = alc260_fixup_fsc_s7020_jwse,
1856 .chained = true,
1857 .chain_id = ALC260_FIXUP_FSC_S7020,
1858 },
1859 [ALC260_FIXUP_VAIO_PINS] = {
1860 .type = HDA_FIXUP_PINS,
1861 .v.pins = (const struct hda_pintbl[]) {
1862 /* Pin configs are missing completely on some VAIOs */
1863 { 0x0f, 0x01211020 },
1864 { 0x10, 0x0001003f },
1865 { 0x11, 0x411111f0 },
1866 { 0x12, 0x01a15930 },
1867 { 0x13, 0x411111f0 },
1868 { 0x14, 0x411111f0 },
1869 { 0x15, 0x411111f0 },
1870 { 0x16, 0x411111f0 },
1871 { 0x17, 0x411111f0 },
1872 { 0x18, 0x411111f0 },
1873 { 0x19, 0x411111f0 },
1874 { }
1875 }
1876 },
1877 };
1878
1879 static const struct hda_quirk alc260_fixup_tbl[] = {
1880 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1881 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1882 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1883 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1884 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1885 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1886 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1887 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1888 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1889 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1890 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1891 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1892 {}
1893 };
1894
1895 static const struct hda_model_fixup alc260_fixup_models[] = {
1896 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1897 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1898 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1899 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1900 {}
1901 };
1902
1903 /*
1904 */
patch_alc260(struct hda_codec * codec)1905 static int patch_alc260(struct hda_codec *codec)
1906 {
1907 struct alc_spec *spec;
1908 int err;
1909
1910 err = alc_alloc_spec(codec, 0x07);
1911 if (err < 0)
1912 return err;
1913
1914 spec = codec->spec;
1915 /* as quite a few machines require HP amp for speaker outputs,
1916 * it's easier to enable it unconditionally; even if it's unneeded,
1917 * it's almost harmless.
1918 */
1919 spec->gen.prefer_hp_amp = 1;
1920 spec->gen.beep_nid = 0x01;
1921
1922 spec->shutup = alc_eapd_shutup;
1923
1924 alc_pre_init(codec);
1925
1926 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1927 alc260_fixups);
1928 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1929
1930 /* automatic parse from the BIOS config */
1931 err = alc260_parse_auto_config(codec);
1932 if (err < 0)
1933 goto error;
1934
1935 if (!spec->gen.no_analog) {
1936 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1937 if (err < 0)
1938 goto error;
1939 }
1940
1941 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1942
1943 return 0;
1944
1945 error:
1946 alc_free(codec);
1947 return err;
1948 }
1949
1950
1951 /*
1952 * ALC882/883/885/888/889 support
1953 *
1954 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1955 * configuration. Each pin widget can choose any input DACs and a mixer.
1956 * Each ADC is connected from a mixer of all inputs. This makes possible
1957 * 6-channel independent captures.
1958 *
1959 * In addition, an independent DAC for the multi-playback (not used in this
1960 * driver yet).
1961 */
1962
1963 /*
1964 * Pin config fixes
1965 */
1966 enum {
1967 ALC882_FIXUP_ABIT_AW9D_MAX,
1968 ALC882_FIXUP_LENOVO_Y530,
1969 ALC882_FIXUP_PB_M5210,
1970 ALC882_FIXUP_ACER_ASPIRE_7736,
1971 ALC882_FIXUP_ASUS_W90V,
1972 ALC889_FIXUP_CD,
1973 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1974 ALC889_FIXUP_VAIO_TT,
1975 ALC888_FIXUP_EEE1601,
1976 ALC886_FIXUP_EAPD,
1977 ALC882_FIXUP_EAPD,
1978 ALC883_FIXUP_EAPD,
1979 ALC883_FIXUP_ACER_EAPD,
1980 ALC882_FIXUP_GPIO1,
1981 ALC882_FIXUP_GPIO2,
1982 ALC882_FIXUP_GPIO3,
1983 ALC889_FIXUP_COEF,
1984 ALC882_FIXUP_ASUS_W2JC,
1985 ALC882_FIXUP_ACER_ASPIRE_4930G,
1986 ALC882_FIXUP_ACER_ASPIRE_8930G,
1987 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1988 ALC885_FIXUP_MACPRO_GPIO,
1989 ALC889_FIXUP_DAC_ROUTE,
1990 ALC889_FIXUP_MBP_VREF,
1991 ALC889_FIXUP_IMAC91_VREF,
1992 ALC889_FIXUP_MBA11_VREF,
1993 ALC889_FIXUP_MBA21_VREF,
1994 ALC889_FIXUP_MP11_VREF,
1995 ALC889_FIXUP_MP41_VREF,
1996 ALC882_FIXUP_INV_DMIC,
1997 ALC882_FIXUP_NO_PRIMARY_HP,
1998 ALC887_FIXUP_ASUS_BASS,
1999 ALC887_FIXUP_BASS_CHMAP,
2000 ALC1220_FIXUP_GB_DUAL_CODECS,
2001 ALC1220_FIXUP_GB_X570,
2002 ALC1220_FIXUP_CLEVO_P950,
2003 ALC1220_FIXUP_CLEVO_PB51ED,
2004 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
2005 ALC887_FIXUP_ASUS_AUDIO,
2006 ALC887_FIXUP_ASUS_HMIC,
2007 ALCS1200A_FIXUP_MIC_VREF,
2008 ALC888VD_FIXUP_MIC_100VREF,
2009 };
2010
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)2011 static void alc889_fixup_coef(struct hda_codec *codec,
2012 const struct hda_fixup *fix, int action)
2013 {
2014 if (action != HDA_FIXUP_ACT_INIT)
2015 return;
2016 alc_update_coef_idx(codec, 7, 0, 0x2030);
2017 }
2018
2019 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2020 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2021 const struct hda_fixup *fix, int action)
2022 {
2023 struct alc_spec *spec = codec->spec;
2024
2025 spec->gpio_write_delay = true;
2026 alc_fixup_gpio3(codec, fix, action);
2027 }
2028
2029 /* Fix the connection of some pins for ALC889:
2030 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2031 * work correctly (bko#42740)
2032 */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2033 static void alc889_fixup_dac_route(struct hda_codec *codec,
2034 const struct hda_fixup *fix, int action)
2035 {
2036 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2037 /* fake the connections during parsing the tree */
2038 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2039 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2040 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2041 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2042 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2043 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2044 } else if (action == HDA_FIXUP_ACT_PROBE) {
2045 /* restore the connections */
2046 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2047 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2048 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2049 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2050 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2051 }
2052 }
2053
2054 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2055 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2056 const struct hda_fixup *fix, int action)
2057 {
2058 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2059 struct alc_spec *spec = codec->spec;
2060 int i;
2061
2062 if (action != HDA_FIXUP_ACT_INIT)
2063 return;
2064 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2065 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2066 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2067 continue;
2068 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2069 val |= AC_PINCTL_VREF_80;
2070 snd_hda_set_pin_ctl(codec, nids[i], val);
2071 spec->gen.keep_vref_in_automute = 1;
2072 break;
2073 }
2074 }
2075
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2076 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2077 const hda_nid_t *nids, int num_nids)
2078 {
2079 struct alc_spec *spec = codec->spec;
2080 int i;
2081
2082 for (i = 0; i < num_nids; i++) {
2083 unsigned int val;
2084 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2085 val |= AC_PINCTL_VREF_50;
2086 snd_hda_set_pin_ctl(codec, nids[i], val);
2087 }
2088 spec->gen.keep_vref_in_automute = 1;
2089 }
2090
2091 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2092 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2093 const struct hda_fixup *fix, int action)
2094 {
2095 static const hda_nid_t nids[] = { 0x18, 0x1a };
2096
2097 if (action == HDA_FIXUP_ACT_INIT)
2098 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2099 }
2100
2101 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2102 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2103 const struct hda_fixup *fix, int action)
2104 {
2105 static const hda_nid_t nids[] = { 0x18 };
2106
2107 if (action == HDA_FIXUP_ACT_INIT)
2108 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2109 }
2110
2111 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2112 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2113 const struct hda_fixup *fix, int action)
2114 {
2115 static const hda_nid_t nids[] = { 0x18, 0x19 };
2116
2117 if (action == HDA_FIXUP_ACT_INIT)
2118 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2119 }
2120
2121 /* Don't take HP output as primary
2122 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2123 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2124 */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2125 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2126 const struct hda_fixup *fix, int action)
2127 {
2128 struct alc_spec *spec = codec->spec;
2129 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2130 spec->gen.no_primary_hp = 1;
2131 spec->gen.no_multi_io = 1;
2132 }
2133 }
2134
2135 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2136 const struct hda_fixup *fix, int action);
2137
2138 /* For dual-codec configuration, we need to disable some features to avoid
2139 * conflicts of kctls and PCM streams
2140 */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2141 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2142 const struct hda_fixup *fix, int action)
2143 {
2144 struct alc_spec *spec = codec->spec;
2145
2146 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2147 return;
2148 /* disable vmaster */
2149 spec->gen.suppress_vmaster = 1;
2150 /* auto-mute and auto-mic switch don't work with multiple codecs */
2151 spec->gen.suppress_auto_mute = 1;
2152 spec->gen.suppress_auto_mic = 1;
2153 /* disable aamix as well */
2154 spec->gen.mixer_nid = 0;
2155 /* add location prefix to avoid conflicts */
2156 codec->force_pin_prefix = 1;
2157 }
2158
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2159 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2160 const char *newname)
2161 {
2162 struct snd_kcontrol *kctl;
2163
2164 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2165 if (kctl)
2166 snd_ctl_rename(codec->card, kctl, newname);
2167 }
2168
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2169 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2170 const struct hda_fixup *fix,
2171 int action)
2172 {
2173 alc_fixup_dual_codecs(codec, fix, action);
2174 switch (action) {
2175 case HDA_FIXUP_ACT_PRE_PROBE:
2176 /* override card longname to provide a unique UCM profile */
2177 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2178 break;
2179 case HDA_FIXUP_ACT_BUILD:
2180 /* rename Capture controls depending on the codec */
2181 rename_ctl(codec, "Capture Volume",
2182 codec->addr == 0 ?
2183 "Rear-Panel Capture Volume" :
2184 "Front-Panel Capture Volume");
2185 rename_ctl(codec, "Capture Switch",
2186 codec->addr == 0 ?
2187 "Rear-Panel Capture Switch" :
2188 "Front-Panel Capture Switch");
2189 break;
2190 }
2191 }
2192
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2193 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2194 const struct hda_fixup *fix,
2195 int action)
2196 {
2197 static const hda_nid_t conn1[] = { 0x0c };
2198 static const struct coef_fw gb_x570_coefs[] = {
2199 WRITE_COEF(0x07, 0x03c0),
2200 WRITE_COEF(0x1a, 0x01c1),
2201 WRITE_COEF(0x1b, 0x0202),
2202 WRITE_COEF(0x43, 0x3005),
2203 {}
2204 };
2205
2206 switch (action) {
2207 case HDA_FIXUP_ACT_PRE_PROBE:
2208 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2209 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2210 break;
2211 case HDA_FIXUP_ACT_INIT:
2212 alc_process_coef_fw(codec, gb_x570_coefs);
2213 break;
2214 }
2215 }
2216
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2217 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2218 const struct hda_fixup *fix,
2219 int action)
2220 {
2221 static const hda_nid_t conn1[] = { 0x0c };
2222
2223 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2224 return;
2225
2226 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2227 /* We therefore want to make sure 0x14 (front headphone) and
2228 * 0x1b (speakers) use the stereo DAC 0x02
2229 */
2230 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2231 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2232 }
2233
2234 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2235 const struct hda_fixup *fix, int action);
2236
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2237 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2238 const struct hda_fixup *fix,
2239 int action)
2240 {
2241 alc1220_fixup_clevo_p950(codec, fix, action);
2242 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2243 }
2244
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2245 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2246 struct hda_jack_callback *jack)
2247 {
2248 struct alc_spec *spec = codec->spec;
2249 unsigned int vref;
2250
2251 snd_hda_gen_hp_automute(codec, jack);
2252
2253 if (spec->gen.hp_jack_present)
2254 vref = AC_PINCTL_VREF_80;
2255 else
2256 vref = AC_PINCTL_VREF_HIZ;
2257 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2258 }
2259
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2260 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2261 const struct hda_fixup *fix, int action)
2262 {
2263 struct alc_spec *spec = codec->spec;
2264 if (action != HDA_FIXUP_ACT_PROBE)
2265 return;
2266 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2267 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2268 }
2269
2270 static const struct hda_fixup alc882_fixups[] = {
2271 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2272 .type = HDA_FIXUP_PINS,
2273 .v.pins = (const struct hda_pintbl[]) {
2274 { 0x15, 0x01080104 }, /* side */
2275 { 0x16, 0x01011012 }, /* rear */
2276 { 0x17, 0x01016011 }, /* clfe */
2277 { }
2278 }
2279 },
2280 [ALC882_FIXUP_LENOVO_Y530] = {
2281 .type = HDA_FIXUP_PINS,
2282 .v.pins = (const struct hda_pintbl[]) {
2283 { 0x15, 0x99130112 }, /* rear int speakers */
2284 { 0x16, 0x99130111 }, /* subwoofer */
2285 { }
2286 }
2287 },
2288 [ALC882_FIXUP_PB_M5210] = {
2289 .type = HDA_FIXUP_PINCTLS,
2290 .v.pins = (const struct hda_pintbl[]) {
2291 { 0x19, PIN_VREF50 },
2292 {}
2293 }
2294 },
2295 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2296 .type = HDA_FIXUP_FUNC,
2297 .v.func = alc_fixup_sku_ignore,
2298 },
2299 [ALC882_FIXUP_ASUS_W90V] = {
2300 .type = HDA_FIXUP_PINS,
2301 .v.pins = (const struct hda_pintbl[]) {
2302 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2303 { }
2304 }
2305 },
2306 [ALC889_FIXUP_CD] = {
2307 .type = HDA_FIXUP_PINS,
2308 .v.pins = (const struct hda_pintbl[]) {
2309 { 0x1c, 0x993301f0 }, /* CD */
2310 { }
2311 }
2312 },
2313 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2314 .type = HDA_FIXUP_PINS,
2315 .v.pins = (const struct hda_pintbl[]) {
2316 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2317 { }
2318 },
2319 .chained = true,
2320 .chain_id = ALC889_FIXUP_CD,
2321 },
2322 [ALC889_FIXUP_VAIO_TT] = {
2323 .type = HDA_FIXUP_PINS,
2324 .v.pins = (const struct hda_pintbl[]) {
2325 { 0x17, 0x90170111 }, /* hidden surround speaker */
2326 { }
2327 }
2328 },
2329 [ALC888_FIXUP_EEE1601] = {
2330 .type = HDA_FIXUP_VERBS,
2331 .v.verbs = (const struct hda_verb[]) {
2332 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2333 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2334 { }
2335 }
2336 },
2337 [ALC886_FIXUP_EAPD] = {
2338 .type = HDA_FIXUP_VERBS,
2339 .v.verbs = (const struct hda_verb[]) {
2340 /* change to EAPD mode */
2341 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2342 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2343 { }
2344 }
2345 },
2346 [ALC882_FIXUP_EAPD] = {
2347 .type = HDA_FIXUP_VERBS,
2348 .v.verbs = (const struct hda_verb[]) {
2349 /* change to EAPD mode */
2350 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2351 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2352 { }
2353 }
2354 },
2355 [ALC883_FIXUP_EAPD] = {
2356 .type = HDA_FIXUP_VERBS,
2357 .v.verbs = (const struct hda_verb[]) {
2358 /* change to EAPD mode */
2359 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2360 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2361 { }
2362 }
2363 },
2364 [ALC883_FIXUP_ACER_EAPD] = {
2365 .type = HDA_FIXUP_VERBS,
2366 .v.verbs = (const struct hda_verb[]) {
2367 /* eanable EAPD on Acer laptops */
2368 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2369 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2370 { }
2371 }
2372 },
2373 [ALC882_FIXUP_GPIO1] = {
2374 .type = HDA_FIXUP_FUNC,
2375 .v.func = alc_fixup_gpio1,
2376 },
2377 [ALC882_FIXUP_GPIO2] = {
2378 .type = HDA_FIXUP_FUNC,
2379 .v.func = alc_fixup_gpio2,
2380 },
2381 [ALC882_FIXUP_GPIO3] = {
2382 .type = HDA_FIXUP_FUNC,
2383 .v.func = alc_fixup_gpio3,
2384 },
2385 [ALC882_FIXUP_ASUS_W2JC] = {
2386 .type = HDA_FIXUP_FUNC,
2387 .v.func = alc_fixup_gpio1,
2388 .chained = true,
2389 .chain_id = ALC882_FIXUP_EAPD,
2390 },
2391 [ALC889_FIXUP_COEF] = {
2392 .type = HDA_FIXUP_FUNC,
2393 .v.func = alc889_fixup_coef,
2394 },
2395 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2396 .type = HDA_FIXUP_PINS,
2397 .v.pins = (const struct hda_pintbl[]) {
2398 { 0x16, 0x99130111 }, /* CLFE speaker */
2399 { 0x17, 0x99130112 }, /* surround speaker */
2400 { }
2401 },
2402 .chained = true,
2403 .chain_id = ALC882_FIXUP_GPIO1,
2404 },
2405 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2406 .type = HDA_FIXUP_PINS,
2407 .v.pins = (const struct hda_pintbl[]) {
2408 { 0x16, 0x99130111 }, /* CLFE speaker */
2409 { 0x1b, 0x99130112 }, /* surround speaker */
2410 { }
2411 },
2412 .chained = true,
2413 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2414 },
2415 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2416 /* additional init verbs for Acer Aspire 8930G */
2417 .type = HDA_FIXUP_VERBS,
2418 .v.verbs = (const struct hda_verb[]) {
2419 /* Enable all DACs */
2420 /* DAC DISABLE/MUTE 1? */
2421 /* setting bits 1-5 disables DAC nids 0x02-0x06
2422 * apparently. Init=0x38 */
2423 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2424 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2425 /* DAC DISABLE/MUTE 2? */
2426 /* some bit here disables the other DACs.
2427 * Init=0x4900 */
2428 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2429 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2430 /* DMIC fix
2431 * This laptop has a stereo digital microphone.
2432 * The mics are only 1cm apart which makes the stereo
2433 * useless. However, either the mic or the ALC889
2434 * makes the signal become a difference/sum signal
2435 * instead of standard stereo, which is annoying.
2436 * So instead we flip this bit which makes the
2437 * codec replicate the sum signal to both channels,
2438 * turning it into a normal mono mic.
2439 */
2440 /* DMIC_CONTROL? Init value = 0x0001 */
2441 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2442 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2443 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2444 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2445 { }
2446 },
2447 .chained = true,
2448 .chain_id = ALC882_FIXUP_GPIO1,
2449 },
2450 [ALC885_FIXUP_MACPRO_GPIO] = {
2451 .type = HDA_FIXUP_FUNC,
2452 .v.func = alc885_fixup_macpro_gpio,
2453 },
2454 [ALC889_FIXUP_DAC_ROUTE] = {
2455 .type = HDA_FIXUP_FUNC,
2456 .v.func = alc889_fixup_dac_route,
2457 },
2458 [ALC889_FIXUP_MBP_VREF] = {
2459 .type = HDA_FIXUP_FUNC,
2460 .v.func = alc889_fixup_mbp_vref,
2461 .chained = true,
2462 .chain_id = ALC882_FIXUP_GPIO1,
2463 },
2464 [ALC889_FIXUP_IMAC91_VREF] = {
2465 .type = HDA_FIXUP_FUNC,
2466 .v.func = alc889_fixup_imac91_vref,
2467 .chained = true,
2468 .chain_id = ALC882_FIXUP_GPIO1,
2469 },
2470 [ALC889_FIXUP_MBA11_VREF] = {
2471 .type = HDA_FIXUP_FUNC,
2472 .v.func = alc889_fixup_mba11_vref,
2473 .chained = true,
2474 .chain_id = ALC889_FIXUP_MBP_VREF,
2475 },
2476 [ALC889_FIXUP_MBA21_VREF] = {
2477 .type = HDA_FIXUP_FUNC,
2478 .v.func = alc889_fixup_mba21_vref,
2479 .chained = true,
2480 .chain_id = ALC889_FIXUP_MBP_VREF,
2481 },
2482 [ALC889_FIXUP_MP11_VREF] = {
2483 .type = HDA_FIXUP_FUNC,
2484 .v.func = alc889_fixup_mba11_vref,
2485 .chained = true,
2486 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2487 },
2488 [ALC889_FIXUP_MP41_VREF] = {
2489 .type = HDA_FIXUP_FUNC,
2490 .v.func = alc889_fixup_mbp_vref,
2491 .chained = true,
2492 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2493 },
2494 [ALC882_FIXUP_INV_DMIC] = {
2495 .type = HDA_FIXUP_FUNC,
2496 .v.func = alc_fixup_inv_dmic,
2497 },
2498 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2499 .type = HDA_FIXUP_FUNC,
2500 .v.func = alc882_fixup_no_primary_hp,
2501 },
2502 [ALC887_FIXUP_ASUS_BASS] = {
2503 .type = HDA_FIXUP_PINS,
2504 .v.pins = (const struct hda_pintbl[]) {
2505 {0x16, 0x99130130}, /* bass speaker */
2506 {}
2507 },
2508 .chained = true,
2509 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2510 },
2511 [ALC887_FIXUP_BASS_CHMAP] = {
2512 .type = HDA_FIXUP_FUNC,
2513 .v.func = alc_fixup_bass_chmap,
2514 },
2515 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2516 .type = HDA_FIXUP_FUNC,
2517 .v.func = alc1220_fixup_gb_dual_codecs,
2518 },
2519 [ALC1220_FIXUP_GB_X570] = {
2520 .type = HDA_FIXUP_FUNC,
2521 .v.func = alc1220_fixup_gb_x570,
2522 },
2523 [ALC1220_FIXUP_CLEVO_P950] = {
2524 .type = HDA_FIXUP_FUNC,
2525 .v.func = alc1220_fixup_clevo_p950,
2526 },
2527 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2528 .type = HDA_FIXUP_FUNC,
2529 .v.func = alc1220_fixup_clevo_pb51ed,
2530 },
2531 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2532 .type = HDA_FIXUP_PINS,
2533 .v.pins = (const struct hda_pintbl[]) {
2534 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2535 {}
2536 },
2537 .chained = true,
2538 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2539 },
2540 [ALC887_FIXUP_ASUS_AUDIO] = {
2541 .type = HDA_FIXUP_PINS,
2542 .v.pins = (const struct hda_pintbl[]) {
2543 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2544 { 0x19, 0x22219420 },
2545 {}
2546 },
2547 },
2548 [ALC887_FIXUP_ASUS_HMIC] = {
2549 .type = HDA_FIXUP_FUNC,
2550 .v.func = alc887_fixup_asus_jack,
2551 .chained = true,
2552 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2553 },
2554 [ALCS1200A_FIXUP_MIC_VREF] = {
2555 .type = HDA_FIXUP_PINCTLS,
2556 .v.pins = (const struct hda_pintbl[]) {
2557 { 0x18, PIN_VREF50 }, /* rear mic */
2558 { 0x19, PIN_VREF50 }, /* front mic */
2559 {}
2560 }
2561 },
2562 [ALC888VD_FIXUP_MIC_100VREF] = {
2563 .type = HDA_FIXUP_PINCTLS,
2564 .v.pins = (const struct hda_pintbl[]) {
2565 { 0x18, PIN_VREF100 }, /* headset mic */
2566 {}
2567 }
2568 },
2569 };
2570
2571 static const struct hda_quirk alc882_fixup_tbl[] = {
2572 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2573 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2574 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2575 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2576 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2577 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2578 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2579 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2580 ALC882_FIXUP_ACER_ASPIRE_4930G),
2581 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2582 ALC882_FIXUP_ACER_ASPIRE_4930G),
2583 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2584 ALC882_FIXUP_ACER_ASPIRE_8930G),
2585 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2586 ALC882_FIXUP_ACER_ASPIRE_8930G),
2587 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2588 ALC882_FIXUP_ACER_ASPIRE_4930G),
2589 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2590 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2591 ALC882_FIXUP_ACER_ASPIRE_4930G),
2592 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2593 ALC882_FIXUP_ACER_ASPIRE_4930G),
2594 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2595 ALC882_FIXUP_ACER_ASPIRE_4930G),
2596 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2597 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2598 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2599 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2600 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2601 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2602 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2603 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2604 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2605 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2606 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2607 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2608 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2609 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2610 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2611 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2612
2613 /* All Apple entries are in codec SSIDs */
2614 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2615 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2616 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2617 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2618 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2619 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2620 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2621 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2622 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2623 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2624 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2625 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2626 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2627 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2628 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2629 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2630 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2631 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2632 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2633 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2634 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2635 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2636
2637 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2638 SND_PCI_QUIRK(0x10ec, 0x12d8, "iBase Elo Touch", ALC888VD_FIXUP_MIC_100VREF),
2639 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2640 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2641 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2642 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2643 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2644 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2645 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2646 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2647 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2648 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2649 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2650 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2651 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2652 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2653 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2654 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2655 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2656 SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2657 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2658 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2660 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2661 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2662 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2663 SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2664 SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2665 SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2666 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2667 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2668 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2669 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2670 SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2671 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2672 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2673 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2674 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2675 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2676 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2677 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2678 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2679 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2680 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2681 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2682 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2683 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2684 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2685 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2686 SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2687 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2688 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2689 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2690 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2691 {}
2692 };
2693
2694 static const struct hda_model_fixup alc882_fixup_models[] = {
2695 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2696 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2697 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2698 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2699 {.id = ALC889_FIXUP_CD, .name = "cd"},
2700 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2701 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2702 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2703 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2704 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2705 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2706 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2707 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2708 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2709 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2710 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2711 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2712 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2713 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2714 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2715 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2716 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2717 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2718 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2719 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2720 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2721 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2722 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2723 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2724 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2725 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2726 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2727 {}
2728 };
2729
2730 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2731 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2732 {0x14, 0x01014010},
2733 {0x15, 0x01011012},
2734 {0x16, 0x01016011},
2735 {0x18, 0x01a19040},
2736 {0x19, 0x02a19050},
2737 {0x1a, 0x0181304f},
2738 {0x1b, 0x0221401f},
2739 {0x1e, 0x01456130}),
2740 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2741 {0x14, 0x01015010},
2742 {0x15, 0x01011012},
2743 {0x16, 0x01011011},
2744 {0x18, 0x01a11040},
2745 {0x19, 0x02a19050},
2746 {0x1a, 0x0181104f},
2747 {0x1b, 0x0221401f},
2748 {0x1e, 0x01451130}),
2749 {}
2750 };
2751
2752 /*
2753 * BIOS auto configuration
2754 */
2755 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2756 static int alc882_parse_auto_config(struct hda_codec *codec)
2757 {
2758 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2759 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2760 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2761 }
2762
2763 /*
2764 */
patch_alc882(struct hda_codec * codec)2765 static int patch_alc882(struct hda_codec *codec)
2766 {
2767 struct alc_spec *spec;
2768 int err;
2769
2770 err = alc_alloc_spec(codec, 0x0b);
2771 if (err < 0)
2772 return err;
2773
2774 spec = codec->spec;
2775
2776 switch (codec->core.vendor_id) {
2777 case 0x10ec0882:
2778 case 0x10ec0885:
2779 case 0x10ec0900:
2780 case 0x10ec0b00:
2781 case 0x10ec1220:
2782 break;
2783 default:
2784 /* ALC883 and variants */
2785 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2786 break;
2787 }
2788
2789 alc_pre_init(codec);
2790
2791 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2792 alc882_fixups);
2793 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2794 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2795
2796 alc_auto_parse_customize_define(codec);
2797
2798 if (has_cdefine_beep(codec))
2799 spec->gen.beep_nid = 0x01;
2800
2801 /* automatic parse from the BIOS config */
2802 err = alc882_parse_auto_config(codec);
2803 if (err < 0)
2804 goto error;
2805
2806 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2807 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2808 if (err < 0)
2809 goto error;
2810 }
2811
2812 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2813
2814 return 0;
2815
2816 error:
2817 alc_free(codec);
2818 return err;
2819 }
2820
2821
2822 /*
2823 * ALC262 support
2824 */
alc262_parse_auto_config(struct hda_codec * codec)2825 static int alc262_parse_auto_config(struct hda_codec *codec)
2826 {
2827 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2828 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2829 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2830 }
2831
2832 /*
2833 * Pin config fixes
2834 */
2835 enum {
2836 ALC262_FIXUP_FSC_H270,
2837 ALC262_FIXUP_FSC_S7110,
2838 ALC262_FIXUP_HP_Z200,
2839 ALC262_FIXUP_TYAN,
2840 ALC262_FIXUP_LENOVO_3000,
2841 ALC262_FIXUP_BENQ,
2842 ALC262_FIXUP_BENQ_T31,
2843 ALC262_FIXUP_INV_DMIC,
2844 ALC262_FIXUP_INTEL_BAYLEYBAY,
2845 };
2846
2847 static const struct hda_fixup alc262_fixups[] = {
2848 [ALC262_FIXUP_FSC_H270] = {
2849 .type = HDA_FIXUP_PINS,
2850 .v.pins = (const struct hda_pintbl[]) {
2851 { 0x14, 0x99130110 }, /* speaker */
2852 { 0x15, 0x0221142f }, /* front HP */
2853 { 0x1b, 0x0121141f }, /* rear HP */
2854 { }
2855 }
2856 },
2857 [ALC262_FIXUP_FSC_S7110] = {
2858 .type = HDA_FIXUP_PINS,
2859 .v.pins = (const struct hda_pintbl[]) {
2860 { 0x15, 0x90170110 }, /* speaker */
2861 { }
2862 },
2863 .chained = true,
2864 .chain_id = ALC262_FIXUP_BENQ,
2865 },
2866 [ALC262_FIXUP_HP_Z200] = {
2867 .type = HDA_FIXUP_PINS,
2868 .v.pins = (const struct hda_pintbl[]) {
2869 { 0x16, 0x99130120 }, /* internal speaker */
2870 { }
2871 }
2872 },
2873 [ALC262_FIXUP_TYAN] = {
2874 .type = HDA_FIXUP_PINS,
2875 .v.pins = (const struct hda_pintbl[]) {
2876 { 0x14, 0x1993e1f0 }, /* int AUX */
2877 { }
2878 }
2879 },
2880 [ALC262_FIXUP_LENOVO_3000] = {
2881 .type = HDA_FIXUP_PINCTLS,
2882 .v.pins = (const struct hda_pintbl[]) {
2883 { 0x19, PIN_VREF50 },
2884 {}
2885 },
2886 .chained = true,
2887 .chain_id = ALC262_FIXUP_BENQ,
2888 },
2889 [ALC262_FIXUP_BENQ] = {
2890 .type = HDA_FIXUP_VERBS,
2891 .v.verbs = (const struct hda_verb[]) {
2892 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2893 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2894 {}
2895 }
2896 },
2897 [ALC262_FIXUP_BENQ_T31] = {
2898 .type = HDA_FIXUP_VERBS,
2899 .v.verbs = (const struct hda_verb[]) {
2900 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2901 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2902 {}
2903 }
2904 },
2905 [ALC262_FIXUP_INV_DMIC] = {
2906 .type = HDA_FIXUP_FUNC,
2907 .v.func = alc_fixup_inv_dmic,
2908 },
2909 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2910 .type = HDA_FIXUP_FUNC,
2911 .v.func = alc_fixup_no_depop_delay,
2912 },
2913 };
2914
2915 static const struct hda_quirk alc262_fixup_tbl[] = {
2916 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2917 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2918 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2919 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2920 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2921 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2922 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2923 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2924 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2925 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2926 {}
2927 };
2928
2929 static const struct hda_model_fixup alc262_fixup_models[] = {
2930 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2931 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2932 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2933 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2934 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2935 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2936 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2937 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2938 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2939 {}
2940 };
2941
2942 /*
2943 */
patch_alc262(struct hda_codec * codec)2944 static int patch_alc262(struct hda_codec *codec)
2945 {
2946 struct alc_spec *spec;
2947 int err;
2948
2949 err = alc_alloc_spec(codec, 0x0b);
2950 if (err < 0)
2951 return err;
2952
2953 spec = codec->spec;
2954 spec->gen.shared_mic_vref_pin = 0x18;
2955
2956 spec->shutup = alc_eapd_shutup;
2957
2958 #if 0
2959 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2960 * under-run
2961 */
2962 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2963 #endif
2964 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2965
2966 alc_pre_init(codec);
2967
2968 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2969 alc262_fixups);
2970 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2971
2972 alc_auto_parse_customize_define(codec);
2973
2974 if (has_cdefine_beep(codec))
2975 spec->gen.beep_nid = 0x01;
2976
2977 /* automatic parse from the BIOS config */
2978 err = alc262_parse_auto_config(codec);
2979 if (err < 0)
2980 goto error;
2981
2982 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2983 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2984 if (err < 0)
2985 goto error;
2986 }
2987
2988 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2989
2990 return 0;
2991
2992 error:
2993 alc_free(codec);
2994 return err;
2995 }
2996
2997 /*
2998 * ALC268
2999 */
3000 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)3001 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
3002 struct snd_ctl_elem_value *ucontrol)
3003 {
3004 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3005 unsigned long pval;
3006 int err;
3007
3008 mutex_lock(&codec->control_mutex);
3009 pval = kcontrol->private_value;
3010 kcontrol->private_value = (pval & ~0xff) | 0x0f;
3011 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3012 if (err >= 0) {
3013 kcontrol->private_value = (pval & ~0xff) | 0x10;
3014 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
3015 }
3016 kcontrol->private_value = pval;
3017 mutex_unlock(&codec->control_mutex);
3018 return err;
3019 }
3020
3021 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
3022 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
3023 {
3024 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3025 .name = "Beep Playback Switch",
3026 .subdevice = HDA_SUBDEV_AMP_FLAG,
3027 .info = snd_hda_mixer_amp_switch_info,
3028 .get = snd_hda_mixer_amp_switch_get,
3029 .put = alc268_beep_switch_put,
3030 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3031 },
3032 };
3033
3034 /* set PCBEEP vol = 0, mute connections */
3035 static const struct hda_verb alc268_beep_init_verbs[] = {
3036 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3037 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3038 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3039 { }
3040 };
3041
3042 enum {
3043 ALC268_FIXUP_INV_DMIC,
3044 ALC268_FIXUP_HP_EAPD,
3045 ALC268_FIXUP_SPDIF,
3046 };
3047
3048 static const struct hda_fixup alc268_fixups[] = {
3049 [ALC268_FIXUP_INV_DMIC] = {
3050 .type = HDA_FIXUP_FUNC,
3051 .v.func = alc_fixup_inv_dmic,
3052 },
3053 [ALC268_FIXUP_HP_EAPD] = {
3054 .type = HDA_FIXUP_VERBS,
3055 .v.verbs = (const struct hda_verb[]) {
3056 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3057 {}
3058 }
3059 },
3060 [ALC268_FIXUP_SPDIF] = {
3061 .type = HDA_FIXUP_PINS,
3062 .v.pins = (const struct hda_pintbl[]) {
3063 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3064 {}
3065 }
3066 },
3067 };
3068
3069 static const struct hda_model_fixup alc268_fixup_models[] = {
3070 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3071 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3072 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3073 {}
3074 };
3075
3076 static const struct hda_quirk alc268_fixup_tbl[] = {
3077 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3078 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3079 /* below is codec SSID since multiple Toshiba laptops have the
3080 * same PCI SSID 1179:ff00
3081 */
3082 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3083 {}
3084 };
3085
3086 /*
3087 * BIOS auto configuration
3088 */
alc268_parse_auto_config(struct hda_codec * codec)3089 static int alc268_parse_auto_config(struct hda_codec *codec)
3090 {
3091 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3092 return alc_parse_auto_config(codec, NULL, alc268_ssids);
3093 }
3094
3095 /*
3096 */
patch_alc268(struct hda_codec * codec)3097 static int patch_alc268(struct hda_codec *codec)
3098 {
3099 struct alc_spec *spec;
3100 int i, err;
3101
3102 /* ALC268 has no aa-loopback mixer */
3103 err = alc_alloc_spec(codec, 0);
3104 if (err < 0)
3105 return err;
3106
3107 spec = codec->spec;
3108 if (has_cdefine_beep(codec))
3109 spec->gen.beep_nid = 0x01;
3110
3111 spec->shutup = alc_eapd_shutup;
3112
3113 alc_pre_init(codec);
3114
3115 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3116 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3117
3118 /* automatic parse from the BIOS config */
3119 err = alc268_parse_auto_config(codec);
3120 if (err < 0)
3121 goto error;
3122
3123 if (err > 0 && !spec->gen.no_analog &&
3124 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3125 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3126 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3127 &alc268_beep_mixer[i])) {
3128 err = -ENOMEM;
3129 goto error;
3130 }
3131 }
3132 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3133 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3134 /* override the amp caps for beep generator */
3135 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3136 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3137 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3138 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3139 (0 << AC_AMPCAP_MUTE_SHIFT));
3140 }
3141
3142 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3143
3144 return 0;
3145
3146 error:
3147 alc_free(codec);
3148 return err;
3149 }
3150
3151 /*
3152 * ALC269
3153 */
3154
3155 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3156 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3157 };
3158
3159 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3160 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3161 };
3162
3163 /* different alc269-variants */
3164 enum {
3165 ALC269_TYPE_ALC269VA,
3166 ALC269_TYPE_ALC269VB,
3167 ALC269_TYPE_ALC269VC,
3168 ALC269_TYPE_ALC269VD,
3169 ALC269_TYPE_ALC280,
3170 ALC269_TYPE_ALC282,
3171 ALC269_TYPE_ALC283,
3172 ALC269_TYPE_ALC284,
3173 ALC269_TYPE_ALC293,
3174 ALC269_TYPE_ALC286,
3175 ALC269_TYPE_ALC298,
3176 ALC269_TYPE_ALC255,
3177 ALC269_TYPE_ALC256,
3178 ALC269_TYPE_ALC257,
3179 ALC269_TYPE_ALC215,
3180 ALC269_TYPE_ALC225,
3181 ALC269_TYPE_ALC245,
3182 ALC269_TYPE_ALC287,
3183 ALC269_TYPE_ALC294,
3184 ALC269_TYPE_ALC300,
3185 ALC269_TYPE_ALC623,
3186 ALC269_TYPE_ALC700,
3187 };
3188
3189 /*
3190 * BIOS auto configuration
3191 */
alc269_parse_auto_config(struct hda_codec * codec)3192 static int alc269_parse_auto_config(struct hda_codec *codec)
3193 {
3194 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3195 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3196 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3197 struct alc_spec *spec = codec->spec;
3198 const hda_nid_t *ssids;
3199
3200 switch (spec->codec_variant) {
3201 case ALC269_TYPE_ALC269VA:
3202 case ALC269_TYPE_ALC269VC:
3203 case ALC269_TYPE_ALC280:
3204 case ALC269_TYPE_ALC284:
3205 case ALC269_TYPE_ALC293:
3206 ssids = alc269va_ssids;
3207 break;
3208 case ALC269_TYPE_ALC269VB:
3209 case ALC269_TYPE_ALC269VD:
3210 case ALC269_TYPE_ALC282:
3211 case ALC269_TYPE_ALC283:
3212 case ALC269_TYPE_ALC286:
3213 case ALC269_TYPE_ALC298:
3214 case ALC269_TYPE_ALC255:
3215 case ALC269_TYPE_ALC256:
3216 case ALC269_TYPE_ALC257:
3217 case ALC269_TYPE_ALC215:
3218 case ALC269_TYPE_ALC225:
3219 case ALC269_TYPE_ALC245:
3220 case ALC269_TYPE_ALC287:
3221 case ALC269_TYPE_ALC294:
3222 case ALC269_TYPE_ALC300:
3223 case ALC269_TYPE_ALC623:
3224 case ALC269_TYPE_ALC700:
3225 ssids = alc269_ssids;
3226 break;
3227 default:
3228 ssids = alc269_ssids;
3229 break;
3230 }
3231
3232 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3233 }
3234
3235 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3236 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3237 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3238 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3239 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3240 {}
3241 };
3242
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3243 static void alc_headset_btn_callback(struct hda_codec *codec,
3244 struct hda_jack_callback *jack)
3245 {
3246 int report = 0;
3247
3248 if (jack->unsol_res & (7 << 13))
3249 report |= SND_JACK_BTN_0;
3250
3251 if (jack->unsol_res & (1 << 16 | 3 << 8))
3252 report |= SND_JACK_BTN_1;
3253
3254 /* Volume up key */
3255 if (jack->unsol_res & (7 << 23))
3256 report |= SND_JACK_BTN_2;
3257
3258 /* Volume down key */
3259 if (jack->unsol_res & (7 << 10))
3260 report |= SND_JACK_BTN_3;
3261
3262 snd_hda_jack_set_button_state(codec, jack->nid, report);
3263 }
3264
alc_disable_headset_jack_key(struct hda_codec * codec)3265 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3266 {
3267 struct alc_spec *spec = codec->spec;
3268
3269 if (!spec->has_hs_key)
3270 return;
3271
3272 switch (codec->core.vendor_id) {
3273 case 0x10ec0215:
3274 case 0x10ec0225:
3275 case 0x10ec0285:
3276 case 0x10ec0287:
3277 case 0x10ec0295:
3278 case 0x10ec0289:
3279 case 0x10ec0299:
3280 alc_write_coef_idx(codec, 0x48, 0x0);
3281 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3282 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3283 break;
3284 case 0x10ec0230:
3285 case 0x10ec0236:
3286 case 0x10ec0256:
3287 case 0x10ec0257:
3288 case 0x19e58326:
3289 alc_write_coef_idx(codec, 0x48, 0x0);
3290 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3291 break;
3292 }
3293 }
3294
alc_enable_headset_jack_key(struct hda_codec * codec)3295 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3296 {
3297 struct alc_spec *spec = codec->spec;
3298
3299 if (!spec->has_hs_key)
3300 return;
3301
3302 switch (codec->core.vendor_id) {
3303 case 0x10ec0215:
3304 case 0x10ec0225:
3305 case 0x10ec0285:
3306 case 0x10ec0287:
3307 case 0x10ec0295:
3308 case 0x10ec0289:
3309 case 0x10ec0299:
3310 alc_write_coef_idx(codec, 0x48, 0xd011);
3311 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3312 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3313 break;
3314 case 0x10ec0230:
3315 case 0x10ec0236:
3316 case 0x10ec0256:
3317 case 0x10ec0257:
3318 case 0x19e58326:
3319 alc_write_coef_idx(codec, 0x48, 0xd011);
3320 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3321 break;
3322 }
3323 }
3324
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3325 static void alc_fixup_headset_jack(struct hda_codec *codec,
3326 const struct hda_fixup *fix, int action)
3327 {
3328 struct alc_spec *spec = codec->spec;
3329 hda_nid_t hp_pin;
3330
3331 switch (action) {
3332 case HDA_FIXUP_ACT_PRE_PROBE:
3333 spec->has_hs_key = 1;
3334 snd_hda_jack_detect_enable_callback(codec, 0x55,
3335 alc_headset_btn_callback);
3336 break;
3337 case HDA_FIXUP_ACT_BUILD:
3338 hp_pin = alc_get_hp_pin(spec);
3339 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3340 alc_headset_btn_keymap,
3341 hp_pin))
3342 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3343 false, SND_JACK_HEADSET,
3344 alc_headset_btn_keymap);
3345
3346 alc_enable_headset_jack_key(codec);
3347 break;
3348 }
3349 }
3350
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3351 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3352 {
3353 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3354 }
3355
alc269_shutup(struct hda_codec * codec)3356 static void alc269_shutup(struct hda_codec *codec)
3357 {
3358 struct alc_spec *spec = codec->spec;
3359
3360 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3361 alc269vb_toggle_power_output(codec, 0);
3362 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3363 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3364 msleep(150);
3365 }
3366 alc_shutup_pins(codec);
3367 }
3368
3369 static const struct coef_fw alc282_coefs[] = {
3370 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3371 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3372 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3373 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3374 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3375 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3376 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3377 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3378 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3379 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3380 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3381 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3382 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3383 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3384 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3385 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3386 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3387 WRITE_COEF(0x63, 0x2902), /* PLL */
3388 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3389 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3390 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3391 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3392 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3393 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3394 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3395 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3396 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3397 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3398 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3399 {}
3400 };
3401
alc282_restore_default_value(struct hda_codec * codec)3402 static void alc282_restore_default_value(struct hda_codec *codec)
3403 {
3404 alc_process_coef_fw(codec, alc282_coefs);
3405 }
3406
alc282_init(struct hda_codec * codec)3407 static void alc282_init(struct hda_codec *codec)
3408 {
3409 struct alc_spec *spec = codec->spec;
3410 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3411 bool hp_pin_sense;
3412 int coef78;
3413
3414 alc282_restore_default_value(codec);
3415
3416 if (!hp_pin)
3417 return;
3418 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3419 coef78 = alc_read_coef_idx(codec, 0x78);
3420
3421 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3422 /* Headphone capless set to high power mode */
3423 alc_write_coef_idx(codec, 0x78, 0x9004);
3424
3425 if (hp_pin_sense)
3426 msleep(2);
3427
3428 snd_hda_codec_write(codec, hp_pin, 0,
3429 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3430
3431 if (hp_pin_sense)
3432 msleep(85);
3433
3434 snd_hda_codec_write(codec, hp_pin, 0,
3435 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3436
3437 if (hp_pin_sense)
3438 msleep(100);
3439
3440 /* Headphone capless set to normal mode */
3441 alc_write_coef_idx(codec, 0x78, coef78);
3442 }
3443
alc282_shutup(struct hda_codec * codec)3444 static void alc282_shutup(struct hda_codec *codec)
3445 {
3446 struct alc_spec *spec = codec->spec;
3447 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3448 bool hp_pin_sense;
3449 int coef78;
3450
3451 if (!hp_pin) {
3452 alc269_shutup(codec);
3453 return;
3454 }
3455
3456 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3457 coef78 = alc_read_coef_idx(codec, 0x78);
3458 alc_write_coef_idx(codec, 0x78, 0x9004);
3459
3460 if (hp_pin_sense)
3461 msleep(2);
3462
3463 snd_hda_codec_write(codec, hp_pin, 0,
3464 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3465
3466 if (hp_pin_sense)
3467 msleep(85);
3468
3469 if (!spec->no_shutup_pins)
3470 snd_hda_codec_write(codec, hp_pin, 0,
3471 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3472
3473 if (hp_pin_sense)
3474 msleep(100);
3475
3476 alc_auto_setup_eapd(codec, false);
3477 alc_shutup_pins(codec);
3478 alc_write_coef_idx(codec, 0x78, coef78);
3479 }
3480
3481 static const struct coef_fw alc283_coefs[] = {
3482 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3483 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3484 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3485 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3486 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3487 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3488 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3489 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3490 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3491 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3492 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3493 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3494 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3495 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3496 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3497 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3498 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3499 WRITE_COEF(0x2e, 0x2902), /* PLL */
3500 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3501 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3502 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3503 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3504 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3505 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3506 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3507 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3508 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3509 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3510 WRITE_COEF(0x49, 0x0), /* test mode */
3511 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3512 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3513 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3514 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3515 {}
3516 };
3517
alc283_restore_default_value(struct hda_codec * codec)3518 static void alc283_restore_default_value(struct hda_codec *codec)
3519 {
3520 alc_process_coef_fw(codec, alc283_coefs);
3521 }
3522
alc283_init(struct hda_codec * codec)3523 static void alc283_init(struct hda_codec *codec)
3524 {
3525 struct alc_spec *spec = codec->spec;
3526 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3527 bool hp_pin_sense;
3528
3529 alc283_restore_default_value(codec);
3530
3531 if (!hp_pin)
3532 return;
3533
3534 msleep(30);
3535 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3536
3537 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3538 /* Headphone capless set to high power mode */
3539 alc_write_coef_idx(codec, 0x43, 0x9004);
3540
3541 snd_hda_codec_write(codec, hp_pin, 0,
3542 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3543
3544 if (hp_pin_sense)
3545 msleep(85);
3546
3547 snd_hda_codec_write(codec, hp_pin, 0,
3548 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3549
3550 if (hp_pin_sense)
3551 msleep(85);
3552 /* Index 0x46 Combo jack auto switch control 2 */
3553 /* 3k pull low control for Headset jack. */
3554 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3555 /* Headphone capless set to normal mode */
3556 alc_write_coef_idx(codec, 0x43, 0x9614);
3557 }
3558
alc283_shutup(struct hda_codec * codec)3559 static void alc283_shutup(struct hda_codec *codec)
3560 {
3561 struct alc_spec *spec = codec->spec;
3562 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3563 bool hp_pin_sense;
3564
3565 if (!hp_pin) {
3566 alc269_shutup(codec);
3567 return;
3568 }
3569
3570 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3571
3572 alc_write_coef_idx(codec, 0x43, 0x9004);
3573
3574 /*depop hp during suspend*/
3575 alc_write_coef_idx(codec, 0x06, 0x2100);
3576
3577 snd_hda_codec_write(codec, hp_pin, 0,
3578 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3579
3580 if (hp_pin_sense)
3581 msleep(100);
3582
3583 if (!spec->no_shutup_pins)
3584 snd_hda_codec_write(codec, hp_pin, 0,
3585 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3586
3587 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3588
3589 if (hp_pin_sense)
3590 msleep(100);
3591 alc_auto_setup_eapd(codec, false);
3592 alc_shutup_pins(codec);
3593 alc_write_coef_idx(codec, 0x43, 0x9614);
3594 }
3595
alc256_init(struct hda_codec * codec)3596 static void alc256_init(struct hda_codec *codec)
3597 {
3598 struct alc_spec *spec = codec->spec;
3599 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3600 bool hp_pin_sense;
3601
3602 if (spec->ultra_low_power) {
3603 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3604 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3605 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3606 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3607 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3608 msleep(30);
3609 }
3610
3611 if (!hp_pin)
3612 hp_pin = 0x21;
3613
3614 msleep(30);
3615
3616 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3617
3618 if (hp_pin_sense) {
3619 msleep(2);
3620 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3621
3622 snd_hda_codec_write(codec, hp_pin, 0,
3623 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3624
3625 msleep(75);
3626
3627 snd_hda_codec_write(codec, hp_pin, 0,
3628 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3629
3630 msleep(75);
3631 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3632 }
3633 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3634 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3635 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3636 /*
3637 * Expose headphone mic (or possibly Line In on some machines) instead
3638 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3639 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3640 * this register.
3641 */
3642 alc_write_coef_idx(codec, 0x36, 0x5757);
3643 }
3644
alc256_shutup(struct hda_codec * codec)3645 static void alc256_shutup(struct hda_codec *codec)
3646 {
3647 struct alc_spec *spec = codec->spec;
3648 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3649 bool hp_pin_sense;
3650
3651 if (!hp_pin)
3652 hp_pin = 0x21;
3653
3654 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3655 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3656
3657 if (hp_pin_sense) {
3658 msleep(2);
3659
3660 snd_hda_codec_write(codec, hp_pin, 0,
3661 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3662
3663 msleep(75);
3664
3665 /* 3k pull low control for Headset jack. */
3666 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3667 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3668 * when booting with headset plugged. So skip setting it for the codec alc257
3669 */
3670 if (spec->en_3kpull_low)
3671 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3672
3673 if (!spec->no_shutup_pins)
3674 snd_hda_codec_write(codec, hp_pin, 0,
3675 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3676
3677 msleep(75);
3678 }
3679
3680 alc_auto_setup_eapd(codec, false);
3681 alc_shutup_pins(codec);
3682 if (spec->ultra_low_power) {
3683 msleep(50);
3684 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3685 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3686 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3687 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3688 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3689 msleep(30);
3690 }
3691 }
3692
alc285_hp_init(struct hda_codec * codec)3693 static void alc285_hp_init(struct hda_codec *codec)
3694 {
3695 struct alc_spec *spec = codec->spec;
3696 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3697 int i, val;
3698 int coef38, coef0d, coef36;
3699
3700 alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
3701 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3702 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3703 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3704 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3705 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3706 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3707
3708 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3709
3710 if (hp_pin)
3711 snd_hda_codec_write(codec, hp_pin, 0,
3712 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3713
3714 msleep(130);
3715 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3716 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3717
3718 if (hp_pin)
3719 snd_hda_codec_write(codec, hp_pin, 0,
3720 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3721 msleep(10);
3722 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3723 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3724 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3725 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3726
3727 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3728 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3729 for (i = 0; i < 20 && val & 0x8000; i++) {
3730 msleep(50);
3731 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3732 } /* Wait for depop procedure finish */
3733
3734 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3735 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3736 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3737 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3738
3739 msleep(50);
3740 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3741 }
3742
alc225_init(struct hda_codec * codec)3743 static void alc225_init(struct hda_codec *codec)
3744 {
3745 struct alc_spec *spec = codec->spec;
3746 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3747 bool hp1_pin_sense, hp2_pin_sense;
3748
3749 if (spec->ultra_low_power) {
3750 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3751 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3752 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3753 msleep(30);
3754 }
3755
3756 if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3757 spec->codec_variant != ALC269_TYPE_ALC245)
3758 /* required only at boot or S3 and S4 resume time */
3759 if (!spec->done_hp_init ||
3760 is_s3_resume(codec) ||
3761 is_s4_resume(codec)) {
3762 alc285_hp_init(codec);
3763 spec->done_hp_init = true;
3764 }
3765
3766 if (!hp_pin)
3767 hp_pin = 0x21;
3768 msleep(30);
3769
3770 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3771 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3772
3773 if (hp1_pin_sense || hp2_pin_sense) {
3774 msleep(2);
3775 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3776
3777 if (hp1_pin_sense)
3778 snd_hda_codec_write(codec, hp_pin, 0,
3779 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3780 if (hp2_pin_sense)
3781 snd_hda_codec_write(codec, 0x16, 0,
3782 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3783 msleep(75);
3784
3785 if (hp1_pin_sense)
3786 snd_hda_codec_write(codec, hp_pin, 0,
3787 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3788 if (hp2_pin_sense)
3789 snd_hda_codec_write(codec, 0x16, 0,
3790 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3791
3792 msleep(75);
3793 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3794 }
3795 }
3796
alc225_shutup(struct hda_codec * codec)3797 static void alc225_shutup(struct hda_codec *codec)
3798 {
3799 struct alc_spec *spec = codec->spec;
3800 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3801 bool hp1_pin_sense, hp2_pin_sense;
3802
3803 if (!hp_pin)
3804 hp_pin = 0x21;
3805
3806 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3807 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3808
3809 if (hp1_pin_sense || hp2_pin_sense) {
3810 alc_disable_headset_jack_key(codec);
3811 /* 3k pull low control for Headset jack. */
3812 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3813 msleep(2);
3814
3815 if (hp1_pin_sense)
3816 snd_hda_codec_write(codec, hp_pin, 0,
3817 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3818 if (hp2_pin_sense)
3819 snd_hda_codec_write(codec, 0x16, 0,
3820 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3821
3822 msleep(75);
3823
3824 if (hp1_pin_sense)
3825 snd_hda_codec_write(codec, hp_pin, 0,
3826 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3827 if (hp2_pin_sense)
3828 snd_hda_codec_write(codec, 0x16, 0,
3829 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3830
3831 msleep(75);
3832 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3833 alc_enable_headset_jack_key(codec);
3834 }
3835 alc_auto_setup_eapd(codec, false);
3836 alc_shutup_pins(codec);
3837 if (spec->ultra_low_power) {
3838 msleep(50);
3839 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3840 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3841 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3842 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3843 msleep(30);
3844 }
3845 }
3846
alc_default_init(struct hda_codec * codec)3847 static void alc_default_init(struct hda_codec *codec)
3848 {
3849 struct alc_spec *spec = codec->spec;
3850 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3851 bool hp_pin_sense;
3852
3853 if (!hp_pin)
3854 return;
3855
3856 msleep(30);
3857
3858 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3859
3860 if (hp_pin_sense) {
3861 msleep(2);
3862
3863 snd_hda_codec_write(codec, hp_pin, 0,
3864 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3865
3866 msleep(75);
3867
3868 snd_hda_codec_write(codec, hp_pin, 0,
3869 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3870 msleep(75);
3871 }
3872 }
3873
alc_default_shutup(struct hda_codec * codec)3874 static void alc_default_shutup(struct hda_codec *codec)
3875 {
3876 struct alc_spec *spec = codec->spec;
3877 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3878 bool hp_pin_sense;
3879
3880 if (!hp_pin) {
3881 alc269_shutup(codec);
3882 return;
3883 }
3884
3885 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3886
3887 if (hp_pin_sense) {
3888 msleep(2);
3889
3890 snd_hda_codec_write(codec, hp_pin, 0,
3891 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3892
3893 msleep(75);
3894
3895 if (!spec->no_shutup_pins)
3896 snd_hda_codec_write(codec, hp_pin, 0,
3897 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3898
3899 msleep(75);
3900 }
3901 alc_auto_setup_eapd(codec, false);
3902 alc_shutup_pins(codec);
3903 }
3904
alc294_hp_init(struct hda_codec * codec)3905 static void alc294_hp_init(struct hda_codec *codec)
3906 {
3907 struct alc_spec *spec = codec->spec;
3908 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3909 int i, val;
3910
3911 if (!hp_pin)
3912 return;
3913
3914 snd_hda_codec_write(codec, hp_pin, 0,
3915 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3916
3917 msleep(100);
3918
3919 if (!spec->no_shutup_pins)
3920 snd_hda_codec_write(codec, hp_pin, 0,
3921 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3922
3923 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3924 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3925
3926 /* Wait for depop procedure finish */
3927 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3928 for (i = 0; i < 20 && val & 0x0080; i++) {
3929 msleep(50);
3930 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3931 }
3932 /* Set HP depop to auto mode */
3933 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3934 msleep(50);
3935 }
3936
alc294_init(struct hda_codec * codec)3937 static void alc294_init(struct hda_codec *codec)
3938 {
3939 struct alc_spec *spec = codec->spec;
3940
3941 /* required only at boot or S4 resume time */
3942 if (!spec->done_hp_init ||
3943 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3944 alc294_hp_init(codec);
3945 spec->done_hp_init = true;
3946 }
3947 alc_default_init(codec);
3948 }
3949
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)3950 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3951 unsigned int val)
3952 {
3953 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3954 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3955 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3956 }
3957
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)3958 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3959 {
3960 unsigned int val;
3961
3962 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3963 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3964 & 0xffff;
3965 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3966 << 16;
3967 return val;
3968 }
3969
alc5505_dsp_halt(struct hda_codec * codec)3970 static void alc5505_dsp_halt(struct hda_codec *codec)
3971 {
3972 unsigned int val;
3973
3974 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3975 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3976 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3977 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3978 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3979 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3980 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3981 val = alc5505_coef_get(codec, 0x6220);
3982 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3983 }
3984
alc5505_dsp_back_from_halt(struct hda_codec * codec)3985 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3986 {
3987 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3988 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3989 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3990 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3991 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3992 alc5505_coef_set(codec, 0x880c, 0x00000004);
3993 }
3994
alc5505_dsp_init(struct hda_codec * codec)3995 static void alc5505_dsp_init(struct hda_codec *codec)
3996 {
3997 unsigned int val;
3998
3999 alc5505_dsp_halt(codec);
4000 alc5505_dsp_back_from_halt(codec);
4001 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
4002 alc5505_coef_set(codec, 0x61b0, 0x5b16);
4003 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
4004 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
4005 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
4006 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
4007 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
4008 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
4009 alc5505_coef_set(codec, 0x61b8, 0x04173302);
4010 alc5505_coef_set(codec, 0x61b8, 0x04163302);
4011 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
4012 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
4013 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4014
4015 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4016 if (val <= 3)
4017 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4018 else
4019 alc5505_coef_set(codec, 0x6220, 0x6002018f);
4020
4021 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4022 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4023 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4024 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4025 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4026 alc5505_coef_set(codec, 0x880c, 0x00000003);
4027 alc5505_coef_set(codec, 0x880c, 0x00000010);
4028
4029 #ifdef HALT_REALTEK_ALC5505
4030 alc5505_dsp_halt(codec);
4031 #endif
4032 }
4033
4034 #ifdef HALT_REALTEK_ALC5505
4035 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
4036 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
4037 #else
4038 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
4039 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
4040 #endif
4041
alc269_suspend(struct hda_codec * codec)4042 static int alc269_suspend(struct hda_codec *codec)
4043 {
4044 struct alc_spec *spec = codec->spec;
4045
4046 if (spec->has_alc5505_dsp)
4047 alc5505_dsp_suspend(codec);
4048
4049 return alc_suspend(codec);
4050 }
4051
alc269_resume(struct hda_codec * codec)4052 static int alc269_resume(struct hda_codec *codec)
4053 {
4054 struct alc_spec *spec = codec->spec;
4055
4056 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4057 alc269vb_toggle_power_output(codec, 0);
4058 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4059 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
4060 msleep(150);
4061 }
4062
4063 codec->patch_ops.init(codec);
4064
4065 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4066 alc269vb_toggle_power_output(codec, 1);
4067 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4068 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
4069 msleep(200);
4070 }
4071
4072 snd_hda_regmap_sync(codec);
4073 hda_call_check_power_status(codec, 0x01);
4074
4075 /* on some machine, the BIOS will clear the codec gpio data when enter
4076 * suspend, and won't restore the data after resume, so we restore it
4077 * in the driver.
4078 */
4079 if (spec->gpio_data)
4080 alc_write_gpio_data(codec);
4081
4082 if (spec->has_alc5505_dsp)
4083 alc5505_dsp_resume(codec);
4084
4085 return 0;
4086 }
4087
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4088 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4089 const struct hda_fixup *fix, int action)
4090 {
4091 struct alc_spec *spec = codec->spec;
4092
4093 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4094 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4095 }
4096
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4097 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4098 const struct hda_fixup *fix,
4099 int action)
4100 {
4101 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4102 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4103
4104 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4105 snd_hda_codec_set_pincfg(codec, 0x19,
4106 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4107 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4108 }
4109
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4110 static void alc269_fixup_hweq(struct hda_codec *codec,
4111 const struct hda_fixup *fix, int action)
4112 {
4113 if (action == HDA_FIXUP_ACT_INIT)
4114 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4115 }
4116
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4117 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4118 const struct hda_fixup *fix, int action)
4119 {
4120 struct alc_spec *spec = codec->spec;
4121
4122 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4123 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4124 }
4125
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4126 static void alc271_fixup_dmic(struct hda_codec *codec,
4127 const struct hda_fixup *fix, int action)
4128 {
4129 static const struct hda_verb verbs[] = {
4130 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4131 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4132 {}
4133 };
4134 unsigned int cfg;
4135
4136 if (strcmp(codec->core.chip_name, "ALC271X") &&
4137 strcmp(codec->core.chip_name, "ALC269VB"))
4138 return;
4139 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4140 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4141 snd_hda_sequence_write(codec, verbs);
4142 }
4143
4144 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4145 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4146 const struct hda_fixup *fix,
4147 int action)
4148 {
4149 if (action == HDA_FIXUP_ACT_INIT)
4150 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4151 }
4152
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4153 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4154 const struct hda_fixup *fix, int action)
4155 {
4156 struct alc_spec *spec = codec->spec;
4157
4158 if (action != HDA_FIXUP_ACT_PROBE)
4159 return;
4160
4161 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4162 * fix the sample rate of analog I/O to 44.1kHz
4163 */
4164 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4165 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4166 }
4167
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4168 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4169 const struct hda_fixup *fix, int action)
4170 {
4171 /* The digital-mic unit sends PDM (differential signal) instead of
4172 * the standard PCM, thus you can't record a valid mono stream as is.
4173 * Below is a workaround specific to ALC269 to control the dmic
4174 * signal source as mono.
4175 */
4176 if (action == HDA_FIXUP_ACT_INIT)
4177 alc_update_coef_idx(codec, 0x07, 0, 0x80);
4178 }
4179
alc269_quanta_automute(struct hda_codec * codec)4180 static void alc269_quanta_automute(struct hda_codec *codec)
4181 {
4182 snd_hda_gen_update_outputs(codec);
4183
4184 alc_write_coef_idx(codec, 0x0c, 0x680);
4185 alc_write_coef_idx(codec, 0x0c, 0x480);
4186 }
4187
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4188 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4189 const struct hda_fixup *fix, int action)
4190 {
4191 struct alc_spec *spec = codec->spec;
4192 if (action != HDA_FIXUP_ACT_PROBE)
4193 return;
4194 spec->gen.automute_hook = alc269_quanta_automute;
4195 }
4196
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4197 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4198 struct hda_jack_callback *jack)
4199 {
4200 struct alc_spec *spec = codec->spec;
4201 int vref;
4202 msleep(200);
4203 snd_hda_gen_hp_automute(codec, jack);
4204
4205 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4206 msleep(100);
4207 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4208 vref);
4209 msleep(500);
4210 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4211 vref);
4212 }
4213
4214 /*
4215 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4216 */
4217 struct hda_alc298_mbxinit {
4218 unsigned char value_0x23;
4219 unsigned char value_0x25;
4220 };
4221
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4222 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4223 const struct hda_alc298_mbxinit *initval,
4224 bool first)
4225 {
4226 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4227 alc_write_coef_idx(codec, 0x26, 0xb000);
4228
4229 if (first)
4230 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4231
4232 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4233 alc_write_coef_idx(codec, 0x26, 0xf000);
4234 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4235
4236 if (initval->value_0x23 != 0x1e)
4237 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4238
4239 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4240 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4241 }
4242
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4243 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4244 const struct hda_fixup *fix,
4245 int action)
4246 {
4247 /* Initialization magic */
4248 static const struct hda_alc298_mbxinit dac_init[] = {
4249 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4250 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4251 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4252 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4253 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4254 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4255 {0x2f, 0x00},
4256 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4257 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4258 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4259 {}
4260 };
4261 const struct hda_alc298_mbxinit *seq;
4262
4263 if (action != HDA_FIXUP_ACT_INIT)
4264 return;
4265
4266 /* Start */
4267 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4268 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4269 alc_write_coef_idx(codec, 0x26, 0xf000);
4270 alc_write_coef_idx(codec, 0x22, 0x31);
4271 alc_write_coef_idx(codec, 0x23, 0x0b);
4272 alc_write_coef_idx(codec, 0x25, 0x00);
4273 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4274 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4275
4276 for (seq = dac_init; seq->value_0x23; seq++)
4277 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4278 }
4279
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4280 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4281 const struct hda_fixup *fix, int action)
4282 {
4283 struct alc_spec *spec = codec->spec;
4284 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4285 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4286 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4287 }
4288 }
4289
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4290 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4291 bool polarity, bool on)
4292 {
4293 unsigned int pinval;
4294
4295 if (!pin)
4296 return;
4297 if (polarity)
4298 on = !on;
4299 pinval = snd_hda_codec_get_pin_target(codec, pin);
4300 pinval &= ~AC_PINCTL_VREFEN;
4301 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4302 /* temporarily power up/down for setting VREF */
4303 snd_hda_power_up_pm(codec);
4304 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4305 snd_hda_power_down_pm(codec);
4306 }
4307
4308 /* 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)4309 static int vref_mute_led_set(struct led_classdev *led_cdev,
4310 enum led_brightness brightness)
4311 {
4312 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4313 struct alc_spec *spec = codec->spec;
4314
4315 alc_update_vref_led(codec, spec->mute_led_nid,
4316 spec->mute_led_polarity, brightness);
4317 return 0;
4318 }
4319
4320 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4321 static unsigned int led_power_filter(struct hda_codec *codec,
4322 hda_nid_t nid,
4323 unsigned int power_state)
4324 {
4325 struct alc_spec *spec = codec->spec;
4326
4327 if (power_state != AC_PWRST_D3 || nid == 0 ||
4328 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4329 return power_state;
4330
4331 /* Set pin ctl again, it might have just been set to 0 */
4332 snd_hda_set_pin_ctl(codec, nid,
4333 snd_hda_codec_get_pin_target(codec, nid));
4334
4335 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4336 }
4337
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4338 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4339 const struct hda_fixup *fix, int action)
4340 {
4341 struct alc_spec *spec = codec->spec;
4342 const struct dmi_device *dev = NULL;
4343
4344 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4345 return;
4346
4347 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4348 int pol, pin;
4349 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4350 continue;
4351 if (pin < 0x0a || pin >= 0x10)
4352 break;
4353 spec->mute_led_polarity = pol;
4354 spec->mute_led_nid = pin - 0x0a + 0x18;
4355 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4356 codec->power_filter = led_power_filter;
4357 codec_dbg(codec,
4358 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4359 spec->mute_led_polarity);
4360 break;
4361 }
4362 }
4363
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4364 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4365 const struct hda_fixup *fix,
4366 int action, hda_nid_t pin)
4367 {
4368 struct alc_spec *spec = codec->spec;
4369
4370 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4371 spec->mute_led_polarity = 0;
4372 spec->mute_led_nid = pin;
4373 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4374 codec->power_filter = led_power_filter;
4375 }
4376 }
4377
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4378 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4379 const struct hda_fixup *fix, int action)
4380 {
4381 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4382 }
4383
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4384 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4385 const struct hda_fixup *fix, int action)
4386 {
4387 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4388 }
4389
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4390 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4391 const struct hda_fixup *fix, int action)
4392 {
4393 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4394 }
4395
4396 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4397 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4398 int polarity, bool enabled)
4399 {
4400 if (polarity)
4401 enabled = !enabled;
4402 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4403 }
4404
4405 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4406 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4407 enum led_brightness brightness)
4408 {
4409 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4410 struct alc_spec *spec = codec->spec;
4411
4412 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4413 spec->mute_led_polarity, !brightness);
4414 return 0;
4415 }
4416
4417 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4418 static int micmute_led_set(struct led_classdev *led_cdev,
4419 enum led_brightness brightness)
4420 {
4421 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4422 struct alc_spec *spec = codec->spec;
4423
4424 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4425 spec->micmute_led_polarity, !brightness);
4426 return 0;
4427 }
4428
4429 /* 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)4430 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4431 int action,
4432 unsigned int mute_mask,
4433 unsigned int micmute_mask)
4434 {
4435 struct alc_spec *spec = codec->spec;
4436
4437 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4438
4439 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4440 return;
4441 if (mute_mask) {
4442 spec->gpio_mute_led_mask = mute_mask;
4443 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4444 }
4445 if (micmute_mask) {
4446 spec->gpio_mic_led_mask = micmute_mask;
4447 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4448 }
4449 }
4450
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4451 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4452 const struct hda_fixup *fix, int action)
4453 {
4454 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4455 }
4456
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4457 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4458 const struct hda_fixup *fix, int action)
4459 {
4460 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4461 }
4462
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4463 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4464 const struct hda_fixup *fix, int action)
4465 {
4466 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4467 }
4468
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4469 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4470 const struct hda_fixup *fix, int action)
4471 {
4472 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4473 }
4474
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4475 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4476 const struct hda_fixup *fix, int action)
4477 {
4478 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4479 }
4480
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4481 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4482 const struct hda_fixup *fix, int action)
4483 {
4484 struct alc_spec *spec = codec->spec;
4485
4486 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4487 spec->micmute_led_polarity = 1;
4488 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4489 }
4490
4491 /* 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)4492 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4493 enum led_brightness brightness)
4494 {
4495 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4496 struct alc_spec *spec = codec->spec;
4497
4498 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4499 spec->micmute_led_polarity, brightness);
4500 return 0;
4501 }
4502
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4503 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4504 const struct hda_fixup *fix, int action)
4505 {
4506 struct alc_spec *spec = codec->spec;
4507
4508 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4509 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4510 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4511 * enable headphone amp
4512 */
4513 spec->gpio_mask |= 0x10;
4514 spec->gpio_dir |= 0x10;
4515 spec->cap_mute_led_nid = 0x18;
4516 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4517 codec->power_filter = led_power_filter;
4518 }
4519 }
4520
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4521 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4522 const struct hda_fixup *fix, int action)
4523 {
4524 struct alc_spec *spec = codec->spec;
4525
4526 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4527 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4528 spec->cap_mute_led_nid = 0x18;
4529 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4530 codec->power_filter = led_power_filter;
4531 }
4532 }
4533
4534 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4535 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4536 */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4537 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4538 const struct hda_fixup *fix, int action)
4539 {
4540 struct alc_spec *spec = codec->spec;
4541
4542 switch (action) {
4543 case HDA_FIXUP_ACT_PRE_PROBE:
4544 spec->gpio_mask |= 0x01;
4545 spec->gpio_dir |= 0x01;
4546 break;
4547 case HDA_FIXUP_ACT_INIT:
4548 /* need to toggle GPIO to enable the amp */
4549 alc_update_gpio_data(codec, 0x01, true);
4550 msleep(100);
4551 alc_update_gpio_data(codec, 0x01, false);
4552 break;
4553 }
4554 }
4555
4556 /* 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)4557 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4558 struct hda_codec *codec,
4559 struct snd_pcm_substream *substream,
4560 int action)
4561 {
4562 switch (action) {
4563 case HDA_GEN_PCM_ACT_PREPARE:
4564 alc_update_gpio_data(codec, 0x04, true);
4565 break;
4566 case HDA_GEN_PCM_ACT_CLEANUP:
4567 alc_update_gpio_data(codec, 0x04, false);
4568 break;
4569 }
4570 }
4571
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4572 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4573 const struct hda_fixup *fix,
4574 int action)
4575 {
4576 struct alc_spec *spec = codec->spec;
4577
4578 if (action == HDA_FIXUP_ACT_PROBE) {
4579 spec->gpio_mask |= 0x04;
4580 spec->gpio_dir |= 0x04;
4581 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4582 }
4583 }
4584
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4585 static void alc_update_coef_led(struct hda_codec *codec,
4586 struct alc_coef_led *led,
4587 bool polarity, bool on)
4588 {
4589 if (polarity)
4590 on = !on;
4591 /* temporarily power up/down for setting COEF bit */
4592 alc_update_coef_idx(codec, led->idx, led->mask,
4593 on ? led->on : led->off);
4594 }
4595
4596 /* 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)4597 static int coef_mute_led_set(struct led_classdev *led_cdev,
4598 enum led_brightness brightness)
4599 {
4600 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4601 struct alc_spec *spec = codec->spec;
4602
4603 alc_update_coef_led(codec, &spec->mute_led_coef,
4604 spec->mute_led_polarity, brightness);
4605 return 0;
4606 }
4607
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4608 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4609 const struct hda_fixup *fix,
4610 int action)
4611 {
4612 struct alc_spec *spec = codec->spec;
4613
4614 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4615 spec->mute_led_polarity = 0;
4616 spec->mute_led_coef.idx = 0x0b;
4617 spec->mute_led_coef.mask = 1 << 3;
4618 spec->mute_led_coef.on = 1 << 3;
4619 spec->mute_led_coef.off = 0;
4620 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4621 }
4622 }
4623
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4624 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4625 const struct hda_fixup *fix,
4626 int action)
4627 {
4628 struct alc_spec *spec = codec->spec;
4629
4630 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4631 spec->mute_led_polarity = 0;
4632 spec->mute_led_coef.idx = 0x34;
4633 spec->mute_led_coef.mask = 1 << 5;
4634 spec->mute_led_coef.on = 0;
4635 spec->mute_led_coef.off = 1 << 5;
4636 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4637 }
4638 }
4639
alc236_fixup_hp_mute_led_coefbit2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4640 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4641 const struct hda_fixup *fix, int action)
4642 {
4643 struct alc_spec *spec = codec->spec;
4644
4645 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4646 spec->mute_led_polarity = 0;
4647 spec->mute_led_coef.idx = 0x07;
4648 spec->mute_led_coef.mask = 1;
4649 spec->mute_led_coef.on = 1;
4650 spec->mute_led_coef.off = 0;
4651 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4652 }
4653 }
4654
alc245_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4655 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4656 const struct hda_fixup *fix,
4657 int action)
4658 {
4659 struct alc_spec *spec = codec->spec;
4660
4661 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4662 spec->mute_led_polarity = 0;
4663 spec->mute_led_coef.idx = 0x0b;
4664 spec->mute_led_coef.mask = 3 << 2;
4665 spec->mute_led_coef.on = 2 << 2;
4666 spec->mute_led_coef.off = 1 << 2;
4667 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4668 }
4669 }
4670
4671 /* 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)4672 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4673 enum led_brightness brightness)
4674 {
4675 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4676 struct alc_spec *spec = codec->spec;
4677
4678 alc_update_coef_led(codec, &spec->mic_led_coef,
4679 spec->micmute_led_polarity, brightness);
4680 return 0;
4681 }
4682
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4683 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4684 const struct hda_fixup *fix, int action)
4685 {
4686 struct alc_spec *spec = codec->spec;
4687
4688 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4689 spec->mic_led_coef.idx = 0x19;
4690 spec->mic_led_coef.mask = 1 << 13;
4691 spec->mic_led_coef.on = 1 << 13;
4692 spec->mic_led_coef.off = 0;
4693 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4694 }
4695 }
4696
alc285_fixup_hp_gpio_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4697 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4698 const struct hda_fixup *fix, int action)
4699 {
4700 struct alc_spec *spec = codec->spec;
4701
4702 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4703 spec->micmute_led_polarity = 1;
4704 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4705 }
4706
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4707 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4708 const struct hda_fixup *fix, int action)
4709 {
4710 struct alc_spec *spec = codec->spec;
4711
4712 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4713 spec->mic_led_coef.idx = 0x35;
4714 spec->mic_led_coef.mask = 3 << 2;
4715 spec->mic_led_coef.on = 2 << 2;
4716 spec->mic_led_coef.off = 1 << 2;
4717 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4718 }
4719 }
4720
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4721 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4722 const struct hda_fixup *fix, int action)
4723 {
4724 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4725 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4726 }
4727
alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4728 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4729 const struct hda_fixup *fix, int action)
4730 {
4731 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4732 alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4733 }
4734
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4735 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4736 const struct hda_fixup *fix, int action)
4737 {
4738 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4739 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4740 }
4741
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4742 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4743 const struct hda_fixup *fix, int action)
4744 {
4745 struct alc_spec *spec = codec->spec;
4746
4747 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4748 spec->cap_mute_led_nid = 0x1a;
4749 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4750 codec->power_filter = led_power_filter;
4751 }
4752 }
4753
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4754 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4755 const struct hda_fixup *fix, int action)
4756 {
4757 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4758 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4759 }
4760
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4761 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4762 const unsigned short coefs[2])
4763 {
4764 alc_write_coef_idx(codec, 0x23, coefs[0]);
4765 alc_write_coef_idx(codec, 0x25, coefs[1]);
4766 alc_write_coef_idx(codec, 0x26, 0xb011);
4767 }
4768
4769 struct alc298_samsung_amp_desc {
4770 unsigned char nid;
4771 unsigned short init_seq[2][2];
4772 };
4773
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4774 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4775 const struct hda_fixup *fix, int action)
4776 {
4777 int i, j;
4778 static const unsigned short init_seq[][2] = {
4779 { 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4780 { 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4781 { 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4782 { 0x41, 0x07 }, { 0x400, 0x1 }
4783 };
4784 static const struct alc298_samsung_amp_desc amps[] = {
4785 { 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4786 { 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4787 };
4788
4789 if (action != HDA_FIXUP_ACT_INIT)
4790 return;
4791
4792 for (i = 0; i < ARRAY_SIZE(amps); i++) {
4793 alc_write_coef_idx(codec, 0x22, amps[i].nid);
4794
4795 for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4796 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4797
4798 for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4799 alc298_samsung_write_coef_pack(codec, init_seq[j]);
4800 }
4801 }
4802
4803 struct alc298_samsung_v2_amp_desc {
4804 unsigned short nid;
4805 int init_seq_size;
4806 unsigned short init_seq[18][2];
4807 };
4808
4809 static const struct alc298_samsung_v2_amp_desc
4810 alc298_samsung_v2_amp_desc_tbl[] = {
4811 { 0x38, 18, {
4812 { 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4813 { 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4814 { 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4815 { 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4816 { 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4817 { 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4818 }},
4819 { 0x39, 18, {
4820 { 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4821 { 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4822 { 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4823 { 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4824 { 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x2399, 0x0003 },
4825 { 0x23a4, 0x00b5 }, { 0x23a5, 0x0001 }, { 0x23ba, 0x0094 }
4826 }},
4827 { 0x3c, 15, {
4828 { 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4829 { 0x201b, 0x0001 }, { 0x201d, 0x0001 }, { 0x201f, 0x00fe },
4830 { 0x2021, 0x0000 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4831 { 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4832 { 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4833 }},
4834 { 0x3d, 15, {
4835 { 0x23e1, 0x0000 }, { 0x2012, 0x006f }, { 0x2014, 0x0000 },
4836 { 0x201b, 0x0002 }, { 0x201d, 0x0002 }, { 0x201f, 0x00fd },
4837 { 0x2021, 0x0001 }, { 0x2022, 0x0010 }, { 0x203d, 0x0005 },
4838 { 0x203f, 0x0003 }, { 0x2050, 0x002c }, { 0x2076, 0x000e },
4839 { 0x207c, 0x004a }, { 0x2081, 0x0003 }, { 0x23ba, 0x008d }
4840 }}
4841 };
4842
alc298_samsung_v2_enable_amps(struct hda_codec * codec)4843 static void alc298_samsung_v2_enable_amps(struct hda_codec *codec)
4844 {
4845 struct alc_spec *spec = codec->spec;
4846 static const unsigned short enable_seq[][2] = {
4847 { 0x203a, 0x0081 }, { 0x23ff, 0x0001 },
4848 };
4849 int i, j;
4850
4851 for (i = 0; i < spec->num_speaker_amps; i++) {
4852 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4853 for (j = 0; j < ARRAY_SIZE(enable_seq); j++)
4854 alc298_samsung_write_coef_pack(codec, enable_seq[j]);
4855 codec_dbg(codec, "alc298_samsung_v2: Enabled speaker amp 0x%02x\n",
4856 alc298_samsung_v2_amp_desc_tbl[i].nid);
4857 }
4858 }
4859
alc298_samsung_v2_disable_amps(struct hda_codec * codec)4860 static void alc298_samsung_v2_disable_amps(struct hda_codec *codec)
4861 {
4862 struct alc_spec *spec = codec->spec;
4863 static const unsigned short disable_seq[][2] = {
4864 { 0x23ff, 0x0000 }, { 0x203a, 0x0080 },
4865 };
4866 int i, j;
4867
4868 for (i = 0; i < spec->num_speaker_amps; i++) {
4869 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4870 for (j = 0; j < ARRAY_SIZE(disable_seq); j++)
4871 alc298_samsung_write_coef_pack(codec, disable_seq[j]);
4872 codec_dbg(codec, "alc298_samsung_v2: Disabled speaker amp 0x%02x\n",
4873 alc298_samsung_v2_amp_desc_tbl[i].nid);
4874 }
4875 }
4876
alc298_samsung_v2_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)4877 static void alc298_samsung_v2_playback_hook(struct hda_pcm_stream *hinfo,
4878 struct hda_codec *codec,
4879 struct snd_pcm_substream *substream,
4880 int action)
4881 {
4882 /* Dynamically enable/disable speaker amps before and after playback */
4883 if (action == HDA_GEN_PCM_ACT_OPEN)
4884 alc298_samsung_v2_enable_amps(codec);
4885 if (action == HDA_GEN_PCM_ACT_CLOSE)
4886 alc298_samsung_v2_disable_amps(codec);
4887 }
4888
alc298_samsung_v2_init_amps(struct hda_codec * codec,int num_speaker_amps)4889 static void alc298_samsung_v2_init_amps(struct hda_codec *codec,
4890 int num_speaker_amps)
4891 {
4892 struct alc_spec *spec = codec->spec;
4893 int i, j;
4894
4895 /* Set spec's num_speaker_amps before doing anything else */
4896 spec->num_speaker_amps = num_speaker_amps;
4897
4898 /* Disable speaker amps before init to prevent any physical damage */
4899 alc298_samsung_v2_disable_amps(codec);
4900
4901 /* Initialize the speaker amps */
4902 for (i = 0; i < spec->num_speaker_amps; i++) {
4903 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
4904 for (j = 0; j < alc298_samsung_v2_amp_desc_tbl[i].init_seq_size; j++) {
4905 alc298_samsung_write_coef_pack(codec,
4906 alc298_samsung_v2_amp_desc_tbl[i].init_seq[j]);
4907 }
4908 alc_write_coef_idx(codec, 0x89, 0x0);
4909 codec_dbg(codec, "alc298_samsung_v2: Initialized speaker amp 0x%02x\n",
4910 alc298_samsung_v2_amp_desc_tbl[i].nid);
4911 }
4912
4913 /* register hook to enable speaker amps only when they are needed */
4914 spec->gen.pcm_playback_hook = alc298_samsung_v2_playback_hook;
4915 }
4916
alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)4917 static void alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec *codec,
4918 const struct hda_fixup *fix, int action)
4919 {
4920 if (action == HDA_FIXUP_ACT_PROBE)
4921 alc298_samsung_v2_init_amps(codec, 2);
4922 }
4923
alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec * codec,const struct hda_fixup * fix,int action)4924 static void alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec *codec,
4925 const struct hda_fixup *fix, int action)
4926 {
4927 if (action == HDA_FIXUP_ACT_PROBE)
4928 alc298_samsung_v2_init_amps(codec, 4);
4929 }
4930
4931 #if IS_REACHABLE(CONFIG_INPUT)
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4932 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4933 struct hda_jack_callback *event)
4934 {
4935 struct alc_spec *spec = codec->spec;
4936
4937 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4938 send both key on and key off event for every interrupt. */
4939 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4940 input_sync(spec->kb_dev);
4941 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4942 input_sync(spec->kb_dev);
4943 }
4944
alc_register_micmute_input_device(struct hda_codec * codec)4945 static int alc_register_micmute_input_device(struct hda_codec *codec)
4946 {
4947 struct alc_spec *spec = codec->spec;
4948 int i;
4949
4950 spec->kb_dev = input_allocate_device();
4951 if (!spec->kb_dev) {
4952 codec_err(codec, "Out of memory (input_allocate_device)\n");
4953 return -ENOMEM;
4954 }
4955
4956 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4957
4958 spec->kb_dev->name = "Microphone Mute Button";
4959 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4960 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4961 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4962 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4963 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4964 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4965
4966 if (input_register_device(spec->kb_dev)) {
4967 codec_err(codec, "input_register_device failed\n");
4968 input_free_device(spec->kb_dev);
4969 spec->kb_dev = NULL;
4970 return -ENOMEM;
4971 }
4972
4973 return 0;
4974 }
4975
4976 /* GPIO1 = set according to SKU external amp
4977 * GPIO2 = mic mute hotkey
4978 * GPIO3 = mute LED
4979 * GPIO4 = mic mute LED
4980 */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4981 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4982 const struct hda_fixup *fix, int action)
4983 {
4984 struct alc_spec *spec = codec->spec;
4985
4986 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4987 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4988 spec->init_amp = ALC_INIT_DEFAULT;
4989 if (alc_register_micmute_input_device(codec) != 0)
4990 return;
4991
4992 spec->gpio_mask |= 0x06;
4993 spec->gpio_dir |= 0x02;
4994 spec->gpio_data |= 0x02;
4995 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4996 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4997 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4998 gpio2_mic_hotkey_event);
4999 return;
5000 }
5001
5002 if (!spec->kb_dev)
5003 return;
5004
5005 switch (action) {
5006 case HDA_FIXUP_ACT_FREE:
5007 input_unregister_device(spec->kb_dev);
5008 spec->kb_dev = NULL;
5009 }
5010 }
5011
5012 /* Line2 = mic mute hotkey
5013 * GPIO2 = mic mute LED
5014 */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)5015 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
5016 const struct hda_fixup *fix, int action)
5017 {
5018 struct alc_spec *spec = codec->spec;
5019
5020 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
5021 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5022 spec->init_amp = ALC_INIT_DEFAULT;
5023 if (alc_register_micmute_input_device(codec) != 0)
5024 return;
5025
5026 snd_hda_jack_detect_enable_callback(codec, 0x1b,
5027 gpio2_mic_hotkey_event);
5028 return;
5029 }
5030
5031 if (!spec->kb_dev)
5032 return;
5033
5034 switch (action) {
5035 case HDA_FIXUP_ACT_FREE:
5036 input_unregister_device(spec->kb_dev);
5037 spec->kb_dev = NULL;
5038 }
5039 }
5040 #else /* INPUT */
5041 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
5042 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
5043 #endif /* INPUT */
5044
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)5045 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
5046 const struct hda_fixup *fix, int action)
5047 {
5048 struct alc_spec *spec = codec->spec;
5049
5050 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
5051 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5052 spec->cap_mute_led_nid = 0x18;
5053 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
5054 }
5055 }
5056
alc_hp_mute_disable(struct hda_codec * codec,unsigned int delay)5057 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay)
5058 {
5059 if (delay <= 0)
5060 delay = 75;
5061 snd_hda_codec_write(codec, 0x21, 0,
5062 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5063 msleep(delay);
5064 snd_hda_codec_write(codec, 0x21, 0,
5065 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5066 msleep(delay);
5067 }
5068
alc_hp_enable_unmute(struct hda_codec * codec,unsigned int delay)5069 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay)
5070 {
5071 if (delay <= 0)
5072 delay = 75;
5073 snd_hda_codec_write(codec, 0x21, 0,
5074 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5075 msleep(delay);
5076 snd_hda_codec_write(codec, 0x21, 0,
5077 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5078 msleep(delay);
5079 }
5080
5081 static const struct coef_fw alc225_pre_hsmode[] = {
5082 UPDATE_COEF(0x4a, 1<<8, 0),
5083 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
5084 UPDATE_COEF(0x63, 3<<14, 3<<14),
5085 UPDATE_COEF(0x4a, 3<<4, 2<<4),
5086 UPDATE_COEF(0x4a, 3<<10, 3<<10),
5087 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
5088 UPDATE_COEF(0x4a, 3<<10, 0),
5089 {}
5090 };
5091
alc_headset_mode_unplugged(struct hda_codec * codec)5092 static void alc_headset_mode_unplugged(struct hda_codec *codec)
5093 {
5094 struct alc_spec *spec = codec->spec;
5095 static const struct coef_fw coef0255[] = {
5096 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
5097 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5098 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5099 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5100 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
5101 {}
5102 };
5103 static const struct coef_fw coef0256[] = {
5104 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
5105 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
5106 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
5107 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
5108 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5109 {}
5110 };
5111 static const struct coef_fw coef0233[] = {
5112 WRITE_COEF(0x1b, 0x0c0b),
5113 WRITE_COEF(0x45, 0xc429),
5114 UPDATE_COEF(0x35, 0x4000, 0),
5115 WRITE_COEF(0x06, 0x2104),
5116 WRITE_COEF(0x1a, 0x0001),
5117 WRITE_COEF(0x26, 0x0004),
5118 WRITE_COEF(0x32, 0x42a3),
5119 {}
5120 };
5121 static const struct coef_fw coef0288[] = {
5122 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5123 UPDATE_COEF(0x50, 0x2000, 0x2000),
5124 UPDATE_COEF(0x56, 0x0006, 0x0006),
5125 UPDATE_COEF(0x66, 0x0008, 0),
5126 UPDATE_COEF(0x67, 0x2000, 0),
5127 {}
5128 };
5129 static const struct coef_fw coef0298[] = {
5130 UPDATE_COEF(0x19, 0x1300, 0x0300),
5131 {}
5132 };
5133 static const struct coef_fw coef0292[] = {
5134 WRITE_COEF(0x76, 0x000e),
5135 WRITE_COEF(0x6c, 0x2400),
5136 WRITE_COEF(0x18, 0x7308),
5137 WRITE_COEF(0x6b, 0xc429),
5138 {}
5139 };
5140 static const struct coef_fw coef0293[] = {
5141 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
5142 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
5143 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
5144 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
5145 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
5146 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5147 {}
5148 };
5149 static const struct coef_fw coef0668[] = {
5150 WRITE_COEF(0x15, 0x0d40),
5151 WRITE_COEF(0xb7, 0x802b),
5152 {}
5153 };
5154 static const struct coef_fw coef0225[] = {
5155 UPDATE_COEF(0x63, 3<<14, 0),
5156 {}
5157 };
5158 static const struct coef_fw coef0274[] = {
5159 UPDATE_COEF(0x4a, 0x0100, 0),
5160 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
5161 UPDATE_COEF(0x6b, 0xf000, 0x5000),
5162 UPDATE_COEF(0x4a, 0x0010, 0),
5163 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5164 WRITE_COEF(0x45, 0x5289),
5165 UPDATE_COEF(0x4a, 0x0c00, 0),
5166 {}
5167 };
5168
5169 if (spec->no_internal_mic_pin) {
5170 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5171 return;
5172 }
5173
5174 switch (codec->core.vendor_id) {
5175 case 0x10ec0255:
5176 alc_process_coef_fw(codec, coef0255);
5177 break;
5178 case 0x10ec0230:
5179 case 0x10ec0236:
5180 case 0x10ec0256:
5181 case 0x19e58326:
5182 alc_hp_mute_disable(codec, 75);
5183 alc_process_coef_fw(codec, coef0256);
5184 break;
5185 case 0x10ec0234:
5186 case 0x10ec0274:
5187 case 0x10ec0294:
5188 alc_process_coef_fw(codec, coef0274);
5189 break;
5190 case 0x10ec0233:
5191 case 0x10ec0283:
5192 alc_process_coef_fw(codec, coef0233);
5193 break;
5194 case 0x10ec0286:
5195 case 0x10ec0288:
5196 alc_process_coef_fw(codec, coef0288);
5197 break;
5198 case 0x10ec0298:
5199 alc_process_coef_fw(codec, coef0298);
5200 alc_process_coef_fw(codec, coef0288);
5201 break;
5202 case 0x10ec0292:
5203 alc_process_coef_fw(codec, coef0292);
5204 break;
5205 case 0x10ec0293:
5206 alc_process_coef_fw(codec, coef0293);
5207 break;
5208 case 0x10ec0668:
5209 alc_process_coef_fw(codec, coef0668);
5210 break;
5211 case 0x10ec0215:
5212 case 0x10ec0225:
5213 case 0x10ec0285:
5214 case 0x10ec0295:
5215 case 0x10ec0289:
5216 case 0x10ec0299:
5217 alc_hp_mute_disable(codec, 75);
5218 alc_process_coef_fw(codec, alc225_pre_hsmode);
5219 alc_process_coef_fw(codec, coef0225);
5220 break;
5221 case 0x10ec0867:
5222 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5223 break;
5224 }
5225 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5226 }
5227
5228
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)5229 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5230 hda_nid_t mic_pin)
5231 {
5232 static const struct coef_fw coef0255[] = {
5233 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5234 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5235 {}
5236 };
5237 static const struct coef_fw coef0256[] = {
5238 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5239 WRITE_COEFEX(0x57, 0x03, 0x09a3),
5240 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5241 {}
5242 };
5243 static const struct coef_fw coef0233[] = {
5244 UPDATE_COEF(0x35, 0, 1<<14),
5245 WRITE_COEF(0x06, 0x2100),
5246 WRITE_COEF(0x1a, 0x0021),
5247 WRITE_COEF(0x26, 0x008c),
5248 {}
5249 };
5250 static const struct coef_fw coef0288[] = {
5251 UPDATE_COEF(0x4f, 0x00c0, 0),
5252 UPDATE_COEF(0x50, 0x2000, 0),
5253 UPDATE_COEF(0x56, 0x0006, 0),
5254 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5255 UPDATE_COEF(0x66, 0x0008, 0x0008),
5256 UPDATE_COEF(0x67, 0x2000, 0x2000),
5257 {}
5258 };
5259 static const struct coef_fw coef0292[] = {
5260 WRITE_COEF(0x19, 0xa208),
5261 WRITE_COEF(0x2e, 0xacf0),
5262 {}
5263 };
5264 static const struct coef_fw coef0293[] = {
5265 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5266 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5267 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5268 {}
5269 };
5270 static const struct coef_fw coef0688[] = {
5271 WRITE_COEF(0xb7, 0x802b),
5272 WRITE_COEF(0xb5, 0x1040),
5273 UPDATE_COEF(0xc3, 0, 1<<12),
5274 {}
5275 };
5276 static const struct coef_fw coef0225[] = {
5277 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5278 UPDATE_COEF(0x4a, 3<<4, 2<<4),
5279 UPDATE_COEF(0x63, 3<<14, 0),
5280 {}
5281 };
5282 static const struct coef_fw coef0274[] = {
5283 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5284 UPDATE_COEF(0x4a, 0x0010, 0),
5285 UPDATE_COEF(0x6b, 0xf000, 0),
5286 {}
5287 };
5288
5289 switch (codec->core.vendor_id) {
5290 case 0x10ec0255:
5291 alc_write_coef_idx(codec, 0x45, 0xc489);
5292 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5293 alc_process_coef_fw(codec, coef0255);
5294 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5295 break;
5296 case 0x10ec0230:
5297 case 0x10ec0236:
5298 case 0x10ec0256:
5299 case 0x19e58326:
5300 alc_write_coef_idx(codec, 0x45, 0xc489);
5301 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5302 alc_process_coef_fw(codec, coef0256);
5303 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5304 break;
5305 case 0x10ec0234:
5306 case 0x10ec0274:
5307 case 0x10ec0294:
5308 alc_write_coef_idx(codec, 0x45, 0x4689);
5309 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5310 alc_process_coef_fw(codec, coef0274);
5311 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5312 break;
5313 case 0x10ec0233:
5314 case 0x10ec0283:
5315 alc_write_coef_idx(codec, 0x45, 0xc429);
5316 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5317 alc_process_coef_fw(codec, coef0233);
5318 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5319 break;
5320 case 0x10ec0286:
5321 case 0x10ec0288:
5322 case 0x10ec0298:
5323 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5324 alc_process_coef_fw(codec, coef0288);
5325 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5326 break;
5327 case 0x10ec0292:
5328 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5329 alc_process_coef_fw(codec, coef0292);
5330 break;
5331 case 0x10ec0293:
5332 /* Set to TRS mode */
5333 alc_write_coef_idx(codec, 0x45, 0xc429);
5334 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5335 alc_process_coef_fw(codec, coef0293);
5336 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5337 break;
5338 case 0x10ec0867:
5339 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5340 fallthrough;
5341 case 0x10ec0221:
5342 case 0x10ec0662:
5343 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5344 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5345 break;
5346 case 0x10ec0668:
5347 alc_write_coef_idx(codec, 0x11, 0x0001);
5348 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5349 alc_process_coef_fw(codec, coef0688);
5350 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5351 break;
5352 case 0x10ec0215:
5353 case 0x10ec0225:
5354 case 0x10ec0285:
5355 case 0x10ec0295:
5356 case 0x10ec0289:
5357 case 0x10ec0299:
5358 alc_process_coef_fw(codec, alc225_pre_hsmode);
5359 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5360 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5361 alc_process_coef_fw(codec, coef0225);
5362 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5363 break;
5364 }
5365 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5366 }
5367
alc_headset_mode_default(struct hda_codec * codec)5368 static void alc_headset_mode_default(struct hda_codec *codec)
5369 {
5370 static const struct coef_fw coef0225[] = {
5371 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5372 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5373 UPDATE_COEF(0x49, 3<<8, 0<<8),
5374 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5375 UPDATE_COEF(0x63, 3<<14, 0),
5376 UPDATE_COEF(0x67, 0xf000, 0x3000),
5377 {}
5378 };
5379 static const struct coef_fw coef0255[] = {
5380 WRITE_COEF(0x45, 0xc089),
5381 WRITE_COEF(0x45, 0xc489),
5382 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5383 WRITE_COEF(0x49, 0x0049),
5384 {}
5385 };
5386 static const struct coef_fw coef0256[] = {
5387 WRITE_COEF(0x45, 0xc489),
5388 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5389 WRITE_COEF(0x49, 0x0049),
5390 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5391 WRITE_COEF(0x06, 0x6100),
5392 {}
5393 };
5394 static const struct coef_fw coef0233[] = {
5395 WRITE_COEF(0x06, 0x2100),
5396 WRITE_COEF(0x32, 0x4ea3),
5397 {}
5398 };
5399 static const struct coef_fw coef0288[] = {
5400 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5401 UPDATE_COEF(0x50, 0x2000, 0x2000),
5402 UPDATE_COEF(0x56, 0x0006, 0x0006),
5403 UPDATE_COEF(0x66, 0x0008, 0),
5404 UPDATE_COEF(0x67, 0x2000, 0),
5405 {}
5406 };
5407 static const struct coef_fw coef0292[] = {
5408 WRITE_COEF(0x76, 0x000e),
5409 WRITE_COEF(0x6c, 0x2400),
5410 WRITE_COEF(0x6b, 0xc429),
5411 WRITE_COEF(0x18, 0x7308),
5412 {}
5413 };
5414 static const struct coef_fw coef0293[] = {
5415 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5416 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5417 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5418 {}
5419 };
5420 static const struct coef_fw coef0688[] = {
5421 WRITE_COEF(0x11, 0x0041),
5422 WRITE_COEF(0x15, 0x0d40),
5423 WRITE_COEF(0xb7, 0x802b),
5424 {}
5425 };
5426 static const struct coef_fw coef0274[] = {
5427 WRITE_COEF(0x45, 0x4289),
5428 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5429 UPDATE_COEF(0x6b, 0x0f00, 0),
5430 UPDATE_COEF(0x49, 0x0300, 0x0300),
5431 {}
5432 };
5433
5434 switch (codec->core.vendor_id) {
5435 case 0x10ec0215:
5436 case 0x10ec0225:
5437 case 0x10ec0285:
5438 case 0x10ec0295:
5439 case 0x10ec0289:
5440 case 0x10ec0299:
5441 alc_process_coef_fw(codec, alc225_pre_hsmode);
5442 alc_process_coef_fw(codec, coef0225);
5443 alc_hp_enable_unmute(codec, 75);
5444 break;
5445 case 0x10ec0255:
5446 alc_process_coef_fw(codec, coef0255);
5447 break;
5448 case 0x10ec0230:
5449 case 0x10ec0236:
5450 case 0x10ec0256:
5451 case 0x19e58326:
5452 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5453 alc_write_coef_idx(codec, 0x45, 0xc089);
5454 msleep(50);
5455 alc_process_coef_fw(codec, coef0256);
5456 alc_hp_enable_unmute(codec, 75);
5457 break;
5458 case 0x10ec0234:
5459 case 0x10ec0274:
5460 case 0x10ec0294:
5461 alc_process_coef_fw(codec, coef0274);
5462 break;
5463 case 0x10ec0233:
5464 case 0x10ec0283:
5465 alc_process_coef_fw(codec, coef0233);
5466 break;
5467 case 0x10ec0286:
5468 case 0x10ec0288:
5469 case 0x10ec0298:
5470 alc_process_coef_fw(codec, coef0288);
5471 break;
5472 case 0x10ec0292:
5473 alc_process_coef_fw(codec, coef0292);
5474 break;
5475 case 0x10ec0293:
5476 alc_process_coef_fw(codec, coef0293);
5477 break;
5478 case 0x10ec0668:
5479 alc_process_coef_fw(codec, coef0688);
5480 break;
5481 case 0x10ec0867:
5482 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5483 break;
5484 }
5485 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5486 }
5487
5488 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5489 static void alc_headset_mode_ctia(struct hda_codec *codec)
5490 {
5491 int val;
5492
5493 static const struct coef_fw coef0255[] = {
5494 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5495 WRITE_COEF(0x1b, 0x0c2b),
5496 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5497 {}
5498 };
5499 static const struct coef_fw coef0256[] = {
5500 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5501 WRITE_COEF(0x1b, 0x0e6b),
5502 {}
5503 };
5504 static const struct coef_fw coef0233[] = {
5505 WRITE_COEF(0x45, 0xd429),
5506 WRITE_COEF(0x1b, 0x0c2b),
5507 WRITE_COEF(0x32, 0x4ea3),
5508 {}
5509 };
5510 static const struct coef_fw coef0288[] = {
5511 UPDATE_COEF(0x50, 0x2000, 0x2000),
5512 UPDATE_COEF(0x56, 0x0006, 0x0006),
5513 UPDATE_COEF(0x66, 0x0008, 0),
5514 UPDATE_COEF(0x67, 0x2000, 0),
5515 {}
5516 };
5517 static const struct coef_fw coef0292[] = {
5518 WRITE_COEF(0x6b, 0xd429),
5519 WRITE_COEF(0x76, 0x0008),
5520 WRITE_COEF(0x18, 0x7388),
5521 {}
5522 };
5523 static const struct coef_fw coef0293[] = {
5524 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5525 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5526 {}
5527 };
5528 static const struct coef_fw coef0688[] = {
5529 WRITE_COEF(0x11, 0x0001),
5530 WRITE_COEF(0x15, 0x0d60),
5531 WRITE_COEF(0xc3, 0x0000),
5532 {}
5533 };
5534 static const struct coef_fw coef0225_1[] = {
5535 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5536 UPDATE_COEF(0x63, 3<<14, 2<<14),
5537 {}
5538 };
5539 static const struct coef_fw coef0225_2[] = {
5540 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5541 UPDATE_COEF(0x63, 3<<14, 1<<14),
5542 {}
5543 };
5544
5545 switch (codec->core.vendor_id) {
5546 case 0x10ec0255:
5547 alc_process_coef_fw(codec, coef0255);
5548 break;
5549 case 0x10ec0230:
5550 case 0x10ec0236:
5551 case 0x10ec0256:
5552 case 0x19e58326:
5553 alc_process_coef_fw(codec, coef0256);
5554 alc_hp_enable_unmute(codec, 75);
5555 break;
5556 case 0x10ec0234:
5557 case 0x10ec0274:
5558 case 0x10ec0294:
5559 alc_write_coef_idx(codec, 0x45, 0xd689);
5560 break;
5561 case 0x10ec0233:
5562 case 0x10ec0283:
5563 alc_process_coef_fw(codec, coef0233);
5564 break;
5565 case 0x10ec0298:
5566 val = alc_read_coef_idx(codec, 0x50);
5567 if (val & (1 << 12)) {
5568 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5569 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5570 msleep(300);
5571 } else {
5572 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5573 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5574 msleep(300);
5575 }
5576 break;
5577 case 0x10ec0286:
5578 case 0x10ec0288:
5579 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5580 msleep(300);
5581 alc_process_coef_fw(codec, coef0288);
5582 break;
5583 case 0x10ec0292:
5584 alc_process_coef_fw(codec, coef0292);
5585 break;
5586 case 0x10ec0293:
5587 alc_process_coef_fw(codec, coef0293);
5588 break;
5589 case 0x10ec0668:
5590 alc_process_coef_fw(codec, coef0688);
5591 break;
5592 case 0x10ec0215:
5593 case 0x10ec0225:
5594 case 0x10ec0285:
5595 case 0x10ec0295:
5596 case 0x10ec0289:
5597 case 0x10ec0299:
5598 val = alc_read_coef_idx(codec, 0x45);
5599 if (val & (1 << 9))
5600 alc_process_coef_fw(codec, coef0225_2);
5601 else
5602 alc_process_coef_fw(codec, coef0225_1);
5603 alc_hp_enable_unmute(codec, 75);
5604 break;
5605 case 0x10ec0867:
5606 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5607 break;
5608 }
5609 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5610 }
5611
5612 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5613 static void alc_headset_mode_omtp(struct hda_codec *codec)
5614 {
5615 static const struct coef_fw coef0255[] = {
5616 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5617 WRITE_COEF(0x1b, 0x0c2b),
5618 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5619 {}
5620 };
5621 static const struct coef_fw coef0256[] = {
5622 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5623 WRITE_COEF(0x1b, 0x0e6b),
5624 {}
5625 };
5626 static const struct coef_fw coef0233[] = {
5627 WRITE_COEF(0x45, 0xe429),
5628 WRITE_COEF(0x1b, 0x0c2b),
5629 WRITE_COEF(0x32, 0x4ea3),
5630 {}
5631 };
5632 static const struct coef_fw coef0288[] = {
5633 UPDATE_COEF(0x50, 0x2000, 0x2000),
5634 UPDATE_COEF(0x56, 0x0006, 0x0006),
5635 UPDATE_COEF(0x66, 0x0008, 0),
5636 UPDATE_COEF(0x67, 0x2000, 0),
5637 {}
5638 };
5639 static const struct coef_fw coef0292[] = {
5640 WRITE_COEF(0x6b, 0xe429),
5641 WRITE_COEF(0x76, 0x0008),
5642 WRITE_COEF(0x18, 0x7388),
5643 {}
5644 };
5645 static const struct coef_fw coef0293[] = {
5646 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5647 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5648 {}
5649 };
5650 static const struct coef_fw coef0688[] = {
5651 WRITE_COEF(0x11, 0x0001),
5652 WRITE_COEF(0x15, 0x0d50),
5653 WRITE_COEF(0xc3, 0x0000),
5654 {}
5655 };
5656 static const struct coef_fw coef0225[] = {
5657 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5658 UPDATE_COEF(0x63, 3<<14, 2<<14),
5659 {}
5660 };
5661
5662 switch (codec->core.vendor_id) {
5663 case 0x10ec0255:
5664 alc_process_coef_fw(codec, coef0255);
5665 break;
5666 case 0x10ec0230:
5667 case 0x10ec0236:
5668 case 0x10ec0256:
5669 case 0x19e58326:
5670 alc_process_coef_fw(codec, coef0256);
5671 alc_hp_enable_unmute(codec, 75);
5672 break;
5673 case 0x10ec0234:
5674 case 0x10ec0274:
5675 case 0x10ec0294:
5676 alc_write_coef_idx(codec, 0x45, 0xe689);
5677 break;
5678 case 0x10ec0233:
5679 case 0x10ec0283:
5680 alc_process_coef_fw(codec, coef0233);
5681 break;
5682 case 0x10ec0298:
5683 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5684 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5685 msleep(300);
5686 break;
5687 case 0x10ec0286:
5688 case 0x10ec0288:
5689 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5690 msleep(300);
5691 alc_process_coef_fw(codec, coef0288);
5692 break;
5693 case 0x10ec0292:
5694 alc_process_coef_fw(codec, coef0292);
5695 break;
5696 case 0x10ec0293:
5697 alc_process_coef_fw(codec, coef0293);
5698 break;
5699 case 0x10ec0668:
5700 alc_process_coef_fw(codec, coef0688);
5701 break;
5702 case 0x10ec0215:
5703 case 0x10ec0225:
5704 case 0x10ec0285:
5705 case 0x10ec0295:
5706 case 0x10ec0289:
5707 case 0x10ec0299:
5708 alc_process_coef_fw(codec, coef0225);
5709 alc_hp_enable_unmute(codec, 75);
5710 break;
5711 }
5712 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5713 }
5714
alc_determine_headset_type(struct hda_codec * codec)5715 static void alc_determine_headset_type(struct hda_codec *codec)
5716 {
5717 int val;
5718 bool is_ctia = false;
5719 struct alc_spec *spec = codec->spec;
5720 static const struct coef_fw coef0255[] = {
5721 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5722 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5723 conteol) */
5724 {}
5725 };
5726 static const struct coef_fw coef0288[] = {
5727 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5728 {}
5729 };
5730 static const struct coef_fw coef0298[] = {
5731 UPDATE_COEF(0x50, 0x2000, 0x2000),
5732 UPDATE_COEF(0x56, 0x0006, 0x0006),
5733 UPDATE_COEF(0x66, 0x0008, 0),
5734 UPDATE_COEF(0x67, 0x2000, 0),
5735 UPDATE_COEF(0x19, 0x1300, 0x1300),
5736 {}
5737 };
5738 static const struct coef_fw coef0293[] = {
5739 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5740 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5741 {}
5742 };
5743 static const struct coef_fw coef0688[] = {
5744 WRITE_COEF(0x11, 0x0001),
5745 WRITE_COEF(0xb7, 0x802b),
5746 WRITE_COEF(0x15, 0x0d60),
5747 WRITE_COEF(0xc3, 0x0c00),
5748 {}
5749 };
5750 static const struct coef_fw coef0274[] = {
5751 UPDATE_COEF(0x4a, 0x0010, 0),
5752 UPDATE_COEF(0x4a, 0x8000, 0),
5753 WRITE_COEF(0x45, 0xd289),
5754 UPDATE_COEF(0x49, 0x0300, 0x0300),
5755 {}
5756 };
5757
5758 if (spec->no_internal_mic_pin) {
5759 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5760 return;
5761 }
5762
5763 switch (codec->core.vendor_id) {
5764 case 0x10ec0255:
5765 alc_process_coef_fw(codec, coef0255);
5766 msleep(300);
5767 val = alc_read_coef_idx(codec, 0x46);
5768 is_ctia = (val & 0x0070) == 0x0070;
5769 break;
5770 case 0x10ec0230:
5771 case 0x10ec0236:
5772 case 0x10ec0256:
5773 case 0x19e58326:
5774 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5775 alc_write_coef_idx(codec, 0x06, 0x6104);
5776 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5777
5778 alc_process_coef_fw(codec, coef0255);
5779 msleep(300);
5780 val = alc_read_coef_idx(codec, 0x46);
5781 is_ctia = (val & 0x0070) == 0x0070;
5782 if (!is_ctia) {
5783 alc_write_coef_idx(codec, 0x45, 0xe089);
5784 msleep(100);
5785 val = alc_read_coef_idx(codec, 0x46);
5786 if ((val & 0x0070) == 0x0070)
5787 is_ctia = false;
5788 else
5789 is_ctia = true;
5790 }
5791 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5792 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5793 break;
5794 case 0x10ec0234:
5795 case 0x10ec0274:
5796 case 0x10ec0294:
5797 alc_process_coef_fw(codec, coef0274);
5798 msleep(850);
5799 val = alc_read_coef_idx(codec, 0x46);
5800 is_ctia = (val & 0x00f0) == 0x00f0;
5801 break;
5802 case 0x10ec0233:
5803 case 0x10ec0283:
5804 alc_write_coef_idx(codec, 0x45, 0xd029);
5805 msleep(300);
5806 val = alc_read_coef_idx(codec, 0x46);
5807 is_ctia = (val & 0x0070) == 0x0070;
5808 break;
5809 case 0x10ec0298:
5810 snd_hda_codec_write(codec, 0x21, 0,
5811 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5812 msleep(100);
5813 snd_hda_codec_write(codec, 0x21, 0,
5814 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5815 msleep(200);
5816
5817 val = alc_read_coef_idx(codec, 0x50);
5818 if (val & (1 << 12)) {
5819 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5820 alc_process_coef_fw(codec, coef0288);
5821 msleep(350);
5822 val = alc_read_coef_idx(codec, 0x50);
5823 is_ctia = (val & 0x0070) == 0x0070;
5824 } else {
5825 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5826 alc_process_coef_fw(codec, coef0288);
5827 msleep(350);
5828 val = alc_read_coef_idx(codec, 0x50);
5829 is_ctia = (val & 0x0070) == 0x0070;
5830 }
5831 alc_process_coef_fw(codec, coef0298);
5832 snd_hda_codec_write(codec, 0x21, 0,
5833 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5834 msleep(75);
5835 snd_hda_codec_write(codec, 0x21, 0,
5836 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5837 break;
5838 case 0x10ec0286:
5839 case 0x10ec0288:
5840 alc_process_coef_fw(codec, coef0288);
5841 msleep(350);
5842 val = alc_read_coef_idx(codec, 0x50);
5843 is_ctia = (val & 0x0070) == 0x0070;
5844 break;
5845 case 0x10ec0292:
5846 alc_write_coef_idx(codec, 0x6b, 0xd429);
5847 msleep(300);
5848 val = alc_read_coef_idx(codec, 0x6c);
5849 is_ctia = (val & 0x001c) == 0x001c;
5850 break;
5851 case 0x10ec0293:
5852 alc_process_coef_fw(codec, coef0293);
5853 msleep(300);
5854 val = alc_read_coef_idx(codec, 0x46);
5855 is_ctia = (val & 0x0070) == 0x0070;
5856 break;
5857 case 0x10ec0668:
5858 alc_process_coef_fw(codec, coef0688);
5859 msleep(300);
5860 val = alc_read_coef_idx(codec, 0xbe);
5861 is_ctia = (val & 0x1c02) == 0x1c02;
5862 break;
5863 case 0x10ec0215:
5864 case 0x10ec0225:
5865 case 0x10ec0285:
5866 case 0x10ec0295:
5867 case 0x10ec0289:
5868 case 0x10ec0299:
5869 alc_process_coef_fw(codec, alc225_pre_hsmode);
5870 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5871 val = alc_read_coef_idx(codec, 0x45);
5872 if (val & (1 << 9)) {
5873 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5874 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5875 msleep(800);
5876 val = alc_read_coef_idx(codec, 0x46);
5877 is_ctia = (val & 0x00f0) == 0x00f0;
5878 } else {
5879 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5880 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5881 msleep(800);
5882 val = alc_read_coef_idx(codec, 0x46);
5883 is_ctia = (val & 0x00f0) == 0x00f0;
5884 }
5885 if (!is_ctia) {
5886 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10);
5887 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5888 msleep(100);
5889 val = alc_read_coef_idx(codec, 0x46);
5890 if ((val & 0x00f0) == 0x00f0)
5891 is_ctia = false;
5892 else
5893 is_ctia = true;
5894 }
5895 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5896 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5897 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5898 break;
5899 case 0x10ec0867:
5900 is_ctia = true;
5901 break;
5902 }
5903
5904 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5905 is_ctia ? "yes" : "no");
5906 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5907 }
5908
alc_update_headset_mode(struct hda_codec * codec)5909 static void alc_update_headset_mode(struct hda_codec *codec)
5910 {
5911 struct alc_spec *spec = codec->spec;
5912
5913 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5914 hda_nid_t hp_pin = alc_get_hp_pin(spec);
5915
5916 int new_headset_mode;
5917
5918 if (!snd_hda_jack_detect(codec, hp_pin))
5919 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5920 else if (mux_pin == spec->headset_mic_pin)
5921 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5922 else if (mux_pin == spec->headphone_mic_pin)
5923 new_headset_mode = ALC_HEADSET_MODE_MIC;
5924 else
5925 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5926
5927 if (new_headset_mode == spec->current_headset_mode) {
5928 snd_hda_gen_update_outputs(codec);
5929 return;
5930 }
5931
5932 switch (new_headset_mode) {
5933 case ALC_HEADSET_MODE_UNPLUGGED:
5934 alc_headset_mode_unplugged(codec);
5935 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5936 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5937 spec->gen.hp_jack_present = false;
5938 break;
5939 case ALC_HEADSET_MODE_HEADSET:
5940 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5941 alc_determine_headset_type(codec);
5942 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5943 alc_headset_mode_ctia(codec);
5944 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5945 alc_headset_mode_omtp(codec);
5946 spec->gen.hp_jack_present = true;
5947 break;
5948 case ALC_HEADSET_MODE_MIC:
5949 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5950 spec->gen.hp_jack_present = false;
5951 break;
5952 case ALC_HEADSET_MODE_HEADPHONE:
5953 alc_headset_mode_default(codec);
5954 spec->gen.hp_jack_present = true;
5955 break;
5956 }
5957 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5958 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5959 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5960 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5961 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5962 PIN_VREFHIZ);
5963 }
5964 spec->current_headset_mode = new_headset_mode;
5965
5966 snd_hda_gen_update_outputs(codec);
5967 }
5968
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5969 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5970 struct snd_kcontrol *kcontrol,
5971 struct snd_ctl_elem_value *ucontrol)
5972 {
5973 alc_update_headset_mode(codec);
5974 }
5975
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5976 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5977 struct hda_jack_callback *jack)
5978 {
5979 snd_hda_gen_hp_automute(codec, jack);
5980 alc_update_headset_mode(codec);
5981 }
5982
alc_probe_headset_mode(struct hda_codec * codec)5983 static void alc_probe_headset_mode(struct hda_codec *codec)
5984 {
5985 int i;
5986 struct alc_spec *spec = codec->spec;
5987 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5988
5989 /* Find mic pins */
5990 for (i = 0; i < cfg->num_inputs; i++) {
5991 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5992 spec->headset_mic_pin = cfg->inputs[i].pin;
5993 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5994 spec->headphone_mic_pin = cfg->inputs[i].pin;
5995 }
5996
5997 WARN_ON(spec->gen.cap_sync_hook);
5998 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5999 spec->gen.automute_hook = alc_update_headset_mode;
6000 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
6001 }
6002
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)6003 static void alc_fixup_headset_mode(struct hda_codec *codec,
6004 const struct hda_fixup *fix, int action)
6005 {
6006 struct alc_spec *spec = codec->spec;
6007
6008 switch (action) {
6009 case HDA_FIXUP_ACT_PRE_PROBE:
6010 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
6011 break;
6012 case HDA_FIXUP_ACT_PROBE:
6013 alc_probe_headset_mode(codec);
6014 break;
6015 case HDA_FIXUP_ACT_INIT:
6016 if (is_s3_resume(codec) || is_s4_resume(codec)) {
6017 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
6018 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
6019 }
6020 alc_update_headset_mode(codec);
6021 break;
6022 }
6023 }
6024
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6025 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
6026 const struct hda_fixup *fix, int action)
6027 {
6028 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6029 struct alc_spec *spec = codec->spec;
6030 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6031 }
6032 else
6033 alc_fixup_headset_mode(codec, fix, action);
6034 }
6035
alc255_set_default_jack_type(struct hda_codec * codec)6036 static void alc255_set_default_jack_type(struct hda_codec *codec)
6037 {
6038 /* Set to iphone type */
6039 static const struct coef_fw alc255fw[] = {
6040 WRITE_COEF(0x1b, 0x880b),
6041 WRITE_COEF(0x45, 0xd089),
6042 WRITE_COEF(0x1b, 0x080b),
6043 WRITE_COEF(0x46, 0x0004),
6044 WRITE_COEF(0x1b, 0x0c0b),
6045 {}
6046 };
6047 static const struct coef_fw alc256fw[] = {
6048 WRITE_COEF(0x1b, 0x884b),
6049 WRITE_COEF(0x45, 0xd089),
6050 WRITE_COEF(0x1b, 0x084b),
6051 WRITE_COEF(0x46, 0x0004),
6052 WRITE_COEF(0x1b, 0x0c4b),
6053 {}
6054 };
6055 switch (codec->core.vendor_id) {
6056 case 0x10ec0255:
6057 alc_process_coef_fw(codec, alc255fw);
6058 break;
6059 case 0x10ec0230:
6060 case 0x10ec0236:
6061 case 0x10ec0256:
6062 case 0x19e58326:
6063 alc_process_coef_fw(codec, alc256fw);
6064 break;
6065 }
6066 msleep(30);
6067 }
6068
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)6069 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
6070 const struct hda_fixup *fix, int action)
6071 {
6072 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6073 alc255_set_default_jack_type(codec);
6074 }
6075 alc_fixup_headset_mode(codec, fix, action);
6076 }
6077
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6078 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
6079 const struct hda_fixup *fix, int action)
6080 {
6081 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6082 struct alc_spec *spec = codec->spec;
6083 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6084 alc255_set_default_jack_type(codec);
6085 }
6086 else
6087 alc_fixup_headset_mode(codec, fix, action);
6088 }
6089
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)6090 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
6091 struct hda_jack_callback *jack)
6092 {
6093 struct alc_spec *spec = codec->spec;
6094
6095 alc_update_headset_jack_cb(codec, jack);
6096 /* Headset Mic enable or disable, only for Dell Dino */
6097 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
6098 }
6099
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)6100 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
6101 const struct hda_fixup *fix, int action)
6102 {
6103 alc_fixup_headset_mode(codec, fix, action);
6104 if (action == HDA_FIXUP_ACT_PROBE) {
6105 struct alc_spec *spec = codec->spec;
6106 /* toggled via hp_automute_hook */
6107 spec->gpio_mask |= 0x40;
6108 spec->gpio_dir |= 0x40;
6109 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
6110 }
6111 }
6112
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6113 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
6114 const struct hda_fixup *fix, int action)
6115 {
6116 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6117 struct alc_spec *spec = codec->spec;
6118 spec->gen.auto_mute_via_amp = 1;
6119 }
6120 }
6121
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)6122 static void alc_fixup_no_shutup(struct hda_codec *codec,
6123 const struct hda_fixup *fix, int action)
6124 {
6125 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6126 struct alc_spec *spec = codec->spec;
6127 spec->no_shutup_pins = 1;
6128 }
6129 }
6130
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)6131 static void alc_fixup_disable_aamix(struct hda_codec *codec,
6132 const struct hda_fixup *fix, int action)
6133 {
6134 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6135 struct alc_spec *spec = codec->spec;
6136 /* Disable AA-loopback as it causes white noise */
6137 spec->gen.mixer_nid = 0;
6138 }
6139 }
6140
6141 /* 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)6142 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
6143 const struct hda_fixup *fix, int action)
6144 {
6145 static const struct hda_pintbl pincfgs[] = {
6146 { 0x16, 0x21211010 }, /* dock headphone */
6147 { 0x19, 0x21a11010 }, /* dock mic */
6148 { }
6149 };
6150 struct alc_spec *spec = codec->spec;
6151
6152 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6153 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6154 codec->power_save_node = 0; /* avoid click noises */
6155 snd_hda_apply_pincfgs(codec, pincfgs);
6156 }
6157 }
6158
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)6159 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
6160 const struct hda_fixup *fix, int action)
6161 {
6162 static const struct hda_pintbl pincfgs[] = {
6163 { 0x17, 0x21211010 }, /* dock headphone */
6164 { 0x19, 0x21a11010 }, /* dock mic */
6165 { }
6166 };
6167 struct alc_spec *spec = codec->spec;
6168
6169 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6170 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6171 snd_hda_apply_pincfgs(codec, pincfgs);
6172 } else if (action == HDA_FIXUP_ACT_INIT) {
6173 /* Enable DOCK device */
6174 snd_hda_codec_write(codec, 0x17, 0,
6175 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6176 /* Enable DOCK device */
6177 snd_hda_codec_write(codec, 0x19, 0,
6178 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6179 }
6180 }
6181
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6182 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6183 const struct hda_fixup *fix, int action)
6184 {
6185 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6186 * the speaker output becomes too low by some reason on Thinkpads with
6187 * ALC298 codec
6188 */
6189 static const hda_nid_t preferred_pairs[] = {
6190 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6191 0
6192 };
6193 struct alc_spec *spec = codec->spec;
6194
6195 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6196 spec->gen.preferred_dacs = preferred_pairs;
6197 }
6198
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6199 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6200 const struct hda_fixup *fix, int action)
6201 {
6202 static const hda_nid_t preferred_pairs[] = {
6203 0x17, 0x02, 0x21, 0x03, 0
6204 };
6205 struct alc_spec *spec = codec->spec;
6206
6207 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6208 spec->gen.preferred_dacs = preferred_pairs;
6209 }
6210
alc_shutup_dell_xps13(struct hda_codec * codec)6211 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6212 {
6213 struct alc_spec *spec = codec->spec;
6214 int hp_pin = alc_get_hp_pin(spec);
6215
6216 /* Prevent pop noises when headphones are plugged in */
6217 snd_hda_codec_write(codec, hp_pin, 0,
6218 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6219 msleep(20);
6220 }
6221
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)6222 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6223 const struct hda_fixup *fix, int action)
6224 {
6225 struct alc_spec *spec = codec->spec;
6226 struct hda_input_mux *imux = &spec->gen.input_mux;
6227 int i;
6228
6229 switch (action) {
6230 case HDA_FIXUP_ACT_PRE_PROBE:
6231 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6232 * it causes a click noise at start up
6233 */
6234 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6235 spec->shutup = alc_shutup_dell_xps13;
6236 break;
6237 case HDA_FIXUP_ACT_PROBE:
6238 /* Make the internal mic the default input source. */
6239 for (i = 0; i < imux->num_items; i++) {
6240 if (spec->gen.imux_pins[i] == 0x12) {
6241 spec->gen.cur_mux[0] = i;
6242 break;
6243 }
6244 }
6245 break;
6246 }
6247 }
6248
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)6249 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6250 const struct hda_fixup *fix, int action)
6251 {
6252 struct alc_spec *spec = codec->spec;
6253
6254 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6255 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6256 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6257
6258 /* Disable boost for mic-in permanently. (This code is only called
6259 from quirks that guarantee that the headphone is at NID 0x1b.) */
6260 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6261 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6262 } else
6263 alc_fixup_headset_mode(codec, fix, action);
6264 }
6265
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)6266 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6267 const struct hda_fixup *fix, int action)
6268 {
6269 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6270 alc_write_coef_idx(codec, 0xc4, 0x8000);
6271 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6272 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6273 }
6274 alc_fixup_headset_mode(codec, fix, action);
6275 }
6276
6277 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)6278 static int find_ext_mic_pin(struct hda_codec *codec)
6279 {
6280 struct alc_spec *spec = codec->spec;
6281 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6282 hda_nid_t nid;
6283 unsigned int defcfg;
6284 int i;
6285
6286 for (i = 0; i < cfg->num_inputs; i++) {
6287 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6288 continue;
6289 nid = cfg->inputs[i].pin;
6290 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6291 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6292 continue;
6293 return nid;
6294 }
6295
6296 return 0;
6297 }
6298
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6299 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6300 const struct hda_fixup *fix,
6301 int action)
6302 {
6303 struct alc_spec *spec = codec->spec;
6304
6305 if (action == HDA_FIXUP_ACT_PROBE) {
6306 int mic_pin = find_ext_mic_pin(codec);
6307 int hp_pin = alc_get_hp_pin(spec);
6308
6309 if (snd_BUG_ON(!mic_pin || !hp_pin))
6310 return;
6311 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6312 }
6313 }
6314
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6315 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6316 const struct hda_fixup *fix,
6317 int action)
6318 {
6319 struct alc_spec *spec = codec->spec;
6320 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6321 int i;
6322
6323 /* The mic boosts on level 2 and 3 are too noisy
6324 on the internal mic input.
6325 Therefore limit the boost to 0 or 1. */
6326
6327 if (action != HDA_FIXUP_ACT_PROBE)
6328 return;
6329
6330 for (i = 0; i < cfg->num_inputs; i++) {
6331 hda_nid_t nid = cfg->inputs[i].pin;
6332 unsigned int defcfg;
6333 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6334 continue;
6335 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6336 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6337 continue;
6338
6339 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6340 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6341 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6342 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6343 (0 << AC_AMPCAP_MUTE_SHIFT));
6344 }
6345 }
6346
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6347 static void alc283_hp_automute_hook(struct hda_codec *codec,
6348 struct hda_jack_callback *jack)
6349 {
6350 struct alc_spec *spec = codec->spec;
6351 int vref;
6352
6353 msleep(200);
6354 snd_hda_gen_hp_automute(codec, jack);
6355
6356 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6357
6358 msleep(600);
6359 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6360 vref);
6361 }
6362
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6363 static void alc283_fixup_chromebook(struct hda_codec *codec,
6364 const struct hda_fixup *fix, int action)
6365 {
6366 struct alc_spec *spec = codec->spec;
6367
6368 switch (action) {
6369 case HDA_FIXUP_ACT_PRE_PROBE:
6370 snd_hda_override_wcaps(codec, 0x03, 0);
6371 /* Disable AA-loopback as it causes white noise */
6372 spec->gen.mixer_nid = 0;
6373 break;
6374 case HDA_FIXUP_ACT_INIT:
6375 /* MIC2-VREF control */
6376 /* Set to manual mode */
6377 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6378 /* Enable Line1 input control by verb */
6379 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6380 break;
6381 }
6382 }
6383
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6384 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6385 const struct hda_fixup *fix, int action)
6386 {
6387 struct alc_spec *spec = codec->spec;
6388
6389 switch (action) {
6390 case HDA_FIXUP_ACT_PRE_PROBE:
6391 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6392 break;
6393 case HDA_FIXUP_ACT_INIT:
6394 /* MIC2-VREF control */
6395 /* Set to manual mode */
6396 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6397 break;
6398 }
6399 }
6400
6401 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6402 static void asus_tx300_automute(struct hda_codec *codec)
6403 {
6404 struct alc_spec *spec = codec->spec;
6405 snd_hda_gen_update_outputs(codec);
6406 if (snd_hda_jack_detect(codec, 0x1b))
6407 spec->gen.mute_bits |= (1ULL << 0x14);
6408 }
6409
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6410 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6411 const struct hda_fixup *fix, int action)
6412 {
6413 struct alc_spec *spec = codec->spec;
6414 static const struct hda_pintbl dock_pins[] = {
6415 { 0x1b, 0x21114000 }, /* dock speaker pin */
6416 {}
6417 };
6418
6419 switch (action) {
6420 case HDA_FIXUP_ACT_PRE_PROBE:
6421 spec->init_amp = ALC_INIT_DEFAULT;
6422 /* TX300 needs to set up GPIO2 for the speaker amp */
6423 alc_setup_gpio(codec, 0x04);
6424 snd_hda_apply_pincfgs(codec, dock_pins);
6425 spec->gen.auto_mute_via_amp = 1;
6426 spec->gen.automute_hook = asus_tx300_automute;
6427 snd_hda_jack_detect_enable_callback(codec, 0x1b,
6428 snd_hda_gen_hp_automute);
6429 break;
6430 case HDA_FIXUP_ACT_PROBE:
6431 spec->init_amp = ALC_INIT_DEFAULT;
6432 break;
6433 case HDA_FIXUP_ACT_BUILD:
6434 /* this is a bit tricky; give more sane names for the main
6435 * (tablet) speaker and the dock speaker, respectively
6436 */
6437 rename_ctl(codec, "Speaker Playback Switch",
6438 "Dock Speaker Playback Switch");
6439 rename_ctl(codec, "Bass Speaker Playback Switch",
6440 "Speaker Playback Switch");
6441 break;
6442 }
6443 }
6444
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6445 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6446 const struct hda_fixup *fix, int action)
6447 {
6448 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6449 /* DAC node 0x03 is giving mono output. We therefore want to
6450 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6451 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6452 static const hda_nid_t conn1[] = { 0x0c };
6453 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6454 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6455 }
6456 }
6457
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6458 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6459 const struct hda_fixup *fix, int action)
6460 {
6461 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6462 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6463 we can't adjust the speaker's volume since this node does not has
6464 Amp-out capability. we change the speaker's route to:
6465 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6466 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6467 speaker's volume now. */
6468
6469 static const hda_nid_t conn1[] = { 0x0c };
6470 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6471 }
6472 }
6473
6474 /* 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)6475 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6476 const struct hda_fixup *fix, int action)
6477 {
6478 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6479 static const hda_nid_t conn[] = { 0x02, 0x03 };
6480 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6481 }
6482 }
6483
6484 /* 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)6485 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6486 const struct hda_fixup *fix, int action)
6487 {
6488 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6489 static const hda_nid_t conn[] = { 0x02 };
6490 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6491 }
6492 }
6493
6494 /* disable DAC3 (0x06) selection on NID 0x15 - share Speaker/Bass Speaker DAC 0x03 */
alc294_fixup_bass_speaker_15(struct hda_codec * codec,const struct hda_fixup * fix,int action)6495 static void alc294_fixup_bass_speaker_15(struct hda_codec *codec,
6496 const struct hda_fixup *fix, int action)
6497 {
6498 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6499 static const hda_nid_t conn[] = { 0x02, 0x03 };
6500 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
6501 }
6502 }
6503
6504 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6505 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6506 struct hda_jack_callback *jack)
6507 {
6508 struct alc_spec *spec = codec->spec;
6509
6510 snd_hda_gen_hp_automute(codec, jack);
6511 /* mute_led_polarity is set to 0, so we pass inverted value here */
6512 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6513 !spec->gen.hp_jack_present);
6514 }
6515
6516 /* Manage GPIOs for HP EliteBook Folio 9480m.
6517 *
6518 * GPIO4 is the headphone amplifier power control
6519 * GPIO3 is the audio output mute indicator LED
6520 */
6521
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6522 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6523 const struct hda_fixup *fix,
6524 int action)
6525 {
6526 struct alc_spec *spec = codec->spec;
6527
6528 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6529 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6530 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6531 spec->gpio_mask |= 0x10;
6532 spec->gpio_dir |= 0x10;
6533 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6534 }
6535 }
6536
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6537 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6538 const struct hda_fixup *fix,
6539 int action)
6540 {
6541 struct alc_spec *spec = codec->spec;
6542
6543 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6544 spec->gpio_mask |= 0x04;
6545 spec->gpio_dir |= 0x04;
6546 /* set data bit low */
6547 }
6548 }
6549
6550 /* Quirk for Thinkpad X1 7th and 8th Gen
6551 * The following fixed routing needed
6552 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6553 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6554 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6555 */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6556 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6557 const struct hda_fixup *fix, int action)
6558 {
6559 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6560 static const hda_nid_t preferred_pairs[] = {
6561 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6562 };
6563 struct alc_spec *spec = codec->spec;
6564
6565 switch (action) {
6566 case HDA_FIXUP_ACT_PRE_PROBE:
6567 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6568 spec->gen.preferred_dacs = preferred_pairs;
6569 break;
6570 case HDA_FIXUP_ACT_BUILD:
6571 /* The generic parser creates somewhat unintuitive volume ctls
6572 * with the fixed routing above, and the shared DAC2 may be
6573 * confusing for PA.
6574 * Rename those to unique names so that PA doesn't touch them
6575 * and use only Master volume.
6576 */
6577 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6578 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6579 break;
6580 }
6581 }
6582
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6583 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6584 const struct hda_fixup *fix,
6585 int action)
6586 {
6587 alc_fixup_dual_codecs(codec, fix, action);
6588 switch (action) {
6589 case HDA_FIXUP_ACT_PRE_PROBE:
6590 /* override card longname to provide a unique UCM profile */
6591 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6592 break;
6593 case HDA_FIXUP_ACT_BUILD:
6594 /* rename Capture controls depending on the codec */
6595 rename_ctl(codec, "Capture Volume",
6596 codec->addr == 0 ?
6597 "Rear-Panel Capture Volume" :
6598 "Front-Panel Capture Volume");
6599 rename_ctl(codec, "Capture Switch",
6600 codec->addr == 0 ?
6601 "Rear-Panel Capture Switch" :
6602 "Front-Panel Capture Switch");
6603 break;
6604 }
6605 }
6606
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6607 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6608 const struct hda_fixup *fix, int action)
6609 {
6610 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6611 return;
6612
6613 codec->power_save_node = 1;
6614 }
6615
6616 /* 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)6617 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6618 const struct hda_fixup *fix, int action)
6619 {
6620 struct alc_spec *spec = codec->spec;
6621 static const hda_nid_t preferred_pairs[] = {
6622 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6623 0
6624 };
6625
6626 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6627 return;
6628
6629 spec->gen.preferred_dacs = preferred_pairs;
6630 spec->gen.auto_mute_via_amp = 1;
6631 codec->power_save_node = 0;
6632 }
6633
6634 /* 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)6635 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6636 const struct hda_fixup *fix, int action)
6637 {
6638 static const hda_nid_t preferred_pairs[] = {
6639 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6640 };
6641 struct alc_spec *spec = codec->spec;
6642
6643 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6644 spec->gen.preferred_dacs = preferred_pairs;
6645 }
6646
6647 /* 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)6648 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6649 const struct hda_fixup *fix, int action)
6650 {
6651 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6652 return;
6653
6654 snd_hda_override_wcaps(codec, 0x03, 0);
6655 }
6656
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6657 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6658 {
6659 switch (codec->core.vendor_id) {
6660 case 0x10ec0274:
6661 case 0x10ec0294:
6662 case 0x10ec0225:
6663 case 0x10ec0295:
6664 case 0x10ec0299:
6665 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6666 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6667 break;
6668 case 0x10ec0230:
6669 case 0x10ec0235:
6670 case 0x10ec0236:
6671 case 0x10ec0255:
6672 case 0x10ec0256:
6673 case 0x10ec0257:
6674 case 0x19e58326:
6675 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6676 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6677 break;
6678 }
6679 }
6680
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6681 static void alc295_fixup_chromebook(struct hda_codec *codec,
6682 const struct hda_fixup *fix, int action)
6683 {
6684 struct alc_spec *spec = codec->spec;
6685
6686 switch (action) {
6687 case HDA_FIXUP_ACT_PRE_PROBE:
6688 spec->ultra_low_power = true;
6689 break;
6690 case HDA_FIXUP_ACT_INIT:
6691 alc_combo_jack_hp_jd_restart(codec);
6692 break;
6693 }
6694 }
6695
alc256_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6696 static void alc256_fixup_chromebook(struct hda_codec *codec,
6697 const struct hda_fixup *fix, int action)
6698 {
6699 struct alc_spec *spec = codec->spec;
6700
6701 switch (action) {
6702 case HDA_FIXUP_ACT_PRE_PROBE:
6703 spec->gen.suppress_auto_mute = 1;
6704 spec->gen.suppress_auto_mic = 1;
6705 spec->en_3kpull_low = false;
6706 break;
6707 }
6708 }
6709
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6710 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6711 const struct hda_fixup *fix, int action)
6712 {
6713 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6714 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6715 }
6716
6717
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6718 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6719 struct hda_jack_callback *cb)
6720 {
6721 /* The Windows driver sets the codec up in a very different way where
6722 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6723 */
6724 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6725 alc_write_coef_idx(codec, 0x10, 0x8a20);
6726 else
6727 alc_write_coef_idx(codec, 0x10, 0x0a20);
6728 }
6729
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6730 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6731 const struct hda_fixup *fix, int action)
6732 {
6733 /* Pin 0x21: headphones/headset mic */
6734 if (!is_jack_detectable(codec, 0x21))
6735 return;
6736
6737 switch (action) {
6738 case HDA_FIXUP_ACT_PRE_PROBE:
6739 snd_hda_jack_detect_enable_callback(codec, 0x21,
6740 alc294_gx502_toggle_output);
6741 break;
6742 case HDA_FIXUP_ACT_INIT:
6743 /* Make sure to start in a correct state, i.e. if
6744 * headphones have been plugged in before powering up the system
6745 */
6746 alc294_gx502_toggle_output(codec, NULL);
6747 break;
6748 }
6749 }
6750
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6751 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6752 struct hda_jack_callback *cb)
6753 {
6754 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6755 * responsible from changes between speakers and headphones
6756 */
6757 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6758 alc_write_coef_idx(codec, 0x10, 0x8420);
6759 else
6760 alc_write_coef_idx(codec, 0x10, 0x0a20);
6761 }
6762
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6763 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6764 const struct hda_fixup *fix, int action)
6765 {
6766 if (!is_jack_detectable(codec, 0x21))
6767 return;
6768
6769 switch (action) {
6770 case HDA_FIXUP_ACT_PRE_PROBE:
6771 snd_hda_jack_detect_enable_callback(codec, 0x21,
6772 alc294_gu502_toggle_output);
6773 break;
6774 case HDA_FIXUP_ACT_INIT:
6775 alc294_gu502_toggle_output(codec, NULL);
6776 break;
6777 }
6778 }
6779
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6780 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6781 const struct hda_fixup *fix, int action)
6782 {
6783 if (action != HDA_FIXUP_ACT_INIT)
6784 return;
6785
6786 msleep(100);
6787 alc_write_coef_idx(codec, 0x65, 0x0);
6788 }
6789
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6790 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6791 const struct hda_fixup *fix, int action)
6792 {
6793 switch (action) {
6794 case HDA_FIXUP_ACT_INIT:
6795 alc_combo_jack_hp_jd_restart(codec);
6796 break;
6797 }
6798 }
6799
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6800 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6801 const struct hda_fixup *fix, int action)
6802 {
6803 struct alc_spec *spec = codec->spec;
6804
6805 switch (action) {
6806 case HDA_FIXUP_ACT_PRE_PROBE:
6807 /* Mic RING SLEEVE swap for combo jack */
6808 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6809 spec->no_internal_mic_pin = true;
6810 break;
6811 case HDA_FIXUP_ACT_INIT:
6812 alc_combo_jack_hp_jd_restart(codec);
6813 break;
6814 }
6815 }
6816
6817 /* GPIO1 = amplifier on/off
6818 * GPIO3 = mic mute LED
6819 */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6820 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6821 const struct hda_fixup *fix, int action)
6822 {
6823 static const hda_nid_t conn[] = { 0x02 };
6824
6825 struct alc_spec *spec = codec->spec;
6826 static const struct hda_pintbl pincfgs[] = {
6827 { 0x14, 0x90170110 }, /* front/high speakers */
6828 { 0x17, 0x90170130 }, /* back/bass speakers */
6829 { }
6830 };
6831
6832 //enable micmute led
6833 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6834
6835 switch (action) {
6836 case HDA_FIXUP_ACT_PRE_PROBE:
6837 spec->micmute_led_polarity = 1;
6838 /* needed for amp of back speakers */
6839 spec->gpio_mask |= 0x01;
6840 spec->gpio_dir |= 0x01;
6841 snd_hda_apply_pincfgs(codec, pincfgs);
6842 /* share DAC to have unified volume control */
6843 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6844 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6845 break;
6846 case HDA_FIXUP_ACT_INIT:
6847 /* need to toggle GPIO to enable the amp of back speakers */
6848 alc_update_gpio_data(codec, 0x01, true);
6849 msleep(100);
6850 alc_update_gpio_data(codec, 0x01, false);
6851 break;
6852 }
6853 }
6854
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6855 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6856 const struct hda_fixup *fix, int action)
6857 {
6858 static const hda_nid_t conn[] = { 0x02 };
6859 static const struct hda_pintbl pincfgs[] = {
6860 { 0x14, 0x90170110 }, /* rear speaker */
6861 { }
6862 };
6863
6864 switch (action) {
6865 case HDA_FIXUP_ACT_PRE_PROBE:
6866 snd_hda_apply_pincfgs(codec, pincfgs);
6867 /* force front speaker to DAC1 */
6868 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6869 break;
6870 }
6871 }
6872
alc285_fixup_hp_envy_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6873 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
6874 const struct hda_fixup *fix,
6875 int action)
6876 {
6877 static const struct coef_fw coefs[] = {
6878 WRITE_COEF(0x08, 0x6a0c), WRITE_COEF(0x0d, 0xa023),
6879 WRITE_COEF(0x10, 0x0320), WRITE_COEF(0x1a, 0x8c03),
6880 WRITE_COEF(0x25, 0x1800), WRITE_COEF(0x26, 0x003a),
6881 WRITE_COEF(0x28, 0x1dfe), WRITE_COEF(0x29, 0xb014),
6882 WRITE_COEF(0x2b, 0x1dfe), WRITE_COEF(0x37, 0xfe15),
6883 WRITE_COEF(0x38, 0x7909), WRITE_COEF(0x45, 0xd489),
6884 WRITE_COEF(0x46, 0x00f4), WRITE_COEF(0x4a, 0x21e0),
6885 WRITE_COEF(0x66, 0x03f0), WRITE_COEF(0x67, 0x1000),
6886 WRITE_COEF(0x6e, 0x1005), { }
6887 };
6888
6889 static const struct hda_pintbl pincfgs[] = {
6890 { 0x12, 0xb7a60130 }, /* Internal microphone*/
6891 { 0x14, 0x90170150 }, /* B&O soundbar speakers */
6892 { 0x17, 0x90170153 }, /* Side speakers */
6893 { 0x19, 0x03a11040 }, /* Headset microphone */
6894 { }
6895 };
6896
6897 switch (action) {
6898 case HDA_FIXUP_ACT_PRE_PROBE:
6899 snd_hda_apply_pincfgs(codec, pincfgs);
6900
6901 /* Fixes volume control problem for side speakers */
6902 alc295_fixup_disable_dac3(codec, fix, action);
6903
6904 /* Fixes no sound from headset speaker */
6905 snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
6906
6907 /* Auto-enable headset mic when plugged */
6908 snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
6909
6910 /* Headset mic volume enhancement */
6911 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
6912 break;
6913 case HDA_FIXUP_ACT_INIT:
6914 alc_process_coef_fw(codec, coefs);
6915 break;
6916 case HDA_FIXUP_ACT_BUILD:
6917 rename_ctl(codec, "Bass Speaker Playback Volume",
6918 "B&O-Tuned Playback Volume");
6919 rename_ctl(codec, "Front Playback Switch",
6920 "B&O Soundbar Playback Switch");
6921 rename_ctl(codec, "Bass Speaker Playback Switch",
6922 "Side Speaker Playback Switch");
6923 break;
6924 }
6925 }
6926
6927 /* for hda_fixup_thinkpad_acpi() */
6928 #include "thinkpad_helper.c"
6929
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6930 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6931 const struct hda_fixup *fix, int action)
6932 {
6933 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6934 hda_fixup_thinkpad_acpi(codec, fix, action);
6935 }
6936
6937 /* 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)6938 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6939 const struct hda_fixup *fix,
6940 int action)
6941 {
6942 struct alc_spec *spec = codec->spec;
6943
6944 switch (action) {
6945 case HDA_FIXUP_ACT_PRE_PROBE:
6946 spec->gen.suppress_auto_mute = 1;
6947 break;
6948 }
6949 }
6950
comp_acpi_device_notify(acpi_handle handle,u32 event,void * data)6951 static void comp_acpi_device_notify(acpi_handle handle, u32 event, void *data)
6952 {
6953 struct hda_codec *cdc = data;
6954 struct alc_spec *spec = cdc->spec;
6955
6956 codec_info(cdc, "ACPI Notification %d\n", event);
6957
6958 hda_component_acpi_device_notify(&spec->comps, handle, event, data);
6959 }
6960
comp_bind(struct device * dev)6961 static int comp_bind(struct device *dev)
6962 {
6963 struct hda_codec *cdc = dev_to_hda_codec(dev);
6964 struct alc_spec *spec = cdc->spec;
6965 int ret;
6966
6967 ret = hda_component_manager_bind(cdc, &spec->comps);
6968 if (ret)
6969 return ret;
6970
6971 return hda_component_manager_bind_acpi_notifications(cdc,
6972 &spec->comps,
6973 comp_acpi_device_notify, cdc);
6974 }
6975
comp_unbind(struct device * dev)6976 static void comp_unbind(struct device *dev)
6977 {
6978 struct hda_codec *cdc = dev_to_hda_codec(dev);
6979 struct alc_spec *spec = cdc->spec;
6980
6981 hda_component_manager_unbind_acpi_notifications(cdc, &spec->comps, comp_acpi_device_notify);
6982 hda_component_manager_unbind(cdc, &spec->comps);
6983 }
6984
6985 static const struct component_master_ops comp_master_ops = {
6986 .bind = comp_bind,
6987 .unbind = comp_unbind,
6988 };
6989
comp_generic_playback_hook(struct hda_pcm_stream * hinfo,struct hda_codec * cdc,struct snd_pcm_substream * sub,int action)6990 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6991 struct snd_pcm_substream *sub, int action)
6992 {
6993 struct alc_spec *spec = cdc->spec;
6994
6995 hda_component_manager_playback_hook(&spec->comps, action);
6996 }
6997
comp_generic_fixup(struct hda_codec * cdc,int action,const char * bus,const char * hid,const char * match_str,int count)6998 static void comp_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6999 const char *hid, const char *match_str, int count)
7000 {
7001 struct alc_spec *spec = cdc->spec;
7002 int ret;
7003
7004 switch (action) {
7005 case HDA_FIXUP_ACT_PRE_PROBE:
7006 ret = hda_component_manager_init(cdc, &spec->comps, count, bus, hid,
7007 match_str, &comp_master_ops);
7008 if (ret)
7009 return;
7010
7011 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
7012 break;
7013 case HDA_FIXUP_ACT_FREE:
7014 hda_component_manager_free(&spec->comps, &comp_master_ops);
7015 break;
7016 }
7017 }
7018
find_cirrus_companion_amps(struct hda_codec * cdc)7019 static void find_cirrus_companion_amps(struct hda_codec *cdc)
7020 {
7021 struct device *dev = hda_codec_dev(cdc);
7022 struct acpi_device *adev;
7023 struct fwnode_handle *fwnode __free(fwnode_handle) = NULL;
7024 const char *bus = NULL;
7025 static const struct {
7026 const char *hid;
7027 const char *name;
7028 } acpi_ids[] = {{ "CSC3554", "cs35l54-hda" },
7029 { "CSC3556", "cs35l56-hda" },
7030 { "CSC3557", "cs35l57-hda" }};
7031 char *match;
7032 int i, count = 0, count_devindex = 0;
7033
7034 for (i = 0; i < ARRAY_SIZE(acpi_ids); ++i) {
7035 adev = acpi_dev_get_first_match_dev(acpi_ids[i].hid, NULL, -1);
7036 if (adev)
7037 break;
7038 }
7039 if (!adev) {
7040 codec_dbg(cdc, "Did not find ACPI entry for a Cirrus Amp\n");
7041 return;
7042 }
7043
7044 count = i2c_acpi_client_count(adev);
7045 if (count > 0) {
7046 bus = "i2c";
7047 } else {
7048 count = acpi_spi_count_resources(adev);
7049 if (count > 0)
7050 bus = "spi";
7051 }
7052
7053 fwnode = fwnode_handle_get(acpi_fwnode_handle(adev));
7054 acpi_dev_put(adev);
7055
7056 if (!bus) {
7057 codec_err(cdc, "Did not find any buses for %s\n", acpi_ids[i].hid);
7058 return;
7059 }
7060
7061 if (!fwnode) {
7062 codec_err(cdc, "Could not get fwnode for %s\n", acpi_ids[i].hid);
7063 return;
7064 }
7065
7066 /*
7067 * When available the cirrus,dev-index property is an accurate
7068 * count of the amps in a system and is used in preference to
7069 * the count of bus devices that can contain additional address
7070 * alias entries.
7071 */
7072 count_devindex = fwnode_property_count_u32(fwnode, "cirrus,dev-index");
7073 if (count_devindex > 0)
7074 count = count_devindex;
7075
7076 match = devm_kasprintf(dev, GFP_KERNEL, "-%%s:00-%s.%%d", acpi_ids[i].name);
7077 if (!match)
7078 return;
7079 codec_info(cdc, "Found %d %s on %s (%s)\n", count, acpi_ids[i].hid, bus, match);
7080 comp_generic_fixup(cdc, HDA_FIXUP_ACT_PRE_PROBE, bus, acpi_ids[i].hid, match, count);
7081 }
7082
cs35l41_fixup_i2c_two(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7083 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7084 {
7085 comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7086 }
7087
cs35l41_fixup_i2c_four(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7088 static void cs35l41_fixup_i2c_four(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7089 {
7090 comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7091 }
7092
cs35l41_fixup_spi_two(struct hda_codec * codec,const struct hda_fixup * fix,int action)7093 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7094 {
7095 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
7096 }
7097
cs35l41_fixup_spi_four(struct hda_codec * codec,const struct hda_fixup * fix,int action)7098 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
7099 {
7100 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
7101 }
7102
alc287_fixup_legion_16achg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7103 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7104 int action)
7105 {
7106 comp_generic_fixup(cdc, action, "i2c", "CLSA0100", "-%s:00-cs35l41-hda.%d", 2);
7107 }
7108
alc287_fixup_legion_16ithg6_speakers(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7109 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
7110 int action)
7111 {
7112 comp_generic_fixup(cdc, action, "i2c", "CLSA0101", "-%s:00-cs35l41-hda.%d", 2);
7113 }
7114
alc285_fixup_asus_ga403u(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7115 static void alc285_fixup_asus_ga403u(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
7116 {
7117 /*
7118 * The same SSID has been re-used in different hardware, they have
7119 * different codecs and the newer GA403U has a ALC285.
7120 */
7121 if (cdc->core.vendor_id != 0x10ec0285)
7122 alc_fixup_inv_dmic(cdc, fix, action);
7123 }
7124
tas2781_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7125 static void tas2781_fixup_i2c(struct hda_codec *cdc,
7126 const struct hda_fixup *fix, int action)
7127 {
7128 comp_generic_fixup(cdc, action, "i2c", "TIAS2781", "-%s:00", 1);
7129 }
7130
yoga7_14arb7_fixup_i2c(struct hda_codec * cdc,const struct hda_fixup * fix,int action)7131 static void yoga7_14arb7_fixup_i2c(struct hda_codec *cdc,
7132 const struct hda_fixup *fix, int action)
7133 {
7134 comp_generic_fixup(cdc, action, "i2c", "INT8866", "-%s:00", 1);
7135 }
7136
alc256_fixup_acer_sfg16_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)7137 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec,
7138 const struct hda_fixup *fix, int action)
7139 {
7140 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
7141 }
7142
7143
7144 /* for alc295_fixup_hp_top_speakers */
7145 #include "hp_x360_helper.c"
7146
7147 /* for alc285_fixup_ideapad_s740_coef() */
7148 #include "ideapad_s740_helper.c"
7149
7150 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
7151 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
7152 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
7153 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
7154 {}
7155 };
7156
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)7157 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
7158 const struct hda_fixup *fix,
7159 int action)
7160 {
7161 /*
7162 * A certain other OS sets these coeffs to different values. On at least
7163 * one TongFang barebone these settings might survive even a cold
7164 * reboot. So to restore a clean slate the values are explicitly reset
7165 * to default here. Without this, the external microphone is always in a
7166 * plugged-in state, while the internal microphone is always in an
7167 * unplugged state, breaking the ability to use the internal microphone.
7168 */
7169 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7170 }
7171
7172 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7173 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7174 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7175 WRITE_COEF(0x49, 0x0149),
7176 {}
7177 };
7178
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)7179 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7180 const struct hda_fixup *fix,
7181 int action)
7182 {
7183 /*
7184 * The audio jack input and output is not detected on the ASRock NUC Box
7185 * 1100 series when cold booting without this fix. Warm rebooting from a
7186 * certain other OS makes the audio functional, as COEF settings are
7187 * preserved in this case. This fix sets these altered COEF values as
7188 * the default.
7189 */
7190 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7191 }
7192
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)7193 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7194 const struct hda_fixup *fix,
7195 int action)
7196 {
7197 /*
7198 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7199 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7200 * needs an additional quirk for sound working after suspend and resume.
7201 */
7202 if (codec->core.vendor_id == 0x10ec0256) {
7203 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7204 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7205 } else {
7206 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7207 }
7208 }
7209
alc256_decrease_headphone_amp_val(struct hda_codec * codec,const struct hda_fixup * fix,int action)7210 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec,
7211 const struct hda_fixup *fix, int action)
7212 {
7213 u32 caps;
7214 u8 nsteps, offs;
7215
7216 if (action != HDA_FIXUP_ACT_PRE_PROBE)
7217 return;
7218
7219 caps = query_amp_caps(codec, 0x3, HDA_OUTPUT);
7220 nsteps = ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) - 10;
7221 offs = ((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT) - 10;
7222 caps &= ~AC_AMPCAP_NUM_STEPS & ~AC_AMPCAP_OFFSET;
7223 caps |= (nsteps << AC_AMPCAP_NUM_STEPS_SHIFT) | (offs << AC_AMPCAP_OFFSET_SHIFT);
7224
7225 if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps))
7226 codec_warn(codec, "failed to override amp caps for NID 0x3\n");
7227 }
7228
alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec * codec,const struct hda_fixup * fix,int action)7229 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7230 const struct hda_fixup *fix,
7231 int action)
7232 {
7233 struct alc_spec *spec = codec->spec;
7234 struct hda_input_mux *imux = &spec->gen.input_mux;
7235 int i;
7236
7237 alc269_fixup_limit_int_mic_boost(codec, fix, action);
7238
7239 switch (action) {
7240 case HDA_FIXUP_ACT_PRE_PROBE:
7241 /**
7242 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7243 * to Hi-Z to avoid pop noises at startup and when plugging and
7244 * unplugging headphones.
7245 */
7246 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7247 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7248 break;
7249 case HDA_FIXUP_ACT_PROBE:
7250 /**
7251 * Make the internal mic (0x12) the default input source to
7252 * prevent pop noises on cold boot.
7253 */
7254 for (i = 0; i < imux->num_items; i++) {
7255 if (spec->gen.imux_pins[i] == 0x12) {
7256 spec->gen.cur_mux[0] = i;
7257 break;
7258 }
7259 }
7260 break;
7261 }
7262 }
7263
alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec * codec,const struct hda_fixup * fix,int action)7264 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7265 const struct hda_fixup *fix, int action)
7266 {
7267 /*
7268 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7269 * unconnected.
7270 */
7271 static const struct hda_pintbl pincfgs[] = {
7272 { 0x17, 0x90170121 },
7273 { }
7274 };
7275 /*
7276 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7277 * DAC 0x02 and 0x03 would be fine.
7278 */
7279 static const hda_nid_t conn[] = { 0x02, 0x03 };
7280 /*
7281 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7282 * Headphones (0x21) are connected to DAC 0x03.
7283 */
7284 static const hda_nid_t preferred_pairs[] = {
7285 0x14, 0x02,
7286 0x17, 0x02,
7287 0x21, 0x03,
7288 0
7289 };
7290 struct alc_spec *spec = codec->spec;
7291
7292 switch (action) {
7293 case HDA_FIXUP_ACT_PRE_PROBE:
7294 snd_hda_apply_pincfgs(codec, pincfgs);
7295 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7296 spec->gen.preferred_dacs = preferred_pairs;
7297 break;
7298 }
7299 }
7300
alc295_fixup_dell_inspiron_top_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)7301 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7302 const struct hda_fixup *fix, int action)
7303 {
7304 static const struct hda_pintbl pincfgs[] = {
7305 { 0x14, 0x90170151 },
7306 { 0x17, 0x90170150 },
7307 { }
7308 };
7309 static const hda_nid_t conn[] = { 0x02, 0x03 };
7310 static const hda_nid_t preferred_pairs[] = {
7311 0x14, 0x02,
7312 0x17, 0x03,
7313 0x21, 0x02,
7314 0
7315 };
7316 struct alc_spec *spec = codec->spec;
7317
7318 alc_fixup_no_shutup(codec, fix, action);
7319
7320 switch (action) {
7321 case HDA_FIXUP_ACT_PRE_PROBE:
7322 snd_hda_apply_pincfgs(codec, pincfgs);
7323 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7324 spec->gen.preferred_dacs = preferred_pairs;
7325 break;
7326 }
7327 }
7328
7329 /* 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)7330 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7331 const struct hda_fixup *fix, int action)
7332 {
7333 struct alc_spec *spec = codec->spec;
7334 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7335 static const hda_nid_t preferred_pairs[] = {
7336 0x17, 0x02, 0x21, 0x03, 0
7337 };
7338
7339 if (action != HDA_FIXUP_ACT_PRE_PROBE)
7340 return;
7341
7342 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7343 spec->gen.preferred_dacs = preferred_pairs;
7344 spec->gen.auto_mute_via_amp = 1;
7345 if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7346 snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7347 0x0); /* Make sure 0x14 was disable */
7348 }
7349 }
7350 /* Fix none verb table of Headset Mic pin */
alc_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)7351 static void alc_fixup_headset_mic(struct hda_codec *codec,
7352 const struct hda_fixup *fix, int action)
7353 {
7354 struct alc_spec *spec = codec->spec;
7355 static const struct hda_pintbl pincfgs[] = {
7356 { 0x19, 0x03a1103c },
7357 { }
7358 };
7359
7360 switch (action) {
7361 case HDA_FIXUP_ACT_PRE_PROBE:
7362 snd_hda_apply_pincfgs(codec, pincfgs);
7363 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7364 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7365 break;
7366 }
7367 }
7368
alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec * codec,const struct hda_fixup * fix,int action)7369 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,
7370 const struct hda_fixup *fix, int action)
7371 {
7372 /*
7373 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7374 * unconnected.
7375 * The Pin Complex 0x17 for the bass speakers has the lowest association
7376 * and sequence values so shift it up a bit to squeeze 0x14 in.
7377 */
7378 static const struct hda_pintbl pincfgs[] = {
7379 { 0x14, 0x90170110 }, // top/treble
7380 { 0x17, 0x90170111 }, // bottom/bass
7381 { }
7382 };
7383
7384 /*
7385 * Force DAC 0x02 for the bass speakers 0x17.
7386 */
7387 static const hda_nid_t conn[] = { 0x02 };
7388
7389 switch (action) {
7390 case HDA_FIXUP_ACT_PRE_PROBE:
7391 snd_hda_apply_pincfgs(codec, pincfgs);
7392 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7393 break;
7394 }
7395
7396 cs35l41_fixup_i2c_two(codec, fix, action);
7397 alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7398 alc245_fixup_hp_gpio_led(codec, fix, action);
7399 }
7400
7401 /* some changes for Spectre x360 16, 2024 model */
alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec * codec,const struct hda_fixup * fix,int action)7402 static void alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec *codec,
7403 const struct hda_fixup *fix, int action)
7404 {
7405 /*
7406 * The Pin Complex 0x14 for the treble speakers is wrongly reported as
7407 * unconnected.
7408 * The Pin Complex 0x17 for the bass speakers has the lowest association
7409 * and sequence values so shift it up a bit to squeeze 0x14 in.
7410 */
7411 struct alc_spec *spec = codec->spec;
7412 static const struct hda_pintbl pincfgs[] = {
7413 { 0x14, 0x90170110 }, // top/treble
7414 { 0x17, 0x90170111 }, // bottom/bass
7415 { }
7416 };
7417
7418 /*
7419 * Force DAC 0x02 for the bass speakers 0x17.
7420 */
7421 static const hda_nid_t conn[] = { 0x02 };
7422
7423 switch (action) {
7424 case HDA_FIXUP_ACT_PRE_PROBE:
7425 /* needed for amp of back speakers */
7426 spec->gpio_mask |= 0x01;
7427 spec->gpio_dir |= 0x01;
7428 snd_hda_apply_pincfgs(codec, pincfgs);
7429 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7430 break;
7431 case HDA_FIXUP_ACT_INIT:
7432 /* need to toggle GPIO to enable the amp of back speakers */
7433 alc_update_gpio_data(codec, 0x01, true);
7434 msleep(100);
7435 alc_update_gpio_data(codec, 0x01, false);
7436 break;
7437 }
7438
7439 cs35l41_fixup_i2c_two(codec, fix, action);
7440 alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
7441 alc245_fixup_hp_gpio_led(codec, fix, action);
7442 }
7443
7444 /*
7445 * ALC287 PCM hooks
7446 */
alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)7447 static void alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream *hinfo,
7448 struct hda_codec *codec,
7449 struct snd_pcm_substream *substream,
7450 int action)
7451 {
7452 switch (action) {
7453 case HDA_GEN_PCM_ACT_OPEN:
7454 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */
7455 break;
7456 case HDA_GEN_PCM_ACT_CLOSE:
7457 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7458 break;
7459 }
7460 }
7461
alc287_s4_power_gpio3_default(struct hda_codec * codec)7462 static void alc287_s4_power_gpio3_default(struct hda_codec *codec)
7463 {
7464 if (is_s4_suspend(codec)) {
7465 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
7466 }
7467 }
7468
alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec * codec,const struct hda_fixup * fix,int action)7469 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec,
7470 const struct hda_fixup *fix, int action)
7471 {
7472 struct alc_spec *spec = codec->spec;
7473 static const struct coef_fw coefs[] = {
7474 WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC300),
7475 WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7476 WRITE_COEF(0x24, 0x0013), WRITE_COEF(0x25, 0x0000), WRITE_COEF(0x26, 0xC301),
7477 WRITE_COEF(0x28, 0x0001), WRITE_COEF(0x29, 0xb023),
7478 };
7479
7480 if (action != HDA_FIXUP_ACT_PRE_PROBE)
7481 return;
7482 alc_update_coef_idx(codec, 0x10, 1<<11, 1<<11);
7483 alc_process_coef_fw(codec, coefs);
7484 spec->power_hook = alc287_s4_power_gpio3_default;
7485 spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook;
7486 }
7487
7488
7489 enum {
7490 ALC269_FIXUP_GPIO2,
7491 ALC269_FIXUP_SONY_VAIO,
7492 ALC275_FIXUP_SONY_VAIO_GPIO2,
7493 ALC269_FIXUP_DELL_M101Z,
7494 ALC269_FIXUP_SKU_IGNORE,
7495 ALC269_FIXUP_ASUS_G73JW,
7496 ALC269_FIXUP_ASUS_N7601ZM_PINS,
7497 ALC269_FIXUP_ASUS_N7601ZM,
7498 ALC269_FIXUP_LENOVO_EAPD,
7499 ALC275_FIXUP_SONY_HWEQ,
7500 ALC275_FIXUP_SONY_DISABLE_AAMIX,
7501 ALC271_FIXUP_DMIC,
7502 ALC269_FIXUP_PCM_44K,
7503 ALC269_FIXUP_STEREO_DMIC,
7504 ALC269_FIXUP_HEADSET_MIC,
7505 ALC269_FIXUP_QUANTA_MUTE,
7506 ALC269_FIXUP_LIFEBOOK,
7507 ALC269_FIXUP_LIFEBOOK_EXTMIC,
7508 ALC269_FIXUP_LIFEBOOK_HP_PIN,
7509 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7510 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7511 ALC269_FIXUP_AMIC,
7512 ALC269_FIXUP_DMIC,
7513 ALC269VB_FIXUP_AMIC,
7514 ALC269VB_FIXUP_DMIC,
7515 ALC269_FIXUP_HP_MUTE_LED,
7516 ALC269_FIXUP_HP_MUTE_LED_MIC1,
7517 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7518 ALC269_FIXUP_HP_MUTE_LED_MIC3,
7519 ALC269_FIXUP_HP_GPIO_LED,
7520 ALC269_FIXUP_HP_GPIO_MIC1_LED,
7521 ALC269_FIXUP_HP_LINE1_MIC1_LED,
7522 ALC269_FIXUP_INV_DMIC,
7523 ALC269_FIXUP_LENOVO_DOCK,
7524 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7525 ALC269_FIXUP_NO_SHUTUP,
7526 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7527 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7528 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7529 ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7530 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7531 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7532 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7533 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7534 ALC269_FIXUP_HEADSET_MODE,
7535 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7536 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7537 ALC269_FIXUP_ASUS_X101_FUNC,
7538 ALC269_FIXUP_ASUS_X101_VERB,
7539 ALC269_FIXUP_ASUS_X101,
7540 ALC271_FIXUP_AMIC_MIC2,
7541 ALC271_FIXUP_HP_GATE_MIC_JACK,
7542 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7543 ALC269_FIXUP_ACER_AC700,
7544 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7545 ALC269VB_FIXUP_ASUS_ZENBOOK,
7546 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7547 ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7548 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7549 ALC269VB_FIXUP_ORDISSIMO_EVE2,
7550 ALC283_FIXUP_CHROME_BOOK,
7551 ALC283_FIXUP_SENSE_COMBO_JACK,
7552 ALC282_FIXUP_ASUS_TX300,
7553 ALC283_FIXUP_INT_MIC,
7554 ALC290_FIXUP_MONO_SPEAKERS,
7555 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7556 ALC290_FIXUP_SUBWOOFER,
7557 ALC290_FIXUP_SUBWOOFER_HSJACK,
7558 ALC269_FIXUP_THINKPAD_ACPI,
7559 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7560 ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
7561 ALC269VC_FIXUP_INFINIX_Y4_MAX,
7562 ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO,
7563 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7564 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7565 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7566 ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
7567 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7568 ALC255_FIXUP_HEADSET_MODE,
7569 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7570 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7571 ALC292_FIXUP_TPT440_DOCK,
7572 ALC292_FIXUP_TPT440,
7573 ALC283_FIXUP_HEADSET_MIC,
7574 ALC255_FIXUP_MIC_MUTE_LED,
7575 ALC282_FIXUP_ASPIRE_V5_PINS,
7576 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7577 ALC280_FIXUP_HP_GPIO4,
7578 ALC286_FIXUP_HP_GPIO_LED,
7579 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7580 ALC280_FIXUP_HP_DOCK_PINS,
7581 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7582 ALC280_FIXUP_HP_9480M,
7583 ALC245_FIXUP_HP_X360_AMP,
7584 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7585 ALC285_FIXUP_HP_ENVY_X360,
7586 ALC288_FIXUP_DELL_HEADSET_MODE,
7587 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7588 ALC288_FIXUP_DELL_XPS_13,
7589 ALC288_FIXUP_DISABLE_AAMIX,
7590 ALC292_FIXUP_DELL_E7X_AAMIX,
7591 ALC292_FIXUP_DELL_E7X,
7592 ALC292_FIXUP_DISABLE_AAMIX,
7593 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7594 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7595 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7596 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7597 ALC275_FIXUP_DELL_XPS,
7598 ALC293_FIXUP_LENOVO_SPK_NOISE,
7599 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7600 ALC255_FIXUP_DELL_SPK_NOISE,
7601 ALC225_FIXUP_DISABLE_MIC_VREF,
7602 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7603 ALC295_FIXUP_DISABLE_DAC3,
7604 ALC285_FIXUP_SPEAKER2_TO_DAC1,
7605 ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7606 ALC285_FIXUP_ASUS_HEADSET_MIC,
7607 ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7608 ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7609 ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7610 ALC280_FIXUP_HP_HEADSET_MIC,
7611 ALC221_FIXUP_HP_FRONT_MIC,
7612 ALC292_FIXUP_TPT460,
7613 ALC298_FIXUP_SPK_VOLUME,
7614 ALC298_FIXUP_LENOVO_SPK_VOLUME,
7615 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7616 ALC269_FIXUP_ATIV_BOOK_8,
7617 ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7618 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7619 ALC256_FIXUP_ASUS_HEADSET_MODE,
7620 ALC256_FIXUP_ASUS_MIC,
7621 ALC256_FIXUP_ASUS_AIO_GPIO2,
7622 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7623 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7624 ALC233_FIXUP_LENOVO_MULTI_CODECS,
7625 ALC233_FIXUP_ACER_HEADSET_MIC,
7626 ALC294_FIXUP_LENOVO_MIC_LOCATION,
7627 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7628 ALC225_FIXUP_S3_POP_NOISE,
7629 ALC700_FIXUP_INTEL_REFERENCE,
7630 ALC274_FIXUP_DELL_BIND_DACS,
7631 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7632 ALC298_FIXUP_TPT470_DOCK_FIX,
7633 ALC298_FIXUP_TPT470_DOCK,
7634 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7635 ALC255_FIXUP_DELL_HEADSET_MIC,
7636 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7637 ALC298_FIXUP_HUAWEI_MBX_STEREO,
7638 ALC295_FIXUP_HP_X360,
7639 ALC221_FIXUP_HP_HEADSET_MIC,
7640 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7641 ALC295_FIXUP_HP_AUTO_MUTE,
7642 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7643 ALC294_FIXUP_ASUS_MIC,
7644 ALC294_FIXUP_ASUS_HEADSET_MIC,
7645 ALC294_FIXUP_ASUS_SPK,
7646 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7647 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7648 ALC255_FIXUP_ACER_HEADSET_MIC,
7649 ALC295_FIXUP_CHROME_BOOK,
7650 ALC225_FIXUP_HEADSET_JACK,
7651 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7652 ALC225_FIXUP_WYSE_AUTO_MUTE,
7653 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7654 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7655 ALC256_FIXUP_ASUS_HEADSET_MIC,
7656 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7657 ALC255_FIXUP_PREDATOR_SUBWOOFER,
7658 ALC299_FIXUP_PREDATOR_SPK,
7659 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7660 ALC289_FIXUP_DELL_SPK1,
7661 ALC289_FIXUP_DELL_SPK2,
7662 ALC289_FIXUP_DUAL_SPK,
7663 ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7664 ALC294_FIXUP_SPK2_TO_DAC1,
7665 ALC294_FIXUP_ASUS_DUAL_SPK,
7666 ALC285_FIXUP_THINKPAD_X1_GEN7,
7667 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7668 ALC294_FIXUP_ASUS_ALLY,
7669 ALC294_FIXUP_ASUS_ALLY_X,
7670 ALC294_FIXUP_ASUS_ALLY_PINS,
7671 ALC294_FIXUP_ASUS_ALLY_VERBS,
7672 ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7673 ALC294_FIXUP_ASUS_HPE,
7674 ALC294_FIXUP_ASUS_COEF_1B,
7675 ALC294_FIXUP_ASUS_GX502_HP,
7676 ALC294_FIXUP_ASUS_GX502_PINS,
7677 ALC294_FIXUP_ASUS_GX502_VERBS,
7678 ALC294_FIXUP_ASUS_GU502_HP,
7679 ALC294_FIXUP_ASUS_GU502_PINS,
7680 ALC294_FIXUP_ASUS_GU502_VERBS,
7681 ALC294_FIXUP_ASUS_G513_PINS,
7682 ALC285_FIXUP_ASUS_G533Z_PINS,
7683 ALC285_FIXUP_HP_GPIO_LED,
7684 ALC285_FIXUP_HP_MUTE_LED,
7685 ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7686 ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7687 ALC236_FIXUP_HP_GPIO_LED,
7688 ALC236_FIXUP_HP_MUTE_LED,
7689 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7690 ALC236_FIXUP_LENOVO_INV_DMIC,
7691 ALC298_FIXUP_SAMSUNG_AMP,
7692 ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS,
7693 ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS,
7694 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7695 ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7696 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7697 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7698 ALC269VC_FIXUP_ACER_HEADSET_MIC,
7699 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7700 ALC289_FIXUP_ASUS_GA401,
7701 ALC289_FIXUP_ASUS_GA502,
7702 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7703 ALC285_FIXUP_HP_GPIO_AMP_INIT,
7704 ALC269_FIXUP_CZC_B20,
7705 ALC269_FIXUP_CZC_TMI,
7706 ALC269_FIXUP_CZC_L101,
7707 ALC269_FIXUP_LEMOTE_A1802,
7708 ALC269_FIXUP_LEMOTE_A190X,
7709 ALC256_FIXUP_INTEL_NUC8_RUGGED,
7710 ALC233_FIXUP_INTEL_NUC8_DMIC,
7711 ALC233_FIXUP_INTEL_NUC8_BOOST,
7712 ALC256_FIXUP_INTEL_NUC10,
7713 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7714 ALC274_FIXUP_HP_MIC,
7715 ALC274_FIXUP_HP_HEADSET_MIC,
7716 ALC274_FIXUP_HP_ENVY_GPIO,
7717 ALC274_FIXUP_ASUS_ZEN_AIO_27,
7718 ALC256_FIXUP_ASUS_HPE,
7719 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7720 ALC287_FIXUP_HP_GPIO_LED,
7721 ALC256_FIXUP_HP_HEADSET_MIC,
7722 ALC245_FIXUP_HP_GPIO_LED,
7723 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7724 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7725 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7726 ALC256_FIXUP_ACER_HEADSET_MIC,
7727 ALC285_FIXUP_IDEAPAD_S740_COEF,
7728 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7729 ALC295_FIXUP_ASUS_DACS,
7730 ALC295_FIXUP_HP_OMEN,
7731 ALC285_FIXUP_HP_SPECTRE_X360,
7732 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7733 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7734 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7735 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7736 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7737 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7738 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7739 ALC298_FIXUP_LENOVO_C940_DUET7,
7740 ALC287_FIXUP_13S_GEN2_SPEAKERS,
7741 ALC256_FIXUP_SET_COEF_DEFAULTS,
7742 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7743 ALC233_FIXUP_NO_AUDIO_JACK,
7744 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7745 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7746 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7747 ALC287_FIXUP_LEGION_16ACHG6,
7748 ALC287_FIXUP_CS35L41_I2C_2,
7749 ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7750 ALC287_FIXUP_CS35L41_I2C_4,
7751 ALC245_FIXUP_CS35L41_SPI_2,
7752 ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7753 ALC245_FIXUP_CS35L41_SPI_4,
7754 ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7755 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7756 ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7757 ALC287_FIXUP_LEGION_16ITHG6,
7758 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7759 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7760 ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN,
7761 ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7762 ALC236_FIXUP_DELL_DUAL_CODECS,
7763 ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7764 ALC287_FIXUP_TAS2781_I2C,
7765 ALC287_FIXUP_YOGA7_14ARB7_I2C,
7766 ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7767 ALC245_FIXUP_HP_X360_MUTE_LEDS,
7768 ALC287_FIXUP_THINKPAD_I2S_SPK,
7769 ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7770 ALC2XX_FIXUP_HEADSET_MIC,
7771 ALC289_FIXUP_DELL_CS35L41_SPI_2,
7772 ALC294_FIXUP_CS35L41_I2C_2,
7773 ALC256_FIXUP_ACER_SFG16_MICMUTE_LED,
7774 ALC256_FIXUP_HEADPHONE_AMP_VOL,
7775 ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX,
7776 ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX,
7777 ALC285_FIXUP_ASUS_GA403U,
7778 ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC,
7779 ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1,
7780 ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
7781 ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1,
7782 ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318,
7783 ALC256_FIXUP_CHROME_BOOK,
7784 ALC245_FIXUP_CLEVO_NOISY_MIC,
7785 ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
7786 ALC233_FIXUP_MEDION_MTL_SPK,
7787 ALC294_FIXUP_BASS_SPEAKER_15,
7788 };
7789
7790 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7791 * both have the very same PCI SSID, and we need to apply different fixups
7792 * depending on the codec ID
7793 */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)7794 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7795 const struct hda_fixup *fix,
7796 int action)
7797 {
7798 int id;
7799
7800 if (codec->core.vendor_id == 0x10ec0298)
7801 id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7802 else
7803 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7804 __snd_hda_apply_fixup(codec, id, action, 0);
7805 }
7806
7807 static const struct hda_fixup alc269_fixups[] = {
7808 [ALC269_FIXUP_GPIO2] = {
7809 .type = HDA_FIXUP_FUNC,
7810 .v.func = alc_fixup_gpio2,
7811 },
7812 [ALC269_FIXUP_SONY_VAIO] = {
7813 .type = HDA_FIXUP_PINCTLS,
7814 .v.pins = (const struct hda_pintbl[]) {
7815 {0x19, PIN_VREFGRD},
7816 {}
7817 }
7818 },
7819 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7820 .type = HDA_FIXUP_FUNC,
7821 .v.func = alc275_fixup_gpio4_off,
7822 .chained = true,
7823 .chain_id = ALC269_FIXUP_SONY_VAIO
7824 },
7825 [ALC269_FIXUP_DELL_M101Z] = {
7826 .type = HDA_FIXUP_VERBS,
7827 .v.verbs = (const struct hda_verb[]) {
7828 /* Enables internal speaker */
7829 {0x20, AC_VERB_SET_COEF_INDEX, 13},
7830 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7831 {}
7832 }
7833 },
7834 [ALC269_FIXUP_SKU_IGNORE] = {
7835 .type = HDA_FIXUP_FUNC,
7836 .v.func = alc_fixup_sku_ignore,
7837 },
7838 [ALC269_FIXUP_ASUS_G73JW] = {
7839 .type = HDA_FIXUP_PINS,
7840 .v.pins = (const struct hda_pintbl[]) {
7841 { 0x17, 0x99130111 }, /* subwoofer */
7842 { }
7843 }
7844 },
7845 [ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7846 .type = HDA_FIXUP_PINS,
7847 .v.pins = (const struct hda_pintbl[]) {
7848 { 0x19, 0x03A11050 },
7849 { 0x1a, 0x03A11C30 },
7850 { 0x21, 0x03211420 },
7851 { }
7852 }
7853 },
7854 [ALC269_FIXUP_ASUS_N7601ZM] = {
7855 .type = HDA_FIXUP_VERBS,
7856 .v.verbs = (const struct hda_verb[]) {
7857 {0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7858 {0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7859 {0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7860 {0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7861 {0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7862 {0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7863 { }
7864 },
7865 .chained = true,
7866 .chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7867 },
7868 [ALC269_FIXUP_LENOVO_EAPD] = {
7869 .type = HDA_FIXUP_VERBS,
7870 .v.verbs = (const struct hda_verb[]) {
7871 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7872 {}
7873 }
7874 },
7875 [ALC275_FIXUP_SONY_HWEQ] = {
7876 .type = HDA_FIXUP_FUNC,
7877 .v.func = alc269_fixup_hweq,
7878 .chained = true,
7879 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7880 },
7881 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7882 .type = HDA_FIXUP_FUNC,
7883 .v.func = alc_fixup_disable_aamix,
7884 .chained = true,
7885 .chain_id = ALC269_FIXUP_SONY_VAIO
7886 },
7887 [ALC271_FIXUP_DMIC] = {
7888 .type = HDA_FIXUP_FUNC,
7889 .v.func = alc271_fixup_dmic,
7890 },
7891 [ALC269_FIXUP_PCM_44K] = {
7892 .type = HDA_FIXUP_FUNC,
7893 .v.func = alc269_fixup_pcm_44k,
7894 .chained = true,
7895 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7896 },
7897 [ALC269_FIXUP_STEREO_DMIC] = {
7898 .type = HDA_FIXUP_FUNC,
7899 .v.func = alc269_fixup_stereo_dmic,
7900 },
7901 [ALC269_FIXUP_HEADSET_MIC] = {
7902 .type = HDA_FIXUP_FUNC,
7903 .v.func = alc269_fixup_headset_mic,
7904 },
7905 [ALC269_FIXUP_QUANTA_MUTE] = {
7906 .type = HDA_FIXUP_FUNC,
7907 .v.func = alc269_fixup_quanta_mute,
7908 },
7909 [ALC269_FIXUP_LIFEBOOK] = {
7910 .type = HDA_FIXUP_PINS,
7911 .v.pins = (const struct hda_pintbl[]) {
7912 { 0x1a, 0x2101103f }, /* dock line-out */
7913 { 0x1b, 0x23a11040 }, /* dock mic-in */
7914 { }
7915 },
7916 .chained = true,
7917 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7918 },
7919 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7920 .type = HDA_FIXUP_PINS,
7921 .v.pins = (const struct hda_pintbl[]) {
7922 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7923 { }
7924 },
7925 },
7926 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7927 .type = HDA_FIXUP_PINS,
7928 .v.pins = (const struct hda_pintbl[]) {
7929 { 0x21, 0x0221102f }, /* HP out */
7930 { }
7931 },
7932 },
7933 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7934 .type = HDA_FIXUP_FUNC,
7935 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7936 },
7937 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7938 .type = HDA_FIXUP_FUNC,
7939 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7940 },
7941 [ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13] = {
7942 .type = HDA_FIXUP_PINS,
7943 .v.pins = (const struct hda_pintbl[]) {
7944 { 0x14, 0x90170151 }, /* use as internal speaker (LFE) */
7945 { 0x1b, 0x90170152 }, /* use as internal speaker (back) */
7946 { }
7947 },
7948 .chained = true,
7949 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7950 },
7951 [ALC269VC_FIXUP_INFINIX_Y4_MAX] = {
7952 .type = HDA_FIXUP_PINS,
7953 .v.pins = (const struct hda_pintbl[]) {
7954 { 0x1b, 0x90170150 }, /* use as internal speaker */
7955 { }
7956 },
7957 .chained = true,
7958 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7959 },
7960 [ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO] = {
7961 .type = HDA_FIXUP_PINS,
7962 .v.pins = (const struct hda_pintbl[]) {
7963 { 0x18, 0x03a19020 }, /* headset mic */
7964 { 0x1b, 0x90170150 }, /* speaker */
7965 { }
7966 },
7967 },
7968 [ALC269_FIXUP_AMIC] = {
7969 .type = HDA_FIXUP_PINS,
7970 .v.pins = (const struct hda_pintbl[]) {
7971 { 0x14, 0x99130110 }, /* speaker */
7972 { 0x15, 0x0121401f }, /* HP out */
7973 { 0x18, 0x01a19c20 }, /* mic */
7974 { 0x19, 0x99a3092f }, /* int-mic */
7975 { }
7976 },
7977 },
7978 [ALC269_FIXUP_DMIC] = {
7979 .type = HDA_FIXUP_PINS,
7980 .v.pins = (const struct hda_pintbl[]) {
7981 { 0x12, 0x99a3092f }, /* int-mic */
7982 { 0x14, 0x99130110 }, /* speaker */
7983 { 0x15, 0x0121401f }, /* HP out */
7984 { 0x18, 0x01a19c20 }, /* mic */
7985 { }
7986 },
7987 },
7988 [ALC269VB_FIXUP_AMIC] = {
7989 .type = HDA_FIXUP_PINS,
7990 .v.pins = (const struct hda_pintbl[]) {
7991 { 0x14, 0x99130110 }, /* speaker */
7992 { 0x18, 0x01a19c20 }, /* mic */
7993 { 0x19, 0x99a3092f }, /* int-mic */
7994 { 0x21, 0x0121401f }, /* HP out */
7995 { }
7996 },
7997 },
7998 [ALC269VB_FIXUP_DMIC] = {
7999 .type = HDA_FIXUP_PINS,
8000 .v.pins = (const struct hda_pintbl[]) {
8001 { 0x12, 0x99a3092f }, /* int-mic */
8002 { 0x14, 0x99130110 }, /* speaker */
8003 { 0x18, 0x01a19c20 }, /* mic */
8004 { 0x21, 0x0121401f }, /* HP out */
8005 { }
8006 },
8007 },
8008 [ALC269_FIXUP_HP_MUTE_LED] = {
8009 .type = HDA_FIXUP_FUNC,
8010 .v.func = alc269_fixup_hp_mute_led,
8011 },
8012 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
8013 .type = HDA_FIXUP_FUNC,
8014 .v.func = alc269_fixup_hp_mute_led_mic1,
8015 },
8016 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
8017 .type = HDA_FIXUP_FUNC,
8018 .v.func = alc269_fixup_hp_mute_led_mic2,
8019 },
8020 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
8021 .type = HDA_FIXUP_FUNC,
8022 .v.func = alc269_fixup_hp_mute_led_mic3,
8023 .chained = true,
8024 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
8025 },
8026 [ALC269_FIXUP_HP_GPIO_LED] = {
8027 .type = HDA_FIXUP_FUNC,
8028 .v.func = alc269_fixup_hp_gpio_led,
8029 },
8030 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
8031 .type = HDA_FIXUP_FUNC,
8032 .v.func = alc269_fixup_hp_gpio_mic1_led,
8033 },
8034 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
8035 .type = HDA_FIXUP_FUNC,
8036 .v.func = alc269_fixup_hp_line1_mic1_led,
8037 },
8038 [ALC269_FIXUP_INV_DMIC] = {
8039 .type = HDA_FIXUP_FUNC,
8040 .v.func = alc_fixup_inv_dmic,
8041 },
8042 [ALC269_FIXUP_NO_SHUTUP] = {
8043 .type = HDA_FIXUP_FUNC,
8044 .v.func = alc_fixup_no_shutup,
8045 },
8046 [ALC269_FIXUP_LENOVO_DOCK] = {
8047 .type = HDA_FIXUP_PINS,
8048 .v.pins = (const struct hda_pintbl[]) {
8049 { 0x19, 0x23a11040 }, /* dock mic */
8050 { 0x1b, 0x2121103f }, /* dock headphone */
8051 { }
8052 },
8053 .chained = true,
8054 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
8055 },
8056 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
8057 .type = HDA_FIXUP_FUNC,
8058 .v.func = alc269_fixup_limit_int_mic_boost,
8059 .chained = true,
8060 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
8061 },
8062 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
8063 .type = HDA_FIXUP_FUNC,
8064 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
8065 .chained = true,
8066 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8067 },
8068 [ALC269_FIXUP_DELL1_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 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8073 { }
8074 },
8075 .chained = true,
8076 .chain_id = ALC269_FIXUP_HEADSET_MODE
8077 },
8078 [ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8079 .type = HDA_FIXUP_FUNC,
8080 .v.func = alc269_fixup_limit_int_mic_boost,
8081 .chained = true,
8082 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8083 },
8084 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8085 .type = HDA_FIXUP_PINS,
8086 .v.pins = (const struct hda_pintbl[]) {
8087 { 0x16, 0x21014020 }, /* dock line out */
8088 { 0x19, 0x21a19030 }, /* dock mic */
8089 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8090 { }
8091 },
8092 .chained = true,
8093 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8094 },
8095 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
8096 .type = HDA_FIXUP_PINS,
8097 .v.pins = (const struct hda_pintbl[]) {
8098 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8099 { }
8100 },
8101 .chained = true,
8102 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8103 },
8104 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
8105 .type = HDA_FIXUP_PINS,
8106 .v.pins = (const struct hda_pintbl[]) {
8107 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8108 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8109 { }
8110 },
8111 .chained = true,
8112 .chain_id = ALC269_FIXUP_HEADSET_MODE
8113 },
8114 [ALC269_FIXUP_HEADSET_MODE] = {
8115 .type = HDA_FIXUP_FUNC,
8116 .v.func = alc_fixup_headset_mode,
8117 .chained = true,
8118 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8119 },
8120 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8121 .type = HDA_FIXUP_FUNC,
8122 .v.func = alc_fixup_headset_mode_no_hp_mic,
8123 },
8124 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
8125 .type = HDA_FIXUP_PINS,
8126 .v.pins = (const struct hda_pintbl[]) {
8127 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
8128 { }
8129 },
8130 .chained = true,
8131 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8132 },
8133 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
8134 .type = HDA_FIXUP_PINS,
8135 .v.pins = (const struct hda_pintbl[]) {
8136 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8137 { }
8138 },
8139 .chained = true,
8140 .chain_id = ALC269_FIXUP_HEADSET_MIC
8141 },
8142 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
8143 .type = HDA_FIXUP_PINS,
8144 .v.pins = (const struct hda_pintbl[]) {
8145 {0x12, 0x90a60130},
8146 {0x13, 0x40000000},
8147 {0x14, 0x90170110},
8148 {0x18, 0x411111f0},
8149 {0x19, 0x04a11040},
8150 {0x1a, 0x411111f0},
8151 {0x1b, 0x90170112},
8152 {0x1d, 0x40759a05},
8153 {0x1e, 0x411111f0},
8154 {0x21, 0x04211020},
8155 { }
8156 },
8157 .chained = true,
8158 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8159 },
8160 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
8161 .type = HDA_FIXUP_FUNC,
8162 .v.func = alc298_fixup_huawei_mbx_stereo,
8163 .chained = true,
8164 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8165 },
8166 [ALC269_FIXUP_ASUS_X101_FUNC] = {
8167 .type = HDA_FIXUP_FUNC,
8168 .v.func = alc269_fixup_x101_headset_mic,
8169 },
8170 [ALC269_FIXUP_ASUS_X101_VERB] = {
8171 .type = HDA_FIXUP_VERBS,
8172 .v.verbs = (const struct hda_verb[]) {
8173 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
8174 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8175 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
8176 { }
8177 },
8178 .chained = true,
8179 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
8180 },
8181 [ALC269_FIXUP_ASUS_X101] = {
8182 .type = HDA_FIXUP_PINS,
8183 .v.pins = (const struct hda_pintbl[]) {
8184 { 0x18, 0x04a1182c }, /* Headset mic */
8185 { }
8186 },
8187 .chained = true,
8188 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
8189 },
8190 [ALC271_FIXUP_AMIC_MIC2] = {
8191 .type = HDA_FIXUP_PINS,
8192 .v.pins = (const struct hda_pintbl[]) {
8193 { 0x14, 0x99130110 }, /* speaker */
8194 { 0x19, 0x01a19c20 }, /* mic */
8195 { 0x1b, 0x99a7012f }, /* int-mic */
8196 { 0x21, 0x0121401f }, /* HP out */
8197 { }
8198 },
8199 },
8200 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
8201 .type = HDA_FIXUP_FUNC,
8202 .v.func = alc271_hp_gate_mic_jack,
8203 .chained = true,
8204 .chain_id = ALC271_FIXUP_AMIC_MIC2,
8205 },
8206 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
8207 .type = HDA_FIXUP_FUNC,
8208 .v.func = alc269_fixup_limit_int_mic_boost,
8209 .chained = true,
8210 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
8211 },
8212 [ALC269_FIXUP_ACER_AC700] = {
8213 .type = HDA_FIXUP_PINS,
8214 .v.pins = (const struct hda_pintbl[]) {
8215 { 0x12, 0x99a3092f }, /* int-mic */
8216 { 0x14, 0x99130110 }, /* speaker */
8217 { 0x18, 0x03a11c20 }, /* mic */
8218 { 0x1e, 0x0346101e }, /* SPDIF1 */
8219 { 0x21, 0x0321101f }, /* HP out */
8220 { }
8221 },
8222 .chained = true,
8223 .chain_id = ALC271_FIXUP_DMIC,
8224 },
8225 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
8226 .type = HDA_FIXUP_FUNC,
8227 .v.func = alc269_fixup_limit_int_mic_boost,
8228 .chained = true,
8229 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8230 },
8231 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
8232 .type = HDA_FIXUP_FUNC,
8233 .v.func = alc269_fixup_limit_int_mic_boost,
8234 .chained = true,
8235 .chain_id = ALC269VB_FIXUP_DMIC,
8236 },
8237 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
8238 .type = HDA_FIXUP_VERBS,
8239 .v.verbs = (const struct hda_verb[]) {
8240 /* class-D output amp +5dB */
8241 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
8242 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
8243 {}
8244 },
8245 .chained = true,
8246 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
8247 },
8248 [ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8249 .type = HDA_FIXUP_PINS,
8250 .v.pins = (const struct hda_pintbl[]) {
8251 { 0x18, 0x01a110f0 }, /* use as headset mic */
8252 { }
8253 },
8254 .chained = true,
8255 .chain_id = ALC269_FIXUP_HEADSET_MIC
8256 },
8257 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
8258 .type = HDA_FIXUP_FUNC,
8259 .v.func = alc269_fixup_limit_int_mic_boost,
8260 .chained = true,
8261 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
8262 },
8263 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
8264 .type = HDA_FIXUP_PINS,
8265 .v.pins = (const struct hda_pintbl[]) {
8266 { 0x12, 0x99a3092f }, /* int-mic */
8267 { 0x18, 0x03a11d20 }, /* mic */
8268 { 0x19, 0x411111f0 }, /* Unused bogus pin */
8269 { }
8270 },
8271 },
8272 [ALC283_FIXUP_CHROME_BOOK] = {
8273 .type = HDA_FIXUP_FUNC,
8274 .v.func = alc283_fixup_chromebook,
8275 },
8276 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
8277 .type = HDA_FIXUP_FUNC,
8278 .v.func = alc283_fixup_sense_combo_jack,
8279 .chained = true,
8280 .chain_id = ALC283_FIXUP_CHROME_BOOK,
8281 },
8282 [ALC282_FIXUP_ASUS_TX300] = {
8283 .type = HDA_FIXUP_FUNC,
8284 .v.func = alc282_fixup_asus_tx300,
8285 },
8286 [ALC283_FIXUP_INT_MIC] = {
8287 .type = HDA_FIXUP_VERBS,
8288 .v.verbs = (const struct hda_verb[]) {
8289 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
8290 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
8291 { }
8292 },
8293 .chained = true,
8294 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8295 },
8296 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
8297 .type = HDA_FIXUP_PINS,
8298 .v.pins = (const struct hda_pintbl[]) {
8299 { 0x17, 0x90170112 }, /* subwoofer */
8300 { }
8301 },
8302 .chained = true,
8303 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
8304 },
8305 [ALC290_FIXUP_SUBWOOFER] = {
8306 .type = HDA_FIXUP_PINS,
8307 .v.pins = (const struct hda_pintbl[]) {
8308 { 0x17, 0x90170112 }, /* subwoofer */
8309 { }
8310 },
8311 .chained = true,
8312 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
8313 },
8314 [ALC290_FIXUP_MONO_SPEAKERS] = {
8315 .type = HDA_FIXUP_FUNC,
8316 .v.func = alc290_fixup_mono_speakers,
8317 },
8318 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
8319 .type = HDA_FIXUP_FUNC,
8320 .v.func = alc290_fixup_mono_speakers,
8321 .chained = true,
8322 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
8323 },
8324 [ALC269_FIXUP_THINKPAD_ACPI] = {
8325 .type = HDA_FIXUP_FUNC,
8326 .v.func = alc_fixup_thinkpad_acpi,
8327 .chained = true,
8328 .chain_id = ALC269_FIXUP_SKU_IGNORE,
8329 },
8330 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
8331 .type = HDA_FIXUP_FUNC,
8332 .v.func = alc_fixup_inv_dmic,
8333 .chained = true,
8334 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8335 },
8336 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
8337 .type = HDA_FIXUP_PINS,
8338 .v.pins = (const struct hda_pintbl[]) {
8339 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8340 { }
8341 },
8342 .chained = true,
8343 .chain_id = ALC255_FIXUP_HEADSET_MODE
8344 },
8345 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8346 .type = HDA_FIXUP_PINS,
8347 .v.pins = (const struct hda_pintbl[]) {
8348 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8349 { }
8350 },
8351 .chained = true,
8352 .chain_id = ALC255_FIXUP_HEADSET_MODE
8353 },
8354 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8355 .type = HDA_FIXUP_PINS,
8356 .v.pins = (const struct hda_pintbl[]) {
8357 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8358 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8359 { }
8360 },
8361 .chained = true,
8362 .chain_id = ALC255_FIXUP_HEADSET_MODE
8363 },
8364 [ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST] = {
8365 .type = HDA_FIXUP_FUNC,
8366 .v.func = alc269_fixup_limit_int_mic_boost,
8367 .chained = true,
8368 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8369 },
8370 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
8371 .type = HDA_FIXUP_PINS,
8372 .v.pins = (const struct hda_pintbl[]) {
8373 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8374 { }
8375 },
8376 .chained = true,
8377 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8378 },
8379 [ALC255_FIXUP_HEADSET_MODE] = {
8380 .type = HDA_FIXUP_FUNC,
8381 .v.func = alc_fixup_headset_mode_alc255,
8382 .chained = true,
8383 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8384 },
8385 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8386 .type = HDA_FIXUP_FUNC,
8387 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8388 },
8389 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8390 .type = HDA_FIXUP_PINS,
8391 .v.pins = (const struct hda_pintbl[]) {
8392 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8393 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8394 { }
8395 },
8396 .chained = true,
8397 .chain_id = ALC269_FIXUP_HEADSET_MODE
8398 },
8399 [ALC292_FIXUP_TPT440_DOCK] = {
8400 .type = HDA_FIXUP_FUNC,
8401 .v.func = alc_fixup_tpt440_dock,
8402 .chained = true,
8403 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8404 },
8405 [ALC292_FIXUP_TPT440] = {
8406 .type = HDA_FIXUP_FUNC,
8407 .v.func = alc_fixup_disable_aamix,
8408 .chained = true,
8409 .chain_id = ALC292_FIXUP_TPT440_DOCK,
8410 },
8411 [ALC283_FIXUP_HEADSET_MIC] = {
8412 .type = HDA_FIXUP_PINS,
8413 .v.pins = (const struct hda_pintbl[]) {
8414 { 0x19, 0x04a110f0 },
8415 { },
8416 },
8417 },
8418 [ALC255_FIXUP_MIC_MUTE_LED] = {
8419 .type = HDA_FIXUP_FUNC,
8420 .v.func = alc_fixup_micmute_led,
8421 },
8422 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
8423 .type = HDA_FIXUP_PINS,
8424 .v.pins = (const struct hda_pintbl[]) {
8425 { 0x12, 0x90a60130 },
8426 { 0x14, 0x90170110 },
8427 { 0x17, 0x40000008 },
8428 { 0x18, 0x411111f0 },
8429 { 0x19, 0x01a1913c },
8430 { 0x1a, 0x411111f0 },
8431 { 0x1b, 0x411111f0 },
8432 { 0x1d, 0x40f89b2d },
8433 { 0x1e, 0x411111f0 },
8434 { 0x21, 0x0321101f },
8435 { },
8436 },
8437 },
8438 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8439 .type = HDA_FIXUP_FUNC,
8440 .v.func = alc269vb_fixup_aspire_e1_coef,
8441 },
8442 [ALC280_FIXUP_HP_GPIO4] = {
8443 .type = HDA_FIXUP_FUNC,
8444 .v.func = alc280_fixup_hp_gpio4,
8445 },
8446 [ALC286_FIXUP_HP_GPIO_LED] = {
8447 .type = HDA_FIXUP_FUNC,
8448 .v.func = alc286_fixup_hp_gpio_led,
8449 },
8450 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8451 .type = HDA_FIXUP_FUNC,
8452 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8453 },
8454 [ALC280_FIXUP_HP_DOCK_PINS] = {
8455 .type = HDA_FIXUP_PINS,
8456 .v.pins = (const struct hda_pintbl[]) {
8457 { 0x1b, 0x21011020 }, /* line-out */
8458 { 0x1a, 0x01a1903c }, /* headset mic */
8459 { 0x18, 0x2181103f }, /* line-in */
8460 { },
8461 },
8462 .chained = true,
8463 .chain_id = ALC280_FIXUP_HP_GPIO4
8464 },
8465 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8466 .type = HDA_FIXUP_PINS,
8467 .v.pins = (const struct hda_pintbl[]) {
8468 { 0x1b, 0x21011020 }, /* line-out */
8469 { 0x18, 0x2181103f }, /* line-in */
8470 { },
8471 },
8472 .chained = true,
8473 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8474 },
8475 [ALC280_FIXUP_HP_9480M] = {
8476 .type = HDA_FIXUP_FUNC,
8477 .v.func = alc280_fixup_hp_9480m,
8478 },
8479 [ALC245_FIXUP_HP_X360_AMP] = {
8480 .type = HDA_FIXUP_FUNC,
8481 .v.func = alc245_fixup_hp_x360_amp,
8482 .chained = true,
8483 .chain_id = ALC245_FIXUP_HP_GPIO_LED
8484 },
8485 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
8486 .type = HDA_FIXUP_FUNC,
8487 .v.func = alc_fixup_headset_mode_dell_alc288,
8488 .chained = true,
8489 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8490 },
8491 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8492 .type = HDA_FIXUP_PINS,
8493 .v.pins = (const struct hda_pintbl[]) {
8494 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8495 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8496 { }
8497 },
8498 .chained = true,
8499 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8500 },
8501 [ALC288_FIXUP_DISABLE_AAMIX] = {
8502 .type = HDA_FIXUP_FUNC,
8503 .v.func = alc_fixup_disable_aamix,
8504 .chained = true,
8505 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8506 },
8507 [ALC288_FIXUP_DELL_XPS_13] = {
8508 .type = HDA_FIXUP_FUNC,
8509 .v.func = alc_fixup_dell_xps13,
8510 .chained = true,
8511 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
8512 },
8513 [ALC292_FIXUP_DISABLE_AAMIX] = {
8514 .type = HDA_FIXUP_FUNC,
8515 .v.func = alc_fixup_disable_aamix,
8516 .chained = true,
8517 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8518 },
8519 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8520 .type = HDA_FIXUP_FUNC,
8521 .v.func = alc_fixup_disable_aamix,
8522 .chained = true,
8523 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8524 },
8525 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8526 .type = HDA_FIXUP_FUNC,
8527 .v.func = alc_fixup_dell_xps13,
8528 .chained = true,
8529 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
8530 },
8531 [ALC292_FIXUP_DELL_E7X] = {
8532 .type = HDA_FIXUP_FUNC,
8533 .v.func = alc_fixup_micmute_led,
8534 /* micmute fixup must be applied at last */
8535 .chained_before = true,
8536 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8537 },
8538 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8539 .type = HDA_FIXUP_PINS,
8540 .v.pins = (const struct hda_pintbl[]) {
8541 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8542 { }
8543 },
8544 .chained_before = true,
8545 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8546 },
8547 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8548 .type = HDA_FIXUP_PINS,
8549 .v.pins = (const struct hda_pintbl[]) {
8550 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8551 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8552 { }
8553 },
8554 .chained = true,
8555 .chain_id = ALC269_FIXUP_HEADSET_MODE
8556 },
8557 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8558 .type = HDA_FIXUP_PINS,
8559 .v.pins = (const struct hda_pintbl[]) {
8560 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8561 { }
8562 },
8563 .chained = true,
8564 .chain_id = ALC269_FIXUP_HEADSET_MODE
8565 },
8566 [ALC275_FIXUP_DELL_XPS] = {
8567 .type = HDA_FIXUP_VERBS,
8568 .v.verbs = (const struct hda_verb[]) {
8569 /* Enables internal speaker */
8570 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8571 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8572 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8573 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8574 {}
8575 }
8576 },
8577 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8578 .type = HDA_FIXUP_FUNC,
8579 .v.func = alc_fixup_disable_aamix,
8580 .chained = true,
8581 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8582 },
8583 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8584 .type = HDA_FIXUP_FUNC,
8585 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8586 },
8587 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8588 .type = HDA_FIXUP_FUNC,
8589 .v.func = alc_fixup_inv_dmic,
8590 .chained = true,
8591 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8592 },
8593 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8594 .type = HDA_FIXUP_FUNC,
8595 .v.func = alc269_fixup_limit_int_mic_boost
8596 },
8597 [ALC255_FIXUP_DELL_SPK_NOISE] = {
8598 .type = HDA_FIXUP_FUNC,
8599 .v.func = alc_fixup_disable_aamix,
8600 .chained = true,
8601 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8602 },
8603 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
8604 .type = HDA_FIXUP_FUNC,
8605 .v.func = alc_fixup_disable_mic_vref,
8606 .chained = true,
8607 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8608 },
8609 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8610 .type = HDA_FIXUP_VERBS,
8611 .v.verbs = (const struct hda_verb[]) {
8612 /* Disable pass-through path for FRONT 14h */
8613 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8614 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8615 {}
8616 },
8617 .chained = true,
8618 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8619 },
8620 [ALC280_FIXUP_HP_HEADSET_MIC] = {
8621 .type = HDA_FIXUP_FUNC,
8622 .v.func = alc_fixup_disable_aamix,
8623 .chained = true,
8624 .chain_id = ALC269_FIXUP_HEADSET_MIC,
8625 },
8626 [ALC221_FIXUP_HP_FRONT_MIC] = {
8627 .type = HDA_FIXUP_PINS,
8628 .v.pins = (const struct hda_pintbl[]) {
8629 { 0x19, 0x02a19020 }, /* Front Mic */
8630 { }
8631 },
8632 },
8633 [ALC292_FIXUP_TPT460] = {
8634 .type = HDA_FIXUP_FUNC,
8635 .v.func = alc_fixup_tpt440_dock,
8636 .chained = true,
8637 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8638 },
8639 [ALC298_FIXUP_SPK_VOLUME] = {
8640 .type = HDA_FIXUP_FUNC,
8641 .v.func = alc298_fixup_speaker_volume,
8642 .chained = true,
8643 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8644 },
8645 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8646 .type = HDA_FIXUP_FUNC,
8647 .v.func = alc298_fixup_speaker_volume,
8648 },
8649 [ALC295_FIXUP_DISABLE_DAC3] = {
8650 .type = HDA_FIXUP_FUNC,
8651 .v.func = alc295_fixup_disable_dac3,
8652 },
8653 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8654 .type = HDA_FIXUP_FUNC,
8655 .v.func = alc285_fixup_speaker2_to_dac1,
8656 .chained = true,
8657 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8658 },
8659 [ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8660 .type = HDA_FIXUP_FUNC,
8661 .v.func = alc285_fixup_speaker2_to_dac1,
8662 .chained = true,
8663 .chain_id = ALC245_FIXUP_CS35L41_SPI_2
8664 },
8665 [ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8666 .type = HDA_FIXUP_PINS,
8667 .v.pins = (const struct hda_pintbl[]) {
8668 { 0x19, 0x03a11050 },
8669 { 0x1b, 0x03a11c30 },
8670 { }
8671 },
8672 .chained = true,
8673 .chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8674 },
8675 [ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8676 .type = HDA_FIXUP_PINS,
8677 .v.pins = (const struct hda_pintbl[]) {
8678 { 0x14, 0x90170120 },
8679 { }
8680 },
8681 .chained = true,
8682 .chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8683 },
8684 [ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8685 .type = HDA_FIXUP_FUNC,
8686 .v.func = alc285_fixup_speaker2_to_dac1,
8687 .chained = true,
8688 .chain_id = ALC287_FIXUP_CS35L41_I2C_2
8689 },
8690 [ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8691 .type = HDA_FIXUP_PINS,
8692 .v.pins = (const struct hda_pintbl[]) {
8693 { 0x19, 0x03a11050 },
8694 { 0x1b, 0x03a11c30 },
8695 { }
8696 },
8697 .chained = true,
8698 .chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8699 },
8700 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8701 .type = HDA_FIXUP_PINS,
8702 .v.pins = (const struct hda_pintbl[]) {
8703 { 0x1b, 0x90170151 },
8704 { }
8705 },
8706 .chained = true,
8707 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8708 },
8709 [ALC269_FIXUP_ATIV_BOOK_8] = {
8710 .type = HDA_FIXUP_FUNC,
8711 .v.func = alc_fixup_auto_mute_via_amp,
8712 .chained = true,
8713 .chain_id = ALC269_FIXUP_NO_SHUTUP
8714 },
8715 [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8716 .type = HDA_FIXUP_PINS,
8717 .v.pins = (const struct hda_pintbl[]) {
8718 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8719 { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8720 { }
8721 },
8722 .chained = true,
8723 .chain_id = ALC269_FIXUP_HEADSET_MODE
8724 },
8725 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8726 .type = HDA_FIXUP_PINS,
8727 .v.pins = (const struct hda_pintbl[]) {
8728 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8729 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8730 { }
8731 },
8732 .chained = true,
8733 .chain_id = ALC269_FIXUP_HEADSET_MODE
8734 },
8735 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8736 .type = HDA_FIXUP_FUNC,
8737 .v.func = alc_fixup_headset_mode,
8738 },
8739 [ALC256_FIXUP_ASUS_MIC] = {
8740 .type = HDA_FIXUP_PINS,
8741 .v.pins = (const struct hda_pintbl[]) {
8742 { 0x13, 0x90a60160 }, /* use as internal mic */
8743 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8744 { }
8745 },
8746 .chained = true,
8747 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8748 },
8749 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8750 .type = HDA_FIXUP_FUNC,
8751 /* Set up GPIO2 for the speaker amp */
8752 .v.func = alc_fixup_gpio4,
8753 },
8754 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8755 .type = HDA_FIXUP_PINS,
8756 .v.pins = (const struct hda_pintbl[]) {
8757 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8758 { }
8759 },
8760 .chained = true,
8761 .chain_id = ALC269_FIXUP_HEADSET_MIC
8762 },
8763 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8764 .type = HDA_FIXUP_VERBS,
8765 .v.verbs = (const struct hda_verb[]) {
8766 /* Enables internal speaker */
8767 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8768 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8769 {}
8770 },
8771 .chained = true,
8772 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8773 },
8774 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8775 .type = HDA_FIXUP_FUNC,
8776 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8777 .chained = true,
8778 .chain_id = ALC269_FIXUP_GPIO2
8779 },
8780 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
8781 .type = HDA_FIXUP_VERBS,
8782 .v.verbs = (const struct hda_verb[]) {
8783 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8784 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8785 { }
8786 },
8787 .chained = true,
8788 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8789 },
8790 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8791 .type = HDA_FIXUP_PINS,
8792 .v.pins = (const struct hda_pintbl[]) {
8793 /* Change the mic location from front to right, otherwise there are
8794 two front mics with the same name, pulseaudio can't handle them.
8795 This is just a temporary workaround, after applying this fixup,
8796 there will be one "Front Mic" and one "Mic" in this machine.
8797 */
8798 { 0x1a, 0x04a19040 },
8799 { }
8800 },
8801 },
8802 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8803 .type = HDA_FIXUP_PINS,
8804 .v.pins = (const struct hda_pintbl[]) {
8805 { 0x16, 0x0101102f }, /* Rear Headset HP */
8806 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8807 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8808 { 0x1b, 0x02011020 },
8809 { }
8810 },
8811 .chained = true,
8812 .chain_id = ALC225_FIXUP_S3_POP_NOISE
8813 },
8814 [ALC225_FIXUP_S3_POP_NOISE] = {
8815 .type = HDA_FIXUP_FUNC,
8816 .v.func = alc225_fixup_s3_pop_noise,
8817 .chained = true,
8818 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8819 },
8820 [ALC700_FIXUP_INTEL_REFERENCE] = {
8821 .type = HDA_FIXUP_VERBS,
8822 .v.verbs = (const struct hda_verb[]) {
8823 /* Enables internal speaker */
8824 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8825 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8826 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8827 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8828 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8829 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8830 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8831 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8832 {}
8833 }
8834 },
8835 [ALC274_FIXUP_DELL_BIND_DACS] = {
8836 .type = HDA_FIXUP_FUNC,
8837 .v.func = alc274_fixup_bind_dacs,
8838 .chained = true,
8839 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8840 },
8841 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8842 .type = HDA_FIXUP_PINS,
8843 .v.pins = (const struct hda_pintbl[]) {
8844 { 0x1b, 0x0401102f },
8845 { }
8846 },
8847 .chained = true,
8848 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
8849 },
8850 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
8851 .type = HDA_FIXUP_FUNC,
8852 .v.func = alc_fixup_tpt470_dock,
8853 .chained = true,
8854 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8855 },
8856 [ALC298_FIXUP_TPT470_DOCK] = {
8857 .type = HDA_FIXUP_FUNC,
8858 .v.func = alc_fixup_tpt470_dacs,
8859 .chained = true,
8860 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8861 },
8862 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8863 .type = HDA_FIXUP_PINS,
8864 .v.pins = (const struct hda_pintbl[]) {
8865 { 0x14, 0x0201101f },
8866 { }
8867 },
8868 .chained = true,
8869 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8870 },
8871 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
8872 .type = HDA_FIXUP_PINS,
8873 .v.pins = (const struct hda_pintbl[]) {
8874 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8875 { }
8876 },
8877 .chained = true,
8878 .chain_id = ALC269_FIXUP_HEADSET_MIC
8879 },
8880 [ALC295_FIXUP_HP_X360] = {
8881 .type = HDA_FIXUP_FUNC,
8882 .v.func = alc295_fixup_hp_top_speakers,
8883 .chained = true,
8884 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8885 },
8886 [ALC221_FIXUP_HP_HEADSET_MIC] = {
8887 .type = HDA_FIXUP_PINS,
8888 .v.pins = (const struct hda_pintbl[]) {
8889 { 0x19, 0x0181313f},
8890 { }
8891 },
8892 .chained = true,
8893 .chain_id = ALC269_FIXUP_HEADSET_MIC
8894 },
8895 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8896 .type = HDA_FIXUP_FUNC,
8897 .v.func = alc285_fixup_invalidate_dacs,
8898 .chained = true,
8899 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8900 },
8901 [ALC295_FIXUP_HP_AUTO_MUTE] = {
8902 .type = HDA_FIXUP_FUNC,
8903 .v.func = alc_fixup_auto_mute_via_amp,
8904 },
8905 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8906 .type = HDA_FIXUP_PINS,
8907 .v.pins = (const struct hda_pintbl[]) {
8908 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8909 { }
8910 },
8911 .chained = true,
8912 .chain_id = ALC269_FIXUP_HEADSET_MIC
8913 },
8914 [ALC294_FIXUP_ASUS_MIC] = {
8915 .type = HDA_FIXUP_PINS,
8916 .v.pins = (const struct hda_pintbl[]) {
8917 { 0x13, 0x90a60160 }, /* use as internal mic */
8918 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8919 { }
8920 },
8921 .chained = true,
8922 .chain_id = ALC269_FIXUP_HEADSET_MIC
8923 },
8924 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8925 .type = HDA_FIXUP_PINS,
8926 .v.pins = (const struct hda_pintbl[]) {
8927 { 0x19, 0x01a1103c }, /* use as headset mic */
8928 { }
8929 },
8930 .chained = true,
8931 .chain_id = ALC269_FIXUP_HEADSET_MIC
8932 },
8933 [ALC294_FIXUP_ASUS_SPK] = {
8934 .type = HDA_FIXUP_VERBS,
8935 .v.verbs = (const struct hda_verb[]) {
8936 /* Set EAPD high */
8937 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8938 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8939 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8940 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8941 { }
8942 },
8943 .chained = true,
8944 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8945 },
8946 [ALC295_FIXUP_CHROME_BOOK] = {
8947 .type = HDA_FIXUP_FUNC,
8948 .v.func = alc295_fixup_chromebook,
8949 .chained = true,
8950 .chain_id = ALC225_FIXUP_HEADSET_JACK
8951 },
8952 [ALC225_FIXUP_HEADSET_JACK] = {
8953 .type = HDA_FIXUP_FUNC,
8954 .v.func = alc_fixup_headset_jack,
8955 },
8956 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8957 .type = HDA_FIXUP_PINS,
8958 .v.pins = (const struct hda_pintbl[]) {
8959 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8960 { }
8961 },
8962 .chained = true,
8963 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8964 },
8965 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8966 .type = HDA_FIXUP_VERBS,
8967 .v.verbs = (const struct hda_verb[]) {
8968 /* Disable PCBEEP-IN passthrough */
8969 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8970 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8971 { }
8972 },
8973 .chained = true,
8974 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8975 },
8976 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8977 .type = HDA_FIXUP_PINS,
8978 .v.pins = (const struct hda_pintbl[]) {
8979 { 0x19, 0x03a11130 },
8980 { 0x1a, 0x90a60140 }, /* use as internal mic */
8981 { }
8982 },
8983 .chained = true,
8984 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8985 },
8986 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8987 .type = HDA_FIXUP_PINS,
8988 .v.pins = (const struct hda_pintbl[]) {
8989 { 0x16, 0x01011020 }, /* Rear Line out */
8990 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8991 { }
8992 },
8993 .chained = true,
8994 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8995 },
8996 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8997 .type = HDA_FIXUP_FUNC,
8998 .v.func = alc_fixup_auto_mute_via_amp,
8999 .chained = true,
9000 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
9001 },
9002 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
9003 .type = HDA_FIXUP_FUNC,
9004 .v.func = alc_fixup_disable_mic_vref,
9005 .chained = true,
9006 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9007 },
9008 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
9009 .type = HDA_FIXUP_VERBS,
9010 .v.verbs = (const struct hda_verb[]) {
9011 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
9012 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
9013 { }
9014 },
9015 .chained = true,
9016 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
9017 },
9018 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
9019 .type = HDA_FIXUP_PINS,
9020 .v.pins = (const struct hda_pintbl[]) {
9021 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
9022 { }
9023 },
9024 .chained = true,
9025 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9026 },
9027 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9028 .type = HDA_FIXUP_PINS,
9029 .v.pins = (const struct hda_pintbl[]) {
9030 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
9031 { }
9032 },
9033 .chained = true,
9034 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9035 },
9036 [ALC255_FIXUP_PREDATOR_SUBWOOFER] = {
9037 .type = HDA_FIXUP_PINS,
9038 .v.pins = (const struct hda_pintbl[]) {
9039 { 0x17, 0x90170151 }, /* use as internal speaker (LFE) */
9040 { 0x1b, 0x90170152 } /* use as internal speaker (back) */
9041 }
9042 },
9043 [ALC299_FIXUP_PREDATOR_SPK] = {
9044 .type = HDA_FIXUP_PINS,
9045 .v.pins = (const struct hda_pintbl[]) {
9046 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
9047 { }
9048 }
9049 },
9050 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
9051 .type = HDA_FIXUP_PINS,
9052 .v.pins = (const struct hda_pintbl[]) {
9053 { 0x19, 0x04a11040 },
9054 { 0x21, 0x04211020 },
9055 { }
9056 },
9057 .chained = true,
9058 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9059 },
9060 [ALC289_FIXUP_DELL_SPK1] = {
9061 .type = HDA_FIXUP_PINS,
9062 .v.pins = (const struct hda_pintbl[]) {
9063 { 0x14, 0x90170140 },
9064 { }
9065 },
9066 .chained = true,
9067 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9068 },
9069 [ALC289_FIXUP_DELL_SPK2] = {
9070 .type = HDA_FIXUP_PINS,
9071 .v.pins = (const struct hda_pintbl[]) {
9072 { 0x17, 0x90170130 }, /* bass spk */
9073 { }
9074 },
9075 .chained = true,
9076 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
9077 },
9078 [ALC289_FIXUP_DUAL_SPK] = {
9079 .type = HDA_FIXUP_FUNC,
9080 .v.func = alc285_fixup_speaker2_to_dac1,
9081 .chained = true,
9082 .chain_id = ALC289_FIXUP_DELL_SPK2
9083 },
9084 [ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
9085 .type = HDA_FIXUP_FUNC,
9086 .v.func = alc285_fixup_speaker2_to_dac1,
9087 .chained = true,
9088 .chain_id = ALC289_FIXUP_DELL_SPK1
9089 },
9090 [ALC294_FIXUP_SPK2_TO_DAC1] = {
9091 .type = HDA_FIXUP_FUNC,
9092 .v.func = alc285_fixup_speaker2_to_dac1,
9093 .chained = true,
9094 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9095 },
9096 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
9097 .type = HDA_FIXUP_FUNC,
9098 /* The GPIO must be pulled to initialize the AMP */
9099 .v.func = alc_fixup_gpio4,
9100 .chained = true,
9101 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
9102 },
9103 [ALC294_FIXUP_ASUS_ALLY] = {
9104 .type = HDA_FIXUP_FUNC,
9105 .v.func = cs35l41_fixup_i2c_two,
9106 .chained = true,
9107 .chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
9108 },
9109 [ALC294_FIXUP_ASUS_ALLY_X] = {
9110 .type = HDA_FIXUP_FUNC,
9111 .v.func = tas2781_fixup_i2c,
9112 .chained = true,
9113 .chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
9114 },
9115 [ALC294_FIXUP_ASUS_ALLY_PINS] = {
9116 .type = HDA_FIXUP_PINS,
9117 .v.pins = (const struct hda_pintbl[]) {
9118 { 0x19, 0x03a11050 },
9119 { 0x1a, 0x03a11c30 },
9120 { 0x21, 0x03211420 },
9121 { }
9122 },
9123 .chained = true,
9124 .chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
9125 },
9126 [ALC294_FIXUP_ASUS_ALLY_VERBS] = {
9127 .type = HDA_FIXUP_VERBS,
9128 .v.verbs = (const struct hda_verb[]) {
9129 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9130 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9131 { 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
9132 { 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
9133 { 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
9134 { 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
9135 { 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9136 { 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
9137 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9138 { 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
9139 { 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9140 { 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
9141 { }
9142 },
9143 .chained = true,
9144 .chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
9145 },
9146 [ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
9147 .type = HDA_FIXUP_FUNC,
9148 .v.func = alc285_fixup_speaker2_to_dac1,
9149 },
9150 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
9151 .type = HDA_FIXUP_FUNC,
9152 .v.func = alc285_fixup_thinkpad_x1_gen7,
9153 .chained = true,
9154 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
9155 },
9156 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
9157 .type = HDA_FIXUP_FUNC,
9158 .v.func = alc_fixup_headset_jack,
9159 .chained = true,
9160 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
9161 },
9162 [ALC294_FIXUP_ASUS_HPE] = {
9163 .type = HDA_FIXUP_VERBS,
9164 .v.verbs = (const struct hda_verb[]) {
9165 /* Set EAPD high */
9166 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9167 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
9168 { }
9169 },
9170 .chained = true,
9171 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9172 },
9173 [ALC294_FIXUP_ASUS_GX502_PINS] = {
9174 .type = HDA_FIXUP_PINS,
9175 .v.pins = (const struct hda_pintbl[]) {
9176 { 0x19, 0x03a11050 }, /* front HP mic */
9177 { 0x1a, 0x01a11830 }, /* rear external mic */
9178 { 0x21, 0x03211020 }, /* front HP out */
9179 { }
9180 },
9181 .chained = true,
9182 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
9183 },
9184 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
9185 .type = HDA_FIXUP_VERBS,
9186 .v.verbs = (const struct hda_verb[]) {
9187 /* set 0x15 to HP-OUT ctrl */
9188 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9189 /* unmute the 0x15 amp */
9190 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9191 { }
9192 },
9193 .chained = true,
9194 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
9195 },
9196 [ALC294_FIXUP_ASUS_GX502_HP] = {
9197 .type = HDA_FIXUP_FUNC,
9198 .v.func = alc294_fixup_gx502_hp,
9199 },
9200 [ALC294_FIXUP_ASUS_GU502_PINS] = {
9201 .type = HDA_FIXUP_PINS,
9202 .v.pins = (const struct hda_pintbl[]) {
9203 { 0x19, 0x01a11050 }, /* rear HP mic */
9204 { 0x1a, 0x01a11830 }, /* rear external mic */
9205 { 0x21, 0x012110f0 }, /* rear HP out */
9206 { }
9207 },
9208 .chained = true,
9209 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
9210 },
9211 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
9212 .type = HDA_FIXUP_VERBS,
9213 .v.verbs = (const struct hda_verb[]) {
9214 /* set 0x15 to HP-OUT ctrl */
9215 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
9216 /* unmute the 0x15 amp */
9217 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
9218 /* set 0x1b to HP-OUT */
9219 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
9220 { }
9221 },
9222 .chained = true,
9223 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
9224 },
9225 [ALC294_FIXUP_ASUS_GU502_HP] = {
9226 .type = HDA_FIXUP_FUNC,
9227 .v.func = alc294_fixup_gu502_hp,
9228 },
9229 [ALC294_FIXUP_ASUS_G513_PINS] = {
9230 .type = HDA_FIXUP_PINS,
9231 .v.pins = (const struct hda_pintbl[]) {
9232 { 0x19, 0x03a11050 }, /* front HP mic */
9233 { 0x1a, 0x03a11c30 }, /* rear external mic */
9234 { 0x21, 0x03211420 }, /* front HP out */
9235 { }
9236 },
9237 },
9238 [ALC285_FIXUP_ASUS_G533Z_PINS] = {
9239 .type = HDA_FIXUP_PINS,
9240 .v.pins = (const struct hda_pintbl[]) {
9241 { 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
9242 { 0x19, 0x03a19020 }, /* Mic Boost Volume */
9243 { 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
9244 { 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
9245 { 0x21, 0x03211420 },
9246 { }
9247 },
9248 },
9249 [ALC294_FIXUP_ASUS_COEF_1B] = {
9250 .type = HDA_FIXUP_VERBS,
9251 .v.verbs = (const struct hda_verb[]) {
9252 /* Set bit 10 to correct noisy output after reboot from
9253 * Windows 10 (due to pop noise reduction?)
9254 */
9255 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
9256 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
9257 { }
9258 },
9259 .chained = true,
9260 .chain_id = ALC289_FIXUP_ASUS_GA401,
9261 },
9262 [ALC285_FIXUP_HP_GPIO_LED] = {
9263 .type = HDA_FIXUP_FUNC,
9264 .v.func = alc285_fixup_hp_gpio_led,
9265 },
9266 [ALC285_FIXUP_HP_MUTE_LED] = {
9267 .type = HDA_FIXUP_FUNC,
9268 .v.func = alc285_fixup_hp_mute_led,
9269 },
9270 [ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
9271 .type = HDA_FIXUP_FUNC,
9272 .v.func = alc285_fixup_hp_spectre_x360_mute_led,
9273 },
9274 [ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
9275 .type = HDA_FIXUP_FUNC,
9276 .v.func = alc236_fixup_hp_mute_led_coefbit2,
9277 },
9278 [ALC236_FIXUP_HP_GPIO_LED] = {
9279 .type = HDA_FIXUP_FUNC,
9280 .v.func = alc236_fixup_hp_gpio_led,
9281 },
9282 [ALC236_FIXUP_HP_MUTE_LED] = {
9283 .type = HDA_FIXUP_FUNC,
9284 .v.func = alc236_fixup_hp_mute_led,
9285 },
9286 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
9287 .type = HDA_FIXUP_FUNC,
9288 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
9289 },
9290 [ALC236_FIXUP_LENOVO_INV_DMIC] = {
9291 .type = HDA_FIXUP_FUNC,
9292 .v.func = alc_fixup_inv_dmic,
9293 .chained = true,
9294 .chain_id = ALC283_FIXUP_INT_MIC,
9295 },
9296 [ALC298_FIXUP_SAMSUNG_AMP] = {
9297 .type = HDA_FIXUP_FUNC,
9298 .v.func = alc298_fixup_samsung_amp,
9299 .chained = true,
9300 .chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
9301 },
9302 [ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS] = {
9303 .type = HDA_FIXUP_FUNC,
9304 .v.func = alc298_fixup_samsung_amp_v2_2_amps
9305 },
9306 [ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS] = {
9307 .type = HDA_FIXUP_FUNC,
9308 .v.func = alc298_fixup_samsung_amp_v2_4_amps
9309 },
9310 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9311 .type = HDA_FIXUP_VERBS,
9312 .v.verbs = (const struct hda_verb[]) {
9313 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
9314 { }
9315 },
9316 },
9317 [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
9318 .type = HDA_FIXUP_VERBS,
9319 .v.verbs = (const struct hda_verb[]) {
9320 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
9321 { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
9322 { }
9323 },
9324 },
9325 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
9326 .type = HDA_FIXUP_PINS,
9327 .v.pins = (const struct hda_pintbl[]) {
9328 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9329 { }
9330 },
9331 .chained = true,
9332 .chain_id = ALC269_FIXUP_HEADSET_MODE
9333 },
9334 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
9335 .type = HDA_FIXUP_PINS,
9336 .v.pins = (const struct hda_pintbl[]) {
9337 { 0x14, 0x90100120 }, /* use as internal speaker */
9338 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
9339 { 0x1a, 0x01011020 }, /* use as line out */
9340 { },
9341 },
9342 .chained = true,
9343 .chain_id = ALC269_FIXUP_HEADSET_MIC
9344 },
9345 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
9346 .type = HDA_FIXUP_PINS,
9347 .v.pins = (const struct hda_pintbl[]) {
9348 { 0x18, 0x02a11030 }, /* use as headset mic */
9349 { }
9350 },
9351 .chained = true,
9352 .chain_id = ALC269_FIXUP_HEADSET_MIC
9353 },
9354 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
9355 .type = HDA_FIXUP_PINS,
9356 .v.pins = (const struct hda_pintbl[]) {
9357 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
9358 { }
9359 },
9360 .chained = true,
9361 .chain_id = ALC269_FIXUP_HEADSET_MIC
9362 },
9363 [ALC289_FIXUP_ASUS_GA401] = {
9364 .type = HDA_FIXUP_FUNC,
9365 .v.func = alc289_fixup_asus_ga401,
9366 .chained = true,
9367 .chain_id = ALC289_FIXUP_ASUS_GA502,
9368 },
9369 [ALC289_FIXUP_ASUS_GA502] = {
9370 .type = HDA_FIXUP_PINS,
9371 .v.pins = (const struct hda_pintbl[]) {
9372 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
9373 { }
9374 },
9375 },
9376 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
9377 .type = HDA_FIXUP_PINS,
9378 .v.pins = (const struct hda_pintbl[]) {
9379 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
9380 { }
9381 },
9382 .chained = true,
9383 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
9384 },
9385 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
9386 .type = HDA_FIXUP_FUNC,
9387 .v.func = alc285_fixup_hp_gpio_amp_init,
9388 .chained = true,
9389 .chain_id = ALC285_FIXUP_HP_GPIO_LED
9390 },
9391 [ALC269_FIXUP_CZC_B20] = {
9392 .type = HDA_FIXUP_PINS,
9393 .v.pins = (const struct hda_pintbl[]) {
9394 { 0x12, 0x411111f0 },
9395 { 0x14, 0x90170110 }, /* speaker */
9396 { 0x15, 0x032f1020 }, /* HP out */
9397 { 0x17, 0x411111f0 },
9398 { 0x18, 0x03ab1040 }, /* mic */
9399 { 0x19, 0xb7a7013f },
9400 { 0x1a, 0x0181305f },
9401 { 0x1b, 0x411111f0 },
9402 { 0x1d, 0x411111f0 },
9403 { 0x1e, 0x411111f0 },
9404 { }
9405 },
9406 .chain_id = ALC269_FIXUP_DMIC,
9407 },
9408 [ALC269_FIXUP_CZC_TMI] = {
9409 .type = HDA_FIXUP_PINS,
9410 .v.pins = (const struct hda_pintbl[]) {
9411 { 0x12, 0x4000c000 },
9412 { 0x14, 0x90170110 }, /* speaker */
9413 { 0x15, 0x0421401f }, /* HP out */
9414 { 0x17, 0x411111f0 },
9415 { 0x18, 0x04a19020 }, /* mic */
9416 { 0x19, 0x411111f0 },
9417 { 0x1a, 0x411111f0 },
9418 { 0x1b, 0x411111f0 },
9419 { 0x1d, 0x40448505 },
9420 { 0x1e, 0x411111f0 },
9421 { 0x20, 0x8000ffff },
9422 { }
9423 },
9424 .chain_id = ALC269_FIXUP_DMIC,
9425 },
9426 [ALC269_FIXUP_CZC_L101] = {
9427 .type = HDA_FIXUP_PINS,
9428 .v.pins = (const struct hda_pintbl[]) {
9429 { 0x12, 0x40000000 },
9430 { 0x14, 0x01014010 }, /* speaker */
9431 { 0x15, 0x411111f0 }, /* HP out */
9432 { 0x16, 0x411111f0 },
9433 { 0x18, 0x01a19020 }, /* mic */
9434 { 0x19, 0x02a19021 },
9435 { 0x1a, 0x0181302f },
9436 { 0x1b, 0x0221401f },
9437 { 0x1c, 0x411111f0 },
9438 { 0x1d, 0x4044c601 },
9439 { 0x1e, 0x411111f0 },
9440 { }
9441 },
9442 .chain_id = ALC269_FIXUP_DMIC,
9443 },
9444 [ALC269_FIXUP_LEMOTE_A1802] = {
9445 .type = HDA_FIXUP_PINS,
9446 .v.pins = (const struct hda_pintbl[]) {
9447 { 0x12, 0x40000000 },
9448 { 0x14, 0x90170110 }, /* speaker */
9449 { 0x17, 0x411111f0 },
9450 { 0x18, 0x03a19040 }, /* mic1 */
9451 { 0x19, 0x90a70130 }, /* mic2 */
9452 { 0x1a, 0x411111f0 },
9453 { 0x1b, 0x411111f0 },
9454 { 0x1d, 0x40489d2d },
9455 { 0x1e, 0x411111f0 },
9456 { 0x20, 0x0003ffff },
9457 { 0x21, 0x03214020 },
9458 { }
9459 },
9460 .chain_id = ALC269_FIXUP_DMIC,
9461 },
9462 [ALC269_FIXUP_LEMOTE_A190X] = {
9463 .type = HDA_FIXUP_PINS,
9464 .v.pins = (const struct hda_pintbl[]) {
9465 { 0x14, 0x99130110 }, /* speaker */
9466 { 0x15, 0x0121401f }, /* HP out */
9467 { 0x18, 0x01a19c20 }, /* rear mic */
9468 { 0x19, 0x99a3092f }, /* front mic */
9469 { 0x1b, 0x0201401f }, /* front lineout */
9470 { }
9471 },
9472 .chain_id = ALC269_FIXUP_DMIC,
9473 },
9474 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9475 .type = HDA_FIXUP_PINS,
9476 .v.pins = (const struct hda_pintbl[]) {
9477 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9478 { }
9479 },
9480 .chained = true,
9481 .chain_id = ALC269_FIXUP_HEADSET_MODE
9482 },
9483 [ALC256_FIXUP_INTEL_NUC10] = {
9484 .type = HDA_FIXUP_PINS,
9485 .v.pins = (const struct hda_pintbl[]) {
9486 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9487 { }
9488 },
9489 .chained = true,
9490 .chain_id = ALC269_FIXUP_HEADSET_MODE
9491 },
9492 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9493 .type = HDA_FIXUP_VERBS,
9494 .v.verbs = (const struct hda_verb[]) {
9495 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9496 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9497 { }
9498 },
9499 .chained = true,
9500 .chain_id = ALC289_FIXUP_ASUS_GA502
9501 },
9502 [ALC274_FIXUP_HP_MIC] = {
9503 .type = HDA_FIXUP_VERBS,
9504 .v.verbs = (const struct hda_verb[]) {
9505 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9506 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9507 { }
9508 },
9509 },
9510 [ALC274_FIXUP_HP_HEADSET_MIC] = {
9511 .type = HDA_FIXUP_FUNC,
9512 .v.func = alc274_fixup_hp_headset_mic,
9513 .chained = true,
9514 .chain_id = ALC274_FIXUP_HP_MIC
9515 },
9516 [ALC274_FIXUP_HP_ENVY_GPIO] = {
9517 .type = HDA_FIXUP_FUNC,
9518 .v.func = alc274_fixup_hp_envy_gpio,
9519 },
9520 [ALC274_FIXUP_ASUS_ZEN_AIO_27] = {
9521 .type = HDA_FIXUP_VERBS,
9522 .v.verbs = (const struct hda_verb[]) {
9523 { 0x20, AC_VERB_SET_COEF_INDEX, 0x10 },
9524 { 0x20, AC_VERB_SET_PROC_COEF, 0xc420 },
9525 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
9526 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
9527 { 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
9528 { 0x20, AC_VERB_SET_PROC_COEF, 0x0249 },
9529 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
9530 { 0x20, AC_VERB_SET_PROC_COEF, 0x202b },
9531 { 0x20, AC_VERB_SET_COEF_INDEX, 0x62 },
9532 { 0x20, AC_VERB_SET_PROC_COEF, 0xa007 },
9533 { 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
9534 { 0x20, AC_VERB_SET_PROC_COEF, 0x5060 },
9535 {}
9536 },
9537 .chained = true,
9538 .chain_id = ALC2XX_FIXUP_HEADSET_MIC,
9539 },
9540 [ALC256_FIXUP_ASUS_HPE] = {
9541 .type = HDA_FIXUP_VERBS,
9542 .v.verbs = (const struct hda_verb[]) {
9543 /* Set EAPD high */
9544 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9545 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9546 { }
9547 },
9548 .chained = true,
9549 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9550 },
9551 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9552 .type = HDA_FIXUP_FUNC,
9553 .v.func = alc_fixup_headset_jack,
9554 .chained = true,
9555 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
9556 },
9557 [ALC287_FIXUP_HP_GPIO_LED] = {
9558 .type = HDA_FIXUP_FUNC,
9559 .v.func = alc287_fixup_hp_gpio_led,
9560 },
9561 [ALC256_FIXUP_HP_HEADSET_MIC] = {
9562 .type = HDA_FIXUP_FUNC,
9563 .v.func = alc274_fixup_hp_headset_mic,
9564 },
9565 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9566 .type = HDA_FIXUP_FUNC,
9567 .v.func = alc_fixup_no_int_mic,
9568 .chained = true,
9569 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9570 },
9571 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9572 .type = HDA_FIXUP_PINS,
9573 .v.pins = (const struct hda_pintbl[]) {
9574 { 0x1b, 0x411111f0 },
9575 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9576 { },
9577 },
9578 .chained = true,
9579 .chain_id = ALC269_FIXUP_HEADSET_MODE
9580 },
9581 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9582 .type = HDA_FIXUP_FUNC,
9583 .v.func = alc269_fixup_limit_int_mic_boost,
9584 .chained = true,
9585 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9586 },
9587 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
9588 .type = HDA_FIXUP_PINS,
9589 .v.pins = (const struct hda_pintbl[]) {
9590 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9591 { 0x1a, 0x90a1092f }, /* use as internal mic */
9592 { }
9593 },
9594 .chained = true,
9595 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9596 },
9597 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9598 .type = HDA_FIXUP_FUNC,
9599 .v.func = alc285_fixup_ideapad_s740_coef,
9600 .chained = true,
9601 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9602 },
9603 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9604 .type = HDA_FIXUP_FUNC,
9605 .v.func = alc269_fixup_limit_int_mic_boost,
9606 .chained = true,
9607 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9608 },
9609 [ALC295_FIXUP_ASUS_DACS] = {
9610 .type = HDA_FIXUP_FUNC,
9611 .v.func = alc295_fixup_asus_dacs,
9612 },
9613 [ALC295_FIXUP_HP_OMEN] = {
9614 .type = HDA_FIXUP_PINS,
9615 .v.pins = (const struct hda_pintbl[]) {
9616 { 0x12, 0xb7a60130 },
9617 { 0x13, 0x40000000 },
9618 { 0x14, 0x411111f0 },
9619 { 0x16, 0x411111f0 },
9620 { 0x17, 0x90170110 },
9621 { 0x18, 0x411111f0 },
9622 { 0x19, 0x02a11030 },
9623 { 0x1a, 0x411111f0 },
9624 { 0x1b, 0x04a19030 },
9625 { 0x1d, 0x40600001 },
9626 { 0x1e, 0x411111f0 },
9627 { 0x21, 0x03211020 },
9628 {}
9629 },
9630 .chained = true,
9631 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9632 },
9633 [ALC285_FIXUP_HP_SPECTRE_X360] = {
9634 .type = HDA_FIXUP_FUNC,
9635 .v.func = alc285_fixup_hp_spectre_x360,
9636 },
9637 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9638 .type = HDA_FIXUP_FUNC,
9639 .v.func = alc285_fixup_hp_spectre_x360_eb1
9640 },
9641 [ALC285_FIXUP_HP_ENVY_X360] = {
9642 .type = HDA_FIXUP_FUNC,
9643 .v.func = alc285_fixup_hp_envy_x360,
9644 .chained = true,
9645 .chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT,
9646 },
9647 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9648 .type = HDA_FIXUP_FUNC,
9649 .v.func = alc285_fixup_ideapad_s740_coef,
9650 .chained = true,
9651 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9652 },
9653 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9654 .type = HDA_FIXUP_FUNC,
9655 .v.func = alc_fixup_no_shutup,
9656 .chained = true,
9657 .chain_id = ALC283_FIXUP_HEADSET_MIC,
9658 },
9659 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9660 .type = HDA_FIXUP_PINS,
9661 .v.pins = (const struct hda_pintbl[]) {
9662 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9663 { }
9664 },
9665 .chained = true,
9666 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9667 },
9668 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9669 .type = HDA_FIXUP_FUNC,
9670 .v.func = alc269_fixup_limit_int_mic_boost,
9671 .chained = true,
9672 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9673 },
9674 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9675 .type = HDA_FIXUP_FUNC,
9676 .v.func = alc285_fixup_ideapad_s740_coef,
9677 .chained = true,
9678 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9679 },
9680 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9681 .type = HDA_FIXUP_FUNC,
9682 .v.func = alc287_fixup_legion_15imhg05_speakers,
9683 .chained = true,
9684 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9685 },
9686 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9687 .type = HDA_FIXUP_VERBS,
9688 //.v.verbs = legion_15imhg05_coefs,
9689 .v.verbs = (const struct hda_verb[]) {
9690 // set left speaker Legion 7i.
9691 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9692 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9693
9694 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9695 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9696 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9697 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9698 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9699
9700 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9701 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9702 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9703 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9704 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9705
9706 // set right speaker Legion 7i.
9707 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9708 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9709
9710 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9711 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9712 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9713 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9714 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9715
9716 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9717 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9718 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9719 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9720 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9721 {}
9722 },
9723 .chained = true,
9724 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9725 },
9726 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9727 .type = HDA_FIXUP_FUNC,
9728 .v.func = alc287_fixup_legion_15imhg05_speakers,
9729 .chained = true,
9730 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9731 },
9732 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9733 .type = HDA_FIXUP_VERBS,
9734 .v.verbs = (const struct hda_verb[]) {
9735 // set left speaker Yoga 7i.
9736 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9737 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9738
9739 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9740 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9741 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9742 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9743 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9744
9745 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9746 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9747 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9748 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9749 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9750
9751 // set right speaker Yoga 7i.
9752 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9753 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9754
9755 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9756 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9757 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9758 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9759 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9760
9761 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9762 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9763 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9764 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9765 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9766 {}
9767 },
9768 .chained = true,
9769 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9770 },
9771 [ALC298_FIXUP_LENOVO_C940_DUET7] = {
9772 .type = HDA_FIXUP_FUNC,
9773 .v.func = alc298_fixup_lenovo_c940_duet7,
9774 },
9775 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9776 .type = HDA_FIXUP_VERBS,
9777 .v.verbs = (const struct hda_verb[]) {
9778 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9779 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9780 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9781 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9782 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9783 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9784 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9785 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9786 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9787 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9788 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9789 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9790 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9791 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9792 {}
9793 },
9794 .chained = true,
9795 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9796 },
9797 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9798 .type = HDA_FIXUP_FUNC,
9799 .v.func = alc256_fixup_set_coef_defaults,
9800 },
9801 [ALC245_FIXUP_HP_GPIO_LED] = {
9802 .type = HDA_FIXUP_FUNC,
9803 .v.func = alc245_fixup_hp_gpio_led,
9804 },
9805 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9806 .type = HDA_FIXUP_PINS,
9807 .v.pins = (const struct hda_pintbl[]) {
9808 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9809 { }
9810 },
9811 .chained = true,
9812 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9813 },
9814 [ALC233_FIXUP_NO_AUDIO_JACK] = {
9815 .type = HDA_FIXUP_FUNC,
9816 .v.func = alc233_fixup_no_audio_jack,
9817 },
9818 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9819 .type = HDA_FIXUP_FUNC,
9820 .v.func = alc256_fixup_mic_no_presence_and_resume,
9821 .chained = true,
9822 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9823 },
9824 [ALC287_FIXUP_LEGION_16ACHG6] = {
9825 .type = HDA_FIXUP_FUNC,
9826 .v.func = alc287_fixup_legion_16achg6_speakers,
9827 },
9828 [ALC287_FIXUP_CS35L41_I2C_2] = {
9829 .type = HDA_FIXUP_FUNC,
9830 .v.func = cs35l41_fixup_i2c_two,
9831 },
9832 [ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9833 .type = HDA_FIXUP_FUNC,
9834 .v.func = cs35l41_fixup_i2c_two,
9835 .chained = true,
9836 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9837 },
9838 [ALC287_FIXUP_CS35L41_I2C_4] = {
9839 .type = HDA_FIXUP_FUNC,
9840 .v.func = cs35l41_fixup_i2c_four,
9841 },
9842 [ALC245_FIXUP_CS35L41_SPI_2] = {
9843 .type = HDA_FIXUP_FUNC,
9844 .v.func = cs35l41_fixup_spi_two,
9845 },
9846 [ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9847 .type = HDA_FIXUP_FUNC,
9848 .v.func = cs35l41_fixup_spi_two,
9849 .chained = true,
9850 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9851 },
9852 [ALC245_FIXUP_CS35L41_SPI_4] = {
9853 .type = HDA_FIXUP_FUNC,
9854 .v.func = cs35l41_fixup_spi_four,
9855 },
9856 [ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9857 .type = HDA_FIXUP_FUNC,
9858 .v.func = cs35l41_fixup_spi_four,
9859 .chained = true,
9860 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9861 },
9862 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9863 .type = HDA_FIXUP_VERBS,
9864 .v.verbs = (const struct hda_verb[]) {
9865 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9866 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9867 { }
9868 },
9869 .chained = true,
9870 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9871 },
9872 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9873 .type = HDA_FIXUP_FUNC,
9874 .v.func = alc_fixup_dell4_mic_no_presence_quiet,
9875 .chained = true,
9876 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9877 },
9878 [ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9879 .type = HDA_FIXUP_PINS,
9880 .v.pins = (const struct hda_pintbl[]) {
9881 { 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9882 { }
9883 },
9884 .chained = true,
9885 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9886 },
9887 [ALC287_FIXUP_LEGION_16ITHG6] = {
9888 .type = HDA_FIXUP_FUNC,
9889 .v.func = alc287_fixup_legion_16ithg6_speakers,
9890 },
9891 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9892 .type = HDA_FIXUP_VERBS,
9893 .v.verbs = (const struct hda_verb[]) {
9894 // enable left speaker
9895 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9896 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9897
9898 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9899 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9900 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9901 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9902 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9903
9904 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9905 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9906 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9907 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9908 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9909
9910 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9911 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9912 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9913 { 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9914 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9915
9916 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9917 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9918 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9919 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9920 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9921
9922 // enable right speaker
9923 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9924 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9925
9926 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9927 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9928 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9929 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9930 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9931
9932 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9933 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9934 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9935 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9936 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9937
9938 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9939 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9940 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9941 { 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9942 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9943
9944 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9945 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9946 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9947 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9948 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9949
9950 { },
9951 },
9952 },
9953 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9954 .type = HDA_FIXUP_FUNC,
9955 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9956 .chained = true,
9957 .chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9958 },
9959 [ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN] = {
9960 .type = HDA_FIXUP_FUNC,
9961 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9962 .chained = true,
9963 .chain_id = ALC287_FIXUP_CS35L41_I2C_2,
9964 },
9965 [ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9966 .type = HDA_FIXUP_FUNC,
9967 .v.func = alc295_fixup_dell_inspiron_top_speakers,
9968 .chained = true,
9969 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9970 },
9971 [ALC236_FIXUP_DELL_DUAL_CODECS] = {
9972 .type = HDA_FIXUP_PINS,
9973 .v.func = alc1220_fixup_gb_dual_codecs,
9974 .chained = true,
9975 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9976 },
9977 [ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9978 .type = HDA_FIXUP_FUNC,
9979 .v.func = cs35l41_fixup_i2c_two,
9980 .chained = true,
9981 .chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9982 },
9983 [ALC287_FIXUP_TAS2781_I2C] = {
9984 .type = HDA_FIXUP_FUNC,
9985 .v.func = tas2781_fixup_i2c,
9986 .chained = true,
9987 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9988 },
9989 [ALC287_FIXUP_YOGA7_14ARB7_I2C] = {
9990 .type = HDA_FIXUP_FUNC,
9991 .v.func = yoga7_14arb7_fixup_i2c,
9992 .chained = true,
9993 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9994 },
9995 [ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9996 .type = HDA_FIXUP_FUNC,
9997 .v.func = alc245_fixup_hp_mute_led_coefbit,
9998 },
9999 [ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
10000 .type = HDA_FIXUP_FUNC,
10001 .v.func = alc245_fixup_hp_mute_led_coefbit,
10002 .chained = true,
10003 .chain_id = ALC245_FIXUP_HP_GPIO_LED
10004 },
10005 [ALC287_FIXUP_THINKPAD_I2S_SPK] = {
10006 .type = HDA_FIXUP_FUNC,
10007 .v.func = alc287_fixup_bind_dacs,
10008 .chained = true,
10009 .chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10010 },
10011 [ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
10012 .type = HDA_FIXUP_FUNC,
10013 .v.func = alc287_fixup_bind_dacs,
10014 .chained = true,
10015 .chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
10016 },
10017 [ALC2XX_FIXUP_HEADSET_MIC] = {
10018 .type = HDA_FIXUP_FUNC,
10019 .v.func = alc_fixup_headset_mic,
10020 },
10021 [ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
10022 .type = HDA_FIXUP_FUNC,
10023 .v.func = cs35l41_fixup_spi_two,
10024 .chained = true,
10025 .chain_id = ALC289_FIXUP_DUAL_SPK
10026 },
10027 [ALC294_FIXUP_CS35L41_I2C_2] = {
10028 .type = HDA_FIXUP_FUNC,
10029 .v.func = cs35l41_fixup_i2c_two,
10030 },
10031 [ALC256_FIXUP_ACER_SFG16_MICMUTE_LED] = {
10032 .type = HDA_FIXUP_FUNC,
10033 .v.func = alc256_fixup_acer_sfg16_micmute_led,
10034 },
10035 [ALC256_FIXUP_HEADPHONE_AMP_VOL] = {
10036 .type = HDA_FIXUP_FUNC,
10037 .v.func = alc256_decrease_headphone_amp_val,
10038 },
10039 [ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX] = {
10040 .type = HDA_FIXUP_FUNC,
10041 .v.func = alc245_fixup_hp_spectre_x360_eu0xxx,
10042 },
10043 [ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX] = {
10044 .type = HDA_FIXUP_FUNC,
10045 .v.func = alc245_fixup_hp_spectre_x360_16_aa0xxx,
10046 },
10047 [ALC285_FIXUP_ASUS_GA403U] = {
10048 .type = HDA_FIXUP_FUNC,
10049 .v.func = alc285_fixup_asus_ga403u,
10050 },
10051 [ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC] = {
10052 .type = HDA_FIXUP_PINS,
10053 .v.pins = (const struct hda_pintbl[]) {
10054 { 0x19, 0x03a11050 },
10055 { 0x1b, 0x03a11c30 },
10056 { }
10057 },
10058 .chained = true,
10059 .chain_id = ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1
10060 },
10061 [ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1] = {
10062 .type = HDA_FIXUP_FUNC,
10063 .v.func = alc285_fixup_speaker2_to_dac1,
10064 .chained = true,
10065 .chain_id = ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC,
10066 },
10067 [ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC] = {
10068 .type = HDA_FIXUP_PINS,
10069 .v.pins = (const struct hda_pintbl[]) {
10070 { 0x19, 0x03a11050 },
10071 { 0x1b, 0x03a11c30 },
10072 { }
10073 },
10074 },
10075 [ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1] = {
10076 .type = HDA_FIXUP_FUNC,
10077 .v.func = alc285_fixup_speaker2_to_dac1,
10078 .chained = true,
10079 .chain_id = ALC285_FIXUP_ASUS_GA403U,
10080 },
10081 [ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318] = {
10082 .type = HDA_FIXUP_FUNC,
10083 .v.func = alc287_fixup_lenovo_thinkpad_with_alc1318,
10084 .chained = true,
10085 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
10086 },
10087 [ALC256_FIXUP_CHROME_BOOK] = {
10088 .type = HDA_FIXUP_FUNC,
10089 .v.func = alc256_fixup_chromebook,
10090 .chained = true,
10091 .chain_id = ALC225_FIXUP_HEADSET_JACK
10092 },
10093 [ALC245_FIXUP_CLEVO_NOISY_MIC] = {
10094 .type = HDA_FIXUP_FUNC,
10095 .v.func = alc269_fixup_limit_int_mic_boost,
10096 .chained = true,
10097 .chain_id = ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
10098 },
10099 [ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE] = {
10100 .type = HDA_FIXUP_PINS,
10101 .v.pins = (const struct hda_pintbl[]) {
10102 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10103 { 0x1b, 0x20a11040 }, /* dock mic */
10104 { }
10105 },
10106 .chained = true,
10107 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
10108 },
10109 [ALC233_FIXUP_MEDION_MTL_SPK] = {
10110 .type = HDA_FIXUP_PINS,
10111 .v.pins = (const struct hda_pintbl[]) {
10112 { 0x1b, 0x90170110 },
10113 { }
10114 },
10115 },
10116 [ALC294_FIXUP_BASS_SPEAKER_15] = {
10117 .type = HDA_FIXUP_FUNC,
10118 .v.func = alc294_fixup_bass_speaker_15,
10119 },
10120 };
10121
10122 static const struct hda_quirk alc269_fixup_tbl[] = {
10123 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
10124 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
10125 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
10126 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
10127 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10128 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
10129 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
10130 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10131 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10132 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
10133 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10134 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
10135 SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10136 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
10137 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
10138 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
10139 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
10140 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10141 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10142 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10143 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
10144 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
10145 SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10146 SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10147 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
10148 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10149 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
10150 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
10151 SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10152 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10153 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10154 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10155 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
10156 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10157 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10158 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10159 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
10160 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
10161 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10162 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10163 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10164 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
10165 SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10166 SND_PCI_QUIRK(0x1025, 0x159c, "Acer Nitro 5 AN515-58", ALC2XX_FIXUP_HEADSET_MIC),
10167 SND_PCI_QUIRK(0x1025, 0x169a, "Acer Swift SFG16", ALC256_FIXUP_ACER_SFG16_MICMUTE_LED),
10168 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
10169 SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
10170 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
10171 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
10172 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
10173 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
10174 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
10175 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
10176 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10177 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10178 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
10179 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10180 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
10181 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
10182 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
10183 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
10184 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10185 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10186 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
10187 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10188 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
10189 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
10190 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10191 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10192 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10193 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10194 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10195 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10196 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
10197 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10198 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
10199 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
10200 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
10201 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
10202 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
10203 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
10204 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
10205 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10206 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10207 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10208 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
10209 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
10210 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
10211 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
10212 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
10213 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10214 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
10215 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10216 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
10217 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10218 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
10219 SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
10220 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
10221 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
10222 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
10223 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10224 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10225 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
10226 SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
10227 SND_PCI_QUIRK(0x1028, 0x0b27, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10228 SND_PCI_QUIRK(0x1028, 0x0b28, "Dell", ALC245_FIXUP_CS35L41_SPI_2),
10229 SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10230 SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10231 SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10232 SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
10233 SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10234 SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10235 SND_PCI_QUIRK(0x1028, 0x0c0e, "Dell Oasis 16", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10236 SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10237 SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
10238 SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10239 SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10240 SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
10241 SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
10242 SND_PCI_QUIRK(0x1028, 0x0c28, "Dell Inspiron 16 Plus 7630", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
10243 SND_PCI_QUIRK(0x1028, 0x0c4d, "Dell", ALC287_FIXUP_CS35L41_I2C_4),
10244 SND_PCI_QUIRK(0x1028, 0x0c94, "Dell Polaris 3 metal", ALC287_FIXUP_TAS2781_I2C),
10245 SND_PCI_QUIRK(0x1028, 0x0c96, "Dell Polaris 2in1", ALC287_FIXUP_TAS2781_I2C),
10246 SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10247 SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10248 SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10249 SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10250 SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10251 SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10252 SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10253 SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10254 SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10255 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10256 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
10257 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
10258 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
10259 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
10260 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10261 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10262 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10263 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10264 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
10265 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10266 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10267 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10268 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10269 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10270 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10271 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10272 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10273 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10274 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10275 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10276 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10277 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10278 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
10279 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
10280 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10281 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10282 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10283 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10284 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10285 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10286 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10287 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10288 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
10289 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10290 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10291 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10292 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
10293 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10294 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10295 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10296 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10297 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10298 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10299 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10300 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10301 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10302 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10303 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10304 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10305 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10306 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10307 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
10308 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10309 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
10310 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10311 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10312 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10313 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
10314 SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
10315 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10316 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10317 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10318 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
10319 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
10320 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
10321 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
10322 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10323 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10324 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
10325 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10326 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10327 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10328 SND_PCI_QUIRK(0x103c, 0x84a6, "HP 250 G7 Notebook PC", ALC269_FIXUP_HP_LINE1_MIC1_LED),
10329 SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10330 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
10331 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10332 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
10333 SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10334 SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
10335 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10336 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10337 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10338 SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10339 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
10340 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10341 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10342 SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
10343 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10344 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10345 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
10346 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
10347 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
10348 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10349 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10350 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10351 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
10352 SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10353 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
10354 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
10355 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
10356 ALC285_FIXUP_HP_GPIO_AMP_INIT),
10357 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
10358 ALC285_FIXUP_HP_GPIO_AMP_INIT),
10359 SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10360 SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10361 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
10362 SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10363 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
10364 SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10365 SND_PCI_QUIRK(0x103c, 0x87df, "HP ProBook 430 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10366 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10367 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10368 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10369 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10370 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
10371 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
10372 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10373 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
10374 SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10375 SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10376 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10377 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10378 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10379 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10380 SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10381 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10382 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10383 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10384 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
10385 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10386 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10387 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10388 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10389 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
10390 SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10391 SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10392 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
10393 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
10394 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
10395 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10396 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10397 SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
10398 SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
10399 SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10400 SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10401 SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10402 SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10403 SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10404 SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10405 SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10406 SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10407 SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10408 SND_PCI_QUIRK(0x103c, 0x897d, "HP mt440 Mobile Thin Client U74", ALC236_FIXUP_HP_GPIO_LED),
10409 SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
10410 SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10411 SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
10412 SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10413 SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
10414 SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10415 SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
10416 SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
10417 SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
10418 SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
10419 SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
10420 SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
10421 SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10422 SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10423 SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10424 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10425 SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10426 SND_PCI_QUIRK(0x103c, 0x89e7, "HP Elite x2 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10427 SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10428 SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10429 SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10430 SND_PCI_QUIRK(0x103c, 0x8a28, "HP Envy 13", ALC287_FIXUP_CS35L41_I2C_2),
10431 SND_PCI_QUIRK(0x103c, 0x8a29, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10432 SND_PCI_QUIRK(0x103c, 0x8a2a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10433 SND_PCI_QUIRK(0x103c, 0x8a2b, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10434 SND_PCI_QUIRK(0x103c, 0x8a2c, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10435 SND_PCI_QUIRK(0x103c, 0x8a2d, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10436 SND_PCI_QUIRK(0x103c, 0x8a2e, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10437 SND_PCI_QUIRK(0x103c, 0x8a30, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10438 SND_PCI_QUIRK(0x103c, 0x8a31, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10439 SND_PCI_QUIRK(0x103c, 0x8a6e, "HP EDNA 360", ALC287_FIXUP_CS35L41_I2C_4),
10440 SND_PCI_QUIRK(0x103c, 0x8a74, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
10441 SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
10442 SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
10443 SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
10444 SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
10445 SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
10446 SND_PCI_QUIRK(0x103c, 0x8ab9, "HP EliteBook 840 G8 (MB 8AB8)", ALC285_FIXUP_HP_GPIO_LED),
10447 SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10448 SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10449 SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10450 SND_PCI_QUIRK(0x103c, 0x8ad8, "HP 800 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10451 SND_PCI_QUIRK(0x103c, 0x8b0f, "HP Elite mt645 G7 Mobile Thin Client U81", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10452 SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10453 SND_PCI_QUIRK(0x103c, 0x8b3a, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10454 SND_PCI_QUIRK(0x103c, 0x8b3f, "HP mt440 Mobile Thin Client U91", ALC236_FIXUP_HP_GPIO_LED),
10455 SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10456 SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10457 SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10458 SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10459 SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10460 SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10461 SND_PCI_QUIRK(0x103c, 0x8b59, "HP Elite mt645 G7 Mobile Thin Client U89", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10462 SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10463 SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10464 SND_PCI_QUIRK(0x103c, 0x8b5f, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10465 SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10466 SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10467 SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10468 SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10469 SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10470 SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10471 SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
10472 SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10473 SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10474 SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
10475 SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
10476 SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
10477 SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
10478 SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10479 SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10480 SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10481 SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10482 SND_PCI_QUIRK(0x103c, 0x8bb3, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10483 SND_PCI_QUIRK(0x103c, 0x8bb4, "HP Slim OMEN", ALC287_FIXUP_CS35L41_I2C_2),
10484 SND_PCI_QUIRK(0x103c, 0x8bdd, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10485 SND_PCI_QUIRK(0x103c, 0x8bde, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10486 SND_PCI_QUIRK(0x103c, 0x8bdf, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10487 SND_PCI_QUIRK(0x103c, 0x8be0, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10488 SND_PCI_QUIRK(0x103c, 0x8be1, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10489 SND_PCI_QUIRK(0x103c, 0x8be2, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10490 SND_PCI_QUIRK(0x103c, 0x8be3, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10491 SND_PCI_QUIRK(0x103c, 0x8be5, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10492 SND_PCI_QUIRK(0x103c, 0x8be6, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10493 SND_PCI_QUIRK(0x103c, 0x8be7, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10494 SND_PCI_QUIRK(0x103c, 0x8be8, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10495 SND_PCI_QUIRK(0x103c, 0x8be9, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10496 SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
10497 SND_PCI_QUIRK(0x103c, 0x8c15, "HP Spectre x360 2-in-1 Laptop 14-eu0xxx", ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX),
10498 SND_PCI_QUIRK(0x103c, 0x8c16, "HP Spectre x360 2-in-1 Laptop 16-aa0xxx", ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX),
10499 SND_PCI_QUIRK(0x103c, 0x8c17, "HP Spectre 16", ALC287_FIXUP_CS35L41_I2C_2),
10500 SND_PCI_QUIRK(0x103c, 0x8c21, "HP Pavilion Plus Laptop 14-ey0XXX", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10501 SND_PCI_QUIRK(0x103c, 0x8c30, "HP Victus 15-fb1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10502 SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10503 SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10504 SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10505 SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10506 SND_PCI_QUIRK(0x103c, 0x8c4d, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10507 SND_PCI_QUIRK(0x103c, 0x8c4e, "HP Omen", ALC287_FIXUP_CS35L41_I2C_2),
10508 SND_PCI_QUIRK(0x103c, 0x8c4f, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
10509 SND_PCI_QUIRK(0x103c, 0x8c50, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10510 SND_PCI_QUIRK(0x103c, 0x8c51, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10511 SND_PCI_QUIRK(0x103c, 0x8c52, "HP EliteBook 1040 G11", ALC285_FIXUP_HP_GPIO_LED),
10512 SND_PCI_QUIRK(0x103c, 0x8c53, "HP Elite x360 1040 2-in-1 G11", ALC285_FIXUP_HP_GPIO_LED),
10513 SND_PCI_QUIRK(0x103c, 0x8c66, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10514 SND_PCI_QUIRK(0x103c, 0x8c67, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10515 SND_PCI_QUIRK(0x103c, 0x8c68, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
10516 SND_PCI_QUIRK(0x103c, 0x8c6a, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
10517 SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10518 SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10519 SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10520 SND_PCI_QUIRK(0x103c, 0x8c7b, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10521 SND_PCI_QUIRK(0x103c, 0x8c7c, "HP ProBook 445 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10522 SND_PCI_QUIRK(0x103c, 0x8c7d, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10523 SND_PCI_QUIRK(0x103c, 0x8c7e, "HP ProBook 465 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10524 SND_PCI_QUIRK(0x103c, 0x8c7f, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10525 SND_PCI_QUIRK(0x103c, 0x8c80, "HP EliteBook 645 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10526 SND_PCI_QUIRK(0x103c, 0x8c81, "HP EliteBook 665 G11", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10527 SND_PCI_QUIRK(0x103c, 0x8c89, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10528 SND_PCI_QUIRK(0x103c, 0x8c8a, "HP EliteBook 630", ALC236_FIXUP_HP_GPIO_LED),
10529 SND_PCI_QUIRK(0x103c, 0x8c8c, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10530 SND_PCI_QUIRK(0x103c, 0x8c8d, "HP ProBook 440 G11", ALC236_FIXUP_HP_GPIO_LED),
10531 SND_PCI_QUIRK(0x103c, 0x8c8e, "HP ProBook 460 G11", ALC236_FIXUP_HP_GPIO_LED),
10532 SND_PCI_QUIRK(0x103c, 0x8c90, "HP EliteBook 640", ALC236_FIXUP_HP_GPIO_LED),
10533 SND_PCI_QUIRK(0x103c, 0x8c91, "HP EliteBook 660", ALC236_FIXUP_HP_GPIO_LED),
10534 SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10535 SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10536 SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10537 SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
10538 SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10539 SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
10540 SND_PCI_QUIRK(0x103c, 0x8caf, "HP Elite mt645 G8 Mobile Thin Client", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
10541 SND_PCI_QUIRK(0x103c, 0x8cbd, "HP Pavilion Aero Laptop 13-bg0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10542 SND_PCI_QUIRK(0x103c, 0x8cdd, "HP Spectre", ALC287_FIXUP_CS35L41_I2C_2),
10543 SND_PCI_QUIRK(0x103c, 0x8cde, "HP Spectre", ALC287_FIXUP_CS35L41_I2C_2),
10544 SND_PCI_QUIRK(0x103c, 0x8cdf, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10545 SND_PCI_QUIRK(0x103c, 0x8ce0, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
10546 SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
10547 SND_PCI_QUIRK(0x103c, 0x8d01, "HP ZBook Power 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10548 SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED),
10549 SND_PCI_QUIRK(0x103c, 0x8d91, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
10550 SND_PCI_QUIRK(0x103c, 0x8d92, "HP ZBook Firefly 16 G12", ALC285_FIXUP_HP_GPIO_LED),
10551 SND_PCI_QUIRK(0x103c, 0x8e18, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10552 SND_PCI_QUIRK(0x103c, 0x8e19, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10553 SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED),
10554 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10555 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
10556 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10557 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
10558 SND_PCI_QUIRK(0x1043, 0x10a4, "ASUS TP3407SA", ALC287_FIXUP_TAS2781_I2C),
10559 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
10560 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10561 SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
10562 SND_PCI_QUIRK(0x1043, 0x1154, "ASUS TP3607SH", ALC287_FIXUP_TAS2781_I2C),
10563 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10564 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10565 SND_PCI_QUIRK(0x1043, 0x1204, "ASUS Strix G615JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
10566 SND_PCI_QUIRK(0x1043, 0x1214, "ASUS Strix G615LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
10567 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10568 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10569 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10570 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
10571 SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
10572 SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10573 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
10574 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
10575 SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
10576 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
10577 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
10578 SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10579 SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X/GA402N", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
10580 SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZ", ALC285_FIXUP_ASUS_HEADSET_MIC),
10581 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603VQ/VU/VV/VJ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10582 SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601VV/VU/VJ/VQ/VI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10583 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G614JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10584 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS G513PI/PU/PV", ALC287_FIXUP_CS35L41_I2C_2),
10585 SND_PCI_QUIRK(0x1043, 0x1503, "ASUS G733PY/PZ/PZV/PYV", ALC287_FIXUP_CS35L41_I2C_2),
10586 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
10587 SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA/XJ/XQ/XU/XV/XI", ALC287_FIXUP_CS35L41_I2C_2),
10588 SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCC", ALC285_FIXUP_ASUS_HEADSET_MIC),
10589 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
10590 SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
10591 SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
10592 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
10593 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10594 SND_PCI_QUIRK(0x1043, 0x16d3, "ASUS UX5304VA", ALC245_FIXUP_CS35L41_SPI_2),
10595 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
10596 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS UX7602VI/BZ", ALC245_FIXUP_CS35L41_SPI_2),
10597 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
10598 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
10599 SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
10600 SND_PCI_QUIRK(0x1043, 0x1eb3, "ROG Ally X RC72LA", ALC294_FIXUP_ASUS_ALLY_X),
10601 SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VI/VV", ALC245_FIXUP_CS35L41_SPI_2),
10602 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
10603 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
10604 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
10605 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
10606 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
10607 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
10608 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
10609 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
10610 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
10611 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
10612 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
10613 SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
10614 SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
10615 SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
10616 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
10617 SND_PCI_QUIRK(0x1043, 0x1b13, "ASUS U41SV/GA403U", ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC),
10618 SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
10619 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
10620 SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
10621 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10622 SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
10623 SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
10624 SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
10625 SND_PCI_QUIRK(0x1043, 0x1c63, "ASUS GU605M", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1),
10626 SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
10627 SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
10628 SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY/JZ/JI/JG", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10629 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
10630 SND_PCI_QUIRK(0x1043, 0x1ccf, "ASUS G814JU/JV/JI", ALC245_FIXUP_CS35L41_SPI_2),
10631 SND_PCI_QUIRK(0x1043, 0x1cdf, "ASUS G814JY/JZ/JG", ALC245_FIXUP_CS35L41_SPI_2),
10632 SND_PCI_QUIRK(0x1043, 0x1cef, "ASUS G834JY/JZ/JI/JG", ALC285_FIXUP_ASUS_HEADSET_MIC),
10633 SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
10634 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
10635 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
10636 SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
10637 SND_PCI_QUIRK(0x1043, 0x1df3, "ASUS UM5606WA", ALC294_FIXUP_BASS_SPEAKER_15),
10638 SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
10639 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
10640 SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
10641 SND_PCI_QUIRK(0x1043, 0x1e1f, "ASUS Vivobook 15 X1504VAP", ALC2XX_FIXUP_HEADSET_MIC),
10642 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
10643 SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
10644 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
10645 SND_PCI_QUIRK(0x1043, 0x1eb3, "ASUS Ally RCLA72", ALC287_FIXUP_TAS2781_I2C),
10646 SND_PCI_QUIRK(0x1043, 0x1ed3, "ASUS HN7306W", ALC287_FIXUP_CS35L41_I2C_2),
10647 SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
10648 SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
10649 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
10650 SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
10651 SND_PCI_QUIRK(0x1043, 0x1f1f, "ASUS H7604JI/JV/J3D", ALC245_FIXUP_CS35L41_SPI_2),
10652 SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
10653 SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
10654 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
10655 SND_PCI_QUIRK(0x1043, 0x31d0, "ASUS Zen AIO 27 Z272SD_A272SD", ALC274_FIXUP_ASUS_ZEN_AIO_27),
10656 SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10657 SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10658 SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10659 SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10660 SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
10661 SND_PCI_QUIRK(0x1043, 0x3e30, "ASUS TP3607SA", ALC287_FIXUP_TAS2781_I2C),
10662 SND_PCI_QUIRK(0x1043, 0x3ee0, "ASUS Strix G815_JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C),
10663 SND_PCI_QUIRK(0x1043, 0x3ef0, "ASUS Strix G635LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
10664 SND_PCI_QUIRK(0x1043, 0x3f00, "ASUS Strix G815LH_LM_LP", ALC287_FIXUP_TAS2781_I2C),
10665 SND_PCI_QUIRK(0x1043, 0x3f10, "ASUS Strix G835LR_LW_LX", ALC287_FIXUP_TAS2781_I2C),
10666 SND_PCI_QUIRK(0x1043, 0x3f20, "ASUS Strix G615LR_LW", ALC287_FIXUP_TAS2781_I2C),
10667 SND_PCI_QUIRK(0x1043, 0x3f30, "ASUS Strix G815LR_LW", ALC287_FIXUP_TAS2781_I2C),
10668 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
10669 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
10670 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10671 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
10672 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
10673 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
10674 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10675 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
10676 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
10677 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10678 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10679 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10680 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10681 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10682 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10683 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10684 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10685 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10686 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10687 SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10688 SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10689 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10690 SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10691 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10692 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10693 SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10694 SND_PCI_QUIRK(0x10ec, 0x12f6, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10695 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10696 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10697 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10698 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10699 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10700 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10701 SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10702 SND_PCI_QUIRK(0x144d, 0xc1a4, "Samsung Galaxy Book Pro 360 (NT935QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10703 SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10704 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10705 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10706 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10707 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10708 SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10709 SND_PCI_QUIRK(0x144d, 0xca06, "Samsung Galaxy Book3 360 (NP730QFG)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10710 SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10711 SND_PCI_QUIRK(0x144d, 0xc870, "Samsung Galaxy Book2 Pro (NP950XED)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
10712 SND_PCI_QUIRK(0x144d, 0xc872, "Samsung Galaxy Book2 Pro (NP950XEE)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
10713 SND_PCI_QUIRK(0x144d, 0xc886, "Samsung Galaxy Book3 Pro (NP964XFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10714 SND_PCI_QUIRK(0x144d, 0xc1ca, "Samsung Galaxy Book3 Pro 360 (NP960QFG)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10715 SND_PCI_QUIRK(0x144d, 0xc1cc, "Samsung Galaxy Book3 Ultra (NT960XFH)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10716 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10717 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10718 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10719 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10720 SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10721 SND_PCI_QUIRK(0x1558, 0x0353, "Clevo V35[05]SN[CDE]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10722 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10723 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10724 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10725 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10726 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10727 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10728 SND_PCI_QUIRK(0x1558, 0x2624, "Clevo L240TU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10729 SND_PCI_QUIRK(0x1558, 0x28c1, "Clevo V370VND", ALC2XX_FIXUP_HEADSET_MIC),
10730 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10731 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10732 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10733 SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10734 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10735 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10736 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10737 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10738 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10739 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10740 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10741 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10742 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10743 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10744 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10745 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10746 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10747 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10748 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10749 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10750 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10751 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10752 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10753 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10754 SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10755 SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10756 SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10757 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10758 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10759 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10760 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10761 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10762 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10763 SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10764 SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10765 SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10766 SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10767 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10768 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10769 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10770 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10771 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10772 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10773 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10774 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10775 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10776 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10777 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10778 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10779 SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10780 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10781 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10782 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10783 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10784 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10785 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10786 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10787 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10788 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10789 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10790 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10791 SND_PCI_QUIRK(0x1558, 0xa554, "VAIO VJFH52", ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE),
10792 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10793 SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10794 SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10795 SND_PCI_QUIRK(0x1558, 0xa741, "Clevo V54x_6x_TNE", ALC245_FIXUP_CLEVO_NOISY_MIC),
10796 SND_PCI_QUIRK(0x1558, 0xa763, "Clevo V54x_6x_TU", ALC245_FIXUP_CLEVO_NOISY_MIC),
10797 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10798 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10799 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10800 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10801 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10802 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10803 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10804 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10805 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10806 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10807 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10808 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10809 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10810 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10811 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10812 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10813 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10814 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10815 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10816 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10817 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10818 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10819 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10820 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10821 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10822 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10823 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10824 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10825 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10826 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10827 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10828 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10829 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10830 SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
10831 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10832 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10833 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10834 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10835 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10836 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10837 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10838 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10839 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10840 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10841 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10842 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10843 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10844 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10845 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10846 SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10847 SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10848 SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10849 SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10850 SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10851 SND_PCI_QUIRK(0x17aa, 0x231e, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
10852 SND_PCI_QUIRK(0x17aa, 0x231f, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318),
10853 SND_PCI_QUIRK(0x17aa, 0x2326, "Hera2", ALC287_FIXUP_TAS2781_I2C),
10854 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10855 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10856 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10857 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10858 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10859 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10860 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10861 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10862 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10863 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10864 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10865 SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
10866 SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10867 HDA_CODEC_QUIRK(0x17aa, 0x3802, "DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10868 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8", ALC287_FIXUP_TAS2781_I2C),
10869 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10870 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10871 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10872 HDA_CODEC_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10873 SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10874 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10875 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10876 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10877 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10878 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10879 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10880 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10881 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10882 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10883 SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10884 SND_PCI_QUIRK(0x17aa, 0x3865, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10885 SND_PCI_QUIRK(0x17aa, 0x3866, "Lenovo 13X", ALC287_FIXUP_CS35L41_I2C_2),
10886 SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10887 HDA_CODEC_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7", ALC287_FIXUP_CS35L41_I2C_2),
10888 SND_PCI_QUIRK(0x17aa, 0x386e, "Yoga Pro 7 14ARP8", ALC285_FIXUP_SPEAKER2_TO_DAC1),
10889 HDA_CODEC_QUIRK(0x17aa, 0x386f, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C),
10890 SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2),
10891 SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C),
10892 SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
10893 SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
10894 SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10895 SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10896 SND_PCI_QUIRK(0x17aa, 0x387f, "Yoga S780-16 pro dual LX", ALC287_FIXUP_TAS2781_I2C),
10897 SND_PCI_QUIRK(0x17aa, 0x3880, "Yoga S780-16 pro dual YC", ALC287_FIXUP_TAS2781_I2C),
10898 SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10899 SND_PCI_QUIRK(0x17aa, 0x3882, "Lenovo Yoga Pro 7 14APH8", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10900 SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10901 SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10902 SND_PCI_QUIRK(0x17aa, 0x3891, "Lenovo Yoga Pro 7 14AHP9", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10903 SND_PCI_QUIRK(0x17aa, 0x38a5, "Y580P AMD dual", ALC287_FIXUP_TAS2781_I2C),
10904 SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10905 SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10906 SND_PCI_QUIRK(0x17aa, 0x38a9, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10907 SND_PCI_QUIRK(0x17aa, 0x38ab, "Thinkbook 16P", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10908 SND_PCI_QUIRK(0x17aa, 0x38b4, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
10909 SND_PCI_QUIRK(0x17aa, 0x38b5, "Legion Slim 7 16IRH8", ALC287_FIXUP_CS35L41_I2C_2),
10910 SND_PCI_QUIRK(0x17aa, 0x38b6, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
10911 SND_PCI_QUIRK(0x17aa, 0x38b7, "Legion Slim 7 16APH8", ALC287_FIXUP_CS35L41_I2C_2),
10912 SND_PCI_QUIRK(0x17aa, 0x38b8, "Yoga S780-14.5 proX AMD YC Dual", ALC287_FIXUP_TAS2781_I2C),
10913 SND_PCI_QUIRK(0x17aa, 0x38b9, "Yoga S780-14.5 proX AMD LX Dual", ALC287_FIXUP_TAS2781_I2C),
10914 SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10915 SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10916 SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10917 SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10918 SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10919 SND_PCI_QUIRK(0x17aa, 0x38c7, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
10920 SND_PCI_QUIRK(0x17aa, 0x38c8, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
10921 SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10922 SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10923 SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10924 SND_PCI_QUIRK(0x17aa, 0x38d3, "Yoga S990-16 Pro IMH YC Dual", ALC287_FIXUP_TAS2781_I2C),
10925 SND_PCI_QUIRK(0x17aa, 0x38d4, "Yoga S990-16 Pro IMH VECO Dual", ALC287_FIXUP_TAS2781_I2C),
10926 SND_PCI_QUIRK(0x17aa, 0x38d5, "Yoga S990-16 Pro IMH YC Quad", ALC287_FIXUP_TAS2781_I2C),
10927 SND_PCI_QUIRK(0x17aa, 0x38d6, "Yoga S990-16 Pro IMH VECO Quad", ALC287_FIXUP_TAS2781_I2C),
10928 SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
10929 SND_PCI_QUIRK(0x17aa, 0x38df, "Yoga Y990 Intel YC Dual", ALC287_FIXUP_TAS2781_I2C),
10930 SND_PCI_QUIRK(0x17aa, 0x38e0, "Yoga Y990 Intel VECO Dual", ALC287_FIXUP_TAS2781_I2C),
10931 SND_PCI_QUIRK(0x17aa, 0x38f8, "Yoga Book 9i", ALC287_FIXUP_TAS2781_I2C),
10932 SND_PCI_QUIRK(0x17aa, 0x38df, "Y990 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10933 SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10934 SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
10935 SND_PCI_QUIRK(0x17aa, 0x38fd, "ThinkBook plus Gen5 Hybrid", ALC287_FIXUP_TAS2781_I2C),
10936 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10937 SND_PCI_QUIRK(0x17aa, 0x3913, "Lenovo 145", ALC236_FIXUP_LENOVO_INV_DMIC),
10938 SND_PCI_QUIRK(0x17aa, 0x391f, "Yoga S990-16 pro Quad YC Quad", ALC287_FIXUP_TAS2781_I2C),
10939 SND_PCI_QUIRK(0x17aa, 0x3920, "Yoga S990-16 pro Quad VECO Quad", ALC287_FIXUP_TAS2781_I2C),
10940 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10941 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10942 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10943 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10944 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10945 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10946 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10947 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10948 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10949 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10950 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10951 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10952 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10953 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10954 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10955 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10956 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10957 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10958 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10959 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10960 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10961 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10962 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10963 SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10964 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10965 SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10966 SND_PCI_QUIRK(0x1854, 0x0440, "LG CQ6", ALC256_FIXUP_HEADPHONE_AMP_VOL),
10967 SND_PCI_QUIRK(0x1854, 0x0441, "LG CQ6 AIO", ALC256_FIXUP_HEADPHONE_AMP_VOL),
10968 SND_PCI_QUIRK(0x1854, 0x0488, "LG gram 16 (16Z90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10969 SND_PCI_QUIRK(0x1854, 0x048a, "LG gram 17 (17ZD90R)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
10970 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10971 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10972 SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
10973 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10974 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10975 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10976 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10977 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10978 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10979 SND_PCI_QUIRK(0x1c6c, 0x122a, "Positivo N14AP7", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10980 SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10981 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10982 SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10983 SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10984 SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10985 SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10986 SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10987 SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10988 SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10989 SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10990 SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10991 SND_PCI_QUIRK(0x1d05, 0x1409, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
10992 SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
10993 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10994 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10995 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10996 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10997 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10998 SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10999 SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13),
11000 SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
11001 SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11002 SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX),
11003 SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
11004 SND_PCI_QUIRK(0x2782, 0x4900, "MEDION E15443", ALC233_FIXUP_MEDION_MTL_SPK),
11005 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
11006 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
11007 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
11008 SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
11009 SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11010 SND_PCI_QUIRK(0xf111, 0x0006, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11011 SND_PCI_QUIRK(0xf111, 0x0009, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11012 SND_PCI_QUIRK(0xf111, 0x000c, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
11013
11014 #if 0
11015 /* Below is a quirk table taken from the old code.
11016 * Basically the device should work as is without the fixup table.
11017 * If BIOS doesn't give a proper info, enable the corresponding
11018 * fixup entry.
11019 */
11020 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11021 ALC269_FIXUP_AMIC),
11022 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
11023 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
11024 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
11025 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
11026 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
11027 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
11028 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
11029 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
11030 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
11031 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
11032 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
11033 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
11034 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
11035 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
11036 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
11037 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
11038 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
11039 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
11040 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
11041 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
11042 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
11043 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
11044 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
11045 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
11046 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
11047 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
11048 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
11049 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
11050 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
11051 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
11052 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
11053 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
11054 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
11055 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
11056 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
11057 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
11058 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
11059 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
11060 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
11061 #endif
11062 {}
11063 };
11064
11065 static const struct hda_quirk alc269_fixup_vendor_tbl[] = {
11066 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
11067 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
11068 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
11069 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
11070 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
11071 {}
11072 };
11073
11074 static const struct hda_model_fixup alc269_fixup_models[] = {
11075 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
11076 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
11077 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
11078 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
11079 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
11080 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
11081 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
11082 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
11083 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
11084 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
11085 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11086 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
11087 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11088 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
11089 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
11090 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
11091 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
11092 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
11093 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
11094 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
11095 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
11096 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
11097 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
11098 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
11099 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11100 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
11101 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
11102 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
11103 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
11104 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
11105 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
11106 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
11107 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
11108 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
11109 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
11110 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
11111 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
11112 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
11113 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
11114 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
11115 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
11116 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
11117 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
11118 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
11119 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
11120 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
11121 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
11122 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
11123 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
11124 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
11125 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
11126 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
11127 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
11128 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
11129 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
11130 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
11131 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
11132 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
11133 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
11134 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
11135 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
11136 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
11137 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
11138 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
11139 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
11140 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
11141 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
11142 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
11143 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
11144 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
11145 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11146 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
11147 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
11148 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
11149 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
11150 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
11151 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
11152 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
11153 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
11154 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
11155 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
11156 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
11157 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
11158 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
11159 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
11160 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
11161 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
11162 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
11163 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
11164 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
11165 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
11166 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
11167 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
11168 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
11169 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
11170 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
11171 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
11172 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
11173 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
11174 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
11175 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
11176 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
11177 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
11178 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
11179 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
11180 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
11181 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
11182 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
11183 {.id = ALC256_FIXUP_CHROME_BOOK, .name = "alc-2024y-chromebook"},
11184 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
11185 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
11186 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
11187 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
11188 {.id = ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS, .name = "alc298-samsung-amp-v2-2-amps"},
11189 {.id = ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS, .name = "alc298-samsung-amp-v2-4-amps"},
11190 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
11191 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
11192 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
11193 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
11194 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
11195 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
11196 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
11197 {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
11198 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
11199 {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
11200 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
11201 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
11202 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
11203 {.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
11204 {.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
11205 {}
11206 };
11207 #define ALC225_STANDARD_PINS \
11208 {0x21, 0x04211020}
11209
11210 #define ALC256_STANDARD_PINS \
11211 {0x12, 0x90a60140}, \
11212 {0x14, 0x90170110}, \
11213 {0x21, 0x02211020}
11214
11215 #define ALC282_STANDARD_PINS \
11216 {0x14, 0x90170110}
11217
11218 #define ALC290_STANDARD_PINS \
11219 {0x12, 0x99a30130}
11220
11221 #define ALC292_STANDARD_PINS \
11222 {0x14, 0x90170110}, \
11223 {0x15, 0x0221401f}
11224
11225 #define ALC295_STANDARD_PINS \
11226 {0x12, 0xb7a60130}, \
11227 {0x14, 0x90170110}, \
11228 {0x21, 0x04211020}
11229
11230 #define ALC298_STANDARD_PINS \
11231 {0x12, 0x90a60130}, \
11232 {0x21, 0x03211020}
11233
11234 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
11235 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
11236 {0x14, 0x01014020},
11237 {0x17, 0x90170110},
11238 {0x18, 0x02a11030},
11239 {0x19, 0x0181303F},
11240 {0x21, 0x0221102f}),
11241 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
11242 {0x12, 0x90a601c0},
11243 {0x14, 0x90171120},
11244 {0x21, 0x02211030}),
11245 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11246 {0x14, 0x90170110},
11247 {0x1b, 0x90a70130},
11248 {0x21, 0x03211020}),
11249 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
11250 {0x1a, 0x90a70130},
11251 {0x1b, 0x90170110},
11252 {0x21, 0x03211020}),
11253 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11254 ALC225_STANDARD_PINS,
11255 {0x12, 0xb7a60130},
11256 {0x14, 0x901701a0}),
11257 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11258 ALC225_STANDARD_PINS,
11259 {0x12, 0xb7a60130},
11260 {0x14, 0x901701b0}),
11261 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11262 ALC225_STANDARD_PINS,
11263 {0x12, 0xb7a60150},
11264 {0x14, 0x901701a0}),
11265 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11266 ALC225_STANDARD_PINS,
11267 {0x12, 0xb7a60150},
11268 {0x14, 0x901701b0}),
11269 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
11270 ALC225_STANDARD_PINS,
11271 {0x12, 0xb7a60130},
11272 {0x1b, 0x90170110}),
11273 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11274 {0x1b, 0x01111010},
11275 {0x1e, 0x01451130},
11276 {0x21, 0x02211020}),
11277 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
11278 {0x12, 0x90a60140},
11279 {0x14, 0x90170110},
11280 {0x19, 0x02a11030},
11281 {0x21, 0x02211020}),
11282 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11283 {0x14, 0x90170110},
11284 {0x19, 0x02a11030},
11285 {0x1a, 0x02a11040},
11286 {0x1b, 0x01014020},
11287 {0x21, 0x0221101f}),
11288 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11289 {0x14, 0x90170110},
11290 {0x19, 0x02a11030},
11291 {0x1a, 0x02a11040},
11292 {0x1b, 0x01011020},
11293 {0x21, 0x0221101f}),
11294 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
11295 {0x14, 0x90170110},
11296 {0x19, 0x02a11020},
11297 {0x1a, 0x02a11030},
11298 {0x21, 0x0221101f}),
11299 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
11300 {0x21, 0x02211010}),
11301 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11302 {0x14, 0x90170110},
11303 {0x19, 0x02a11020},
11304 {0x21, 0x02211030}),
11305 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
11306 {0x14, 0x90170110},
11307 {0x21, 0x02211020}),
11308 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11309 {0x14, 0x90170130},
11310 {0x21, 0x02211040}),
11311 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11312 {0x12, 0x90a60140},
11313 {0x14, 0x90170110},
11314 {0x21, 0x02211020}),
11315 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11316 {0x12, 0x90a60160},
11317 {0x14, 0x90170120},
11318 {0x21, 0x02211030}),
11319 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11320 {0x14, 0x90170110},
11321 {0x1b, 0x02011020},
11322 {0x21, 0x0221101f}),
11323 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11324 {0x14, 0x90170110},
11325 {0x1b, 0x01011020},
11326 {0x21, 0x0221101f}),
11327 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11328 {0x14, 0x90170130},
11329 {0x1b, 0x01014020},
11330 {0x21, 0x0221103f}),
11331 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11332 {0x14, 0x90170130},
11333 {0x1b, 0x01011020},
11334 {0x21, 0x0221103f}),
11335 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11336 {0x14, 0x90170130},
11337 {0x1b, 0x02011020},
11338 {0x21, 0x0221103f}),
11339 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11340 {0x14, 0x90170150},
11341 {0x1b, 0x02011020},
11342 {0x21, 0x0221105f}),
11343 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11344 {0x14, 0x90170110},
11345 {0x1b, 0x01014020},
11346 {0x21, 0x0221101f}),
11347 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11348 {0x12, 0x90a60160},
11349 {0x14, 0x90170120},
11350 {0x17, 0x90170140},
11351 {0x21, 0x0321102f}),
11352 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11353 {0x12, 0x90a60160},
11354 {0x14, 0x90170130},
11355 {0x21, 0x02211040}),
11356 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11357 {0x12, 0x90a60160},
11358 {0x14, 0x90170140},
11359 {0x21, 0x02211050}),
11360 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11361 {0x12, 0x90a60170},
11362 {0x14, 0x90170120},
11363 {0x21, 0x02211030}),
11364 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11365 {0x12, 0x90a60170},
11366 {0x14, 0x90170130},
11367 {0x21, 0x02211040}),
11368 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11369 {0x12, 0x90a60170},
11370 {0x14, 0x90171130},
11371 {0x21, 0x02211040}),
11372 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11373 {0x12, 0x90a60170},
11374 {0x14, 0x90170140},
11375 {0x21, 0x02211050}),
11376 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11377 {0x12, 0x90a60180},
11378 {0x14, 0x90170130},
11379 {0x21, 0x02211040}),
11380 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11381 {0x12, 0x90a60180},
11382 {0x14, 0x90170120},
11383 {0x21, 0x02211030}),
11384 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11385 {0x1b, 0x01011020},
11386 {0x21, 0x02211010}),
11387 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11388 {0x14, 0x90170110},
11389 {0x1b, 0x90a70130},
11390 {0x21, 0x04211020}),
11391 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
11392 {0x14, 0x90170110},
11393 {0x1b, 0x90a70130},
11394 {0x21, 0x03211020}),
11395 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11396 {0x12, 0x90a60130},
11397 {0x14, 0x90170110},
11398 {0x21, 0x03211020}),
11399 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11400 {0x12, 0x90a60130},
11401 {0x14, 0x90170110},
11402 {0x21, 0x04211020}),
11403 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
11404 {0x1a, 0x90a70130},
11405 {0x1b, 0x90170110},
11406 {0x21, 0x03211020}),
11407 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
11408 {0x14, 0x90170110},
11409 {0x19, 0x02a11020},
11410 {0x21, 0x0221101f}),
11411 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
11412 {0x17, 0x90170110},
11413 {0x19, 0x03a11030},
11414 {0x21, 0x03211020}),
11415 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
11416 {0x12, 0x90a60130},
11417 {0x14, 0x90170110},
11418 {0x15, 0x0421101f},
11419 {0x1a, 0x04a11020}),
11420 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
11421 {0x12, 0x90a60140},
11422 {0x14, 0x90170110},
11423 {0x15, 0x0421101f},
11424 {0x18, 0x02811030},
11425 {0x1a, 0x04a1103f},
11426 {0x1b, 0x02011020}),
11427 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11428 ALC282_STANDARD_PINS,
11429 {0x12, 0x99a30130},
11430 {0x19, 0x03a11020},
11431 {0x21, 0x0321101f}),
11432 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11433 ALC282_STANDARD_PINS,
11434 {0x12, 0x99a30130},
11435 {0x19, 0x03a11020},
11436 {0x21, 0x03211040}),
11437 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11438 ALC282_STANDARD_PINS,
11439 {0x12, 0x99a30130},
11440 {0x19, 0x03a11030},
11441 {0x21, 0x03211020}),
11442 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11443 ALC282_STANDARD_PINS,
11444 {0x12, 0x99a30130},
11445 {0x19, 0x04a11020},
11446 {0x21, 0x0421101f}),
11447 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
11448 ALC282_STANDARD_PINS,
11449 {0x12, 0x90a60140},
11450 {0x19, 0x04a11030},
11451 {0x21, 0x04211020}),
11452 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11453 ALC282_STANDARD_PINS,
11454 {0x12, 0x90a609c0},
11455 {0x18, 0x03a11830},
11456 {0x19, 0x04a19831},
11457 {0x1a, 0x0481303f},
11458 {0x1b, 0x04211020},
11459 {0x21, 0x0321101f}),
11460 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
11461 ALC282_STANDARD_PINS,
11462 {0x12, 0x90a60940},
11463 {0x18, 0x03a11830},
11464 {0x19, 0x04a19831},
11465 {0x1a, 0x0481303f},
11466 {0x1b, 0x04211020},
11467 {0x21, 0x0321101f}),
11468 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11469 ALC282_STANDARD_PINS,
11470 {0x12, 0x90a60130},
11471 {0x21, 0x0321101f}),
11472 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11473 {0x12, 0x90a60160},
11474 {0x14, 0x90170120},
11475 {0x21, 0x02211030}),
11476 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
11477 ALC282_STANDARD_PINS,
11478 {0x12, 0x90a60130},
11479 {0x19, 0x03a11020},
11480 {0x21, 0x0321101f}),
11481 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11482 {0x12, 0x90a60130},
11483 {0x14, 0x90170110},
11484 {0x19, 0x04a11040},
11485 {0x21, 0x04211020}),
11486 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
11487 {0x14, 0x90170110},
11488 {0x19, 0x04a11040},
11489 {0x1d, 0x40600001},
11490 {0x21, 0x04211020}),
11491 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
11492 {0x14, 0x90170110},
11493 {0x19, 0x04a11040},
11494 {0x21, 0x04211020}),
11495 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
11496 {0x14, 0x90170110},
11497 {0x17, 0x90170111},
11498 {0x19, 0x03a11030},
11499 {0x21, 0x03211020}),
11500 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11501 {0x17, 0x90170110},
11502 {0x19, 0x03a11030},
11503 {0x21, 0x03211020}),
11504 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
11505 {0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
11506 {0x19, 0x04a11040},
11507 {0x21, 0x04211020}),
11508 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
11509 {0x12, 0x90a60130},
11510 {0x17, 0x90170110},
11511 {0x21, 0x02211020}),
11512 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
11513 {0x12, 0x90a60120},
11514 {0x14, 0x90170110},
11515 {0x21, 0x0321101f}),
11516 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11517 ALC290_STANDARD_PINS,
11518 {0x15, 0x04211040},
11519 {0x18, 0x90170112},
11520 {0x1a, 0x04a11020}),
11521 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11522 ALC290_STANDARD_PINS,
11523 {0x15, 0x04211040},
11524 {0x18, 0x90170110},
11525 {0x1a, 0x04a11020}),
11526 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11527 ALC290_STANDARD_PINS,
11528 {0x15, 0x0421101f},
11529 {0x1a, 0x04a11020}),
11530 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11531 ALC290_STANDARD_PINS,
11532 {0x15, 0x04211020},
11533 {0x1a, 0x04a11040}),
11534 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11535 ALC290_STANDARD_PINS,
11536 {0x14, 0x90170110},
11537 {0x15, 0x04211020},
11538 {0x1a, 0x04a11040}),
11539 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11540 ALC290_STANDARD_PINS,
11541 {0x14, 0x90170110},
11542 {0x15, 0x04211020},
11543 {0x1a, 0x04a11020}),
11544 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
11545 ALC290_STANDARD_PINS,
11546 {0x14, 0x90170110},
11547 {0x15, 0x0421101f},
11548 {0x1a, 0x04a11020}),
11549 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11550 ALC292_STANDARD_PINS,
11551 {0x12, 0x90a60140},
11552 {0x16, 0x01014020},
11553 {0x19, 0x01a19030}),
11554 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
11555 ALC292_STANDARD_PINS,
11556 {0x12, 0x90a60140},
11557 {0x16, 0x01014020},
11558 {0x18, 0x02a19031},
11559 {0x19, 0x01a1903e}),
11560 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
11561 ALC292_STANDARD_PINS,
11562 {0x12, 0x90a60140}),
11563 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11564 ALC292_STANDARD_PINS,
11565 {0x13, 0x90a60140},
11566 {0x16, 0x21014020},
11567 {0x19, 0x21a19030}),
11568 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
11569 ALC292_STANDARD_PINS,
11570 {0x13, 0x90a60140}),
11571 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
11572 {0x17, 0x90170110},
11573 {0x21, 0x04211020}),
11574 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
11575 {0x14, 0x90170110},
11576 {0x1b, 0x90a70130},
11577 {0x21, 0x04211020}),
11578 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11579 {0x12, 0x90a60130},
11580 {0x17, 0x90170110},
11581 {0x21, 0x03211020}),
11582 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11583 {0x12, 0x90a60130},
11584 {0x17, 0x90170110},
11585 {0x21, 0x04211020}),
11586 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
11587 {0x12, 0x90a60130},
11588 {0x17, 0x90170110},
11589 {0x21, 0x03211020}),
11590 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11591 {0x12, 0x90a60120},
11592 {0x17, 0x90170110},
11593 {0x21, 0x04211030}),
11594 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11595 {0x12, 0x90a60130},
11596 {0x17, 0x90170110},
11597 {0x21, 0x03211020}),
11598 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
11599 {0x12, 0x90a60130},
11600 {0x17, 0x90170110},
11601 {0x21, 0x03211020}),
11602 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11603 ALC298_STANDARD_PINS,
11604 {0x17, 0x90170110}),
11605 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11606 ALC298_STANDARD_PINS,
11607 {0x17, 0x90170140}),
11608 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
11609 ALC298_STANDARD_PINS,
11610 {0x17, 0x90170150}),
11611 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
11612 {0x12, 0xb7a60140},
11613 {0x13, 0xb7a60150},
11614 {0x17, 0x90170110},
11615 {0x1a, 0x03011020},
11616 {0x21, 0x03211030}),
11617 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
11618 {0x12, 0xb7a60140},
11619 {0x17, 0x90170110},
11620 {0x1a, 0x03a11030},
11621 {0x21, 0x03211020}),
11622 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11623 ALC225_STANDARD_PINS,
11624 {0x12, 0xb7a60130},
11625 {0x17, 0x90170110}),
11626 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
11627 {0x14, 0x01014010},
11628 {0x17, 0x90170120},
11629 {0x18, 0x02a11030},
11630 {0x19, 0x02a1103f},
11631 {0x21, 0x0221101f}),
11632 {}
11633 };
11634
11635 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
11636 * more machines, don't need to match all valid pins, just need to match
11637 * all the pins defined in the tbl. Just because of this reason, it is possible
11638 * that a single machine matches multiple tbls, so there is one limitation:
11639 * at most one tbl is allowed to define for the same vendor and same codec
11640 */
11641 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
11642 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1025, "Acer", ALC2XX_FIXUP_HEADSET_MIC,
11643 {0x19, 0x40000000}),
11644 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
11645 {0x19, 0x40000000},
11646 {0x1b, 0x40000000}),
11647 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
11648 {0x19, 0x40000000},
11649 {0x1b, 0x40000000}),
11650 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11651 {0x19, 0x40000000},
11652 {0x1a, 0x40000000}),
11653 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11654 {0x19, 0x40000000},
11655 {0x1a, 0x40000000}),
11656 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_LIMIT_INT_MIC_BOOST,
11657 {0x19, 0x40000000},
11658 {0x1a, 0x40000000}),
11659 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
11660 {0x19, 0x40000000}),
11661 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1558, "Clevo", ALC2XX_FIXUP_HEADSET_MIC,
11662 {0x19, 0x40000000}),
11663 {}
11664 };
11665
alc269_fill_coef(struct hda_codec * codec)11666 static void alc269_fill_coef(struct hda_codec *codec)
11667 {
11668 struct alc_spec *spec = codec->spec;
11669 int val;
11670
11671 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
11672 return;
11673
11674 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
11675 alc_write_coef_idx(codec, 0xf, 0x960b);
11676 alc_write_coef_idx(codec, 0xe, 0x8817);
11677 }
11678
11679 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
11680 alc_write_coef_idx(codec, 0xf, 0x960b);
11681 alc_write_coef_idx(codec, 0xe, 0x8814);
11682 }
11683
11684 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
11685 /* Power up output pin */
11686 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
11687 }
11688
11689 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
11690 val = alc_read_coef_idx(codec, 0xd);
11691 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
11692 /* Capless ramp up clock control */
11693 alc_write_coef_idx(codec, 0xd, val | (1<<10));
11694 }
11695 val = alc_read_coef_idx(codec, 0x17);
11696 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
11697 /* Class D power on reset */
11698 alc_write_coef_idx(codec, 0x17, val | (1<<7));
11699 }
11700 }
11701
11702 /* HP */
11703 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
11704 }
11705
11706 /*
11707 */
patch_alc269(struct hda_codec * codec)11708 static int patch_alc269(struct hda_codec *codec)
11709 {
11710 struct alc_spec *spec;
11711 int err;
11712
11713 err = alc_alloc_spec(codec, 0x0b);
11714 if (err < 0)
11715 return err;
11716
11717 spec = codec->spec;
11718 spec->gen.shared_mic_vref_pin = 0x18;
11719 codec->power_save_node = 0;
11720 spec->en_3kpull_low = true;
11721
11722 codec->patch_ops.suspend = alc269_suspend;
11723 codec->patch_ops.resume = alc269_resume;
11724 spec->shutup = alc_default_shutup;
11725 spec->init_hook = alc_default_init;
11726
11727 switch (codec->core.vendor_id) {
11728 case 0x10ec0269:
11729 spec->codec_variant = ALC269_TYPE_ALC269VA;
11730 switch (alc_get_coef0(codec) & 0x00f0) {
11731 case 0x0010:
11732 if (codec->bus->pci &&
11733 codec->bus->pci->subsystem_vendor == 0x1025 &&
11734 spec->cdefine.platform_type == 1)
11735 err = alc_codec_rename(codec, "ALC271X");
11736 spec->codec_variant = ALC269_TYPE_ALC269VB;
11737 break;
11738 case 0x0020:
11739 if (codec->bus->pci &&
11740 codec->bus->pci->subsystem_vendor == 0x17aa &&
11741 codec->bus->pci->subsystem_device == 0x21f3)
11742 err = alc_codec_rename(codec, "ALC3202");
11743 spec->codec_variant = ALC269_TYPE_ALC269VC;
11744 break;
11745 case 0x0030:
11746 spec->codec_variant = ALC269_TYPE_ALC269VD;
11747 break;
11748 default:
11749 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11750 }
11751 if (err < 0)
11752 goto error;
11753 spec->shutup = alc269_shutup;
11754 spec->init_hook = alc269_fill_coef;
11755 alc269_fill_coef(codec);
11756 break;
11757
11758 case 0x10ec0280:
11759 case 0x10ec0290:
11760 spec->codec_variant = ALC269_TYPE_ALC280;
11761 break;
11762 case 0x10ec0282:
11763 spec->codec_variant = ALC269_TYPE_ALC282;
11764 spec->shutup = alc282_shutup;
11765 spec->init_hook = alc282_init;
11766 break;
11767 case 0x10ec0233:
11768 case 0x10ec0283:
11769 spec->codec_variant = ALC269_TYPE_ALC283;
11770 spec->shutup = alc283_shutup;
11771 spec->init_hook = alc283_init;
11772 break;
11773 case 0x10ec0284:
11774 case 0x10ec0292:
11775 spec->codec_variant = ALC269_TYPE_ALC284;
11776 break;
11777 case 0x10ec0293:
11778 spec->codec_variant = ALC269_TYPE_ALC293;
11779 break;
11780 case 0x10ec0286:
11781 case 0x10ec0288:
11782 spec->codec_variant = ALC269_TYPE_ALC286;
11783 break;
11784 case 0x10ec0298:
11785 spec->codec_variant = ALC269_TYPE_ALC298;
11786 break;
11787 case 0x10ec0235:
11788 case 0x10ec0255:
11789 spec->codec_variant = ALC269_TYPE_ALC255;
11790 spec->shutup = alc256_shutup;
11791 spec->init_hook = alc256_init;
11792 break;
11793 case 0x10ec0230:
11794 case 0x10ec0236:
11795 case 0x10ec0256:
11796 case 0x19e58326:
11797 spec->codec_variant = ALC269_TYPE_ALC256;
11798 spec->shutup = alc256_shutup;
11799 spec->init_hook = alc256_init;
11800 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11801 if (codec->core.vendor_id == 0x10ec0236 &&
11802 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11803 spec->en_3kpull_low = false;
11804 break;
11805 case 0x10ec0257:
11806 spec->codec_variant = ALC269_TYPE_ALC257;
11807 spec->shutup = alc256_shutup;
11808 spec->init_hook = alc256_init;
11809 spec->gen.mixer_nid = 0;
11810 spec->en_3kpull_low = false;
11811 break;
11812 case 0x10ec0215:
11813 case 0x10ec0245:
11814 case 0x10ec0285:
11815 case 0x10ec0289:
11816 if (alc_get_coef0(codec) & 0x0010)
11817 spec->codec_variant = ALC269_TYPE_ALC245;
11818 else
11819 spec->codec_variant = ALC269_TYPE_ALC215;
11820 spec->shutup = alc225_shutup;
11821 spec->init_hook = alc225_init;
11822 spec->gen.mixer_nid = 0;
11823 break;
11824 case 0x10ec0225:
11825 case 0x10ec0295:
11826 case 0x10ec0299:
11827 spec->codec_variant = ALC269_TYPE_ALC225;
11828 spec->shutup = alc225_shutup;
11829 spec->init_hook = alc225_init;
11830 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11831 break;
11832 case 0x10ec0287:
11833 spec->codec_variant = ALC269_TYPE_ALC287;
11834 spec->shutup = alc225_shutup;
11835 spec->init_hook = alc225_init;
11836 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11837 break;
11838 case 0x10ec0234:
11839 case 0x10ec0274:
11840 case 0x10ec0294:
11841 spec->codec_variant = ALC269_TYPE_ALC294;
11842 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11843 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11844 spec->init_hook = alc294_init;
11845 break;
11846 case 0x10ec0300:
11847 spec->codec_variant = ALC269_TYPE_ALC300;
11848 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11849 break;
11850 case 0x10ec0623:
11851 spec->codec_variant = ALC269_TYPE_ALC623;
11852 break;
11853 case 0x10ec0700:
11854 case 0x10ec0701:
11855 case 0x10ec0703:
11856 case 0x10ec0711:
11857 spec->codec_variant = ALC269_TYPE_ALC700;
11858 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11859 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11860 spec->init_hook = alc294_init;
11861 break;
11862
11863 }
11864
11865 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11866 spec->has_alc5505_dsp = 1;
11867 spec->init_hook = alc5505_dsp_init;
11868 }
11869
11870 alc_pre_init(codec);
11871
11872 snd_hda_pick_fixup(codec, alc269_fixup_models,
11873 alc269_fixup_tbl, alc269_fixups);
11874 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11875 * the quirk breaks the latter (bko#214101).
11876 * Clear the wrong entry.
11877 */
11878 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11879 codec->core.vendor_id == 0x10ec0294) {
11880 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11881 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11882 }
11883
11884 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11885 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11886 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
11887 alc269_fixups);
11888
11889 /*
11890 * Check whether ACPI describes companion amplifiers that require
11891 * component binding
11892 */
11893 find_cirrus_companion_amps(codec);
11894
11895 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11896
11897 alc_auto_parse_customize_define(codec);
11898
11899 if (has_cdefine_beep(codec))
11900 spec->gen.beep_nid = 0x01;
11901
11902 /* automatic parse from the BIOS config */
11903 err = alc269_parse_auto_config(codec);
11904 if (err < 0)
11905 goto error;
11906
11907 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11908 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11909 if (err < 0)
11910 goto error;
11911 }
11912
11913 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11914
11915 return 0;
11916
11917 error:
11918 alc_free(codec);
11919 return err;
11920 }
11921
11922 /*
11923 * ALC861
11924 */
11925
alc861_parse_auto_config(struct hda_codec * codec)11926 static int alc861_parse_auto_config(struct hda_codec *codec)
11927 {
11928 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11929 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11930 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11931 }
11932
11933 /* Pin config fixes */
11934 enum {
11935 ALC861_FIXUP_FSC_AMILO_PI1505,
11936 ALC861_FIXUP_AMP_VREF_0F,
11937 ALC861_FIXUP_NO_JACK_DETECT,
11938 ALC861_FIXUP_ASUS_A6RP,
11939 ALC660_FIXUP_ASUS_W7J,
11940 };
11941
11942 /* 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)11943 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11944 const struct hda_fixup *fix, int action)
11945 {
11946 struct alc_spec *spec = codec->spec;
11947 unsigned int val;
11948
11949 if (action != HDA_FIXUP_ACT_INIT)
11950 return;
11951 val = snd_hda_codec_get_pin_target(codec, 0x0f);
11952 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11953 val |= AC_PINCTL_IN_EN;
11954 val |= AC_PINCTL_VREF_50;
11955 snd_hda_set_pin_ctl(codec, 0x0f, val);
11956 spec->gen.keep_vref_in_automute = 1;
11957 }
11958
11959 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)11960 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11961 const struct hda_fixup *fix, int action)
11962 {
11963 if (action == HDA_FIXUP_ACT_PRE_PROBE)
11964 codec->no_jack_detect = 1;
11965 }
11966
11967 static const struct hda_fixup alc861_fixups[] = {
11968 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
11969 .type = HDA_FIXUP_PINS,
11970 .v.pins = (const struct hda_pintbl[]) {
11971 { 0x0b, 0x0221101f }, /* HP */
11972 { 0x0f, 0x90170310 }, /* speaker */
11973 { }
11974 }
11975 },
11976 [ALC861_FIXUP_AMP_VREF_0F] = {
11977 .type = HDA_FIXUP_FUNC,
11978 .v.func = alc861_fixup_asus_amp_vref_0f,
11979 },
11980 [ALC861_FIXUP_NO_JACK_DETECT] = {
11981 .type = HDA_FIXUP_FUNC,
11982 .v.func = alc_fixup_no_jack_detect,
11983 },
11984 [ALC861_FIXUP_ASUS_A6RP] = {
11985 .type = HDA_FIXUP_FUNC,
11986 .v.func = alc861_fixup_asus_amp_vref_0f,
11987 .chained = true,
11988 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11989 },
11990 [ALC660_FIXUP_ASUS_W7J] = {
11991 .type = HDA_FIXUP_VERBS,
11992 .v.verbs = (const struct hda_verb[]) {
11993 /* ASUS W7J needs a magic pin setup on unused NID 0x10
11994 * for enabling outputs
11995 */
11996 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11997 { }
11998 },
11999 }
12000 };
12001
12002 static const struct hda_quirk alc861_fixup_tbl[] = {
12003 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
12004 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
12005 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
12006 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
12007 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
12008 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
12009 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
12010 {}
12011 };
12012
12013 /*
12014 */
patch_alc861(struct hda_codec * codec)12015 static int patch_alc861(struct hda_codec *codec)
12016 {
12017 struct alc_spec *spec;
12018 int err;
12019
12020 err = alc_alloc_spec(codec, 0x15);
12021 if (err < 0)
12022 return err;
12023
12024 spec = codec->spec;
12025 if (has_cdefine_beep(codec))
12026 spec->gen.beep_nid = 0x23;
12027
12028 spec->power_hook = alc_power_eapd;
12029
12030 alc_pre_init(codec);
12031
12032 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
12033 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12034
12035 /* automatic parse from the BIOS config */
12036 err = alc861_parse_auto_config(codec);
12037 if (err < 0)
12038 goto error;
12039
12040 if (!spec->gen.no_analog) {
12041 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
12042 if (err < 0)
12043 goto error;
12044 }
12045
12046 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12047
12048 return 0;
12049
12050 error:
12051 alc_free(codec);
12052 return err;
12053 }
12054
12055 /*
12056 * ALC861-VD support
12057 *
12058 * Based on ALC882
12059 *
12060 * In addition, an independent DAC
12061 */
alc861vd_parse_auto_config(struct hda_codec * codec)12062 static int alc861vd_parse_auto_config(struct hda_codec *codec)
12063 {
12064 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
12065 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12066 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
12067 }
12068
12069 enum {
12070 ALC660VD_FIX_ASUS_GPIO1,
12071 ALC861VD_FIX_DALLAS,
12072 };
12073
12074 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)12075 static void alc861vd_fixup_dallas(struct hda_codec *codec,
12076 const struct hda_fixup *fix, int action)
12077 {
12078 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12079 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
12080 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
12081 }
12082 }
12083
12084 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12085 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
12086 const struct hda_fixup *fix, int action)
12087 {
12088 struct alc_spec *spec = codec->spec;
12089
12090 if (action == HDA_FIXUP_ACT_PRE_PROBE)
12091 spec->gpio_mask |= 0x02;
12092 alc_fixup_gpio(codec, action, 0x01);
12093 }
12094
12095 static const struct hda_fixup alc861vd_fixups[] = {
12096 [ALC660VD_FIX_ASUS_GPIO1] = {
12097 .type = HDA_FIXUP_FUNC,
12098 .v.func = alc660vd_fixup_asus_gpio1,
12099 },
12100 [ALC861VD_FIX_DALLAS] = {
12101 .type = HDA_FIXUP_FUNC,
12102 .v.func = alc861vd_fixup_dallas,
12103 },
12104 };
12105
12106 static const struct hda_quirk alc861vd_fixup_tbl[] = {
12107 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
12108 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
12109 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
12110 {}
12111 };
12112
12113 /*
12114 */
patch_alc861vd(struct hda_codec * codec)12115 static int patch_alc861vd(struct hda_codec *codec)
12116 {
12117 struct alc_spec *spec;
12118 int err;
12119
12120 err = alc_alloc_spec(codec, 0x0b);
12121 if (err < 0)
12122 return err;
12123
12124 spec = codec->spec;
12125 if (has_cdefine_beep(codec))
12126 spec->gen.beep_nid = 0x23;
12127
12128 spec->shutup = alc_eapd_shutup;
12129
12130 alc_pre_init(codec);
12131
12132 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
12133 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12134
12135 /* automatic parse from the BIOS config */
12136 err = alc861vd_parse_auto_config(codec);
12137 if (err < 0)
12138 goto error;
12139
12140 if (!spec->gen.no_analog) {
12141 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12142 if (err < 0)
12143 goto error;
12144 }
12145
12146 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12147
12148 return 0;
12149
12150 error:
12151 alc_free(codec);
12152 return err;
12153 }
12154
12155 /*
12156 * ALC662 support
12157 *
12158 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12159 * configuration. Each pin widget can choose any input DACs and a mixer.
12160 * Each ADC is connected from a mixer of all inputs. This makes possible
12161 * 6-channel independent captures.
12162 *
12163 * In addition, an independent DAC for the multi-playback (not used in this
12164 * driver yet).
12165 */
12166
12167 /*
12168 * BIOS auto configuration
12169 */
12170
alc662_parse_auto_config(struct hda_codec * codec)12171 static int alc662_parse_auto_config(struct hda_codec *codec)
12172 {
12173 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
12174 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
12175 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
12176 const hda_nid_t *ssids;
12177
12178 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
12179 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
12180 codec->core.vendor_id == 0x10ec0671)
12181 ssids = alc663_ssids;
12182 else
12183 ssids = alc662_ssids;
12184 return alc_parse_auto_config(codec, alc662_ignore, ssids);
12185 }
12186
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)12187 static void alc272_fixup_mario(struct hda_codec *codec,
12188 const struct hda_fixup *fix, int action)
12189 {
12190 if (action != HDA_FIXUP_ACT_PRE_PROBE)
12191 return;
12192 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
12193 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
12194 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
12195 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12196 (0 << AC_AMPCAP_MUTE_SHIFT)))
12197 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
12198 }
12199
12200 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
12201 { .channels = 2,
12202 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
12203 { .channels = 4,
12204 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
12205 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
12206 { }
12207 };
12208
12209 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)12210 static void alc_fixup_bass_chmap(struct hda_codec *codec,
12211 const struct hda_fixup *fix, int action)
12212 {
12213 if (action == HDA_FIXUP_ACT_BUILD) {
12214 struct alc_spec *spec = codec->spec;
12215 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
12216 }
12217 }
12218
12219 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)12220 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
12221 hda_nid_t nid,
12222 unsigned int power_state)
12223 {
12224 struct alc_spec *spec = codec->spec;
12225 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
12226 return AC_PWRST_D0;
12227 return power_state;
12228 }
12229
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)12230 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
12231 const struct hda_fixup *fix, int action)
12232 {
12233 struct alc_spec *spec = codec->spec;
12234
12235 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
12236 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12237 spec->mute_led_polarity = 1;
12238 codec->power_filter = gpio_led_power_filter;
12239 }
12240 }
12241
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12242 static void alc662_usi_automute_hook(struct hda_codec *codec,
12243 struct hda_jack_callback *jack)
12244 {
12245 struct alc_spec *spec = codec->spec;
12246 int vref;
12247 msleep(200);
12248 snd_hda_gen_hp_automute(codec, jack);
12249
12250 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
12251 msleep(100);
12252 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
12253 vref);
12254 }
12255
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12256 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
12257 const struct hda_fixup *fix, int action)
12258 {
12259 struct alc_spec *spec = codec->spec;
12260 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12261 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12262 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
12263 }
12264 }
12265
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)12266 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
12267 struct hda_jack_callback *cb)
12268 {
12269 /* surround speakers at 0x1b already get muted automatically when
12270 * headphones are plugged in, but we have to mute/unmute the remaining
12271 * channels manually:
12272 * 0x15 - front left/front right
12273 * 0x18 - front center/ LFE
12274 */
12275 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
12276 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
12277 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
12278 } else {
12279 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
12280 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
12281 }
12282 }
12283
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)12284 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
12285 const struct hda_fixup *fix, int action)
12286 {
12287 /* Pin 0x1b: shared headphones jack and surround speakers */
12288 if (!is_jack_detectable(codec, 0x1b))
12289 return;
12290
12291 switch (action) {
12292 case HDA_FIXUP_ACT_PRE_PROBE:
12293 snd_hda_jack_detect_enable_callback(codec, 0x1b,
12294 alc662_aspire_ethos_mute_speakers);
12295 /* subwoofer needs an extra GPIO setting to become audible */
12296 alc_setup_gpio(codec, 0x02);
12297 break;
12298 case HDA_FIXUP_ACT_INIT:
12299 /* Make sure to start in a correct state, i.e. if
12300 * headphones have been plugged in before powering up the system
12301 */
12302 alc662_aspire_ethos_mute_speakers(codec, NULL);
12303 break;
12304 }
12305 }
12306
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)12307 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
12308 const struct hda_fixup *fix, int action)
12309 {
12310 struct alc_spec *spec = codec->spec;
12311
12312 static const struct hda_pintbl pincfgs[] = {
12313 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
12314 { 0x1b, 0x0181304f },
12315 { }
12316 };
12317
12318 switch (action) {
12319 case HDA_FIXUP_ACT_PRE_PROBE:
12320 spec->gen.mixer_nid = 0;
12321 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12322 snd_hda_apply_pincfgs(codec, pincfgs);
12323 break;
12324 case HDA_FIXUP_ACT_INIT:
12325 alc_write_coef_idx(codec, 0x19, 0xa054);
12326 break;
12327 }
12328 }
12329
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)12330 static void alc897_hp_automute_hook(struct hda_codec *codec,
12331 struct hda_jack_callback *jack)
12332 {
12333 struct alc_spec *spec = codec->spec;
12334 int vref;
12335
12336 snd_hda_gen_hp_automute(codec, jack);
12337 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
12338 snd_hda_set_pin_ctl(codec, 0x1b, vref);
12339 }
12340
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)12341 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
12342 const struct hda_fixup *fix, int action)
12343 {
12344 struct alc_spec *spec = codec->spec;
12345 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12346 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12347 spec->no_shutup_pins = 1;
12348 }
12349 if (action == HDA_FIXUP_ACT_PROBE) {
12350 snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100);
12351 }
12352 }
12353
alc897_fixup_lenovo_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)12354 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
12355 const struct hda_fixup *fix, int action)
12356 {
12357 struct alc_spec *spec = codec->spec;
12358
12359 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
12360 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
12361 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
12362 }
12363 }
12364
12365 static const struct coef_fw alc668_coefs[] = {
12366 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
12367 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
12368 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
12369 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
12370 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
12371 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
12372 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
12373 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
12374 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
12375 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
12376 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
12377 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
12378 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
12379 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
12380 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
12381 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
12382 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
12383 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
12384 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
12385 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
12386 {}
12387 };
12388
alc668_restore_default_value(struct hda_codec * codec)12389 static void alc668_restore_default_value(struct hda_codec *codec)
12390 {
12391 alc_process_coef_fw(codec, alc668_coefs);
12392 }
12393
12394 enum {
12395 ALC662_FIXUP_ASPIRE,
12396 ALC662_FIXUP_LED_GPIO1,
12397 ALC662_FIXUP_IDEAPAD,
12398 ALC272_FIXUP_MARIO,
12399 ALC662_FIXUP_CZC_ET26,
12400 ALC662_FIXUP_CZC_P10T,
12401 ALC662_FIXUP_SKU_IGNORE,
12402 ALC662_FIXUP_HP_RP5800,
12403 ALC662_FIXUP_ASUS_MODE1,
12404 ALC662_FIXUP_ASUS_MODE2,
12405 ALC662_FIXUP_ASUS_MODE3,
12406 ALC662_FIXUP_ASUS_MODE4,
12407 ALC662_FIXUP_ASUS_MODE5,
12408 ALC662_FIXUP_ASUS_MODE6,
12409 ALC662_FIXUP_ASUS_MODE7,
12410 ALC662_FIXUP_ASUS_MODE8,
12411 ALC662_FIXUP_NO_JACK_DETECT,
12412 ALC662_FIXUP_ZOTAC_Z68,
12413 ALC662_FIXUP_INV_DMIC,
12414 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12415 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
12416 ALC662_FIXUP_HEADSET_MODE,
12417 ALC668_FIXUP_HEADSET_MODE,
12418 ALC662_FIXUP_BASS_MODE4_CHMAP,
12419 ALC662_FIXUP_BASS_16,
12420 ALC662_FIXUP_BASS_1A,
12421 ALC662_FIXUP_BASS_CHMAP,
12422 ALC668_FIXUP_AUTO_MUTE,
12423 ALC668_FIXUP_DELL_DISABLE_AAMIX,
12424 ALC668_FIXUP_DELL_XPS13,
12425 ALC662_FIXUP_ASUS_Nx50,
12426 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12427 ALC668_FIXUP_ASUS_Nx51,
12428 ALC668_FIXUP_MIC_COEF,
12429 ALC668_FIXUP_ASUS_G751,
12430 ALC891_FIXUP_HEADSET_MODE,
12431 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12432 ALC662_FIXUP_ACER_VERITON,
12433 ALC892_FIXUP_ASROCK_MOBO,
12434 ALC662_FIXUP_USI_FUNC,
12435 ALC662_FIXUP_USI_HEADSET_MODE,
12436 ALC662_FIXUP_LENOVO_MULTI_CODECS,
12437 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
12438 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
12439 ALC671_FIXUP_HP_HEADSET_MIC2,
12440 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
12441 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
12442 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
12443 ALC668_FIXUP_HEADSET_MIC,
12444 ALC668_FIXUP_MIC_DET_COEF,
12445 ALC897_FIXUP_LENOVO_HEADSET_MIC,
12446 ALC897_FIXUP_HEADSET_MIC_PIN,
12447 ALC897_FIXUP_HP_HSMIC_VERB,
12448 ALC897_FIXUP_LENOVO_HEADSET_MODE,
12449 ALC897_FIXUP_HEADSET_MIC_PIN2,
12450 ALC897_FIXUP_UNIS_H3C_X500S,
12451 ALC897_FIXUP_HEADSET_MIC_PIN3,
12452 };
12453
12454 static const struct hda_fixup alc662_fixups[] = {
12455 [ALC662_FIXUP_ASPIRE] = {
12456 .type = HDA_FIXUP_PINS,
12457 .v.pins = (const struct hda_pintbl[]) {
12458 { 0x15, 0x99130112 }, /* subwoofer */
12459 { }
12460 }
12461 },
12462 [ALC662_FIXUP_LED_GPIO1] = {
12463 .type = HDA_FIXUP_FUNC,
12464 .v.func = alc662_fixup_led_gpio1,
12465 },
12466 [ALC662_FIXUP_IDEAPAD] = {
12467 .type = HDA_FIXUP_PINS,
12468 .v.pins = (const struct hda_pintbl[]) {
12469 { 0x17, 0x99130112 }, /* subwoofer */
12470 { }
12471 },
12472 .chained = true,
12473 .chain_id = ALC662_FIXUP_LED_GPIO1,
12474 },
12475 [ALC272_FIXUP_MARIO] = {
12476 .type = HDA_FIXUP_FUNC,
12477 .v.func = alc272_fixup_mario,
12478 },
12479 [ALC662_FIXUP_CZC_ET26] = {
12480 .type = HDA_FIXUP_PINS,
12481 .v.pins = (const struct hda_pintbl[]) {
12482 {0x12, 0x403cc000},
12483 {0x14, 0x90170110}, /* speaker */
12484 {0x15, 0x411111f0},
12485 {0x16, 0x411111f0},
12486 {0x18, 0x01a19030}, /* mic */
12487 {0x19, 0x90a7013f}, /* int-mic */
12488 {0x1a, 0x01014020},
12489 {0x1b, 0x0121401f},
12490 {0x1c, 0x411111f0},
12491 {0x1d, 0x411111f0},
12492 {0x1e, 0x40478e35},
12493 {}
12494 },
12495 .chained = true,
12496 .chain_id = ALC662_FIXUP_SKU_IGNORE
12497 },
12498 [ALC662_FIXUP_CZC_P10T] = {
12499 .type = HDA_FIXUP_VERBS,
12500 .v.verbs = (const struct hda_verb[]) {
12501 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
12502 {}
12503 }
12504 },
12505 [ALC662_FIXUP_SKU_IGNORE] = {
12506 .type = HDA_FIXUP_FUNC,
12507 .v.func = alc_fixup_sku_ignore,
12508 },
12509 [ALC662_FIXUP_HP_RP5800] = {
12510 .type = HDA_FIXUP_PINS,
12511 .v.pins = (const struct hda_pintbl[]) {
12512 { 0x14, 0x0221201f }, /* HP out */
12513 { }
12514 },
12515 .chained = true,
12516 .chain_id = ALC662_FIXUP_SKU_IGNORE
12517 },
12518 [ALC662_FIXUP_ASUS_MODE1] = {
12519 .type = HDA_FIXUP_PINS,
12520 .v.pins = (const struct hda_pintbl[]) {
12521 { 0x14, 0x99130110 }, /* speaker */
12522 { 0x18, 0x01a19c20 }, /* mic */
12523 { 0x19, 0x99a3092f }, /* int-mic */
12524 { 0x21, 0x0121401f }, /* HP out */
12525 { }
12526 },
12527 .chained = true,
12528 .chain_id = ALC662_FIXUP_SKU_IGNORE
12529 },
12530 [ALC662_FIXUP_ASUS_MODE2] = {
12531 .type = HDA_FIXUP_PINS,
12532 .v.pins = (const struct hda_pintbl[]) {
12533 { 0x14, 0x99130110 }, /* speaker */
12534 { 0x18, 0x01a19820 }, /* mic */
12535 { 0x19, 0x99a3092f }, /* int-mic */
12536 { 0x1b, 0x0121401f }, /* HP out */
12537 { }
12538 },
12539 .chained = true,
12540 .chain_id = ALC662_FIXUP_SKU_IGNORE
12541 },
12542 [ALC662_FIXUP_ASUS_MODE3] = {
12543 .type = HDA_FIXUP_PINS,
12544 .v.pins = (const struct hda_pintbl[]) {
12545 { 0x14, 0x99130110 }, /* speaker */
12546 { 0x15, 0x0121441f }, /* HP */
12547 { 0x18, 0x01a19840 }, /* mic */
12548 { 0x19, 0x99a3094f }, /* int-mic */
12549 { 0x21, 0x01211420 }, /* HP2 */
12550 { }
12551 },
12552 .chained = true,
12553 .chain_id = ALC662_FIXUP_SKU_IGNORE
12554 },
12555 [ALC662_FIXUP_ASUS_MODE4] = {
12556 .type = HDA_FIXUP_PINS,
12557 .v.pins = (const struct hda_pintbl[]) {
12558 { 0x14, 0x99130110 }, /* speaker */
12559 { 0x16, 0x99130111 }, /* speaker */
12560 { 0x18, 0x01a19840 }, /* mic */
12561 { 0x19, 0x99a3094f }, /* int-mic */
12562 { 0x21, 0x0121441f }, /* HP */
12563 { }
12564 },
12565 .chained = true,
12566 .chain_id = ALC662_FIXUP_SKU_IGNORE
12567 },
12568 [ALC662_FIXUP_ASUS_MODE5] = {
12569 .type = HDA_FIXUP_PINS,
12570 .v.pins = (const struct hda_pintbl[]) {
12571 { 0x14, 0x99130110 }, /* speaker */
12572 { 0x15, 0x0121441f }, /* HP */
12573 { 0x16, 0x99130111 }, /* speaker */
12574 { 0x18, 0x01a19840 }, /* mic */
12575 { 0x19, 0x99a3094f }, /* int-mic */
12576 { }
12577 },
12578 .chained = true,
12579 .chain_id = ALC662_FIXUP_SKU_IGNORE
12580 },
12581 [ALC662_FIXUP_ASUS_MODE6] = {
12582 .type = HDA_FIXUP_PINS,
12583 .v.pins = (const struct hda_pintbl[]) {
12584 { 0x14, 0x99130110 }, /* speaker */
12585 { 0x15, 0x01211420 }, /* HP2 */
12586 { 0x18, 0x01a19840 }, /* mic */
12587 { 0x19, 0x99a3094f }, /* int-mic */
12588 { 0x1b, 0x0121441f }, /* HP */
12589 { }
12590 },
12591 .chained = true,
12592 .chain_id = ALC662_FIXUP_SKU_IGNORE
12593 },
12594 [ALC662_FIXUP_ASUS_MODE7] = {
12595 .type = HDA_FIXUP_PINS,
12596 .v.pins = (const struct hda_pintbl[]) {
12597 { 0x14, 0x99130110 }, /* speaker */
12598 { 0x17, 0x99130111 }, /* speaker */
12599 { 0x18, 0x01a19840 }, /* mic */
12600 { 0x19, 0x99a3094f }, /* int-mic */
12601 { 0x1b, 0x01214020 }, /* HP */
12602 { 0x21, 0x0121401f }, /* HP */
12603 { }
12604 },
12605 .chained = true,
12606 .chain_id = ALC662_FIXUP_SKU_IGNORE
12607 },
12608 [ALC662_FIXUP_ASUS_MODE8] = {
12609 .type = HDA_FIXUP_PINS,
12610 .v.pins = (const struct hda_pintbl[]) {
12611 { 0x14, 0x99130110 }, /* speaker */
12612 { 0x12, 0x99a30970 }, /* int-mic */
12613 { 0x15, 0x01214020 }, /* HP */
12614 { 0x17, 0x99130111 }, /* speaker */
12615 { 0x18, 0x01a19840 }, /* mic */
12616 { 0x21, 0x0121401f }, /* HP */
12617 { }
12618 },
12619 .chained = true,
12620 .chain_id = ALC662_FIXUP_SKU_IGNORE
12621 },
12622 [ALC662_FIXUP_NO_JACK_DETECT] = {
12623 .type = HDA_FIXUP_FUNC,
12624 .v.func = alc_fixup_no_jack_detect,
12625 },
12626 [ALC662_FIXUP_ZOTAC_Z68] = {
12627 .type = HDA_FIXUP_PINS,
12628 .v.pins = (const struct hda_pintbl[]) {
12629 { 0x1b, 0x02214020 }, /* Front HP */
12630 { }
12631 }
12632 },
12633 [ALC662_FIXUP_INV_DMIC] = {
12634 .type = HDA_FIXUP_FUNC,
12635 .v.func = alc_fixup_inv_dmic,
12636 },
12637 [ALC668_FIXUP_DELL_XPS13] = {
12638 .type = HDA_FIXUP_FUNC,
12639 .v.func = alc_fixup_dell_xps13,
12640 .chained = true,
12641 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
12642 },
12643 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
12644 .type = HDA_FIXUP_FUNC,
12645 .v.func = alc_fixup_disable_aamix,
12646 .chained = true,
12647 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12648 },
12649 [ALC668_FIXUP_AUTO_MUTE] = {
12650 .type = HDA_FIXUP_FUNC,
12651 .v.func = alc_fixup_auto_mute_via_amp,
12652 .chained = true,
12653 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
12654 },
12655 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
12656 .type = HDA_FIXUP_PINS,
12657 .v.pins = (const struct hda_pintbl[]) {
12658 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12659 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
12660 { }
12661 },
12662 .chained = true,
12663 .chain_id = ALC662_FIXUP_HEADSET_MODE
12664 },
12665 [ALC662_FIXUP_HEADSET_MODE] = {
12666 .type = HDA_FIXUP_FUNC,
12667 .v.func = alc_fixup_headset_mode_alc662,
12668 },
12669 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
12670 .type = HDA_FIXUP_PINS,
12671 .v.pins = (const struct hda_pintbl[]) {
12672 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12673 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12674 { }
12675 },
12676 .chained = true,
12677 .chain_id = ALC668_FIXUP_HEADSET_MODE
12678 },
12679 [ALC668_FIXUP_HEADSET_MODE] = {
12680 .type = HDA_FIXUP_FUNC,
12681 .v.func = alc_fixup_headset_mode_alc668,
12682 },
12683 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
12684 .type = HDA_FIXUP_FUNC,
12685 .v.func = alc_fixup_bass_chmap,
12686 .chained = true,
12687 .chain_id = ALC662_FIXUP_ASUS_MODE4
12688 },
12689 [ALC662_FIXUP_BASS_16] = {
12690 .type = HDA_FIXUP_PINS,
12691 .v.pins = (const struct hda_pintbl[]) {
12692 {0x16, 0x80106111}, /* bass speaker */
12693 {}
12694 },
12695 .chained = true,
12696 .chain_id = ALC662_FIXUP_BASS_CHMAP,
12697 },
12698 [ALC662_FIXUP_BASS_1A] = {
12699 .type = HDA_FIXUP_PINS,
12700 .v.pins = (const struct hda_pintbl[]) {
12701 {0x1a, 0x80106111}, /* bass speaker */
12702 {}
12703 },
12704 .chained = true,
12705 .chain_id = ALC662_FIXUP_BASS_CHMAP,
12706 },
12707 [ALC662_FIXUP_BASS_CHMAP] = {
12708 .type = HDA_FIXUP_FUNC,
12709 .v.func = alc_fixup_bass_chmap,
12710 },
12711 [ALC662_FIXUP_ASUS_Nx50] = {
12712 .type = HDA_FIXUP_FUNC,
12713 .v.func = alc_fixup_auto_mute_via_amp,
12714 .chained = true,
12715 .chain_id = ALC662_FIXUP_BASS_1A
12716 },
12717 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
12718 .type = HDA_FIXUP_FUNC,
12719 .v.func = alc_fixup_headset_mode_alc668,
12720 .chain_id = ALC662_FIXUP_BASS_CHMAP
12721 },
12722 [ALC668_FIXUP_ASUS_Nx51] = {
12723 .type = HDA_FIXUP_PINS,
12724 .v.pins = (const struct hda_pintbl[]) {
12725 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12726 { 0x1a, 0x90170151 }, /* bass speaker */
12727 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12728 {}
12729 },
12730 .chained = true,
12731 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
12732 },
12733 [ALC668_FIXUP_MIC_COEF] = {
12734 .type = HDA_FIXUP_VERBS,
12735 .v.verbs = (const struct hda_verb[]) {
12736 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
12737 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
12738 {}
12739 },
12740 },
12741 [ALC668_FIXUP_ASUS_G751] = {
12742 .type = HDA_FIXUP_PINS,
12743 .v.pins = (const struct hda_pintbl[]) {
12744 { 0x16, 0x0421101f }, /* HP */
12745 {}
12746 },
12747 .chained = true,
12748 .chain_id = ALC668_FIXUP_MIC_COEF
12749 },
12750 [ALC891_FIXUP_HEADSET_MODE] = {
12751 .type = HDA_FIXUP_FUNC,
12752 .v.func = alc_fixup_headset_mode,
12753 },
12754 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
12755 .type = HDA_FIXUP_PINS,
12756 .v.pins = (const struct hda_pintbl[]) {
12757 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
12758 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
12759 { }
12760 },
12761 .chained = true,
12762 .chain_id = ALC891_FIXUP_HEADSET_MODE
12763 },
12764 [ALC662_FIXUP_ACER_VERITON] = {
12765 .type = HDA_FIXUP_PINS,
12766 .v.pins = (const struct hda_pintbl[]) {
12767 { 0x15, 0x50170120 }, /* no internal speaker */
12768 { }
12769 }
12770 },
12771 [ALC892_FIXUP_ASROCK_MOBO] = {
12772 .type = HDA_FIXUP_PINS,
12773 .v.pins = (const struct hda_pintbl[]) {
12774 { 0x15, 0x40f000f0 }, /* disabled */
12775 { 0x16, 0x40f000f0 }, /* disabled */
12776 { }
12777 }
12778 },
12779 [ALC662_FIXUP_USI_FUNC] = {
12780 .type = HDA_FIXUP_FUNC,
12781 .v.func = alc662_fixup_usi_headset_mic,
12782 },
12783 [ALC662_FIXUP_USI_HEADSET_MODE] = {
12784 .type = HDA_FIXUP_PINS,
12785 .v.pins = (const struct hda_pintbl[]) {
12786 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12787 { 0x18, 0x01a1903d },
12788 { }
12789 },
12790 .chained = true,
12791 .chain_id = ALC662_FIXUP_USI_FUNC
12792 },
12793 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12794 .type = HDA_FIXUP_FUNC,
12795 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12796 },
12797 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12798 .type = HDA_FIXUP_FUNC,
12799 .v.func = alc662_fixup_aspire_ethos_hp,
12800 },
12801 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12802 .type = HDA_FIXUP_PINS,
12803 .v.pins = (const struct hda_pintbl[]) {
12804 { 0x15, 0x92130110 }, /* front speakers */
12805 { 0x18, 0x99130111 }, /* center/subwoofer */
12806 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
12807 { }
12808 },
12809 .chained = true,
12810 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12811 },
12812 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
12813 .type = HDA_FIXUP_FUNC,
12814 .v.func = alc671_fixup_hp_headset_mic2,
12815 },
12816 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12817 .type = HDA_FIXUP_PINS,
12818 .v.pins = (const struct hda_pintbl[]) {
12819 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12820 { }
12821 },
12822 .chained = true,
12823 .chain_id = ALC662_FIXUP_USI_FUNC
12824 },
12825 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12826 .type = HDA_FIXUP_PINS,
12827 .v.pins = (const struct hda_pintbl[]) {
12828 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12829 { 0x1b, 0x0221144f },
12830 { }
12831 },
12832 .chained = true,
12833 .chain_id = ALC662_FIXUP_USI_FUNC
12834 },
12835 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12836 .type = HDA_FIXUP_PINS,
12837 .v.pins = (const struct hda_pintbl[]) {
12838 { 0x1b, 0x04a1112c },
12839 { }
12840 },
12841 .chained = true,
12842 .chain_id = ALC668_FIXUP_HEADSET_MIC
12843 },
12844 [ALC668_FIXUP_HEADSET_MIC] = {
12845 .type = HDA_FIXUP_FUNC,
12846 .v.func = alc269_fixup_headset_mic,
12847 .chained = true,
12848 .chain_id = ALC668_FIXUP_MIC_DET_COEF
12849 },
12850 [ALC668_FIXUP_MIC_DET_COEF] = {
12851 .type = HDA_FIXUP_VERBS,
12852 .v.verbs = (const struct hda_verb[]) {
12853 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12854 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12855 {}
12856 },
12857 },
12858 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12859 .type = HDA_FIXUP_FUNC,
12860 .v.func = alc897_fixup_lenovo_headset_mic,
12861 },
12862 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
12863 .type = HDA_FIXUP_PINS,
12864 .v.pins = (const struct hda_pintbl[]) {
12865 { 0x1a, 0x03a11050 },
12866 { }
12867 },
12868 .chained = true,
12869 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12870 },
12871 [ALC897_FIXUP_HP_HSMIC_VERB] = {
12872 .type = HDA_FIXUP_PINS,
12873 .v.pins = (const struct hda_pintbl[]) {
12874 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12875 { }
12876 },
12877 },
12878 [ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12879 .type = HDA_FIXUP_FUNC,
12880 .v.func = alc897_fixup_lenovo_headset_mode,
12881 },
12882 [ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12883 .type = HDA_FIXUP_PINS,
12884 .v.pins = (const struct hda_pintbl[]) {
12885 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12886 { }
12887 },
12888 .chained = true,
12889 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12890 },
12891 [ALC897_FIXUP_UNIS_H3C_X500S] = {
12892 .type = HDA_FIXUP_VERBS,
12893 .v.verbs = (const struct hda_verb[]) {
12894 { 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12895 {}
12896 },
12897 },
12898 [ALC897_FIXUP_HEADSET_MIC_PIN3] = {
12899 .type = HDA_FIXUP_PINS,
12900 .v.pins = (const struct hda_pintbl[]) {
12901 { 0x19, 0x03a11050 }, /* use as headset mic */
12902 { }
12903 },
12904 },
12905 };
12906
12907 static const struct hda_quirk alc662_fixup_tbl[] = {
12908 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12909 SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
12910 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12911 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12912 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12913 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12914 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12915 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12916 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12917 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12918 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12919 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12920 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12921 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12922 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12923 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12924 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12925 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12926 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12927 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12928 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12929 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12930 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12931 SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12932 SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12933 SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12934 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12935 SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12936 SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12937 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12938 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12939 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12940 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12941 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12942 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12943 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12944 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12945 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12946 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12947 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12948 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12949 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12950 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12951 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12952 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12953 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12954 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12955 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12956 SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12957 SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12958 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12959 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12960 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12961 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12962 SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12963 SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12964 SND_PCI_QUIRK(0x17aa, 0x3364, "Lenovo ThinkCentre M90 Gen5", ALC897_FIXUP_HEADSET_MIC_PIN),
12965 SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12966 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12967 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12968 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12969 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12970 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12971 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12972 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12973 SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12974
12975 #if 0
12976 /* Below is a quirk table taken from the old code.
12977 * Basically the device should work as is without the fixup table.
12978 * If BIOS doesn't give a proper info, enable the corresponding
12979 * fixup entry.
12980 */
12981 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12982 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12983 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12984 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12985 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12986 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12987 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12988 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12989 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12990 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12991 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12992 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12993 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12994 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12995 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12996 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12997 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12998 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12999 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13000 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13001 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13002 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13003 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
13004 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
13005 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
13006 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13007 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
13008 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
13009 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13010 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
13011 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13012 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13013 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
13014 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
13015 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
13016 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
13017 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
13018 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
13019 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
13020 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
13021 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
13022 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
13023 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13024 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
13025 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
13026 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
13027 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
13028 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
13029 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
13030 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
13031 #endif
13032 {}
13033 };
13034
13035 static const struct hda_model_fixup alc662_fixup_models[] = {
13036 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
13037 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
13038 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
13039 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
13040 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
13041 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
13042 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
13043 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
13044 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
13045 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
13046 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
13047 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
13048 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
13049 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
13050 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
13051 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
13052 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
13053 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
13054 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
13055 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
13056 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
13057 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
13058 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
13059 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
13060 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
13061 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
13062 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
13063 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
13064 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
13065 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
13066 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
13067 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
13068 {.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
13069 {}
13070 };
13071
13072 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
13073 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13074 {0x17, 0x02211010},
13075 {0x18, 0x01a19030},
13076 {0x1a, 0x01813040},
13077 {0x21, 0x01014020}),
13078 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
13079 {0x16, 0x01813030},
13080 {0x17, 0x02211010},
13081 {0x18, 0x01a19040},
13082 {0x21, 0x01014020}),
13083 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
13084 {0x14, 0x01014010},
13085 {0x18, 0x01a19020},
13086 {0x1a, 0x0181302f},
13087 {0x1b, 0x0221401f}),
13088 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13089 {0x12, 0x99a30130},
13090 {0x14, 0x90170110},
13091 {0x15, 0x0321101f},
13092 {0x16, 0x03011020}),
13093 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13094 {0x12, 0x99a30140},
13095 {0x14, 0x90170110},
13096 {0x15, 0x0321101f},
13097 {0x16, 0x03011020}),
13098 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13099 {0x12, 0x99a30150},
13100 {0x14, 0x90170110},
13101 {0x15, 0x0321101f},
13102 {0x16, 0x03011020}),
13103 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
13104 {0x14, 0x90170110},
13105 {0x15, 0x0321101f},
13106 {0x16, 0x03011020}),
13107 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
13108 {0x12, 0x90a60130},
13109 {0x14, 0x90170110},
13110 {0x15, 0x0321101f}),
13111 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13112 {0x14, 0x01014010},
13113 {0x17, 0x90170150},
13114 {0x19, 0x02a11060},
13115 {0x1b, 0x01813030},
13116 {0x21, 0x02211020}),
13117 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13118 {0x14, 0x01014010},
13119 {0x18, 0x01a19040},
13120 {0x1b, 0x01813030},
13121 {0x21, 0x02211020}),
13122 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
13123 {0x14, 0x01014020},
13124 {0x17, 0x90170110},
13125 {0x18, 0x01a19050},
13126 {0x1b, 0x01813040},
13127 {0x21, 0x02211030}),
13128 {}
13129 };
13130
13131 /*
13132 */
patch_alc662(struct hda_codec * codec)13133 static int patch_alc662(struct hda_codec *codec)
13134 {
13135 struct alc_spec *spec;
13136 int err;
13137
13138 err = alc_alloc_spec(codec, 0x0b);
13139 if (err < 0)
13140 return err;
13141
13142 spec = codec->spec;
13143
13144 spec->shutup = alc_eapd_shutup;
13145
13146 /* handle multiple HPs as is */
13147 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
13148
13149 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13150
13151 switch (codec->core.vendor_id) {
13152 case 0x10ec0668:
13153 spec->init_hook = alc668_restore_default_value;
13154 break;
13155 }
13156
13157 alc_pre_init(codec);
13158
13159 snd_hda_pick_fixup(codec, alc662_fixup_models,
13160 alc662_fixup_tbl, alc662_fixups);
13161 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
13162 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
13163
13164 alc_auto_parse_customize_define(codec);
13165
13166 if (has_cdefine_beep(codec))
13167 spec->gen.beep_nid = 0x01;
13168
13169 if ((alc_get_coef0(codec) & (1 << 14)) &&
13170 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
13171 spec->cdefine.platform_type == 1) {
13172 err = alc_codec_rename(codec, "ALC272X");
13173 if (err < 0)
13174 goto error;
13175 }
13176
13177 /* automatic parse from the BIOS config */
13178 err = alc662_parse_auto_config(codec);
13179 if (err < 0)
13180 goto error;
13181
13182 if (!spec->gen.no_analog && spec->gen.beep_nid) {
13183 switch (codec->core.vendor_id) {
13184 case 0x10ec0662:
13185 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
13186 break;
13187 case 0x10ec0272:
13188 case 0x10ec0663:
13189 case 0x10ec0665:
13190 case 0x10ec0668:
13191 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13192 break;
13193 case 0x10ec0273:
13194 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
13195 break;
13196 }
13197 if (err < 0)
13198 goto error;
13199 }
13200
13201 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
13202
13203 return 0;
13204
13205 error:
13206 alc_free(codec);
13207 return err;
13208 }
13209
13210 /*
13211 * ALC680 support
13212 */
13213
alc680_parse_auto_config(struct hda_codec * codec)13214 static int alc680_parse_auto_config(struct hda_codec *codec)
13215 {
13216 return alc_parse_auto_config(codec, NULL, NULL);
13217 }
13218
13219 /*
13220 */
patch_alc680(struct hda_codec * codec)13221 static int patch_alc680(struct hda_codec *codec)
13222 {
13223 int err;
13224
13225 /* ALC680 has no aa-loopback mixer */
13226 err = alc_alloc_spec(codec, 0);
13227 if (err < 0)
13228 return err;
13229
13230 /* automatic parse from the BIOS config */
13231 err = alc680_parse_auto_config(codec);
13232 if (err < 0) {
13233 alc_free(codec);
13234 return err;
13235 }
13236
13237 return 0;
13238 }
13239
13240 /*
13241 * patch entries
13242 */
13243 static const struct hda_device_id snd_hda_id_realtek[] = {
13244 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
13245 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
13246 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
13247 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
13248 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
13249 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
13250 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
13251 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
13252 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
13253 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
13254 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
13255 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
13256 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
13257 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
13258 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
13259 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
13260 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
13261 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
13262 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
13263 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
13264 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
13265 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
13266 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
13267 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
13268 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
13269 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
13270 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
13271 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
13272 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
13273 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
13274 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
13275 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
13276 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
13277 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
13278 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
13279 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
13280 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
13281 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
13282 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
13283 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
13284 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
13285 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
13286 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
13287 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
13288 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
13289 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
13290 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
13291 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
13292 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
13293 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
13294 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
13295 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
13296 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
13297 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
13298 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
13299 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
13300 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
13301 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
13302 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
13303 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
13304 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
13305 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
13306 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
13307 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
13308 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
13309 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
13310 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
13311 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
13312 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
13313 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
13314 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
13315 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
13316 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
13317 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
13318 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
13319 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
13320 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
13321 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
13322 HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
13323 {} /* terminator */
13324 };
13325 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
13326
13327 MODULE_LICENSE("GPL");
13328 MODULE_DESCRIPTION("Realtek HD-audio codec");
13329 MODULE_IMPORT_NS("SND_HDA_SCODEC_COMPONENT");
13330
13331 static struct hda_codec_driver realtek_driver = {
13332 .id = snd_hda_id_realtek,
13333 };
13334
13335 module_hda_codec_driver(realtek_driver);
13336