1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
5 * HD audio interface patch for Realtek ALC codecs
6 *
7 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
9 * Takashi Iwai <tiwai@suse.de>
10 * Jonathan Woithe <jwoithe@just42.net>
11 */
12
13 #include <linux/init.h>
14 #include <linux/delay.h>
15 #include <linux/slab.h>
16 #include <linux/pci.h>
17 #include <linux/dmi.h>
18 #include <linux/module.h>
19 #include <linux/input.h>
20 #include <linux/leds.h>
21 #include <sound/core.h>
22 #include <sound/jack.h>
23 #include <sound/hda_codec.h>
24 #include "hda_local.h"
25 #include "hda_auto_parser.h"
26 #include "hda_jack.h"
27 #include "hda_generic.h"
28
29 /* keep halting ALC5505 DSP, for power saving */
30 #define HALT_REALTEK_ALC5505
31
32 /* extra amp-initialization sequence types */
33 enum {
34 ALC_INIT_UNDEFINED,
35 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
37 };
38
39 enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45 };
46
47 enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51 };
52
53 enum {
54 ALC_KEY_MICMUTE_INDEX,
55 };
56
57 struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
67 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
68 };
69
70 struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75 };
76
77 struct alc_spec {
78 struct hda_gen_spec gen; /* must be at head */
79
80 /* codec parameterization */
81 struct alc_customize_define cdefine;
82 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
83
84 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
88 bool gpio_write_delay; /* add a delay before writing gpio_data */
89
90 /* mute LED for HP laptops, see vref_mute_led_set() */
91 int mute_led_polarity;
92 int micmute_led_polarity;
93 hda_nid_t mute_led_nid;
94 hda_nid_t cap_mute_led_nid;
95
96 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
98 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
100
101 hda_nid_t headset_mic_pin;
102 hda_nid_t headphone_mic_pin;
103 int current_headset_mode;
104 int current_headset_type;
105
106 /* hooks */
107 void (*init_hook)(struct hda_codec *codec);
108 #ifdef CONFIG_PM
109 void (*power_hook)(struct hda_codec *codec);
110 #endif
111 void (*shutup)(struct hda_codec *codec);
112 void (*reboot_notify)(struct hda_codec *codec);
113
114 int init_amp;
115 int codec_variant; /* flag for other variants */
116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
118 unsigned int done_hp_init:1;
119 unsigned int no_shutup_pins:1;
120 unsigned int ultra_low_power:1;
121 unsigned int has_hs_key:1;
122 unsigned int no_internal_mic_pin:1;
123
124 /* for PLL fix */
125 hda_nid_t pll_nid;
126 unsigned int pll_coef_idx, pll_coef_bit;
127 unsigned int coef0;
128 struct input_dev *kb_dev;
129 u8 alc_mute_keycode_map[1];
130 };
131
132 /*
133 * COEF access helper functions
134 */
135
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)136 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
137 unsigned int coef_idx)
138 {
139 unsigned int val;
140
141 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
142 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
143 return val;
144 }
145
146 #define alc_read_coef_idx(codec, coef_idx) \
147 alc_read_coefex_idx(codec, 0x20, coef_idx)
148
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)149 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
150 unsigned int coef_idx, unsigned int coef_val)
151 {
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
154 }
155
156 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
157 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
158
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)159 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 unsigned int coef_idx, unsigned int mask,
161 unsigned int bits_set)
162 {
163 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
164
165 if (val != -1)
166 alc_write_coefex_idx(codec, nid, coef_idx,
167 (val & ~mask) | bits_set);
168 }
169
170 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
171 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
172
173 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)174 static unsigned int alc_get_coef0(struct hda_codec *codec)
175 {
176 struct alc_spec *spec = codec->spec;
177
178 if (!spec->coef0)
179 spec->coef0 = alc_read_coef_idx(codec, 0);
180 return spec->coef0;
181 }
182
183 /* coef writes/updates batch */
184 struct coef_fw {
185 unsigned char nid;
186 unsigned char idx;
187 unsigned short mask;
188 unsigned short val;
189 };
190
191 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
192 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
193 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
194 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
195 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
196
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)197 static void alc_process_coef_fw(struct hda_codec *codec,
198 const struct coef_fw *fw)
199 {
200 for (; fw->nid; fw++) {
201 if (fw->mask == (unsigned short)-1)
202 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
203 else
204 alc_update_coefex_idx(codec, fw->nid, fw->idx,
205 fw->mask, fw->val);
206 }
207 }
208
209 /*
210 * GPIO setup tables, used in initialization
211 */
212
213 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)214 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
215 {
216 struct alc_spec *spec = codec->spec;
217
218 spec->gpio_mask |= mask;
219 spec->gpio_dir |= mask;
220 spec->gpio_data |= mask;
221 }
222
alc_write_gpio_data(struct hda_codec * codec)223 static void alc_write_gpio_data(struct hda_codec *codec)
224 {
225 struct alc_spec *spec = codec->spec;
226
227 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
228 spec->gpio_data);
229 }
230
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)231 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
232 bool on)
233 {
234 struct alc_spec *spec = codec->spec;
235 unsigned int oldval = spec->gpio_data;
236
237 if (on)
238 spec->gpio_data |= mask;
239 else
240 spec->gpio_data &= ~mask;
241 if (oldval != spec->gpio_data)
242 alc_write_gpio_data(codec);
243 }
244
alc_write_gpio(struct hda_codec * codec)245 static void alc_write_gpio(struct hda_codec *codec)
246 {
247 struct alc_spec *spec = codec->spec;
248
249 if (!spec->gpio_mask)
250 return;
251
252 snd_hda_codec_write(codec, codec->core.afg, 0,
253 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
254 snd_hda_codec_write(codec, codec->core.afg, 0,
255 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
256 if (spec->gpio_write_delay)
257 msleep(1);
258 alc_write_gpio_data(codec);
259 }
260
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)261 static void alc_fixup_gpio(struct hda_codec *codec, int action,
262 unsigned int mask)
263 {
264 if (action == HDA_FIXUP_ACT_PRE_PROBE)
265 alc_setup_gpio(codec, mask);
266 }
267
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)268 static void alc_fixup_gpio1(struct hda_codec *codec,
269 const struct hda_fixup *fix, int action)
270 {
271 alc_fixup_gpio(codec, action, 0x01);
272 }
273
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)274 static void alc_fixup_gpio2(struct hda_codec *codec,
275 const struct hda_fixup *fix, int action)
276 {
277 alc_fixup_gpio(codec, action, 0x02);
278 }
279
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)280 static void alc_fixup_gpio3(struct hda_codec *codec,
281 const struct hda_fixup *fix, int action)
282 {
283 alc_fixup_gpio(codec, action, 0x03);
284 }
285
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)286 static void alc_fixup_gpio4(struct hda_codec *codec,
287 const struct hda_fixup *fix, int action)
288 {
289 alc_fixup_gpio(codec, action, 0x04);
290 }
291
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)292 static void alc_fixup_micmute_led(struct hda_codec *codec,
293 const struct hda_fixup *fix, int action)
294 {
295 if (action == HDA_FIXUP_ACT_PROBE)
296 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
297 }
298
299 /*
300 * Fix hardware PLL issue
301 * On some codecs, the analog PLL gating control must be off while
302 * the default value is 1.
303 */
alc_fix_pll(struct hda_codec * codec)304 static void alc_fix_pll(struct hda_codec *codec)
305 {
306 struct alc_spec *spec = codec->spec;
307
308 if (spec->pll_nid)
309 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
310 1 << spec->pll_coef_bit, 0);
311 }
312
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)313 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
314 unsigned int coef_idx, unsigned int coef_bit)
315 {
316 struct alc_spec *spec = codec->spec;
317 spec->pll_nid = nid;
318 spec->pll_coef_idx = coef_idx;
319 spec->pll_coef_bit = coef_bit;
320 alc_fix_pll(codec);
321 }
322
323 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)324 static void alc_update_knob_master(struct hda_codec *codec,
325 struct hda_jack_callback *jack)
326 {
327 unsigned int val;
328 struct snd_kcontrol *kctl;
329 struct snd_ctl_elem_value *uctl;
330
331 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
332 if (!kctl)
333 return;
334 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
335 if (!uctl)
336 return;
337 val = snd_hda_codec_read(codec, jack->nid, 0,
338 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
339 val &= HDA_AMP_VOLMASK;
340 uctl->value.integer.value[0] = val;
341 uctl->value.integer.value[1] = val;
342 kctl->put(kctl, uctl);
343 kfree(uctl);
344 }
345
alc880_unsol_event(struct hda_codec * codec,unsigned int res)346 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
347 {
348 /* For some reason, the res given from ALC880 is broken.
349 Here we adjust it properly. */
350 snd_hda_jack_unsol_event(codec, res >> 2);
351 }
352
353 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)354 static void alc_fill_eapd_coef(struct hda_codec *codec)
355 {
356 int coef;
357
358 coef = alc_get_coef0(codec);
359
360 switch (codec->core.vendor_id) {
361 case 0x10ec0262:
362 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
363 break;
364 case 0x10ec0267:
365 case 0x10ec0268:
366 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
367 break;
368 case 0x10ec0269:
369 if ((coef & 0x00f0) == 0x0010)
370 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
371 if ((coef & 0x00f0) == 0x0020)
372 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
373 if ((coef & 0x00f0) == 0x0030)
374 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
375 break;
376 case 0x10ec0280:
377 case 0x10ec0284:
378 case 0x10ec0290:
379 case 0x10ec0292:
380 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
381 break;
382 case 0x10ec0225:
383 case 0x10ec0295:
384 case 0x10ec0299:
385 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
386 fallthrough;
387 case 0x10ec0215:
388 case 0x10ec0230:
389 case 0x10ec0233:
390 case 0x10ec0235:
391 case 0x10ec0236:
392 case 0x10ec0245:
393 case 0x10ec0255:
394 case 0x10ec0256:
395 case 0x10ec0257:
396 case 0x10ec0282:
397 case 0x10ec0283:
398 case 0x10ec0286:
399 case 0x10ec0288:
400 case 0x10ec0285:
401 case 0x10ec0298:
402 case 0x10ec0289:
403 case 0x10ec0300:
404 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
405 break;
406 case 0x10ec0275:
407 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
408 break;
409 case 0x10ec0287:
410 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
411 alc_write_coef_idx(codec, 0x8, 0x4ab7);
412 break;
413 case 0x10ec0293:
414 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
415 break;
416 case 0x10ec0234:
417 case 0x10ec0274:
418 case 0x10ec0294:
419 case 0x10ec0700:
420 case 0x10ec0701:
421 case 0x10ec0703:
422 case 0x10ec0711:
423 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
424 break;
425 case 0x10ec0662:
426 if ((coef & 0x00f0) == 0x0030)
427 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
428 break;
429 case 0x10ec0272:
430 case 0x10ec0273:
431 case 0x10ec0663:
432 case 0x10ec0665:
433 case 0x10ec0670:
434 case 0x10ec0671:
435 case 0x10ec0672:
436 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
437 break;
438 case 0x10ec0222:
439 case 0x10ec0623:
440 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
441 break;
442 case 0x10ec0668:
443 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
444 break;
445 case 0x10ec0867:
446 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
447 break;
448 case 0x10ec0888:
449 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
450 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
451 break;
452 case 0x10ec0892:
453 case 0x10ec0897:
454 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
455 break;
456 case 0x10ec0899:
457 case 0x10ec0900:
458 case 0x10ec0b00:
459 case 0x10ec1168:
460 case 0x10ec1220:
461 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
462 break;
463 }
464 }
465
466 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)467 static void alc888_coef_init(struct hda_codec *codec)
468 {
469 switch (alc_get_coef0(codec) & 0x00f0) {
470 /* alc888-VA */
471 case 0x00:
472 /* alc888-VB */
473 case 0x10:
474 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
475 break;
476 }
477 }
478
479 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)480 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
481 {
482 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
483 return;
484 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
485 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
486 on ? 2 : 0);
487 }
488
489 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)490 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
491 {
492 /* We currently only handle front, HP */
493 static const hda_nid_t pins[] = {
494 0x0f, 0x10, 0x14, 0x15, 0x17, 0
495 };
496 const hda_nid_t *p;
497 for (p = pins; *p; p++)
498 set_eapd(codec, *p, on);
499 }
500
501 static int find_ext_mic_pin(struct hda_codec *codec);
502
alc_headset_mic_no_shutup(struct hda_codec * codec)503 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
504 {
505 const struct hda_pincfg *pin;
506 int mic_pin = find_ext_mic_pin(codec);
507 int i;
508
509 /* don't shut up pins when unloading the driver; otherwise it breaks
510 * the default pin setup at the next load of the driver
511 */
512 if (codec->bus->shutdown)
513 return;
514
515 snd_array_for_each(&codec->init_pins, i, pin) {
516 /* use read here for syncing after issuing each verb */
517 if (pin->nid != mic_pin)
518 snd_hda_codec_read(codec, pin->nid, 0,
519 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
520 }
521
522 codec->pins_shutup = 1;
523 }
524
alc_shutup_pins(struct hda_codec * codec)525 static void alc_shutup_pins(struct hda_codec *codec)
526 {
527 struct alc_spec *spec = codec->spec;
528
529 switch (codec->core.vendor_id) {
530 case 0x10ec0236:
531 case 0x10ec0256:
532 case 0x10ec0283:
533 case 0x10ec0286:
534 case 0x10ec0288:
535 case 0x10ec0298:
536 alc_headset_mic_no_shutup(codec);
537 break;
538 default:
539 if (!spec->no_shutup_pins)
540 snd_hda_shutup_pins(codec);
541 break;
542 }
543 }
544
545 /* generic shutup callback;
546 * just turning off EAPD and a little pause for avoiding pop-noise
547 */
alc_eapd_shutup(struct hda_codec * codec)548 static void alc_eapd_shutup(struct hda_codec *codec)
549 {
550 struct alc_spec *spec = codec->spec;
551
552 alc_auto_setup_eapd(codec, false);
553 if (!spec->no_depop_delay)
554 msleep(200);
555 alc_shutup_pins(codec);
556 }
557
558 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)559 static void alc_auto_init_amp(struct hda_codec *codec, int type)
560 {
561 alc_auto_setup_eapd(codec, true);
562 alc_write_gpio(codec);
563 switch (type) {
564 case ALC_INIT_DEFAULT:
565 switch (codec->core.vendor_id) {
566 case 0x10ec0260:
567 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
568 break;
569 case 0x10ec0880:
570 case 0x10ec0882:
571 case 0x10ec0883:
572 case 0x10ec0885:
573 alc_update_coef_idx(codec, 7, 0, 0x2030);
574 break;
575 case 0x10ec0888:
576 alc888_coef_init(codec);
577 break;
578 }
579 break;
580 }
581 }
582
583 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)584 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
585 {
586 if (spec->gen.autocfg.hp_pins[0])
587 return spec->gen.autocfg.hp_pins[0];
588 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
589 return spec->gen.autocfg.line_out_pins[0];
590 return 0;
591 }
592
593 /*
594 * Realtek SSID verification
595 */
596
597 /* Could be any non-zero and even value. When used as fixup, tells
598 * the driver to ignore any present sku defines.
599 */
600 #define ALC_FIXUP_SKU_IGNORE (2)
601
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)602 static void alc_fixup_sku_ignore(struct hda_codec *codec,
603 const struct hda_fixup *fix, int action)
604 {
605 struct alc_spec *spec = codec->spec;
606 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
607 spec->cdefine.fixup = 1;
608 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
609 }
610 }
611
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)612 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
613 const struct hda_fixup *fix, int action)
614 {
615 struct alc_spec *spec = codec->spec;
616
617 if (action == HDA_FIXUP_ACT_PROBE) {
618 spec->no_depop_delay = 1;
619 codec->depop_delay = 0;
620 }
621 }
622
alc_auto_parse_customize_define(struct hda_codec * codec)623 static int alc_auto_parse_customize_define(struct hda_codec *codec)
624 {
625 unsigned int ass, tmp, i;
626 unsigned nid = 0;
627 struct alc_spec *spec = codec->spec;
628
629 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
630
631 if (spec->cdefine.fixup) {
632 ass = spec->cdefine.sku_cfg;
633 if (ass == ALC_FIXUP_SKU_IGNORE)
634 return -1;
635 goto do_sku;
636 }
637
638 if (!codec->bus->pci)
639 return -1;
640 ass = codec->core.subsystem_id & 0xffff;
641 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
642 goto do_sku;
643
644 nid = 0x1d;
645 if (codec->core.vendor_id == 0x10ec0260)
646 nid = 0x17;
647 ass = snd_hda_codec_get_pincfg(codec, nid);
648
649 if (!(ass & 1)) {
650 codec_info(codec, "%s: SKU not ready 0x%08x\n",
651 codec->core.chip_name, ass);
652 return -1;
653 }
654
655 /* check sum */
656 tmp = 0;
657 for (i = 1; i < 16; i++) {
658 if ((ass >> i) & 1)
659 tmp++;
660 }
661 if (((ass >> 16) & 0xf) != tmp)
662 return -1;
663
664 spec->cdefine.port_connectivity = ass >> 30;
665 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
666 spec->cdefine.check_sum = (ass >> 16) & 0xf;
667 spec->cdefine.customization = ass >> 8;
668 do_sku:
669 spec->cdefine.sku_cfg = ass;
670 spec->cdefine.external_amp = (ass & 0x38) >> 3;
671 spec->cdefine.platform_type = (ass & 0x4) >> 2;
672 spec->cdefine.swap = (ass & 0x2) >> 1;
673 spec->cdefine.override = ass & 0x1;
674
675 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
676 nid, spec->cdefine.sku_cfg);
677 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
678 spec->cdefine.port_connectivity);
679 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
680 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
681 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
682 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
683 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
684 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
685 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
686
687 return 0;
688 }
689
690 /* 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)691 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
692 {
693 int i;
694 for (i = 0; i < nums; i++)
695 if (list[i] == nid)
696 return i;
697 return -1;
698 }
699 /* 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)700 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
701 {
702 return find_idx_in_nid_list(nid, list, nums) >= 0;
703 }
704
705 /* check subsystem ID and set up device-specific initialization;
706 * return 1 if initialized, 0 if invalid SSID
707 */
708 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
709 * 31 ~ 16 : Manufacture ID
710 * 15 ~ 8 : SKU ID
711 * 7 ~ 0 : Assembly ID
712 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
713 */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)714 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
715 {
716 unsigned int ass, tmp, i;
717 unsigned nid;
718 struct alc_spec *spec = codec->spec;
719
720 if (spec->cdefine.fixup) {
721 ass = spec->cdefine.sku_cfg;
722 if (ass == ALC_FIXUP_SKU_IGNORE)
723 return 0;
724 goto do_sku;
725 }
726
727 ass = codec->core.subsystem_id & 0xffff;
728 if (codec->bus->pci &&
729 ass != codec->bus->pci->subsystem_device && (ass & 1))
730 goto do_sku;
731
732 /* invalid SSID, check the special NID pin defcfg instead */
733 /*
734 * 31~30 : port connectivity
735 * 29~21 : reserve
736 * 20 : PCBEEP input
737 * 19~16 : Check sum (15:1)
738 * 15~1 : Custom
739 * 0 : override
740 */
741 nid = 0x1d;
742 if (codec->core.vendor_id == 0x10ec0260)
743 nid = 0x17;
744 ass = snd_hda_codec_get_pincfg(codec, nid);
745 codec_dbg(codec,
746 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
747 ass, nid);
748 if (!(ass & 1))
749 return 0;
750 if ((ass >> 30) != 1) /* no physical connection */
751 return 0;
752
753 /* check sum */
754 tmp = 0;
755 for (i = 1; i < 16; i++) {
756 if ((ass >> i) & 1)
757 tmp++;
758 }
759 if (((ass >> 16) & 0xf) != tmp)
760 return 0;
761 do_sku:
762 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
763 ass & 0xffff, codec->core.vendor_id);
764 /*
765 * 0 : override
766 * 1 : Swap Jack
767 * 2 : 0 --> Desktop, 1 --> Laptop
768 * 3~5 : External Amplifier control
769 * 7~6 : Reserved
770 */
771 tmp = (ass & 0x38) >> 3; /* external Amp control */
772 if (spec->init_amp == ALC_INIT_UNDEFINED) {
773 switch (tmp) {
774 case 1:
775 alc_setup_gpio(codec, 0x01);
776 break;
777 case 3:
778 alc_setup_gpio(codec, 0x02);
779 break;
780 case 7:
781 alc_setup_gpio(codec, 0x03);
782 break;
783 case 5:
784 default:
785 spec->init_amp = ALC_INIT_DEFAULT;
786 break;
787 }
788 }
789
790 /* is laptop or Desktop and enable the function "Mute internal speaker
791 * when the external headphone out jack is plugged"
792 */
793 if (!(ass & 0x8000))
794 return 1;
795 /*
796 * 10~8 : Jack location
797 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
798 * 14~13: Resvered
799 * 15 : 1 --> enable the function "Mute internal speaker
800 * when the external headphone out jack is plugged"
801 */
802 if (!alc_get_hp_pin(spec)) {
803 hda_nid_t nid;
804 tmp = (ass >> 11) & 0x3; /* HP to chassis */
805 nid = ports[tmp];
806 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
807 spec->gen.autocfg.line_outs))
808 return 1;
809 spec->gen.autocfg.hp_pins[0] = nid;
810 }
811 return 1;
812 }
813
814 /* Check the validity of ALC subsystem-id
815 * 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)816 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
817 {
818 if (!alc_subsystem_id(codec, ports)) {
819 struct alc_spec *spec = codec->spec;
820 if (spec->init_amp == ALC_INIT_UNDEFINED) {
821 codec_dbg(codec,
822 "realtek: Enable default setup for auto mode as fallback\n");
823 spec->init_amp = ALC_INIT_DEFAULT;
824 }
825 }
826 }
827
828 /*
829 */
830
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)831 static void alc_fixup_inv_dmic(struct hda_codec *codec,
832 const struct hda_fixup *fix, int action)
833 {
834 struct alc_spec *spec = codec->spec;
835
836 spec->gen.inv_dmic_split = 1;
837 }
838
839
alc_build_controls(struct hda_codec * codec)840 static int alc_build_controls(struct hda_codec *codec)
841 {
842 int err;
843
844 err = snd_hda_gen_build_controls(codec);
845 if (err < 0)
846 return err;
847
848 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
849 return 0;
850 }
851
852
853 /*
854 * Common callbacks
855 */
856
alc_pre_init(struct hda_codec * codec)857 static void alc_pre_init(struct hda_codec *codec)
858 {
859 alc_fill_eapd_coef(codec);
860 }
861
862 #define is_s3_resume(codec) \
863 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
864 #define is_s4_resume(codec) \
865 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
866
alc_init(struct hda_codec * codec)867 static int alc_init(struct hda_codec *codec)
868 {
869 struct alc_spec *spec = codec->spec;
870
871 /* hibernation resume needs the full chip initialization */
872 if (is_s4_resume(codec))
873 alc_pre_init(codec);
874
875 if (spec->init_hook)
876 spec->init_hook(codec);
877
878 spec->gen.skip_verbs = 1; /* applied in below */
879 snd_hda_gen_init(codec);
880 alc_fix_pll(codec);
881 alc_auto_init_amp(codec, spec->init_amp);
882 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
883
884 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
885
886 return 0;
887 }
888
alc_shutup(struct hda_codec * codec)889 static inline void alc_shutup(struct hda_codec *codec)
890 {
891 struct alc_spec *spec = codec->spec;
892
893 if (!snd_hda_get_bool_hint(codec, "shutup"))
894 return; /* disabled explicitly by hints */
895
896 if (spec && spec->shutup)
897 spec->shutup(codec);
898 else
899 alc_shutup_pins(codec);
900 }
901
alc_reboot_notify(struct hda_codec * codec)902 static void alc_reboot_notify(struct hda_codec *codec)
903 {
904 struct alc_spec *spec = codec->spec;
905
906 if (spec && spec->reboot_notify)
907 spec->reboot_notify(codec);
908 else
909 alc_shutup(codec);
910 }
911
912 #define alc_free snd_hda_gen_free
913
914 #ifdef CONFIG_PM
alc_power_eapd(struct hda_codec * codec)915 static void alc_power_eapd(struct hda_codec *codec)
916 {
917 alc_auto_setup_eapd(codec, false);
918 }
919
alc_suspend(struct hda_codec * codec)920 static int alc_suspend(struct hda_codec *codec)
921 {
922 struct alc_spec *spec = codec->spec;
923 alc_shutup(codec);
924 if (spec && spec->power_hook)
925 spec->power_hook(codec);
926 return 0;
927 }
928 #endif
929
930 #ifdef CONFIG_PM
alc_resume(struct hda_codec * codec)931 static int alc_resume(struct hda_codec *codec)
932 {
933 struct alc_spec *spec = codec->spec;
934
935 if (!spec->no_depop_delay)
936 msleep(150); /* to avoid pop noise */
937 codec->patch_ops.init(codec);
938 snd_hda_regmap_sync(codec);
939 hda_call_check_power_status(codec, 0x01);
940 return 0;
941 }
942 #endif
943
944 /*
945 */
946 static const struct hda_codec_ops alc_patch_ops = {
947 .build_controls = alc_build_controls,
948 .build_pcms = snd_hda_gen_build_pcms,
949 .init = alc_init,
950 .free = alc_free,
951 .unsol_event = snd_hda_jack_unsol_event,
952 #ifdef CONFIG_PM
953 .resume = alc_resume,
954 .suspend = alc_suspend,
955 .check_power_status = snd_hda_gen_check_power_status,
956 #endif
957 .reboot_notify = alc_reboot_notify,
958 };
959
960
961 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
962
963 /*
964 * Rename codecs appropriately from COEF value or subvendor id
965 */
966 struct alc_codec_rename_table {
967 unsigned int vendor_id;
968 unsigned short coef_mask;
969 unsigned short coef_bits;
970 const char *name;
971 };
972
973 struct alc_codec_rename_pci_table {
974 unsigned int codec_vendor_id;
975 unsigned short pci_subvendor;
976 unsigned short pci_subdevice;
977 const char *name;
978 };
979
980 static const struct alc_codec_rename_table rename_tbl[] = {
981 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
982 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
983 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
984 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
985 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
986 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
987 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
988 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
989 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
990 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
991 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
992 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
993 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
994 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
995 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
996 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
997 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
998 { } /* terminator */
999 };
1000
1001 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1002 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1003 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1004 { 0x10ec0283, 0x1028, 0, "ALC3223" },
1005 { 0x10ec0288, 0x1028, 0, "ALC3263" },
1006 { 0x10ec0292, 0x1028, 0, "ALC3226" },
1007 { 0x10ec0293, 0x1028, 0, "ALC3235" },
1008 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1009 { 0x10ec0668, 0x1028, 0, "ALC3661" },
1010 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1011 { 0x10ec0899, 0x1028, 0, "ALC3861" },
1012 { 0x10ec0298, 0x1028, 0, "ALC3266" },
1013 { 0x10ec0236, 0x1028, 0, "ALC3204" },
1014 { 0x10ec0256, 0x1028, 0, "ALC3246" },
1015 { 0x10ec0225, 0x1028, 0, "ALC3253" },
1016 { 0x10ec0295, 0x1028, 0, "ALC3254" },
1017 { 0x10ec0299, 0x1028, 0, "ALC3271" },
1018 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1019 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1020 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1021 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1022 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1023 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1024 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1025 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1026 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1027 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1028 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1029 { } /* terminator */
1030 };
1031
alc_codec_rename_from_preset(struct hda_codec * codec)1032 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1033 {
1034 const struct alc_codec_rename_table *p;
1035 const struct alc_codec_rename_pci_table *q;
1036
1037 for (p = rename_tbl; p->vendor_id; p++) {
1038 if (p->vendor_id != codec->core.vendor_id)
1039 continue;
1040 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1041 return alc_codec_rename(codec, p->name);
1042 }
1043
1044 if (!codec->bus->pci)
1045 return 0;
1046 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1047 if (q->codec_vendor_id != codec->core.vendor_id)
1048 continue;
1049 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1050 continue;
1051 if (!q->pci_subdevice ||
1052 q->pci_subdevice == codec->bus->pci->subsystem_device)
1053 return alc_codec_rename(codec, q->name);
1054 }
1055
1056 return 0;
1057 }
1058
1059
1060 /*
1061 * Digital-beep handlers
1062 */
1063 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1064
1065 /* additional beep mixers; private_value will be overwritten */
1066 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1067 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1068 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1069 };
1070
1071 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1072 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1073 int idx, int dir)
1074 {
1075 struct snd_kcontrol_new *knew;
1076 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1077 int i;
1078
1079 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1080 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1081 &alc_beep_mixer[i]);
1082 if (!knew)
1083 return -ENOMEM;
1084 knew->private_value = beep_amp;
1085 }
1086 return 0;
1087 }
1088
1089 static const struct snd_pci_quirk beep_allow_list[] = {
1090 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1091 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1092 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1093 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1094 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1095 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1096 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1097 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1098 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1099 /* denylist -- no beep available */
1100 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1101 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1102 {}
1103 };
1104
has_cdefine_beep(struct hda_codec * codec)1105 static inline int has_cdefine_beep(struct hda_codec *codec)
1106 {
1107 struct alc_spec *spec = codec->spec;
1108 const struct snd_pci_quirk *q;
1109 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1110 if (q)
1111 return q->value;
1112 return spec->cdefine.enable_pcbeep;
1113 }
1114 #else
1115 #define set_beep_amp(spec, nid, idx, dir) 0
1116 #define has_cdefine_beep(codec) 0
1117 #endif
1118
1119 /* parse the BIOS configuration and set up the alc_spec */
1120 /* return 1 if successful, 0 if the proper config is not found,
1121 * or a negative error code
1122 */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1123 static int alc_parse_auto_config(struct hda_codec *codec,
1124 const hda_nid_t *ignore_nids,
1125 const hda_nid_t *ssid_nids)
1126 {
1127 struct alc_spec *spec = codec->spec;
1128 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1129 int err;
1130
1131 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1132 spec->parse_flags);
1133 if (err < 0)
1134 return err;
1135
1136 if (ssid_nids)
1137 alc_ssid_check(codec, ssid_nids);
1138
1139 err = snd_hda_gen_parse_auto_config(codec, cfg);
1140 if (err < 0)
1141 return err;
1142
1143 return 1;
1144 }
1145
1146 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1147 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1148 {
1149 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1150 int err;
1151
1152 if (!spec)
1153 return -ENOMEM;
1154 codec->spec = spec;
1155 snd_hda_gen_spec_init(&spec->gen);
1156 spec->gen.mixer_nid = mixer_nid;
1157 spec->gen.own_eapd_ctl = 1;
1158 codec->single_adc_amp = 1;
1159 /* FIXME: do we need this for all Realtek codec models? */
1160 codec->spdif_status_reset = 1;
1161 codec->forced_resume = 1;
1162 codec->patch_ops = alc_patch_ops;
1163
1164 err = alc_codec_rename_from_preset(codec);
1165 if (err < 0) {
1166 kfree(spec);
1167 return err;
1168 }
1169 return 0;
1170 }
1171
alc880_parse_auto_config(struct hda_codec * codec)1172 static int alc880_parse_auto_config(struct hda_codec *codec)
1173 {
1174 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1175 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1176 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1177 }
1178
1179 /*
1180 * ALC880 fix-ups
1181 */
1182 enum {
1183 ALC880_FIXUP_GPIO1,
1184 ALC880_FIXUP_GPIO2,
1185 ALC880_FIXUP_MEDION_RIM,
1186 ALC880_FIXUP_LG,
1187 ALC880_FIXUP_LG_LW25,
1188 ALC880_FIXUP_W810,
1189 ALC880_FIXUP_EAPD_COEF,
1190 ALC880_FIXUP_TCL_S700,
1191 ALC880_FIXUP_VOL_KNOB,
1192 ALC880_FIXUP_FUJITSU,
1193 ALC880_FIXUP_F1734,
1194 ALC880_FIXUP_UNIWILL,
1195 ALC880_FIXUP_UNIWILL_DIG,
1196 ALC880_FIXUP_Z71V,
1197 ALC880_FIXUP_ASUS_W5A,
1198 ALC880_FIXUP_3ST_BASE,
1199 ALC880_FIXUP_3ST,
1200 ALC880_FIXUP_3ST_DIG,
1201 ALC880_FIXUP_5ST_BASE,
1202 ALC880_FIXUP_5ST,
1203 ALC880_FIXUP_5ST_DIG,
1204 ALC880_FIXUP_6ST_BASE,
1205 ALC880_FIXUP_6ST,
1206 ALC880_FIXUP_6ST_DIG,
1207 ALC880_FIXUP_6ST_AUTOMUTE,
1208 };
1209
1210 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1211 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1212 const struct hda_fixup *fix, int action)
1213 {
1214 if (action == HDA_FIXUP_ACT_PROBE)
1215 snd_hda_jack_detect_enable_callback(codec, 0x21,
1216 alc_update_knob_master);
1217 }
1218
1219 static const struct hda_fixup alc880_fixups[] = {
1220 [ALC880_FIXUP_GPIO1] = {
1221 .type = HDA_FIXUP_FUNC,
1222 .v.func = alc_fixup_gpio1,
1223 },
1224 [ALC880_FIXUP_GPIO2] = {
1225 .type = HDA_FIXUP_FUNC,
1226 .v.func = alc_fixup_gpio2,
1227 },
1228 [ALC880_FIXUP_MEDION_RIM] = {
1229 .type = HDA_FIXUP_VERBS,
1230 .v.verbs = (const struct hda_verb[]) {
1231 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1232 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1233 { }
1234 },
1235 .chained = true,
1236 .chain_id = ALC880_FIXUP_GPIO2,
1237 },
1238 [ALC880_FIXUP_LG] = {
1239 .type = HDA_FIXUP_PINS,
1240 .v.pins = (const struct hda_pintbl[]) {
1241 /* disable bogus unused pins */
1242 { 0x16, 0x411111f0 },
1243 { 0x18, 0x411111f0 },
1244 { 0x1a, 0x411111f0 },
1245 { }
1246 }
1247 },
1248 [ALC880_FIXUP_LG_LW25] = {
1249 .type = HDA_FIXUP_PINS,
1250 .v.pins = (const struct hda_pintbl[]) {
1251 { 0x1a, 0x0181344f }, /* line-in */
1252 { 0x1b, 0x0321403f }, /* headphone */
1253 { }
1254 }
1255 },
1256 [ALC880_FIXUP_W810] = {
1257 .type = HDA_FIXUP_PINS,
1258 .v.pins = (const struct hda_pintbl[]) {
1259 /* disable bogus unused pins */
1260 { 0x17, 0x411111f0 },
1261 { }
1262 },
1263 .chained = true,
1264 .chain_id = ALC880_FIXUP_GPIO2,
1265 },
1266 [ALC880_FIXUP_EAPD_COEF] = {
1267 .type = HDA_FIXUP_VERBS,
1268 .v.verbs = (const struct hda_verb[]) {
1269 /* change to EAPD mode */
1270 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1271 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1272 {}
1273 },
1274 },
1275 [ALC880_FIXUP_TCL_S700] = {
1276 .type = HDA_FIXUP_VERBS,
1277 .v.verbs = (const struct hda_verb[]) {
1278 /* change to EAPD mode */
1279 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1280 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1281 {}
1282 },
1283 .chained = true,
1284 .chain_id = ALC880_FIXUP_GPIO2,
1285 },
1286 [ALC880_FIXUP_VOL_KNOB] = {
1287 .type = HDA_FIXUP_FUNC,
1288 .v.func = alc880_fixup_vol_knob,
1289 },
1290 [ALC880_FIXUP_FUJITSU] = {
1291 /* override all pins as BIOS on old Amilo is broken */
1292 .type = HDA_FIXUP_PINS,
1293 .v.pins = (const struct hda_pintbl[]) {
1294 { 0x14, 0x0121401f }, /* HP */
1295 { 0x15, 0x99030120 }, /* speaker */
1296 { 0x16, 0x99030130 }, /* bass speaker */
1297 { 0x17, 0x411111f0 }, /* N/A */
1298 { 0x18, 0x411111f0 }, /* N/A */
1299 { 0x19, 0x01a19950 }, /* mic-in */
1300 { 0x1a, 0x411111f0 }, /* N/A */
1301 { 0x1b, 0x411111f0 }, /* N/A */
1302 { 0x1c, 0x411111f0 }, /* N/A */
1303 { 0x1d, 0x411111f0 }, /* N/A */
1304 { 0x1e, 0x01454140 }, /* SPDIF out */
1305 { }
1306 },
1307 .chained = true,
1308 .chain_id = ALC880_FIXUP_VOL_KNOB,
1309 },
1310 [ALC880_FIXUP_F1734] = {
1311 /* almost compatible with FUJITSU, but no bass and SPDIF */
1312 .type = HDA_FIXUP_PINS,
1313 .v.pins = (const struct hda_pintbl[]) {
1314 { 0x14, 0x0121401f }, /* HP */
1315 { 0x15, 0x99030120 }, /* speaker */
1316 { 0x16, 0x411111f0 }, /* N/A */
1317 { 0x17, 0x411111f0 }, /* N/A */
1318 { 0x18, 0x411111f0 }, /* N/A */
1319 { 0x19, 0x01a19950 }, /* mic-in */
1320 { 0x1a, 0x411111f0 }, /* N/A */
1321 { 0x1b, 0x411111f0 }, /* N/A */
1322 { 0x1c, 0x411111f0 }, /* N/A */
1323 { 0x1d, 0x411111f0 }, /* N/A */
1324 { 0x1e, 0x411111f0 }, /* N/A */
1325 { }
1326 },
1327 .chained = true,
1328 .chain_id = ALC880_FIXUP_VOL_KNOB,
1329 },
1330 [ALC880_FIXUP_UNIWILL] = {
1331 /* need to fix HP and speaker pins to be parsed correctly */
1332 .type = HDA_FIXUP_PINS,
1333 .v.pins = (const struct hda_pintbl[]) {
1334 { 0x14, 0x0121411f }, /* HP */
1335 { 0x15, 0x99030120 }, /* speaker */
1336 { 0x16, 0x99030130 }, /* bass speaker */
1337 { }
1338 },
1339 },
1340 [ALC880_FIXUP_UNIWILL_DIG] = {
1341 .type = HDA_FIXUP_PINS,
1342 .v.pins = (const struct hda_pintbl[]) {
1343 /* disable bogus unused pins */
1344 { 0x17, 0x411111f0 },
1345 { 0x19, 0x411111f0 },
1346 { 0x1b, 0x411111f0 },
1347 { 0x1f, 0x411111f0 },
1348 { }
1349 }
1350 },
1351 [ALC880_FIXUP_Z71V] = {
1352 .type = HDA_FIXUP_PINS,
1353 .v.pins = (const struct hda_pintbl[]) {
1354 /* set up the whole pins as BIOS is utterly broken */
1355 { 0x14, 0x99030120 }, /* speaker */
1356 { 0x15, 0x0121411f }, /* HP */
1357 { 0x16, 0x411111f0 }, /* N/A */
1358 { 0x17, 0x411111f0 }, /* N/A */
1359 { 0x18, 0x01a19950 }, /* mic-in */
1360 { 0x19, 0x411111f0 }, /* N/A */
1361 { 0x1a, 0x01813031 }, /* line-in */
1362 { 0x1b, 0x411111f0 }, /* N/A */
1363 { 0x1c, 0x411111f0 }, /* N/A */
1364 { 0x1d, 0x411111f0 }, /* N/A */
1365 { 0x1e, 0x0144111e }, /* SPDIF */
1366 { }
1367 }
1368 },
1369 [ALC880_FIXUP_ASUS_W5A] = {
1370 .type = HDA_FIXUP_PINS,
1371 .v.pins = (const struct hda_pintbl[]) {
1372 /* set up the whole pins as BIOS is utterly broken */
1373 { 0x14, 0x0121411f }, /* HP */
1374 { 0x15, 0x411111f0 }, /* N/A */
1375 { 0x16, 0x411111f0 }, /* N/A */
1376 { 0x17, 0x411111f0 }, /* N/A */
1377 { 0x18, 0x90a60160 }, /* mic */
1378 { 0x19, 0x411111f0 }, /* N/A */
1379 { 0x1a, 0x411111f0 }, /* N/A */
1380 { 0x1b, 0x411111f0 }, /* N/A */
1381 { 0x1c, 0x411111f0 }, /* N/A */
1382 { 0x1d, 0x411111f0 }, /* N/A */
1383 { 0x1e, 0xb743111e }, /* SPDIF out */
1384 { }
1385 },
1386 .chained = true,
1387 .chain_id = ALC880_FIXUP_GPIO1,
1388 },
1389 [ALC880_FIXUP_3ST_BASE] = {
1390 .type = HDA_FIXUP_PINS,
1391 .v.pins = (const struct hda_pintbl[]) {
1392 { 0x14, 0x01014010 }, /* line-out */
1393 { 0x15, 0x411111f0 }, /* N/A */
1394 { 0x16, 0x411111f0 }, /* N/A */
1395 { 0x17, 0x411111f0 }, /* N/A */
1396 { 0x18, 0x01a19c30 }, /* mic-in */
1397 { 0x19, 0x0121411f }, /* HP */
1398 { 0x1a, 0x01813031 }, /* line-in */
1399 { 0x1b, 0x02a19c40 }, /* front-mic */
1400 { 0x1c, 0x411111f0 }, /* N/A */
1401 { 0x1d, 0x411111f0 }, /* N/A */
1402 /* 0x1e is filled in below */
1403 { 0x1f, 0x411111f0 }, /* N/A */
1404 { }
1405 }
1406 },
1407 [ALC880_FIXUP_3ST] = {
1408 .type = HDA_FIXUP_PINS,
1409 .v.pins = (const struct hda_pintbl[]) {
1410 { 0x1e, 0x411111f0 }, /* N/A */
1411 { }
1412 },
1413 .chained = true,
1414 .chain_id = ALC880_FIXUP_3ST_BASE,
1415 },
1416 [ALC880_FIXUP_3ST_DIG] = {
1417 .type = HDA_FIXUP_PINS,
1418 .v.pins = (const struct hda_pintbl[]) {
1419 { 0x1e, 0x0144111e }, /* SPDIF */
1420 { }
1421 },
1422 .chained = true,
1423 .chain_id = ALC880_FIXUP_3ST_BASE,
1424 },
1425 [ALC880_FIXUP_5ST_BASE] = {
1426 .type = HDA_FIXUP_PINS,
1427 .v.pins = (const struct hda_pintbl[]) {
1428 { 0x14, 0x01014010 }, /* front */
1429 { 0x15, 0x411111f0 }, /* N/A */
1430 { 0x16, 0x01011411 }, /* CLFE */
1431 { 0x17, 0x01016412 }, /* surr */
1432 { 0x18, 0x01a19c30 }, /* mic-in */
1433 { 0x19, 0x0121411f }, /* HP */
1434 { 0x1a, 0x01813031 }, /* line-in */
1435 { 0x1b, 0x02a19c40 }, /* front-mic */
1436 { 0x1c, 0x411111f0 }, /* N/A */
1437 { 0x1d, 0x411111f0 }, /* N/A */
1438 /* 0x1e is filled in below */
1439 { 0x1f, 0x411111f0 }, /* N/A */
1440 { }
1441 }
1442 },
1443 [ALC880_FIXUP_5ST] = {
1444 .type = HDA_FIXUP_PINS,
1445 .v.pins = (const struct hda_pintbl[]) {
1446 { 0x1e, 0x411111f0 }, /* N/A */
1447 { }
1448 },
1449 .chained = true,
1450 .chain_id = ALC880_FIXUP_5ST_BASE,
1451 },
1452 [ALC880_FIXUP_5ST_DIG] = {
1453 .type = HDA_FIXUP_PINS,
1454 .v.pins = (const struct hda_pintbl[]) {
1455 { 0x1e, 0x0144111e }, /* SPDIF */
1456 { }
1457 },
1458 .chained = true,
1459 .chain_id = ALC880_FIXUP_5ST_BASE,
1460 },
1461 [ALC880_FIXUP_6ST_BASE] = {
1462 .type = HDA_FIXUP_PINS,
1463 .v.pins = (const struct hda_pintbl[]) {
1464 { 0x14, 0x01014010 }, /* front */
1465 { 0x15, 0x01016412 }, /* surr */
1466 { 0x16, 0x01011411 }, /* CLFE */
1467 { 0x17, 0x01012414 }, /* side */
1468 { 0x18, 0x01a19c30 }, /* mic-in */
1469 { 0x19, 0x02a19c40 }, /* front-mic */
1470 { 0x1a, 0x01813031 }, /* line-in */
1471 { 0x1b, 0x0121411f }, /* HP */
1472 { 0x1c, 0x411111f0 }, /* N/A */
1473 { 0x1d, 0x411111f0 }, /* N/A */
1474 /* 0x1e is filled in below */
1475 { 0x1f, 0x411111f0 }, /* N/A */
1476 { }
1477 }
1478 },
1479 [ALC880_FIXUP_6ST] = {
1480 .type = HDA_FIXUP_PINS,
1481 .v.pins = (const struct hda_pintbl[]) {
1482 { 0x1e, 0x411111f0 }, /* N/A */
1483 { }
1484 },
1485 .chained = true,
1486 .chain_id = ALC880_FIXUP_6ST_BASE,
1487 },
1488 [ALC880_FIXUP_6ST_DIG] = {
1489 .type = HDA_FIXUP_PINS,
1490 .v.pins = (const struct hda_pintbl[]) {
1491 { 0x1e, 0x0144111e }, /* SPDIF */
1492 { }
1493 },
1494 .chained = true,
1495 .chain_id = ALC880_FIXUP_6ST_BASE,
1496 },
1497 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1498 .type = HDA_FIXUP_PINS,
1499 .v.pins = (const struct hda_pintbl[]) {
1500 { 0x1b, 0x0121401f }, /* HP with jack detect */
1501 { }
1502 },
1503 .chained_before = true,
1504 .chain_id = ALC880_FIXUP_6ST_BASE,
1505 },
1506 };
1507
1508 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1509 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1510 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1511 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1512 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1513 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1514 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1515 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1516 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1517 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1518 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1519 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1520 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1521 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1522 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1523 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1524 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1525 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1526 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1527 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1528 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1529 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1530 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1531 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1532
1533 /* Below is the copied entries from alc880_quirks.c.
1534 * It's not quite sure whether BIOS sets the correct pin-config table
1535 * on these machines, thus they are kept to be compatible with
1536 * the old static quirks. Once when it's confirmed to work without
1537 * these overrides, it'd be better to remove.
1538 */
1539 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1540 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1541 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1542 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1543 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1544 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1545 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1546 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1547 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1548 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1549 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1550 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1551 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1552 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1553 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1554 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1555 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1556 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1557 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1558 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1559 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1560 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1561 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1563 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1564 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1565 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1566 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1567 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1568 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1569 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1570 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1571 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1572 /* default Intel */
1573 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1574 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1575 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1576 {}
1577 };
1578
1579 static const struct hda_model_fixup alc880_fixup_models[] = {
1580 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1581 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1582 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1583 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1584 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1585 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1586 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1587 {}
1588 };
1589
1590
1591 /*
1592 * OK, here we have finally the patch for ALC880
1593 */
patch_alc880(struct hda_codec * codec)1594 static int patch_alc880(struct hda_codec *codec)
1595 {
1596 struct alc_spec *spec;
1597 int err;
1598
1599 err = alc_alloc_spec(codec, 0x0b);
1600 if (err < 0)
1601 return err;
1602
1603 spec = codec->spec;
1604 spec->gen.need_dac_fix = 1;
1605 spec->gen.beep_nid = 0x01;
1606
1607 codec->patch_ops.unsol_event = alc880_unsol_event;
1608
1609 alc_pre_init(codec);
1610
1611 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1612 alc880_fixups);
1613 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1614
1615 /* automatic parse from the BIOS config */
1616 err = alc880_parse_auto_config(codec);
1617 if (err < 0)
1618 goto error;
1619
1620 if (!spec->gen.no_analog) {
1621 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1622 if (err < 0)
1623 goto error;
1624 }
1625
1626 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1627
1628 return 0;
1629
1630 error:
1631 alc_free(codec);
1632 return err;
1633 }
1634
1635
1636 /*
1637 * ALC260 support
1638 */
alc260_parse_auto_config(struct hda_codec * codec)1639 static int alc260_parse_auto_config(struct hda_codec *codec)
1640 {
1641 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1642 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1643 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1644 }
1645
1646 /*
1647 * Pin config fixes
1648 */
1649 enum {
1650 ALC260_FIXUP_HP_DC5750,
1651 ALC260_FIXUP_HP_PIN_0F,
1652 ALC260_FIXUP_COEF,
1653 ALC260_FIXUP_GPIO1,
1654 ALC260_FIXUP_GPIO1_TOGGLE,
1655 ALC260_FIXUP_REPLACER,
1656 ALC260_FIXUP_HP_B1900,
1657 ALC260_FIXUP_KN1,
1658 ALC260_FIXUP_FSC_S7020,
1659 ALC260_FIXUP_FSC_S7020_JWSE,
1660 ALC260_FIXUP_VAIO_PINS,
1661 };
1662
alc260_gpio1_automute(struct hda_codec * codec)1663 static void alc260_gpio1_automute(struct hda_codec *codec)
1664 {
1665 struct alc_spec *spec = codec->spec;
1666
1667 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1668 }
1669
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1670 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1671 const struct hda_fixup *fix, int action)
1672 {
1673 struct alc_spec *spec = codec->spec;
1674 if (action == HDA_FIXUP_ACT_PROBE) {
1675 /* although the machine has only one output pin, we need to
1676 * toggle GPIO1 according to the jack state
1677 */
1678 spec->gen.automute_hook = alc260_gpio1_automute;
1679 spec->gen.detect_hp = 1;
1680 spec->gen.automute_speaker = 1;
1681 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1682 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1683 snd_hda_gen_hp_automute);
1684 alc_setup_gpio(codec, 0x01);
1685 }
1686 }
1687
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1688 static void alc260_fixup_kn1(struct hda_codec *codec,
1689 const struct hda_fixup *fix, int action)
1690 {
1691 struct alc_spec *spec = codec->spec;
1692 static const struct hda_pintbl pincfgs[] = {
1693 { 0x0f, 0x02214000 }, /* HP/speaker */
1694 { 0x12, 0x90a60160 }, /* int mic */
1695 { 0x13, 0x02a19000 }, /* ext mic */
1696 { 0x18, 0x01446000 }, /* SPDIF out */
1697 /* disable bogus I/O pins */
1698 { 0x10, 0x411111f0 },
1699 { 0x11, 0x411111f0 },
1700 { 0x14, 0x411111f0 },
1701 { 0x15, 0x411111f0 },
1702 { 0x16, 0x411111f0 },
1703 { 0x17, 0x411111f0 },
1704 { 0x19, 0x411111f0 },
1705 { }
1706 };
1707
1708 switch (action) {
1709 case HDA_FIXUP_ACT_PRE_PROBE:
1710 snd_hda_apply_pincfgs(codec, pincfgs);
1711 spec->init_amp = ALC_INIT_NONE;
1712 break;
1713 }
1714 }
1715
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1716 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1717 const struct hda_fixup *fix, int action)
1718 {
1719 struct alc_spec *spec = codec->spec;
1720 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1721 spec->init_amp = ALC_INIT_NONE;
1722 }
1723
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1724 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1725 const struct hda_fixup *fix, int action)
1726 {
1727 struct alc_spec *spec = codec->spec;
1728 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1729 spec->gen.add_jack_modes = 1;
1730 spec->gen.hp_mic = 1;
1731 }
1732 }
1733
1734 static const struct hda_fixup alc260_fixups[] = {
1735 [ALC260_FIXUP_HP_DC5750] = {
1736 .type = HDA_FIXUP_PINS,
1737 .v.pins = (const struct hda_pintbl[]) {
1738 { 0x11, 0x90130110 }, /* speaker */
1739 { }
1740 }
1741 },
1742 [ALC260_FIXUP_HP_PIN_0F] = {
1743 .type = HDA_FIXUP_PINS,
1744 .v.pins = (const struct hda_pintbl[]) {
1745 { 0x0f, 0x01214000 }, /* HP */
1746 { }
1747 }
1748 },
1749 [ALC260_FIXUP_COEF] = {
1750 .type = HDA_FIXUP_VERBS,
1751 .v.verbs = (const struct hda_verb[]) {
1752 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1753 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1754 { }
1755 },
1756 },
1757 [ALC260_FIXUP_GPIO1] = {
1758 .type = HDA_FIXUP_FUNC,
1759 .v.func = alc_fixup_gpio1,
1760 },
1761 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1762 .type = HDA_FIXUP_FUNC,
1763 .v.func = alc260_fixup_gpio1_toggle,
1764 .chained = true,
1765 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1766 },
1767 [ALC260_FIXUP_REPLACER] = {
1768 .type = HDA_FIXUP_VERBS,
1769 .v.verbs = (const struct hda_verb[]) {
1770 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1771 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1772 { }
1773 },
1774 .chained = true,
1775 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1776 },
1777 [ALC260_FIXUP_HP_B1900] = {
1778 .type = HDA_FIXUP_FUNC,
1779 .v.func = alc260_fixup_gpio1_toggle,
1780 .chained = true,
1781 .chain_id = ALC260_FIXUP_COEF,
1782 },
1783 [ALC260_FIXUP_KN1] = {
1784 .type = HDA_FIXUP_FUNC,
1785 .v.func = alc260_fixup_kn1,
1786 },
1787 [ALC260_FIXUP_FSC_S7020] = {
1788 .type = HDA_FIXUP_FUNC,
1789 .v.func = alc260_fixup_fsc_s7020,
1790 },
1791 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1792 .type = HDA_FIXUP_FUNC,
1793 .v.func = alc260_fixup_fsc_s7020_jwse,
1794 .chained = true,
1795 .chain_id = ALC260_FIXUP_FSC_S7020,
1796 },
1797 [ALC260_FIXUP_VAIO_PINS] = {
1798 .type = HDA_FIXUP_PINS,
1799 .v.pins = (const struct hda_pintbl[]) {
1800 /* Pin configs are missing completely on some VAIOs */
1801 { 0x0f, 0x01211020 },
1802 { 0x10, 0x0001003f },
1803 { 0x11, 0x411111f0 },
1804 { 0x12, 0x01a15930 },
1805 { 0x13, 0x411111f0 },
1806 { 0x14, 0x411111f0 },
1807 { 0x15, 0x411111f0 },
1808 { 0x16, 0x411111f0 },
1809 { 0x17, 0x411111f0 },
1810 { 0x18, 0x411111f0 },
1811 { 0x19, 0x411111f0 },
1812 { }
1813 }
1814 },
1815 };
1816
1817 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1818 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1819 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1820 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1821 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1822 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1823 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1824 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1825 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1826 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1827 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1828 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1829 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1830 {}
1831 };
1832
1833 static const struct hda_model_fixup alc260_fixup_models[] = {
1834 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1835 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1836 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1837 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1838 {}
1839 };
1840
1841 /*
1842 */
patch_alc260(struct hda_codec * codec)1843 static int patch_alc260(struct hda_codec *codec)
1844 {
1845 struct alc_spec *spec;
1846 int err;
1847
1848 err = alc_alloc_spec(codec, 0x07);
1849 if (err < 0)
1850 return err;
1851
1852 spec = codec->spec;
1853 /* as quite a few machines require HP amp for speaker outputs,
1854 * it's easier to enable it unconditionally; even if it's unneeded,
1855 * it's almost harmless.
1856 */
1857 spec->gen.prefer_hp_amp = 1;
1858 spec->gen.beep_nid = 0x01;
1859
1860 spec->shutup = alc_eapd_shutup;
1861
1862 alc_pre_init(codec);
1863
1864 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1865 alc260_fixups);
1866 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1867
1868 /* automatic parse from the BIOS config */
1869 err = alc260_parse_auto_config(codec);
1870 if (err < 0)
1871 goto error;
1872
1873 if (!spec->gen.no_analog) {
1874 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1875 if (err < 0)
1876 goto error;
1877 }
1878
1879 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1880
1881 return 0;
1882
1883 error:
1884 alc_free(codec);
1885 return err;
1886 }
1887
1888
1889 /*
1890 * ALC882/883/885/888/889 support
1891 *
1892 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1893 * configuration. Each pin widget can choose any input DACs and a mixer.
1894 * Each ADC is connected from a mixer of all inputs. This makes possible
1895 * 6-channel independent captures.
1896 *
1897 * In addition, an independent DAC for the multi-playback (not used in this
1898 * driver yet).
1899 */
1900
1901 /*
1902 * Pin config fixes
1903 */
1904 enum {
1905 ALC882_FIXUP_ABIT_AW9D_MAX,
1906 ALC882_FIXUP_LENOVO_Y530,
1907 ALC882_FIXUP_PB_M5210,
1908 ALC882_FIXUP_ACER_ASPIRE_7736,
1909 ALC882_FIXUP_ASUS_W90V,
1910 ALC889_FIXUP_CD,
1911 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1912 ALC889_FIXUP_VAIO_TT,
1913 ALC888_FIXUP_EEE1601,
1914 ALC886_FIXUP_EAPD,
1915 ALC882_FIXUP_EAPD,
1916 ALC883_FIXUP_EAPD,
1917 ALC883_FIXUP_ACER_EAPD,
1918 ALC882_FIXUP_GPIO1,
1919 ALC882_FIXUP_GPIO2,
1920 ALC882_FIXUP_GPIO3,
1921 ALC889_FIXUP_COEF,
1922 ALC882_FIXUP_ASUS_W2JC,
1923 ALC882_FIXUP_ACER_ASPIRE_4930G,
1924 ALC882_FIXUP_ACER_ASPIRE_8930G,
1925 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1926 ALC885_FIXUP_MACPRO_GPIO,
1927 ALC889_FIXUP_DAC_ROUTE,
1928 ALC889_FIXUP_MBP_VREF,
1929 ALC889_FIXUP_IMAC91_VREF,
1930 ALC889_FIXUP_MBA11_VREF,
1931 ALC889_FIXUP_MBA21_VREF,
1932 ALC889_FIXUP_MP11_VREF,
1933 ALC889_FIXUP_MP41_VREF,
1934 ALC882_FIXUP_INV_DMIC,
1935 ALC882_FIXUP_NO_PRIMARY_HP,
1936 ALC887_FIXUP_ASUS_BASS,
1937 ALC887_FIXUP_BASS_CHMAP,
1938 ALC1220_FIXUP_GB_DUAL_CODECS,
1939 ALC1220_FIXUP_GB_X570,
1940 ALC1220_FIXUP_CLEVO_P950,
1941 ALC1220_FIXUP_CLEVO_PB51ED,
1942 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1943 ALC887_FIXUP_ASUS_AUDIO,
1944 ALC887_FIXUP_ASUS_HMIC,
1945 };
1946
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)1947 static void alc889_fixup_coef(struct hda_codec *codec,
1948 const struct hda_fixup *fix, int action)
1949 {
1950 if (action != HDA_FIXUP_ACT_INIT)
1951 return;
1952 alc_update_coef_idx(codec, 7, 0, 0x2030);
1953 }
1954
1955 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)1956 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1957 const struct hda_fixup *fix, int action)
1958 {
1959 struct alc_spec *spec = codec->spec;
1960
1961 spec->gpio_write_delay = true;
1962 alc_fixup_gpio3(codec, fix, action);
1963 }
1964
1965 /* Fix the connection of some pins for ALC889:
1966 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1967 * work correctly (bko#42740)
1968 */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)1969 static void alc889_fixup_dac_route(struct hda_codec *codec,
1970 const struct hda_fixup *fix, int action)
1971 {
1972 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1973 /* fake the connections during parsing the tree */
1974 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1975 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1976 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1977 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1978 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1979 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
1980 } else if (action == HDA_FIXUP_ACT_PROBE) {
1981 /* restore the connections */
1982 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1983 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1984 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1985 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1986 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
1987 }
1988 }
1989
1990 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)1991 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1992 const struct hda_fixup *fix, int action)
1993 {
1994 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
1995 struct alc_spec *spec = codec->spec;
1996 int i;
1997
1998 if (action != HDA_FIXUP_ACT_INIT)
1999 return;
2000 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2001 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2002 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2003 continue;
2004 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2005 val |= AC_PINCTL_VREF_80;
2006 snd_hda_set_pin_ctl(codec, nids[i], val);
2007 spec->gen.keep_vref_in_automute = 1;
2008 break;
2009 }
2010 }
2011
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2012 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2013 const hda_nid_t *nids, int num_nids)
2014 {
2015 struct alc_spec *spec = codec->spec;
2016 int i;
2017
2018 for (i = 0; i < num_nids; i++) {
2019 unsigned int val;
2020 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2021 val |= AC_PINCTL_VREF_50;
2022 snd_hda_set_pin_ctl(codec, nids[i], val);
2023 }
2024 spec->gen.keep_vref_in_automute = 1;
2025 }
2026
2027 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2028 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2029 const struct hda_fixup *fix, int action)
2030 {
2031 static const hda_nid_t nids[] = { 0x18, 0x1a };
2032
2033 if (action == HDA_FIXUP_ACT_INIT)
2034 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2035 }
2036
2037 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2038 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2039 const struct hda_fixup *fix, int action)
2040 {
2041 static const hda_nid_t nids[] = { 0x18 };
2042
2043 if (action == HDA_FIXUP_ACT_INIT)
2044 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2045 }
2046
2047 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2048 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2049 const struct hda_fixup *fix, int action)
2050 {
2051 static const hda_nid_t nids[] = { 0x18, 0x19 };
2052
2053 if (action == HDA_FIXUP_ACT_INIT)
2054 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2055 }
2056
2057 /* Don't take HP output as primary
2058 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2059 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2060 */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2061 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2062 const struct hda_fixup *fix, int action)
2063 {
2064 struct alc_spec *spec = codec->spec;
2065 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2066 spec->gen.no_primary_hp = 1;
2067 spec->gen.no_multi_io = 1;
2068 }
2069 }
2070
2071 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2072 const struct hda_fixup *fix, int action);
2073
2074 /* For dual-codec configuration, we need to disable some features to avoid
2075 * conflicts of kctls and PCM streams
2076 */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2077 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2078 const struct hda_fixup *fix, int action)
2079 {
2080 struct alc_spec *spec = codec->spec;
2081
2082 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2083 return;
2084 /* disable vmaster */
2085 spec->gen.suppress_vmaster = 1;
2086 /* auto-mute and auto-mic switch don't work with multiple codecs */
2087 spec->gen.suppress_auto_mute = 1;
2088 spec->gen.suppress_auto_mic = 1;
2089 /* disable aamix as well */
2090 spec->gen.mixer_nid = 0;
2091 /* add location prefix to avoid conflicts */
2092 codec->force_pin_prefix = 1;
2093 }
2094
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2095 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2096 const char *newname)
2097 {
2098 struct snd_kcontrol *kctl;
2099
2100 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2101 if (kctl)
2102 strcpy(kctl->id.name, newname);
2103 }
2104
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2105 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2106 const struct hda_fixup *fix,
2107 int action)
2108 {
2109 alc_fixup_dual_codecs(codec, fix, action);
2110 switch (action) {
2111 case HDA_FIXUP_ACT_PRE_PROBE:
2112 /* override card longname to provide a unique UCM profile */
2113 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2114 break;
2115 case HDA_FIXUP_ACT_BUILD:
2116 /* rename Capture controls depending on the codec */
2117 rename_ctl(codec, "Capture Volume",
2118 codec->addr == 0 ?
2119 "Rear-Panel Capture Volume" :
2120 "Front-Panel Capture Volume");
2121 rename_ctl(codec, "Capture Switch",
2122 codec->addr == 0 ?
2123 "Rear-Panel Capture Switch" :
2124 "Front-Panel Capture Switch");
2125 break;
2126 }
2127 }
2128
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2129 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2130 const struct hda_fixup *fix,
2131 int action)
2132 {
2133 static const hda_nid_t conn1[] = { 0x0c };
2134 static const struct coef_fw gb_x570_coefs[] = {
2135 WRITE_COEF(0x1a, 0x01c1),
2136 WRITE_COEF(0x1b, 0x0202),
2137 WRITE_COEF(0x43, 0x3005),
2138 {}
2139 };
2140
2141 switch (action) {
2142 case HDA_FIXUP_ACT_PRE_PROBE:
2143 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2144 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2145 break;
2146 case HDA_FIXUP_ACT_INIT:
2147 alc_process_coef_fw(codec, gb_x570_coefs);
2148 break;
2149 }
2150 }
2151
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2152 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2153 const struct hda_fixup *fix,
2154 int action)
2155 {
2156 static const hda_nid_t conn1[] = { 0x0c };
2157
2158 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2159 return;
2160
2161 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2162 /* We therefore want to make sure 0x14 (front headphone) and
2163 * 0x1b (speakers) use the stereo DAC 0x02
2164 */
2165 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2166 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2167 }
2168
2169 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2170 const struct hda_fixup *fix, int action);
2171
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2172 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2173 const struct hda_fixup *fix,
2174 int action)
2175 {
2176 alc1220_fixup_clevo_p950(codec, fix, action);
2177 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2178 }
2179
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2180 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2181 struct hda_jack_callback *jack)
2182 {
2183 struct alc_spec *spec = codec->spec;
2184 unsigned int vref;
2185
2186 snd_hda_gen_hp_automute(codec, jack);
2187
2188 if (spec->gen.hp_jack_present)
2189 vref = AC_PINCTL_VREF_80;
2190 else
2191 vref = AC_PINCTL_VREF_HIZ;
2192 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2193 }
2194
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2195 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2196 const struct hda_fixup *fix, int action)
2197 {
2198 struct alc_spec *spec = codec->spec;
2199 if (action != HDA_FIXUP_ACT_PROBE)
2200 return;
2201 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2202 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2203 }
2204
2205 static const struct hda_fixup alc882_fixups[] = {
2206 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2207 .type = HDA_FIXUP_PINS,
2208 .v.pins = (const struct hda_pintbl[]) {
2209 { 0x15, 0x01080104 }, /* side */
2210 { 0x16, 0x01011012 }, /* rear */
2211 { 0x17, 0x01016011 }, /* clfe */
2212 { }
2213 }
2214 },
2215 [ALC882_FIXUP_LENOVO_Y530] = {
2216 .type = HDA_FIXUP_PINS,
2217 .v.pins = (const struct hda_pintbl[]) {
2218 { 0x15, 0x99130112 }, /* rear int speakers */
2219 { 0x16, 0x99130111 }, /* subwoofer */
2220 { }
2221 }
2222 },
2223 [ALC882_FIXUP_PB_M5210] = {
2224 .type = HDA_FIXUP_PINCTLS,
2225 .v.pins = (const struct hda_pintbl[]) {
2226 { 0x19, PIN_VREF50 },
2227 {}
2228 }
2229 },
2230 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2231 .type = HDA_FIXUP_FUNC,
2232 .v.func = alc_fixup_sku_ignore,
2233 },
2234 [ALC882_FIXUP_ASUS_W90V] = {
2235 .type = HDA_FIXUP_PINS,
2236 .v.pins = (const struct hda_pintbl[]) {
2237 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2238 { }
2239 }
2240 },
2241 [ALC889_FIXUP_CD] = {
2242 .type = HDA_FIXUP_PINS,
2243 .v.pins = (const struct hda_pintbl[]) {
2244 { 0x1c, 0x993301f0 }, /* CD */
2245 { }
2246 }
2247 },
2248 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2249 .type = HDA_FIXUP_PINS,
2250 .v.pins = (const struct hda_pintbl[]) {
2251 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2252 { }
2253 },
2254 .chained = true,
2255 .chain_id = ALC889_FIXUP_CD,
2256 },
2257 [ALC889_FIXUP_VAIO_TT] = {
2258 .type = HDA_FIXUP_PINS,
2259 .v.pins = (const struct hda_pintbl[]) {
2260 { 0x17, 0x90170111 }, /* hidden surround speaker */
2261 { }
2262 }
2263 },
2264 [ALC888_FIXUP_EEE1601] = {
2265 .type = HDA_FIXUP_VERBS,
2266 .v.verbs = (const struct hda_verb[]) {
2267 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2268 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2269 { }
2270 }
2271 },
2272 [ALC886_FIXUP_EAPD] = {
2273 .type = HDA_FIXUP_VERBS,
2274 .v.verbs = (const struct hda_verb[]) {
2275 /* change to EAPD mode */
2276 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2277 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2278 { }
2279 }
2280 },
2281 [ALC882_FIXUP_EAPD] = {
2282 .type = HDA_FIXUP_VERBS,
2283 .v.verbs = (const struct hda_verb[]) {
2284 /* change to EAPD mode */
2285 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2286 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2287 { }
2288 }
2289 },
2290 [ALC883_FIXUP_EAPD] = {
2291 .type = HDA_FIXUP_VERBS,
2292 .v.verbs = (const struct hda_verb[]) {
2293 /* change to EAPD mode */
2294 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2295 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2296 { }
2297 }
2298 },
2299 [ALC883_FIXUP_ACER_EAPD] = {
2300 .type = HDA_FIXUP_VERBS,
2301 .v.verbs = (const struct hda_verb[]) {
2302 /* eanable EAPD on Acer laptops */
2303 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2304 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2305 { }
2306 }
2307 },
2308 [ALC882_FIXUP_GPIO1] = {
2309 .type = HDA_FIXUP_FUNC,
2310 .v.func = alc_fixup_gpio1,
2311 },
2312 [ALC882_FIXUP_GPIO2] = {
2313 .type = HDA_FIXUP_FUNC,
2314 .v.func = alc_fixup_gpio2,
2315 },
2316 [ALC882_FIXUP_GPIO3] = {
2317 .type = HDA_FIXUP_FUNC,
2318 .v.func = alc_fixup_gpio3,
2319 },
2320 [ALC882_FIXUP_ASUS_W2JC] = {
2321 .type = HDA_FIXUP_FUNC,
2322 .v.func = alc_fixup_gpio1,
2323 .chained = true,
2324 .chain_id = ALC882_FIXUP_EAPD,
2325 },
2326 [ALC889_FIXUP_COEF] = {
2327 .type = HDA_FIXUP_FUNC,
2328 .v.func = alc889_fixup_coef,
2329 },
2330 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2331 .type = HDA_FIXUP_PINS,
2332 .v.pins = (const struct hda_pintbl[]) {
2333 { 0x16, 0x99130111 }, /* CLFE speaker */
2334 { 0x17, 0x99130112 }, /* surround speaker */
2335 { }
2336 },
2337 .chained = true,
2338 .chain_id = ALC882_FIXUP_GPIO1,
2339 },
2340 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2341 .type = HDA_FIXUP_PINS,
2342 .v.pins = (const struct hda_pintbl[]) {
2343 { 0x16, 0x99130111 }, /* CLFE speaker */
2344 { 0x1b, 0x99130112 }, /* surround speaker */
2345 { }
2346 },
2347 .chained = true,
2348 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2349 },
2350 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2351 /* additional init verbs for Acer Aspire 8930G */
2352 .type = HDA_FIXUP_VERBS,
2353 .v.verbs = (const struct hda_verb[]) {
2354 /* Enable all DACs */
2355 /* DAC DISABLE/MUTE 1? */
2356 /* setting bits 1-5 disables DAC nids 0x02-0x06
2357 * apparently. Init=0x38 */
2358 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2359 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2360 /* DAC DISABLE/MUTE 2? */
2361 /* some bit here disables the other DACs.
2362 * Init=0x4900 */
2363 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2364 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2365 /* DMIC fix
2366 * This laptop has a stereo digital microphone.
2367 * The mics are only 1cm apart which makes the stereo
2368 * useless. However, either the mic or the ALC889
2369 * makes the signal become a difference/sum signal
2370 * instead of standard stereo, which is annoying.
2371 * So instead we flip this bit which makes the
2372 * codec replicate the sum signal to both channels,
2373 * turning it into a normal mono mic.
2374 */
2375 /* DMIC_CONTROL? Init value = 0x0001 */
2376 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2377 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2378 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2379 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2380 { }
2381 },
2382 .chained = true,
2383 .chain_id = ALC882_FIXUP_GPIO1,
2384 },
2385 [ALC885_FIXUP_MACPRO_GPIO] = {
2386 .type = HDA_FIXUP_FUNC,
2387 .v.func = alc885_fixup_macpro_gpio,
2388 },
2389 [ALC889_FIXUP_DAC_ROUTE] = {
2390 .type = HDA_FIXUP_FUNC,
2391 .v.func = alc889_fixup_dac_route,
2392 },
2393 [ALC889_FIXUP_MBP_VREF] = {
2394 .type = HDA_FIXUP_FUNC,
2395 .v.func = alc889_fixup_mbp_vref,
2396 .chained = true,
2397 .chain_id = ALC882_FIXUP_GPIO1,
2398 },
2399 [ALC889_FIXUP_IMAC91_VREF] = {
2400 .type = HDA_FIXUP_FUNC,
2401 .v.func = alc889_fixup_imac91_vref,
2402 .chained = true,
2403 .chain_id = ALC882_FIXUP_GPIO1,
2404 },
2405 [ALC889_FIXUP_MBA11_VREF] = {
2406 .type = HDA_FIXUP_FUNC,
2407 .v.func = alc889_fixup_mba11_vref,
2408 .chained = true,
2409 .chain_id = ALC889_FIXUP_MBP_VREF,
2410 },
2411 [ALC889_FIXUP_MBA21_VREF] = {
2412 .type = HDA_FIXUP_FUNC,
2413 .v.func = alc889_fixup_mba21_vref,
2414 .chained = true,
2415 .chain_id = ALC889_FIXUP_MBP_VREF,
2416 },
2417 [ALC889_FIXUP_MP11_VREF] = {
2418 .type = HDA_FIXUP_FUNC,
2419 .v.func = alc889_fixup_mba11_vref,
2420 .chained = true,
2421 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2422 },
2423 [ALC889_FIXUP_MP41_VREF] = {
2424 .type = HDA_FIXUP_FUNC,
2425 .v.func = alc889_fixup_mbp_vref,
2426 .chained = true,
2427 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2428 },
2429 [ALC882_FIXUP_INV_DMIC] = {
2430 .type = HDA_FIXUP_FUNC,
2431 .v.func = alc_fixup_inv_dmic,
2432 },
2433 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2434 .type = HDA_FIXUP_FUNC,
2435 .v.func = alc882_fixup_no_primary_hp,
2436 },
2437 [ALC887_FIXUP_ASUS_BASS] = {
2438 .type = HDA_FIXUP_PINS,
2439 .v.pins = (const struct hda_pintbl[]) {
2440 {0x16, 0x99130130}, /* bass speaker */
2441 {}
2442 },
2443 .chained = true,
2444 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2445 },
2446 [ALC887_FIXUP_BASS_CHMAP] = {
2447 .type = HDA_FIXUP_FUNC,
2448 .v.func = alc_fixup_bass_chmap,
2449 },
2450 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2451 .type = HDA_FIXUP_FUNC,
2452 .v.func = alc1220_fixup_gb_dual_codecs,
2453 },
2454 [ALC1220_FIXUP_GB_X570] = {
2455 .type = HDA_FIXUP_FUNC,
2456 .v.func = alc1220_fixup_gb_x570,
2457 },
2458 [ALC1220_FIXUP_CLEVO_P950] = {
2459 .type = HDA_FIXUP_FUNC,
2460 .v.func = alc1220_fixup_clevo_p950,
2461 },
2462 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2463 .type = HDA_FIXUP_FUNC,
2464 .v.func = alc1220_fixup_clevo_pb51ed,
2465 },
2466 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2467 .type = HDA_FIXUP_PINS,
2468 .v.pins = (const struct hda_pintbl[]) {
2469 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2470 {}
2471 },
2472 .chained = true,
2473 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2474 },
2475 [ALC887_FIXUP_ASUS_AUDIO] = {
2476 .type = HDA_FIXUP_PINS,
2477 .v.pins = (const struct hda_pintbl[]) {
2478 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2479 { 0x19, 0x22219420 },
2480 {}
2481 },
2482 },
2483 [ALC887_FIXUP_ASUS_HMIC] = {
2484 .type = HDA_FIXUP_FUNC,
2485 .v.func = alc887_fixup_asus_jack,
2486 .chained = true,
2487 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2488 },
2489 };
2490
2491 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2492 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2493 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2494 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2495 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2496 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2497 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2498 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2499 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2500 ALC882_FIXUP_ACER_ASPIRE_4930G),
2501 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2502 ALC882_FIXUP_ACER_ASPIRE_4930G),
2503 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2504 ALC882_FIXUP_ACER_ASPIRE_8930G),
2505 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2506 ALC882_FIXUP_ACER_ASPIRE_8930G),
2507 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2508 ALC882_FIXUP_ACER_ASPIRE_4930G),
2509 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2510 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2511 ALC882_FIXUP_ACER_ASPIRE_4930G),
2512 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2513 ALC882_FIXUP_ACER_ASPIRE_4930G),
2514 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2515 ALC882_FIXUP_ACER_ASPIRE_4930G),
2516 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2517 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2518 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2519 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2520 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2521 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2522 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2523 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2524 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2525 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2526 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2527 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2528 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2529 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2530 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2531
2532 /* All Apple entries are in codec SSIDs */
2533 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2534 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2535 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2536 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2537 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2538 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2539 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2540 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2541 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2542 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2543 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2544 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2545 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2546 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2547 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2548 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2549 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2550 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2551 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2552 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2553 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2554 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2555
2556 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2557 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2558 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2559 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2560 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2561 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
2562 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2563 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2564 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2565 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2566 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2567 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2568 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2569 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2570 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2571 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2572 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2573 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2574 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2575 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2576 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2577 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2578 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2579 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2580 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2581 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2582 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2583 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2584 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2585 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2586 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2587 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2588 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2589 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2590 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2591 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2592 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2593 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2594 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2595 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2596 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2597 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2598 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2599 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2600 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2601 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2602 {}
2603 };
2604
2605 static const struct hda_model_fixup alc882_fixup_models[] = {
2606 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2607 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2608 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2609 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2610 {.id = ALC889_FIXUP_CD, .name = "cd"},
2611 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2612 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2613 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2614 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2615 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2616 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2617 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2618 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2619 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2620 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2621 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2622 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2623 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2624 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2625 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2626 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2627 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2628 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2629 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2630 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2631 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2632 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2633 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2634 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2635 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2636 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2637 {}
2638 };
2639
2640 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2641 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2642 {0x14, 0x01014010},
2643 {0x15, 0x01011012},
2644 {0x16, 0x01016011},
2645 {0x18, 0x01a19040},
2646 {0x19, 0x02a19050},
2647 {0x1a, 0x0181304f},
2648 {0x1b, 0x0221401f},
2649 {0x1e, 0x01456130}),
2650 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2651 {0x14, 0x01015010},
2652 {0x15, 0x01011012},
2653 {0x16, 0x01011011},
2654 {0x18, 0x01a11040},
2655 {0x19, 0x02a19050},
2656 {0x1a, 0x0181104f},
2657 {0x1b, 0x0221401f},
2658 {0x1e, 0x01451130}),
2659 {}
2660 };
2661
2662 /*
2663 * BIOS auto configuration
2664 */
2665 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2666 static int alc882_parse_auto_config(struct hda_codec *codec)
2667 {
2668 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2669 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2670 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2671 }
2672
2673 /*
2674 */
patch_alc882(struct hda_codec * codec)2675 static int patch_alc882(struct hda_codec *codec)
2676 {
2677 struct alc_spec *spec;
2678 int err;
2679
2680 err = alc_alloc_spec(codec, 0x0b);
2681 if (err < 0)
2682 return err;
2683
2684 spec = codec->spec;
2685
2686 switch (codec->core.vendor_id) {
2687 case 0x10ec0882:
2688 case 0x10ec0885:
2689 case 0x10ec0900:
2690 case 0x10ec0b00:
2691 case 0x10ec1220:
2692 break;
2693 default:
2694 /* ALC883 and variants */
2695 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2696 break;
2697 }
2698
2699 alc_pre_init(codec);
2700
2701 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2702 alc882_fixups);
2703 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2704 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2705
2706 alc_auto_parse_customize_define(codec);
2707
2708 if (has_cdefine_beep(codec))
2709 spec->gen.beep_nid = 0x01;
2710
2711 /* automatic parse from the BIOS config */
2712 err = alc882_parse_auto_config(codec);
2713 if (err < 0)
2714 goto error;
2715
2716 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2717 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2718 if (err < 0)
2719 goto error;
2720 }
2721
2722 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2723
2724 return 0;
2725
2726 error:
2727 alc_free(codec);
2728 return err;
2729 }
2730
2731
2732 /*
2733 * ALC262 support
2734 */
alc262_parse_auto_config(struct hda_codec * codec)2735 static int alc262_parse_auto_config(struct hda_codec *codec)
2736 {
2737 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2738 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2739 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2740 }
2741
2742 /*
2743 * Pin config fixes
2744 */
2745 enum {
2746 ALC262_FIXUP_FSC_H270,
2747 ALC262_FIXUP_FSC_S7110,
2748 ALC262_FIXUP_HP_Z200,
2749 ALC262_FIXUP_TYAN,
2750 ALC262_FIXUP_LENOVO_3000,
2751 ALC262_FIXUP_BENQ,
2752 ALC262_FIXUP_BENQ_T31,
2753 ALC262_FIXUP_INV_DMIC,
2754 ALC262_FIXUP_INTEL_BAYLEYBAY,
2755 };
2756
2757 static const struct hda_fixup alc262_fixups[] = {
2758 [ALC262_FIXUP_FSC_H270] = {
2759 .type = HDA_FIXUP_PINS,
2760 .v.pins = (const struct hda_pintbl[]) {
2761 { 0x14, 0x99130110 }, /* speaker */
2762 { 0x15, 0x0221142f }, /* front HP */
2763 { 0x1b, 0x0121141f }, /* rear HP */
2764 { }
2765 }
2766 },
2767 [ALC262_FIXUP_FSC_S7110] = {
2768 .type = HDA_FIXUP_PINS,
2769 .v.pins = (const struct hda_pintbl[]) {
2770 { 0x15, 0x90170110 }, /* speaker */
2771 { }
2772 },
2773 .chained = true,
2774 .chain_id = ALC262_FIXUP_BENQ,
2775 },
2776 [ALC262_FIXUP_HP_Z200] = {
2777 .type = HDA_FIXUP_PINS,
2778 .v.pins = (const struct hda_pintbl[]) {
2779 { 0x16, 0x99130120 }, /* internal speaker */
2780 { }
2781 }
2782 },
2783 [ALC262_FIXUP_TYAN] = {
2784 .type = HDA_FIXUP_PINS,
2785 .v.pins = (const struct hda_pintbl[]) {
2786 { 0x14, 0x1993e1f0 }, /* int AUX */
2787 { }
2788 }
2789 },
2790 [ALC262_FIXUP_LENOVO_3000] = {
2791 .type = HDA_FIXUP_PINCTLS,
2792 .v.pins = (const struct hda_pintbl[]) {
2793 { 0x19, PIN_VREF50 },
2794 {}
2795 },
2796 .chained = true,
2797 .chain_id = ALC262_FIXUP_BENQ,
2798 },
2799 [ALC262_FIXUP_BENQ] = {
2800 .type = HDA_FIXUP_VERBS,
2801 .v.verbs = (const struct hda_verb[]) {
2802 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2803 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2804 {}
2805 }
2806 },
2807 [ALC262_FIXUP_BENQ_T31] = {
2808 .type = HDA_FIXUP_VERBS,
2809 .v.verbs = (const struct hda_verb[]) {
2810 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2811 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2812 {}
2813 }
2814 },
2815 [ALC262_FIXUP_INV_DMIC] = {
2816 .type = HDA_FIXUP_FUNC,
2817 .v.func = alc_fixup_inv_dmic,
2818 },
2819 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2820 .type = HDA_FIXUP_FUNC,
2821 .v.func = alc_fixup_no_depop_delay,
2822 },
2823 };
2824
2825 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2826 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2827 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2828 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2829 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2830 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2831 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2832 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2833 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2834 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2835 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2836 {}
2837 };
2838
2839 static const struct hda_model_fixup alc262_fixup_models[] = {
2840 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2841 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2842 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2843 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2844 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2845 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2846 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2847 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2848 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2849 {}
2850 };
2851
2852 /*
2853 */
patch_alc262(struct hda_codec * codec)2854 static int patch_alc262(struct hda_codec *codec)
2855 {
2856 struct alc_spec *spec;
2857 int err;
2858
2859 err = alc_alloc_spec(codec, 0x0b);
2860 if (err < 0)
2861 return err;
2862
2863 spec = codec->spec;
2864 spec->gen.shared_mic_vref_pin = 0x18;
2865
2866 spec->shutup = alc_eapd_shutup;
2867
2868 #if 0
2869 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2870 * under-run
2871 */
2872 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2873 #endif
2874 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2875
2876 alc_pre_init(codec);
2877
2878 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2879 alc262_fixups);
2880 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2881
2882 alc_auto_parse_customize_define(codec);
2883
2884 if (has_cdefine_beep(codec))
2885 spec->gen.beep_nid = 0x01;
2886
2887 /* automatic parse from the BIOS config */
2888 err = alc262_parse_auto_config(codec);
2889 if (err < 0)
2890 goto error;
2891
2892 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2893 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2894 if (err < 0)
2895 goto error;
2896 }
2897
2898 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2899
2900 return 0;
2901
2902 error:
2903 alc_free(codec);
2904 return err;
2905 }
2906
2907 /*
2908 * ALC268
2909 */
2910 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2911 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2912 struct snd_ctl_elem_value *ucontrol)
2913 {
2914 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2915 unsigned long pval;
2916 int err;
2917
2918 mutex_lock(&codec->control_mutex);
2919 pval = kcontrol->private_value;
2920 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2921 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2922 if (err >= 0) {
2923 kcontrol->private_value = (pval & ~0xff) | 0x10;
2924 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2925 }
2926 kcontrol->private_value = pval;
2927 mutex_unlock(&codec->control_mutex);
2928 return err;
2929 }
2930
2931 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2932 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2933 {
2934 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2935 .name = "Beep Playback Switch",
2936 .subdevice = HDA_SUBDEV_AMP_FLAG,
2937 .info = snd_hda_mixer_amp_switch_info,
2938 .get = snd_hda_mixer_amp_switch_get,
2939 .put = alc268_beep_switch_put,
2940 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2941 },
2942 };
2943
2944 /* set PCBEEP vol = 0, mute connections */
2945 static const struct hda_verb alc268_beep_init_verbs[] = {
2946 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2947 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2948 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2949 { }
2950 };
2951
2952 enum {
2953 ALC268_FIXUP_INV_DMIC,
2954 ALC268_FIXUP_HP_EAPD,
2955 ALC268_FIXUP_SPDIF,
2956 };
2957
2958 static const struct hda_fixup alc268_fixups[] = {
2959 [ALC268_FIXUP_INV_DMIC] = {
2960 .type = HDA_FIXUP_FUNC,
2961 .v.func = alc_fixup_inv_dmic,
2962 },
2963 [ALC268_FIXUP_HP_EAPD] = {
2964 .type = HDA_FIXUP_VERBS,
2965 .v.verbs = (const struct hda_verb[]) {
2966 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2967 {}
2968 }
2969 },
2970 [ALC268_FIXUP_SPDIF] = {
2971 .type = HDA_FIXUP_PINS,
2972 .v.pins = (const struct hda_pintbl[]) {
2973 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2974 {}
2975 }
2976 },
2977 };
2978
2979 static const struct hda_model_fixup alc268_fixup_models[] = {
2980 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2981 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2982 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
2983 {}
2984 };
2985
2986 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2987 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2988 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2989 /* below is codec SSID since multiple Toshiba laptops have the
2990 * same PCI SSID 1179:ff00
2991 */
2992 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2993 {}
2994 };
2995
2996 /*
2997 * BIOS auto configuration
2998 */
alc268_parse_auto_config(struct hda_codec * codec)2999 static int alc268_parse_auto_config(struct hda_codec *codec)
3000 {
3001 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3002 return alc_parse_auto_config(codec, NULL, alc268_ssids);
3003 }
3004
3005 /*
3006 */
patch_alc268(struct hda_codec * codec)3007 static int patch_alc268(struct hda_codec *codec)
3008 {
3009 struct alc_spec *spec;
3010 int i, err;
3011
3012 /* ALC268 has no aa-loopback mixer */
3013 err = alc_alloc_spec(codec, 0);
3014 if (err < 0)
3015 return err;
3016
3017 spec = codec->spec;
3018 if (has_cdefine_beep(codec))
3019 spec->gen.beep_nid = 0x01;
3020
3021 spec->shutup = alc_eapd_shutup;
3022
3023 alc_pre_init(codec);
3024
3025 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3026 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3027
3028 /* automatic parse from the BIOS config */
3029 err = alc268_parse_auto_config(codec);
3030 if (err < 0)
3031 goto error;
3032
3033 if (err > 0 && !spec->gen.no_analog &&
3034 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3035 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3036 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3037 &alc268_beep_mixer[i])) {
3038 err = -ENOMEM;
3039 goto error;
3040 }
3041 }
3042 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3043 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3044 /* override the amp caps for beep generator */
3045 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3046 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3047 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3048 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3049 (0 << AC_AMPCAP_MUTE_SHIFT));
3050 }
3051
3052 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3053
3054 return 0;
3055
3056 error:
3057 alc_free(codec);
3058 return err;
3059 }
3060
3061 /*
3062 * ALC269
3063 */
3064
3065 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3066 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3067 };
3068
3069 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3070 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3071 };
3072
3073 /* different alc269-variants */
3074 enum {
3075 ALC269_TYPE_ALC269VA,
3076 ALC269_TYPE_ALC269VB,
3077 ALC269_TYPE_ALC269VC,
3078 ALC269_TYPE_ALC269VD,
3079 ALC269_TYPE_ALC280,
3080 ALC269_TYPE_ALC282,
3081 ALC269_TYPE_ALC283,
3082 ALC269_TYPE_ALC284,
3083 ALC269_TYPE_ALC293,
3084 ALC269_TYPE_ALC286,
3085 ALC269_TYPE_ALC298,
3086 ALC269_TYPE_ALC255,
3087 ALC269_TYPE_ALC256,
3088 ALC269_TYPE_ALC257,
3089 ALC269_TYPE_ALC215,
3090 ALC269_TYPE_ALC225,
3091 ALC269_TYPE_ALC294,
3092 ALC269_TYPE_ALC300,
3093 ALC269_TYPE_ALC623,
3094 ALC269_TYPE_ALC700,
3095 };
3096
3097 /*
3098 * BIOS auto configuration
3099 */
alc269_parse_auto_config(struct hda_codec * codec)3100 static int alc269_parse_auto_config(struct hda_codec *codec)
3101 {
3102 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3103 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3104 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3105 struct alc_spec *spec = codec->spec;
3106 const hda_nid_t *ssids;
3107
3108 switch (spec->codec_variant) {
3109 case ALC269_TYPE_ALC269VA:
3110 case ALC269_TYPE_ALC269VC:
3111 case ALC269_TYPE_ALC280:
3112 case ALC269_TYPE_ALC284:
3113 case ALC269_TYPE_ALC293:
3114 ssids = alc269va_ssids;
3115 break;
3116 case ALC269_TYPE_ALC269VB:
3117 case ALC269_TYPE_ALC269VD:
3118 case ALC269_TYPE_ALC282:
3119 case ALC269_TYPE_ALC283:
3120 case ALC269_TYPE_ALC286:
3121 case ALC269_TYPE_ALC298:
3122 case ALC269_TYPE_ALC255:
3123 case ALC269_TYPE_ALC256:
3124 case ALC269_TYPE_ALC257:
3125 case ALC269_TYPE_ALC215:
3126 case ALC269_TYPE_ALC225:
3127 case ALC269_TYPE_ALC294:
3128 case ALC269_TYPE_ALC300:
3129 case ALC269_TYPE_ALC623:
3130 case ALC269_TYPE_ALC700:
3131 ssids = alc269_ssids;
3132 break;
3133 default:
3134 ssids = alc269_ssids;
3135 break;
3136 }
3137
3138 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3139 }
3140
3141 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3142 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3143 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3144 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3145 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3146 {}
3147 };
3148
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3149 static void alc_headset_btn_callback(struct hda_codec *codec,
3150 struct hda_jack_callback *jack)
3151 {
3152 int report = 0;
3153
3154 if (jack->unsol_res & (7 << 13))
3155 report |= SND_JACK_BTN_0;
3156
3157 if (jack->unsol_res & (1 << 16 | 3 << 8))
3158 report |= SND_JACK_BTN_1;
3159
3160 /* Volume up key */
3161 if (jack->unsol_res & (7 << 23))
3162 report |= SND_JACK_BTN_2;
3163
3164 /* Volume down key */
3165 if (jack->unsol_res & (7 << 10))
3166 report |= SND_JACK_BTN_3;
3167
3168 jack->jack->button_state = report;
3169 }
3170
alc_disable_headset_jack_key(struct hda_codec * codec)3171 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3172 {
3173 struct alc_spec *spec = codec->spec;
3174
3175 if (!spec->has_hs_key)
3176 return;
3177
3178 switch (codec->core.vendor_id) {
3179 case 0x10ec0215:
3180 case 0x10ec0225:
3181 case 0x10ec0285:
3182 case 0x10ec0287:
3183 case 0x10ec0295:
3184 case 0x10ec0289:
3185 case 0x10ec0299:
3186 alc_write_coef_idx(codec, 0x48, 0x0);
3187 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3188 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3189 break;
3190 case 0x10ec0230:
3191 case 0x10ec0236:
3192 case 0x10ec0256:
3193 alc_write_coef_idx(codec, 0x48, 0x0);
3194 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3195 break;
3196 }
3197 }
3198
alc_enable_headset_jack_key(struct hda_codec * codec)3199 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3200 {
3201 struct alc_spec *spec = codec->spec;
3202
3203 if (!spec->has_hs_key)
3204 return;
3205
3206 switch (codec->core.vendor_id) {
3207 case 0x10ec0215:
3208 case 0x10ec0225:
3209 case 0x10ec0285:
3210 case 0x10ec0287:
3211 case 0x10ec0295:
3212 case 0x10ec0289:
3213 case 0x10ec0299:
3214 alc_write_coef_idx(codec, 0x48, 0xd011);
3215 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3216 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3217 break;
3218 case 0x10ec0230:
3219 case 0x10ec0236:
3220 case 0x10ec0256:
3221 alc_write_coef_idx(codec, 0x48, 0xd011);
3222 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3223 break;
3224 }
3225 }
3226
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3227 static void alc_fixup_headset_jack(struct hda_codec *codec,
3228 const struct hda_fixup *fix, int action)
3229 {
3230 struct alc_spec *spec = codec->spec;
3231
3232 switch (action) {
3233 case HDA_FIXUP_ACT_PRE_PROBE:
3234 spec->has_hs_key = 1;
3235 snd_hda_jack_detect_enable_callback(codec, 0x55,
3236 alc_headset_btn_callback);
3237 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3238 SND_JACK_HEADSET, alc_headset_btn_keymap);
3239 break;
3240 case HDA_FIXUP_ACT_INIT:
3241 alc_enable_headset_jack_key(codec);
3242 break;
3243 }
3244 }
3245
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3246 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3247 {
3248 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3249 }
3250
alc269_shutup(struct hda_codec * codec)3251 static void alc269_shutup(struct hda_codec *codec)
3252 {
3253 struct alc_spec *spec = codec->spec;
3254
3255 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3256 alc269vb_toggle_power_output(codec, 0);
3257 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3258 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3259 msleep(150);
3260 }
3261 alc_shutup_pins(codec);
3262 }
3263
3264 static const struct coef_fw alc282_coefs[] = {
3265 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3266 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3267 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3268 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3269 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3270 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3271 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3272 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3273 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3274 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3275 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3276 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3277 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3278 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3279 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3280 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3281 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3282 WRITE_COEF(0x63, 0x2902), /* PLL */
3283 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3284 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3285 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3286 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3287 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3288 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3289 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3290 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3291 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3292 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3293 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3294 {}
3295 };
3296
alc282_restore_default_value(struct hda_codec * codec)3297 static void alc282_restore_default_value(struct hda_codec *codec)
3298 {
3299 alc_process_coef_fw(codec, alc282_coefs);
3300 }
3301
alc282_init(struct hda_codec * codec)3302 static void alc282_init(struct hda_codec *codec)
3303 {
3304 struct alc_spec *spec = codec->spec;
3305 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3306 bool hp_pin_sense;
3307 int coef78;
3308
3309 alc282_restore_default_value(codec);
3310
3311 if (!hp_pin)
3312 return;
3313 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3314 coef78 = alc_read_coef_idx(codec, 0x78);
3315
3316 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3317 /* Headphone capless set to high power mode */
3318 alc_write_coef_idx(codec, 0x78, 0x9004);
3319
3320 if (hp_pin_sense)
3321 msleep(2);
3322
3323 snd_hda_codec_write(codec, hp_pin, 0,
3324 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3325
3326 if (hp_pin_sense)
3327 msleep(85);
3328
3329 snd_hda_codec_write(codec, hp_pin, 0,
3330 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3331
3332 if (hp_pin_sense)
3333 msleep(100);
3334
3335 /* Headphone capless set to normal mode */
3336 alc_write_coef_idx(codec, 0x78, coef78);
3337 }
3338
alc282_shutup(struct hda_codec * codec)3339 static void alc282_shutup(struct hda_codec *codec)
3340 {
3341 struct alc_spec *spec = codec->spec;
3342 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3343 bool hp_pin_sense;
3344 int coef78;
3345
3346 if (!hp_pin) {
3347 alc269_shutup(codec);
3348 return;
3349 }
3350
3351 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3352 coef78 = alc_read_coef_idx(codec, 0x78);
3353 alc_write_coef_idx(codec, 0x78, 0x9004);
3354
3355 if (hp_pin_sense)
3356 msleep(2);
3357
3358 snd_hda_codec_write(codec, hp_pin, 0,
3359 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3360
3361 if (hp_pin_sense)
3362 msleep(85);
3363
3364 if (!spec->no_shutup_pins)
3365 snd_hda_codec_write(codec, hp_pin, 0,
3366 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3367
3368 if (hp_pin_sense)
3369 msleep(100);
3370
3371 alc_auto_setup_eapd(codec, false);
3372 alc_shutup_pins(codec);
3373 alc_write_coef_idx(codec, 0x78, coef78);
3374 }
3375
3376 static const struct coef_fw alc283_coefs[] = {
3377 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3378 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3379 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3380 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3381 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3382 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3383 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3384 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3385 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3386 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3387 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3388 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3389 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3390 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3391 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3392 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3393 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3394 WRITE_COEF(0x2e, 0x2902), /* PLL */
3395 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3396 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3397 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3398 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3399 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3400 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3401 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3402 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3403 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3404 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3405 WRITE_COEF(0x49, 0x0), /* test mode */
3406 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3407 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3408 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3409 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3410 {}
3411 };
3412
alc283_restore_default_value(struct hda_codec * codec)3413 static void alc283_restore_default_value(struct hda_codec *codec)
3414 {
3415 alc_process_coef_fw(codec, alc283_coefs);
3416 }
3417
alc283_init(struct hda_codec * codec)3418 static void alc283_init(struct hda_codec *codec)
3419 {
3420 struct alc_spec *spec = codec->spec;
3421 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3422 bool hp_pin_sense;
3423
3424 alc283_restore_default_value(codec);
3425
3426 if (!hp_pin)
3427 return;
3428
3429 msleep(30);
3430 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3431
3432 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3433 /* Headphone capless set to high power mode */
3434 alc_write_coef_idx(codec, 0x43, 0x9004);
3435
3436 snd_hda_codec_write(codec, hp_pin, 0,
3437 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3438
3439 if (hp_pin_sense)
3440 msleep(85);
3441
3442 snd_hda_codec_write(codec, hp_pin, 0,
3443 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3444
3445 if (hp_pin_sense)
3446 msleep(85);
3447 /* Index 0x46 Combo jack auto switch control 2 */
3448 /* 3k pull low control for Headset jack. */
3449 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3450 /* Headphone capless set to normal mode */
3451 alc_write_coef_idx(codec, 0x43, 0x9614);
3452 }
3453
alc283_shutup(struct hda_codec * codec)3454 static void alc283_shutup(struct hda_codec *codec)
3455 {
3456 struct alc_spec *spec = codec->spec;
3457 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3458 bool hp_pin_sense;
3459
3460 if (!hp_pin) {
3461 alc269_shutup(codec);
3462 return;
3463 }
3464
3465 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3466
3467 alc_write_coef_idx(codec, 0x43, 0x9004);
3468
3469 /*depop hp during suspend*/
3470 alc_write_coef_idx(codec, 0x06, 0x2100);
3471
3472 snd_hda_codec_write(codec, hp_pin, 0,
3473 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3474
3475 if (hp_pin_sense)
3476 msleep(100);
3477
3478 if (!spec->no_shutup_pins)
3479 snd_hda_codec_write(codec, hp_pin, 0,
3480 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3481
3482 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3483
3484 if (hp_pin_sense)
3485 msleep(100);
3486 alc_auto_setup_eapd(codec, false);
3487 alc_shutup_pins(codec);
3488 alc_write_coef_idx(codec, 0x43, 0x9614);
3489 }
3490
alc256_init(struct hda_codec * codec)3491 static void alc256_init(struct hda_codec *codec)
3492 {
3493 struct alc_spec *spec = codec->spec;
3494 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3495 bool hp_pin_sense;
3496
3497 if (!hp_pin)
3498 hp_pin = 0x21;
3499
3500 msleep(30);
3501
3502 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3503
3504 if (hp_pin_sense)
3505 msleep(2);
3506
3507 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3508 if (spec->ultra_low_power) {
3509 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3510 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3511 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3512 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3513 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3514 msleep(30);
3515 }
3516
3517 snd_hda_codec_write(codec, hp_pin, 0,
3518 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3519
3520 if (hp_pin_sense || spec->ultra_low_power)
3521 msleep(85);
3522
3523 snd_hda_codec_write(codec, hp_pin, 0,
3524 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3525
3526 if (hp_pin_sense || spec->ultra_low_power)
3527 msleep(100);
3528
3529 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3530 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3531 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3532 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3533 /*
3534 * Expose headphone mic (or possibly Line In on some machines) instead
3535 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3536 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3537 * this register.
3538 */
3539 alc_write_coef_idx(codec, 0x36, 0x5757);
3540 }
3541
alc256_shutup(struct hda_codec * codec)3542 static void alc256_shutup(struct hda_codec *codec)
3543 {
3544 struct alc_spec *spec = codec->spec;
3545 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3546 bool hp_pin_sense;
3547
3548 if (!hp_pin)
3549 hp_pin = 0x21;
3550
3551 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3552
3553 if (hp_pin_sense)
3554 msleep(2);
3555
3556 snd_hda_codec_write(codec, hp_pin, 0,
3557 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3558
3559 if (hp_pin_sense || spec->ultra_low_power)
3560 msleep(85);
3561
3562 /* 3k pull low control for Headset jack. */
3563 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3564 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3565 * when booting with headset plugged. So skip setting it for the codec alc257
3566 */
3567 if (spec->codec_variant != ALC269_TYPE_ALC257 &&
3568 spec->codec_variant != ALC269_TYPE_ALC256)
3569 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3570
3571 if (!spec->no_shutup_pins)
3572 snd_hda_codec_write(codec, hp_pin, 0,
3573 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3574
3575 if (hp_pin_sense || spec->ultra_low_power)
3576 msleep(100);
3577
3578 alc_auto_setup_eapd(codec, false);
3579 alc_shutup_pins(codec);
3580 if (spec->ultra_low_power) {
3581 msleep(50);
3582 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3583 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3584 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3585 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3586 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3587 msleep(30);
3588 }
3589 }
3590
alc225_init(struct hda_codec * codec)3591 static void alc225_init(struct hda_codec *codec)
3592 {
3593 struct alc_spec *spec = codec->spec;
3594 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3595 bool hp1_pin_sense, hp2_pin_sense;
3596
3597 if (!hp_pin)
3598 hp_pin = 0x21;
3599 msleep(30);
3600
3601 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3602 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3603
3604 if (hp1_pin_sense || hp2_pin_sense)
3605 msleep(2);
3606
3607 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3608 if (spec->ultra_low_power) {
3609 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3610 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3611 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3612 msleep(30);
3613 }
3614
3615 if (hp1_pin_sense || spec->ultra_low_power)
3616 snd_hda_codec_write(codec, hp_pin, 0,
3617 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3618 if (hp2_pin_sense)
3619 snd_hda_codec_write(codec, 0x16, 0,
3620 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3621
3622 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3623 msleep(85);
3624
3625 if (hp1_pin_sense || spec->ultra_low_power)
3626 snd_hda_codec_write(codec, hp_pin, 0,
3627 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3628 if (hp2_pin_sense)
3629 snd_hda_codec_write(codec, 0x16, 0,
3630 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3631
3632 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3633 msleep(100);
3634
3635 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3636 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3637 }
3638
alc225_shutup(struct hda_codec * codec)3639 static void alc225_shutup(struct hda_codec *codec)
3640 {
3641 struct alc_spec *spec = codec->spec;
3642 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3643 bool hp1_pin_sense, hp2_pin_sense;
3644
3645 if (!hp_pin)
3646 hp_pin = 0x21;
3647
3648 alc_disable_headset_jack_key(codec);
3649 /* 3k pull low control for Headset jack. */
3650 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3651
3652 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3653 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3654
3655 if (hp1_pin_sense || hp2_pin_sense)
3656 msleep(2);
3657
3658 if (hp1_pin_sense || spec->ultra_low_power)
3659 snd_hda_codec_write(codec, hp_pin, 0,
3660 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3661 if (hp2_pin_sense)
3662 snd_hda_codec_write(codec, 0x16, 0,
3663 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3664
3665 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3666 msleep(85);
3667
3668 if (hp1_pin_sense || spec->ultra_low_power)
3669 snd_hda_codec_write(codec, hp_pin, 0,
3670 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3671 if (hp2_pin_sense)
3672 snd_hda_codec_write(codec, 0x16, 0,
3673 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3674
3675 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3676 msleep(100);
3677
3678 alc_auto_setup_eapd(codec, false);
3679 alc_shutup_pins(codec);
3680 if (spec->ultra_low_power) {
3681 msleep(50);
3682 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3683 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3684 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3685 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3686 msleep(30);
3687 }
3688
3689 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3690 alc_enable_headset_jack_key(codec);
3691 }
3692
alc_default_init(struct hda_codec * codec)3693 static void alc_default_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 bool hp_pin_sense;
3698
3699 if (!hp_pin)
3700 return;
3701
3702 msleep(30);
3703
3704 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3705
3706 if (hp_pin_sense)
3707 msleep(2);
3708
3709 snd_hda_codec_write(codec, hp_pin, 0,
3710 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3711
3712 if (hp_pin_sense)
3713 msleep(85);
3714
3715 snd_hda_codec_write(codec, hp_pin, 0,
3716 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3717
3718 if (hp_pin_sense)
3719 msleep(100);
3720 }
3721
alc_default_shutup(struct hda_codec * codec)3722 static void alc_default_shutup(struct hda_codec *codec)
3723 {
3724 struct alc_spec *spec = codec->spec;
3725 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3726 bool hp_pin_sense;
3727
3728 if (!hp_pin) {
3729 alc269_shutup(codec);
3730 return;
3731 }
3732
3733 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3734
3735 if (hp_pin_sense)
3736 msleep(2);
3737
3738 snd_hda_codec_write(codec, hp_pin, 0,
3739 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3740
3741 if (hp_pin_sense)
3742 msleep(85);
3743
3744 if (!spec->no_shutup_pins)
3745 snd_hda_codec_write(codec, hp_pin, 0,
3746 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3747
3748 if (hp_pin_sense)
3749 msleep(100);
3750
3751 alc_auto_setup_eapd(codec, false);
3752 alc_shutup_pins(codec);
3753 }
3754
alc294_hp_init(struct hda_codec * codec)3755 static void alc294_hp_init(struct hda_codec *codec)
3756 {
3757 struct alc_spec *spec = codec->spec;
3758 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3759 int i, val;
3760
3761 if (!hp_pin)
3762 return;
3763
3764 snd_hda_codec_write(codec, hp_pin, 0,
3765 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3766
3767 msleep(100);
3768
3769 if (!spec->no_shutup_pins)
3770 snd_hda_codec_write(codec, hp_pin, 0,
3771 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3772
3773 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3774 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3775
3776 /* Wait for depop procedure finish */
3777 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3778 for (i = 0; i < 20 && val & 0x0080; i++) {
3779 msleep(50);
3780 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3781 }
3782 /* Set HP depop to auto mode */
3783 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3784 msleep(50);
3785 }
3786
alc294_init(struct hda_codec * codec)3787 static void alc294_init(struct hda_codec *codec)
3788 {
3789 struct alc_spec *spec = codec->spec;
3790
3791 /* required only at boot or S4 resume time */
3792 if (!spec->done_hp_init ||
3793 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3794 alc294_hp_init(codec);
3795 spec->done_hp_init = true;
3796 }
3797 alc_default_init(codec);
3798 }
3799
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)3800 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3801 unsigned int val)
3802 {
3803 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3804 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3805 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3806 }
3807
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)3808 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3809 {
3810 unsigned int val;
3811
3812 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3813 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3814 & 0xffff;
3815 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3816 << 16;
3817 return val;
3818 }
3819
alc5505_dsp_halt(struct hda_codec * codec)3820 static void alc5505_dsp_halt(struct hda_codec *codec)
3821 {
3822 unsigned int val;
3823
3824 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3825 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3826 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3827 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3828 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3829 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3830 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3831 val = alc5505_coef_get(codec, 0x6220);
3832 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3833 }
3834
alc5505_dsp_back_from_halt(struct hda_codec * codec)3835 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3836 {
3837 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3838 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3839 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3840 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3841 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3842 alc5505_coef_set(codec, 0x880c, 0x00000004);
3843 }
3844
alc5505_dsp_init(struct hda_codec * codec)3845 static void alc5505_dsp_init(struct hda_codec *codec)
3846 {
3847 unsigned int val;
3848
3849 alc5505_dsp_halt(codec);
3850 alc5505_dsp_back_from_halt(codec);
3851 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3852 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3853 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3854 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3855 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3856 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3857 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3858 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3859 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3860 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3861 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3862 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3863 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3864
3865 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3866 if (val <= 3)
3867 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3868 else
3869 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3870
3871 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3872 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3873 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3874 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3875 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3876 alc5505_coef_set(codec, 0x880c, 0x00000003);
3877 alc5505_coef_set(codec, 0x880c, 0x00000010);
3878
3879 #ifdef HALT_REALTEK_ALC5505
3880 alc5505_dsp_halt(codec);
3881 #endif
3882 }
3883
3884 #ifdef HALT_REALTEK_ALC5505
3885 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3886 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
3887 #else
3888 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3889 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3890 #endif
3891
3892 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)3893 static int alc269_suspend(struct hda_codec *codec)
3894 {
3895 struct alc_spec *spec = codec->spec;
3896
3897 if (spec->has_alc5505_dsp)
3898 alc5505_dsp_suspend(codec);
3899 return alc_suspend(codec);
3900 }
3901
alc269_resume(struct hda_codec * codec)3902 static int alc269_resume(struct hda_codec *codec)
3903 {
3904 struct alc_spec *spec = codec->spec;
3905
3906 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3907 alc269vb_toggle_power_output(codec, 0);
3908 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3909 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3910 msleep(150);
3911 }
3912
3913 codec->patch_ops.init(codec);
3914
3915 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3916 alc269vb_toggle_power_output(codec, 1);
3917 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3918 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3919 msleep(200);
3920 }
3921
3922 snd_hda_regmap_sync(codec);
3923 hda_call_check_power_status(codec, 0x01);
3924
3925 /* on some machine, the BIOS will clear the codec gpio data when enter
3926 * suspend, and won't restore the data after resume, so we restore it
3927 * in the driver.
3928 */
3929 if (spec->gpio_data)
3930 alc_write_gpio_data(codec);
3931
3932 if (spec->has_alc5505_dsp)
3933 alc5505_dsp_resume(codec);
3934
3935 return 0;
3936 }
3937 #endif /* CONFIG_PM */
3938
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)3939 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3940 const struct hda_fixup *fix, int action)
3941 {
3942 struct alc_spec *spec = codec->spec;
3943
3944 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3945 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3946 }
3947
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)3948 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3949 const struct hda_fixup *fix,
3950 int action)
3951 {
3952 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3953 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3954
3955 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3956 snd_hda_codec_set_pincfg(codec, 0x19,
3957 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3958 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3959 }
3960
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)3961 static void alc269_fixup_hweq(struct hda_codec *codec,
3962 const struct hda_fixup *fix, int action)
3963 {
3964 if (action == HDA_FIXUP_ACT_INIT)
3965 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3966 }
3967
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)3968 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3969 const struct hda_fixup *fix, int action)
3970 {
3971 struct alc_spec *spec = codec->spec;
3972
3973 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3974 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3975 }
3976
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)3977 static void alc271_fixup_dmic(struct hda_codec *codec,
3978 const struct hda_fixup *fix, int action)
3979 {
3980 static const struct hda_verb verbs[] = {
3981 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3982 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3983 {}
3984 };
3985 unsigned int cfg;
3986
3987 if (strcmp(codec->core.chip_name, "ALC271X") &&
3988 strcmp(codec->core.chip_name, "ALC269VB"))
3989 return;
3990 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3991 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3992 snd_hda_sequence_write(codec, verbs);
3993 }
3994
3995 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)3996 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
3997 const struct hda_fixup *fix,
3998 int action)
3999 {
4000 if (action == HDA_FIXUP_ACT_INIT)
4001 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4002 }
4003
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4004 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4005 const struct hda_fixup *fix, int action)
4006 {
4007 struct alc_spec *spec = codec->spec;
4008
4009 if (action != HDA_FIXUP_ACT_PROBE)
4010 return;
4011
4012 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4013 * fix the sample rate of analog I/O to 44.1kHz
4014 */
4015 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4016 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4017 }
4018
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4019 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4020 const struct hda_fixup *fix, int action)
4021 {
4022 /* The digital-mic unit sends PDM (differential signal) instead of
4023 * the standard PCM, thus you can't record a valid mono stream as is.
4024 * Below is a workaround specific to ALC269 to control the dmic
4025 * signal source as mono.
4026 */
4027 if (action == HDA_FIXUP_ACT_INIT)
4028 alc_update_coef_idx(codec, 0x07, 0, 0x80);
4029 }
4030
alc269_quanta_automute(struct hda_codec * codec)4031 static void alc269_quanta_automute(struct hda_codec *codec)
4032 {
4033 snd_hda_gen_update_outputs(codec);
4034
4035 alc_write_coef_idx(codec, 0x0c, 0x680);
4036 alc_write_coef_idx(codec, 0x0c, 0x480);
4037 }
4038
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4039 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4040 const struct hda_fixup *fix, int action)
4041 {
4042 struct alc_spec *spec = codec->spec;
4043 if (action != HDA_FIXUP_ACT_PROBE)
4044 return;
4045 spec->gen.automute_hook = alc269_quanta_automute;
4046 }
4047
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4048 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4049 struct hda_jack_callback *jack)
4050 {
4051 struct alc_spec *spec = codec->spec;
4052 int vref;
4053 msleep(200);
4054 snd_hda_gen_hp_automute(codec, jack);
4055
4056 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4057 msleep(100);
4058 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4059 vref);
4060 msleep(500);
4061 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4062 vref);
4063 }
4064
4065 /*
4066 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4067 */
4068 struct hda_alc298_mbxinit {
4069 unsigned char value_0x23;
4070 unsigned char value_0x25;
4071 };
4072
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4073 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4074 const struct hda_alc298_mbxinit *initval,
4075 bool first)
4076 {
4077 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4078 alc_write_coef_idx(codec, 0x26, 0xb000);
4079
4080 if (first)
4081 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4082
4083 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4084 alc_write_coef_idx(codec, 0x26, 0xf000);
4085 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4086
4087 if (initval->value_0x23 != 0x1e)
4088 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4089
4090 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4091 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4092 }
4093
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4094 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4095 const struct hda_fixup *fix,
4096 int action)
4097 {
4098 /* Initialization magic */
4099 static const struct hda_alc298_mbxinit dac_init[] = {
4100 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4101 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4102 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4103 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4104 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4105 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4106 {0x2f, 0x00},
4107 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4108 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4109 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4110 {}
4111 };
4112 const struct hda_alc298_mbxinit *seq;
4113
4114 if (action != HDA_FIXUP_ACT_INIT)
4115 return;
4116
4117 /* Start */
4118 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4119 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4120 alc_write_coef_idx(codec, 0x26, 0xf000);
4121 alc_write_coef_idx(codec, 0x22, 0x31);
4122 alc_write_coef_idx(codec, 0x23, 0x0b);
4123 alc_write_coef_idx(codec, 0x25, 0x00);
4124 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4125 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4126
4127 for (seq = dac_init; seq->value_0x23; seq++)
4128 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4129 }
4130
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4131 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4132 const struct hda_fixup *fix, int action)
4133 {
4134 struct alc_spec *spec = codec->spec;
4135 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4136 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4137 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4138 }
4139 }
4140
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4141 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4142 bool polarity, bool on)
4143 {
4144 unsigned int pinval;
4145
4146 if (!pin)
4147 return;
4148 if (polarity)
4149 on = !on;
4150 pinval = snd_hda_codec_get_pin_target(codec, pin);
4151 pinval &= ~AC_PINCTL_VREFEN;
4152 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4153 /* temporarily power up/down for setting VREF */
4154 snd_hda_power_up_pm(codec);
4155 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4156 snd_hda_power_down_pm(codec);
4157 }
4158
4159 /* 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)4160 static int vref_mute_led_set(struct led_classdev *led_cdev,
4161 enum led_brightness brightness)
4162 {
4163 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4164 struct alc_spec *spec = codec->spec;
4165
4166 alc_update_vref_led(codec, spec->mute_led_nid,
4167 spec->mute_led_polarity, brightness);
4168 return 0;
4169 }
4170
4171 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4172 static unsigned int led_power_filter(struct hda_codec *codec,
4173 hda_nid_t nid,
4174 unsigned int power_state)
4175 {
4176 struct alc_spec *spec = codec->spec;
4177
4178 if (power_state != AC_PWRST_D3 || nid == 0 ||
4179 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4180 return power_state;
4181
4182 /* Set pin ctl again, it might have just been set to 0 */
4183 snd_hda_set_pin_ctl(codec, nid,
4184 snd_hda_codec_get_pin_target(codec, nid));
4185
4186 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4187 }
4188
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4189 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4190 const struct hda_fixup *fix, int action)
4191 {
4192 struct alc_spec *spec = codec->spec;
4193 const struct dmi_device *dev = NULL;
4194
4195 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4196 return;
4197
4198 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4199 int pol, pin;
4200 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4201 continue;
4202 if (pin < 0x0a || pin >= 0x10)
4203 break;
4204 spec->mute_led_polarity = pol;
4205 spec->mute_led_nid = pin - 0x0a + 0x18;
4206 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4207 codec->power_filter = led_power_filter;
4208 codec_dbg(codec,
4209 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4210 spec->mute_led_polarity);
4211 break;
4212 }
4213 }
4214
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4215 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4216 const struct hda_fixup *fix,
4217 int action, hda_nid_t pin)
4218 {
4219 struct alc_spec *spec = codec->spec;
4220
4221 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4222 spec->mute_led_polarity = 0;
4223 spec->mute_led_nid = pin;
4224 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4225 codec->power_filter = led_power_filter;
4226 }
4227 }
4228
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4229 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4230 const struct hda_fixup *fix, int action)
4231 {
4232 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4233 }
4234
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4235 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4236 const struct hda_fixup *fix, int action)
4237 {
4238 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4239 }
4240
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4241 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4242 const struct hda_fixup *fix, int action)
4243 {
4244 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4245 }
4246
4247 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4248 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4249 int polarity, bool enabled)
4250 {
4251 if (polarity)
4252 enabled = !enabled;
4253 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4254 }
4255
4256 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4257 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4258 enum led_brightness brightness)
4259 {
4260 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4261 struct alc_spec *spec = codec->spec;
4262
4263 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4264 spec->mute_led_polarity, !brightness);
4265 return 0;
4266 }
4267
4268 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4269 static int micmute_led_set(struct led_classdev *led_cdev,
4270 enum led_brightness brightness)
4271 {
4272 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4273 struct alc_spec *spec = codec->spec;
4274
4275 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4276 spec->micmute_led_polarity, !brightness);
4277 return 0;
4278 }
4279
4280 /* 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)4281 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4282 int action,
4283 unsigned int mute_mask,
4284 unsigned int micmute_mask)
4285 {
4286 struct alc_spec *spec = codec->spec;
4287
4288 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4289
4290 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4291 return;
4292 if (mute_mask) {
4293 spec->gpio_mute_led_mask = mute_mask;
4294 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4295 }
4296 if (micmute_mask) {
4297 spec->gpio_mic_led_mask = micmute_mask;
4298 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4299 }
4300 }
4301
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4302 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4303 const struct hda_fixup *fix, int action)
4304 {
4305 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4306 }
4307
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4308 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4309 const struct hda_fixup *fix, int action)
4310 {
4311 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4312 }
4313
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4314 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4315 const struct hda_fixup *fix, int action)
4316 {
4317 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4318 }
4319
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4320 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4321 const struct hda_fixup *fix, int action)
4322 {
4323 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4324 }
4325
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4326 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4327 const struct hda_fixup *fix, int action)
4328 {
4329 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4330 }
4331
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4332 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4333 const struct hda_fixup *fix, int action)
4334 {
4335 struct alc_spec *spec = codec->spec;
4336
4337 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4338 spec->micmute_led_polarity = 1;
4339 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4340 }
4341
4342 /* 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)4343 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4344 enum led_brightness brightness)
4345 {
4346 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4347 struct alc_spec *spec = codec->spec;
4348
4349 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4350 spec->micmute_led_polarity, brightness);
4351 return 0;
4352 }
4353
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4354 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4355 const struct hda_fixup *fix, int action)
4356 {
4357 struct alc_spec *spec = codec->spec;
4358
4359 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4360 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4361 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4362 * enable headphone amp
4363 */
4364 spec->gpio_mask |= 0x10;
4365 spec->gpio_dir |= 0x10;
4366 spec->cap_mute_led_nid = 0x18;
4367 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4368 codec->power_filter = led_power_filter;
4369 }
4370 }
4371
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4372 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4373 const struct hda_fixup *fix, int action)
4374 {
4375 struct alc_spec *spec = codec->spec;
4376
4377 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4378 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4379 spec->cap_mute_led_nid = 0x18;
4380 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4381 codec->power_filter = led_power_filter;
4382 }
4383 }
4384
4385 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4386 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4387 */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4388 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4389 const struct hda_fixup *fix, int action)
4390 {
4391 struct alc_spec *spec = codec->spec;
4392
4393 switch (action) {
4394 case HDA_FIXUP_ACT_PRE_PROBE:
4395 spec->gpio_mask |= 0x01;
4396 spec->gpio_dir |= 0x01;
4397 break;
4398 case HDA_FIXUP_ACT_INIT:
4399 /* need to toggle GPIO to enable the amp */
4400 alc_update_gpio_data(codec, 0x01, true);
4401 msleep(100);
4402 alc_update_gpio_data(codec, 0x01, false);
4403 break;
4404 }
4405 }
4406
4407 /* 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)4408 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4409 struct hda_codec *codec,
4410 struct snd_pcm_substream *substream,
4411 int action)
4412 {
4413 switch (action) {
4414 case HDA_GEN_PCM_ACT_PREPARE:
4415 alc_update_gpio_data(codec, 0x04, true);
4416 break;
4417 case HDA_GEN_PCM_ACT_CLEANUP:
4418 alc_update_gpio_data(codec, 0x04, false);
4419 break;
4420 }
4421 }
4422
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4423 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4424 const struct hda_fixup *fix,
4425 int action)
4426 {
4427 struct alc_spec *spec = codec->spec;
4428
4429 if (action == HDA_FIXUP_ACT_PROBE) {
4430 spec->gpio_mask |= 0x04;
4431 spec->gpio_dir |= 0x04;
4432 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4433 }
4434 }
4435
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4436 static void alc_update_coef_led(struct hda_codec *codec,
4437 struct alc_coef_led *led,
4438 bool polarity, bool on)
4439 {
4440 if (polarity)
4441 on = !on;
4442 /* temporarily power up/down for setting COEF bit */
4443 alc_update_coef_idx(codec, led->idx, led->mask,
4444 on ? led->on : led->off);
4445 }
4446
4447 /* 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)4448 static int coef_mute_led_set(struct led_classdev *led_cdev,
4449 enum led_brightness brightness)
4450 {
4451 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4452 struct alc_spec *spec = codec->spec;
4453
4454 alc_update_coef_led(codec, &spec->mute_led_coef,
4455 spec->mute_led_polarity, brightness);
4456 return 0;
4457 }
4458
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4459 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4460 const struct hda_fixup *fix,
4461 int action)
4462 {
4463 struct alc_spec *spec = codec->spec;
4464
4465 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4466 spec->mute_led_polarity = 0;
4467 spec->mute_led_coef.idx = 0x0b;
4468 spec->mute_led_coef.mask = 1 << 3;
4469 spec->mute_led_coef.on = 1 << 3;
4470 spec->mute_led_coef.off = 0;
4471 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4472 }
4473 }
4474
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4475 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4476 const struct hda_fixup *fix,
4477 int action)
4478 {
4479 struct alc_spec *spec = codec->spec;
4480
4481 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4482 spec->mute_led_polarity = 0;
4483 spec->mute_led_coef.idx = 0x34;
4484 spec->mute_led_coef.mask = 1 << 5;
4485 spec->mute_led_coef.on = 0;
4486 spec->mute_led_coef.off = 1 << 5;
4487 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4488 }
4489 }
4490
4491 /* 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)4492 static int coef_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_coef_led(codec, &spec->mic_led_coef,
4499 spec->micmute_led_polarity, brightness);
4500 return 0;
4501 }
4502
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4503 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4504 const struct hda_fixup *fix, int action)
4505 {
4506 struct alc_spec *spec = codec->spec;
4507
4508 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4509 spec->mic_led_coef.idx = 0x19;
4510 spec->mic_led_coef.mask = 1 << 13;
4511 spec->mic_led_coef.on = 1 << 13;
4512 spec->mic_led_coef.off = 0;
4513 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4514 }
4515 }
4516
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4517 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4518 const struct hda_fixup *fix, int action)
4519 {
4520 struct alc_spec *spec = codec->spec;
4521
4522 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4523 spec->mic_led_coef.idx = 0x35;
4524 spec->mic_led_coef.mask = 3 << 2;
4525 spec->mic_led_coef.on = 2 << 2;
4526 spec->mic_led_coef.off = 1 << 2;
4527 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4528 }
4529 }
4530
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4531 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4532 const struct hda_fixup *fix, int action)
4533 {
4534 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4535 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4536 }
4537
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4538 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4539 const struct hda_fixup *fix, int action)
4540 {
4541 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4542 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4543 }
4544
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4545 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4546 const struct hda_fixup *fix, int action)
4547 {
4548 struct alc_spec *spec = codec->spec;
4549
4550 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4551 spec->cap_mute_led_nid = 0x1a;
4552 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4553 codec->power_filter = led_power_filter;
4554 }
4555 }
4556
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4557 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4558 const struct hda_fixup *fix, int action)
4559 {
4560 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4561 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4562 }
4563
4564 #if IS_REACHABLE(CONFIG_INPUT)
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4565 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4566 struct hda_jack_callback *event)
4567 {
4568 struct alc_spec *spec = codec->spec;
4569
4570 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4571 send both key on and key off event for every interrupt. */
4572 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4573 input_sync(spec->kb_dev);
4574 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4575 input_sync(spec->kb_dev);
4576 }
4577
alc_register_micmute_input_device(struct hda_codec * codec)4578 static int alc_register_micmute_input_device(struct hda_codec *codec)
4579 {
4580 struct alc_spec *spec = codec->spec;
4581 int i;
4582
4583 spec->kb_dev = input_allocate_device();
4584 if (!spec->kb_dev) {
4585 codec_err(codec, "Out of memory (input_allocate_device)\n");
4586 return -ENOMEM;
4587 }
4588
4589 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4590
4591 spec->kb_dev->name = "Microphone Mute Button";
4592 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4593 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4594 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4595 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4596 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4597 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4598
4599 if (input_register_device(spec->kb_dev)) {
4600 codec_err(codec, "input_register_device failed\n");
4601 input_free_device(spec->kb_dev);
4602 spec->kb_dev = NULL;
4603 return -ENOMEM;
4604 }
4605
4606 return 0;
4607 }
4608
4609 /* GPIO1 = set according to SKU external amp
4610 * GPIO2 = mic mute hotkey
4611 * GPIO3 = mute LED
4612 * GPIO4 = mic mute LED
4613 */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4614 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4615 const struct hda_fixup *fix, int action)
4616 {
4617 struct alc_spec *spec = codec->spec;
4618
4619 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4620 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4621 spec->init_amp = ALC_INIT_DEFAULT;
4622 if (alc_register_micmute_input_device(codec) != 0)
4623 return;
4624
4625 spec->gpio_mask |= 0x06;
4626 spec->gpio_dir |= 0x02;
4627 spec->gpio_data |= 0x02;
4628 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4629 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4630 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4631 gpio2_mic_hotkey_event);
4632 return;
4633 }
4634
4635 if (!spec->kb_dev)
4636 return;
4637
4638 switch (action) {
4639 case HDA_FIXUP_ACT_FREE:
4640 input_unregister_device(spec->kb_dev);
4641 spec->kb_dev = NULL;
4642 }
4643 }
4644
4645 /* Line2 = mic mute hotkey
4646 * GPIO2 = mic mute LED
4647 */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4648 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4649 const struct hda_fixup *fix, int action)
4650 {
4651 struct alc_spec *spec = codec->spec;
4652
4653 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4654 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4655 spec->init_amp = ALC_INIT_DEFAULT;
4656 if (alc_register_micmute_input_device(codec) != 0)
4657 return;
4658
4659 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4660 gpio2_mic_hotkey_event);
4661 return;
4662 }
4663
4664 if (!spec->kb_dev)
4665 return;
4666
4667 switch (action) {
4668 case HDA_FIXUP_ACT_FREE:
4669 input_unregister_device(spec->kb_dev);
4670 spec->kb_dev = NULL;
4671 }
4672 }
4673 #else /* INPUT */
4674 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4675 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4676 #endif /* INPUT */
4677
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4678 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4679 const struct hda_fixup *fix, int action)
4680 {
4681 struct alc_spec *spec = codec->spec;
4682
4683 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4684 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4685 spec->cap_mute_led_nid = 0x18;
4686 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4687 }
4688 }
4689
4690 static const struct coef_fw alc225_pre_hsmode[] = {
4691 UPDATE_COEF(0x4a, 1<<8, 0),
4692 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4693 UPDATE_COEF(0x63, 3<<14, 3<<14),
4694 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4695 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4696 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4697 UPDATE_COEF(0x4a, 3<<10, 0),
4698 {}
4699 };
4700
alc_headset_mode_unplugged(struct hda_codec * codec)4701 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4702 {
4703 struct alc_spec *spec = codec->spec;
4704 static const struct coef_fw coef0255[] = {
4705 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4706 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4707 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4708 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4709 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4710 {}
4711 };
4712 static const struct coef_fw coef0256[] = {
4713 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4714 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4715 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4716 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4717 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4718 {}
4719 };
4720 static const struct coef_fw coef0233[] = {
4721 WRITE_COEF(0x1b, 0x0c0b),
4722 WRITE_COEF(0x45, 0xc429),
4723 UPDATE_COEF(0x35, 0x4000, 0),
4724 WRITE_COEF(0x06, 0x2104),
4725 WRITE_COEF(0x1a, 0x0001),
4726 WRITE_COEF(0x26, 0x0004),
4727 WRITE_COEF(0x32, 0x42a3),
4728 {}
4729 };
4730 static const struct coef_fw coef0288[] = {
4731 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4732 UPDATE_COEF(0x50, 0x2000, 0x2000),
4733 UPDATE_COEF(0x56, 0x0006, 0x0006),
4734 UPDATE_COEF(0x66, 0x0008, 0),
4735 UPDATE_COEF(0x67, 0x2000, 0),
4736 {}
4737 };
4738 static const struct coef_fw coef0298[] = {
4739 UPDATE_COEF(0x19, 0x1300, 0x0300),
4740 {}
4741 };
4742 static const struct coef_fw coef0292[] = {
4743 WRITE_COEF(0x76, 0x000e),
4744 WRITE_COEF(0x6c, 0x2400),
4745 WRITE_COEF(0x18, 0x7308),
4746 WRITE_COEF(0x6b, 0xc429),
4747 {}
4748 };
4749 static const struct coef_fw coef0293[] = {
4750 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4751 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4752 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4753 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4754 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4755 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4756 {}
4757 };
4758 static const struct coef_fw coef0668[] = {
4759 WRITE_COEF(0x15, 0x0d40),
4760 WRITE_COEF(0xb7, 0x802b),
4761 {}
4762 };
4763 static const struct coef_fw coef0225[] = {
4764 UPDATE_COEF(0x63, 3<<14, 0),
4765 {}
4766 };
4767 static const struct coef_fw coef0274[] = {
4768 UPDATE_COEF(0x4a, 0x0100, 0),
4769 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4770 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4771 UPDATE_COEF(0x4a, 0x0010, 0),
4772 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4773 WRITE_COEF(0x45, 0x5289),
4774 UPDATE_COEF(0x4a, 0x0c00, 0),
4775 {}
4776 };
4777
4778 if (spec->no_internal_mic_pin) {
4779 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4780 return;
4781 }
4782
4783 switch (codec->core.vendor_id) {
4784 case 0x10ec0255:
4785 alc_process_coef_fw(codec, coef0255);
4786 break;
4787 case 0x10ec0230:
4788 case 0x10ec0236:
4789 case 0x10ec0256:
4790 alc_process_coef_fw(codec, coef0256);
4791 break;
4792 case 0x10ec0234:
4793 case 0x10ec0274:
4794 case 0x10ec0294:
4795 alc_process_coef_fw(codec, coef0274);
4796 break;
4797 case 0x10ec0233:
4798 case 0x10ec0283:
4799 alc_process_coef_fw(codec, coef0233);
4800 break;
4801 case 0x10ec0286:
4802 case 0x10ec0288:
4803 alc_process_coef_fw(codec, coef0288);
4804 break;
4805 case 0x10ec0298:
4806 alc_process_coef_fw(codec, coef0298);
4807 alc_process_coef_fw(codec, coef0288);
4808 break;
4809 case 0x10ec0292:
4810 alc_process_coef_fw(codec, coef0292);
4811 break;
4812 case 0x10ec0293:
4813 alc_process_coef_fw(codec, coef0293);
4814 break;
4815 case 0x10ec0668:
4816 alc_process_coef_fw(codec, coef0668);
4817 break;
4818 case 0x10ec0215:
4819 case 0x10ec0225:
4820 case 0x10ec0285:
4821 case 0x10ec0295:
4822 case 0x10ec0289:
4823 case 0x10ec0299:
4824 alc_process_coef_fw(codec, alc225_pre_hsmode);
4825 alc_process_coef_fw(codec, coef0225);
4826 break;
4827 case 0x10ec0867:
4828 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4829 break;
4830 }
4831 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
4832 }
4833
4834
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)4835 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4836 hda_nid_t mic_pin)
4837 {
4838 static const struct coef_fw coef0255[] = {
4839 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4840 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4841 {}
4842 };
4843 static const struct coef_fw coef0256[] = {
4844 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4845 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4846 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4847 {}
4848 };
4849 static const struct coef_fw coef0233[] = {
4850 UPDATE_COEF(0x35, 0, 1<<14),
4851 WRITE_COEF(0x06, 0x2100),
4852 WRITE_COEF(0x1a, 0x0021),
4853 WRITE_COEF(0x26, 0x008c),
4854 {}
4855 };
4856 static const struct coef_fw coef0288[] = {
4857 UPDATE_COEF(0x4f, 0x00c0, 0),
4858 UPDATE_COEF(0x50, 0x2000, 0),
4859 UPDATE_COEF(0x56, 0x0006, 0),
4860 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4861 UPDATE_COEF(0x66, 0x0008, 0x0008),
4862 UPDATE_COEF(0x67, 0x2000, 0x2000),
4863 {}
4864 };
4865 static const struct coef_fw coef0292[] = {
4866 WRITE_COEF(0x19, 0xa208),
4867 WRITE_COEF(0x2e, 0xacf0),
4868 {}
4869 };
4870 static const struct coef_fw coef0293[] = {
4871 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4872 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4873 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4874 {}
4875 };
4876 static const struct coef_fw coef0688[] = {
4877 WRITE_COEF(0xb7, 0x802b),
4878 WRITE_COEF(0xb5, 0x1040),
4879 UPDATE_COEF(0xc3, 0, 1<<12),
4880 {}
4881 };
4882 static const struct coef_fw coef0225[] = {
4883 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4884 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4885 UPDATE_COEF(0x63, 3<<14, 0),
4886 {}
4887 };
4888 static const struct coef_fw coef0274[] = {
4889 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4890 UPDATE_COEF(0x4a, 0x0010, 0),
4891 UPDATE_COEF(0x6b, 0xf000, 0),
4892 {}
4893 };
4894
4895 switch (codec->core.vendor_id) {
4896 case 0x10ec0255:
4897 alc_write_coef_idx(codec, 0x45, 0xc489);
4898 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4899 alc_process_coef_fw(codec, coef0255);
4900 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4901 break;
4902 case 0x10ec0230:
4903 case 0x10ec0236:
4904 case 0x10ec0256:
4905 alc_write_coef_idx(codec, 0x45, 0xc489);
4906 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4907 alc_process_coef_fw(codec, coef0256);
4908 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4909 break;
4910 case 0x10ec0234:
4911 case 0x10ec0274:
4912 case 0x10ec0294:
4913 alc_write_coef_idx(codec, 0x45, 0x4689);
4914 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4915 alc_process_coef_fw(codec, coef0274);
4916 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4917 break;
4918 case 0x10ec0233:
4919 case 0x10ec0283:
4920 alc_write_coef_idx(codec, 0x45, 0xc429);
4921 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4922 alc_process_coef_fw(codec, coef0233);
4923 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4924 break;
4925 case 0x10ec0286:
4926 case 0x10ec0288:
4927 case 0x10ec0298:
4928 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4929 alc_process_coef_fw(codec, coef0288);
4930 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4931 break;
4932 case 0x10ec0292:
4933 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4934 alc_process_coef_fw(codec, coef0292);
4935 break;
4936 case 0x10ec0293:
4937 /* Set to TRS mode */
4938 alc_write_coef_idx(codec, 0x45, 0xc429);
4939 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4940 alc_process_coef_fw(codec, coef0293);
4941 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4942 break;
4943 case 0x10ec0867:
4944 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4945 fallthrough;
4946 case 0x10ec0221:
4947 case 0x10ec0662:
4948 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4949 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4950 break;
4951 case 0x10ec0668:
4952 alc_write_coef_idx(codec, 0x11, 0x0001);
4953 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4954 alc_process_coef_fw(codec, coef0688);
4955 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4956 break;
4957 case 0x10ec0215:
4958 case 0x10ec0225:
4959 case 0x10ec0285:
4960 case 0x10ec0295:
4961 case 0x10ec0289:
4962 case 0x10ec0299:
4963 alc_process_coef_fw(codec, alc225_pre_hsmode);
4964 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4965 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4966 alc_process_coef_fw(codec, coef0225);
4967 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4968 break;
4969 }
4970 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
4971 }
4972
alc_headset_mode_default(struct hda_codec * codec)4973 static void alc_headset_mode_default(struct hda_codec *codec)
4974 {
4975 static const struct coef_fw coef0225[] = {
4976 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4977 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4978 UPDATE_COEF(0x49, 3<<8, 0<<8),
4979 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4980 UPDATE_COEF(0x63, 3<<14, 0),
4981 UPDATE_COEF(0x67, 0xf000, 0x3000),
4982 {}
4983 };
4984 static const struct coef_fw coef0255[] = {
4985 WRITE_COEF(0x45, 0xc089),
4986 WRITE_COEF(0x45, 0xc489),
4987 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4988 WRITE_COEF(0x49, 0x0049),
4989 {}
4990 };
4991 static const struct coef_fw coef0256[] = {
4992 WRITE_COEF(0x45, 0xc489),
4993 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4994 WRITE_COEF(0x49, 0x0049),
4995 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4996 WRITE_COEF(0x06, 0x6100),
4997 {}
4998 };
4999 static const struct coef_fw coef0233[] = {
5000 WRITE_COEF(0x06, 0x2100),
5001 WRITE_COEF(0x32, 0x4ea3),
5002 {}
5003 };
5004 static const struct coef_fw coef0288[] = {
5005 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5006 UPDATE_COEF(0x50, 0x2000, 0x2000),
5007 UPDATE_COEF(0x56, 0x0006, 0x0006),
5008 UPDATE_COEF(0x66, 0x0008, 0),
5009 UPDATE_COEF(0x67, 0x2000, 0),
5010 {}
5011 };
5012 static const struct coef_fw coef0292[] = {
5013 WRITE_COEF(0x76, 0x000e),
5014 WRITE_COEF(0x6c, 0x2400),
5015 WRITE_COEF(0x6b, 0xc429),
5016 WRITE_COEF(0x18, 0x7308),
5017 {}
5018 };
5019 static const struct coef_fw coef0293[] = {
5020 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5021 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5022 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5023 {}
5024 };
5025 static const struct coef_fw coef0688[] = {
5026 WRITE_COEF(0x11, 0x0041),
5027 WRITE_COEF(0x15, 0x0d40),
5028 WRITE_COEF(0xb7, 0x802b),
5029 {}
5030 };
5031 static const struct coef_fw coef0274[] = {
5032 WRITE_COEF(0x45, 0x4289),
5033 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5034 UPDATE_COEF(0x6b, 0x0f00, 0),
5035 UPDATE_COEF(0x49, 0x0300, 0x0300),
5036 {}
5037 };
5038
5039 switch (codec->core.vendor_id) {
5040 case 0x10ec0215:
5041 case 0x10ec0225:
5042 case 0x10ec0285:
5043 case 0x10ec0295:
5044 case 0x10ec0289:
5045 case 0x10ec0299:
5046 alc_process_coef_fw(codec, alc225_pre_hsmode);
5047 alc_process_coef_fw(codec, coef0225);
5048 break;
5049 case 0x10ec0255:
5050 alc_process_coef_fw(codec, coef0255);
5051 break;
5052 case 0x10ec0230:
5053 case 0x10ec0236:
5054 case 0x10ec0256:
5055 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5056 alc_write_coef_idx(codec, 0x45, 0xc089);
5057 msleep(50);
5058 alc_process_coef_fw(codec, coef0256);
5059 break;
5060 case 0x10ec0234:
5061 case 0x10ec0274:
5062 case 0x10ec0294:
5063 alc_process_coef_fw(codec, coef0274);
5064 break;
5065 case 0x10ec0233:
5066 case 0x10ec0283:
5067 alc_process_coef_fw(codec, coef0233);
5068 break;
5069 case 0x10ec0286:
5070 case 0x10ec0288:
5071 case 0x10ec0298:
5072 alc_process_coef_fw(codec, coef0288);
5073 break;
5074 case 0x10ec0292:
5075 alc_process_coef_fw(codec, coef0292);
5076 break;
5077 case 0x10ec0293:
5078 alc_process_coef_fw(codec, coef0293);
5079 break;
5080 case 0x10ec0668:
5081 alc_process_coef_fw(codec, coef0688);
5082 break;
5083 case 0x10ec0867:
5084 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5085 break;
5086 }
5087 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5088 }
5089
5090 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5091 static void alc_headset_mode_ctia(struct hda_codec *codec)
5092 {
5093 int val;
5094
5095 static const struct coef_fw coef0255[] = {
5096 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5097 WRITE_COEF(0x1b, 0x0c2b),
5098 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5099 {}
5100 };
5101 static const struct coef_fw coef0256[] = {
5102 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5103 WRITE_COEF(0x1b, 0x0e6b),
5104 {}
5105 };
5106 static const struct coef_fw coef0233[] = {
5107 WRITE_COEF(0x45, 0xd429),
5108 WRITE_COEF(0x1b, 0x0c2b),
5109 WRITE_COEF(0x32, 0x4ea3),
5110 {}
5111 };
5112 static const struct coef_fw coef0288[] = {
5113 UPDATE_COEF(0x50, 0x2000, 0x2000),
5114 UPDATE_COEF(0x56, 0x0006, 0x0006),
5115 UPDATE_COEF(0x66, 0x0008, 0),
5116 UPDATE_COEF(0x67, 0x2000, 0),
5117 {}
5118 };
5119 static const struct coef_fw coef0292[] = {
5120 WRITE_COEF(0x6b, 0xd429),
5121 WRITE_COEF(0x76, 0x0008),
5122 WRITE_COEF(0x18, 0x7388),
5123 {}
5124 };
5125 static const struct coef_fw coef0293[] = {
5126 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5127 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5128 {}
5129 };
5130 static const struct coef_fw coef0688[] = {
5131 WRITE_COEF(0x11, 0x0001),
5132 WRITE_COEF(0x15, 0x0d60),
5133 WRITE_COEF(0xc3, 0x0000),
5134 {}
5135 };
5136 static const struct coef_fw coef0225_1[] = {
5137 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5138 UPDATE_COEF(0x63, 3<<14, 2<<14),
5139 {}
5140 };
5141 static const struct coef_fw coef0225_2[] = {
5142 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5143 UPDATE_COEF(0x63, 3<<14, 1<<14),
5144 {}
5145 };
5146
5147 switch (codec->core.vendor_id) {
5148 case 0x10ec0255:
5149 alc_process_coef_fw(codec, coef0255);
5150 break;
5151 case 0x10ec0230:
5152 case 0x10ec0236:
5153 case 0x10ec0256:
5154 alc_process_coef_fw(codec, coef0256);
5155 break;
5156 case 0x10ec0234:
5157 case 0x10ec0274:
5158 case 0x10ec0294:
5159 alc_write_coef_idx(codec, 0x45, 0xd689);
5160 break;
5161 case 0x10ec0233:
5162 case 0x10ec0283:
5163 alc_process_coef_fw(codec, coef0233);
5164 break;
5165 case 0x10ec0298:
5166 val = alc_read_coef_idx(codec, 0x50);
5167 if (val & (1 << 12)) {
5168 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5169 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5170 msleep(300);
5171 } else {
5172 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5173 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5174 msleep(300);
5175 }
5176 break;
5177 case 0x10ec0286:
5178 case 0x10ec0288:
5179 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5180 msleep(300);
5181 alc_process_coef_fw(codec, coef0288);
5182 break;
5183 case 0x10ec0292:
5184 alc_process_coef_fw(codec, coef0292);
5185 break;
5186 case 0x10ec0293:
5187 alc_process_coef_fw(codec, coef0293);
5188 break;
5189 case 0x10ec0668:
5190 alc_process_coef_fw(codec, coef0688);
5191 break;
5192 case 0x10ec0215:
5193 case 0x10ec0225:
5194 case 0x10ec0285:
5195 case 0x10ec0295:
5196 case 0x10ec0289:
5197 case 0x10ec0299:
5198 val = alc_read_coef_idx(codec, 0x45);
5199 if (val & (1 << 9))
5200 alc_process_coef_fw(codec, coef0225_2);
5201 else
5202 alc_process_coef_fw(codec, coef0225_1);
5203 break;
5204 case 0x10ec0867:
5205 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5206 break;
5207 }
5208 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5209 }
5210
5211 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5212 static void alc_headset_mode_omtp(struct hda_codec *codec)
5213 {
5214 static const struct coef_fw coef0255[] = {
5215 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5216 WRITE_COEF(0x1b, 0x0c2b),
5217 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5218 {}
5219 };
5220 static const struct coef_fw coef0256[] = {
5221 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5222 WRITE_COEF(0x1b, 0x0e6b),
5223 {}
5224 };
5225 static const struct coef_fw coef0233[] = {
5226 WRITE_COEF(0x45, 0xe429),
5227 WRITE_COEF(0x1b, 0x0c2b),
5228 WRITE_COEF(0x32, 0x4ea3),
5229 {}
5230 };
5231 static const struct coef_fw coef0288[] = {
5232 UPDATE_COEF(0x50, 0x2000, 0x2000),
5233 UPDATE_COEF(0x56, 0x0006, 0x0006),
5234 UPDATE_COEF(0x66, 0x0008, 0),
5235 UPDATE_COEF(0x67, 0x2000, 0),
5236 {}
5237 };
5238 static const struct coef_fw coef0292[] = {
5239 WRITE_COEF(0x6b, 0xe429),
5240 WRITE_COEF(0x76, 0x0008),
5241 WRITE_COEF(0x18, 0x7388),
5242 {}
5243 };
5244 static const struct coef_fw coef0293[] = {
5245 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5246 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5247 {}
5248 };
5249 static const struct coef_fw coef0688[] = {
5250 WRITE_COEF(0x11, 0x0001),
5251 WRITE_COEF(0x15, 0x0d50),
5252 WRITE_COEF(0xc3, 0x0000),
5253 {}
5254 };
5255 static const struct coef_fw coef0225[] = {
5256 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5257 UPDATE_COEF(0x63, 3<<14, 2<<14),
5258 {}
5259 };
5260
5261 switch (codec->core.vendor_id) {
5262 case 0x10ec0255:
5263 alc_process_coef_fw(codec, coef0255);
5264 break;
5265 case 0x10ec0230:
5266 case 0x10ec0236:
5267 case 0x10ec0256:
5268 alc_process_coef_fw(codec, coef0256);
5269 break;
5270 case 0x10ec0234:
5271 case 0x10ec0274:
5272 case 0x10ec0294:
5273 alc_write_coef_idx(codec, 0x45, 0xe689);
5274 break;
5275 case 0x10ec0233:
5276 case 0x10ec0283:
5277 alc_process_coef_fw(codec, coef0233);
5278 break;
5279 case 0x10ec0298:
5280 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5281 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5282 msleep(300);
5283 break;
5284 case 0x10ec0286:
5285 case 0x10ec0288:
5286 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5287 msleep(300);
5288 alc_process_coef_fw(codec, coef0288);
5289 break;
5290 case 0x10ec0292:
5291 alc_process_coef_fw(codec, coef0292);
5292 break;
5293 case 0x10ec0293:
5294 alc_process_coef_fw(codec, coef0293);
5295 break;
5296 case 0x10ec0668:
5297 alc_process_coef_fw(codec, coef0688);
5298 break;
5299 case 0x10ec0215:
5300 case 0x10ec0225:
5301 case 0x10ec0285:
5302 case 0x10ec0295:
5303 case 0x10ec0289:
5304 case 0x10ec0299:
5305 alc_process_coef_fw(codec, coef0225);
5306 break;
5307 }
5308 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5309 }
5310
alc_determine_headset_type(struct hda_codec * codec)5311 static void alc_determine_headset_type(struct hda_codec *codec)
5312 {
5313 int val;
5314 bool is_ctia = false;
5315 struct alc_spec *spec = codec->spec;
5316 static const struct coef_fw coef0255[] = {
5317 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5318 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5319 conteol) */
5320 {}
5321 };
5322 static const struct coef_fw coef0288[] = {
5323 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5324 {}
5325 };
5326 static const struct coef_fw coef0298[] = {
5327 UPDATE_COEF(0x50, 0x2000, 0x2000),
5328 UPDATE_COEF(0x56, 0x0006, 0x0006),
5329 UPDATE_COEF(0x66, 0x0008, 0),
5330 UPDATE_COEF(0x67, 0x2000, 0),
5331 UPDATE_COEF(0x19, 0x1300, 0x1300),
5332 {}
5333 };
5334 static const struct coef_fw coef0293[] = {
5335 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5336 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5337 {}
5338 };
5339 static const struct coef_fw coef0688[] = {
5340 WRITE_COEF(0x11, 0x0001),
5341 WRITE_COEF(0xb7, 0x802b),
5342 WRITE_COEF(0x15, 0x0d60),
5343 WRITE_COEF(0xc3, 0x0c00),
5344 {}
5345 };
5346 static const struct coef_fw coef0274[] = {
5347 UPDATE_COEF(0x4a, 0x0010, 0),
5348 UPDATE_COEF(0x4a, 0x8000, 0),
5349 WRITE_COEF(0x45, 0xd289),
5350 UPDATE_COEF(0x49, 0x0300, 0x0300),
5351 {}
5352 };
5353
5354 if (spec->no_internal_mic_pin) {
5355 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5356 return;
5357 }
5358
5359 switch (codec->core.vendor_id) {
5360 case 0x10ec0255:
5361 alc_process_coef_fw(codec, coef0255);
5362 msleep(300);
5363 val = alc_read_coef_idx(codec, 0x46);
5364 is_ctia = (val & 0x0070) == 0x0070;
5365 break;
5366 case 0x10ec0230:
5367 case 0x10ec0236:
5368 case 0x10ec0256:
5369 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5370 alc_write_coef_idx(codec, 0x06, 0x6104);
5371 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5372
5373 snd_hda_codec_write(codec, 0x21, 0,
5374 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5375 msleep(80);
5376 snd_hda_codec_write(codec, 0x21, 0,
5377 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5378
5379 alc_process_coef_fw(codec, coef0255);
5380 msleep(300);
5381 val = alc_read_coef_idx(codec, 0x46);
5382 is_ctia = (val & 0x0070) == 0x0070;
5383
5384 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5385 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5386
5387 snd_hda_codec_write(codec, 0x21, 0,
5388 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5389 msleep(80);
5390 snd_hda_codec_write(codec, 0x21, 0,
5391 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5392 break;
5393 case 0x10ec0234:
5394 case 0x10ec0274:
5395 case 0x10ec0294:
5396 alc_process_coef_fw(codec, coef0274);
5397 msleep(850);
5398 val = alc_read_coef_idx(codec, 0x46);
5399 is_ctia = (val & 0x00f0) == 0x00f0;
5400 break;
5401 case 0x10ec0233:
5402 case 0x10ec0283:
5403 alc_write_coef_idx(codec, 0x45, 0xd029);
5404 msleep(300);
5405 val = alc_read_coef_idx(codec, 0x46);
5406 is_ctia = (val & 0x0070) == 0x0070;
5407 break;
5408 case 0x10ec0298:
5409 snd_hda_codec_write(codec, 0x21, 0,
5410 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5411 msleep(100);
5412 snd_hda_codec_write(codec, 0x21, 0,
5413 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5414 msleep(200);
5415
5416 val = alc_read_coef_idx(codec, 0x50);
5417 if (val & (1 << 12)) {
5418 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5419 alc_process_coef_fw(codec, coef0288);
5420 msleep(350);
5421 val = alc_read_coef_idx(codec, 0x50);
5422 is_ctia = (val & 0x0070) == 0x0070;
5423 } else {
5424 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5425 alc_process_coef_fw(codec, coef0288);
5426 msleep(350);
5427 val = alc_read_coef_idx(codec, 0x50);
5428 is_ctia = (val & 0x0070) == 0x0070;
5429 }
5430 alc_process_coef_fw(codec, coef0298);
5431 snd_hda_codec_write(codec, 0x21, 0,
5432 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5433 msleep(75);
5434 snd_hda_codec_write(codec, 0x21, 0,
5435 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5436 break;
5437 case 0x10ec0286:
5438 case 0x10ec0288:
5439 alc_process_coef_fw(codec, coef0288);
5440 msleep(350);
5441 val = alc_read_coef_idx(codec, 0x50);
5442 is_ctia = (val & 0x0070) == 0x0070;
5443 break;
5444 case 0x10ec0292:
5445 alc_write_coef_idx(codec, 0x6b, 0xd429);
5446 msleep(300);
5447 val = alc_read_coef_idx(codec, 0x6c);
5448 is_ctia = (val & 0x001c) == 0x001c;
5449 break;
5450 case 0x10ec0293:
5451 alc_process_coef_fw(codec, coef0293);
5452 msleep(300);
5453 val = alc_read_coef_idx(codec, 0x46);
5454 is_ctia = (val & 0x0070) == 0x0070;
5455 break;
5456 case 0x10ec0668:
5457 alc_process_coef_fw(codec, coef0688);
5458 msleep(300);
5459 val = alc_read_coef_idx(codec, 0xbe);
5460 is_ctia = (val & 0x1c02) == 0x1c02;
5461 break;
5462 case 0x10ec0215:
5463 case 0x10ec0225:
5464 case 0x10ec0285:
5465 case 0x10ec0295:
5466 case 0x10ec0289:
5467 case 0x10ec0299:
5468 snd_hda_codec_write(codec, 0x21, 0,
5469 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5470 msleep(80);
5471 snd_hda_codec_write(codec, 0x21, 0,
5472 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5473
5474 alc_process_coef_fw(codec, alc225_pre_hsmode);
5475 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5476 val = alc_read_coef_idx(codec, 0x45);
5477 if (val & (1 << 9)) {
5478 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5479 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5480 msleep(800);
5481 val = alc_read_coef_idx(codec, 0x46);
5482 is_ctia = (val & 0x00f0) == 0x00f0;
5483 } else {
5484 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5485 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5486 msleep(800);
5487 val = alc_read_coef_idx(codec, 0x46);
5488 is_ctia = (val & 0x00f0) == 0x00f0;
5489 }
5490 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5491 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5492 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5493
5494 snd_hda_codec_write(codec, 0x21, 0,
5495 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5496 msleep(80);
5497 snd_hda_codec_write(codec, 0x21, 0,
5498 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5499 break;
5500 case 0x10ec0867:
5501 is_ctia = true;
5502 break;
5503 }
5504
5505 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5506 is_ctia ? "yes" : "no");
5507 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5508 }
5509
alc_update_headset_mode(struct hda_codec * codec)5510 static void alc_update_headset_mode(struct hda_codec *codec)
5511 {
5512 struct alc_spec *spec = codec->spec;
5513
5514 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5515 hda_nid_t hp_pin = alc_get_hp_pin(spec);
5516
5517 int new_headset_mode;
5518
5519 if (!snd_hda_jack_detect(codec, hp_pin))
5520 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5521 else if (mux_pin == spec->headset_mic_pin)
5522 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5523 else if (mux_pin == spec->headphone_mic_pin)
5524 new_headset_mode = ALC_HEADSET_MODE_MIC;
5525 else
5526 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5527
5528 if (new_headset_mode == spec->current_headset_mode) {
5529 snd_hda_gen_update_outputs(codec);
5530 return;
5531 }
5532
5533 switch (new_headset_mode) {
5534 case ALC_HEADSET_MODE_UNPLUGGED:
5535 alc_headset_mode_unplugged(codec);
5536 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5537 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5538 spec->gen.hp_jack_present = false;
5539 break;
5540 case ALC_HEADSET_MODE_HEADSET:
5541 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5542 alc_determine_headset_type(codec);
5543 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5544 alc_headset_mode_ctia(codec);
5545 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5546 alc_headset_mode_omtp(codec);
5547 spec->gen.hp_jack_present = true;
5548 break;
5549 case ALC_HEADSET_MODE_MIC:
5550 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5551 spec->gen.hp_jack_present = false;
5552 break;
5553 case ALC_HEADSET_MODE_HEADPHONE:
5554 alc_headset_mode_default(codec);
5555 spec->gen.hp_jack_present = true;
5556 break;
5557 }
5558 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5559 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5560 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5561 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5562 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5563 PIN_VREFHIZ);
5564 }
5565 spec->current_headset_mode = new_headset_mode;
5566
5567 snd_hda_gen_update_outputs(codec);
5568 }
5569
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5570 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5571 struct snd_kcontrol *kcontrol,
5572 struct snd_ctl_elem_value *ucontrol)
5573 {
5574 alc_update_headset_mode(codec);
5575 }
5576
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5577 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5578 struct hda_jack_callback *jack)
5579 {
5580 snd_hda_gen_hp_automute(codec, jack);
5581 alc_update_headset_mode(codec);
5582 }
5583
alc_probe_headset_mode(struct hda_codec * codec)5584 static void alc_probe_headset_mode(struct hda_codec *codec)
5585 {
5586 int i;
5587 struct alc_spec *spec = codec->spec;
5588 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5589
5590 /* Find mic pins */
5591 for (i = 0; i < cfg->num_inputs; i++) {
5592 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5593 spec->headset_mic_pin = cfg->inputs[i].pin;
5594 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5595 spec->headphone_mic_pin = cfg->inputs[i].pin;
5596 }
5597
5598 WARN_ON(spec->gen.cap_sync_hook);
5599 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5600 spec->gen.automute_hook = alc_update_headset_mode;
5601 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5602 }
5603
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5604 static void alc_fixup_headset_mode(struct hda_codec *codec,
5605 const struct hda_fixup *fix, int action)
5606 {
5607 struct alc_spec *spec = codec->spec;
5608
5609 switch (action) {
5610 case HDA_FIXUP_ACT_PRE_PROBE:
5611 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5612 break;
5613 case HDA_FIXUP_ACT_PROBE:
5614 alc_probe_headset_mode(codec);
5615 break;
5616 case HDA_FIXUP_ACT_INIT:
5617 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5618 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5619 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5620 }
5621 alc_update_headset_mode(codec);
5622 break;
5623 }
5624 }
5625
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5626 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5627 const struct hda_fixup *fix, int action)
5628 {
5629 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5630 struct alc_spec *spec = codec->spec;
5631 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5632 }
5633 else
5634 alc_fixup_headset_mode(codec, fix, action);
5635 }
5636
alc255_set_default_jack_type(struct hda_codec * codec)5637 static void alc255_set_default_jack_type(struct hda_codec *codec)
5638 {
5639 /* Set to iphone type */
5640 static const struct coef_fw alc255fw[] = {
5641 WRITE_COEF(0x1b, 0x880b),
5642 WRITE_COEF(0x45, 0xd089),
5643 WRITE_COEF(0x1b, 0x080b),
5644 WRITE_COEF(0x46, 0x0004),
5645 WRITE_COEF(0x1b, 0x0c0b),
5646 {}
5647 };
5648 static const struct coef_fw alc256fw[] = {
5649 WRITE_COEF(0x1b, 0x884b),
5650 WRITE_COEF(0x45, 0xd089),
5651 WRITE_COEF(0x1b, 0x084b),
5652 WRITE_COEF(0x46, 0x0004),
5653 WRITE_COEF(0x1b, 0x0c4b),
5654 {}
5655 };
5656 switch (codec->core.vendor_id) {
5657 case 0x10ec0255:
5658 alc_process_coef_fw(codec, alc255fw);
5659 break;
5660 case 0x10ec0230:
5661 case 0x10ec0236:
5662 case 0x10ec0256:
5663 alc_process_coef_fw(codec, alc256fw);
5664 break;
5665 }
5666 msleep(30);
5667 }
5668
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)5669 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5670 const struct hda_fixup *fix, int action)
5671 {
5672 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5673 alc255_set_default_jack_type(codec);
5674 }
5675 alc_fixup_headset_mode(codec, fix, action);
5676 }
5677
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5678 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5679 const struct hda_fixup *fix, int action)
5680 {
5681 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5682 struct alc_spec *spec = codec->spec;
5683 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5684 alc255_set_default_jack_type(codec);
5685 }
5686 else
5687 alc_fixup_headset_mode(codec, fix, action);
5688 }
5689
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5690 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5691 struct hda_jack_callback *jack)
5692 {
5693 struct alc_spec *spec = codec->spec;
5694
5695 alc_update_headset_jack_cb(codec, jack);
5696 /* Headset Mic enable or disable, only for Dell Dino */
5697 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5698 }
5699
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)5700 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5701 const struct hda_fixup *fix, int action)
5702 {
5703 alc_fixup_headset_mode(codec, fix, action);
5704 if (action == HDA_FIXUP_ACT_PROBE) {
5705 struct alc_spec *spec = codec->spec;
5706 /* toggled via hp_automute_hook */
5707 spec->gpio_mask |= 0x40;
5708 spec->gpio_dir |= 0x40;
5709 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5710 }
5711 }
5712
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)5713 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5714 const struct hda_fixup *fix, int action)
5715 {
5716 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5717 struct alc_spec *spec = codec->spec;
5718 spec->gen.auto_mute_via_amp = 1;
5719 }
5720 }
5721
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)5722 static void alc_fixup_no_shutup(struct hda_codec *codec,
5723 const struct hda_fixup *fix, int action)
5724 {
5725 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5726 struct alc_spec *spec = codec->spec;
5727 spec->no_shutup_pins = 1;
5728 }
5729 }
5730
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)5731 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5732 const struct hda_fixup *fix, int action)
5733 {
5734 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5735 struct alc_spec *spec = codec->spec;
5736 /* Disable AA-loopback as it causes white noise */
5737 spec->gen.mixer_nid = 0;
5738 }
5739 }
5740
5741 /* 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)5742 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5743 const struct hda_fixup *fix, int action)
5744 {
5745 static const struct hda_pintbl pincfgs[] = {
5746 { 0x16, 0x21211010 }, /* dock headphone */
5747 { 0x19, 0x21a11010 }, /* dock mic */
5748 { }
5749 };
5750 struct alc_spec *spec = codec->spec;
5751
5752 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5753 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
5754 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5755 codec->power_save_node = 0; /* avoid click noises */
5756 snd_hda_apply_pincfgs(codec, pincfgs);
5757 }
5758 }
5759
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)5760 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5761 const struct hda_fixup *fix, int action)
5762 {
5763 static const struct hda_pintbl pincfgs[] = {
5764 { 0x17, 0x21211010 }, /* dock headphone */
5765 { 0x19, 0x21a11010 }, /* dock mic */
5766 { }
5767 };
5768 struct alc_spec *spec = codec->spec;
5769
5770 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5771 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5772 snd_hda_apply_pincfgs(codec, pincfgs);
5773 } else if (action == HDA_FIXUP_ACT_INIT) {
5774 /* Enable DOCK device */
5775 snd_hda_codec_write(codec, 0x17, 0,
5776 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5777 /* Enable DOCK device */
5778 snd_hda_codec_write(codec, 0x19, 0,
5779 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5780 }
5781 }
5782
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)5783 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5784 const struct hda_fixup *fix, int action)
5785 {
5786 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5787 * the speaker output becomes too low by some reason on Thinkpads with
5788 * ALC298 codec
5789 */
5790 static const hda_nid_t preferred_pairs[] = {
5791 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5792 0
5793 };
5794 struct alc_spec *spec = codec->spec;
5795
5796 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5797 spec->gen.preferred_dacs = preferred_pairs;
5798 }
5799
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)5800 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5801 const struct hda_fixup *fix, int action)
5802 {
5803 static const hda_nid_t preferred_pairs[] = {
5804 0x17, 0x02, 0x21, 0x03, 0
5805 };
5806 struct alc_spec *spec = codec->spec;
5807
5808 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5809 spec->gen.preferred_dacs = preferred_pairs;
5810 }
5811
alc_shutup_dell_xps13(struct hda_codec * codec)5812 static void alc_shutup_dell_xps13(struct hda_codec *codec)
5813 {
5814 struct alc_spec *spec = codec->spec;
5815 int hp_pin = alc_get_hp_pin(spec);
5816
5817 /* Prevent pop noises when headphones are plugged in */
5818 snd_hda_codec_write(codec, hp_pin, 0,
5819 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5820 msleep(20);
5821 }
5822
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)5823 static void alc_fixup_dell_xps13(struct hda_codec *codec,
5824 const struct hda_fixup *fix, int action)
5825 {
5826 struct alc_spec *spec = codec->spec;
5827 struct hda_input_mux *imux = &spec->gen.input_mux;
5828 int i;
5829
5830 switch (action) {
5831 case HDA_FIXUP_ACT_PRE_PROBE:
5832 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5833 * it causes a click noise at start up
5834 */
5835 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5836 spec->shutup = alc_shutup_dell_xps13;
5837 break;
5838 case HDA_FIXUP_ACT_PROBE:
5839 /* Make the internal mic the default input source. */
5840 for (i = 0; i < imux->num_items; i++) {
5841 if (spec->gen.imux_pins[i] == 0x12) {
5842 spec->gen.cur_mux[0] = i;
5843 break;
5844 }
5845 }
5846 break;
5847 }
5848 }
5849
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)5850 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5851 const struct hda_fixup *fix, int action)
5852 {
5853 struct alc_spec *spec = codec->spec;
5854
5855 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5856 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5857 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
5858
5859 /* Disable boost for mic-in permanently. (This code is only called
5860 from quirks that guarantee that the headphone is at NID 0x1b.) */
5861 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5862 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
5863 } else
5864 alc_fixup_headset_mode(codec, fix, action);
5865 }
5866
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)5867 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5868 const struct hda_fixup *fix, int action)
5869 {
5870 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5871 alc_write_coef_idx(codec, 0xc4, 0x8000);
5872 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
5873 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5874 }
5875 alc_fixup_headset_mode(codec, fix, action);
5876 }
5877
5878 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)5879 static int find_ext_mic_pin(struct hda_codec *codec)
5880 {
5881 struct alc_spec *spec = codec->spec;
5882 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5883 hda_nid_t nid;
5884 unsigned int defcfg;
5885 int i;
5886
5887 for (i = 0; i < cfg->num_inputs; i++) {
5888 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5889 continue;
5890 nid = cfg->inputs[i].pin;
5891 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5892 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5893 continue;
5894 return nid;
5895 }
5896
5897 return 0;
5898 }
5899
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)5900 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
5901 const struct hda_fixup *fix,
5902 int action)
5903 {
5904 struct alc_spec *spec = codec->spec;
5905
5906 if (action == HDA_FIXUP_ACT_PROBE) {
5907 int mic_pin = find_ext_mic_pin(codec);
5908 int hp_pin = alc_get_hp_pin(spec);
5909
5910 if (snd_BUG_ON(!mic_pin || !hp_pin))
5911 return;
5912 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
5913 }
5914 }
5915
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)5916 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5917 const struct hda_fixup *fix,
5918 int action)
5919 {
5920 struct alc_spec *spec = codec->spec;
5921 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5922 int i;
5923
5924 /* The mic boosts on level 2 and 3 are too noisy
5925 on the internal mic input.
5926 Therefore limit the boost to 0 or 1. */
5927
5928 if (action != HDA_FIXUP_ACT_PROBE)
5929 return;
5930
5931 for (i = 0; i < cfg->num_inputs; i++) {
5932 hda_nid_t nid = cfg->inputs[i].pin;
5933 unsigned int defcfg;
5934 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5935 continue;
5936 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5937 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5938 continue;
5939
5940 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5941 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5942 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5943 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5944 (0 << AC_AMPCAP_MUTE_SHIFT));
5945 }
5946 }
5947
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)5948 static void alc283_hp_automute_hook(struct hda_codec *codec,
5949 struct hda_jack_callback *jack)
5950 {
5951 struct alc_spec *spec = codec->spec;
5952 int vref;
5953
5954 msleep(200);
5955 snd_hda_gen_hp_automute(codec, jack);
5956
5957 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5958
5959 msleep(600);
5960 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5961 vref);
5962 }
5963
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)5964 static void alc283_fixup_chromebook(struct hda_codec *codec,
5965 const struct hda_fixup *fix, int action)
5966 {
5967 struct alc_spec *spec = codec->spec;
5968
5969 switch (action) {
5970 case HDA_FIXUP_ACT_PRE_PROBE:
5971 snd_hda_override_wcaps(codec, 0x03, 0);
5972 /* Disable AA-loopback as it causes white noise */
5973 spec->gen.mixer_nid = 0;
5974 break;
5975 case HDA_FIXUP_ACT_INIT:
5976 /* MIC2-VREF control */
5977 /* Set to manual mode */
5978 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5979 /* Enable Line1 input control by verb */
5980 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
5981 break;
5982 }
5983 }
5984
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)5985 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5986 const struct hda_fixup *fix, int action)
5987 {
5988 struct alc_spec *spec = codec->spec;
5989
5990 switch (action) {
5991 case HDA_FIXUP_ACT_PRE_PROBE:
5992 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5993 break;
5994 case HDA_FIXUP_ACT_INIT:
5995 /* MIC2-VREF control */
5996 /* Set to manual mode */
5997 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5998 break;
5999 }
6000 }
6001
6002 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6003 static void asus_tx300_automute(struct hda_codec *codec)
6004 {
6005 struct alc_spec *spec = codec->spec;
6006 snd_hda_gen_update_outputs(codec);
6007 if (snd_hda_jack_detect(codec, 0x1b))
6008 spec->gen.mute_bits |= (1ULL << 0x14);
6009 }
6010
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6011 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6012 const struct hda_fixup *fix, int action)
6013 {
6014 struct alc_spec *spec = codec->spec;
6015 static const struct hda_pintbl dock_pins[] = {
6016 { 0x1b, 0x21114000 }, /* dock speaker pin */
6017 {}
6018 };
6019
6020 switch (action) {
6021 case HDA_FIXUP_ACT_PRE_PROBE:
6022 spec->init_amp = ALC_INIT_DEFAULT;
6023 /* TX300 needs to set up GPIO2 for the speaker amp */
6024 alc_setup_gpio(codec, 0x04);
6025 snd_hda_apply_pincfgs(codec, dock_pins);
6026 spec->gen.auto_mute_via_amp = 1;
6027 spec->gen.automute_hook = asus_tx300_automute;
6028 snd_hda_jack_detect_enable_callback(codec, 0x1b,
6029 snd_hda_gen_hp_automute);
6030 break;
6031 case HDA_FIXUP_ACT_PROBE:
6032 spec->init_amp = ALC_INIT_DEFAULT;
6033 break;
6034 case HDA_FIXUP_ACT_BUILD:
6035 /* this is a bit tricky; give more sane names for the main
6036 * (tablet) speaker and the dock speaker, respectively
6037 */
6038 rename_ctl(codec, "Speaker Playback Switch",
6039 "Dock Speaker Playback Switch");
6040 rename_ctl(codec, "Bass Speaker Playback Switch",
6041 "Speaker Playback Switch");
6042 break;
6043 }
6044 }
6045
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6046 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6047 const struct hda_fixup *fix, int action)
6048 {
6049 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6050 /* DAC node 0x03 is giving mono output. We therefore want to
6051 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6052 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6053 static const hda_nid_t conn1[] = { 0x0c };
6054 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6055 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6056 }
6057 }
6058
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6059 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6060 const struct hda_fixup *fix, int action)
6061 {
6062 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6063 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6064 we can't adjust the speaker's volume since this node does not has
6065 Amp-out capability. we change the speaker's route to:
6066 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6067 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6068 speaker's volume now. */
6069
6070 static const hda_nid_t conn1[] = { 0x0c };
6071 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6072 }
6073 }
6074
6075 /* 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)6076 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6077 const struct hda_fixup *fix, int action)
6078 {
6079 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6080 static const hda_nid_t conn[] = { 0x02, 0x03 };
6081 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6082 }
6083 }
6084
6085 /* 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)6086 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6087 const struct hda_fixup *fix, int action)
6088 {
6089 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6090 static const hda_nid_t conn[] = { 0x02 };
6091 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6092 }
6093 }
6094
6095 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6096 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6097 struct hda_jack_callback *jack)
6098 {
6099 struct alc_spec *spec = codec->spec;
6100
6101 snd_hda_gen_hp_automute(codec, jack);
6102 /* mute_led_polarity is set to 0, so we pass inverted value here */
6103 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6104 !spec->gen.hp_jack_present);
6105 }
6106
6107 /* Manage GPIOs for HP EliteBook Folio 9480m.
6108 *
6109 * GPIO4 is the headphone amplifier power control
6110 * GPIO3 is the audio output mute indicator LED
6111 */
6112
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6113 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6114 const struct hda_fixup *fix,
6115 int action)
6116 {
6117 struct alc_spec *spec = codec->spec;
6118
6119 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6120 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6121 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6122 spec->gpio_mask |= 0x10;
6123 spec->gpio_dir |= 0x10;
6124 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6125 }
6126 }
6127
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6128 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6129 const struct hda_fixup *fix,
6130 int action)
6131 {
6132 struct alc_spec *spec = codec->spec;
6133
6134 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6135 spec->gpio_mask |= 0x04;
6136 spec->gpio_dir |= 0x04;
6137 /* set data bit low */
6138 }
6139 }
6140
6141 /* Quirk for Thinkpad X1 7th and 8th Gen
6142 * The following fixed routing needed
6143 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6144 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6145 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6146 */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6147 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6148 const struct hda_fixup *fix, int action)
6149 {
6150 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6151 static const hda_nid_t preferred_pairs[] = {
6152 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6153 };
6154 struct alc_spec *spec = codec->spec;
6155
6156 switch (action) {
6157 case HDA_FIXUP_ACT_PRE_PROBE:
6158 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6159 spec->gen.preferred_dacs = preferred_pairs;
6160 break;
6161 case HDA_FIXUP_ACT_BUILD:
6162 /* The generic parser creates somewhat unintuitive volume ctls
6163 * with the fixed routing above, and the shared DAC2 may be
6164 * confusing for PA.
6165 * Rename those to unique names so that PA doesn't touch them
6166 * and use only Master volume.
6167 */
6168 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6169 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6170 break;
6171 }
6172 }
6173
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6174 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6175 const struct hda_fixup *fix,
6176 int action)
6177 {
6178 alc_fixup_dual_codecs(codec, fix, action);
6179 switch (action) {
6180 case HDA_FIXUP_ACT_PRE_PROBE:
6181 /* override card longname to provide a unique UCM profile */
6182 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6183 break;
6184 case HDA_FIXUP_ACT_BUILD:
6185 /* rename Capture controls depending on the codec */
6186 rename_ctl(codec, "Capture Volume",
6187 codec->addr == 0 ?
6188 "Rear-Panel Capture Volume" :
6189 "Front-Panel Capture Volume");
6190 rename_ctl(codec, "Capture Switch",
6191 codec->addr == 0 ?
6192 "Rear-Panel Capture Switch" :
6193 "Front-Panel Capture Switch");
6194 break;
6195 }
6196 }
6197
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6198 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6199 const struct hda_fixup *fix, int action)
6200 {
6201 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6202 return;
6203
6204 codec->power_save_node = 1;
6205 }
6206
6207 /* 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)6208 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6209 const struct hda_fixup *fix, int action)
6210 {
6211 struct alc_spec *spec = codec->spec;
6212 static const hda_nid_t preferred_pairs[] = {
6213 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6214 0
6215 };
6216
6217 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6218 return;
6219
6220 spec->gen.preferred_dacs = preferred_pairs;
6221 spec->gen.auto_mute_via_amp = 1;
6222 codec->power_save_node = 0;
6223 }
6224
6225 /* 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)6226 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6227 const struct hda_fixup *fix, int action)
6228 {
6229 static const hda_nid_t preferred_pairs[] = {
6230 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6231 };
6232 struct alc_spec *spec = codec->spec;
6233
6234 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6235 spec->gen.preferred_dacs = preferred_pairs;
6236 spec->gen.obey_preferred_dacs = 1;
6237 }
6238 }
6239
6240 /* 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)6241 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6242 const struct hda_fixup *fix, int action)
6243 {
6244 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6245 return;
6246
6247 snd_hda_override_wcaps(codec, 0x03, 0);
6248 }
6249
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6250 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6251 {
6252 switch (codec->core.vendor_id) {
6253 case 0x10ec0274:
6254 case 0x10ec0294:
6255 case 0x10ec0225:
6256 case 0x10ec0295:
6257 case 0x10ec0299:
6258 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6259 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6260 break;
6261 case 0x10ec0230:
6262 case 0x10ec0235:
6263 case 0x10ec0236:
6264 case 0x10ec0255:
6265 case 0x10ec0256:
6266 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6267 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6268 break;
6269 }
6270 }
6271
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6272 static void alc295_fixup_chromebook(struct hda_codec *codec,
6273 const struct hda_fixup *fix, int action)
6274 {
6275 struct alc_spec *spec = codec->spec;
6276
6277 switch (action) {
6278 case HDA_FIXUP_ACT_PRE_PROBE:
6279 spec->ultra_low_power = true;
6280 break;
6281 case HDA_FIXUP_ACT_INIT:
6282 alc_combo_jack_hp_jd_restart(codec);
6283 break;
6284 }
6285 }
6286
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6287 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6288 const struct hda_fixup *fix, int action)
6289 {
6290 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6291 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6292 }
6293
6294
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6295 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6296 struct hda_jack_callback *cb)
6297 {
6298 /* The Windows driver sets the codec up in a very different way where
6299 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6300 */
6301 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6302 alc_write_coef_idx(codec, 0x10, 0x8a20);
6303 else
6304 alc_write_coef_idx(codec, 0x10, 0x0a20);
6305 }
6306
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6307 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6308 const struct hda_fixup *fix, int action)
6309 {
6310 /* Pin 0x21: headphones/headset mic */
6311 if (!is_jack_detectable(codec, 0x21))
6312 return;
6313
6314 switch (action) {
6315 case HDA_FIXUP_ACT_PRE_PROBE:
6316 snd_hda_jack_detect_enable_callback(codec, 0x21,
6317 alc294_gx502_toggle_output);
6318 break;
6319 case HDA_FIXUP_ACT_INIT:
6320 /* Make sure to start in a correct state, i.e. if
6321 * headphones have been plugged in before powering up the system
6322 */
6323 alc294_gx502_toggle_output(codec, NULL);
6324 break;
6325 }
6326 }
6327
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6328 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6329 struct hda_jack_callback *cb)
6330 {
6331 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6332 * responsible from changes between speakers and headphones
6333 */
6334 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6335 alc_write_coef_idx(codec, 0x10, 0x8420);
6336 else
6337 alc_write_coef_idx(codec, 0x10, 0x0a20);
6338 }
6339
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6340 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6341 const struct hda_fixup *fix, int action)
6342 {
6343 if (!is_jack_detectable(codec, 0x21))
6344 return;
6345
6346 switch (action) {
6347 case HDA_FIXUP_ACT_PRE_PROBE:
6348 snd_hda_jack_detect_enable_callback(codec, 0x21,
6349 alc294_gu502_toggle_output);
6350 break;
6351 case HDA_FIXUP_ACT_INIT:
6352 alc294_gu502_toggle_output(codec, NULL);
6353 break;
6354 }
6355 }
6356
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6357 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6358 const struct hda_fixup *fix, int action)
6359 {
6360 if (action != HDA_FIXUP_ACT_INIT)
6361 return;
6362
6363 msleep(100);
6364 alc_write_coef_idx(codec, 0x65, 0x0);
6365 }
6366
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6367 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6368 const struct hda_fixup *fix, int action)
6369 {
6370 switch (action) {
6371 case HDA_FIXUP_ACT_INIT:
6372 alc_combo_jack_hp_jd_restart(codec);
6373 break;
6374 }
6375 }
6376
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6377 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6378 const struct hda_fixup *fix, int action)
6379 {
6380 struct alc_spec *spec = codec->spec;
6381
6382 switch (action) {
6383 case HDA_FIXUP_ACT_PRE_PROBE:
6384 /* Mic RING SLEEVE swap for combo jack */
6385 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6386 spec->no_internal_mic_pin = true;
6387 break;
6388 case HDA_FIXUP_ACT_INIT:
6389 alc_combo_jack_hp_jd_restart(codec);
6390 break;
6391 }
6392 }
6393
6394 /* GPIO1 = amplifier on/off
6395 * GPIO3 = mic mute LED
6396 */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6397 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6398 const struct hda_fixup *fix, int action)
6399 {
6400 static const hda_nid_t conn[] = { 0x02 };
6401
6402 struct alc_spec *spec = codec->spec;
6403 static const struct hda_pintbl pincfgs[] = {
6404 { 0x14, 0x90170110 }, /* front/high speakers */
6405 { 0x17, 0x90170130 }, /* back/bass speakers */
6406 { }
6407 };
6408
6409 //enable micmute led
6410 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6411
6412 switch (action) {
6413 case HDA_FIXUP_ACT_PRE_PROBE:
6414 spec->micmute_led_polarity = 1;
6415 /* needed for amp of back speakers */
6416 spec->gpio_mask |= 0x01;
6417 spec->gpio_dir |= 0x01;
6418 snd_hda_apply_pincfgs(codec, pincfgs);
6419 /* share DAC to have unified volume control */
6420 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6421 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6422 break;
6423 case HDA_FIXUP_ACT_INIT:
6424 /* need to toggle GPIO to enable the amp of back speakers */
6425 alc_update_gpio_data(codec, 0x01, true);
6426 msleep(100);
6427 alc_update_gpio_data(codec, 0x01, false);
6428 break;
6429 }
6430 }
6431
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6432 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6433 const struct hda_fixup *fix, int action)
6434 {
6435 static const hda_nid_t conn[] = { 0x02 };
6436 static const struct hda_pintbl pincfgs[] = {
6437 { 0x14, 0x90170110 }, /* rear speaker */
6438 { }
6439 };
6440
6441 switch (action) {
6442 case HDA_FIXUP_ACT_PRE_PROBE:
6443 snd_hda_apply_pincfgs(codec, pincfgs);
6444 /* force front speaker to DAC1 */
6445 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6446 break;
6447 }
6448 }
6449
6450 /* for hda_fixup_thinkpad_acpi() */
6451 #include "thinkpad_helper.c"
6452
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6453 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6454 const struct hda_fixup *fix, int action)
6455 {
6456 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6457 hda_fixup_thinkpad_acpi(codec, fix, action);
6458 }
6459
6460 /* 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)6461 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6462 const struct hda_fixup *fix,
6463 int action)
6464 {
6465 struct alc_spec *spec = codec->spec;
6466
6467 switch (action) {
6468 case HDA_FIXUP_ACT_PRE_PROBE:
6469 spec->gen.suppress_auto_mute = 1;
6470 break;
6471 }
6472 }
6473
6474 /* for alc295_fixup_hp_top_speakers */
6475 #include "hp_x360_helper.c"
6476
6477 /* for alc285_fixup_ideapad_s740_coef() */
6478 #include "ideapad_s740_helper.c"
6479
6480 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6481 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6482 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6483 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6484 {}
6485 };
6486
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)6487 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6488 const struct hda_fixup *fix,
6489 int action)
6490 {
6491 /*
6492 * A certain other OS sets these coeffs to different values. On at least
6493 * one TongFang barebone these settings might survive even a cold
6494 * reboot. So to restore a clean slate the values are explicitly reset
6495 * to default here. Without this, the external microphone is always in a
6496 * plugged-in state, while the internal microphone is always in an
6497 * unplugged state, breaking the ability to use the internal microphone.
6498 */
6499 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
6500 }
6501
6502 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6503 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6504 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6505 WRITE_COEF(0x49, 0x0149),
6506 {}
6507 };
6508
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6509 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6510 const struct hda_fixup *fix,
6511 int action)
6512 {
6513 /*
6514 * The audio jack input and output is not detected on the ASRock NUC Box
6515 * 1100 series when cold booting without this fix. Warm rebooting from a
6516 * certain other OS makes the audio functional, as COEF settings are
6517 * preserved in this case. This fix sets these altered COEF values as
6518 * the default.
6519 */
6520 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6521 }
6522
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6523 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6524 const struct hda_fixup *fix,
6525 int action)
6526 {
6527 /*
6528 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6529 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6530 * needs an additional quirk for sound working after suspend and resume.
6531 */
6532 if (codec->core.vendor_id == 0x10ec0256) {
6533 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6534 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6535 } else {
6536 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6537 }
6538 }
6539
6540 enum {
6541 ALC269_FIXUP_GPIO2,
6542 ALC269_FIXUP_SONY_VAIO,
6543 ALC275_FIXUP_SONY_VAIO_GPIO2,
6544 ALC269_FIXUP_DELL_M101Z,
6545 ALC269_FIXUP_SKU_IGNORE,
6546 ALC269_FIXUP_ASUS_G73JW,
6547 ALC269_FIXUP_LENOVO_EAPD,
6548 ALC275_FIXUP_SONY_HWEQ,
6549 ALC275_FIXUP_SONY_DISABLE_AAMIX,
6550 ALC271_FIXUP_DMIC,
6551 ALC269_FIXUP_PCM_44K,
6552 ALC269_FIXUP_STEREO_DMIC,
6553 ALC269_FIXUP_HEADSET_MIC,
6554 ALC269_FIXUP_QUANTA_MUTE,
6555 ALC269_FIXUP_LIFEBOOK,
6556 ALC269_FIXUP_LIFEBOOK_EXTMIC,
6557 ALC269_FIXUP_LIFEBOOK_HP_PIN,
6558 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
6559 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
6560 ALC269_FIXUP_AMIC,
6561 ALC269_FIXUP_DMIC,
6562 ALC269VB_FIXUP_AMIC,
6563 ALC269VB_FIXUP_DMIC,
6564 ALC269_FIXUP_HP_MUTE_LED,
6565 ALC269_FIXUP_HP_MUTE_LED_MIC1,
6566 ALC269_FIXUP_HP_MUTE_LED_MIC2,
6567 ALC269_FIXUP_HP_MUTE_LED_MIC3,
6568 ALC269_FIXUP_HP_GPIO_LED,
6569 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6570 ALC269_FIXUP_HP_LINE1_MIC1_LED,
6571 ALC269_FIXUP_INV_DMIC,
6572 ALC269_FIXUP_LENOVO_DOCK,
6573 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
6574 ALC269_FIXUP_NO_SHUTUP,
6575 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
6576 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
6577 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6578 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6579 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6580 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6581 ALC269_FIXUP_HEADSET_MODE,
6582 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
6583 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
6584 ALC269_FIXUP_ASUS_X101_FUNC,
6585 ALC269_FIXUP_ASUS_X101_VERB,
6586 ALC269_FIXUP_ASUS_X101,
6587 ALC271_FIXUP_AMIC_MIC2,
6588 ALC271_FIXUP_HP_GATE_MIC_JACK,
6589 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
6590 ALC269_FIXUP_ACER_AC700,
6591 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
6592 ALC269VB_FIXUP_ASUS_ZENBOOK,
6593 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
6594 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
6595 ALC269VB_FIXUP_ORDISSIMO_EVE2,
6596 ALC283_FIXUP_CHROME_BOOK,
6597 ALC283_FIXUP_SENSE_COMBO_JACK,
6598 ALC282_FIXUP_ASUS_TX300,
6599 ALC283_FIXUP_INT_MIC,
6600 ALC290_FIXUP_MONO_SPEAKERS,
6601 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6602 ALC290_FIXUP_SUBWOOFER,
6603 ALC290_FIXUP_SUBWOOFER_HSJACK,
6604 ALC269_FIXUP_THINKPAD_ACPI,
6605 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
6606 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6607 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6608 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6609 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
6610 ALC255_FIXUP_HEADSET_MODE,
6611 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
6612 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6613 ALC292_FIXUP_TPT440_DOCK,
6614 ALC292_FIXUP_TPT440,
6615 ALC283_FIXUP_HEADSET_MIC,
6616 ALC255_FIXUP_MIC_MUTE_LED,
6617 ALC282_FIXUP_ASPIRE_V5_PINS,
6618 ALC269VB_FIXUP_ASPIRE_E1_COEF,
6619 ALC280_FIXUP_HP_GPIO4,
6620 ALC286_FIXUP_HP_GPIO_LED,
6621 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
6622 ALC280_FIXUP_HP_DOCK_PINS,
6623 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
6624 ALC280_FIXUP_HP_9480M,
6625 ALC245_FIXUP_HP_X360_AMP,
6626 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
6627 ALC288_FIXUP_DELL_HEADSET_MODE,
6628 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
6629 ALC288_FIXUP_DELL_XPS_13,
6630 ALC288_FIXUP_DISABLE_AAMIX,
6631 ALC292_FIXUP_DELL_E7X_AAMIX,
6632 ALC292_FIXUP_DELL_E7X,
6633 ALC292_FIXUP_DISABLE_AAMIX,
6634 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
6635 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
6636 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6637 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6638 ALC275_FIXUP_DELL_XPS,
6639 ALC293_FIXUP_LENOVO_SPK_NOISE,
6640 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6641 ALC255_FIXUP_DELL_SPK_NOISE,
6642 ALC225_FIXUP_DISABLE_MIC_VREF,
6643 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6644 ALC295_FIXUP_DISABLE_DAC3,
6645 ALC285_FIXUP_SPEAKER2_TO_DAC1,
6646 ALC280_FIXUP_HP_HEADSET_MIC,
6647 ALC221_FIXUP_HP_FRONT_MIC,
6648 ALC292_FIXUP_TPT460,
6649 ALC298_FIXUP_SPK_VOLUME,
6650 ALC298_FIXUP_LENOVO_SPK_VOLUME,
6651 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
6652 ALC269_FIXUP_ATIV_BOOK_8,
6653 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
6654 ALC256_FIXUP_ASUS_HEADSET_MODE,
6655 ALC256_FIXUP_ASUS_MIC,
6656 ALC256_FIXUP_ASUS_AIO_GPIO2,
6657 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6658 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
6659 ALC233_FIXUP_LENOVO_MULTI_CODECS,
6660 ALC233_FIXUP_ACER_HEADSET_MIC,
6661 ALC294_FIXUP_LENOVO_MIC_LOCATION,
6662 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
6663 ALC225_FIXUP_S3_POP_NOISE,
6664 ALC700_FIXUP_INTEL_REFERENCE,
6665 ALC274_FIXUP_DELL_BIND_DACS,
6666 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
6667 ALC298_FIXUP_TPT470_DOCK_FIX,
6668 ALC298_FIXUP_TPT470_DOCK,
6669 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
6670 ALC255_FIXUP_DELL_HEADSET_MIC,
6671 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
6672 ALC298_FIXUP_HUAWEI_MBX_STEREO,
6673 ALC295_FIXUP_HP_X360,
6674 ALC221_FIXUP_HP_HEADSET_MIC,
6675 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
6676 ALC295_FIXUP_HP_AUTO_MUTE,
6677 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
6678 ALC294_FIXUP_ASUS_MIC,
6679 ALC294_FIXUP_ASUS_HEADSET_MIC,
6680 ALC294_FIXUP_ASUS_SPK,
6681 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
6682 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
6683 ALC255_FIXUP_ACER_HEADSET_MIC,
6684 ALC295_FIXUP_CHROME_BOOK,
6685 ALC225_FIXUP_HEADSET_JACK,
6686 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6687 ALC225_FIXUP_WYSE_AUTO_MUTE,
6688 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
6689 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
6690 ALC256_FIXUP_ASUS_HEADSET_MIC,
6691 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
6692 ALC299_FIXUP_PREDATOR_SPK,
6693 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
6694 ALC289_FIXUP_DELL_SPK2,
6695 ALC289_FIXUP_DUAL_SPK,
6696 ALC294_FIXUP_SPK2_TO_DAC1,
6697 ALC294_FIXUP_ASUS_DUAL_SPK,
6698 ALC285_FIXUP_THINKPAD_X1_GEN7,
6699 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
6700 ALC294_FIXUP_ASUS_HPE,
6701 ALC294_FIXUP_ASUS_COEF_1B,
6702 ALC294_FIXUP_ASUS_GX502_HP,
6703 ALC294_FIXUP_ASUS_GX502_PINS,
6704 ALC294_FIXUP_ASUS_GX502_VERBS,
6705 ALC294_FIXUP_ASUS_GU502_HP,
6706 ALC294_FIXUP_ASUS_GU502_PINS,
6707 ALC294_FIXUP_ASUS_GU502_VERBS,
6708 ALC285_FIXUP_HP_GPIO_LED,
6709 ALC285_FIXUP_HP_MUTE_LED,
6710 ALC236_FIXUP_HP_GPIO_LED,
6711 ALC236_FIXUP_HP_MUTE_LED,
6712 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
6713 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
6714 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
6715 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6716 ALC269VC_FIXUP_ACER_HEADSET_MIC,
6717 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
6718 ALC289_FIXUP_ASUS_GA401,
6719 ALC289_FIXUP_ASUS_GA502,
6720 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
6721 ALC285_FIXUP_HP_GPIO_AMP_INIT,
6722 ALC269_FIXUP_CZC_B20,
6723 ALC269_FIXUP_CZC_TMI,
6724 ALC269_FIXUP_CZC_L101,
6725 ALC269_FIXUP_LEMOTE_A1802,
6726 ALC269_FIXUP_LEMOTE_A190X,
6727 ALC256_FIXUP_INTEL_NUC8_RUGGED,
6728 ALC233_FIXUP_INTEL_NUC8_DMIC,
6729 ALC233_FIXUP_INTEL_NUC8_BOOST,
6730 ALC256_FIXUP_INTEL_NUC10,
6731 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
6732 ALC274_FIXUP_HP_MIC,
6733 ALC274_FIXUP_HP_HEADSET_MIC,
6734 ALC274_FIXUP_HP_ENVY_GPIO,
6735 ALC256_FIXUP_ASUS_HPE,
6736 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
6737 ALC287_FIXUP_HP_GPIO_LED,
6738 ALC256_FIXUP_HP_HEADSET_MIC,
6739 ALC245_FIXUP_HP_GPIO_LED,
6740 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
6741 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
6742 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
6743 ALC256_FIXUP_ACER_HEADSET_MIC,
6744 ALC285_FIXUP_IDEAPAD_S740_COEF,
6745 ALC295_FIXUP_ASUS_DACS,
6746 ALC295_FIXUP_HP_OMEN,
6747 ALC285_FIXUP_HP_SPECTRE_X360,
6748 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
6749 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
6750 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
6751 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
6752 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6753 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6754 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
6755 ALC287_FIXUP_13S_GEN2_SPEAKERS,
6756 ALC256_FIXUP_SET_COEF_DEFAULTS,
6757 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
6758 ALC233_FIXUP_NO_AUDIO_JACK,
6759 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
6760 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6761 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
6762 };
6763
6764 static const struct hda_fixup alc269_fixups[] = {
6765 [ALC269_FIXUP_GPIO2] = {
6766 .type = HDA_FIXUP_FUNC,
6767 .v.func = alc_fixup_gpio2,
6768 },
6769 [ALC269_FIXUP_SONY_VAIO] = {
6770 .type = HDA_FIXUP_PINCTLS,
6771 .v.pins = (const struct hda_pintbl[]) {
6772 {0x19, PIN_VREFGRD},
6773 {}
6774 }
6775 },
6776 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
6777 .type = HDA_FIXUP_FUNC,
6778 .v.func = alc275_fixup_gpio4_off,
6779 .chained = true,
6780 .chain_id = ALC269_FIXUP_SONY_VAIO
6781 },
6782 [ALC269_FIXUP_DELL_M101Z] = {
6783 .type = HDA_FIXUP_VERBS,
6784 .v.verbs = (const struct hda_verb[]) {
6785 /* Enables internal speaker */
6786 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6787 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6788 {}
6789 }
6790 },
6791 [ALC269_FIXUP_SKU_IGNORE] = {
6792 .type = HDA_FIXUP_FUNC,
6793 .v.func = alc_fixup_sku_ignore,
6794 },
6795 [ALC269_FIXUP_ASUS_G73JW] = {
6796 .type = HDA_FIXUP_PINS,
6797 .v.pins = (const struct hda_pintbl[]) {
6798 { 0x17, 0x99130111 }, /* subwoofer */
6799 { }
6800 }
6801 },
6802 [ALC269_FIXUP_LENOVO_EAPD] = {
6803 .type = HDA_FIXUP_VERBS,
6804 .v.verbs = (const struct hda_verb[]) {
6805 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6806 {}
6807 }
6808 },
6809 [ALC275_FIXUP_SONY_HWEQ] = {
6810 .type = HDA_FIXUP_FUNC,
6811 .v.func = alc269_fixup_hweq,
6812 .chained = true,
6813 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6814 },
6815 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6816 .type = HDA_FIXUP_FUNC,
6817 .v.func = alc_fixup_disable_aamix,
6818 .chained = true,
6819 .chain_id = ALC269_FIXUP_SONY_VAIO
6820 },
6821 [ALC271_FIXUP_DMIC] = {
6822 .type = HDA_FIXUP_FUNC,
6823 .v.func = alc271_fixup_dmic,
6824 },
6825 [ALC269_FIXUP_PCM_44K] = {
6826 .type = HDA_FIXUP_FUNC,
6827 .v.func = alc269_fixup_pcm_44k,
6828 .chained = true,
6829 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6830 },
6831 [ALC269_FIXUP_STEREO_DMIC] = {
6832 .type = HDA_FIXUP_FUNC,
6833 .v.func = alc269_fixup_stereo_dmic,
6834 },
6835 [ALC269_FIXUP_HEADSET_MIC] = {
6836 .type = HDA_FIXUP_FUNC,
6837 .v.func = alc269_fixup_headset_mic,
6838 },
6839 [ALC269_FIXUP_QUANTA_MUTE] = {
6840 .type = HDA_FIXUP_FUNC,
6841 .v.func = alc269_fixup_quanta_mute,
6842 },
6843 [ALC269_FIXUP_LIFEBOOK] = {
6844 .type = HDA_FIXUP_PINS,
6845 .v.pins = (const struct hda_pintbl[]) {
6846 { 0x1a, 0x2101103f }, /* dock line-out */
6847 { 0x1b, 0x23a11040 }, /* dock mic-in */
6848 { }
6849 },
6850 .chained = true,
6851 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6852 },
6853 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6854 .type = HDA_FIXUP_PINS,
6855 .v.pins = (const struct hda_pintbl[]) {
6856 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6857 { }
6858 },
6859 },
6860 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6861 .type = HDA_FIXUP_PINS,
6862 .v.pins = (const struct hda_pintbl[]) {
6863 { 0x21, 0x0221102f }, /* HP out */
6864 { }
6865 },
6866 },
6867 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6868 .type = HDA_FIXUP_FUNC,
6869 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6870 },
6871 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6872 .type = HDA_FIXUP_FUNC,
6873 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6874 },
6875 [ALC269_FIXUP_AMIC] = {
6876 .type = HDA_FIXUP_PINS,
6877 .v.pins = (const struct hda_pintbl[]) {
6878 { 0x14, 0x99130110 }, /* speaker */
6879 { 0x15, 0x0121401f }, /* HP out */
6880 { 0x18, 0x01a19c20 }, /* mic */
6881 { 0x19, 0x99a3092f }, /* int-mic */
6882 { }
6883 },
6884 },
6885 [ALC269_FIXUP_DMIC] = {
6886 .type = HDA_FIXUP_PINS,
6887 .v.pins = (const struct hda_pintbl[]) {
6888 { 0x12, 0x99a3092f }, /* int-mic */
6889 { 0x14, 0x99130110 }, /* speaker */
6890 { 0x15, 0x0121401f }, /* HP out */
6891 { 0x18, 0x01a19c20 }, /* mic */
6892 { }
6893 },
6894 },
6895 [ALC269VB_FIXUP_AMIC] = {
6896 .type = HDA_FIXUP_PINS,
6897 .v.pins = (const struct hda_pintbl[]) {
6898 { 0x14, 0x99130110 }, /* speaker */
6899 { 0x18, 0x01a19c20 }, /* mic */
6900 { 0x19, 0x99a3092f }, /* int-mic */
6901 { 0x21, 0x0121401f }, /* HP out */
6902 { }
6903 },
6904 },
6905 [ALC269VB_FIXUP_DMIC] = {
6906 .type = HDA_FIXUP_PINS,
6907 .v.pins = (const struct hda_pintbl[]) {
6908 { 0x12, 0x99a3092f }, /* int-mic */
6909 { 0x14, 0x99130110 }, /* speaker */
6910 { 0x18, 0x01a19c20 }, /* mic */
6911 { 0x21, 0x0121401f }, /* HP out */
6912 { }
6913 },
6914 },
6915 [ALC269_FIXUP_HP_MUTE_LED] = {
6916 .type = HDA_FIXUP_FUNC,
6917 .v.func = alc269_fixup_hp_mute_led,
6918 },
6919 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6920 .type = HDA_FIXUP_FUNC,
6921 .v.func = alc269_fixup_hp_mute_led_mic1,
6922 },
6923 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
6924 .type = HDA_FIXUP_FUNC,
6925 .v.func = alc269_fixup_hp_mute_led_mic2,
6926 },
6927 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6928 .type = HDA_FIXUP_FUNC,
6929 .v.func = alc269_fixup_hp_mute_led_mic3,
6930 .chained = true,
6931 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
6932 },
6933 [ALC269_FIXUP_HP_GPIO_LED] = {
6934 .type = HDA_FIXUP_FUNC,
6935 .v.func = alc269_fixup_hp_gpio_led,
6936 },
6937 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6938 .type = HDA_FIXUP_FUNC,
6939 .v.func = alc269_fixup_hp_gpio_mic1_led,
6940 },
6941 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6942 .type = HDA_FIXUP_FUNC,
6943 .v.func = alc269_fixup_hp_line1_mic1_led,
6944 },
6945 [ALC269_FIXUP_INV_DMIC] = {
6946 .type = HDA_FIXUP_FUNC,
6947 .v.func = alc_fixup_inv_dmic,
6948 },
6949 [ALC269_FIXUP_NO_SHUTUP] = {
6950 .type = HDA_FIXUP_FUNC,
6951 .v.func = alc_fixup_no_shutup,
6952 },
6953 [ALC269_FIXUP_LENOVO_DOCK] = {
6954 .type = HDA_FIXUP_PINS,
6955 .v.pins = (const struct hda_pintbl[]) {
6956 { 0x19, 0x23a11040 }, /* dock mic */
6957 { 0x1b, 0x2121103f }, /* dock headphone */
6958 { }
6959 },
6960 .chained = true,
6961 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6962 },
6963 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6964 .type = HDA_FIXUP_FUNC,
6965 .v.func = alc269_fixup_limit_int_mic_boost,
6966 .chained = true,
6967 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6968 },
6969 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
6970 .type = HDA_FIXUP_FUNC,
6971 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6972 .chained = true,
6973 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6974 },
6975 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6976 .type = HDA_FIXUP_PINS,
6977 .v.pins = (const struct hda_pintbl[]) {
6978 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6979 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6980 { }
6981 },
6982 .chained = true,
6983 .chain_id = ALC269_FIXUP_HEADSET_MODE
6984 },
6985 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6986 .type = HDA_FIXUP_PINS,
6987 .v.pins = (const struct hda_pintbl[]) {
6988 { 0x16, 0x21014020 }, /* dock line out */
6989 { 0x19, 0x21a19030 }, /* dock mic */
6990 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6991 { }
6992 },
6993 .chained = true,
6994 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6995 },
6996 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6997 .type = HDA_FIXUP_PINS,
6998 .v.pins = (const struct hda_pintbl[]) {
6999 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7000 { }
7001 },
7002 .chained = true,
7003 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7004 },
7005 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7006 .type = HDA_FIXUP_PINS,
7007 .v.pins = (const struct hda_pintbl[]) {
7008 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7009 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7010 { }
7011 },
7012 .chained = true,
7013 .chain_id = ALC269_FIXUP_HEADSET_MODE
7014 },
7015 [ALC269_FIXUP_HEADSET_MODE] = {
7016 .type = HDA_FIXUP_FUNC,
7017 .v.func = alc_fixup_headset_mode,
7018 .chained = true,
7019 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7020 },
7021 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7022 .type = HDA_FIXUP_FUNC,
7023 .v.func = alc_fixup_headset_mode_no_hp_mic,
7024 },
7025 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7026 .type = HDA_FIXUP_PINS,
7027 .v.pins = (const struct hda_pintbl[]) {
7028 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7029 { }
7030 },
7031 .chained = true,
7032 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7033 },
7034 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7035 .type = HDA_FIXUP_PINS,
7036 .v.pins = (const struct hda_pintbl[]) {
7037 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7038 { }
7039 },
7040 .chained = true,
7041 .chain_id = ALC269_FIXUP_HEADSET_MIC
7042 },
7043 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7044 .type = HDA_FIXUP_PINS,
7045 .v.pins = (const struct hda_pintbl[]) {
7046 {0x12, 0x90a60130},
7047 {0x13, 0x40000000},
7048 {0x14, 0x90170110},
7049 {0x18, 0x411111f0},
7050 {0x19, 0x04a11040},
7051 {0x1a, 0x411111f0},
7052 {0x1b, 0x90170112},
7053 {0x1d, 0x40759a05},
7054 {0x1e, 0x411111f0},
7055 {0x21, 0x04211020},
7056 { }
7057 },
7058 .chained = true,
7059 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7060 },
7061 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7062 .type = HDA_FIXUP_FUNC,
7063 .v.func = alc298_fixup_huawei_mbx_stereo,
7064 .chained = true,
7065 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7066 },
7067 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7068 .type = HDA_FIXUP_FUNC,
7069 .v.func = alc269_fixup_x101_headset_mic,
7070 },
7071 [ALC269_FIXUP_ASUS_X101_VERB] = {
7072 .type = HDA_FIXUP_VERBS,
7073 .v.verbs = (const struct hda_verb[]) {
7074 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7075 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7076 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7077 { }
7078 },
7079 .chained = true,
7080 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7081 },
7082 [ALC269_FIXUP_ASUS_X101] = {
7083 .type = HDA_FIXUP_PINS,
7084 .v.pins = (const struct hda_pintbl[]) {
7085 { 0x18, 0x04a1182c }, /* Headset mic */
7086 { }
7087 },
7088 .chained = true,
7089 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7090 },
7091 [ALC271_FIXUP_AMIC_MIC2] = {
7092 .type = HDA_FIXUP_PINS,
7093 .v.pins = (const struct hda_pintbl[]) {
7094 { 0x14, 0x99130110 }, /* speaker */
7095 { 0x19, 0x01a19c20 }, /* mic */
7096 { 0x1b, 0x99a7012f }, /* int-mic */
7097 { 0x21, 0x0121401f }, /* HP out */
7098 { }
7099 },
7100 },
7101 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7102 .type = HDA_FIXUP_FUNC,
7103 .v.func = alc271_hp_gate_mic_jack,
7104 .chained = true,
7105 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7106 },
7107 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7108 .type = HDA_FIXUP_FUNC,
7109 .v.func = alc269_fixup_limit_int_mic_boost,
7110 .chained = true,
7111 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7112 },
7113 [ALC269_FIXUP_ACER_AC700] = {
7114 .type = HDA_FIXUP_PINS,
7115 .v.pins = (const struct hda_pintbl[]) {
7116 { 0x12, 0x99a3092f }, /* int-mic */
7117 { 0x14, 0x99130110 }, /* speaker */
7118 { 0x18, 0x03a11c20 }, /* mic */
7119 { 0x1e, 0x0346101e }, /* SPDIF1 */
7120 { 0x21, 0x0321101f }, /* HP out */
7121 { }
7122 },
7123 .chained = true,
7124 .chain_id = ALC271_FIXUP_DMIC,
7125 },
7126 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7127 .type = HDA_FIXUP_FUNC,
7128 .v.func = alc269_fixup_limit_int_mic_boost,
7129 .chained = true,
7130 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7131 },
7132 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7133 .type = HDA_FIXUP_FUNC,
7134 .v.func = alc269_fixup_limit_int_mic_boost,
7135 .chained = true,
7136 .chain_id = ALC269VB_FIXUP_DMIC,
7137 },
7138 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7139 .type = HDA_FIXUP_VERBS,
7140 .v.verbs = (const struct hda_verb[]) {
7141 /* class-D output amp +5dB */
7142 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7143 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7144 {}
7145 },
7146 .chained = true,
7147 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7148 },
7149 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7150 .type = HDA_FIXUP_FUNC,
7151 .v.func = alc269_fixup_limit_int_mic_boost,
7152 .chained = true,
7153 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7154 },
7155 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7156 .type = HDA_FIXUP_PINS,
7157 .v.pins = (const struct hda_pintbl[]) {
7158 { 0x12, 0x99a3092f }, /* int-mic */
7159 { 0x18, 0x03a11d20 }, /* mic */
7160 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7161 { }
7162 },
7163 },
7164 [ALC283_FIXUP_CHROME_BOOK] = {
7165 .type = HDA_FIXUP_FUNC,
7166 .v.func = alc283_fixup_chromebook,
7167 },
7168 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7169 .type = HDA_FIXUP_FUNC,
7170 .v.func = alc283_fixup_sense_combo_jack,
7171 .chained = true,
7172 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7173 },
7174 [ALC282_FIXUP_ASUS_TX300] = {
7175 .type = HDA_FIXUP_FUNC,
7176 .v.func = alc282_fixup_asus_tx300,
7177 },
7178 [ALC283_FIXUP_INT_MIC] = {
7179 .type = HDA_FIXUP_VERBS,
7180 .v.verbs = (const struct hda_verb[]) {
7181 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7182 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7183 { }
7184 },
7185 .chained = true,
7186 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7187 },
7188 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7189 .type = HDA_FIXUP_PINS,
7190 .v.pins = (const struct hda_pintbl[]) {
7191 { 0x17, 0x90170112 }, /* subwoofer */
7192 { }
7193 },
7194 .chained = true,
7195 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7196 },
7197 [ALC290_FIXUP_SUBWOOFER] = {
7198 .type = HDA_FIXUP_PINS,
7199 .v.pins = (const struct hda_pintbl[]) {
7200 { 0x17, 0x90170112 }, /* subwoofer */
7201 { }
7202 },
7203 .chained = true,
7204 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7205 },
7206 [ALC290_FIXUP_MONO_SPEAKERS] = {
7207 .type = HDA_FIXUP_FUNC,
7208 .v.func = alc290_fixup_mono_speakers,
7209 },
7210 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7211 .type = HDA_FIXUP_FUNC,
7212 .v.func = alc290_fixup_mono_speakers,
7213 .chained = true,
7214 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7215 },
7216 [ALC269_FIXUP_THINKPAD_ACPI] = {
7217 .type = HDA_FIXUP_FUNC,
7218 .v.func = alc_fixup_thinkpad_acpi,
7219 .chained = true,
7220 .chain_id = ALC269_FIXUP_SKU_IGNORE,
7221 },
7222 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7223 .type = HDA_FIXUP_FUNC,
7224 .v.func = alc_fixup_inv_dmic,
7225 .chained = true,
7226 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7227 },
7228 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
7229 .type = HDA_FIXUP_PINS,
7230 .v.pins = (const struct hda_pintbl[]) {
7231 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7232 { }
7233 },
7234 .chained = true,
7235 .chain_id = ALC255_FIXUP_HEADSET_MODE
7236 },
7237 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7238 .type = HDA_FIXUP_PINS,
7239 .v.pins = (const struct hda_pintbl[]) {
7240 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7241 { }
7242 },
7243 .chained = true,
7244 .chain_id = ALC255_FIXUP_HEADSET_MODE
7245 },
7246 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7247 .type = HDA_FIXUP_PINS,
7248 .v.pins = (const struct hda_pintbl[]) {
7249 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7250 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7251 { }
7252 },
7253 .chained = true,
7254 .chain_id = ALC255_FIXUP_HEADSET_MODE
7255 },
7256 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7257 .type = HDA_FIXUP_PINS,
7258 .v.pins = (const struct hda_pintbl[]) {
7259 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7260 { }
7261 },
7262 .chained = true,
7263 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7264 },
7265 [ALC255_FIXUP_HEADSET_MODE] = {
7266 .type = HDA_FIXUP_FUNC,
7267 .v.func = alc_fixup_headset_mode_alc255,
7268 .chained = true,
7269 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7270 },
7271 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7272 .type = HDA_FIXUP_FUNC,
7273 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7274 },
7275 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7276 .type = HDA_FIXUP_PINS,
7277 .v.pins = (const struct hda_pintbl[]) {
7278 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7279 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7280 { }
7281 },
7282 .chained = true,
7283 .chain_id = ALC269_FIXUP_HEADSET_MODE
7284 },
7285 [ALC292_FIXUP_TPT440_DOCK] = {
7286 .type = HDA_FIXUP_FUNC,
7287 .v.func = alc_fixup_tpt440_dock,
7288 .chained = true,
7289 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7290 },
7291 [ALC292_FIXUP_TPT440] = {
7292 .type = HDA_FIXUP_FUNC,
7293 .v.func = alc_fixup_disable_aamix,
7294 .chained = true,
7295 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7296 },
7297 [ALC283_FIXUP_HEADSET_MIC] = {
7298 .type = HDA_FIXUP_PINS,
7299 .v.pins = (const struct hda_pintbl[]) {
7300 { 0x19, 0x04a110f0 },
7301 { },
7302 },
7303 },
7304 [ALC255_FIXUP_MIC_MUTE_LED] = {
7305 .type = HDA_FIXUP_FUNC,
7306 .v.func = alc_fixup_micmute_led,
7307 },
7308 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7309 .type = HDA_FIXUP_PINS,
7310 .v.pins = (const struct hda_pintbl[]) {
7311 { 0x12, 0x90a60130 },
7312 { 0x14, 0x90170110 },
7313 { 0x17, 0x40000008 },
7314 { 0x18, 0x411111f0 },
7315 { 0x19, 0x01a1913c },
7316 { 0x1a, 0x411111f0 },
7317 { 0x1b, 0x411111f0 },
7318 { 0x1d, 0x40f89b2d },
7319 { 0x1e, 0x411111f0 },
7320 { 0x21, 0x0321101f },
7321 { },
7322 },
7323 },
7324 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7325 .type = HDA_FIXUP_FUNC,
7326 .v.func = alc269vb_fixup_aspire_e1_coef,
7327 },
7328 [ALC280_FIXUP_HP_GPIO4] = {
7329 .type = HDA_FIXUP_FUNC,
7330 .v.func = alc280_fixup_hp_gpio4,
7331 },
7332 [ALC286_FIXUP_HP_GPIO_LED] = {
7333 .type = HDA_FIXUP_FUNC,
7334 .v.func = alc286_fixup_hp_gpio_led,
7335 },
7336 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7337 .type = HDA_FIXUP_FUNC,
7338 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7339 },
7340 [ALC280_FIXUP_HP_DOCK_PINS] = {
7341 .type = HDA_FIXUP_PINS,
7342 .v.pins = (const struct hda_pintbl[]) {
7343 { 0x1b, 0x21011020 }, /* line-out */
7344 { 0x1a, 0x01a1903c }, /* headset mic */
7345 { 0x18, 0x2181103f }, /* line-in */
7346 { },
7347 },
7348 .chained = true,
7349 .chain_id = ALC280_FIXUP_HP_GPIO4
7350 },
7351 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7352 .type = HDA_FIXUP_PINS,
7353 .v.pins = (const struct hda_pintbl[]) {
7354 { 0x1b, 0x21011020 }, /* line-out */
7355 { 0x18, 0x2181103f }, /* line-in */
7356 { },
7357 },
7358 .chained = true,
7359 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7360 },
7361 [ALC280_FIXUP_HP_9480M] = {
7362 .type = HDA_FIXUP_FUNC,
7363 .v.func = alc280_fixup_hp_9480m,
7364 },
7365 [ALC245_FIXUP_HP_X360_AMP] = {
7366 .type = HDA_FIXUP_FUNC,
7367 .v.func = alc245_fixup_hp_x360_amp,
7368 .chained = true,
7369 .chain_id = ALC245_FIXUP_HP_GPIO_LED
7370 },
7371 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7372 .type = HDA_FIXUP_FUNC,
7373 .v.func = alc_fixup_headset_mode_dell_alc288,
7374 .chained = true,
7375 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7376 },
7377 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7378 .type = HDA_FIXUP_PINS,
7379 .v.pins = (const struct hda_pintbl[]) {
7380 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7381 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7382 { }
7383 },
7384 .chained = true,
7385 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7386 },
7387 [ALC288_FIXUP_DISABLE_AAMIX] = {
7388 .type = HDA_FIXUP_FUNC,
7389 .v.func = alc_fixup_disable_aamix,
7390 .chained = true,
7391 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
7392 },
7393 [ALC288_FIXUP_DELL_XPS_13] = {
7394 .type = HDA_FIXUP_FUNC,
7395 .v.func = alc_fixup_dell_xps13,
7396 .chained = true,
7397 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7398 },
7399 [ALC292_FIXUP_DISABLE_AAMIX] = {
7400 .type = HDA_FIXUP_FUNC,
7401 .v.func = alc_fixup_disable_aamix,
7402 .chained = true,
7403 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
7404 },
7405 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7406 .type = HDA_FIXUP_FUNC,
7407 .v.func = alc_fixup_disable_aamix,
7408 .chained = true,
7409 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7410 },
7411 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
7412 .type = HDA_FIXUP_FUNC,
7413 .v.func = alc_fixup_dell_xps13,
7414 .chained = true,
7415 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7416 },
7417 [ALC292_FIXUP_DELL_E7X] = {
7418 .type = HDA_FIXUP_FUNC,
7419 .v.func = alc_fixup_micmute_led,
7420 /* micmute fixup must be applied at last */
7421 .chained_before = true,
7422 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7423 },
7424 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7425 .type = HDA_FIXUP_PINS,
7426 .v.pins = (const struct hda_pintbl[]) {
7427 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7428 { }
7429 },
7430 .chained_before = true,
7431 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7432 },
7433 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7434 .type = HDA_FIXUP_PINS,
7435 .v.pins = (const struct hda_pintbl[]) {
7436 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7437 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7438 { }
7439 },
7440 .chained = true,
7441 .chain_id = ALC269_FIXUP_HEADSET_MODE
7442 },
7443 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7444 .type = HDA_FIXUP_PINS,
7445 .v.pins = (const struct hda_pintbl[]) {
7446 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7447 { }
7448 },
7449 .chained = true,
7450 .chain_id = ALC269_FIXUP_HEADSET_MODE
7451 },
7452 [ALC275_FIXUP_DELL_XPS] = {
7453 .type = HDA_FIXUP_VERBS,
7454 .v.verbs = (const struct hda_verb[]) {
7455 /* Enables internal speaker */
7456 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7457 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7458 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7459 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7460 {}
7461 }
7462 },
7463 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7464 .type = HDA_FIXUP_FUNC,
7465 .v.func = alc_fixup_disable_aamix,
7466 .chained = true,
7467 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7468 },
7469 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7470 .type = HDA_FIXUP_FUNC,
7471 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7472 },
7473 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7474 .type = HDA_FIXUP_FUNC,
7475 .v.func = alc_fixup_inv_dmic,
7476 .chained = true,
7477 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7478 },
7479 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7480 .type = HDA_FIXUP_FUNC,
7481 .v.func = alc269_fixup_limit_int_mic_boost
7482 },
7483 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7484 .type = HDA_FIXUP_FUNC,
7485 .v.func = alc_fixup_disable_aamix,
7486 .chained = true,
7487 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7488 },
7489 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7490 .type = HDA_FIXUP_FUNC,
7491 .v.func = alc_fixup_disable_mic_vref,
7492 .chained = true,
7493 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7494 },
7495 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7496 .type = HDA_FIXUP_VERBS,
7497 .v.verbs = (const struct hda_verb[]) {
7498 /* Disable pass-through path for FRONT 14h */
7499 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7500 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7501 {}
7502 },
7503 .chained = true,
7504 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
7505 },
7506 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7507 .type = HDA_FIXUP_FUNC,
7508 .v.func = alc_fixup_disable_aamix,
7509 .chained = true,
7510 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7511 },
7512 [ALC221_FIXUP_HP_FRONT_MIC] = {
7513 .type = HDA_FIXUP_PINS,
7514 .v.pins = (const struct hda_pintbl[]) {
7515 { 0x19, 0x02a19020 }, /* Front Mic */
7516 { }
7517 },
7518 },
7519 [ALC292_FIXUP_TPT460] = {
7520 .type = HDA_FIXUP_FUNC,
7521 .v.func = alc_fixup_tpt440_dock,
7522 .chained = true,
7523 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7524 },
7525 [ALC298_FIXUP_SPK_VOLUME] = {
7526 .type = HDA_FIXUP_FUNC,
7527 .v.func = alc298_fixup_speaker_volume,
7528 .chained = true,
7529 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7530 },
7531 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7532 .type = HDA_FIXUP_FUNC,
7533 .v.func = alc298_fixup_speaker_volume,
7534 },
7535 [ALC295_FIXUP_DISABLE_DAC3] = {
7536 .type = HDA_FIXUP_FUNC,
7537 .v.func = alc295_fixup_disable_dac3,
7538 },
7539 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7540 .type = HDA_FIXUP_FUNC,
7541 .v.func = alc285_fixup_speaker2_to_dac1,
7542 .chained = true,
7543 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7544 },
7545 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7546 .type = HDA_FIXUP_PINS,
7547 .v.pins = (const struct hda_pintbl[]) {
7548 { 0x1b, 0x90170151 },
7549 { }
7550 },
7551 .chained = true,
7552 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7553 },
7554 [ALC269_FIXUP_ATIV_BOOK_8] = {
7555 .type = HDA_FIXUP_FUNC,
7556 .v.func = alc_fixup_auto_mute_via_amp,
7557 .chained = true,
7558 .chain_id = ALC269_FIXUP_NO_SHUTUP
7559 },
7560 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7561 .type = HDA_FIXUP_PINS,
7562 .v.pins = (const struct hda_pintbl[]) {
7563 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7564 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7565 { }
7566 },
7567 .chained = true,
7568 .chain_id = ALC269_FIXUP_HEADSET_MODE
7569 },
7570 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7571 .type = HDA_FIXUP_FUNC,
7572 .v.func = alc_fixup_headset_mode,
7573 },
7574 [ALC256_FIXUP_ASUS_MIC] = {
7575 .type = HDA_FIXUP_PINS,
7576 .v.pins = (const struct hda_pintbl[]) {
7577 { 0x13, 0x90a60160 }, /* use as internal mic */
7578 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7579 { }
7580 },
7581 .chained = true,
7582 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7583 },
7584 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
7585 .type = HDA_FIXUP_FUNC,
7586 /* Set up GPIO2 for the speaker amp */
7587 .v.func = alc_fixup_gpio4,
7588 },
7589 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7590 .type = HDA_FIXUP_PINS,
7591 .v.pins = (const struct hda_pintbl[]) {
7592 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7593 { }
7594 },
7595 .chained = true,
7596 .chain_id = ALC269_FIXUP_HEADSET_MIC
7597 },
7598 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7599 .type = HDA_FIXUP_VERBS,
7600 .v.verbs = (const struct hda_verb[]) {
7601 /* Enables internal speaker */
7602 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7603 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7604 {}
7605 },
7606 .chained = true,
7607 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7608 },
7609 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7610 .type = HDA_FIXUP_FUNC,
7611 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
7612 .chained = true,
7613 .chain_id = ALC269_FIXUP_GPIO2
7614 },
7615 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7616 .type = HDA_FIXUP_VERBS,
7617 .v.verbs = (const struct hda_verb[]) {
7618 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7619 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7620 { }
7621 },
7622 .chained = true,
7623 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7624 },
7625 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7626 .type = HDA_FIXUP_PINS,
7627 .v.pins = (const struct hda_pintbl[]) {
7628 /* Change the mic location from front to right, otherwise there are
7629 two front mics with the same name, pulseaudio can't handle them.
7630 This is just a temporary workaround, after applying this fixup,
7631 there will be one "Front Mic" and one "Mic" in this machine.
7632 */
7633 { 0x1a, 0x04a19040 },
7634 { }
7635 },
7636 },
7637 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7638 .type = HDA_FIXUP_PINS,
7639 .v.pins = (const struct hda_pintbl[]) {
7640 { 0x16, 0x0101102f }, /* Rear Headset HP */
7641 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7642 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7643 { 0x1b, 0x02011020 },
7644 { }
7645 },
7646 .chained = true,
7647 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7648 },
7649 [ALC225_FIXUP_S3_POP_NOISE] = {
7650 .type = HDA_FIXUP_FUNC,
7651 .v.func = alc225_fixup_s3_pop_noise,
7652 .chained = true,
7653 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7654 },
7655 [ALC700_FIXUP_INTEL_REFERENCE] = {
7656 .type = HDA_FIXUP_VERBS,
7657 .v.verbs = (const struct hda_verb[]) {
7658 /* Enables internal speaker */
7659 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7660 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7661 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7662 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7663 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7664 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7665 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7666 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7667 {}
7668 }
7669 },
7670 [ALC274_FIXUP_DELL_BIND_DACS] = {
7671 .type = HDA_FIXUP_FUNC,
7672 .v.func = alc274_fixup_bind_dacs,
7673 .chained = true,
7674 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7675 },
7676 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7677 .type = HDA_FIXUP_PINS,
7678 .v.pins = (const struct hda_pintbl[]) {
7679 { 0x1b, 0x0401102f },
7680 { }
7681 },
7682 .chained = true,
7683 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7684 },
7685 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
7686 .type = HDA_FIXUP_FUNC,
7687 .v.func = alc_fixup_tpt470_dock,
7688 .chained = true,
7689 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7690 },
7691 [ALC298_FIXUP_TPT470_DOCK] = {
7692 .type = HDA_FIXUP_FUNC,
7693 .v.func = alc_fixup_tpt470_dacs,
7694 .chained = true,
7695 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7696 },
7697 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7698 .type = HDA_FIXUP_PINS,
7699 .v.pins = (const struct hda_pintbl[]) {
7700 { 0x14, 0x0201101f },
7701 { }
7702 },
7703 .chained = true,
7704 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7705 },
7706 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7707 .type = HDA_FIXUP_PINS,
7708 .v.pins = (const struct hda_pintbl[]) {
7709 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7710 { }
7711 },
7712 .chained = true,
7713 .chain_id = ALC269_FIXUP_HEADSET_MIC
7714 },
7715 [ALC295_FIXUP_HP_X360] = {
7716 .type = HDA_FIXUP_FUNC,
7717 .v.func = alc295_fixup_hp_top_speakers,
7718 .chained = true,
7719 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
7720 },
7721 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7722 .type = HDA_FIXUP_PINS,
7723 .v.pins = (const struct hda_pintbl[]) {
7724 { 0x19, 0x0181313f},
7725 { }
7726 },
7727 .chained = true,
7728 .chain_id = ALC269_FIXUP_HEADSET_MIC
7729 },
7730 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7731 .type = HDA_FIXUP_FUNC,
7732 .v.func = alc285_fixup_invalidate_dacs,
7733 .chained = true,
7734 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7735 },
7736 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7737 .type = HDA_FIXUP_FUNC,
7738 .v.func = alc_fixup_auto_mute_via_amp,
7739 },
7740 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7741 .type = HDA_FIXUP_PINS,
7742 .v.pins = (const struct hda_pintbl[]) {
7743 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7744 { }
7745 },
7746 .chained = true,
7747 .chain_id = ALC269_FIXUP_HEADSET_MIC
7748 },
7749 [ALC294_FIXUP_ASUS_MIC] = {
7750 .type = HDA_FIXUP_PINS,
7751 .v.pins = (const struct hda_pintbl[]) {
7752 { 0x13, 0x90a60160 }, /* use as internal mic */
7753 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7754 { }
7755 },
7756 .chained = true,
7757 .chain_id = ALC269_FIXUP_HEADSET_MIC
7758 },
7759 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7760 .type = HDA_FIXUP_PINS,
7761 .v.pins = (const struct hda_pintbl[]) {
7762 { 0x19, 0x01a1103c }, /* use as headset mic */
7763 { }
7764 },
7765 .chained = true,
7766 .chain_id = ALC269_FIXUP_HEADSET_MIC
7767 },
7768 [ALC294_FIXUP_ASUS_SPK] = {
7769 .type = HDA_FIXUP_VERBS,
7770 .v.verbs = (const struct hda_verb[]) {
7771 /* Set EAPD high */
7772 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7773 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
7774 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7775 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7776 { }
7777 },
7778 .chained = true,
7779 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7780 },
7781 [ALC295_FIXUP_CHROME_BOOK] = {
7782 .type = HDA_FIXUP_FUNC,
7783 .v.func = alc295_fixup_chromebook,
7784 .chained = true,
7785 .chain_id = ALC225_FIXUP_HEADSET_JACK
7786 },
7787 [ALC225_FIXUP_HEADSET_JACK] = {
7788 .type = HDA_FIXUP_FUNC,
7789 .v.func = alc_fixup_headset_jack,
7790 },
7791 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7792 .type = HDA_FIXUP_PINS,
7793 .v.pins = (const struct hda_pintbl[]) {
7794 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7795 { }
7796 },
7797 .chained = true,
7798 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7799 },
7800 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7801 .type = HDA_FIXUP_VERBS,
7802 .v.verbs = (const struct hda_verb[]) {
7803 /* Disable PCBEEP-IN passthrough */
7804 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7805 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7806 { }
7807 },
7808 .chained = true,
7809 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7810 },
7811 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7812 .type = HDA_FIXUP_PINS,
7813 .v.pins = (const struct hda_pintbl[]) {
7814 { 0x19, 0x03a11130 },
7815 { 0x1a, 0x90a60140 }, /* use as internal mic */
7816 { }
7817 },
7818 .chained = true,
7819 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7820 },
7821 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7822 .type = HDA_FIXUP_PINS,
7823 .v.pins = (const struct hda_pintbl[]) {
7824 { 0x16, 0x01011020 }, /* Rear Line out */
7825 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7826 { }
7827 },
7828 .chained = true,
7829 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7830 },
7831 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7832 .type = HDA_FIXUP_FUNC,
7833 .v.func = alc_fixup_auto_mute_via_amp,
7834 .chained = true,
7835 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7836 },
7837 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7838 .type = HDA_FIXUP_FUNC,
7839 .v.func = alc_fixup_disable_mic_vref,
7840 .chained = true,
7841 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7842 },
7843 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7844 .type = HDA_FIXUP_VERBS,
7845 .v.verbs = (const struct hda_verb[]) {
7846 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7847 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7848 { }
7849 },
7850 .chained = true,
7851 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7852 },
7853 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7854 .type = HDA_FIXUP_PINS,
7855 .v.pins = (const struct hda_pintbl[]) {
7856 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7857 { }
7858 },
7859 .chained = true,
7860 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7861 },
7862 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7863 .type = HDA_FIXUP_PINS,
7864 .v.pins = (const struct hda_pintbl[]) {
7865 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7866 { }
7867 },
7868 .chained = true,
7869 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7870 },
7871 [ALC299_FIXUP_PREDATOR_SPK] = {
7872 .type = HDA_FIXUP_PINS,
7873 .v.pins = (const struct hda_pintbl[]) {
7874 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7875 { }
7876 }
7877 },
7878 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7879 .type = HDA_FIXUP_PINS,
7880 .v.pins = (const struct hda_pintbl[]) {
7881 { 0x19, 0x04a11040 },
7882 { 0x21, 0x04211020 },
7883 { }
7884 },
7885 .chained = true,
7886 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7887 },
7888 [ALC289_FIXUP_DELL_SPK2] = {
7889 .type = HDA_FIXUP_PINS,
7890 .v.pins = (const struct hda_pintbl[]) {
7891 { 0x17, 0x90170130 }, /* bass spk */
7892 { }
7893 },
7894 .chained = true,
7895 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7896 },
7897 [ALC289_FIXUP_DUAL_SPK] = {
7898 .type = HDA_FIXUP_FUNC,
7899 .v.func = alc285_fixup_speaker2_to_dac1,
7900 .chained = true,
7901 .chain_id = ALC289_FIXUP_DELL_SPK2
7902 },
7903 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7904 .type = HDA_FIXUP_FUNC,
7905 .v.func = alc285_fixup_speaker2_to_dac1,
7906 .chained = true,
7907 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7908 },
7909 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
7910 .type = HDA_FIXUP_FUNC,
7911 /* The GPIO must be pulled to initialize the AMP */
7912 .v.func = alc_fixup_gpio4,
7913 .chained = true,
7914 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
7915 },
7916 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7917 .type = HDA_FIXUP_FUNC,
7918 .v.func = alc285_fixup_thinkpad_x1_gen7,
7919 .chained = true,
7920 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7921 },
7922 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7923 .type = HDA_FIXUP_FUNC,
7924 .v.func = alc_fixup_headset_jack,
7925 .chained = true,
7926 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
7927 },
7928 [ALC294_FIXUP_ASUS_HPE] = {
7929 .type = HDA_FIXUP_VERBS,
7930 .v.verbs = (const struct hda_verb[]) {
7931 /* Set EAPD high */
7932 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7933 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7934 { }
7935 },
7936 .chained = true,
7937 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7938 },
7939 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7940 .type = HDA_FIXUP_PINS,
7941 .v.pins = (const struct hda_pintbl[]) {
7942 { 0x19, 0x03a11050 }, /* front HP mic */
7943 { 0x1a, 0x01a11830 }, /* rear external mic */
7944 { 0x21, 0x03211020 }, /* front HP out */
7945 { }
7946 },
7947 .chained = true,
7948 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7949 },
7950 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7951 .type = HDA_FIXUP_VERBS,
7952 .v.verbs = (const struct hda_verb[]) {
7953 /* set 0x15 to HP-OUT ctrl */
7954 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7955 /* unmute the 0x15 amp */
7956 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7957 { }
7958 },
7959 .chained = true,
7960 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7961 },
7962 [ALC294_FIXUP_ASUS_GX502_HP] = {
7963 .type = HDA_FIXUP_FUNC,
7964 .v.func = alc294_fixup_gx502_hp,
7965 },
7966 [ALC294_FIXUP_ASUS_GU502_PINS] = {
7967 .type = HDA_FIXUP_PINS,
7968 .v.pins = (const struct hda_pintbl[]) {
7969 { 0x19, 0x01a11050 }, /* rear HP mic */
7970 { 0x1a, 0x01a11830 }, /* rear external mic */
7971 { 0x21, 0x012110f0 }, /* rear HP out */
7972 { }
7973 },
7974 .chained = true,
7975 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
7976 },
7977 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
7978 .type = HDA_FIXUP_VERBS,
7979 .v.verbs = (const struct hda_verb[]) {
7980 /* set 0x15 to HP-OUT ctrl */
7981 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7982 /* unmute the 0x15 amp */
7983 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7984 /* set 0x1b to HP-OUT */
7985 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
7986 { }
7987 },
7988 .chained = true,
7989 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
7990 },
7991 [ALC294_FIXUP_ASUS_GU502_HP] = {
7992 .type = HDA_FIXUP_FUNC,
7993 .v.func = alc294_fixup_gu502_hp,
7994 },
7995 [ALC294_FIXUP_ASUS_COEF_1B] = {
7996 .type = HDA_FIXUP_VERBS,
7997 .v.verbs = (const struct hda_verb[]) {
7998 /* Set bit 10 to correct noisy output after reboot from
7999 * Windows 10 (due to pop noise reduction?)
8000 */
8001 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8002 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8003 { }
8004 },
8005 .chained = true,
8006 .chain_id = ALC289_FIXUP_ASUS_GA401,
8007 },
8008 [ALC285_FIXUP_HP_GPIO_LED] = {
8009 .type = HDA_FIXUP_FUNC,
8010 .v.func = alc285_fixup_hp_gpio_led,
8011 },
8012 [ALC285_FIXUP_HP_MUTE_LED] = {
8013 .type = HDA_FIXUP_FUNC,
8014 .v.func = alc285_fixup_hp_mute_led,
8015 },
8016 [ALC236_FIXUP_HP_GPIO_LED] = {
8017 .type = HDA_FIXUP_FUNC,
8018 .v.func = alc236_fixup_hp_gpio_led,
8019 },
8020 [ALC236_FIXUP_HP_MUTE_LED] = {
8021 .type = HDA_FIXUP_FUNC,
8022 .v.func = alc236_fixup_hp_mute_led,
8023 },
8024 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8025 .type = HDA_FIXUP_FUNC,
8026 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8027 },
8028 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8029 .type = HDA_FIXUP_VERBS,
8030 .v.verbs = (const struct hda_verb[]) {
8031 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8032 { }
8033 },
8034 },
8035 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8036 .type = HDA_FIXUP_PINS,
8037 .v.pins = (const struct hda_pintbl[]) {
8038 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8039 { }
8040 },
8041 .chained = true,
8042 .chain_id = ALC269_FIXUP_HEADSET_MODE
8043 },
8044 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8045 .type = HDA_FIXUP_PINS,
8046 .v.pins = (const struct hda_pintbl[]) {
8047 { 0x14, 0x90100120 }, /* use as internal speaker */
8048 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8049 { 0x1a, 0x01011020 }, /* use as line out */
8050 { },
8051 },
8052 .chained = true,
8053 .chain_id = ALC269_FIXUP_HEADSET_MIC
8054 },
8055 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8056 .type = HDA_FIXUP_PINS,
8057 .v.pins = (const struct hda_pintbl[]) {
8058 { 0x18, 0x02a11030 }, /* use as headset mic */
8059 { }
8060 },
8061 .chained = true,
8062 .chain_id = ALC269_FIXUP_HEADSET_MIC
8063 },
8064 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8065 .type = HDA_FIXUP_PINS,
8066 .v.pins = (const struct hda_pintbl[]) {
8067 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8068 { }
8069 },
8070 .chained = true,
8071 .chain_id = ALC269_FIXUP_HEADSET_MIC
8072 },
8073 [ALC289_FIXUP_ASUS_GA401] = {
8074 .type = HDA_FIXUP_FUNC,
8075 .v.func = alc289_fixup_asus_ga401,
8076 .chained = true,
8077 .chain_id = ALC289_FIXUP_ASUS_GA502,
8078 },
8079 [ALC289_FIXUP_ASUS_GA502] = {
8080 .type = HDA_FIXUP_PINS,
8081 .v.pins = (const struct hda_pintbl[]) {
8082 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8083 { }
8084 },
8085 },
8086 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8087 .type = HDA_FIXUP_PINS,
8088 .v.pins = (const struct hda_pintbl[]) {
8089 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8090 { }
8091 },
8092 .chained = true,
8093 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8094 },
8095 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8096 .type = HDA_FIXUP_FUNC,
8097 .v.func = alc285_fixup_hp_gpio_amp_init,
8098 .chained = true,
8099 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8100 },
8101 [ALC269_FIXUP_CZC_B20] = {
8102 .type = HDA_FIXUP_PINS,
8103 .v.pins = (const struct hda_pintbl[]) {
8104 { 0x12, 0x411111f0 },
8105 { 0x14, 0x90170110 }, /* speaker */
8106 { 0x15, 0x032f1020 }, /* HP out */
8107 { 0x17, 0x411111f0 },
8108 { 0x18, 0x03ab1040 }, /* mic */
8109 { 0x19, 0xb7a7013f },
8110 { 0x1a, 0x0181305f },
8111 { 0x1b, 0x411111f0 },
8112 { 0x1d, 0x411111f0 },
8113 { 0x1e, 0x411111f0 },
8114 { }
8115 },
8116 .chain_id = ALC269_FIXUP_DMIC,
8117 },
8118 [ALC269_FIXUP_CZC_TMI] = {
8119 .type = HDA_FIXUP_PINS,
8120 .v.pins = (const struct hda_pintbl[]) {
8121 { 0x12, 0x4000c000 },
8122 { 0x14, 0x90170110 }, /* speaker */
8123 { 0x15, 0x0421401f }, /* HP out */
8124 { 0x17, 0x411111f0 },
8125 { 0x18, 0x04a19020 }, /* mic */
8126 { 0x19, 0x411111f0 },
8127 { 0x1a, 0x411111f0 },
8128 { 0x1b, 0x411111f0 },
8129 { 0x1d, 0x40448505 },
8130 { 0x1e, 0x411111f0 },
8131 { 0x20, 0x8000ffff },
8132 { }
8133 },
8134 .chain_id = ALC269_FIXUP_DMIC,
8135 },
8136 [ALC269_FIXUP_CZC_L101] = {
8137 .type = HDA_FIXUP_PINS,
8138 .v.pins = (const struct hda_pintbl[]) {
8139 { 0x12, 0x40000000 },
8140 { 0x14, 0x01014010 }, /* speaker */
8141 { 0x15, 0x411111f0 }, /* HP out */
8142 { 0x16, 0x411111f0 },
8143 { 0x18, 0x01a19020 }, /* mic */
8144 { 0x19, 0x02a19021 },
8145 { 0x1a, 0x0181302f },
8146 { 0x1b, 0x0221401f },
8147 { 0x1c, 0x411111f0 },
8148 { 0x1d, 0x4044c601 },
8149 { 0x1e, 0x411111f0 },
8150 { }
8151 },
8152 .chain_id = ALC269_FIXUP_DMIC,
8153 },
8154 [ALC269_FIXUP_LEMOTE_A1802] = {
8155 .type = HDA_FIXUP_PINS,
8156 .v.pins = (const struct hda_pintbl[]) {
8157 { 0x12, 0x40000000 },
8158 { 0x14, 0x90170110 }, /* speaker */
8159 { 0x17, 0x411111f0 },
8160 { 0x18, 0x03a19040 }, /* mic1 */
8161 { 0x19, 0x90a70130 }, /* mic2 */
8162 { 0x1a, 0x411111f0 },
8163 { 0x1b, 0x411111f0 },
8164 { 0x1d, 0x40489d2d },
8165 { 0x1e, 0x411111f0 },
8166 { 0x20, 0x0003ffff },
8167 { 0x21, 0x03214020 },
8168 { }
8169 },
8170 .chain_id = ALC269_FIXUP_DMIC,
8171 },
8172 [ALC269_FIXUP_LEMOTE_A190X] = {
8173 .type = HDA_FIXUP_PINS,
8174 .v.pins = (const struct hda_pintbl[]) {
8175 { 0x14, 0x99130110 }, /* speaker */
8176 { 0x15, 0x0121401f }, /* HP out */
8177 { 0x18, 0x01a19c20 }, /* rear mic */
8178 { 0x19, 0x99a3092f }, /* front mic */
8179 { 0x1b, 0x0201401f }, /* front lineout */
8180 { }
8181 },
8182 .chain_id = ALC269_FIXUP_DMIC,
8183 },
8184 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8185 .type = HDA_FIXUP_PINS,
8186 .v.pins = (const struct hda_pintbl[]) {
8187 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8188 { }
8189 },
8190 .chained = true,
8191 .chain_id = ALC269_FIXUP_HEADSET_MODE
8192 },
8193 [ALC256_FIXUP_INTEL_NUC10] = {
8194 .type = HDA_FIXUP_PINS,
8195 .v.pins = (const struct hda_pintbl[]) {
8196 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8197 { }
8198 },
8199 .chained = true,
8200 .chain_id = ALC269_FIXUP_HEADSET_MODE
8201 },
8202 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8203 .type = HDA_FIXUP_VERBS,
8204 .v.verbs = (const struct hda_verb[]) {
8205 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8206 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8207 { }
8208 },
8209 .chained = true,
8210 .chain_id = ALC289_FIXUP_ASUS_GA502
8211 },
8212 [ALC274_FIXUP_HP_MIC] = {
8213 .type = HDA_FIXUP_VERBS,
8214 .v.verbs = (const struct hda_verb[]) {
8215 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8216 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8217 { }
8218 },
8219 },
8220 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8221 .type = HDA_FIXUP_FUNC,
8222 .v.func = alc274_fixup_hp_headset_mic,
8223 .chained = true,
8224 .chain_id = ALC274_FIXUP_HP_MIC
8225 },
8226 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8227 .type = HDA_FIXUP_FUNC,
8228 .v.func = alc274_fixup_hp_envy_gpio,
8229 },
8230 [ALC256_FIXUP_ASUS_HPE] = {
8231 .type = HDA_FIXUP_VERBS,
8232 .v.verbs = (const struct hda_verb[]) {
8233 /* Set EAPD high */
8234 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8235 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8236 { }
8237 },
8238 .chained = true,
8239 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8240 },
8241 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8242 .type = HDA_FIXUP_FUNC,
8243 .v.func = alc_fixup_headset_jack,
8244 .chained = true,
8245 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8246 },
8247 [ALC287_FIXUP_HP_GPIO_LED] = {
8248 .type = HDA_FIXUP_FUNC,
8249 .v.func = alc287_fixup_hp_gpio_led,
8250 },
8251 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8252 .type = HDA_FIXUP_FUNC,
8253 .v.func = alc274_fixup_hp_headset_mic,
8254 },
8255 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8256 .type = HDA_FIXUP_FUNC,
8257 .v.func = alc_fixup_no_int_mic,
8258 .chained = true,
8259 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8260 },
8261 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8262 .type = HDA_FIXUP_PINS,
8263 .v.pins = (const struct hda_pintbl[]) {
8264 { 0x1b, 0x411111f0 },
8265 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8266 { },
8267 },
8268 .chained = true,
8269 .chain_id = ALC269_FIXUP_HEADSET_MODE
8270 },
8271 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8272 .type = HDA_FIXUP_FUNC,
8273 .v.func = alc269_fixup_limit_int_mic_boost,
8274 .chained = true,
8275 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8276 },
8277 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8278 .type = HDA_FIXUP_PINS,
8279 .v.pins = (const struct hda_pintbl[]) {
8280 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8281 { 0x1a, 0x90a1092f }, /* use as internal mic */
8282 { }
8283 },
8284 .chained = true,
8285 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8286 },
8287 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8288 .type = HDA_FIXUP_FUNC,
8289 .v.func = alc285_fixup_ideapad_s740_coef,
8290 .chained = true,
8291 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8292 },
8293 [ALC295_FIXUP_ASUS_DACS] = {
8294 .type = HDA_FIXUP_FUNC,
8295 .v.func = alc295_fixup_asus_dacs,
8296 },
8297 [ALC295_FIXUP_HP_OMEN] = {
8298 .type = HDA_FIXUP_PINS,
8299 .v.pins = (const struct hda_pintbl[]) {
8300 { 0x12, 0xb7a60130 },
8301 { 0x13, 0x40000000 },
8302 { 0x14, 0x411111f0 },
8303 { 0x16, 0x411111f0 },
8304 { 0x17, 0x90170110 },
8305 { 0x18, 0x411111f0 },
8306 { 0x19, 0x02a11030 },
8307 { 0x1a, 0x411111f0 },
8308 { 0x1b, 0x04a19030 },
8309 { 0x1d, 0x40600001 },
8310 { 0x1e, 0x411111f0 },
8311 { 0x21, 0x03211020 },
8312 {}
8313 },
8314 .chained = true,
8315 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8316 },
8317 [ALC285_FIXUP_HP_SPECTRE_X360] = {
8318 .type = HDA_FIXUP_FUNC,
8319 .v.func = alc285_fixup_hp_spectre_x360,
8320 },
8321 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8322 .type = HDA_FIXUP_FUNC,
8323 .v.func = alc285_fixup_hp_spectre_x360_eb1
8324 },
8325 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8326 .type = HDA_FIXUP_FUNC,
8327 .v.func = alc285_fixup_ideapad_s740_coef,
8328 .chained = true,
8329 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8330 },
8331 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8332 .type = HDA_FIXUP_FUNC,
8333 .v.func = alc_fixup_no_shutup,
8334 .chained = true,
8335 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8336 },
8337 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8338 .type = HDA_FIXUP_PINS,
8339 .v.pins = (const struct hda_pintbl[]) {
8340 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8341 { }
8342 },
8343 .chained = true,
8344 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8345 },
8346 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8347 .type = HDA_FIXUP_FUNC,
8348 .v.func = alc269_fixup_limit_int_mic_boost,
8349 .chained = true,
8350 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8351 },
8352 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8353 .type = HDA_FIXUP_FUNC,
8354 .v.func = alc285_fixup_ideapad_s740_coef,
8355 .chained = true,
8356 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8357 },
8358 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8359 .type = HDA_FIXUP_FUNC,
8360 .v.func = alc287_fixup_legion_15imhg05_speakers,
8361 .chained = true,
8362 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8363 },
8364 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8365 .type = HDA_FIXUP_VERBS,
8366 //.v.verbs = legion_15imhg05_coefs,
8367 .v.verbs = (const struct hda_verb[]) {
8368 // set left speaker Legion 7i.
8369 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8370 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8371
8372 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8373 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8374 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8375 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8376 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8377
8378 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8379 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8380 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8381 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8382 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8383
8384 // set right speaker Legion 7i.
8385 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8386 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8387
8388 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8389 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8390 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8391 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8392 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8393
8394 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8395 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8396 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8397 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8398 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8399 {}
8400 },
8401 .chained = true,
8402 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8403 },
8404 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8405 .type = HDA_FIXUP_FUNC,
8406 .v.func = alc287_fixup_legion_15imhg05_speakers,
8407 .chained = true,
8408 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8409 },
8410 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8411 .type = HDA_FIXUP_VERBS,
8412 .v.verbs = (const struct hda_verb[]) {
8413 // set left speaker Yoga 7i.
8414 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8415 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8416
8417 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8418 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8419 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8420 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8421 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8422
8423 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8424 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8425 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8426 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8427 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8428
8429 // set right speaker Yoga 7i.
8430 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8431 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8432
8433 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8434 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8435 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8436 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8437 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8438
8439 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8440 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8441 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8442 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8443 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8444 {}
8445 },
8446 .chained = true,
8447 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8448 },
8449 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8450 .type = HDA_FIXUP_VERBS,
8451 .v.verbs = (const struct hda_verb[]) {
8452 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8453 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8454 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8455 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8456 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8457 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8458 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8459 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8460 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8461 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8462 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8463 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8464 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8465 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8466 {}
8467 },
8468 .chained = true,
8469 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8470 },
8471 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
8472 .type = HDA_FIXUP_FUNC,
8473 .v.func = alc256_fixup_set_coef_defaults,
8474 },
8475 [ALC245_FIXUP_HP_GPIO_LED] = {
8476 .type = HDA_FIXUP_FUNC,
8477 .v.func = alc245_fixup_hp_gpio_led,
8478 },
8479 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8480 .type = HDA_FIXUP_PINS,
8481 .v.pins = (const struct hda_pintbl[]) {
8482 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8483 { }
8484 },
8485 .chained = true,
8486 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8487 },
8488 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8489 .type = HDA_FIXUP_FUNC,
8490 .v.func = alc233_fixup_no_audio_jack,
8491 },
8492 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8493 .type = HDA_FIXUP_FUNC,
8494 .v.func = alc256_fixup_mic_no_presence_and_resume,
8495 .chained = true,
8496 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8497 },
8498 };
8499
8500 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
8501 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
8502 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8503 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
8504 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
8505 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8506 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8507 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
8508 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8509 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8510 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
8511 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8512 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
8513 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
8514 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
8515 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
8516 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
8517 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
8518 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8519 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8520 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8521 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
8522 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8523 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
8524 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
8525 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
8526 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8527 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8528 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8529 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
8530 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8531 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8532 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
8533 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
8534 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8535 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8536 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8537 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
8538 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
8539 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
8540 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
8541 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8542 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8543 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
8544 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
8545 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8546 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8547 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8548 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8549 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8550 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
8551 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
8552 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
8553 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8554 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8555 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
8556 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8557 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8558 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8559 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8560 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8561 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8562 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8563 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8564 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8565 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8566 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8567 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
8568 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
8569 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
8570 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
8571 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8572 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
8573 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
8574 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8575 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8576 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8577 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8578 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
8579 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
8580 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
8581 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8582 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8583 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8584 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8585 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8586 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8587 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8588 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
8589 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
8590 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
8591 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8592 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8593 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8594 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8595 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
8596 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8597 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
8598 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8599 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8600 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8601 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8602 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8603 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8604 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8605 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8606 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8607 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8608 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8609 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8610 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8611 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8612 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8613 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8614 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8615 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8616 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
8617 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
8618 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8619 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8620 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8621 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8622 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8623 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8624 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8625 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8626 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
8627 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8628 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
8629 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8630 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
8631 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8632 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8633 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8634 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8635 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8636 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8637 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8638 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8639 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8640 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8641 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8642 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8643 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8644 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8645 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8646 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8647 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8648 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8649 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8650 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8651 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8652 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8653 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8654 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8655 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8656 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8657 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
8658 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
8659 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8660 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8661 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8662 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8663 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8664 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8665 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
8666 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8667 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
8668 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8669 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8670 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
8671 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
8672 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8673 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8674 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
8675 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
8676 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
8677 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
8678 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
8679 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8680 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
8681 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
8682 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
8683 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8684 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8685 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8686 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8687 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
8688 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
8689 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8690 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8691 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8692 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8693 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8694 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
8695 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
8696 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
8697 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8698 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8699 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8700 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8701 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8702 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8703 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8704 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8705 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8706 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8707 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8708 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8709 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8710 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
8711 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
8712 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
8713 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
8714 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8715 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
8716 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
8717 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8718 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8719 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8720 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8721 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
8722 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8723 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8724 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
8725 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
8726 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
8727 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
8728 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
8729 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
8730 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
8731 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
8732 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
8733 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
8734 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
8735 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
8736 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
8737 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
8738 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8739 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
8740 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
8741 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
8742 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
8743 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
8744 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
8745 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8746 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8747 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
8748 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
8749 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
8750 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
8751 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
8752 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
8753 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
8754 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8755 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8756 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8757 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8758 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
8759 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8760 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8761 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8762 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
8763 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8764 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8765 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
8766 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
8767 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
8768 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
8769 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
8770 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
8771 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
8772 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
8773 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8774 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8775 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8776 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
8777 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
8778 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8779 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8780 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8781 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8782 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
8783 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8784 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8785 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8786 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8787 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
8788 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
8789 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8790 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8791 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8792 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8793 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8794 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8795 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8796 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8797 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8798 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8799 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8800 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8801 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8802 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8803 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8804 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8805 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8806 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8807 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8808 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8809 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8810 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8811 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8812 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8813 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8814 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8815 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8816 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8817 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8818 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8819 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8820 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8821 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8822 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8823 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8824 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8825 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8826 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8827 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8828 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8829 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8830 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8831 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
8832 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
8833 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
8834 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8835 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8836 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
8837 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8838 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8839 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8840 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8841 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8842 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8843 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8844 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8845 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL5XNU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8846 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8847 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8848 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8849 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8850 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8851 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8852 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
8853 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
8854 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8855 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8856 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8857 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8858 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
8859 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
8860 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
8861 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
8862 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
8863 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
8864 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
8865 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
8866 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
8867 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
8868 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
8869 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
8870 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
8871 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8872 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
8873 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
8874 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
8875 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8876 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8877 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
8878 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
8879 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8880 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8881 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8882 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
8883 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8884 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8885 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8886 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8887 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
8888 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
8889 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8890 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8891 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
8892 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
8893 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8894 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8895 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8896 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8897 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8898 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8899 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8900 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8901 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
8902 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
8903 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
8904 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
8905 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
8906 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
8907 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8908 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
8909 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8910 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8911 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8912 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
8913 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
8914 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
8915 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
8916 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8917 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
8918 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
8919 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8920 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
8921 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
8922 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
8923 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
8924 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
8925 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
8926 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
8927 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
8928 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8929 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8930 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8931 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8932 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8933 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8934 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
8935 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
8936 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
8937 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8938 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8939 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
8940 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
8941 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8942 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
8943 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
8944 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
8945 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
8946 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
8947 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
8948 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
8949 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
8950 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
8951
8952 #if 0
8953 /* Below is a quirk table taken from the old code.
8954 * Basically the device should work as is without the fixup table.
8955 * If BIOS doesn't give a proper info, enable the corresponding
8956 * fixup entry.
8957 */
8958 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8959 ALC269_FIXUP_AMIC),
8960 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
8961 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8962 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8963 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8964 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8965 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8966 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8967 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8968 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8969 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8970 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8971 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8972 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8973 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8974 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8975 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8976 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8977 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8978 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8979 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8980 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8981 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8982 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8983 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8984 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8985 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8986 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8987 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8988 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8989 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8990 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8991 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8992 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8993 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8994 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8995 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8996 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8997 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8998 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8999 #endif
9000 {}
9001 };
9002
9003 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9004 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9005 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9006 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9007 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
9008 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
9009 {}
9010 };
9011
9012 static const struct hda_model_fixup alc269_fixup_models[] = {
9013 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9014 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
9015 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9016 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9017 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
9018 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
9019 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9020 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
9021 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
9022 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9023 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9024 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
9025 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9026 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
9027 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9028 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
9029 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
9030 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
9031 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9032 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
9033 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
9034 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
9035 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
9036 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
9037 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
9038 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9039 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9040 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9041 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9042 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9043 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9044 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9045 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9046 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9047 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9048 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9049 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9050 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9051 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9052 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9053 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9054 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9055 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9056 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9057 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9058 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9059 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9060 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9061 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9062 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9063 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9064 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9065 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9066 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9067 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9068 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9069 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9070 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9071 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9072 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9073 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9074 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9075 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9076 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9077 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
9078 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
9079 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
9080 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
9081 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9082 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9083 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9084 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9085 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9086 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9087 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9088 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9089 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9090 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9091 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9092 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9093 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9094 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
9095 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9096 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9097 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
9098 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
9099 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
9100 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
9101 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9102 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9103 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9104 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9105 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9106 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9107 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9108 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9109 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9110 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9111 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9112 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9113 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9114 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9115 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9116 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9117 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
9118 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9119 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
9120 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
9121 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
9122 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
9123 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
9124 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
9125 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
9126 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
9127 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
9128 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
9129 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9130 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
9131 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
9132 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
9133 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
9134 {}
9135 };
9136 #define ALC225_STANDARD_PINS \
9137 {0x21, 0x04211020}
9138
9139 #define ALC256_STANDARD_PINS \
9140 {0x12, 0x90a60140}, \
9141 {0x14, 0x90170110}, \
9142 {0x21, 0x02211020}
9143
9144 #define ALC282_STANDARD_PINS \
9145 {0x14, 0x90170110}
9146
9147 #define ALC290_STANDARD_PINS \
9148 {0x12, 0x99a30130}
9149
9150 #define ALC292_STANDARD_PINS \
9151 {0x14, 0x90170110}, \
9152 {0x15, 0x0221401f}
9153
9154 #define ALC295_STANDARD_PINS \
9155 {0x12, 0xb7a60130}, \
9156 {0x14, 0x90170110}, \
9157 {0x21, 0x04211020}
9158
9159 #define ALC298_STANDARD_PINS \
9160 {0x12, 0x90a60130}, \
9161 {0x21, 0x03211020}
9162
9163 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
9164 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9165 {0x14, 0x01014020},
9166 {0x17, 0x90170110},
9167 {0x18, 0x02a11030},
9168 {0x19, 0x0181303F},
9169 {0x21, 0x0221102f}),
9170 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9171 {0x12, 0x90a601c0},
9172 {0x14, 0x90171120},
9173 {0x21, 0x02211030}),
9174 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9175 {0x14, 0x90170110},
9176 {0x1b, 0x90a70130},
9177 {0x21, 0x03211020}),
9178 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9179 {0x1a, 0x90a70130},
9180 {0x1b, 0x90170110},
9181 {0x21, 0x03211020}),
9182 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9183 ALC225_STANDARD_PINS,
9184 {0x12, 0xb7a60130},
9185 {0x14, 0x901701a0}),
9186 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9187 ALC225_STANDARD_PINS,
9188 {0x12, 0xb7a60130},
9189 {0x14, 0x901701b0}),
9190 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9191 ALC225_STANDARD_PINS,
9192 {0x12, 0xb7a60150},
9193 {0x14, 0x901701a0}),
9194 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9195 ALC225_STANDARD_PINS,
9196 {0x12, 0xb7a60150},
9197 {0x14, 0x901701b0}),
9198 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9199 ALC225_STANDARD_PINS,
9200 {0x12, 0xb7a60130},
9201 {0x1b, 0x90170110}),
9202 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9203 {0x1b, 0x01111010},
9204 {0x1e, 0x01451130},
9205 {0x21, 0x02211020}),
9206 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9207 {0x12, 0x90a60140},
9208 {0x14, 0x90170110},
9209 {0x19, 0x02a11030},
9210 {0x21, 0x02211020}),
9211 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9212 {0x14, 0x90170110},
9213 {0x19, 0x02a11030},
9214 {0x1a, 0x02a11040},
9215 {0x1b, 0x01014020},
9216 {0x21, 0x0221101f}),
9217 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9218 {0x14, 0x90170110},
9219 {0x19, 0x02a11030},
9220 {0x1a, 0x02a11040},
9221 {0x1b, 0x01011020},
9222 {0x21, 0x0221101f}),
9223 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9224 {0x14, 0x90170110},
9225 {0x19, 0x02a11020},
9226 {0x1a, 0x02a11030},
9227 {0x21, 0x0221101f}),
9228 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9229 {0x21, 0x02211010}),
9230 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9231 {0x14, 0x90170110},
9232 {0x19, 0x02a11020},
9233 {0x21, 0x02211030}),
9234 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9235 {0x14, 0x90170110},
9236 {0x21, 0x02211020}),
9237 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9238 {0x14, 0x90170130},
9239 {0x21, 0x02211040}),
9240 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9241 {0x12, 0x90a60140},
9242 {0x14, 0x90170110},
9243 {0x21, 0x02211020}),
9244 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9245 {0x12, 0x90a60160},
9246 {0x14, 0x90170120},
9247 {0x21, 0x02211030}),
9248 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9249 {0x14, 0x90170110},
9250 {0x1b, 0x02011020},
9251 {0x21, 0x0221101f}),
9252 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9253 {0x14, 0x90170110},
9254 {0x1b, 0x01011020},
9255 {0x21, 0x0221101f}),
9256 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9257 {0x14, 0x90170130},
9258 {0x1b, 0x01014020},
9259 {0x21, 0x0221103f}),
9260 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9261 {0x14, 0x90170130},
9262 {0x1b, 0x01011020},
9263 {0x21, 0x0221103f}),
9264 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9265 {0x14, 0x90170130},
9266 {0x1b, 0x02011020},
9267 {0x21, 0x0221103f}),
9268 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9269 {0x14, 0x90170150},
9270 {0x1b, 0x02011020},
9271 {0x21, 0x0221105f}),
9272 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9273 {0x14, 0x90170110},
9274 {0x1b, 0x01014020},
9275 {0x21, 0x0221101f}),
9276 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9277 {0x12, 0x90a60160},
9278 {0x14, 0x90170120},
9279 {0x17, 0x90170140},
9280 {0x21, 0x0321102f}),
9281 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9282 {0x12, 0x90a60160},
9283 {0x14, 0x90170130},
9284 {0x21, 0x02211040}),
9285 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9286 {0x12, 0x90a60160},
9287 {0x14, 0x90170140},
9288 {0x21, 0x02211050}),
9289 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9290 {0x12, 0x90a60170},
9291 {0x14, 0x90170120},
9292 {0x21, 0x02211030}),
9293 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9294 {0x12, 0x90a60170},
9295 {0x14, 0x90170130},
9296 {0x21, 0x02211040}),
9297 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9298 {0x12, 0x90a60170},
9299 {0x14, 0x90171130},
9300 {0x21, 0x02211040}),
9301 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9302 {0x12, 0x90a60170},
9303 {0x14, 0x90170140},
9304 {0x21, 0x02211050}),
9305 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9306 {0x12, 0x90a60180},
9307 {0x14, 0x90170130},
9308 {0x21, 0x02211040}),
9309 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9310 {0x12, 0x90a60180},
9311 {0x14, 0x90170120},
9312 {0x21, 0x02211030}),
9313 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9314 {0x1b, 0x01011020},
9315 {0x21, 0x02211010}),
9316 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9317 {0x14, 0x90170110},
9318 {0x1b, 0x90a70130},
9319 {0x21, 0x04211020}),
9320 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9321 {0x14, 0x90170110},
9322 {0x1b, 0x90a70130},
9323 {0x21, 0x03211020}),
9324 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9325 {0x12, 0x90a60130},
9326 {0x14, 0x90170110},
9327 {0x21, 0x03211020}),
9328 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9329 {0x12, 0x90a60130},
9330 {0x14, 0x90170110},
9331 {0x21, 0x04211020}),
9332 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9333 {0x1a, 0x90a70130},
9334 {0x1b, 0x90170110},
9335 {0x21, 0x03211020}),
9336 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9337 {0x14, 0x90170110},
9338 {0x19, 0x02a11020},
9339 {0x21, 0x0221101f}),
9340 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9341 {0x17, 0x90170110},
9342 {0x19, 0x03a11030},
9343 {0x21, 0x03211020}),
9344 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9345 {0x12, 0x90a60130},
9346 {0x14, 0x90170110},
9347 {0x15, 0x0421101f},
9348 {0x1a, 0x04a11020}),
9349 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9350 {0x12, 0x90a60140},
9351 {0x14, 0x90170110},
9352 {0x15, 0x0421101f},
9353 {0x18, 0x02811030},
9354 {0x1a, 0x04a1103f},
9355 {0x1b, 0x02011020}),
9356 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9357 ALC282_STANDARD_PINS,
9358 {0x12, 0x99a30130},
9359 {0x19, 0x03a11020},
9360 {0x21, 0x0321101f}),
9361 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9362 ALC282_STANDARD_PINS,
9363 {0x12, 0x99a30130},
9364 {0x19, 0x03a11020},
9365 {0x21, 0x03211040}),
9366 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9367 ALC282_STANDARD_PINS,
9368 {0x12, 0x99a30130},
9369 {0x19, 0x03a11030},
9370 {0x21, 0x03211020}),
9371 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9372 ALC282_STANDARD_PINS,
9373 {0x12, 0x99a30130},
9374 {0x19, 0x04a11020},
9375 {0x21, 0x0421101f}),
9376 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
9377 ALC282_STANDARD_PINS,
9378 {0x12, 0x90a60140},
9379 {0x19, 0x04a11030},
9380 {0x21, 0x04211020}),
9381 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9382 ALC282_STANDARD_PINS,
9383 {0x12, 0x90a609c0},
9384 {0x18, 0x03a11830},
9385 {0x19, 0x04a19831},
9386 {0x1a, 0x0481303f},
9387 {0x1b, 0x04211020},
9388 {0x21, 0x0321101f}),
9389 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9390 ALC282_STANDARD_PINS,
9391 {0x12, 0x90a60940},
9392 {0x18, 0x03a11830},
9393 {0x19, 0x04a19831},
9394 {0x1a, 0x0481303f},
9395 {0x1b, 0x04211020},
9396 {0x21, 0x0321101f}),
9397 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9398 ALC282_STANDARD_PINS,
9399 {0x12, 0x90a60130},
9400 {0x21, 0x0321101f}),
9401 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9402 {0x12, 0x90a60160},
9403 {0x14, 0x90170120},
9404 {0x21, 0x02211030}),
9405 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9406 ALC282_STANDARD_PINS,
9407 {0x12, 0x90a60130},
9408 {0x19, 0x03a11020},
9409 {0x21, 0x0321101f}),
9410 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9411 {0x12, 0x90a60130},
9412 {0x14, 0x90170110},
9413 {0x19, 0x04a11040},
9414 {0x21, 0x04211020}),
9415 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9416 {0x14, 0x90170110},
9417 {0x19, 0x04a11040},
9418 {0x1d, 0x40600001},
9419 {0x21, 0x04211020}),
9420 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9421 {0x14, 0x90170110},
9422 {0x19, 0x04a11040},
9423 {0x21, 0x04211020}),
9424 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9425 {0x14, 0x90170110},
9426 {0x17, 0x90170111},
9427 {0x19, 0x03a11030},
9428 {0x21, 0x03211020}),
9429 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9430 {0x12, 0x90a60130},
9431 {0x17, 0x90170110},
9432 {0x21, 0x02211020}),
9433 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
9434 {0x12, 0x90a60120},
9435 {0x14, 0x90170110},
9436 {0x21, 0x0321101f}),
9437 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9438 ALC290_STANDARD_PINS,
9439 {0x15, 0x04211040},
9440 {0x18, 0x90170112},
9441 {0x1a, 0x04a11020}),
9442 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9443 ALC290_STANDARD_PINS,
9444 {0x15, 0x04211040},
9445 {0x18, 0x90170110},
9446 {0x1a, 0x04a11020}),
9447 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9448 ALC290_STANDARD_PINS,
9449 {0x15, 0x0421101f},
9450 {0x1a, 0x04a11020}),
9451 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9452 ALC290_STANDARD_PINS,
9453 {0x15, 0x04211020},
9454 {0x1a, 0x04a11040}),
9455 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9456 ALC290_STANDARD_PINS,
9457 {0x14, 0x90170110},
9458 {0x15, 0x04211020},
9459 {0x1a, 0x04a11040}),
9460 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9461 ALC290_STANDARD_PINS,
9462 {0x14, 0x90170110},
9463 {0x15, 0x04211020},
9464 {0x1a, 0x04a11020}),
9465 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9466 ALC290_STANDARD_PINS,
9467 {0x14, 0x90170110},
9468 {0x15, 0x0421101f},
9469 {0x1a, 0x04a11020}),
9470 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9471 ALC292_STANDARD_PINS,
9472 {0x12, 0x90a60140},
9473 {0x16, 0x01014020},
9474 {0x19, 0x01a19030}),
9475 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9476 ALC292_STANDARD_PINS,
9477 {0x12, 0x90a60140},
9478 {0x16, 0x01014020},
9479 {0x18, 0x02a19031},
9480 {0x19, 0x01a1903e}),
9481 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
9482 ALC292_STANDARD_PINS,
9483 {0x12, 0x90a60140}),
9484 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9485 ALC292_STANDARD_PINS,
9486 {0x13, 0x90a60140},
9487 {0x16, 0x21014020},
9488 {0x19, 0x21a19030}),
9489 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9490 ALC292_STANDARD_PINS,
9491 {0x13, 0x90a60140}),
9492 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9493 {0x17, 0x90170110},
9494 {0x21, 0x04211020}),
9495 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9496 {0x14, 0x90170110},
9497 {0x1b, 0x90a70130},
9498 {0x21, 0x04211020}),
9499 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9500 {0x12, 0x90a60130},
9501 {0x17, 0x90170110},
9502 {0x21, 0x03211020}),
9503 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9504 {0x12, 0x90a60130},
9505 {0x17, 0x90170110},
9506 {0x21, 0x04211020}),
9507 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9508 {0x12, 0x90a60130},
9509 {0x17, 0x90170110},
9510 {0x21, 0x03211020}),
9511 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9512 {0x12, 0x90a60120},
9513 {0x17, 0x90170110},
9514 {0x21, 0x04211030}),
9515 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9516 {0x12, 0x90a60130},
9517 {0x17, 0x90170110},
9518 {0x21, 0x03211020}),
9519 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9520 {0x12, 0x90a60130},
9521 {0x17, 0x90170110},
9522 {0x21, 0x03211020}),
9523 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9524 {0x14, 0x90170110},
9525 {0x21, 0x04211020}),
9526 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9527 {0x14, 0x90170110},
9528 {0x21, 0x04211030}),
9529 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9530 ALC295_STANDARD_PINS,
9531 {0x17, 0x21014020},
9532 {0x18, 0x21a19030}),
9533 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9534 ALC295_STANDARD_PINS,
9535 {0x17, 0x21014040},
9536 {0x18, 0x21a19050}),
9537 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9538 ALC295_STANDARD_PINS),
9539 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9540 ALC298_STANDARD_PINS,
9541 {0x17, 0x90170110}),
9542 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9543 ALC298_STANDARD_PINS,
9544 {0x17, 0x90170140}),
9545 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9546 ALC298_STANDARD_PINS,
9547 {0x17, 0x90170150}),
9548 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9549 {0x12, 0xb7a60140},
9550 {0x13, 0xb7a60150},
9551 {0x17, 0x90170110},
9552 {0x1a, 0x03011020},
9553 {0x21, 0x03211030}),
9554 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9555 {0x12, 0xb7a60140},
9556 {0x17, 0x90170110},
9557 {0x1a, 0x03a11030},
9558 {0x21, 0x03211020}),
9559 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9560 ALC225_STANDARD_PINS,
9561 {0x12, 0xb7a60130},
9562 {0x17, 0x90170110}),
9563 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9564 {0x14, 0x01014010},
9565 {0x17, 0x90170120},
9566 {0x18, 0x02a11030},
9567 {0x19, 0x02a1103f},
9568 {0x21, 0x0221101f}),
9569 {}
9570 };
9571
9572 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9573 * more machines, don't need to match all valid pins, just need to match
9574 * all the pins defined in the tbl. Just because of this reason, it is possible
9575 * that a single machine matches multiple tbls, so there is one limitation:
9576 * at most one tbl is allowed to define for the same vendor and same codec
9577 */
9578 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9579 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9580 {0x19, 0x40000000},
9581 {0x1b, 0x40000000}),
9582 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9583 {0x19, 0x40000000},
9584 {0x1a, 0x40000000}),
9585 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9586 {0x19, 0x40000000},
9587 {0x1a, 0x40000000}),
9588 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9589 {0x19, 0x40000000},
9590 {0x1a, 0x40000000}),
9591 {}
9592 };
9593
alc269_fill_coef(struct hda_codec * codec)9594 static void alc269_fill_coef(struct hda_codec *codec)
9595 {
9596 struct alc_spec *spec = codec->spec;
9597 int val;
9598
9599 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
9600 return;
9601
9602 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
9603 alc_write_coef_idx(codec, 0xf, 0x960b);
9604 alc_write_coef_idx(codec, 0xe, 0x8817);
9605 }
9606
9607 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
9608 alc_write_coef_idx(codec, 0xf, 0x960b);
9609 alc_write_coef_idx(codec, 0xe, 0x8814);
9610 }
9611
9612 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
9613 /* Power up output pin */
9614 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
9615 }
9616
9617 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
9618 val = alc_read_coef_idx(codec, 0xd);
9619 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
9620 /* Capless ramp up clock control */
9621 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9622 }
9623 val = alc_read_coef_idx(codec, 0x17);
9624 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
9625 /* Class D power on reset */
9626 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9627 }
9628 }
9629
9630 /* HP */
9631 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
9632 }
9633
9634 /*
9635 */
patch_alc269(struct hda_codec * codec)9636 static int patch_alc269(struct hda_codec *codec)
9637 {
9638 struct alc_spec *spec;
9639 int err;
9640
9641 err = alc_alloc_spec(codec, 0x0b);
9642 if (err < 0)
9643 return err;
9644
9645 spec = codec->spec;
9646 spec->gen.shared_mic_vref_pin = 0x18;
9647 codec->power_save_node = 0;
9648
9649 #ifdef CONFIG_PM
9650 codec->patch_ops.suspend = alc269_suspend;
9651 codec->patch_ops.resume = alc269_resume;
9652 #endif
9653 spec->shutup = alc_default_shutup;
9654 spec->init_hook = alc_default_init;
9655
9656 switch (codec->core.vendor_id) {
9657 case 0x10ec0269:
9658 spec->codec_variant = ALC269_TYPE_ALC269VA;
9659 switch (alc_get_coef0(codec) & 0x00f0) {
9660 case 0x0010:
9661 if (codec->bus->pci &&
9662 codec->bus->pci->subsystem_vendor == 0x1025 &&
9663 spec->cdefine.platform_type == 1)
9664 err = alc_codec_rename(codec, "ALC271X");
9665 spec->codec_variant = ALC269_TYPE_ALC269VB;
9666 break;
9667 case 0x0020:
9668 if (codec->bus->pci &&
9669 codec->bus->pci->subsystem_vendor == 0x17aa &&
9670 codec->bus->pci->subsystem_device == 0x21f3)
9671 err = alc_codec_rename(codec, "ALC3202");
9672 spec->codec_variant = ALC269_TYPE_ALC269VC;
9673 break;
9674 case 0x0030:
9675 spec->codec_variant = ALC269_TYPE_ALC269VD;
9676 break;
9677 default:
9678 alc_fix_pll_init(codec, 0x20, 0x04, 15);
9679 }
9680 if (err < 0)
9681 goto error;
9682 spec->shutup = alc269_shutup;
9683 spec->init_hook = alc269_fill_coef;
9684 alc269_fill_coef(codec);
9685 break;
9686
9687 case 0x10ec0280:
9688 case 0x10ec0290:
9689 spec->codec_variant = ALC269_TYPE_ALC280;
9690 break;
9691 case 0x10ec0282:
9692 spec->codec_variant = ALC269_TYPE_ALC282;
9693 spec->shutup = alc282_shutup;
9694 spec->init_hook = alc282_init;
9695 break;
9696 case 0x10ec0233:
9697 case 0x10ec0283:
9698 spec->codec_variant = ALC269_TYPE_ALC283;
9699 spec->shutup = alc283_shutup;
9700 spec->init_hook = alc283_init;
9701 break;
9702 case 0x10ec0284:
9703 case 0x10ec0292:
9704 spec->codec_variant = ALC269_TYPE_ALC284;
9705 break;
9706 case 0x10ec0293:
9707 spec->codec_variant = ALC269_TYPE_ALC293;
9708 break;
9709 case 0x10ec0286:
9710 case 0x10ec0288:
9711 spec->codec_variant = ALC269_TYPE_ALC286;
9712 break;
9713 case 0x10ec0298:
9714 spec->codec_variant = ALC269_TYPE_ALC298;
9715 break;
9716 case 0x10ec0235:
9717 case 0x10ec0255:
9718 spec->codec_variant = ALC269_TYPE_ALC255;
9719 spec->shutup = alc256_shutup;
9720 spec->init_hook = alc256_init;
9721 break;
9722 case 0x10ec0230:
9723 case 0x10ec0236:
9724 case 0x10ec0256:
9725 spec->codec_variant = ALC269_TYPE_ALC256;
9726 spec->shutup = alc256_shutup;
9727 spec->init_hook = alc256_init;
9728 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
9729 break;
9730 case 0x10ec0257:
9731 spec->codec_variant = ALC269_TYPE_ALC257;
9732 spec->shutup = alc256_shutup;
9733 spec->init_hook = alc256_init;
9734 spec->gen.mixer_nid = 0;
9735 break;
9736 case 0x10ec0215:
9737 case 0x10ec0245:
9738 case 0x10ec0285:
9739 case 0x10ec0287:
9740 case 0x10ec0289:
9741 spec->codec_variant = ALC269_TYPE_ALC215;
9742 spec->shutup = alc225_shutup;
9743 spec->init_hook = alc225_init;
9744 spec->gen.mixer_nid = 0;
9745 break;
9746 case 0x10ec0225:
9747 case 0x10ec0295:
9748 case 0x10ec0299:
9749 spec->codec_variant = ALC269_TYPE_ALC225;
9750 spec->shutup = alc225_shutup;
9751 spec->init_hook = alc225_init;
9752 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
9753 break;
9754 case 0x10ec0234:
9755 case 0x10ec0274:
9756 case 0x10ec0294:
9757 spec->codec_variant = ALC269_TYPE_ALC294;
9758 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
9759 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
9760 spec->init_hook = alc294_init;
9761 break;
9762 case 0x10ec0300:
9763 spec->codec_variant = ALC269_TYPE_ALC300;
9764 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
9765 break;
9766 case 0x10ec0623:
9767 spec->codec_variant = ALC269_TYPE_ALC623;
9768 break;
9769 case 0x10ec0700:
9770 case 0x10ec0701:
9771 case 0x10ec0703:
9772 case 0x10ec0711:
9773 spec->codec_variant = ALC269_TYPE_ALC700;
9774 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
9775 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
9776 spec->init_hook = alc294_init;
9777 break;
9778
9779 }
9780
9781 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
9782 spec->has_alc5505_dsp = 1;
9783 spec->init_hook = alc5505_dsp_init;
9784 }
9785
9786 alc_pre_init(codec);
9787
9788 snd_hda_pick_fixup(codec, alc269_fixup_models,
9789 alc269_fixup_tbl, alc269_fixups);
9790 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
9791 * the quirk breaks the latter (bko#214101).
9792 * Clear the wrong entry.
9793 */
9794 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
9795 codec->core.vendor_id == 0x10ec0294) {
9796 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
9797 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
9798 }
9799
9800 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
9801 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
9802 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9803 alc269_fixups);
9804 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9805
9806 alc_auto_parse_customize_define(codec);
9807
9808 if (has_cdefine_beep(codec))
9809 spec->gen.beep_nid = 0x01;
9810
9811 /* automatic parse from the BIOS config */
9812 err = alc269_parse_auto_config(codec);
9813 if (err < 0)
9814 goto error;
9815
9816 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9817 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9818 if (err < 0)
9819 goto error;
9820 }
9821
9822 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
9823
9824 return 0;
9825
9826 error:
9827 alc_free(codec);
9828 return err;
9829 }
9830
9831 /*
9832 * ALC861
9833 */
9834
alc861_parse_auto_config(struct hda_codec * codec)9835 static int alc861_parse_auto_config(struct hda_codec *codec)
9836 {
9837 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
9838 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9839 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
9840 }
9841
9842 /* Pin config fixes */
9843 enum {
9844 ALC861_FIXUP_FSC_AMILO_PI1505,
9845 ALC861_FIXUP_AMP_VREF_0F,
9846 ALC861_FIXUP_NO_JACK_DETECT,
9847 ALC861_FIXUP_ASUS_A6RP,
9848 ALC660_FIXUP_ASUS_W7J,
9849 };
9850
9851 /* 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)9852 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
9853 const struct hda_fixup *fix, int action)
9854 {
9855 struct alc_spec *spec = codec->spec;
9856 unsigned int val;
9857
9858 if (action != HDA_FIXUP_ACT_INIT)
9859 return;
9860 val = snd_hda_codec_get_pin_target(codec, 0x0f);
9861 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9862 val |= AC_PINCTL_IN_EN;
9863 val |= AC_PINCTL_VREF_50;
9864 snd_hda_set_pin_ctl(codec, 0x0f, val);
9865 spec->gen.keep_vref_in_automute = 1;
9866 }
9867
9868 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)9869 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
9870 const struct hda_fixup *fix, int action)
9871 {
9872 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9873 codec->no_jack_detect = 1;
9874 }
9875
9876 static const struct hda_fixup alc861_fixups[] = {
9877 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
9878 .type = HDA_FIXUP_PINS,
9879 .v.pins = (const struct hda_pintbl[]) {
9880 { 0x0b, 0x0221101f }, /* HP */
9881 { 0x0f, 0x90170310 }, /* speaker */
9882 { }
9883 }
9884 },
9885 [ALC861_FIXUP_AMP_VREF_0F] = {
9886 .type = HDA_FIXUP_FUNC,
9887 .v.func = alc861_fixup_asus_amp_vref_0f,
9888 },
9889 [ALC861_FIXUP_NO_JACK_DETECT] = {
9890 .type = HDA_FIXUP_FUNC,
9891 .v.func = alc_fixup_no_jack_detect,
9892 },
9893 [ALC861_FIXUP_ASUS_A6RP] = {
9894 .type = HDA_FIXUP_FUNC,
9895 .v.func = alc861_fixup_asus_amp_vref_0f,
9896 .chained = true,
9897 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
9898 },
9899 [ALC660_FIXUP_ASUS_W7J] = {
9900 .type = HDA_FIXUP_VERBS,
9901 .v.verbs = (const struct hda_verb[]) {
9902 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9903 * for enabling outputs
9904 */
9905 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9906 { }
9907 },
9908 }
9909 };
9910
9911 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
9912 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
9913 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
9914 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9915 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9916 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
9917 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
9918 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
9919 {}
9920 };
9921
9922 /*
9923 */
patch_alc861(struct hda_codec * codec)9924 static int patch_alc861(struct hda_codec *codec)
9925 {
9926 struct alc_spec *spec;
9927 int err;
9928
9929 err = alc_alloc_spec(codec, 0x15);
9930 if (err < 0)
9931 return err;
9932
9933 spec = codec->spec;
9934 if (has_cdefine_beep(codec))
9935 spec->gen.beep_nid = 0x23;
9936
9937 #ifdef CONFIG_PM
9938 spec->power_hook = alc_power_eapd;
9939 #endif
9940
9941 alc_pre_init(codec);
9942
9943 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9944 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9945
9946 /* automatic parse from the BIOS config */
9947 err = alc861_parse_auto_config(codec);
9948 if (err < 0)
9949 goto error;
9950
9951 if (!spec->gen.no_analog) {
9952 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9953 if (err < 0)
9954 goto error;
9955 }
9956
9957 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
9958
9959 return 0;
9960
9961 error:
9962 alc_free(codec);
9963 return err;
9964 }
9965
9966 /*
9967 * ALC861-VD support
9968 *
9969 * Based on ALC882
9970 *
9971 * In addition, an independent DAC
9972 */
alc861vd_parse_auto_config(struct hda_codec * codec)9973 static int alc861vd_parse_auto_config(struct hda_codec *codec)
9974 {
9975 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
9976 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9977 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
9978 }
9979
9980 enum {
9981 ALC660VD_FIX_ASUS_GPIO1,
9982 ALC861VD_FIX_DALLAS,
9983 };
9984
9985 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)9986 static void alc861vd_fixup_dallas(struct hda_codec *codec,
9987 const struct hda_fixup *fix, int action)
9988 {
9989 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9990 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9991 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
9992 }
9993 }
9994
9995 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)9996 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9997 const struct hda_fixup *fix, int action)
9998 {
9999 struct alc_spec *spec = codec->spec;
10000
10001 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10002 spec->gpio_mask |= 0x02;
10003 alc_fixup_gpio(codec, action, 0x01);
10004 }
10005
10006 static const struct hda_fixup alc861vd_fixups[] = {
10007 [ALC660VD_FIX_ASUS_GPIO1] = {
10008 .type = HDA_FIXUP_FUNC,
10009 .v.func = alc660vd_fixup_asus_gpio1,
10010 },
10011 [ALC861VD_FIX_DALLAS] = {
10012 .type = HDA_FIXUP_FUNC,
10013 .v.func = alc861vd_fixup_dallas,
10014 },
10015 };
10016
10017 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
10018 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
10019 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
10020 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
10021 {}
10022 };
10023
10024 /*
10025 */
patch_alc861vd(struct hda_codec * codec)10026 static int patch_alc861vd(struct hda_codec *codec)
10027 {
10028 struct alc_spec *spec;
10029 int err;
10030
10031 err = alc_alloc_spec(codec, 0x0b);
10032 if (err < 0)
10033 return err;
10034
10035 spec = codec->spec;
10036 if (has_cdefine_beep(codec))
10037 spec->gen.beep_nid = 0x23;
10038
10039 spec->shutup = alc_eapd_shutup;
10040
10041 alc_pre_init(codec);
10042
10043 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10044 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10045
10046 /* automatic parse from the BIOS config */
10047 err = alc861vd_parse_auto_config(codec);
10048 if (err < 0)
10049 goto error;
10050
10051 if (!spec->gen.no_analog) {
10052 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10053 if (err < 0)
10054 goto error;
10055 }
10056
10057 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10058
10059 return 0;
10060
10061 error:
10062 alc_free(codec);
10063 return err;
10064 }
10065
10066 /*
10067 * ALC662 support
10068 *
10069 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10070 * configuration. Each pin widget can choose any input DACs and a mixer.
10071 * Each ADC is connected from a mixer of all inputs. This makes possible
10072 * 6-channel independent captures.
10073 *
10074 * In addition, an independent DAC for the multi-playback (not used in this
10075 * driver yet).
10076 */
10077
10078 /*
10079 * BIOS auto configuration
10080 */
10081
alc662_parse_auto_config(struct hda_codec * codec)10082 static int alc662_parse_auto_config(struct hda_codec *codec)
10083 {
10084 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
10085 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10086 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10087 const hda_nid_t *ssids;
10088
10089 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10090 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10091 codec->core.vendor_id == 0x10ec0671)
10092 ssids = alc663_ssids;
10093 else
10094 ssids = alc662_ssids;
10095 return alc_parse_auto_config(codec, alc662_ignore, ssids);
10096 }
10097
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)10098 static void alc272_fixup_mario(struct hda_codec *codec,
10099 const struct hda_fixup *fix, int action)
10100 {
10101 if (action != HDA_FIXUP_ACT_PRE_PROBE)
10102 return;
10103 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10104 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10105 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10106 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10107 (0 << AC_AMPCAP_MUTE_SHIFT)))
10108 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
10109 }
10110
10111 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10112 { .channels = 2,
10113 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10114 { .channels = 4,
10115 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10116 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10117 { }
10118 };
10119
10120 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)10121 static void alc_fixup_bass_chmap(struct hda_codec *codec,
10122 const struct hda_fixup *fix, int action)
10123 {
10124 if (action == HDA_FIXUP_ACT_BUILD) {
10125 struct alc_spec *spec = codec->spec;
10126 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
10127 }
10128 }
10129
10130 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)10131 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10132 hda_nid_t nid,
10133 unsigned int power_state)
10134 {
10135 struct alc_spec *spec = codec->spec;
10136 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
10137 return AC_PWRST_D0;
10138 return power_state;
10139 }
10140
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)10141 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10142 const struct hda_fixup *fix, int action)
10143 {
10144 struct alc_spec *spec = codec->spec;
10145
10146 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
10147 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10148 spec->mute_led_polarity = 1;
10149 codec->power_filter = gpio_led_power_filter;
10150 }
10151 }
10152
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)10153 static void alc662_usi_automute_hook(struct hda_codec *codec,
10154 struct hda_jack_callback *jack)
10155 {
10156 struct alc_spec *spec = codec->spec;
10157 int vref;
10158 msleep(200);
10159 snd_hda_gen_hp_automute(codec, jack);
10160
10161 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10162 msleep(100);
10163 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10164 vref);
10165 }
10166
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)10167 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10168 const struct hda_fixup *fix, int action)
10169 {
10170 struct alc_spec *spec = codec->spec;
10171 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10172 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10173 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10174 }
10175 }
10176
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)10177 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10178 struct hda_jack_callback *cb)
10179 {
10180 /* surround speakers at 0x1b already get muted automatically when
10181 * headphones are plugged in, but we have to mute/unmute the remaining
10182 * channels manually:
10183 * 0x15 - front left/front right
10184 * 0x18 - front center/ LFE
10185 */
10186 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10187 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10188 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10189 } else {
10190 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10191 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10192 }
10193 }
10194
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)10195 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10196 const struct hda_fixup *fix, int action)
10197 {
10198 /* Pin 0x1b: shared headphones jack and surround speakers */
10199 if (!is_jack_detectable(codec, 0x1b))
10200 return;
10201
10202 switch (action) {
10203 case HDA_FIXUP_ACT_PRE_PROBE:
10204 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10205 alc662_aspire_ethos_mute_speakers);
10206 /* subwoofer needs an extra GPIO setting to become audible */
10207 alc_setup_gpio(codec, 0x02);
10208 break;
10209 case HDA_FIXUP_ACT_INIT:
10210 /* Make sure to start in a correct state, i.e. if
10211 * headphones have been plugged in before powering up the system
10212 */
10213 alc662_aspire_ethos_mute_speakers(codec, NULL);
10214 break;
10215 }
10216 }
10217
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)10218 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10219 const struct hda_fixup *fix, int action)
10220 {
10221 struct alc_spec *spec = codec->spec;
10222
10223 static const struct hda_pintbl pincfgs[] = {
10224 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10225 { 0x1b, 0x0181304f },
10226 { }
10227 };
10228
10229 switch (action) {
10230 case HDA_FIXUP_ACT_PRE_PROBE:
10231 spec->gen.mixer_nid = 0;
10232 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10233 snd_hda_apply_pincfgs(codec, pincfgs);
10234 break;
10235 case HDA_FIXUP_ACT_INIT:
10236 alc_write_coef_idx(codec, 0x19, 0xa054);
10237 break;
10238 }
10239 }
10240
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)10241 static void alc897_hp_automute_hook(struct hda_codec *codec,
10242 struct hda_jack_callback *jack)
10243 {
10244 struct alc_spec *spec = codec->spec;
10245 int vref;
10246
10247 snd_hda_gen_hp_automute(codec, jack);
10248 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10249 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10250 vref);
10251 }
10252
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)10253 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10254 const struct hda_fixup *fix, int action)
10255 {
10256 struct alc_spec *spec = codec->spec;
10257 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10258 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10259 }
10260 }
10261
10262 static const struct coef_fw alc668_coefs[] = {
10263 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10264 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10265 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10266 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10267 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10268 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10269 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10270 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10271 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10272 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10273 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10274 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10275 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10276 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10277 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10278 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10279 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10280 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10281 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10282 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10283 {}
10284 };
10285
alc668_restore_default_value(struct hda_codec * codec)10286 static void alc668_restore_default_value(struct hda_codec *codec)
10287 {
10288 alc_process_coef_fw(codec, alc668_coefs);
10289 }
10290
10291 enum {
10292 ALC662_FIXUP_ASPIRE,
10293 ALC662_FIXUP_LED_GPIO1,
10294 ALC662_FIXUP_IDEAPAD,
10295 ALC272_FIXUP_MARIO,
10296 ALC662_FIXUP_CZC_ET26,
10297 ALC662_FIXUP_CZC_P10T,
10298 ALC662_FIXUP_SKU_IGNORE,
10299 ALC662_FIXUP_HP_RP5800,
10300 ALC662_FIXUP_ASUS_MODE1,
10301 ALC662_FIXUP_ASUS_MODE2,
10302 ALC662_FIXUP_ASUS_MODE3,
10303 ALC662_FIXUP_ASUS_MODE4,
10304 ALC662_FIXUP_ASUS_MODE5,
10305 ALC662_FIXUP_ASUS_MODE6,
10306 ALC662_FIXUP_ASUS_MODE7,
10307 ALC662_FIXUP_ASUS_MODE8,
10308 ALC662_FIXUP_NO_JACK_DETECT,
10309 ALC662_FIXUP_ZOTAC_Z68,
10310 ALC662_FIXUP_INV_DMIC,
10311 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
10312 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
10313 ALC662_FIXUP_HEADSET_MODE,
10314 ALC668_FIXUP_HEADSET_MODE,
10315 ALC662_FIXUP_BASS_MODE4_CHMAP,
10316 ALC662_FIXUP_BASS_16,
10317 ALC662_FIXUP_BASS_1A,
10318 ALC662_FIXUP_BASS_CHMAP,
10319 ALC668_FIXUP_AUTO_MUTE,
10320 ALC668_FIXUP_DELL_DISABLE_AAMIX,
10321 ALC668_FIXUP_DELL_XPS13,
10322 ALC662_FIXUP_ASUS_Nx50,
10323 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
10324 ALC668_FIXUP_ASUS_Nx51,
10325 ALC668_FIXUP_MIC_COEF,
10326 ALC668_FIXUP_ASUS_G751,
10327 ALC891_FIXUP_HEADSET_MODE,
10328 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10329 ALC662_FIXUP_ACER_VERITON,
10330 ALC892_FIXUP_ASROCK_MOBO,
10331 ALC662_FIXUP_USI_FUNC,
10332 ALC662_FIXUP_USI_HEADSET_MODE,
10333 ALC662_FIXUP_LENOVO_MULTI_CODECS,
10334 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
10335 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
10336 ALC671_FIXUP_HP_HEADSET_MIC2,
10337 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
10338 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
10339 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10340 ALC668_FIXUP_HEADSET_MIC,
10341 ALC668_FIXUP_MIC_DET_COEF,
10342 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10343 ALC897_FIXUP_HEADSET_MIC_PIN,
10344 };
10345
10346 static const struct hda_fixup alc662_fixups[] = {
10347 [ALC662_FIXUP_ASPIRE] = {
10348 .type = HDA_FIXUP_PINS,
10349 .v.pins = (const struct hda_pintbl[]) {
10350 { 0x15, 0x99130112 }, /* subwoofer */
10351 { }
10352 }
10353 },
10354 [ALC662_FIXUP_LED_GPIO1] = {
10355 .type = HDA_FIXUP_FUNC,
10356 .v.func = alc662_fixup_led_gpio1,
10357 },
10358 [ALC662_FIXUP_IDEAPAD] = {
10359 .type = HDA_FIXUP_PINS,
10360 .v.pins = (const struct hda_pintbl[]) {
10361 { 0x17, 0x99130112 }, /* subwoofer */
10362 { }
10363 },
10364 .chained = true,
10365 .chain_id = ALC662_FIXUP_LED_GPIO1,
10366 },
10367 [ALC272_FIXUP_MARIO] = {
10368 .type = HDA_FIXUP_FUNC,
10369 .v.func = alc272_fixup_mario,
10370 },
10371 [ALC662_FIXUP_CZC_ET26] = {
10372 .type = HDA_FIXUP_PINS,
10373 .v.pins = (const struct hda_pintbl[]) {
10374 {0x12, 0x403cc000},
10375 {0x14, 0x90170110}, /* speaker */
10376 {0x15, 0x411111f0},
10377 {0x16, 0x411111f0},
10378 {0x18, 0x01a19030}, /* mic */
10379 {0x19, 0x90a7013f}, /* int-mic */
10380 {0x1a, 0x01014020},
10381 {0x1b, 0x0121401f},
10382 {0x1c, 0x411111f0},
10383 {0x1d, 0x411111f0},
10384 {0x1e, 0x40478e35},
10385 {}
10386 },
10387 .chained = true,
10388 .chain_id = ALC662_FIXUP_SKU_IGNORE
10389 },
10390 [ALC662_FIXUP_CZC_P10T] = {
10391 .type = HDA_FIXUP_VERBS,
10392 .v.verbs = (const struct hda_verb[]) {
10393 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10394 {}
10395 }
10396 },
10397 [ALC662_FIXUP_SKU_IGNORE] = {
10398 .type = HDA_FIXUP_FUNC,
10399 .v.func = alc_fixup_sku_ignore,
10400 },
10401 [ALC662_FIXUP_HP_RP5800] = {
10402 .type = HDA_FIXUP_PINS,
10403 .v.pins = (const struct hda_pintbl[]) {
10404 { 0x14, 0x0221201f }, /* HP out */
10405 { }
10406 },
10407 .chained = true,
10408 .chain_id = ALC662_FIXUP_SKU_IGNORE
10409 },
10410 [ALC662_FIXUP_ASUS_MODE1] = {
10411 .type = HDA_FIXUP_PINS,
10412 .v.pins = (const struct hda_pintbl[]) {
10413 { 0x14, 0x99130110 }, /* speaker */
10414 { 0x18, 0x01a19c20 }, /* mic */
10415 { 0x19, 0x99a3092f }, /* int-mic */
10416 { 0x21, 0x0121401f }, /* HP out */
10417 { }
10418 },
10419 .chained = true,
10420 .chain_id = ALC662_FIXUP_SKU_IGNORE
10421 },
10422 [ALC662_FIXUP_ASUS_MODE2] = {
10423 .type = HDA_FIXUP_PINS,
10424 .v.pins = (const struct hda_pintbl[]) {
10425 { 0x14, 0x99130110 }, /* speaker */
10426 { 0x18, 0x01a19820 }, /* mic */
10427 { 0x19, 0x99a3092f }, /* int-mic */
10428 { 0x1b, 0x0121401f }, /* HP out */
10429 { }
10430 },
10431 .chained = true,
10432 .chain_id = ALC662_FIXUP_SKU_IGNORE
10433 },
10434 [ALC662_FIXUP_ASUS_MODE3] = {
10435 .type = HDA_FIXUP_PINS,
10436 .v.pins = (const struct hda_pintbl[]) {
10437 { 0x14, 0x99130110 }, /* speaker */
10438 { 0x15, 0x0121441f }, /* HP */
10439 { 0x18, 0x01a19840 }, /* mic */
10440 { 0x19, 0x99a3094f }, /* int-mic */
10441 { 0x21, 0x01211420 }, /* HP2 */
10442 { }
10443 },
10444 .chained = true,
10445 .chain_id = ALC662_FIXUP_SKU_IGNORE
10446 },
10447 [ALC662_FIXUP_ASUS_MODE4] = {
10448 .type = HDA_FIXUP_PINS,
10449 .v.pins = (const struct hda_pintbl[]) {
10450 { 0x14, 0x99130110 }, /* speaker */
10451 { 0x16, 0x99130111 }, /* speaker */
10452 { 0x18, 0x01a19840 }, /* mic */
10453 { 0x19, 0x99a3094f }, /* int-mic */
10454 { 0x21, 0x0121441f }, /* HP */
10455 { }
10456 },
10457 .chained = true,
10458 .chain_id = ALC662_FIXUP_SKU_IGNORE
10459 },
10460 [ALC662_FIXUP_ASUS_MODE5] = {
10461 .type = HDA_FIXUP_PINS,
10462 .v.pins = (const struct hda_pintbl[]) {
10463 { 0x14, 0x99130110 }, /* speaker */
10464 { 0x15, 0x0121441f }, /* HP */
10465 { 0x16, 0x99130111 }, /* speaker */
10466 { 0x18, 0x01a19840 }, /* mic */
10467 { 0x19, 0x99a3094f }, /* int-mic */
10468 { }
10469 },
10470 .chained = true,
10471 .chain_id = ALC662_FIXUP_SKU_IGNORE
10472 },
10473 [ALC662_FIXUP_ASUS_MODE6] = {
10474 .type = HDA_FIXUP_PINS,
10475 .v.pins = (const struct hda_pintbl[]) {
10476 { 0x14, 0x99130110 }, /* speaker */
10477 { 0x15, 0x01211420 }, /* HP2 */
10478 { 0x18, 0x01a19840 }, /* mic */
10479 { 0x19, 0x99a3094f }, /* int-mic */
10480 { 0x1b, 0x0121441f }, /* HP */
10481 { }
10482 },
10483 .chained = true,
10484 .chain_id = ALC662_FIXUP_SKU_IGNORE
10485 },
10486 [ALC662_FIXUP_ASUS_MODE7] = {
10487 .type = HDA_FIXUP_PINS,
10488 .v.pins = (const struct hda_pintbl[]) {
10489 { 0x14, 0x99130110 }, /* speaker */
10490 { 0x17, 0x99130111 }, /* speaker */
10491 { 0x18, 0x01a19840 }, /* mic */
10492 { 0x19, 0x99a3094f }, /* int-mic */
10493 { 0x1b, 0x01214020 }, /* HP */
10494 { 0x21, 0x0121401f }, /* HP */
10495 { }
10496 },
10497 .chained = true,
10498 .chain_id = ALC662_FIXUP_SKU_IGNORE
10499 },
10500 [ALC662_FIXUP_ASUS_MODE8] = {
10501 .type = HDA_FIXUP_PINS,
10502 .v.pins = (const struct hda_pintbl[]) {
10503 { 0x14, 0x99130110 }, /* speaker */
10504 { 0x12, 0x99a30970 }, /* int-mic */
10505 { 0x15, 0x01214020 }, /* HP */
10506 { 0x17, 0x99130111 }, /* speaker */
10507 { 0x18, 0x01a19840 }, /* mic */
10508 { 0x21, 0x0121401f }, /* HP */
10509 { }
10510 },
10511 .chained = true,
10512 .chain_id = ALC662_FIXUP_SKU_IGNORE
10513 },
10514 [ALC662_FIXUP_NO_JACK_DETECT] = {
10515 .type = HDA_FIXUP_FUNC,
10516 .v.func = alc_fixup_no_jack_detect,
10517 },
10518 [ALC662_FIXUP_ZOTAC_Z68] = {
10519 .type = HDA_FIXUP_PINS,
10520 .v.pins = (const struct hda_pintbl[]) {
10521 { 0x1b, 0x02214020 }, /* Front HP */
10522 { }
10523 }
10524 },
10525 [ALC662_FIXUP_INV_DMIC] = {
10526 .type = HDA_FIXUP_FUNC,
10527 .v.func = alc_fixup_inv_dmic,
10528 },
10529 [ALC668_FIXUP_DELL_XPS13] = {
10530 .type = HDA_FIXUP_FUNC,
10531 .v.func = alc_fixup_dell_xps13,
10532 .chained = true,
10533 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10534 },
10535 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10536 .type = HDA_FIXUP_FUNC,
10537 .v.func = alc_fixup_disable_aamix,
10538 .chained = true,
10539 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10540 },
10541 [ALC668_FIXUP_AUTO_MUTE] = {
10542 .type = HDA_FIXUP_FUNC,
10543 .v.func = alc_fixup_auto_mute_via_amp,
10544 .chained = true,
10545 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10546 },
10547 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10548 .type = HDA_FIXUP_PINS,
10549 .v.pins = (const struct hda_pintbl[]) {
10550 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10551 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10552 { }
10553 },
10554 .chained = true,
10555 .chain_id = ALC662_FIXUP_HEADSET_MODE
10556 },
10557 [ALC662_FIXUP_HEADSET_MODE] = {
10558 .type = HDA_FIXUP_FUNC,
10559 .v.func = alc_fixup_headset_mode_alc662,
10560 },
10561 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10562 .type = HDA_FIXUP_PINS,
10563 .v.pins = (const struct hda_pintbl[]) {
10564 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10565 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10566 { }
10567 },
10568 .chained = true,
10569 .chain_id = ALC668_FIXUP_HEADSET_MODE
10570 },
10571 [ALC668_FIXUP_HEADSET_MODE] = {
10572 .type = HDA_FIXUP_FUNC,
10573 .v.func = alc_fixup_headset_mode_alc668,
10574 },
10575 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
10576 .type = HDA_FIXUP_FUNC,
10577 .v.func = alc_fixup_bass_chmap,
10578 .chained = true,
10579 .chain_id = ALC662_FIXUP_ASUS_MODE4
10580 },
10581 [ALC662_FIXUP_BASS_16] = {
10582 .type = HDA_FIXUP_PINS,
10583 .v.pins = (const struct hda_pintbl[]) {
10584 {0x16, 0x80106111}, /* bass speaker */
10585 {}
10586 },
10587 .chained = true,
10588 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10589 },
10590 [ALC662_FIXUP_BASS_1A] = {
10591 .type = HDA_FIXUP_PINS,
10592 .v.pins = (const struct hda_pintbl[]) {
10593 {0x1a, 0x80106111}, /* bass speaker */
10594 {}
10595 },
10596 .chained = true,
10597 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10598 },
10599 [ALC662_FIXUP_BASS_CHMAP] = {
10600 .type = HDA_FIXUP_FUNC,
10601 .v.func = alc_fixup_bass_chmap,
10602 },
10603 [ALC662_FIXUP_ASUS_Nx50] = {
10604 .type = HDA_FIXUP_FUNC,
10605 .v.func = alc_fixup_auto_mute_via_amp,
10606 .chained = true,
10607 .chain_id = ALC662_FIXUP_BASS_1A
10608 },
10609 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10610 .type = HDA_FIXUP_FUNC,
10611 .v.func = alc_fixup_headset_mode_alc668,
10612 .chain_id = ALC662_FIXUP_BASS_CHMAP
10613 },
10614 [ALC668_FIXUP_ASUS_Nx51] = {
10615 .type = HDA_FIXUP_PINS,
10616 .v.pins = (const struct hda_pintbl[]) {
10617 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10618 { 0x1a, 0x90170151 }, /* bass speaker */
10619 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10620 {}
10621 },
10622 .chained = true,
10623 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
10624 },
10625 [ALC668_FIXUP_MIC_COEF] = {
10626 .type = HDA_FIXUP_VERBS,
10627 .v.verbs = (const struct hda_verb[]) {
10628 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10629 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10630 {}
10631 },
10632 },
10633 [ALC668_FIXUP_ASUS_G751] = {
10634 .type = HDA_FIXUP_PINS,
10635 .v.pins = (const struct hda_pintbl[]) {
10636 { 0x16, 0x0421101f }, /* HP */
10637 {}
10638 },
10639 .chained = true,
10640 .chain_id = ALC668_FIXUP_MIC_COEF
10641 },
10642 [ALC891_FIXUP_HEADSET_MODE] = {
10643 .type = HDA_FIXUP_FUNC,
10644 .v.func = alc_fixup_headset_mode,
10645 },
10646 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10647 .type = HDA_FIXUP_PINS,
10648 .v.pins = (const struct hda_pintbl[]) {
10649 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10650 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10651 { }
10652 },
10653 .chained = true,
10654 .chain_id = ALC891_FIXUP_HEADSET_MODE
10655 },
10656 [ALC662_FIXUP_ACER_VERITON] = {
10657 .type = HDA_FIXUP_PINS,
10658 .v.pins = (const struct hda_pintbl[]) {
10659 { 0x15, 0x50170120 }, /* no internal speaker */
10660 { }
10661 }
10662 },
10663 [ALC892_FIXUP_ASROCK_MOBO] = {
10664 .type = HDA_FIXUP_PINS,
10665 .v.pins = (const struct hda_pintbl[]) {
10666 { 0x15, 0x40f000f0 }, /* disabled */
10667 { 0x16, 0x40f000f0 }, /* disabled */
10668 { }
10669 }
10670 },
10671 [ALC662_FIXUP_USI_FUNC] = {
10672 .type = HDA_FIXUP_FUNC,
10673 .v.func = alc662_fixup_usi_headset_mic,
10674 },
10675 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10676 .type = HDA_FIXUP_PINS,
10677 .v.pins = (const struct hda_pintbl[]) {
10678 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10679 { 0x18, 0x01a1903d },
10680 { }
10681 },
10682 .chained = true,
10683 .chain_id = ALC662_FIXUP_USI_FUNC
10684 },
10685 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10686 .type = HDA_FIXUP_FUNC,
10687 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10688 },
10689 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10690 .type = HDA_FIXUP_FUNC,
10691 .v.func = alc662_fixup_aspire_ethos_hp,
10692 },
10693 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10694 .type = HDA_FIXUP_PINS,
10695 .v.pins = (const struct hda_pintbl[]) {
10696 { 0x15, 0x92130110 }, /* front speakers */
10697 { 0x18, 0x99130111 }, /* center/subwoofer */
10698 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10699 { }
10700 },
10701 .chained = true,
10702 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
10703 },
10704 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10705 .type = HDA_FIXUP_FUNC,
10706 .v.func = alc671_fixup_hp_headset_mic2,
10707 },
10708 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10709 .type = HDA_FIXUP_PINS,
10710 .v.pins = (const struct hda_pintbl[]) {
10711 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10712 { }
10713 },
10714 .chained = true,
10715 .chain_id = ALC662_FIXUP_USI_FUNC
10716 },
10717 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10718 .type = HDA_FIXUP_PINS,
10719 .v.pins = (const struct hda_pintbl[]) {
10720 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10721 { 0x1b, 0x0221144f },
10722 { }
10723 },
10724 .chained = true,
10725 .chain_id = ALC662_FIXUP_USI_FUNC
10726 },
10727 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
10728 .type = HDA_FIXUP_PINS,
10729 .v.pins = (const struct hda_pintbl[]) {
10730 { 0x1b, 0x04a1112c },
10731 { }
10732 },
10733 .chained = true,
10734 .chain_id = ALC668_FIXUP_HEADSET_MIC
10735 },
10736 [ALC668_FIXUP_HEADSET_MIC] = {
10737 .type = HDA_FIXUP_FUNC,
10738 .v.func = alc269_fixup_headset_mic,
10739 .chained = true,
10740 .chain_id = ALC668_FIXUP_MIC_DET_COEF
10741 },
10742 [ALC668_FIXUP_MIC_DET_COEF] = {
10743 .type = HDA_FIXUP_VERBS,
10744 .v.verbs = (const struct hda_verb[]) {
10745 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
10746 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
10747 {}
10748 },
10749 },
10750 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
10751 .type = HDA_FIXUP_FUNC,
10752 .v.func = alc897_fixup_lenovo_headset_mic,
10753 },
10754 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
10755 .type = HDA_FIXUP_PINS,
10756 .v.pins = (const struct hda_pintbl[]) {
10757 { 0x1a, 0x03a11050 },
10758 { }
10759 },
10760 .chained = true,
10761 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
10762 },
10763 };
10764
10765 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
10766 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
10767 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
10768 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
10769 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
10770 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
10771 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
10772 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
10773 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
10774 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
10775 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
10776 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
10777 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10778 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10779 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
10780 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
10781 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
10782 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10783 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10784 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10785 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10786 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10787 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
10788 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
10789 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
10790 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
10791 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
10792 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
10793 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
10794 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
10795 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
10796 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10797 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
10798 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
10799 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
10800 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
10801 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
10802 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
10803 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
10804 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
10805 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
10806 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
10807 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
10808 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
10809 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
10810 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
10811 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
10812 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
10813 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
10814 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
10815 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
10816 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
10817 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
10818
10819 #if 0
10820 /* Below is a quirk table taken from the old code.
10821 * Basically the device should work as is without the fixup table.
10822 * If BIOS doesn't give a proper info, enable the corresponding
10823 * fixup entry.
10824 */
10825 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10826 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10827 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10828 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10829 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10830 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10831 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10832 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10833 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10834 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10835 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10836 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10837 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10838 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10839 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10840 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10841 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10842 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10843 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10844 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10845 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10846 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10847 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10848 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10849 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10850 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10851 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10852 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10853 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10854 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10855 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10856 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10857 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10858 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10859 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10860 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10861 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10862 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10863 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10864 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10865 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10866 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10867 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10868 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10869 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10870 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10871 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10872 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10873 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10874 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10875 #endif
10876 {}
10877 };
10878
10879 static const struct hda_model_fixup alc662_fixup_models[] = {
10880 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10881 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
10882 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
10883 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
10884 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10885 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10886 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10887 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10888 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10889 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10890 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10891 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
10892 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
10893 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
10894 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
10895 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10896 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10897 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10898 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10899 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10900 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10901 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10902 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10903 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
10904 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
10905 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10906 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10907 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10908 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10909 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
10910 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10911 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
10912 {}
10913 };
10914
10915 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
10916 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10917 {0x17, 0x02211010},
10918 {0x18, 0x01a19030},
10919 {0x1a, 0x01813040},
10920 {0x21, 0x01014020}),
10921 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10922 {0x16, 0x01813030},
10923 {0x17, 0x02211010},
10924 {0x18, 0x01a19040},
10925 {0x21, 0x01014020}),
10926 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
10927 {0x14, 0x01014010},
10928 {0x18, 0x01a19020},
10929 {0x1a, 0x0181302f},
10930 {0x1b, 0x0221401f}),
10931 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10932 {0x12, 0x99a30130},
10933 {0x14, 0x90170110},
10934 {0x15, 0x0321101f},
10935 {0x16, 0x03011020}),
10936 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10937 {0x12, 0x99a30140},
10938 {0x14, 0x90170110},
10939 {0x15, 0x0321101f},
10940 {0x16, 0x03011020}),
10941 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10942 {0x12, 0x99a30150},
10943 {0x14, 0x90170110},
10944 {0x15, 0x0321101f},
10945 {0x16, 0x03011020}),
10946 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10947 {0x14, 0x90170110},
10948 {0x15, 0x0321101f},
10949 {0x16, 0x03011020}),
10950 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10951 {0x12, 0x90a60130},
10952 {0x14, 0x90170110},
10953 {0x15, 0x0321101f}),
10954 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10955 {0x14, 0x01014010},
10956 {0x17, 0x90170150},
10957 {0x19, 0x02a11060},
10958 {0x1b, 0x01813030},
10959 {0x21, 0x02211020}),
10960 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10961 {0x14, 0x01014010},
10962 {0x18, 0x01a19040},
10963 {0x1b, 0x01813030},
10964 {0x21, 0x02211020}),
10965 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10966 {0x14, 0x01014020},
10967 {0x17, 0x90170110},
10968 {0x18, 0x01a19050},
10969 {0x1b, 0x01813040},
10970 {0x21, 0x02211030}),
10971 {}
10972 };
10973
10974 /*
10975 */
patch_alc662(struct hda_codec * codec)10976 static int patch_alc662(struct hda_codec *codec)
10977 {
10978 struct alc_spec *spec;
10979 int err;
10980
10981 err = alc_alloc_spec(codec, 0x0b);
10982 if (err < 0)
10983 return err;
10984
10985 spec = codec->spec;
10986
10987 spec->shutup = alc_eapd_shutup;
10988
10989 /* handle multiple HPs as is */
10990 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10991
10992 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10993
10994 switch (codec->core.vendor_id) {
10995 case 0x10ec0668:
10996 spec->init_hook = alc668_restore_default_value;
10997 break;
10998 }
10999
11000 alc_pre_init(codec);
11001
11002 snd_hda_pick_fixup(codec, alc662_fixup_models,
11003 alc662_fixup_tbl, alc662_fixups);
11004 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
11005 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11006
11007 alc_auto_parse_customize_define(codec);
11008
11009 if (has_cdefine_beep(codec))
11010 spec->gen.beep_nid = 0x01;
11011
11012 if ((alc_get_coef0(codec) & (1 << 14)) &&
11013 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
11014 spec->cdefine.platform_type == 1) {
11015 err = alc_codec_rename(codec, "ALC272X");
11016 if (err < 0)
11017 goto error;
11018 }
11019
11020 /* automatic parse from the BIOS config */
11021 err = alc662_parse_auto_config(codec);
11022 if (err < 0)
11023 goto error;
11024
11025 if (!spec->gen.no_analog && spec->gen.beep_nid) {
11026 switch (codec->core.vendor_id) {
11027 case 0x10ec0662:
11028 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11029 break;
11030 case 0x10ec0272:
11031 case 0x10ec0663:
11032 case 0x10ec0665:
11033 case 0x10ec0668:
11034 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
11035 break;
11036 case 0x10ec0273:
11037 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
11038 break;
11039 }
11040 if (err < 0)
11041 goto error;
11042 }
11043
11044 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11045
11046 return 0;
11047
11048 error:
11049 alc_free(codec);
11050 return err;
11051 }
11052
11053 /*
11054 * ALC680 support
11055 */
11056
alc680_parse_auto_config(struct hda_codec * codec)11057 static int alc680_parse_auto_config(struct hda_codec *codec)
11058 {
11059 return alc_parse_auto_config(codec, NULL, NULL);
11060 }
11061
11062 /*
11063 */
patch_alc680(struct hda_codec * codec)11064 static int patch_alc680(struct hda_codec *codec)
11065 {
11066 int err;
11067
11068 /* ALC680 has no aa-loopback mixer */
11069 err = alc_alloc_spec(codec, 0);
11070 if (err < 0)
11071 return err;
11072
11073 /* automatic parse from the BIOS config */
11074 err = alc680_parse_auto_config(codec);
11075 if (err < 0) {
11076 alc_free(codec);
11077 return err;
11078 }
11079
11080 return 0;
11081 }
11082
11083 /*
11084 * patch entries
11085 */
11086 static const struct hda_device_id snd_hda_id_realtek[] = {
11087 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
11088 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
11089 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
11090 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
11091 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
11092 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11093 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
11094 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
11095 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
11096 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
11097 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
11098 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11099 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
11100 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
11101 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11102 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11103 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11104 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11105 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11106 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11107 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
11108 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
11109 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11110 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11111 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11112 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11113 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11114 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
11115 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
11116 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
11117 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
11118 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
11119 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
11120 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11121 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11122 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
11123 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
11124 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
11125 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
11126 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
11127 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
11128 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
11129 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11130 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11131 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11132 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11133 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11134 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11135 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11136 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11137 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11138 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11139 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11140 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11141 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11142 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
11143 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11144 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11145 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
11146 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
11147 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
11148 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11149 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11150 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11151 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11152 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11153 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11154 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11155 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11156 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11157 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11158 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
11159 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
11160 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11161 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
11162 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
11163 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
11164 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
11165 {} /* terminator */
11166 };
11167 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
11168
11169 MODULE_LICENSE("GPL");
11170 MODULE_DESCRIPTION("Realtek HD-audio codec");
11171
11172 static struct hda_codec_driver realtek_driver = {
11173 .id = snd_hda_id_realtek,
11174 };
11175
11176 module_hda_codec_driver(realtek_driver);
11177