Revert "ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO"
[linux/fpc-iii.git] / sound / pci / hda / patch_realtek.c
blob9c5b3d19bfa734107b6b8ca2234b468766da672d
1 /*
2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for Realtek ALC codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@just42.net>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <linux/dmi.h>
31 #include <linux/module.h>
32 #include <linux/input.h>
33 #include <sound/core.h>
34 #include <sound/jack.h>
35 #include "hda_codec.h"
36 #include "hda_local.h"
37 #include "hda_auto_parser.h"
38 #include "hda_jack.h"
39 #include "hda_generic.h"
41 /* keep halting ALC5505 DSP, for power saving */
42 #define HALT_REALTEK_ALC5505
44 /* extra amp-initialization sequence types */
45 enum {
46 ALC_INIT_UNDEFINED,
47 ALC_INIT_NONE,
48 ALC_INIT_DEFAULT,
51 enum {
52 ALC_HEADSET_MODE_UNKNOWN,
53 ALC_HEADSET_MODE_UNPLUGGED,
54 ALC_HEADSET_MODE_HEADSET,
55 ALC_HEADSET_MODE_MIC,
56 ALC_HEADSET_MODE_HEADPHONE,
59 enum {
60 ALC_HEADSET_TYPE_UNKNOWN,
61 ALC_HEADSET_TYPE_CTIA,
62 ALC_HEADSET_TYPE_OMTP,
65 enum {
66 ALC_KEY_MICMUTE_INDEX,
69 struct alc_customize_define {
70 unsigned int sku_cfg;
71 unsigned char port_connectivity;
72 unsigned char check_sum;
73 unsigned char customization;
74 unsigned char external_amp;
75 unsigned int enable_pcbeep:1;
76 unsigned int platform_type:1;
77 unsigned int swap:1;
78 unsigned int override:1;
79 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
82 struct alc_spec {
83 struct hda_gen_spec gen; /* must be at head */
85 /* codec parameterization */
86 struct alc_customize_define cdefine;
87 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
89 /* GPIO bits */
90 unsigned int gpio_mask;
91 unsigned int gpio_dir;
92 unsigned int gpio_data;
93 bool gpio_write_delay; /* add a delay before writing gpio_data */
95 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
96 int mute_led_polarity;
97 int micmute_led_polarity;
98 hda_nid_t mute_led_nid;
99 hda_nid_t cap_mute_led_nid;
101 unsigned int gpio_mute_led_mask;
102 unsigned int gpio_mic_led_mask;
104 hda_nid_t headset_mic_pin;
105 hda_nid_t headphone_mic_pin;
106 int current_headset_mode;
107 int current_headset_type;
109 /* hooks */
110 void (*init_hook)(struct hda_codec *codec);
111 #ifdef CONFIG_PM
112 void (*power_hook)(struct hda_codec *codec);
113 #endif
114 void (*shutup)(struct hda_codec *codec);
115 void (*reboot_notify)(struct hda_codec *codec);
117 int init_amp;
118 int codec_variant; /* flag for other variants */
119 unsigned int has_alc5505_dsp:1;
120 unsigned int no_depop_delay:1;
121 unsigned int done_hp_init:1;
122 unsigned int no_shutup_pins:1;
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];
133 * COEF access helper functions
136 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
137 unsigned int coef_idx)
139 unsigned int val;
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;
146 #define alc_read_coef_idx(codec, coef_idx) \
147 alc_read_coefex_idx(codec, 0x20, coef_idx)
149 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
150 unsigned int coef_idx, unsigned int coef_val)
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);
156 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
157 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
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)
163 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
165 if (val != -1)
166 alc_write_coefex_idx(codec, nid, coef_idx,
167 (val & ~mask) | bits_set);
170 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
171 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
173 /* a special bypass for COEF 0; read the cached value at the second time */
174 static unsigned int alc_get_coef0(struct hda_codec *codec)
176 struct alc_spec *spec = codec->spec;
178 if (!spec->coef0)
179 spec->coef0 = alc_read_coef_idx(codec, 0);
180 return spec->coef0;
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;
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)
197 static void alc_process_coef_fw(struct hda_codec *codec,
198 const struct coef_fw *fw)
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);
210 * GPIO setup tables, used in initialization
213 /* Enable GPIO mask and set output */
214 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
216 struct alc_spec *spec = codec->spec;
218 spec->gpio_mask |= mask;
219 spec->gpio_dir |= mask;
220 spec->gpio_data |= mask;
223 static void alc_write_gpio_data(struct hda_codec *codec)
225 struct alc_spec *spec = codec->spec;
227 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
228 spec->gpio_data);
231 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
232 bool on)
234 struct alc_spec *spec = codec->spec;
235 unsigned int oldval = spec->gpio_data;
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);
245 static void alc_write_gpio(struct hda_codec *codec)
247 struct alc_spec *spec = codec->spec;
249 if (!spec->gpio_mask)
250 return;
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);
261 static void alc_fixup_gpio(struct hda_codec *codec, int action,
262 unsigned int mask)
264 if (action == HDA_FIXUP_ACT_PRE_PROBE)
265 alc_setup_gpio(codec, mask);
268 static void alc_fixup_gpio1(struct hda_codec *codec,
269 const struct hda_fixup *fix, int action)
271 alc_fixup_gpio(codec, action, 0x01);
274 static void alc_fixup_gpio2(struct hda_codec *codec,
275 const struct hda_fixup *fix, int action)
277 alc_fixup_gpio(codec, action, 0x02);
280 static void alc_fixup_gpio3(struct hda_codec *codec,
281 const struct hda_fixup *fix, int action)
283 alc_fixup_gpio(codec, action, 0x03);
286 static void alc_fixup_gpio4(struct hda_codec *codec,
287 const struct hda_fixup *fix, int action)
289 alc_fixup_gpio(codec, action, 0x04);
293 * Fix hardware PLL issue
294 * On some codecs, the analog PLL gating control must be off while
295 * the default value is 1.
297 static void alc_fix_pll(struct hda_codec *codec)
299 struct alc_spec *spec = codec->spec;
301 if (spec->pll_nid)
302 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
303 1 << spec->pll_coef_bit, 0);
306 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
307 unsigned int coef_idx, unsigned int coef_bit)
309 struct alc_spec *spec = codec->spec;
310 spec->pll_nid = nid;
311 spec->pll_coef_idx = coef_idx;
312 spec->pll_coef_bit = coef_bit;
313 alc_fix_pll(codec);
316 /* update the master volume per volume-knob's unsol event */
317 static void alc_update_knob_master(struct hda_codec *codec,
318 struct hda_jack_callback *jack)
320 unsigned int val;
321 struct snd_kcontrol *kctl;
322 struct snd_ctl_elem_value *uctl;
324 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
325 if (!kctl)
326 return;
327 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
328 if (!uctl)
329 return;
330 val = snd_hda_codec_read(codec, jack->nid, 0,
331 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
332 val &= HDA_AMP_VOLMASK;
333 uctl->value.integer.value[0] = val;
334 uctl->value.integer.value[1] = val;
335 kctl->put(kctl, uctl);
336 kfree(uctl);
339 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
341 /* For some reason, the res given from ALC880 is broken.
342 Here we adjust it properly. */
343 snd_hda_jack_unsol_event(codec, res >> 2);
346 /* Change EAPD to verb control */
347 static void alc_fill_eapd_coef(struct hda_codec *codec)
349 int coef;
351 coef = alc_get_coef0(codec);
353 switch (codec->core.vendor_id) {
354 case 0x10ec0262:
355 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
356 break;
357 case 0x10ec0267:
358 case 0x10ec0268:
359 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
360 break;
361 case 0x10ec0269:
362 if ((coef & 0x00f0) == 0x0010)
363 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
364 if ((coef & 0x00f0) == 0x0020)
365 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
366 if ((coef & 0x00f0) == 0x0030)
367 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
368 break;
369 case 0x10ec0280:
370 case 0x10ec0284:
371 case 0x10ec0290:
372 case 0x10ec0292:
373 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
374 break;
375 case 0x10ec0225:
376 case 0x10ec0295:
377 case 0x10ec0299:
378 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
379 /* fallthrough */
380 case 0x10ec0215:
381 case 0x10ec0233:
382 case 0x10ec0235:
383 case 0x10ec0236:
384 case 0x10ec0245:
385 case 0x10ec0255:
386 case 0x10ec0256:
387 case 0x10ec0257:
388 case 0x10ec0282:
389 case 0x10ec0283:
390 case 0x10ec0286:
391 case 0x10ec0287:
392 case 0x10ec0288:
393 case 0x10ec0285:
394 case 0x10ec0298:
395 case 0x10ec0289:
396 case 0x10ec0300:
397 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
398 break;
399 case 0x10ec0275:
400 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
401 break;
402 case 0x10ec0293:
403 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
404 break;
405 case 0x10ec0234:
406 case 0x10ec0274:
407 case 0x10ec0294:
408 case 0x10ec0700:
409 case 0x10ec0701:
410 case 0x10ec0703:
411 case 0x10ec0711:
412 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
413 break;
414 case 0x10ec0662:
415 if ((coef & 0x00f0) == 0x0030)
416 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
417 break;
418 case 0x10ec0272:
419 case 0x10ec0273:
420 case 0x10ec0663:
421 case 0x10ec0665:
422 case 0x10ec0670:
423 case 0x10ec0671:
424 case 0x10ec0672:
425 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
426 break;
427 case 0x10ec0222:
428 case 0x10ec0623:
429 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
430 break;
431 case 0x10ec0668:
432 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
433 break;
434 case 0x10ec0867:
435 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
436 break;
437 case 0x10ec0888:
438 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
439 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
440 break;
441 case 0x10ec0892:
442 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
443 break;
444 case 0x10ec0899:
445 case 0x10ec0900:
446 case 0x10ec0b00:
447 case 0x10ec1168:
448 case 0x10ec1220:
449 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
450 break;
454 /* additional initialization for ALC888 variants */
455 static void alc888_coef_init(struct hda_codec *codec)
457 switch (alc_get_coef0(codec) & 0x00f0) {
458 /* alc888-VA */
459 case 0x00:
460 /* alc888-VB */
461 case 0x10:
462 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
463 break;
467 /* turn on/off EAPD control (only if available) */
468 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
470 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
471 return;
472 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
473 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
474 on ? 2 : 0);
477 /* turn on/off EAPD controls of the codec */
478 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
480 /* We currently only handle front, HP */
481 static hda_nid_t pins[] = {
482 0x0f, 0x10, 0x14, 0x15, 0x17, 0
484 hda_nid_t *p;
485 for (p = pins; *p; p++)
486 set_eapd(codec, *p, on);
489 static int find_ext_mic_pin(struct hda_codec *codec);
491 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
493 const struct hda_pincfg *pin;
494 int mic_pin = find_ext_mic_pin(codec);
495 int i;
497 /* don't shut up pins when unloading the driver; otherwise it breaks
498 * the default pin setup at the next load of the driver
500 if (codec->bus->shutdown)
501 return;
503 snd_array_for_each(&codec->init_pins, i, pin) {
504 /* use read here for syncing after issuing each verb */
505 if (pin->nid != mic_pin)
506 snd_hda_codec_read(codec, pin->nid, 0,
507 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
510 codec->pins_shutup = 1;
513 static void alc_shutup_pins(struct hda_codec *codec)
515 struct alc_spec *spec = codec->spec;
517 switch (codec->core.vendor_id) {
518 case 0x10ec0283:
519 case 0x10ec0286:
520 case 0x10ec0288:
521 case 0x10ec0298:
522 alc_headset_mic_no_shutup(codec);
523 break;
524 default:
525 if (!spec->no_shutup_pins)
526 snd_hda_shutup_pins(codec);
527 break;
531 /* generic shutup callback;
532 * just turning off EAPD and a little pause for avoiding pop-noise
534 static void alc_eapd_shutup(struct hda_codec *codec)
536 struct alc_spec *spec = codec->spec;
538 alc_auto_setup_eapd(codec, false);
539 if (!spec->no_depop_delay)
540 msleep(200);
541 alc_shutup_pins(codec);
544 /* generic EAPD initialization */
545 static void alc_auto_init_amp(struct hda_codec *codec, int type)
547 alc_fill_eapd_coef(codec);
548 alc_auto_setup_eapd(codec, true);
549 alc_write_gpio(codec);
550 switch (type) {
551 case ALC_INIT_DEFAULT:
552 switch (codec->core.vendor_id) {
553 case 0x10ec0260:
554 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
555 break;
556 case 0x10ec0880:
557 case 0x10ec0882:
558 case 0x10ec0883:
559 case 0x10ec0885:
560 alc_update_coef_idx(codec, 7, 0, 0x2030);
561 break;
562 case 0x10ec0888:
563 alc888_coef_init(codec);
564 break;
566 break;
570 /* get a primary headphone pin if available */
571 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
573 if (spec->gen.autocfg.hp_pins[0])
574 return spec->gen.autocfg.hp_pins[0];
575 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
576 return spec->gen.autocfg.line_out_pins[0];
577 return 0;
581 * Realtek SSID verification
584 /* Could be any non-zero and even value. When used as fixup, tells
585 * the driver to ignore any present sku defines.
587 #define ALC_FIXUP_SKU_IGNORE (2)
589 static void alc_fixup_sku_ignore(struct hda_codec *codec,
590 const struct hda_fixup *fix, int action)
592 struct alc_spec *spec = codec->spec;
593 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
594 spec->cdefine.fixup = 1;
595 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
599 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
600 const struct hda_fixup *fix, int action)
602 struct alc_spec *spec = codec->spec;
604 if (action == HDA_FIXUP_ACT_PROBE) {
605 spec->no_depop_delay = 1;
606 codec->depop_delay = 0;
610 static int alc_auto_parse_customize_define(struct hda_codec *codec)
612 unsigned int ass, tmp, i;
613 unsigned nid = 0;
614 struct alc_spec *spec = codec->spec;
616 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
618 if (spec->cdefine.fixup) {
619 ass = spec->cdefine.sku_cfg;
620 if (ass == ALC_FIXUP_SKU_IGNORE)
621 return -1;
622 goto do_sku;
625 if (!codec->bus->pci)
626 return -1;
627 ass = codec->core.subsystem_id & 0xffff;
628 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
629 goto do_sku;
631 nid = 0x1d;
632 if (codec->core.vendor_id == 0x10ec0260)
633 nid = 0x17;
634 ass = snd_hda_codec_get_pincfg(codec, nid);
636 if (!(ass & 1)) {
637 codec_info(codec, "%s: SKU not ready 0x%08x\n",
638 codec->core.chip_name, ass);
639 return -1;
642 /* check sum */
643 tmp = 0;
644 for (i = 1; i < 16; i++) {
645 if ((ass >> i) & 1)
646 tmp++;
648 if (((ass >> 16) & 0xf) != tmp)
649 return -1;
651 spec->cdefine.port_connectivity = ass >> 30;
652 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
653 spec->cdefine.check_sum = (ass >> 16) & 0xf;
654 spec->cdefine.customization = ass >> 8;
655 do_sku:
656 spec->cdefine.sku_cfg = ass;
657 spec->cdefine.external_amp = (ass & 0x38) >> 3;
658 spec->cdefine.platform_type = (ass & 0x4) >> 2;
659 spec->cdefine.swap = (ass & 0x2) >> 1;
660 spec->cdefine.override = ass & 0x1;
662 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
663 nid, spec->cdefine.sku_cfg);
664 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
665 spec->cdefine.port_connectivity);
666 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
667 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
668 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
669 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
670 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
671 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
672 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
674 return 0;
677 /* return the position of NID in the list, or -1 if not found */
678 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
680 int i;
681 for (i = 0; i < nums; i++)
682 if (list[i] == nid)
683 return i;
684 return -1;
686 /* return true if the given NID is found in the list */
687 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
689 return find_idx_in_nid_list(nid, list, nums) >= 0;
692 /* check subsystem ID and set up device-specific initialization;
693 * return 1 if initialized, 0 if invalid SSID
695 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
696 * 31 ~ 16 : Manufacture ID
697 * 15 ~ 8 : SKU ID
698 * 7 ~ 0 : Assembly ID
699 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
701 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
703 unsigned int ass, tmp, i;
704 unsigned nid;
705 struct alc_spec *spec = codec->spec;
707 if (spec->cdefine.fixup) {
708 ass = spec->cdefine.sku_cfg;
709 if (ass == ALC_FIXUP_SKU_IGNORE)
710 return 0;
711 goto do_sku;
714 ass = codec->core.subsystem_id & 0xffff;
715 if (codec->bus->pci &&
716 ass != codec->bus->pci->subsystem_device && (ass & 1))
717 goto do_sku;
719 /* invalid SSID, check the special NID pin defcfg instead */
721 * 31~30 : port connectivity
722 * 29~21 : reserve
723 * 20 : PCBEEP input
724 * 19~16 : Check sum (15:1)
725 * 15~1 : Custom
726 * 0 : override
728 nid = 0x1d;
729 if (codec->core.vendor_id == 0x10ec0260)
730 nid = 0x17;
731 ass = snd_hda_codec_get_pincfg(codec, nid);
732 codec_dbg(codec,
733 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
734 ass, nid);
735 if (!(ass & 1))
736 return 0;
737 if ((ass >> 30) != 1) /* no physical connection */
738 return 0;
740 /* check sum */
741 tmp = 0;
742 for (i = 1; i < 16; i++) {
743 if ((ass >> i) & 1)
744 tmp++;
746 if (((ass >> 16) & 0xf) != tmp)
747 return 0;
748 do_sku:
749 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
750 ass & 0xffff, codec->core.vendor_id);
752 * 0 : override
753 * 1 : Swap Jack
754 * 2 : 0 --> Desktop, 1 --> Laptop
755 * 3~5 : External Amplifier control
756 * 7~6 : Reserved
758 tmp = (ass & 0x38) >> 3; /* external Amp control */
759 if (spec->init_amp == ALC_INIT_UNDEFINED) {
760 switch (tmp) {
761 case 1:
762 alc_setup_gpio(codec, 0x01);
763 break;
764 case 3:
765 alc_setup_gpio(codec, 0x02);
766 break;
767 case 7:
768 alc_setup_gpio(codec, 0x03);
769 break;
770 case 5:
771 default:
772 spec->init_amp = ALC_INIT_DEFAULT;
773 break;
777 /* is laptop or Desktop and enable the function "Mute internal speaker
778 * when the external headphone out jack is plugged"
780 if (!(ass & 0x8000))
781 return 1;
783 * 10~8 : Jack location
784 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
785 * 14~13: Resvered
786 * 15 : 1 --> enable the function "Mute internal speaker
787 * when the external headphone out jack is plugged"
789 if (!alc_get_hp_pin(spec)) {
790 hda_nid_t nid;
791 tmp = (ass >> 11) & 0x3; /* HP to chassis */
792 nid = ports[tmp];
793 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
794 spec->gen.autocfg.line_outs))
795 return 1;
796 spec->gen.autocfg.hp_pins[0] = nid;
798 return 1;
801 /* Check the validity of ALC subsystem-id
802 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
803 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
805 if (!alc_subsystem_id(codec, ports)) {
806 struct alc_spec *spec = codec->spec;
807 if (spec->init_amp == ALC_INIT_UNDEFINED) {
808 codec_dbg(codec,
809 "realtek: Enable default setup for auto mode as fallback\n");
810 spec->init_amp = ALC_INIT_DEFAULT;
818 static void alc_fixup_inv_dmic(struct hda_codec *codec,
819 const struct hda_fixup *fix, int action)
821 struct alc_spec *spec = codec->spec;
823 spec->gen.inv_dmic_split = 1;
827 static int alc_build_controls(struct hda_codec *codec)
829 int err;
831 err = snd_hda_gen_build_controls(codec);
832 if (err < 0)
833 return err;
835 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
836 return 0;
841 * Common callbacks
844 static int alc_init(struct hda_codec *codec)
846 struct alc_spec *spec = codec->spec;
848 if (spec->init_hook)
849 spec->init_hook(codec);
851 spec->gen.skip_verbs = 1; /* applied in below */
852 snd_hda_gen_init(codec);
853 alc_fix_pll(codec);
854 alc_auto_init_amp(codec, spec->init_amp);
855 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
857 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
859 return 0;
862 static inline void alc_shutup(struct hda_codec *codec)
864 struct alc_spec *spec = codec->spec;
866 if (!snd_hda_get_bool_hint(codec, "shutup"))
867 return; /* disabled explicitly by hints */
869 if (spec && spec->shutup)
870 spec->shutup(codec);
871 else
872 alc_shutup_pins(codec);
875 static void alc_reboot_notify(struct hda_codec *codec)
877 struct alc_spec *spec = codec->spec;
879 if (spec && spec->reboot_notify)
880 spec->reboot_notify(codec);
881 else
882 alc_shutup(codec);
885 #define alc_free snd_hda_gen_free
887 #ifdef CONFIG_PM
888 static void alc_power_eapd(struct hda_codec *codec)
890 alc_auto_setup_eapd(codec, false);
893 static int alc_suspend(struct hda_codec *codec)
895 struct alc_spec *spec = codec->spec;
896 alc_shutup(codec);
897 if (spec && spec->power_hook)
898 spec->power_hook(codec);
899 return 0;
901 #endif
903 #ifdef CONFIG_PM
904 static int alc_resume(struct hda_codec *codec)
906 struct alc_spec *spec = codec->spec;
908 if (!spec->no_depop_delay)
909 msleep(150); /* to avoid pop noise */
910 codec->patch_ops.init(codec);
911 regcache_sync(codec->core.regmap);
912 hda_call_check_power_status(codec, 0x01);
913 return 0;
915 #endif
919 static const struct hda_codec_ops alc_patch_ops = {
920 .build_controls = alc_build_controls,
921 .build_pcms = snd_hda_gen_build_pcms,
922 .init = alc_init,
923 .free = alc_free,
924 .unsol_event = snd_hda_jack_unsol_event,
925 #ifdef CONFIG_PM
926 .resume = alc_resume,
927 .suspend = alc_suspend,
928 .check_power_status = snd_hda_gen_check_power_status,
929 #endif
930 .reboot_notify = alc_reboot_notify,
934 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
937 * Rename codecs appropriately from COEF value or subvendor id
939 struct alc_codec_rename_table {
940 unsigned int vendor_id;
941 unsigned short coef_mask;
942 unsigned short coef_bits;
943 const char *name;
946 struct alc_codec_rename_pci_table {
947 unsigned int codec_vendor_id;
948 unsigned short pci_subvendor;
949 unsigned short pci_subdevice;
950 const char *name;
953 static struct alc_codec_rename_table rename_tbl[] = {
954 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
955 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
956 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
957 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
958 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
959 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
960 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
961 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
962 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
963 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
964 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
965 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
966 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
967 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
968 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
969 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
970 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
971 { } /* terminator */
974 static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
975 { 0x10ec0280, 0x1028, 0, "ALC3220" },
976 { 0x10ec0282, 0x1028, 0, "ALC3221" },
977 { 0x10ec0283, 0x1028, 0, "ALC3223" },
978 { 0x10ec0288, 0x1028, 0, "ALC3263" },
979 { 0x10ec0292, 0x1028, 0, "ALC3226" },
980 { 0x10ec0293, 0x1028, 0, "ALC3235" },
981 { 0x10ec0255, 0x1028, 0, "ALC3234" },
982 { 0x10ec0668, 0x1028, 0, "ALC3661" },
983 { 0x10ec0275, 0x1028, 0, "ALC3260" },
984 { 0x10ec0899, 0x1028, 0, "ALC3861" },
985 { 0x10ec0298, 0x1028, 0, "ALC3266" },
986 { 0x10ec0236, 0x1028, 0, "ALC3204" },
987 { 0x10ec0256, 0x1028, 0, "ALC3246" },
988 { 0x10ec0225, 0x1028, 0, "ALC3253" },
989 { 0x10ec0295, 0x1028, 0, "ALC3254" },
990 { 0x10ec0299, 0x1028, 0, "ALC3271" },
991 { 0x10ec0670, 0x1025, 0, "ALC669X" },
992 { 0x10ec0676, 0x1025, 0, "ALC679X" },
993 { 0x10ec0282, 0x1043, 0, "ALC3229" },
994 { 0x10ec0233, 0x1043, 0, "ALC3236" },
995 { 0x10ec0280, 0x103c, 0, "ALC3228" },
996 { 0x10ec0282, 0x103c, 0, "ALC3227" },
997 { 0x10ec0286, 0x103c, 0, "ALC3242" },
998 { 0x10ec0290, 0x103c, 0, "ALC3241" },
999 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1000 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1001 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1002 { } /* terminator */
1005 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1007 const struct alc_codec_rename_table *p;
1008 const struct alc_codec_rename_pci_table *q;
1010 for (p = rename_tbl; p->vendor_id; p++) {
1011 if (p->vendor_id != codec->core.vendor_id)
1012 continue;
1013 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1014 return alc_codec_rename(codec, p->name);
1017 if (!codec->bus->pci)
1018 return 0;
1019 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1020 if (q->codec_vendor_id != codec->core.vendor_id)
1021 continue;
1022 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1023 continue;
1024 if (!q->pci_subdevice ||
1025 q->pci_subdevice == codec->bus->pci->subsystem_device)
1026 return alc_codec_rename(codec, q->name);
1029 return 0;
1034 * Digital-beep handlers
1036 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1038 /* additional beep mixers; private_value will be overwritten */
1039 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1040 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1041 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1044 /* set up and create beep controls */
1045 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1046 int idx, int dir)
1048 struct snd_kcontrol_new *knew;
1049 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1050 int i;
1052 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1053 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1054 &alc_beep_mixer[i]);
1055 if (!knew)
1056 return -ENOMEM;
1057 knew->private_value = beep_amp;
1059 return 0;
1062 static const struct snd_pci_quirk beep_white_list[] = {
1063 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1064 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1065 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1066 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1067 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1068 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1069 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1070 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1071 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1072 /* blacklist -- no beep available */
1073 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1074 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1078 static inline int has_cdefine_beep(struct hda_codec *codec)
1080 struct alc_spec *spec = codec->spec;
1081 const struct snd_pci_quirk *q;
1082 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
1083 if (q)
1084 return q->value;
1085 return spec->cdefine.enable_pcbeep;
1087 #else
1088 #define set_beep_amp(spec, nid, idx, dir) 0
1089 #define has_cdefine_beep(codec) 0
1090 #endif
1092 /* parse the BIOS configuration and set up the alc_spec */
1093 /* return 1 if successful, 0 if the proper config is not found,
1094 * or a negative error code
1096 static int alc_parse_auto_config(struct hda_codec *codec,
1097 const hda_nid_t *ignore_nids,
1098 const hda_nid_t *ssid_nids)
1100 struct alc_spec *spec = codec->spec;
1101 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1102 int err;
1104 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1105 spec->parse_flags);
1106 if (err < 0)
1107 return err;
1109 if (ssid_nids)
1110 alc_ssid_check(codec, ssid_nids);
1112 err = snd_hda_gen_parse_auto_config(codec, cfg);
1113 if (err < 0)
1114 return err;
1116 return 1;
1119 /* common preparation job for alc_spec */
1120 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1122 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1123 int err;
1125 if (!spec)
1126 return -ENOMEM;
1127 codec->spec = spec;
1128 snd_hda_gen_spec_init(&spec->gen);
1129 spec->gen.mixer_nid = mixer_nid;
1130 spec->gen.own_eapd_ctl = 1;
1131 codec->single_adc_amp = 1;
1132 /* FIXME: do we need this for all Realtek codec models? */
1133 codec->spdif_status_reset = 1;
1134 codec->patch_ops = alc_patch_ops;
1136 err = alc_codec_rename_from_preset(codec);
1137 if (err < 0) {
1138 kfree(spec);
1139 return err;
1141 return 0;
1144 static int alc880_parse_auto_config(struct hda_codec *codec)
1146 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1147 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1148 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1152 * ALC880 fix-ups
1154 enum {
1155 ALC880_FIXUP_GPIO1,
1156 ALC880_FIXUP_GPIO2,
1157 ALC880_FIXUP_MEDION_RIM,
1158 ALC880_FIXUP_LG,
1159 ALC880_FIXUP_LG_LW25,
1160 ALC880_FIXUP_W810,
1161 ALC880_FIXUP_EAPD_COEF,
1162 ALC880_FIXUP_TCL_S700,
1163 ALC880_FIXUP_VOL_KNOB,
1164 ALC880_FIXUP_FUJITSU,
1165 ALC880_FIXUP_F1734,
1166 ALC880_FIXUP_UNIWILL,
1167 ALC880_FIXUP_UNIWILL_DIG,
1168 ALC880_FIXUP_Z71V,
1169 ALC880_FIXUP_ASUS_W5A,
1170 ALC880_FIXUP_3ST_BASE,
1171 ALC880_FIXUP_3ST,
1172 ALC880_FIXUP_3ST_DIG,
1173 ALC880_FIXUP_5ST_BASE,
1174 ALC880_FIXUP_5ST,
1175 ALC880_FIXUP_5ST_DIG,
1176 ALC880_FIXUP_6ST_BASE,
1177 ALC880_FIXUP_6ST,
1178 ALC880_FIXUP_6ST_DIG,
1179 ALC880_FIXUP_6ST_AUTOMUTE,
1182 /* enable the volume-knob widget support on NID 0x21 */
1183 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1184 const struct hda_fixup *fix, int action)
1186 if (action == HDA_FIXUP_ACT_PROBE)
1187 snd_hda_jack_detect_enable_callback(codec, 0x21,
1188 alc_update_knob_master);
1191 static const struct hda_fixup alc880_fixups[] = {
1192 [ALC880_FIXUP_GPIO1] = {
1193 .type = HDA_FIXUP_FUNC,
1194 .v.func = alc_fixup_gpio1,
1196 [ALC880_FIXUP_GPIO2] = {
1197 .type = HDA_FIXUP_FUNC,
1198 .v.func = alc_fixup_gpio2,
1200 [ALC880_FIXUP_MEDION_RIM] = {
1201 .type = HDA_FIXUP_VERBS,
1202 .v.verbs = (const struct hda_verb[]) {
1203 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1204 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1207 .chained = true,
1208 .chain_id = ALC880_FIXUP_GPIO2,
1210 [ALC880_FIXUP_LG] = {
1211 .type = HDA_FIXUP_PINS,
1212 .v.pins = (const struct hda_pintbl[]) {
1213 /* disable bogus unused pins */
1214 { 0x16, 0x411111f0 },
1215 { 0x18, 0x411111f0 },
1216 { 0x1a, 0x411111f0 },
1220 [ALC880_FIXUP_LG_LW25] = {
1221 .type = HDA_FIXUP_PINS,
1222 .v.pins = (const struct hda_pintbl[]) {
1223 { 0x1a, 0x0181344f }, /* line-in */
1224 { 0x1b, 0x0321403f }, /* headphone */
1228 [ALC880_FIXUP_W810] = {
1229 .type = HDA_FIXUP_PINS,
1230 .v.pins = (const struct hda_pintbl[]) {
1231 /* disable bogus unused pins */
1232 { 0x17, 0x411111f0 },
1235 .chained = true,
1236 .chain_id = ALC880_FIXUP_GPIO2,
1238 [ALC880_FIXUP_EAPD_COEF] = {
1239 .type = HDA_FIXUP_VERBS,
1240 .v.verbs = (const struct hda_verb[]) {
1241 /* change to EAPD mode */
1242 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1243 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1247 [ALC880_FIXUP_TCL_S700] = {
1248 .type = HDA_FIXUP_VERBS,
1249 .v.verbs = (const struct hda_verb[]) {
1250 /* change to EAPD mode */
1251 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1252 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1255 .chained = true,
1256 .chain_id = ALC880_FIXUP_GPIO2,
1258 [ALC880_FIXUP_VOL_KNOB] = {
1259 .type = HDA_FIXUP_FUNC,
1260 .v.func = alc880_fixup_vol_knob,
1262 [ALC880_FIXUP_FUJITSU] = {
1263 /* override all pins as BIOS on old Amilo is broken */
1264 .type = HDA_FIXUP_PINS,
1265 .v.pins = (const struct hda_pintbl[]) {
1266 { 0x14, 0x0121401f }, /* HP */
1267 { 0x15, 0x99030120 }, /* speaker */
1268 { 0x16, 0x99030130 }, /* bass speaker */
1269 { 0x17, 0x411111f0 }, /* N/A */
1270 { 0x18, 0x411111f0 }, /* N/A */
1271 { 0x19, 0x01a19950 }, /* mic-in */
1272 { 0x1a, 0x411111f0 }, /* N/A */
1273 { 0x1b, 0x411111f0 }, /* N/A */
1274 { 0x1c, 0x411111f0 }, /* N/A */
1275 { 0x1d, 0x411111f0 }, /* N/A */
1276 { 0x1e, 0x01454140 }, /* SPDIF out */
1279 .chained = true,
1280 .chain_id = ALC880_FIXUP_VOL_KNOB,
1282 [ALC880_FIXUP_F1734] = {
1283 /* almost compatible with FUJITSU, but no bass and SPDIF */
1284 .type = HDA_FIXUP_PINS,
1285 .v.pins = (const struct hda_pintbl[]) {
1286 { 0x14, 0x0121401f }, /* HP */
1287 { 0x15, 0x99030120 }, /* speaker */
1288 { 0x16, 0x411111f0 }, /* N/A */
1289 { 0x17, 0x411111f0 }, /* N/A */
1290 { 0x18, 0x411111f0 }, /* N/A */
1291 { 0x19, 0x01a19950 }, /* mic-in */
1292 { 0x1a, 0x411111f0 }, /* N/A */
1293 { 0x1b, 0x411111f0 }, /* N/A */
1294 { 0x1c, 0x411111f0 }, /* N/A */
1295 { 0x1d, 0x411111f0 }, /* N/A */
1296 { 0x1e, 0x411111f0 }, /* N/A */
1299 .chained = true,
1300 .chain_id = ALC880_FIXUP_VOL_KNOB,
1302 [ALC880_FIXUP_UNIWILL] = {
1303 /* need to fix HP and speaker pins to be parsed correctly */
1304 .type = HDA_FIXUP_PINS,
1305 .v.pins = (const struct hda_pintbl[]) {
1306 { 0x14, 0x0121411f }, /* HP */
1307 { 0x15, 0x99030120 }, /* speaker */
1308 { 0x16, 0x99030130 }, /* bass speaker */
1312 [ALC880_FIXUP_UNIWILL_DIG] = {
1313 .type = HDA_FIXUP_PINS,
1314 .v.pins = (const struct hda_pintbl[]) {
1315 /* disable bogus unused pins */
1316 { 0x17, 0x411111f0 },
1317 { 0x19, 0x411111f0 },
1318 { 0x1b, 0x411111f0 },
1319 { 0x1f, 0x411111f0 },
1323 [ALC880_FIXUP_Z71V] = {
1324 .type = HDA_FIXUP_PINS,
1325 .v.pins = (const struct hda_pintbl[]) {
1326 /* set up the whole pins as BIOS is utterly broken */
1327 { 0x14, 0x99030120 }, /* speaker */
1328 { 0x15, 0x0121411f }, /* HP */
1329 { 0x16, 0x411111f0 }, /* N/A */
1330 { 0x17, 0x411111f0 }, /* N/A */
1331 { 0x18, 0x01a19950 }, /* mic-in */
1332 { 0x19, 0x411111f0 }, /* N/A */
1333 { 0x1a, 0x01813031 }, /* line-in */
1334 { 0x1b, 0x411111f0 }, /* N/A */
1335 { 0x1c, 0x411111f0 }, /* N/A */
1336 { 0x1d, 0x411111f0 }, /* N/A */
1337 { 0x1e, 0x0144111e }, /* SPDIF */
1341 [ALC880_FIXUP_ASUS_W5A] = {
1342 .type = HDA_FIXUP_PINS,
1343 .v.pins = (const struct hda_pintbl[]) {
1344 /* set up the whole pins as BIOS is utterly broken */
1345 { 0x14, 0x0121411f }, /* HP */
1346 { 0x15, 0x411111f0 }, /* N/A */
1347 { 0x16, 0x411111f0 }, /* N/A */
1348 { 0x17, 0x411111f0 }, /* N/A */
1349 { 0x18, 0x90a60160 }, /* mic */
1350 { 0x19, 0x411111f0 }, /* N/A */
1351 { 0x1a, 0x411111f0 }, /* N/A */
1352 { 0x1b, 0x411111f0 }, /* N/A */
1353 { 0x1c, 0x411111f0 }, /* N/A */
1354 { 0x1d, 0x411111f0 }, /* N/A */
1355 { 0x1e, 0xb743111e }, /* SPDIF out */
1358 .chained = true,
1359 .chain_id = ALC880_FIXUP_GPIO1,
1361 [ALC880_FIXUP_3ST_BASE] = {
1362 .type = HDA_FIXUP_PINS,
1363 .v.pins = (const struct hda_pintbl[]) {
1364 { 0x14, 0x01014010 }, /* line-out */
1365 { 0x15, 0x411111f0 }, /* N/A */
1366 { 0x16, 0x411111f0 }, /* N/A */
1367 { 0x17, 0x411111f0 }, /* N/A */
1368 { 0x18, 0x01a19c30 }, /* mic-in */
1369 { 0x19, 0x0121411f }, /* HP */
1370 { 0x1a, 0x01813031 }, /* line-in */
1371 { 0x1b, 0x02a19c40 }, /* front-mic */
1372 { 0x1c, 0x411111f0 }, /* N/A */
1373 { 0x1d, 0x411111f0 }, /* N/A */
1374 /* 0x1e is filled in below */
1375 { 0x1f, 0x411111f0 }, /* N/A */
1379 [ALC880_FIXUP_3ST] = {
1380 .type = HDA_FIXUP_PINS,
1381 .v.pins = (const struct hda_pintbl[]) {
1382 { 0x1e, 0x411111f0 }, /* N/A */
1385 .chained = true,
1386 .chain_id = ALC880_FIXUP_3ST_BASE,
1388 [ALC880_FIXUP_3ST_DIG] = {
1389 .type = HDA_FIXUP_PINS,
1390 .v.pins = (const struct hda_pintbl[]) {
1391 { 0x1e, 0x0144111e }, /* SPDIF */
1394 .chained = true,
1395 .chain_id = ALC880_FIXUP_3ST_BASE,
1397 [ALC880_FIXUP_5ST_BASE] = {
1398 .type = HDA_FIXUP_PINS,
1399 .v.pins = (const struct hda_pintbl[]) {
1400 { 0x14, 0x01014010 }, /* front */
1401 { 0x15, 0x411111f0 }, /* N/A */
1402 { 0x16, 0x01011411 }, /* CLFE */
1403 { 0x17, 0x01016412 }, /* surr */
1404 { 0x18, 0x01a19c30 }, /* mic-in */
1405 { 0x19, 0x0121411f }, /* HP */
1406 { 0x1a, 0x01813031 }, /* line-in */
1407 { 0x1b, 0x02a19c40 }, /* front-mic */
1408 { 0x1c, 0x411111f0 }, /* N/A */
1409 { 0x1d, 0x411111f0 }, /* N/A */
1410 /* 0x1e is filled in below */
1411 { 0x1f, 0x411111f0 }, /* N/A */
1415 [ALC880_FIXUP_5ST] = {
1416 .type = HDA_FIXUP_PINS,
1417 .v.pins = (const struct hda_pintbl[]) {
1418 { 0x1e, 0x411111f0 }, /* N/A */
1421 .chained = true,
1422 .chain_id = ALC880_FIXUP_5ST_BASE,
1424 [ALC880_FIXUP_5ST_DIG] = {
1425 .type = HDA_FIXUP_PINS,
1426 .v.pins = (const struct hda_pintbl[]) {
1427 { 0x1e, 0x0144111e }, /* SPDIF */
1430 .chained = true,
1431 .chain_id = ALC880_FIXUP_5ST_BASE,
1433 [ALC880_FIXUP_6ST_BASE] = {
1434 .type = HDA_FIXUP_PINS,
1435 .v.pins = (const struct hda_pintbl[]) {
1436 { 0x14, 0x01014010 }, /* front */
1437 { 0x15, 0x01016412 }, /* surr */
1438 { 0x16, 0x01011411 }, /* CLFE */
1439 { 0x17, 0x01012414 }, /* side */
1440 { 0x18, 0x01a19c30 }, /* mic-in */
1441 { 0x19, 0x02a19c40 }, /* front-mic */
1442 { 0x1a, 0x01813031 }, /* line-in */
1443 { 0x1b, 0x0121411f }, /* HP */
1444 { 0x1c, 0x411111f0 }, /* N/A */
1445 { 0x1d, 0x411111f0 }, /* N/A */
1446 /* 0x1e is filled in below */
1447 { 0x1f, 0x411111f0 }, /* N/A */
1451 [ALC880_FIXUP_6ST] = {
1452 .type = HDA_FIXUP_PINS,
1453 .v.pins = (const struct hda_pintbl[]) {
1454 { 0x1e, 0x411111f0 }, /* N/A */
1457 .chained = true,
1458 .chain_id = ALC880_FIXUP_6ST_BASE,
1460 [ALC880_FIXUP_6ST_DIG] = {
1461 .type = HDA_FIXUP_PINS,
1462 .v.pins = (const struct hda_pintbl[]) {
1463 { 0x1e, 0x0144111e }, /* SPDIF */
1466 .chained = true,
1467 .chain_id = ALC880_FIXUP_6ST_BASE,
1469 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1470 .type = HDA_FIXUP_PINS,
1471 .v.pins = (const struct hda_pintbl[]) {
1472 { 0x1b, 0x0121401f }, /* HP with jack detect */
1475 .chained_before = true,
1476 .chain_id = ALC880_FIXUP_6ST_BASE,
1480 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1481 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1482 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1483 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1484 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1485 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1486 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1487 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1488 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1489 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1490 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1491 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1492 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1493 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1494 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1495 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1496 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1497 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1498 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1499 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1500 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1501 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1502 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1503 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1505 /* Below is the copied entries from alc880_quirks.c.
1506 * It's not quite sure whether BIOS sets the correct pin-config table
1507 * on these machines, thus they are kept to be compatible with
1508 * the old static quirks. Once when it's confirmed to work without
1509 * these overrides, it'd be better to remove.
1511 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1512 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1513 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1514 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1515 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1516 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1517 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1518 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1519 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1520 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1521 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1522 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1523 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1524 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1525 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1526 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1527 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1528 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1529 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1530 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1531 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1532 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1533 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1534 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1535 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1536 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1537 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1538 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1539 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1540 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1541 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1542 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1543 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1544 /* default Intel */
1545 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1546 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1547 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1551 static const struct hda_model_fixup alc880_fixup_models[] = {
1552 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1553 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1554 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1555 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1556 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1557 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1558 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1564 * OK, here we have finally the patch for ALC880
1566 static int patch_alc880(struct hda_codec *codec)
1568 struct alc_spec *spec;
1569 int err;
1571 err = alc_alloc_spec(codec, 0x0b);
1572 if (err < 0)
1573 return err;
1575 spec = codec->spec;
1576 spec->gen.need_dac_fix = 1;
1577 spec->gen.beep_nid = 0x01;
1579 codec->patch_ops.unsol_event = alc880_unsol_event;
1581 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1582 alc880_fixups);
1583 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1585 /* automatic parse from the BIOS config */
1586 err = alc880_parse_auto_config(codec);
1587 if (err < 0)
1588 goto error;
1590 if (!spec->gen.no_analog) {
1591 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1592 if (err < 0)
1593 goto error;
1596 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1598 return 0;
1600 error:
1601 alc_free(codec);
1602 return err;
1607 * ALC260 support
1609 static int alc260_parse_auto_config(struct hda_codec *codec)
1611 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1612 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1613 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1617 * Pin config fixes
1619 enum {
1620 ALC260_FIXUP_HP_DC5750,
1621 ALC260_FIXUP_HP_PIN_0F,
1622 ALC260_FIXUP_COEF,
1623 ALC260_FIXUP_GPIO1,
1624 ALC260_FIXUP_GPIO1_TOGGLE,
1625 ALC260_FIXUP_REPLACER,
1626 ALC260_FIXUP_HP_B1900,
1627 ALC260_FIXUP_KN1,
1628 ALC260_FIXUP_FSC_S7020,
1629 ALC260_FIXUP_FSC_S7020_JWSE,
1630 ALC260_FIXUP_VAIO_PINS,
1633 static void alc260_gpio1_automute(struct hda_codec *codec)
1635 struct alc_spec *spec = codec->spec;
1637 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1640 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1641 const struct hda_fixup *fix, int action)
1643 struct alc_spec *spec = codec->spec;
1644 if (action == HDA_FIXUP_ACT_PROBE) {
1645 /* although the machine has only one output pin, we need to
1646 * toggle GPIO1 according to the jack state
1648 spec->gen.automute_hook = alc260_gpio1_automute;
1649 spec->gen.detect_hp = 1;
1650 spec->gen.automute_speaker = 1;
1651 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1652 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1653 snd_hda_gen_hp_automute);
1654 alc_setup_gpio(codec, 0x01);
1658 static void alc260_fixup_kn1(struct hda_codec *codec,
1659 const struct hda_fixup *fix, int action)
1661 struct alc_spec *spec = codec->spec;
1662 static const struct hda_pintbl pincfgs[] = {
1663 { 0x0f, 0x02214000 }, /* HP/speaker */
1664 { 0x12, 0x90a60160 }, /* int mic */
1665 { 0x13, 0x02a19000 }, /* ext mic */
1666 { 0x18, 0x01446000 }, /* SPDIF out */
1667 /* disable bogus I/O pins */
1668 { 0x10, 0x411111f0 },
1669 { 0x11, 0x411111f0 },
1670 { 0x14, 0x411111f0 },
1671 { 0x15, 0x411111f0 },
1672 { 0x16, 0x411111f0 },
1673 { 0x17, 0x411111f0 },
1674 { 0x19, 0x411111f0 },
1678 switch (action) {
1679 case HDA_FIXUP_ACT_PRE_PROBE:
1680 snd_hda_apply_pincfgs(codec, pincfgs);
1681 spec->init_amp = ALC_INIT_NONE;
1682 break;
1686 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1687 const struct hda_fixup *fix, int action)
1689 struct alc_spec *spec = codec->spec;
1690 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1691 spec->init_amp = ALC_INIT_NONE;
1694 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1695 const struct hda_fixup *fix, int action)
1697 struct alc_spec *spec = codec->spec;
1698 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1699 spec->gen.add_jack_modes = 1;
1700 spec->gen.hp_mic = 1;
1704 static const struct hda_fixup alc260_fixups[] = {
1705 [ALC260_FIXUP_HP_DC5750] = {
1706 .type = HDA_FIXUP_PINS,
1707 .v.pins = (const struct hda_pintbl[]) {
1708 { 0x11, 0x90130110 }, /* speaker */
1712 [ALC260_FIXUP_HP_PIN_0F] = {
1713 .type = HDA_FIXUP_PINS,
1714 .v.pins = (const struct hda_pintbl[]) {
1715 { 0x0f, 0x01214000 }, /* HP */
1719 [ALC260_FIXUP_COEF] = {
1720 .type = HDA_FIXUP_VERBS,
1721 .v.verbs = (const struct hda_verb[]) {
1722 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1723 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1727 [ALC260_FIXUP_GPIO1] = {
1728 .type = HDA_FIXUP_FUNC,
1729 .v.func = alc_fixup_gpio1,
1731 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1732 .type = HDA_FIXUP_FUNC,
1733 .v.func = alc260_fixup_gpio1_toggle,
1734 .chained = true,
1735 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1737 [ALC260_FIXUP_REPLACER] = {
1738 .type = HDA_FIXUP_VERBS,
1739 .v.verbs = (const struct hda_verb[]) {
1740 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1741 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1744 .chained = true,
1745 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1747 [ALC260_FIXUP_HP_B1900] = {
1748 .type = HDA_FIXUP_FUNC,
1749 .v.func = alc260_fixup_gpio1_toggle,
1750 .chained = true,
1751 .chain_id = ALC260_FIXUP_COEF,
1753 [ALC260_FIXUP_KN1] = {
1754 .type = HDA_FIXUP_FUNC,
1755 .v.func = alc260_fixup_kn1,
1757 [ALC260_FIXUP_FSC_S7020] = {
1758 .type = HDA_FIXUP_FUNC,
1759 .v.func = alc260_fixup_fsc_s7020,
1761 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1762 .type = HDA_FIXUP_FUNC,
1763 .v.func = alc260_fixup_fsc_s7020_jwse,
1764 .chained = true,
1765 .chain_id = ALC260_FIXUP_FSC_S7020,
1767 [ALC260_FIXUP_VAIO_PINS] = {
1768 .type = HDA_FIXUP_PINS,
1769 .v.pins = (const struct hda_pintbl[]) {
1770 /* Pin configs are missing completely on some VAIOs */
1771 { 0x0f, 0x01211020 },
1772 { 0x10, 0x0001003f },
1773 { 0x11, 0x411111f0 },
1774 { 0x12, 0x01a15930 },
1775 { 0x13, 0x411111f0 },
1776 { 0x14, 0x411111f0 },
1777 { 0x15, 0x411111f0 },
1778 { 0x16, 0x411111f0 },
1779 { 0x17, 0x411111f0 },
1780 { 0x18, 0x411111f0 },
1781 { 0x19, 0x411111f0 },
1787 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1788 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1789 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1790 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1791 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1792 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1793 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1794 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1795 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1796 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1797 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1798 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1799 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1803 static const struct hda_model_fixup alc260_fixup_models[] = {
1804 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1805 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1806 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1807 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1813 static int patch_alc260(struct hda_codec *codec)
1815 struct alc_spec *spec;
1816 int err;
1818 err = alc_alloc_spec(codec, 0x07);
1819 if (err < 0)
1820 return err;
1822 spec = codec->spec;
1823 /* as quite a few machines require HP amp for speaker outputs,
1824 * it's easier to enable it unconditionally; even if it's unneeded,
1825 * it's almost harmless.
1827 spec->gen.prefer_hp_amp = 1;
1828 spec->gen.beep_nid = 0x01;
1830 spec->shutup = alc_eapd_shutup;
1832 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1833 alc260_fixups);
1834 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1836 /* automatic parse from the BIOS config */
1837 err = alc260_parse_auto_config(codec);
1838 if (err < 0)
1839 goto error;
1841 if (!spec->gen.no_analog) {
1842 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1843 if (err < 0)
1844 goto error;
1847 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1849 return 0;
1851 error:
1852 alc_free(codec);
1853 return err;
1858 * ALC882/883/885/888/889 support
1860 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1861 * configuration. Each pin widget can choose any input DACs and a mixer.
1862 * Each ADC is connected from a mixer of all inputs. This makes possible
1863 * 6-channel independent captures.
1865 * In addition, an independent DAC for the multi-playback (not used in this
1866 * driver yet).
1870 * Pin config fixes
1872 enum {
1873 ALC882_FIXUP_ABIT_AW9D_MAX,
1874 ALC882_FIXUP_LENOVO_Y530,
1875 ALC882_FIXUP_PB_M5210,
1876 ALC882_FIXUP_ACER_ASPIRE_7736,
1877 ALC882_FIXUP_ASUS_W90V,
1878 ALC889_FIXUP_CD,
1879 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1880 ALC889_FIXUP_VAIO_TT,
1881 ALC888_FIXUP_EEE1601,
1882 ALC882_FIXUP_EAPD,
1883 ALC883_FIXUP_EAPD,
1884 ALC883_FIXUP_ACER_EAPD,
1885 ALC882_FIXUP_GPIO1,
1886 ALC882_FIXUP_GPIO2,
1887 ALC882_FIXUP_GPIO3,
1888 ALC889_FIXUP_COEF,
1889 ALC882_FIXUP_ASUS_W2JC,
1890 ALC882_FIXUP_ACER_ASPIRE_4930G,
1891 ALC882_FIXUP_ACER_ASPIRE_8930G,
1892 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1893 ALC885_FIXUP_MACPRO_GPIO,
1894 ALC889_FIXUP_DAC_ROUTE,
1895 ALC889_FIXUP_MBP_VREF,
1896 ALC889_FIXUP_IMAC91_VREF,
1897 ALC889_FIXUP_MBA11_VREF,
1898 ALC889_FIXUP_MBA21_VREF,
1899 ALC889_FIXUP_MP11_VREF,
1900 ALC889_FIXUP_MP41_VREF,
1901 ALC882_FIXUP_INV_DMIC,
1902 ALC882_FIXUP_NO_PRIMARY_HP,
1903 ALC887_FIXUP_ASUS_BASS,
1904 ALC887_FIXUP_BASS_CHMAP,
1905 ALC1220_FIXUP_GB_DUAL_CODECS,
1906 ALC1220_FIXUP_CLEVO_P950,
1907 ALC1220_FIXUP_CLEVO_PB51ED,
1908 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1911 static void alc889_fixup_coef(struct hda_codec *codec,
1912 const struct hda_fixup *fix, int action)
1914 if (action != HDA_FIXUP_ACT_INIT)
1915 return;
1916 alc_update_coef_idx(codec, 7, 0, 0x2030);
1919 /* set up GPIO at initialization */
1920 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
1921 const struct hda_fixup *fix, int action)
1923 struct alc_spec *spec = codec->spec;
1925 spec->gpio_write_delay = true;
1926 alc_fixup_gpio3(codec, fix, action);
1929 /* Fix the connection of some pins for ALC889:
1930 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1931 * work correctly (bko#42740)
1933 static void alc889_fixup_dac_route(struct hda_codec *codec,
1934 const struct hda_fixup *fix, int action)
1936 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1937 /* fake the connections during parsing the tree */
1938 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1939 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1940 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1941 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1942 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1943 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
1944 } else if (action == HDA_FIXUP_ACT_PROBE) {
1945 /* restore the connections */
1946 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1947 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1948 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1949 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1950 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
1954 /* Set VREF on HP pin */
1955 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
1956 const struct hda_fixup *fix, int action)
1958 struct alc_spec *spec = codec->spec;
1959 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
1960 int i;
1962 if (action != HDA_FIXUP_ACT_INIT)
1963 return;
1964 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1965 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1966 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1967 continue;
1968 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1969 val |= AC_PINCTL_VREF_80;
1970 snd_hda_set_pin_ctl(codec, nids[i], val);
1971 spec->gen.keep_vref_in_automute = 1;
1972 break;
1976 static void alc889_fixup_mac_pins(struct hda_codec *codec,
1977 const hda_nid_t *nids, int num_nids)
1979 struct alc_spec *spec = codec->spec;
1980 int i;
1982 for (i = 0; i < num_nids; i++) {
1983 unsigned int val;
1984 val = snd_hda_codec_get_pin_target(codec, nids[i]);
1985 val |= AC_PINCTL_VREF_50;
1986 snd_hda_set_pin_ctl(codec, nids[i], val);
1988 spec->gen.keep_vref_in_automute = 1;
1991 /* Set VREF on speaker pins on imac91 */
1992 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1993 const struct hda_fixup *fix, int action)
1995 static hda_nid_t nids[2] = { 0x18, 0x1a };
1997 if (action == HDA_FIXUP_ACT_INIT)
1998 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2001 /* Set VREF on speaker pins on mba11 */
2002 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2003 const struct hda_fixup *fix, int action)
2005 static hda_nid_t nids[1] = { 0x18 };
2007 if (action == HDA_FIXUP_ACT_INIT)
2008 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2011 /* Set VREF on speaker pins on mba21 */
2012 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2013 const struct hda_fixup *fix, int action)
2015 static hda_nid_t nids[2] = { 0x18, 0x19 };
2017 if (action == HDA_FIXUP_ACT_INIT)
2018 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2021 /* Don't take HP output as primary
2022 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2023 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2025 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2026 const struct hda_fixup *fix, int action)
2028 struct alc_spec *spec = codec->spec;
2029 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2030 spec->gen.no_primary_hp = 1;
2031 spec->gen.no_multi_io = 1;
2035 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2036 const struct hda_fixup *fix, int action);
2038 /* For dual-codec configuration, we need to disable some features to avoid
2039 * conflicts of kctls and PCM streams
2041 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2042 const struct hda_fixup *fix, int action)
2044 struct alc_spec *spec = codec->spec;
2046 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2047 return;
2048 /* disable vmaster */
2049 spec->gen.suppress_vmaster = 1;
2050 /* auto-mute and auto-mic switch don't work with multiple codecs */
2051 spec->gen.suppress_auto_mute = 1;
2052 spec->gen.suppress_auto_mic = 1;
2053 /* disable aamix as well */
2054 spec->gen.mixer_nid = 0;
2055 /* add location prefix to avoid conflicts */
2056 codec->force_pin_prefix = 1;
2059 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2060 const char *newname)
2062 struct snd_kcontrol *kctl;
2064 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2065 if (kctl)
2066 strcpy(kctl->id.name, newname);
2069 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2070 const struct hda_fixup *fix,
2071 int action)
2073 alc_fixup_dual_codecs(codec, fix, action);
2074 switch (action) {
2075 case HDA_FIXUP_ACT_PRE_PROBE:
2076 /* override card longname to provide a unique UCM profile */
2077 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2078 break;
2079 case HDA_FIXUP_ACT_BUILD:
2080 /* rename Capture controls depending on the codec */
2081 rename_ctl(codec, "Capture Volume",
2082 codec->addr == 0 ?
2083 "Rear-Panel Capture Volume" :
2084 "Front-Panel Capture Volume");
2085 rename_ctl(codec, "Capture Switch",
2086 codec->addr == 0 ?
2087 "Rear-Panel Capture Switch" :
2088 "Front-Panel Capture Switch");
2089 break;
2093 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2094 const struct hda_fixup *fix,
2095 int action)
2097 hda_nid_t conn1[1] = { 0x0c };
2099 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2100 return;
2102 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2103 /* We therefore want to make sure 0x14 (front headphone) and
2104 * 0x1b (speakers) use the stereo DAC 0x02
2106 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
2107 snd_hda_override_conn_list(codec, 0x1b, 1, conn1);
2110 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2111 const struct hda_fixup *fix, int action);
2113 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2114 const struct hda_fixup *fix,
2115 int action)
2117 alc1220_fixup_clevo_p950(codec, fix, action);
2118 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2121 static const struct hda_fixup alc882_fixups[] = {
2122 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2123 .type = HDA_FIXUP_PINS,
2124 .v.pins = (const struct hda_pintbl[]) {
2125 { 0x15, 0x01080104 }, /* side */
2126 { 0x16, 0x01011012 }, /* rear */
2127 { 0x17, 0x01016011 }, /* clfe */
2131 [ALC882_FIXUP_LENOVO_Y530] = {
2132 .type = HDA_FIXUP_PINS,
2133 .v.pins = (const struct hda_pintbl[]) {
2134 { 0x15, 0x99130112 }, /* rear int speakers */
2135 { 0x16, 0x99130111 }, /* subwoofer */
2139 [ALC882_FIXUP_PB_M5210] = {
2140 .type = HDA_FIXUP_PINCTLS,
2141 .v.pins = (const struct hda_pintbl[]) {
2142 { 0x19, PIN_VREF50 },
2146 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2147 .type = HDA_FIXUP_FUNC,
2148 .v.func = alc_fixup_sku_ignore,
2150 [ALC882_FIXUP_ASUS_W90V] = {
2151 .type = HDA_FIXUP_PINS,
2152 .v.pins = (const struct hda_pintbl[]) {
2153 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2157 [ALC889_FIXUP_CD] = {
2158 .type = HDA_FIXUP_PINS,
2159 .v.pins = (const struct hda_pintbl[]) {
2160 { 0x1c, 0x993301f0 }, /* CD */
2164 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2165 .type = HDA_FIXUP_PINS,
2166 .v.pins = (const struct hda_pintbl[]) {
2167 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2170 .chained = true,
2171 .chain_id = ALC889_FIXUP_CD,
2173 [ALC889_FIXUP_VAIO_TT] = {
2174 .type = HDA_FIXUP_PINS,
2175 .v.pins = (const struct hda_pintbl[]) {
2176 { 0x17, 0x90170111 }, /* hidden surround speaker */
2180 [ALC888_FIXUP_EEE1601] = {
2181 .type = HDA_FIXUP_VERBS,
2182 .v.verbs = (const struct hda_verb[]) {
2183 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2184 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2188 [ALC882_FIXUP_EAPD] = {
2189 .type = HDA_FIXUP_VERBS,
2190 .v.verbs = (const struct hda_verb[]) {
2191 /* change to EAPD mode */
2192 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2193 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2197 [ALC883_FIXUP_EAPD] = {
2198 .type = HDA_FIXUP_VERBS,
2199 .v.verbs = (const struct hda_verb[]) {
2200 /* change to EAPD mode */
2201 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2202 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2206 [ALC883_FIXUP_ACER_EAPD] = {
2207 .type = HDA_FIXUP_VERBS,
2208 .v.verbs = (const struct hda_verb[]) {
2209 /* eanable EAPD on Acer laptops */
2210 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2211 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2215 [ALC882_FIXUP_GPIO1] = {
2216 .type = HDA_FIXUP_FUNC,
2217 .v.func = alc_fixup_gpio1,
2219 [ALC882_FIXUP_GPIO2] = {
2220 .type = HDA_FIXUP_FUNC,
2221 .v.func = alc_fixup_gpio2,
2223 [ALC882_FIXUP_GPIO3] = {
2224 .type = HDA_FIXUP_FUNC,
2225 .v.func = alc_fixup_gpio3,
2227 [ALC882_FIXUP_ASUS_W2JC] = {
2228 .type = HDA_FIXUP_FUNC,
2229 .v.func = alc_fixup_gpio1,
2230 .chained = true,
2231 .chain_id = ALC882_FIXUP_EAPD,
2233 [ALC889_FIXUP_COEF] = {
2234 .type = HDA_FIXUP_FUNC,
2235 .v.func = alc889_fixup_coef,
2237 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2238 .type = HDA_FIXUP_PINS,
2239 .v.pins = (const struct hda_pintbl[]) {
2240 { 0x16, 0x99130111 }, /* CLFE speaker */
2241 { 0x17, 0x99130112 }, /* surround speaker */
2244 .chained = true,
2245 .chain_id = ALC882_FIXUP_GPIO1,
2247 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2248 .type = HDA_FIXUP_PINS,
2249 .v.pins = (const struct hda_pintbl[]) {
2250 { 0x16, 0x99130111 }, /* CLFE speaker */
2251 { 0x1b, 0x99130112 }, /* surround speaker */
2254 .chained = true,
2255 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2257 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2258 /* additional init verbs for Acer Aspire 8930G */
2259 .type = HDA_FIXUP_VERBS,
2260 .v.verbs = (const struct hda_verb[]) {
2261 /* Enable all DACs */
2262 /* DAC DISABLE/MUTE 1? */
2263 /* setting bits 1-5 disables DAC nids 0x02-0x06
2264 * apparently. Init=0x38 */
2265 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2266 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2267 /* DAC DISABLE/MUTE 2? */
2268 /* some bit here disables the other DACs.
2269 * Init=0x4900 */
2270 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2271 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2272 /* DMIC fix
2273 * This laptop has a stereo digital microphone.
2274 * The mics are only 1cm apart which makes the stereo
2275 * useless. However, either the mic or the ALC889
2276 * makes the signal become a difference/sum signal
2277 * instead of standard stereo, which is annoying.
2278 * So instead we flip this bit which makes the
2279 * codec replicate the sum signal to both channels,
2280 * turning it into a normal mono mic.
2282 /* DMIC_CONTROL? Init value = 0x0001 */
2283 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2284 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2285 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2286 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2289 .chained = true,
2290 .chain_id = ALC882_FIXUP_GPIO1,
2292 [ALC885_FIXUP_MACPRO_GPIO] = {
2293 .type = HDA_FIXUP_FUNC,
2294 .v.func = alc885_fixup_macpro_gpio,
2296 [ALC889_FIXUP_DAC_ROUTE] = {
2297 .type = HDA_FIXUP_FUNC,
2298 .v.func = alc889_fixup_dac_route,
2300 [ALC889_FIXUP_MBP_VREF] = {
2301 .type = HDA_FIXUP_FUNC,
2302 .v.func = alc889_fixup_mbp_vref,
2303 .chained = true,
2304 .chain_id = ALC882_FIXUP_GPIO1,
2306 [ALC889_FIXUP_IMAC91_VREF] = {
2307 .type = HDA_FIXUP_FUNC,
2308 .v.func = alc889_fixup_imac91_vref,
2309 .chained = true,
2310 .chain_id = ALC882_FIXUP_GPIO1,
2312 [ALC889_FIXUP_MBA11_VREF] = {
2313 .type = HDA_FIXUP_FUNC,
2314 .v.func = alc889_fixup_mba11_vref,
2315 .chained = true,
2316 .chain_id = ALC889_FIXUP_MBP_VREF,
2318 [ALC889_FIXUP_MBA21_VREF] = {
2319 .type = HDA_FIXUP_FUNC,
2320 .v.func = alc889_fixup_mba21_vref,
2321 .chained = true,
2322 .chain_id = ALC889_FIXUP_MBP_VREF,
2324 [ALC889_FIXUP_MP11_VREF] = {
2325 .type = HDA_FIXUP_FUNC,
2326 .v.func = alc889_fixup_mba11_vref,
2327 .chained = true,
2328 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2330 [ALC889_FIXUP_MP41_VREF] = {
2331 .type = HDA_FIXUP_FUNC,
2332 .v.func = alc889_fixup_mbp_vref,
2333 .chained = true,
2334 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2336 [ALC882_FIXUP_INV_DMIC] = {
2337 .type = HDA_FIXUP_FUNC,
2338 .v.func = alc_fixup_inv_dmic,
2340 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2341 .type = HDA_FIXUP_FUNC,
2342 .v.func = alc882_fixup_no_primary_hp,
2344 [ALC887_FIXUP_ASUS_BASS] = {
2345 .type = HDA_FIXUP_PINS,
2346 .v.pins = (const struct hda_pintbl[]) {
2347 {0x16, 0x99130130}, /* bass speaker */
2350 .chained = true,
2351 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2353 [ALC887_FIXUP_BASS_CHMAP] = {
2354 .type = HDA_FIXUP_FUNC,
2355 .v.func = alc_fixup_bass_chmap,
2357 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2358 .type = HDA_FIXUP_FUNC,
2359 .v.func = alc1220_fixup_gb_dual_codecs,
2361 [ALC1220_FIXUP_CLEVO_P950] = {
2362 .type = HDA_FIXUP_FUNC,
2363 .v.func = alc1220_fixup_clevo_p950,
2365 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2366 .type = HDA_FIXUP_FUNC,
2367 .v.func = alc1220_fixup_clevo_pb51ed,
2369 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2370 .type = HDA_FIXUP_PINS,
2371 .v.pins = (const struct hda_pintbl[]) {
2372 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2375 .chained = true,
2376 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2380 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2381 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2382 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2383 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2384 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2385 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2386 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2387 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2388 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2389 ALC882_FIXUP_ACER_ASPIRE_4930G),
2390 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2391 ALC882_FIXUP_ACER_ASPIRE_4930G),
2392 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2393 ALC882_FIXUP_ACER_ASPIRE_8930G),
2394 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2395 ALC882_FIXUP_ACER_ASPIRE_8930G),
2396 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2397 ALC882_FIXUP_ACER_ASPIRE_4930G),
2398 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2399 ALC882_FIXUP_ACER_ASPIRE_4930G),
2400 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2401 ALC882_FIXUP_ACER_ASPIRE_4930G),
2402 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2403 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2404 ALC882_FIXUP_ACER_ASPIRE_4930G),
2405 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2406 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2407 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2408 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2409 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2410 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2411 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2412 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2413 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2414 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2415 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2416 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2417 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2418 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2420 /* All Apple entries are in codec SSIDs */
2421 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2422 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2423 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2424 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2425 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2426 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2427 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2428 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2429 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2430 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2431 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2432 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2433 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2434 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2435 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2436 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2437 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2438 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2439 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2440 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2441 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2442 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2444 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2445 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2446 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2447 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
2448 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
2449 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2450 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2451 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2452 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2453 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2454 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2455 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2456 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2457 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2458 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2459 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2460 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2461 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2462 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2463 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2464 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2465 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2466 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2467 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2468 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2469 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2470 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2471 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2475 static const struct hda_model_fixup alc882_fixup_models[] = {
2476 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2477 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2478 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2479 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2480 {.id = ALC889_FIXUP_CD, .name = "cd"},
2481 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2482 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2483 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2484 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2485 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2486 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2487 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2488 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2489 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2490 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2491 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2492 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2493 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2494 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2495 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2496 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2497 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2498 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2499 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2500 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2501 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2502 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2503 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2504 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2505 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2506 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2511 * BIOS auto configuration
2513 /* almost identical with ALC880 parser... */
2514 static int alc882_parse_auto_config(struct hda_codec *codec)
2516 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2517 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2518 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2523 static int patch_alc882(struct hda_codec *codec)
2525 struct alc_spec *spec;
2526 int err;
2528 err = alc_alloc_spec(codec, 0x0b);
2529 if (err < 0)
2530 return err;
2532 spec = codec->spec;
2534 switch (codec->core.vendor_id) {
2535 case 0x10ec0882:
2536 case 0x10ec0885:
2537 case 0x10ec0900:
2538 case 0x10ec0b00:
2539 case 0x10ec1220:
2540 break;
2541 default:
2542 /* ALC883 and variants */
2543 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2544 break;
2547 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2548 alc882_fixups);
2549 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2551 alc_auto_parse_customize_define(codec);
2553 if (has_cdefine_beep(codec))
2554 spec->gen.beep_nid = 0x01;
2556 /* automatic parse from the BIOS config */
2557 err = alc882_parse_auto_config(codec);
2558 if (err < 0)
2559 goto error;
2561 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2562 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2563 if (err < 0)
2564 goto error;
2567 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2569 return 0;
2571 error:
2572 alc_free(codec);
2573 return err;
2578 * ALC262 support
2580 static int alc262_parse_auto_config(struct hda_codec *codec)
2582 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2583 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2584 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2588 * Pin config fixes
2590 enum {
2591 ALC262_FIXUP_FSC_H270,
2592 ALC262_FIXUP_FSC_S7110,
2593 ALC262_FIXUP_HP_Z200,
2594 ALC262_FIXUP_TYAN,
2595 ALC262_FIXUP_LENOVO_3000,
2596 ALC262_FIXUP_BENQ,
2597 ALC262_FIXUP_BENQ_T31,
2598 ALC262_FIXUP_INV_DMIC,
2599 ALC262_FIXUP_INTEL_BAYLEYBAY,
2602 static const struct hda_fixup alc262_fixups[] = {
2603 [ALC262_FIXUP_FSC_H270] = {
2604 .type = HDA_FIXUP_PINS,
2605 .v.pins = (const struct hda_pintbl[]) {
2606 { 0x14, 0x99130110 }, /* speaker */
2607 { 0x15, 0x0221142f }, /* front HP */
2608 { 0x1b, 0x0121141f }, /* rear HP */
2612 [ALC262_FIXUP_FSC_S7110] = {
2613 .type = HDA_FIXUP_PINS,
2614 .v.pins = (const struct hda_pintbl[]) {
2615 { 0x15, 0x90170110 }, /* speaker */
2618 .chained = true,
2619 .chain_id = ALC262_FIXUP_BENQ,
2621 [ALC262_FIXUP_HP_Z200] = {
2622 .type = HDA_FIXUP_PINS,
2623 .v.pins = (const struct hda_pintbl[]) {
2624 { 0x16, 0x99130120 }, /* internal speaker */
2628 [ALC262_FIXUP_TYAN] = {
2629 .type = HDA_FIXUP_PINS,
2630 .v.pins = (const struct hda_pintbl[]) {
2631 { 0x14, 0x1993e1f0 }, /* int AUX */
2635 [ALC262_FIXUP_LENOVO_3000] = {
2636 .type = HDA_FIXUP_PINCTLS,
2637 .v.pins = (const struct hda_pintbl[]) {
2638 { 0x19, PIN_VREF50 },
2641 .chained = true,
2642 .chain_id = ALC262_FIXUP_BENQ,
2644 [ALC262_FIXUP_BENQ] = {
2645 .type = HDA_FIXUP_VERBS,
2646 .v.verbs = (const struct hda_verb[]) {
2647 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2648 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2652 [ALC262_FIXUP_BENQ_T31] = {
2653 .type = HDA_FIXUP_VERBS,
2654 .v.verbs = (const struct hda_verb[]) {
2655 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2656 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2660 [ALC262_FIXUP_INV_DMIC] = {
2661 .type = HDA_FIXUP_FUNC,
2662 .v.func = alc_fixup_inv_dmic,
2664 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2665 .type = HDA_FIXUP_FUNC,
2666 .v.func = alc_fixup_no_depop_delay,
2670 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2671 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2672 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2673 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2674 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2675 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2676 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2677 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2678 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2679 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2680 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2684 static const struct hda_model_fixup alc262_fixup_models[] = {
2685 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2686 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2687 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2688 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2689 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2690 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2691 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2692 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2693 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2699 static int patch_alc262(struct hda_codec *codec)
2701 struct alc_spec *spec;
2702 int err;
2704 err = alc_alloc_spec(codec, 0x0b);
2705 if (err < 0)
2706 return err;
2708 spec = codec->spec;
2709 spec->gen.shared_mic_vref_pin = 0x18;
2711 spec->shutup = alc_eapd_shutup;
2713 #if 0
2714 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2715 * under-run
2717 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2718 #endif
2719 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2721 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2722 alc262_fixups);
2723 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2725 alc_auto_parse_customize_define(codec);
2727 if (has_cdefine_beep(codec))
2728 spec->gen.beep_nid = 0x01;
2730 /* automatic parse from the BIOS config */
2731 err = alc262_parse_auto_config(codec);
2732 if (err < 0)
2733 goto error;
2735 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2736 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2737 if (err < 0)
2738 goto error;
2741 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2743 return 0;
2745 error:
2746 alc_free(codec);
2747 return err;
2751 * ALC268
2753 /* bind Beep switches of both NID 0x0f and 0x10 */
2754 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2755 struct snd_ctl_elem_value *ucontrol)
2757 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2758 unsigned long pval;
2759 int err;
2761 mutex_lock(&codec->control_mutex);
2762 pval = kcontrol->private_value;
2763 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2764 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2765 if (err >= 0) {
2766 kcontrol->private_value = (pval & ~0xff) | 0x10;
2767 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2769 kcontrol->private_value = pval;
2770 mutex_unlock(&codec->control_mutex);
2771 return err;
2774 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2775 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2777 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2778 .name = "Beep Playback Switch",
2779 .subdevice = HDA_SUBDEV_AMP_FLAG,
2780 .info = snd_hda_mixer_amp_switch_info,
2781 .get = snd_hda_mixer_amp_switch_get,
2782 .put = alc268_beep_switch_put,
2783 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2787 /* set PCBEEP vol = 0, mute connections */
2788 static const struct hda_verb alc268_beep_init_verbs[] = {
2789 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2790 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2791 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2795 enum {
2796 ALC268_FIXUP_INV_DMIC,
2797 ALC268_FIXUP_HP_EAPD,
2798 ALC268_FIXUP_SPDIF,
2801 static const struct hda_fixup alc268_fixups[] = {
2802 [ALC268_FIXUP_INV_DMIC] = {
2803 .type = HDA_FIXUP_FUNC,
2804 .v.func = alc_fixup_inv_dmic,
2806 [ALC268_FIXUP_HP_EAPD] = {
2807 .type = HDA_FIXUP_VERBS,
2808 .v.verbs = (const struct hda_verb[]) {
2809 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2813 [ALC268_FIXUP_SPDIF] = {
2814 .type = HDA_FIXUP_PINS,
2815 .v.pins = (const struct hda_pintbl[]) {
2816 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2822 static const struct hda_model_fixup alc268_fixup_models[] = {
2823 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2824 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2825 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
2829 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2830 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2831 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2832 /* below is codec SSID since multiple Toshiba laptops have the
2833 * same PCI SSID 1179:ff00
2835 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2840 * BIOS auto configuration
2842 static int alc268_parse_auto_config(struct hda_codec *codec)
2844 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2845 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2850 static int patch_alc268(struct hda_codec *codec)
2852 struct alc_spec *spec;
2853 int i, err;
2855 /* ALC268 has no aa-loopback mixer */
2856 err = alc_alloc_spec(codec, 0);
2857 if (err < 0)
2858 return err;
2860 spec = codec->spec;
2861 spec->gen.beep_nid = 0x01;
2863 spec->shutup = alc_eapd_shutup;
2865 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2866 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2868 /* automatic parse from the BIOS config */
2869 err = alc268_parse_auto_config(codec);
2870 if (err < 0)
2871 goto error;
2873 if (err > 0 && !spec->gen.no_analog &&
2874 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2875 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2876 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2877 &alc268_beep_mixer[i])) {
2878 err = -ENOMEM;
2879 goto error;
2882 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2883 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2884 /* override the amp caps for beep generator */
2885 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2886 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2887 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2888 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2889 (0 << AC_AMPCAP_MUTE_SHIFT));
2892 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2894 return 0;
2896 error:
2897 alc_free(codec);
2898 return err;
2902 * ALC269
2905 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2906 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2909 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2910 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2913 /* different alc269-variants */
2914 enum {
2915 ALC269_TYPE_ALC269VA,
2916 ALC269_TYPE_ALC269VB,
2917 ALC269_TYPE_ALC269VC,
2918 ALC269_TYPE_ALC269VD,
2919 ALC269_TYPE_ALC280,
2920 ALC269_TYPE_ALC282,
2921 ALC269_TYPE_ALC283,
2922 ALC269_TYPE_ALC284,
2923 ALC269_TYPE_ALC293,
2924 ALC269_TYPE_ALC286,
2925 ALC269_TYPE_ALC298,
2926 ALC269_TYPE_ALC255,
2927 ALC269_TYPE_ALC256,
2928 ALC269_TYPE_ALC257,
2929 ALC269_TYPE_ALC215,
2930 ALC269_TYPE_ALC225,
2931 ALC269_TYPE_ALC294,
2932 ALC269_TYPE_ALC300,
2933 ALC269_TYPE_ALC623,
2934 ALC269_TYPE_ALC700,
2938 * BIOS auto configuration
2940 static int alc269_parse_auto_config(struct hda_codec *codec)
2942 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
2943 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2944 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2945 struct alc_spec *spec = codec->spec;
2946 const hda_nid_t *ssids;
2948 switch (spec->codec_variant) {
2949 case ALC269_TYPE_ALC269VA:
2950 case ALC269_TYPE_ALC269VC:
2951 case ALC269_TYPE_ALC280:
2952 case ALC269_TYPE_ALC284:
2953 case ALC269_TYPE_ALC293:
2954 ssids = alc269va_ssids;
2955 break;
2956 case ALC269_TYPE_ALC269VB:
2957 case ALC269_TYPE_ALC269VD:
2958 case ALC269_TYPE_ALC282:
2959 case ALC269_TYPE_ALC283:
2960 case ALC269_TYPE_ALC286:
2961 case ALC269_TYPE_ALC298:
2962 case ALC269_TYPE_ALC255:
2963 case ALC269_TYPE_ALC256:
2964 case ALC269_TYPE_ALC257:
2965 case ALC269_TYPE_ALC215:
2966 case ALC269_TYPE_ALC225:
2967 case ALC269_TYPE_ALC294:
2968 case ALC269_TYPE_ALC300:
2969 case ALC269_TYPE_ALC623:
2970 case ALC269_TYPE_ALC700:
2971 ssids = alc269_ssids;
2972 break;
2973 default:
2974 ssids = alc269_ssids;
2975 break;
2978 return alc_parse_auto_config(codec, alc269_ignore, ssids);
2981 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2983 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
2986 static void alc269_shutup(struct hda_codec *codec)
2988 struct alc_spec *spec = codec->spec;
2990 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2991 alc269vb_toggle_power_output(codec, 0);
2992 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2993 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
2994 msleep(150);
2996 alc_shutup_pins(codec);
2999 static struct coef_fw alc282_coefs[] = {
3000 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3001 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3002 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3003 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3004 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3005 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3006 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3007 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3008 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3009 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3010 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3011 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3012 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3013 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3014 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3015 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3016 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3017 WRITE_COEF(0x63, 0x2902), /* PLL */
3018 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3019 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3020 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3021 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3022 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3023 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3024 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3025 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3026 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3027 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3028 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3032 static void alc282_restore_default_value(struct hda_codec *codec)
3034 alc_process_coef_fw(codec, alc282_coefs);
3037 static void alc282_init(struct hda_codec *codec)
3039 struct alc_spec *spec = codec->spec;
3040 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3041 bool hp_pin_sense;
3042 int coef78;
3044 alc282_restore_default_value(codec);
3046 if (!hp_pin)
3047 return;
3048 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3049 coef78 = alc_read_coef_idx(codec, 0x78);
3051 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3052 /* Headphone capless set to high power mode */
3053 alc_write_coef_idx(codec, 0x78, 0x9004);
3055 if (hp_pin_sense)
3056 msleep(2);
3058 snd_hda_codec_write(codec, hp_pin, 0,
3059 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3061 if (hp_pin_sense)
3062 msleep(85);
3064 snd_hda_codec_write(codec, hp_pin, 0,
3065 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3067 if (hp_pin_sense)
3068 msleep(100);
3070 /* Headphone capless set to normal mode */
3071 alc_write_coef_idx(codec, 0x78, coef78);
3074 static void alc282_shutup(struct hda_codec *codec)
3076 struct alc_spec *spec = codec->spec;
3077 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3078 bool hp_pin_sense;
3079 int coef78;
3081 if (!hp_pin) {
3082 alc269_shutup(codec);
3083 return;
3086 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3087 coef78 = alc_read_coef_idx(codec, 0x78);
3088 alc_write_coef_idx(codec, 0x78, 0x9004);
3090 if (hp_pin_sense)
3091 msleep(2);
3093 snd_hda_codec_write(codec, hp_pin, 0,
3094 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3096 if (hp_pin_sense)
3097 msleep(85);
3099 if (!spec->no_shutup_pins)
3100 snd_hda_codec_write(codec, hp_pin, 0,
3101 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3103 if (hp_pin_sense)
3104 msleep(100);
3106 alc_auto_setup_eapd(codec, false);
3107 alc_shutup_pins(codec);
3108 alc_write_coef_idx(codec, 0x78, coef78);
3111 static struct coef_fw alc283_coefs[] = {
3112 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3113 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3114 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3115 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3116 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3117 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3118 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3119 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3120 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3121 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3122 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3123 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3124 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3125 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3126 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3127 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3128 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3129 WRITE_COEF(0x2e, 0x2902), /* PLL */
3130 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3131 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3132 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3133 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3134 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3135 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3136 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3137 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3138 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3139 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3140 WRITE_COEF(0x49, 0x0), /* test mode */
3141 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3142 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3143 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3144 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3148 static void alc283_restore_default_value(struct hda_codec *codec)
3150 alc_process_coef_fw(codec, alc283_coefs);
3153 static void alc283_init(struct hda_codec *codec)
3155 struct alc_spec *spec = codec->spec;
3156 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3157 bool hp_pin_sense;
3159 alc283_restore_default_value(codec);
3161 if (!hp_pin)
3162 return;
3164 msleep(30);
3165 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3167 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3168 /* Headphone capless set to high power mode */
3169 alc_write_coef_idx(codec, 0x43, 0x9004);
3171 snd_hda_codec_write(codec, hp_pin, 0,
3172 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3174 if (hp_pin_sense)
3175 msleep(85);
3177 snd_hda_codec_write(codec, hp_pin, 0,
3178 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3180 if (hp_pin_sense)
3181 msleep(85);
3182 /* Index 0x46 Combo jack auto switch control 2 */
3183 /* 3k pull low control for Headset jack. */
3184 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3185 /* Headphone capless set to normal mode */
3186 alc_write_coef_idx(codec, 0x43, 0x9614);
3189 static void alc283_shutup(struct hda_codec *codec)
3191 struct alc_spec *spec = codec->spec;
3192 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3193 bool hp_pin_sense;
3195 if (!hp_pin) {
3196 alc269_shutup(codec);
3197 return;
3200 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3202 alc_write_coef_idx(codec, 0x43, 0x9004);
3204 /*depop hp during suspend*/
3205 alc_write_coef_idx(codec, 0x06, 0x2100);
3207 snd_hda_codec_write(codec, hp_pin, 0,
3208 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3210 if (hp_pin_sense)
3211 msleep(100);
3213 if (!spec->no_shutup_pins)
3214 snd_hda_codec_write(codec, hp_pin, 0,
3215 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3217 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3219 if (hp_pin_sense)
3220 msleep(100);
3221 alc_auto_setup_eapd(codec, false);
3222 alc_shutup_pins(codec);
3223 alc_write_coef_idx(codec, 0x43, 0x9614);
3226 static void alc256_init(struct hda_codec *codec)
3228 struct alc_spec *spec = codec->spec;
3229 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3230 bool hp_pin_sense;
3232 if (!hp_pin)
3233 return;
3235 msleep(30);
3237 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3239 if (hp_pin_sense)
3240 msleep(2);
3242 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3244 snd_hda_codec_write(codec, hp_pin, 0,
3245 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3247 if (hp_pin_sense)
3248 msleep(85);
3250 snd_hda_codec_write(codec, hp_pin, 0,
3251 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3253 if (hp_pin_sense)
3254 msleep(100);
3256 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3257 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3258 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3259 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3261 * Expose headphone mic (or possibly Line In on some machines) instead
3262 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3263 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3264 * this register.
3266 alc_write_coef_idx(codec, 0x36, 0x5757);
3269 static void alc256_shutup(struct hda_codec *codec)
3271 struct alc_spec *spec = codec->spec;
3272 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3273 bool hp_pin_sense;
3275 if (!hp_pin) {
3276 alc269_shutup(codec);
3277 return;
3280 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3282 if (hp_pin_sense)
3283 msleep(2);
3285 snd_hda_codec_write(codec, hp_pin, 0,
3286 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3288 if (hp_pin_sense)
3289 msleep(85);
3291 /* 3k pull low control for Headset jack. */
3292 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3293 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3295 if (!spec->no_shutup_pins)
3296 snd_hda_codec_write(codec, hp_pin, 0,
3297 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3299 if (hp_pin_sense)
3300 msleep(100);
3302 alc_auto_setup_eapd(codec, false);
3303 alc_shutup_pins(codec);
3306 static void alc225_init(struct hda_codec *codec)
3308 struct alc_spec *spec = codec->spec;
3309 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3310 bool hp1_pin_sense, hp2_pin_sense;
3312 if (!hp_pin)
3313 return;
3315 msleep(30);
3317 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3318 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3320 if (hp1_pin_sense || hp2_pin_sense)
3321 msleep(2);
3323 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3325 if (hp1_pin_sense)
3326 snd_hda_codec_write(codec, hp_pin, 0,
3327 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3328 if (hp2_pin_sense)
3329 snd_hda_codec_write(codec, 0x16, 0,
3330 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3332 if (hp1_pin_sense || hp2_pin_sense)
3333 msleep(85);
3335 if (hp1_pin_sense)
3336 snd_hda_codec_write(codec, hp_pin, 0,
3337 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3338 if (hp2_pin_sense)
3339 snd_hda_codec_write(codec, 0x16, 0,
3340 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3342 if (hp1_pin_sense || hp2_pin_sense)
3343 msleep(100);
3345 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3346 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3349 static void alc225_shutup(struct hda_codec *codec)
3351 struct alc_spec *spec = codec->spec;
3352 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3353 bool hp1_pin_sense, hp2_pin_sense;
3355 if (!hp_pin) {
3356 alc269_shutup(codec);
3357 return;
3360 /* 3k pull low control for Headset jack. */
3361 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3363 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3364 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3366 if (hp1_pin_sense || hp2_pin_sense)
3367 msleep(2);
3369 if (hp1_pin_sense)
3370 snd_hda_codec_write(codec, hp_pin, 0,
3371 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3372 if (hp2_pin_sense)
3373 snd_hda_codec_write(codec, 0x16, 0,
3374 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3376 if (hp1_pin_sense || hp2_pin_sense)
3377 msleep(85);
3379 if (hp1_pin_sense)
3380 snd_hda_codec_write(codec, hp_pin, 0,
3381 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3382 if (hp2_pin_sense)
3383 snd_hda_codec_write(codec, 0x16, 0,
3384 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3386 if (hp1_pin_sense || hp2_pin_sense)
3387 msleep(100);
3389 alc_auto_setup_eapd(codec, false);
3390 alc_shutup_pins(codec);
3393 static void alc_default_init(struct hda_codec *codec)
3395 struct alc_spec *spec = codec->spec;
3396 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3397 bool hp_pin_sense;
3399 if (!hp_pin)
3400 return;
3402 msleep(30);
3404 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3406 if (hp_pin_sense)
3407 msleep(2);
3409 snd_hda_codec_write(codec, hp_pin, 0,
3410 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3412 if (hp_pin_sense)
3413 msleep(85);
3415 snd_hda_codec_write(codec, hp_pin, 0,
3416 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3418 if (hp_pin_sense)
3419 msleep(100);
3422 static void alc_default_shutup(struct hda_codec *codec)
3424 struct alc_spec *spec = codec->spec;
3425 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3426 bool hp_pin_sense;
3428 if (!hp_pin) {
3429 alc269_shutup(codec);
3430 return;
3433 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3435 if (hp_pin_sense)
3436 msleep(2);
3438 snd_hda_codec_write(codec, hp_pin, 0,
3439 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3441 if (hp_pin_sense)
3442 msleep(85);
3444 if (!spec->no_shutup_pins)
3445 snd_hda_codec_write(codec, hp_pin, 0,
3446 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3448 if (hp_pin_sense)
3449 msleep(100);
3451 alc_auto_setup_eapd(codec, false);
3452 alc_shutup_pins(codec);
3455 static void alc294_hp_init(struct hda_codec *codec)
3457 struct alc_spec *spec = codec->spec;
3458 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3459 int i, val;
3461 if (!hp_pin)
3462 return;
3464 snd_hda_codec_write(codec, hp_pin, 0,
3465 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3467 msleep(100);
3469 if (!spec->no_shutup_pins)
3470 snd_hda_codec_write(codec, hp_pin, 0,
3471 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3473 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3474 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3476 /* Wait for depop procedure finish */
3477 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3478 for (i = 0; i < 20 && val & 0x0080; i++) {
3479 msleep(50);
3480 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3482 /* Set HP depop to auto mode */
3483 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3484 msleep(50);
3487 static void alc294_init(struct hda_codec *codec)
3489 struct alc_spec *spec = codec->spec;
3491 /* required only at boot or S4 resume time */
3492 if (!spec->done_hp_init ||
3493 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3494 alc294_hp_init(codec);
3495 spec->done_hp_init = true;
3497 alc_default_init(codec);
3500 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3501 unsigned int val)
3503 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3504 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3505 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3508 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3510 unsigned int val;
3512 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3513 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3514 & 0xffff;
3515 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3516 << 16;
3517 return val;
3520 static void alc5505_dsp_halt(struct hda_codec *codec)
3522 unsigned int val;
3524 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3525 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3526 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3527 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3528 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3529 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3530 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3531 val = alc5505_coef_get(codec, 0x6220);
3532 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3535 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3537 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3538 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3539 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3540 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3541 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3542 alc5505_coef_set(codec, 0x880c, 0x00000004);
3545 static void alc5505_dsp_init(struct hda_codec *codec)
3547 unsigned int val;
3549 alc5505_dsp_halt(codec);
3550 alc5505_dsp_back_from_halt(codec);
3551 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3552 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3553 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3554 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3555 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3556 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3557 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3558 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3559 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3560 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3561 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3562 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3563 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3565 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3566 if (val <= 3)
3567 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3568 else
3569 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3571 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3572 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3573 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3574 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3575 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3576 alc5505_coef_set(codec, 0x880c, 0x00000003);
3577 alc5505_coef_set(codec, 0x880c, 0x00000010);
3579 #ifdef HALT_REALTEK_ALC5505
3580 alc5505_dsp_halt(codec);
3581 #endif
3584 #ifdef HALT_REALTEK_ALC5505
3585 #define alc5505_dsp_suspend(codec) /* NOP */
3586 #define alc5505_dsp_resume(codec) /* NOP */
3587 #else
3588 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3589 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3590 #endif
3592 #ifdef CONFIG_PM
3593 static int alc269_suspend(struct hda_codec *codec)
3595 struct alc_spec *spec = codec->spec;
3597 if (spec->has_alc5505_dsp)
3598 alc5505_dsp_suspend(codec);
3599 return alc_suspend(codec);
3602 static int alc269_resume(struct hda_codec *codec)
3604 struct alc_spec *spec = codec->spec;
3606 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3607 alc269vb_toggle_power_output(codec, 0);
3608 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3609 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3610 msleep(150);
3613 codec->patch_ops.init(codec);
3615 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3616 alc269vb_toggle_power_output(codec, 1);
3617 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3618 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3619 msleep(200);
3622 regcache_sync(codec->core.regmap);
3623 hda_call_check_power_status(codec, 0x01);
3625 /* on some machine, the BIOS will clear the codec gpio data when enter
3626 * suspend, and won't restore the data after resume, so we restore it
3627 * in the driver.
3629 if (spec->gpio_data)
3630 alc_write_gpio_data(codec);
3632 if (spec->has_alc5505_dsp)
3633 alc5505_dsp_resume(codec);
3635 return 0;
3637 #endif /* CONFIG_PM */
3639 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3640 const struct hda_fixup *fix, int action)
3642 struct alc_spec *spec = codec->spec;
3644 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3645 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3648 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3649 const struct hda_fixup *fix,
3650 int action)
3652 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3653 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3655 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3656 snd_hda_codec_set_pincfg(codec, 0x19,
3657 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3658 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3661 static void alc269_fixup_hweq(struct hda_codec *codec,
3662 const struct hda_fixup *fix, int action)
3664 if (action == HDA_FIXUP_ACT_INIT)
3665 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3668 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3669 const struct hda_fixup *fix, int action)
3671 struct alc_spec *spec = codec->spec;
3673 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3674 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3677 static void alc271_fixup_dmic(struct hda_codec *codec,
3678 const struct hda_fixup *fix, int action)
3680 static const struct hda_verb verbs[] = {
3681 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3682 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3685 unsigned int cfg;
3687 if (strcmp(codec->core.chip_name, "ALC271X") &&
3688 strcmp(codec->core.chip_name, "ALC269VB"))
3689 return;
3690 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3691 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3692 snd_hda_sequence_write(codec, verbs);
3695 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3696 const struct hda_fixup *fix, int action)
3698 struct alc_spec *spec = codec->spec;
3700 if (action != HDA_FIXUP_ACT_PROBE)
3701 return;
3703 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3704 * fix the sample rate of analog I/O to 44.1kHz
3706 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3707 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3710 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3711 const struct hda_fixup *fix, int action)
3713 /* The digital-mic unit sends PDM (differential signal) instead of
3714 * the standard PCM, thus you can't record a valid mono stream as is.
3715 * Below is a workaround specific to ALC269 to control the dmic
3716 * signal source as mono.
3718 if (action == HDA_FIXUP_ACT_INIT)
3719 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3722 static void alc269_quanta_automute(struct hda_codec *codec)
3724 snd_hda_gen_update_outputs(codec);
3726 alc_write_coef_idx(codec, 0x0c, 0x680);
3727 alc_write_coef_idx(codec, 0x0c, 0x480);
3730 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3731 const struct hda_fixup *fix, int action)
3733 struct alc_spec *spec = codec->spec;
3734 if (action != HDA_FIXUP_ACT_PROBE)
3735 return;
3736 spec->gen.automute_hook = alc269_quanta_automute;
3739 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3740 struct hda_jack_callback *jack)
3742 struct alc_spec *spec = codec->spec;
3743 int vref;
3744 msleep(200);
3745 snd_hda_gen_hp_automute(codec, jack);
3747 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3748 msleep(100);
3749 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3750 vref);
3751 msleep(500);
3752 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3753 vref);
3756 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3757 const struct hda_fixup *fix, int action)
3759 struct alc_spec *spec = codec->spec;
3760 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3761 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3762 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3767 /* update mute-LED according to the speaker mute state via mic VREF pin */
3768 static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
3770 struct hda_codec *codec = private_data;
3771 struct alc_spec *spec = codec->spec;
3772 unsigned int pinval;
3774 if (spec->mute_led_polarity)
3775 enabled = !enabled;
3776 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3777 pinval &= ~AC_PINCTL_VREFEN;
3778 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
3779 if (spec->mute_led_nid) {
3780 /* temporarily power up/down for setting VREF */
3781 snd_hda_power_up_pm(codec);
3782 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
3783 snd_hda_power_down_pm(codec);
3787 /* Make sure the led works even in runtime suspend */
3788 static unsigned int led_power_filter(struct hda_codec *codec,
3789 hda_nid_t nid,
3790 unsigned int power_state)
3792 struct alc_spec *spec = codec->spec;
3794 if (power_state != AC_PWRST_D3 || nid == 0 ||
3795 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
3796 return power_state;
3798 /* Set pin ctl again, it might have just been set to 0 */
3799 snd_hda_set_pin_ctl(codec, nid,
3800 snd_hda_codec_get_pin_target(codec, nid));
3802 return snd_hda_gen_path_power_filter(codec, nid, power_state);
3805 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3806 const struct hda_fixup *fix, int action)
3808 struct alc_spec *spec = codec->spec;
3809 const struct dmi_device *dev = NULL;
3811 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3812 return;
3814 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3815 int pol, pin;
3816 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3817 continue;
3818 if (pin < 0x0a || pin >= 0x10)
3819 break;
3820 spec->mute_led_polarity = pol;
3821 spec->mute_led_nid = pin - 0x0a + 0x18;
3822 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3823 spec->gen.vmaster_mute_enum = 1;
3824 codec->power_filter = led_power_filter;
3825 codec_dbg(codec,
3826 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
3827 spec->mute_led_polarity);
3828 break;
3832 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
3833 const struct hda_fixup *fix,
3834 int action, hda_nid_t pin)
3836 struct alc_spec *spec = codec->spec;
3838 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3839 spec->mute_led_polarity = 0;
3840 spec->mute_led_nid = pin;
3841 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3842 spec->gen.vmaster_mute_enum = 1;
3843 codec->power_filter = led_power_filter;
3847 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3848 const struct hda_fixup *fix, int action)
3850 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
3853 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3854 const struct hda_fixup *fix, int action)
3856 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
3859 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
3860 const struct hda_fixup *fix, int action)
3862 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
3865 /* update LED status via GPIO */
3866 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3867 int polarity, bool enabled)
3869 if (polarity)
3870 enabled = !enabled;
3871 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
3874 /* turn on/off mute LED via GPIO per vmaster hook */
3875 static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3877 struct hda_codec *codec = private_data;
3878 struct alc_spec *spec = codec->spec;
3880 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
3881 spec->mute_led_polarity, enabled);
3884 /* turn on/off mic-mute LED via GPIO per capture hook */
3885 static void alc_gpio_micmute_update(struct hda_codec *codec)
3887 struct alc_spec *spec = codec->spec;
3889 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3890 spec->micmute_led_polarity,
3891 spec->gen.micmute_led.led_value);
3894 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
3895 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
3896 int action,
3897 unsigned int mute_mask,
3898 unsigned int micmute_mask)
3900 struct alc_spec *spec = codec->spec;
3902 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
3904 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3905 return;
3906 if (mute_mask) {
3907 spec->gpio_mute_led_mask = mute_mask;
3908 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3910 if (micmute_mask) {
3911 spec->gpio_mic_led_mask = micmute_mask;
3912 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
3916 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3917 const struct hda_fixup *fix, int action)
3919 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
3922 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
3923 const struct hda_fixup *fix, int action)
3925 struct alc_spec *spec = codec->spec;
3927 spec->micmute_led_polarity = 1;
3929 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
3932 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3933 const struct hda_fixup *fix, int action)
3935 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
3938 /* turn on/off mic-mute LED per capture hook */
3939 static void alc_cap_micmute_update(struct hda_codec *codec)
3941 struct alc_spec *spec = codec->spec;
3942 unsigned int pinval;
3944 if (!spec->cap_mute_led_nid)
3945 return;
3946 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
3947 pinval &= ~AC_PINCTL_VREFEN;
3948 if (spec->gen.micmute_led.led_value)
3949 pinval |= AC_PINCTL_VREF_80;
3950 else
3951 pinval |= AC_PINCTL_VREF_HIZ;
3952 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3955 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3956 const struct hda_fixup *fix, int action)
3958 struct alc_spec *spec = codec->spec;
3960 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
3961 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3962 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
3963 * enable headphone amp
3965 spec->gpio_mask |= 0x10;
3966 spec->gpio_dir |= 0x10;
3967 spec->cap_mute_led_nid = 0x18;
3968 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
3969 codec->power_filter = led_power_filter;
3973 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3974 const struct hda_fixup *fix, int action)
3976 struct alc_spec *spec = codec->spec;
3978 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
3979 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3980 spec->cap_mute_led_nid = 0x18;
3981 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
3982 codec->power_filter = led_power_filter;
3986 #if IS_REACHABLE(CONFIG_INPUT)
3987 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3988 struct hda_jack_callback *event)
3990 struct alc_spec *spec = codec->spec;
3992 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3993 send both key on and key off event for every interrupt. */
3994 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
3995 input_sync(spec->kb_dev);
3996 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
3997 input_sync(spec->kb_dev);
4000 static int alc_register_micmute_input_device(struct hda_codec *codec)
4002 struct alc_spec *spec = codec->spec;
4003 int i;
4005 spec->kb_dev = input_allocate_device();
4006 if (!spec->kb_dev) {
4007 codec_err(codec, "Out of memory (input_allocate_device)\n");
4008 return -ENOMEM;
4011 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4013 spec->kb_dev->name = "Microphone Mute Button";
4014 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4015 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4016 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4017 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4018 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4019 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4021 if (input_register_device(spec->kb_dev)) {
4022 codec_err(codec, "input_register_device failed\n");
4023 input_free_device(spec->kb_dev);
4024 spec->kb_dev = NULL;
4025 return -ENOMEM;
4028 return 0;
4031 /* GPIO1 = set according to SKU external amp
4032 * GPIO2 = mic mute hotkey
4033 * GPIO3 = mute LED
4034 * GPIO4 = mic mute LED
4036 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4037 const struct hda_fixup *fix, int action)
4039 struct alc_spec *spec = codec->spec;
4041 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4042 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4043 spec->init_amp = ALC_INIT_DEFAULT;
4044 if (alc_register_micmute_input_device(codec) != 0)
4045 return;
4047 spec->gpio_mask |= 0x06;
4048 spec->gpio_dir |= 0x02;
4049 spec->gpio_data |= 0x02;
4050 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4051 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4052 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4053 gpio2_mic_hotkey_event);
4054 return;
4057 if (!spec->kb_dev)
4058 return;
4060 switch (action) {
4061 case HDA_FIXUP_ACT_FREE:
4062 input_unregister_device(spec->kb_dev);
4063 spec->kb_dev = NULL;
4067 /* Line2 = mic mute hotkey
4068 * GPIO2 = mic mute LED
4070 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4071 const struct hda_fixup *fix, int action)
4073 struct alc_spec *spec = codec->spec;
4075 spec->micmute_led_polarity = 1;
4076 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4077 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4078 spec->init_amp = ALC_INIT_DEFAULT;
4079 if (alc_register_micmute_input_device(codec) != 0)
4080 return;
4082 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4083 gpio2_mic_hotkey_event);
4084 return;
4087 if (!spec->kb_dev)
4088 return;
4090 switch (action) {
4091 case HDA_FIXUP_ACT_FREE:
4092 input_unregister_device(spec->kb_dev);
4093 spec->kb_dev = NULL;
4096 #else /* INPUT */
4097 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4098 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4099 #endif /* INPUT */
4101 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4102 const struct hda_fixup *fix, int action)
4104 struct alc_spec *spec = codec->spec;
4106 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4107 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4108 spec->cap_mute_led_nid = 0x18;
4109 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
4113 static struct coef_fw alc225_pre_hsmode[] = {
4114 UPDATE_COEF(0x4a, 1<<8, 0),
4115 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4116 UPDATE_COEF(0x63, 3<<14, 3<<14),
4117 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4118 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4119 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4120 UPDATE_COEF(0x4a, 3<<10, 0),
4124 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4126 static struct coef_fw coef0255[] = {
4127 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4128 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4129 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4130 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4131 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4134 static struct coef_fw coef0256[] = {
4135 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4136 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4137 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4138 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4139 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4142 static struct coef_fw coef0233[] = {
4143 WRITE_COEF(0x1b, 0x0c0b),
4144 WRITE_COEF(0x45, 0xc429),
4145 UPDATE_COEF(0x35, 0x4000, 0),
4146 WRITE_COEF(0x06, 0x2104),
4147 WRITE_COEF(0x1a, 0x0001),
4148 WRITE_COEF(0x26, 0x0004),
4149 WRITE_COEF(0x32, 0x42a3),
4152 static struct coef_fw coef0288[] = {
4153 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4154 UPDATE_COEF(0x50, 0x2000, 0x2000),
4155 UPDATE_COEF(0x56, 0x0006, 0x0006),
4156 UPDATE_COEF(0x66, 0x0008, 0),
4157 UPDATE_COEF(0x67, 0x2000, 0),
4160 static struct coef_fw coef0298[] = {
4161 UPDATE_COEF(0x19, 0x1300, 0x0300),
4164 static struct coef_fw coef0292[] = {
4165 WRITE_COEF(0x76, 0x000e),
4166 WRITE_COEF(0x6c, 0x2400),
4167 WRITE_COEF(0x18, 0x7308),
4168 WRITE_COEF(0x6b, 0xc429),
4171 static struct coef_fw coef0293[] = {
4172 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4173 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4174 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4175 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4176 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4177 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4180 static struct coef_fw coef0668[] = {
4181 WRITE_COEF(0x15, 0x0d40),
4182 WRITE_COEF(0xb7, 0x802b),
4185 static struct coef_fw coef0225[] = {
4186 UPDATE_COEF(0x63, 3<<14, 0),
4189 static struct coef_fw coef0274[] = {
4190 UPDATE_COEF(0x4a, 0x0100, 0),
4191 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4192 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4193 UPDATE_COEF(0x4a, 0x0010, 0),
4194 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4195 WRITE_COEF(0x45, 0x5289),
4196 UPDATE_COEF(0x4a, 0x0c00, 0),
4200 switch (codec->core.vendor_id) {
4201 case 0x10ec0255:
4202 alc_process_coef_fw(codec, coef0255);
4203 break;
4204 case 0x10ec0236:
4205 case 0x10ec0256:
4206 alc_process_coef_fw(codec, coef0256);
4207 break;
4208 case 0x10ec0234:
4209 case 0x10ec0274:
4210 case 0x10ec0294:
4211 alc_process_coef_fw(codec, coef0274);
4212 break;
4213 case 0x10ec0233:
4214 case 0x10ec0283:
4215 alc_process_coef_fw(codec, coef0233);
4216 break;
4217 case 0x10ec0286:
4218 case 0x10ec0288:
4219 alc_process_coef_fw(codec, coef0288);
4220 break;
4221 case 0x10ec0298:
4222 alc_process_coef_fw(codec, coef0298);
4223 alc_process_coef_fw(codec, coef0288);
4224 break;
4225 case 0x10ec0292:
4226 alc_process_coef_fw(codec, coef0292);
4227 break;
4228 case 0x10ec0293:
4229 alc_process_coef_fw(codec, coef0293);
4230 break;
4231 case 0x10ec0668:
4232 alc_process_coef_fw(codec, coef0668);
4233 break;
4234 case 0x10ec0215:
4235 case 0x10ec0225:
4236 case 0x10ec0285:
4237 case 0x10ec0295:
4238 case 0x10ec0289:
4239 case 0x10ec0299:
4240 alc_process_coef_fw(codec, alc225_pre_hsmode);
4241 alc_process_coef_fw(codec, coef0225);
4242 break;
4243 case 0x10ec0867:
4244 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4245 break;
4247 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
4251 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4252 hda_nid_t mic_pin)
4254 static struct coef_fw coef0255[] = {
4255 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4256 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4259 static struct coef_fw coef0256[] = {
4260 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4261 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4262 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4265 static struct coef_fw coef0233[] = {
4266 UPDATE_COEF(0x35, 0, 1<<14),
4267 WRITE_COEF(0x06, 0x2100),
4268 WRITE_COEF(0x1a, 0x0021),
4269 WRITE_COEF(0x26, 0x008c),
4272 static struct coef_fw coef0288[] = {
4273 UPDATE_COEF(0x4f, 0x00c0, 0),
4274 UPDATE_COEF(0x50, 0x2000, 0),
4275 UPDATE_COEF(0x56, 0x0006, 0),
4276 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4277 UPDATE_COEF(0x66, 0x0008, 0x0008),
4278 UPDATE_COEF(0x67, 0x2000, 0x2000),
4281 static struct coef_fw coef0292[] = {
4282 WRITE_COEF(0x19, 0xa208),
4283 WRITE_COEF(0x2e, 0xacf0),
4286 static struct coef_fw coef0293[] = {
4287 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4288 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4289 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4292 static struct coef_fw coef0688[] = {
4293 WRITE_COEF(0xb7, 0x802b),
4294 WRITE_COEF(0xb5, 0x1040),
4295 UPDATE_COEF(0xc3, 0, 1<<12),
4298 static struct coef_fw coef0225[] = {
4299 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4300 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4301 UPDATE_COEF(0x63, 3<<14, 0),
4304 static struct coef_fw coef0274[] = {
4305 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4306 UPDATE_COEF(0x4a, 0x0010, 0),
4307 UPDATE_COEF(0x6b, 0xf000, 0),
4311 switch (codec->core.vendor_id) {
4312 case 0x10ec0255:
4313 alc_write_coef_idx(codec, 0x45, 0xc489);
4314 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4315 alc_process_coef_fw(codec, coef0255);
4316 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4317 break;
4318 case 0x10ec0236:
4319 case 0x10ec0256:
4320 alc_write_coef_idx(codec, 0x45, 0xc489);
4321 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4322 alc_process_coef_fw(codec, coef0256);
4323 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4324 break;
4325 case 0x10ec0234:
4326 case 0x10ec0274:
4327 case 0x10ec0294:
4328 alc_write_coef_idx(codec, 0x45, 0x4689);
4329 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4330 alc_process_coef_fw(codec, coef0274);
4331 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4332 break;
4333 case 0x10ec0233:
4334 case 0x10ec0283:
4335 alc_write_coef_idx(codec, 0x45, 0xc429);
4336 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4337 alc_process_coef_fw(codec, coef0233);
4338 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4339 break;
4340 case 0x10ec0286:
4341 case 0x10ec0288:
4342 case 0x10ec0298:
4343 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4344 alc_process_coef_fw(codec, coef0288);
4345 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4346 break;
4347 case 0x10ec0292:
4348 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4349 alc_process_coef_fw(codec, coef0292);
4350 break;
4351 case 0x10ec0293:
4352 /* Set to TRS mode */
4353 alc_write_coef_idx(codec, 0x45, 0xc429);
4354 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4355 alc_process_coef_fw(codec, coef0293);
4356 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4357 break;
4358 case 0x10ec0867:
4359 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4360 /* fallthru */
4361 case 0x10ec0221:
4362 case 0x10ec0662:
4363 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4364 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4365 break;
4366 case 0x10ec0668:
4367 alc_write_coef_idx(codec, 0x11, 0x0001);
4368 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4369 alc_process_coef_fw(codec, coef0688);
4370 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4371 break;
4372 case 0x10ec0215:
4373 case 0x10ec0225:
4374 case 0x10ec0285:
4375 case 0x10ec0295:
4376 case 0x10ec0289:
4377 case 0x10ec0299:
4378 alc_process_coef_fw(codec, alc225_pre_hsmode);
4379 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4380 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4381 alc_process_coef_fw(codec, coef0225);
4382 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4383 break;
4385 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
4388 static void alc_headset_mode_default(struct hda_codec *codec)
4390 static struct coef_fw coef0225[] = {
4391 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4392 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4393 UPDATE_COEF(0x49, 3<<8, 0<<8),
4394 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4395 UPDATE_COEF(0x63, 3<<14, 0),
4396 UPDATE_COEF(0x67, 0xf000, 0x3000),
4399 static struct coef_fw coef0255[] = {
4400 WRITE_COEF(0x45, 0xc089),
4401 WRITE_COEF(0x45, 0xc489),
4402 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4403 WRITE_COEF(0x49, 0x0049),
4406 static struct coef_fw coef0256[] = {
4407 WRITE_COEF(0x45, 0xc489),
4408 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4409 WRITE_COEF(0x49, 0x0049),
4410 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4411 WRITE_COEF(0x06, 0x6100),
4414 static struct coef_fw coef0233[] = {
4415 WRITE_COEF(0x06, 0x2100),
4416 WRITE_COEF(0x32, 0x4ea3),
4419 static struct coef_fw coef0288[] = {
4420 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4421 UPDATE_COEF(0x50, 0x2000, 0x2000),
4422 UPDATE_COEF(0x56, 0x0006, 0x0006),
4423 UPDATE_COEF(0x66, 0x0008, 0),
4424 UPDATE_COEF(0x67, 0x2000, 0),
4427 static struct coef_fw coef0292[] = {
4428 WRITE_COEF(0x76, 0x000e),
4429 WRITE_COEF(0x6c, 0x2400),
4430 WRITE_COEF(0x6b, 0xc429),
4431 WRITE_COEF(0x18, 0x7308),
4434 static struct coef_fw coef0293[] = {
4435 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4436 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4437 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4440 static struct coef_fw coef0688[] = {
4441 WRITE_COEF(0x11, 0x0041),
4442 WRITE_COEF(0x15, 0x0d40),
4443 WRITE_COEF(0xb7, 0x802b),
4446 static struct coef_fw coef0274[] = {
4447 WRITE_COEF(0x45, 0x4289),
4448 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4449 UPDATE_COEF(0x6b, 0x0f00, 0),
4450 UPDATE_COEF(0x49, 0x0300, 0x0300),
4454 switch (codec->core.vendor_id) {
4455 case 0x10ec0215:
4456 case 0x10ec0225:
4457 case 0x10ec0285:
4458 case 0x10ec0295:
4459 case 0x10ec0289:
4460 case 0x10ec0299:
4461 alc_process_coef_fw(codec, alc225_pre_hsmode);
4462 alc_process_coef_fw(codec, coef0225);
4463 break;
4464 case 0x10ec0255:
4465 alc_process_coef_fw(codec, coef0255);
4466 break;
4467 case 0x10ec0236:
4468 case 0x10ec0256:
4469 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4470 alc_write_coef_idx(codec, 0x45, 0xc089);
4471 msleep(50);
4472 alc_process_coef_fw(codec, coef0256);
4473 break;
4474 case 0x10ec0234:
4475 case 0x10ec0274:
4476 case 0x10ec0294:
4477 alc_process_coef_fw(codec, coef0274);
4478 break;
4479 case 0x10ec0233:
4480 case 0x10ec0283:
4481 alc_process_coef_fw(codec, coef0233);
4482 break;
4483 case 0x10ec0286:
4484 case 0x10ec0288:
4485 case 0x10ec0298:
4486 alc_process_coef_fw(codec, coef0288);
4487 break;
4488 case 0x10ec0292:
4489 alc_process_coef_fw(codec, coef0292);
4490 break;
4491 case 0x10ec0293:
4492 alc_process_coef_fw(codec, coef0293);
4493 break;
4494 case 0x10ec0668:
4495 alc_process_coef_fw(codec, coef0688);
4496 break;
4497 case 0x10ec0867:
4498 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4499 break;
4501 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
4504 /* Iphone type */
4505 static void alc_headset_mode_ctia(struct hda_codec *codec)
4507 int val;
4509 static struct coef_fw coef0255[] = {
4510 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4511 WRITE_COEF(0x1b, 0x0c2b),
4512 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4515 static struct coef_fw coef0256[] = {
4516 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4517 WRITE_COEF(0x1b, 0x0e6b),
4520 static struct coef_fw coef0233[] = {
4521 WRITE_COEF(0x45, 0xd429),
4522 WRITE_COEF(0x1b, 0x0c2b),
4523 WRITE_COEF(0x32, 0x4ea3),
4526 static struct coef_fw coef0288[] = {
4527 UPDATE_COEF(0x50, 0x2000, 0x2000),
4528 UPDATE_COEF(0x56, 0x0006, 0x0006),
4529 UPDATE_COEF(0x66, 0x0008, 0),
4530 UPDATE_COEF(0x67, 0x2000, 0),
4533 static struct coef_fw coef0292[] = {
4534 WRITE_COEF(0x6b, 0xd429),
4535 WRITE_COEF(0x76, 0x0008),
4536 WRITE_COEF(0x18, 0x7388),
4539 static struct coef_fw coef0293[] = {
4540 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4541 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4544 static struct coef_fw coef0688[] = {
4545 WRITE_COEF(0x11, 0x0001),
4546 WRITE_COEF(0x15, 0x0d60),
4547 WRITE_COEF(0xc3, 0x0000),
4550 static struct coef_fw coef0225_1[] = {
4551 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4552 UPDATE_COEF(0x63, 3<<14, 2<<14),
4555 static struct coef_fw coef0225_2[] = {
4556 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4557 UPDATE_COEF(0x63, 3<<14, 1<<14),
4561 switch (codec->core.vendor_id) {
4562 case 0x10ec0255:
4563 alc_process_coef_fw(codec, coef0255);
4564 break;
4565 case 0x10ec0236:
4566 case 0x10ec0256:
4567 alc_process_coef_fw(codec, coef0256);
4568 break;
4569 case 0x10ec0234:
4570 case 0x10ec0274:
4571 case 0x10ec0294:
4572 alc_write_coef_idx(codec, 0x45, 0xd689);
4573 break;
4574 case 0x10ec0233:
4575 case 0x10ec0283:
4576 alc_process_coef_fw(codec, coef0233);
4577 break;
4578 case 0x10ec0298:
4579 val = alc_read_coef_idx(codec, 0x50);
4580 if (val & (1 << 12)) {
4581 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4582 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4583 msleep(300);
4584 } else {
4585 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4586 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4587 msleep(300);
4589 break;
4590 case 0x10ec0286:
4591 case 0x10ec0288:
4592 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4593 msleep(300);
4594 alc_process_coef_fw(codec, coef0288);
4595 break;
4596 case 0x10ec0292:
4597 alc_process_coef_fw(codec, coef0292);
4598 break;
4599 case 0x10ec0293:
4600 alc_process_coef_fw(codec, coef0293);
4601 break;
4602 case 0x10ec0668:
4603 alc_process_coef_fw(codec, coef0688);
4604 break;
4605 case 0x10ec0215:
4606 case 0x10ec0225:
4607 case 0x10ec0285:
4608 case 0x10ec0295:
4609 case 0x10ec0289:
4610 case 0x10ec0299:
4611 val = alc_read_coef_idx(codec, 0x45);
4612 if (val & (1 << 9))
4613 alc_process_coef_fw(codec, coef0225_2);
4614 else
4615 alc_process_coef_fw(codec, coef0225_1);
4616 break;
4617 case 0x10ec0867:
4618 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4619 break;
4621 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
4624 /* Nokia type */
4625 static void alc_headset_mode_omtp(struct hda_codec *codec)
4627 static struct coef_fw coef0255[] = {
4628 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4629 WRITE_COEF(0x1b, 0x0c2b),
4630 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4633 static struct coef_fw coef0256[] = {
4634 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4635 WRITE_COEF(0x1b, 0x0e6b),
4638 static struct coef_fw coef0233[] = {
4639 WRITE_COEF(0x45, 0xe429),
4640 WRITE_COEF(0x1b, 0x0c2b),
4641 WRITE_COEF(0x32, 0x4ea3),
4644 static struct coef_fw coef0288[] = {
4645 UPDATE_COEF(0x50, 0x2000, 0x2000),
4646 UPDATE_COEF(0x56, 0x0006, 0x0006),
4647 UPDATE_COEF(0x66, 0x0008, 0),
4648 UPDATE_COEF(0x67, 0x2000, 0),
4651 static struct coef_fw coef0292[] = {
4652 WRITE_COEF(0x6b, 0xe429),
4653 WRITE_COEF(0x76, 0x0008),
4654 WRITE_COEF(0x18, 0x7388),
4657 static struct coef_fw coef0293[] = {
4658 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4659 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4662 static struct coef_fw coef0688[] = {
4663 WRITE_COEF(0x11, 0x0001),
4664 WRITE_COEF(0x15, 0x0d50),
4665 WRITE_COEF(0xc3, 0x0000),
4668 static struct coef_fw coef0225[] = {
4669 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
4670 UPDATE_COEF(0x63, 3<<14, 2<<14),
4674 switch (codec->core.vendor_id) {
4675 case 0x10ec0255:
4676 alc_process_coef_fw(codec, coef0255);
4677 break;
4678 case 0x10ec0236:
4679 case 0x10ec0256:
4680 alc_process_coef_fw(codec, coef0256);
4681 break;
4682 case 0x10ec0234:
4683 case 0x10ec0274:
4684 case 0x10ec0294:
4685 alc_write_coef_idx(codec, 0x45, 0xe689);
4686 break;
4687 case 0x10ec0233:
4688 case 0x10ec0283:
4689 alc_process_coef_fw(codec, coef0233);
4690 break;
4691 case 0x10ec0298:
4692 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
4693 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4694 msleep(300);
4695 break;
4696 case 0x10ec0286:
4697 case 0x10ec0288:
4698 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4699 msleep(300);
4700 alc_process_coef_fw(codec, coef0288);
4701 break;
4702 case 0x10ec0292:
4703 alc_process_coef_fw(codec, coef0292);
4704 break;
4705 case 0x10ec0293:
4706 alc_process_coef_fw(codec, coef0293);
4707 break;
4708 case 0x10ec0668:
4709 alc_process_coef_fw(codec, coef0688);
4710 break;
4711 case 0x10ec0215:
4712 case 0x10ec0225:
4713 case 0x10ec0285:
4714 case 0x10ec0295:
4715 case 0x10ec0289:
4716 case 0x10ec0299:
4717 alc_process_coef_fw(codec, coef0225);
4718 break;
4720 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
4723 static void alc_determine_headset_type(struct hda_codec *codec)
4725 int val;
4726 bool is_ctia = false;
4727 struct alc_spec *spec = codec->spec;
4728 static struct coef_fw coef0255[] = {
4729 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4730 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4731 conteol) */
4734 static struct coef_fw coef0288[] = {
4735 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4738 static struct coef_fw coef0298[] = {
4739 UPDATE_COEF(0x50, 0x2000, 0x2000),
4740 UPDATE_COEF(0x56, 0x0006, 0x0006),
4741 UPDATE_COEF(0x66, 0x0008, 0),
4742 UPDATE_COEF(0x67, 0x2000, 0),
4743 UPDATE_COEF(0x19, 0x1300, 0x1300),
4746 static struct coef_fw coef0293[] = {
4747 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4748 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4751 static struct coef_fw coef0688[] = {
4752 WRITE_COEF(0x11, 0x0001),
4753 WRITE_COEF(0xb7, 0x802b),
4754 WRITE_COEF(0x15, 0x0d60),
4755 WRITE_COEF(0xc3, 0x0c00),
4758 static struct coef_fw coef0274[] = {
4759 UPDATE_COEF(0x4a, 0x0010, 0),
4760 UPDATE_COEF(0x4a, 0x8000, 0),
4761 WRITE_COEF(0x45, 0xd289),
4762 UPDATE_COEF(0x49, 0x0300, 0x0300),
4766 switch (codec->core.vendor_id) {
4767 case 0x10ec0255:
4768 alc_process_coef_fw(codec, coef0255);
4769 msleep(300);
4770 val = alc_read_coef_idx(codec, 0x46);
4771 is_ctia = (val & 0x0070) == 0x0070;
4772 break;
4773 case 0x10ec0236:
4774 case 0x10ec0256:
4775 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4776 alc_write_coef_idx(codec, 0x06, 0x6104);
4777 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
4779 snd_hda_codec_write(codec, 0x21, 0,
4780 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4781 msleep(80);
4782 snd_hda_codec_write(codec, 0x21, 0,
4783 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4785 alc_process_coef_fw(codec, coef0255);
4786 msleep(300);
4787 val = alc_read_coef_idx(codec, 0x46);
4788 is_ctia = (val & 0x0070) == 0x0070;
4790 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
4791 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4793 snd_hda_codec_write(codec, 0x21, 0,
4794 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4795 msleep(80);
4796 snd_hda_codec_write(codec, 0x21, 0,
4797 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4798 break;
4799 case 0x10ec0234:
4800 case 0x10ec0274:
4801 case 0x10ec0294:
4802 alc_process_coef_fw(codec, coef0274);
4803 msleep(80);
4804 val = alc_read_coef_idx(codec, 0x46);
4805 is_ctia = (val & 0x00f0) == 0x00f0;
4806 break;
4807 case 0x10ec0233:
4808 case 0x10ec0283:
4809 alc_write_coef_idx(codec, 0x45, 0xd029);
4810 msleep(300);
4811 val = alc_read_coef_idx(codec, 0x46);
4812 is_ctia = (val & 0x0070) == 0x0070;
4813 break;
4814 case 0x10ec0298:
4815 snd_hda_codec_write(codec, 0x21, 0,
4816 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4817 msleep(100);
4818 snd_hda_codec_write(codec, 0x21, 0,
4819 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4820 msleep(200);
4822 val = alc_read_coef_idx(codec, 0x50);
4823 if (val & (1 << 12)) {
4824 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4825 alc_process_coef_fw(codec, coef0288);
4826 msleep(350);
4827 val = alc_read_coef_idx(codec, 0x50);
4828 is_ctia = (val & 0x0070) == 0x0070;
4829 } else {
4830 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4831 alc_process_coef_fw(codec, coef0288);
4832 msleep(350);
4833 val = alc_read_coef_idx(codec, 0x50);
4834 is_ctia = (val & 0x0070) == 0x0070;
4836 alc_process_coef_fw(codec, coef0298);
4837 snd_hda_codec_write(codec, 0x21, 0,
4838 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4839 msleep(75);
4840 snd_hda_codec_write(codec, 0x21, 0,
4841 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4842 break;
4843 case 0x10ec0286:
4844 case 0x10ec0288:
4845 alc_process_coef_fw(codec, coef0288);
4846 msleep(350);
4847 val = alc_read_coef_idx(codec, 0x50);
4848 is_ctia = (val & 0x0070) == 0x0070;
4849 break;
4850 case 0x10ec0292:
4851 alc_write_coef_idx(codec, 0x6b, 0xd429);
4852 msleep(300);
4853 val = alc_read_coef_idx(codec, 0x6c);
4854 is_ctia = (val & 0x001c) == 0x001c;
4855 break;
4856 case 0x10ec0293:
4857 alc_process_coef_fw(codec, coef0293);
4858 msleep(300);
4859 val = alc_read_coef_idx(codec, 0x46);
4860 is_ctia = (val & 0x0070) == 0x0070;
4861 break;
4862 case 0x10ec0668:
4863 alc_process_coef_fw(codec, coef0688);
4864 msleep(300);
4865 val = alc_read_coef_idx(codec, 0xbe);
4866 is_ctia = (val & 0x1c02) == 0x1c02;
4867 break;
4868 case 0x10ec0215:
4869 case 0x10ec0225:
4870 case 0x10ec0285:
4871 case 0x10ec0295:
4872 case 0x10ec0289:
4873 case 0x10ec0299:
4874 snd_hda_codec_write(codec, 0x21, 0,
4875 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4876 msleep(80);
4877 snd_hda_codec_write(codec, 0x21, 0,
4878 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4880 alc_process_coef_fw(codec, alc225_pre_hsmode);
4881 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4882 val = alc_read_coef_idx(codec, 0x45);
4883 if (val & (1 << 9)) {
4884 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4885 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4886 msleep(800);
4887 val = alc_read_coef_idx(codec, 0x46);
4888 is_ctia = (val & 0x00f0) == 0x00f0;
4889 } else {
4890 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4891 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4892 msleep(800);
4893 val = alc_read_coef_idx(codec, 0x46);
4894 is_ctia = (val & 0x00f0) == 0x00f0;
4896 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4897 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4898 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
4900 snd_hda_codec_write(codec, 0x21, 0,
4901 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4902 msleep(80);
4903 snd_hda_codec_write(codec, 0x21, 0,
4904 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4905 break;
4906 case 0x10ec0867:
4907 is_ctia = true;
4908 break;
4911 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
4912 is_ctia ? "yes" : "no");
4913 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4916 static void alc_update_headset_mode(struct hda_codec *codec)
4918 struct alc_spec *spec = codec->spec;
4920 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4921 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4923 int new_headset_mode;
4925 if (!snd_hda_jack_detect(codec, hp_pin))
4926 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4927 else if (mux_pin == spec->headset_mic_pin)
4928 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4929 else if (mux_pin == spec->headphone_mic_pin)
4930 new_headset_mode = ALC_HEADSET_MODE_MIC;
4931 else
4932 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4934 if (new_headset_mode == spec->current_headset_mode) {
4935 snd_hda_gen_update_outputs(codec);
4936 return;
4939 switch (new_headset_mode) {
4940 case ALC_HEADSET_MODE_UNPLUGGED:
4941 alc_headset_mode_unplugged(codec);
4942 spec->gen.hp_jack_present = false;
4943 break;
4944 case ALC_HEADSET_MODE_HEADSET:
4945 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4946 alc_determine_headset_type(codec);
4947 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4948 alc_headset_mode_ctia(codec);
4949 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4950 alc_headset_mode_omtp(codec);
4951 spec->gen.hp_jack_present = true;
4952 break;
4953 case ALC_HEADSET_MODE_MIC:
4954 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4955 spec->gen.hp_jack_present = false;
4956 break;
4957 case ALC_HEADSET_MODE_HEADPHONE:
4958 alc_headset_mode_default(codec);
4959 spec->gen.hp_jack_present = true;
4960 break;
4962 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4963 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4964 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
4965 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
4966 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4967 PIN_VREFHIZ);
4969 spec->current_headset_mode = new_headset_mode;
4971 snd_hda_gen_update_outputs(codec);
4974 static void alc_update_headset_mode_hook(struct hda_codec *codec,
4975 struct snd_kcontrol *kcontrol,
4976 struct snd_ctl_elem_value *ucontrol)
4978 alc_update_headset_mode(codec);
4981 static void alc_update_headset_jack_cb(struct hda_codec *codec,
4982 struct hda_jack_callback *jack)
4984 struct alc_spec *spec = codec->spec;
4985 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
4986 snd_hda_gen_hp_automute(codec, jack);
4989 static void alc_probe_headset_mode(struct hda_codec *codec)
4991 int i;
4992 struct alc_spec *spec = codec->spec;
4993 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4995 /* Find mic pins */
4996 for (i = 0; i < cfg->num_inputs; i++) {
4997 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4998 spec->headset_mic_pin = cfg->inputs[i].pin;
4999 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5000 spec->headphone_mic_pin = cfg->inputs[i].pin;
5003 WARN_ON(spec->gen.cap_sync_hook);
5004 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5005 spec->gen.automute_hook = alc_update_headset_mode;
5006 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5009 static void alc_fixup_headset_mode(struct hda_codec *codec,
5010 const struct hda_fixup *fix, int action)
5012 struct alc_spec *spec = codec->spec;
5014 switch (action) {
5015 case HDA_FIXUP_ACT_PRE_PROBE:
5016 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5017 break;
5018 case HDA_FIXUP_ACT_PROBE:
5019 alc_probe_headset_mode(codec);
5020 break;
5021 case HDA_FIXUP_ACT_INIT:
5022 spec->current_headset_mode = 0;
5023 alc_update_headset_mode(codec);
5024 break;
5028 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5029 const struct hda_fixup *fix, int action)
5031 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5032 struct alc_spec *spec = codec->spec;
5033 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5035 else
5036 alc_fixup_headset_mode(codec, fix, action);
5039 static void alc255_set_default_jack_type(struct hda_codec *codec)
5041 /* Set to iphone type */
5042 static struct coef_fw alc255fw[] = {
5043 WRITE_COEF(0x1b, 0x880b),
5044 WRITE_COEF(0x45, 0xd089),
5045 WRITE_COEF(0x1b, 0x080b),
5046 WRITE_COEF(0x46, 0x0004),
5047 WRITE_COEF(0x1b, 0x0c0b),
5050 static struct coef_fw alc256fw[] = {
5051 WRITE_COEF(0x1b, 0x884b),
5052 WRITE_COEF(0x45, 0xd089),
5053 WRITE_COEF(0x1b, 0x084b),
5054 WRITE_COEF(0x46, 0x0004),
5055 WRITE_COEF(0x1b, 0x0c4b),
5058 switch (codec->core.vendor_id) {
5059 case 0x10ec0255:
5060 alc_process_coef_fw(codec, alc255fw);
5061 break;
5062 case 0x10ec0236:
5063 case 0x10ec0256:
5064 alc_process_coef_fw(codec, alc256fw);
5065 break;
5067 msleep(30);
5070 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5071 const struct hda_fixup *fix, int action)
5073 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5074 alc255_set_default_jack_type(codec);
5076 alc_fixup_headset_mode(codec, fix, action);
5079 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5080 const struct hda_fixup *fix, int action)
5082 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5083 struct alc_spec *spec = codec->spec;
5084 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5085 alc255_set_default_jack_type(codec);
5087 else
5088 alc_fixup_headset_mode(codec, fix, action);
5091 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5092 struct hda_jack_callback *jack)
5094 struct alc_spec *spec = codec->spec;
5096 alc_update_headset_jack_cb(codec, jack);
5097 /* Headset Mic enable or disable, only for Dell Dino */
5098 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5101 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5102 const struct hda_fixup *fix, int action)
5104 alc_fixup_headset_mode(codec, fix, action);
5105 if (action == HDA_FIXUP_ACT_PROBE) {
5106 struct alc_spec *spec = codec->spec;
5107 /* toggled via hp_automute_hook */
5108 spec->gpio_mask |= 0x40;
5109 spec->gpio_dir |= 0x40;
5110 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5114 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5115 const struct hda_fixup *fix, int action)
5117 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5118 struct alc_spec *spec = codec->spec;
5119 spec->gen.auto_mute_via_amp = 1;
5123 static void alc_fixup_no_shutup(struct hda_codec *codec,
5124 const struct hda_fixup *fix, int action)
5126 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5127 struct alc_spec *spec = codec->spec;
5128 spec->no_shutup_pins = 1;
5132 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5133 const struct hda_fixup *fix, int action)
5135 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5136 struct alc_spec *spec = codec->spec;
5137 /* Disable AA-loopback as it causes white noise */
5138 spec->gen.mixer_nid = 0;
5142 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5143 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5144 const struct hda_fixup *fix, int action)
5146 static const struct hda_pintbl pincfgs[] = {
5147 { 0x16, 0x21211010 }, /* dock headphone */
5148 { 0x19, 0x21a11010 }, /* dock mic */
5151 struct alc_spec *spec = codec->spec;
5153 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5154 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
5155 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5156 codec->power_save_node = 0; /* avoid click noises */
5157 snd_hda_apply_pincfgs(codec, pincfgs);
5161 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5162 const struct hda_fixup *fix, int action)
5164 static const struct hda_pintbl pincfgs[] = {
5165 { 0x17, 0x21211010 }, /* dock headphone */
5166 { 0x19, 0x21a11010 }, /* dock mic */
5169 struct alc_spec *spec = codec->spec;
5171 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5172 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5173 snd_hda_apply_pincfgs(codec, pincfgs);
5174 } else if (action == HDA_FIXUP_ACT_INIT) {
5175 /* Enable DOCK device */
5176 snd_hda_codec_write(codec, 0x17, 0,
5177 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5178 /* Enable DOCK device */
5179 snd_hda_codec_write(codec, 0x19, 0,
5180 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5184 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5185 const struct hda_fixup *fix, int action)
5187 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5188 * the speaker output becomes too low by some reason on Thinkpads with
5189 * ALC298 codec
5191 static hda_nid_t preferred_pairs[] = {
5192 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5195 struct alc_spec *spec = codec->spec;
5197 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5198 spec->gen.preferred_dacs = preferred_pairs;
5201 static void alc_shutup_dell_xps13(struct hda_codec *codec)
5203 struct alc_spec *spec = codec->spec;
5204 int hp_pin = alc_get_hp_pin(spec);
5206 /* Prevent pop noises when headphones are plugged in */
5207 snd_hda_codec_write(codec, hp_pin, 0,
5208 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5209 msleep(20);
5212 static void alc_fixup_dell_xps13(struct hda_codec *codec,
5213 const struct hda_fixup *fix, int action)
5215 struct alc_spec *spec = codec->spec;
5216 struct hda_input_mux *imux = &spec->gen.input_mux;
5217 int i;
5219 switch (action) {
5220 case HDA_FIXUP_ACT_PRE_PROBE:
5221 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5222 * it causes a click noise at start up
5224 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5225 spec->shutup = alc_shutup_dell_xps13;
5226 break;
5227 case HDA_FIXUP_ACT_PROBE:
5228 /* Make the internal mic the default input source. */
5229 for (i = 0; i < imux->num_items; i++) {
5230 if (spec->gen.imux_pins[i] == 0x12) {
5231 spec->gen.cur_mux[0] = i;
5232 break;
5235 break;
5239 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5240 const struct hda_fixup *fix, int action)
5242 struct alc_spec *spec = codec->spec;
5244 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5245 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5246 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
5248 /* Disable boost for mic-in permanently. (This code is only called
5249 from quirks that guarantee that the headphone is at NID 0x1b.) */
5250 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5251 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
5252 } else
5253 alc_fixup_headset_mode(codec, fix, action);
5256 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5257 const struct hda_fixup *fix, int action)
5259 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5260 alc_write_coef_idx(codec, 0xc4, 0x8000);
5261 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
5262 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5264 alc_fixup_headset_mode(codec, fix, action);
5267 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5268 static int find_ext_mic_pin(struct hda_codec *codec)
5270 struct alc_spec *spec = codec->spec;
5271 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5272 hda_nid_t nid;
5273 unsigned int defcfg;
5274 int i;
5276 for (i = 0; i < cfg->num_inputs; i++) {
5277 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5278 continue;
5279 nid = cfg->inputs[i].pin;
5280 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5281 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5282 continue;
5283 return nid;
5286 return 0;
5289 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
5290 const struct hda_fixup *fix,
5291 int action)
5293 struct alc_spec *spec = codec->spec;
5295 if (action == HDA_FIXUP_ACT_PROBE) {
5296 int mic_pin = find_ext_mic_pin(codec);
5297 int hp_pin = alc_get_hp_pin(spec);
5299 if (snd_BUG_ON(!mic_pin || !hp_pin))
5300 return;
5301 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
5305 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5306 const struct hda_fixup *fix,
5307 int action)
5309 struct alc_spec *spec = codec->spec;
5310 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5311 int i;
5313 /* The mic boosts on level 2 and 3 are too noisy
5314 on the internal mic input.
5315 Therefore limit the boost to 0 or 1. */
5317 if (action != HDA_FIXUP_ACT_PROBE)
5318 return;
5320 for (i = 0; i < cfg->num_inputs; i++) {
5321 hda_nid_t nid = cfg->inputs[i].pin;
5322 unsigned int defcfg;
5323 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5324 continue;
5325 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5326 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5327 continue;
5329 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5330 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5331 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5332 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5333 (0 << AC_AMPCAP_MUTE_SHIFT));
5337 static void alc283_hp_automute_hook(struct hda_codec *codec,
5338 struct hda_jack_callback *jack)
5340 struct alc_spec *spec = codec->spec;
5341 int vref;
5343 msleep(200);
5344 snd_hda_gen_hp_automute(codec, jack);
5346 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5348 msleep(600);
5349 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5350 vref);
5353 static void alc283_fixup_chromebook(struct hda_codec *codec,
5354 const struct hda_fixup *fix, int action)
5356 struct alc_spec *spec = codec->spec;
5358 switch (action) {
5359 case HDA_FIXUP_ACT_PRE_PROBE:
5360 snd_hda_override_wcaps(codec, 0x03, 0);
5361 /* Disable AA-loopback as it causes white noise */
5362 spec->gen.mixer_nid = 0;
5363 break;
5364 case HDA_FIXUP_ACT_INIT:
5365 /* MIC2-VREF control */
5366 /* Set to manual mode */
5367 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5368 /* Enable Line1 input control by verb */
5369 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
5370 break;
5374 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5375 const struct hda_fixup *fix, int action)
5377 struct alc_spec *spec = codec->spec;
5379 switch (action) {
5380 case HDA_FIXUP_ACT_PRE_PROBE:
5381 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5382 break;
5383 case HDA_FIXUP_ACT_INIT:
5384 /* MIC2-VREF control */
5385 /* Set to manual mode */
5386 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5387 break;
5391 /* mute tablet speaker pin (0x14) via dock plugging in addition */
5392 static void asus_tx300_automute(struct hda_codec *codec)
5394 struct alc_spec *spec = codec->spec;
5395 snd_hda_gen_update_outputs(codec);
5396 if (snd_hda_jack_detect(codec, 0x1b))
5397 spec->gen.mute_bits |= (1ULL << 0x14);
5400 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5401 const struct hda_fixup *fix, int action)
5403 struct alc_spec *spec = codec->spec;
5404 static const struct hda_pintbl dock_pins[] = {
5405 { 0x1b, 0x21114000 }, /* dock speaker pin */
5409 switch (action) {
5410 case HDA_FIXUP_ACT_PRE_PROBE:
5411 spec->init_amp = ALC_INIT_DEFAULT;
5412 /* TX300 needs to set up GPIO2 for the speaker amp */
5413 alc_setup_gpio(codec, 0x04);
5414 snd_hda_apply_pincfgs(codec, dock_pins);
5415 spec->gen.auto_mute_via_amp = 1;
5416 spec->gen.automute_hook = asus_tx300_automute;
5417 snd_hda_jack_detect_enable_callback(codec, 0x1b,
5418 snd_hda_gen_hp_automute);
5419 break;
5420 case HDA_FIXUP_ACT_PROBE:
5421 spec->init_amp = ALC_INIT_DEFAULT;
5422 break;
5423 case HDA_FIXUP_ACT_BUILD:
5424 /* this is a bit tricky; give more sane names for the main
5425 * (tablet) speaker and the dock speaker, respectively
5427 rename_ctl(codec, "Speaker Playback Switch",
5428 "Dock Speaker Playback Switch");
5429 rename_ctl(codec, "Bass Speaker Playback Switch",
5430 "Speaker Playback Switch");
5431 break;
5435 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5436 const struct hda_fixup *fix, int action)
5438 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5439 /* DAC node 0x03 is giving mono output. We therefore want to
5440 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5441 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5442 hda_nid_t conn1[2] = { 0x0c };
5443 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5444 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5448 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5449 const struct hda_fixup *fix, int action)
5451 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5452 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5453 we can't adjust the speaker's volume since this node does not has
5454 Amp-out capability. we change the speaker's route to:
5455 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5456 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5457 speaker's volume now. */
5459 hda_nid_t conn1[1] = { 0x0c };
5460 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5464 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5465 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5466 const struct hda_fixup *fix, int action)
5468 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5469 hda_nid_t conn[2] = { 0x02, 0x03 };
5470 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5474 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
5475 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
5476 const struct hda_fixup *fix, int action)
5478 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5479 hda_nid_t conn[1] = { 0x02 };
5480 snd_hda_override_conn_list(codec, 0x17, 1, conn);
5484 /* Hook to update amp GPIO4 for automute */
5485 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5486 struct hda_jack_callback *jack)
5488 struct alc_spec *spec = codec->spec;
5490 snd_hda_gen_hp_automute(codec, jack);
5491 /* mute_led_polarity is set to 0, so we pass inverted value here */
5492 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
5493 !spec->gen.hp_jack_present);
5496 /* Manage GPIOs for HP EliteBook Folio 9480m.
5498 * GPIO4 is the headphone amplifier power control
5499 * GPIO3 is the audio output mute indicator LED
5502 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5503 const struct hda_fixup *fix,
5504 int action)
5506 struct alc_spec *spec = codec->spec;
5508 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
5509 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5510 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5511 spec->gpio_mask |= 0x10;
5512 spec->gpio_dir |= 0x10;
5513 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
5517 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5518 const struct hda_fixup *fix,
5519 int action)
5521 struct alc_spec *spec = codec->spec;
5523 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5524 spec->gpio_mask |= 0x04;
5525 spec->gpio_dir |= 0x04;
5526 /* set data bit low */
5530 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5531 const struct hda_fixup *fix,
5532 int action)
5534 alc_fixup_dual_codecs(codec, fix, action);
5535 switch (action) {
5536 case HDA_FIXUP_ACT_PRE_PROBE:
5537 /* override card longname to provide a unique UCM profile */
5538 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5539 break;
5540 case HDA_FIXUP_ACT_BUILD:
5541 /* rename Capture controls depending on the codec */
5542 rename_ctl(codec, "Capture Volume",
5543 codec->addr == 0 ?
5544 "Rear-Panel Capture Volume" :
5545 "Front-Panel Capture Volume");
5546 rename_ctl(codec, "Capture Switch",
5547 codec->addr == 0 ?
5548 "Rear-Panel Capture Switch" :
5549 "Front-Panel Capture Switch");
5550 break;
5554 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
5555 const struct hda_fixup *fix, int action)
5557 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5558 return;
5560 codec->power_save_node = 1;
5563 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5564 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5565 const struct hda_fixup *fix, int action)
5567 struct alc_spec *spec = codec->spec;
5568 static hda_nid_t preferred_pairs[] = {
5569 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5573 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5574 return;
5576 spec->gen.preferred_dacs = preferred_pairs;
5577 spec->gen.auto_mute_via_amp = 1;
5578 codec->power_save_node = 0;
5581 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
5582 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
5583 const struct hda_fixup *fix, int action)
5585 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5586 return;
5588 snd_hda_override_wcaps(codec, 0x03, 0);
5591 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
5592 const struct hda_fixup *fix, int action)
5594 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5595 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5598 /* for hda_fixup_thinkpad_acpi() */
5599 #include "thinkpad_helper.c"
5601 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5602 const struct hda_fixup *fix, int action)
5604 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5605 hda_fixup_thinkpad_acpi(codec, fix, action);
5608 /* for dell wmi mic mute led */
5609 #include "dell_wmi_helper.c"
5611 /* for alc295_fixup_hp_top_speakers */
5612 #include "hp_x360_helper.c"
5614 enum {
5615 ALC269_FIXUP_SONY_VAIO,
5616 ALC275_FIXUP_SONY_VAIO_GPIO2,
5617 ALC269_FIXUP_DELL_M101Z,
5618 ALC269_FIXUP_SKU_IGNORE,
5619 ALC269_FIXUP_ASUS_G73JW,
5620 ALC269_FIXUP_LENOVO_EAPD,
5621 ALC275_FIXUP_SONY_HWEQ,
5622 ALC275_FIXUP_SONY_DISABLE_AAMIX,
5623 ALC271_FIXUP_DMIC,
5624 ALC269_FIXUP_PCM_44K,
5625 ALC269_FIXUP_STEREO_DMIC,
5626 ALC269_FIXUP_HEADSET_MIC,
5627 ALC269_FIXUP_QUANTA_MUTE,
5628 ALC269_FIXUP_LIFEBOOK,
5629 ALC269_FIXUP_LIFEBOOK_EXTMIC,
5630 ALC269_FIXUP_LIFEBOOK_HP_PIN,
5631 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
5632 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
5633 ALC269_FIXUP_AMIC,
5634 ALC269_FIXUP_DMIC,
5635 ALC269VB_FIXUP_AMIC,
5636 ALC269VB_FIXUP_DMIC,
5637 ALC269_FIXUP_HP_MUTE_LED,
5638 ALC269_FIXUP_HP_MUTE_LED_MIC1,
5639 ALC269_FIXUP_HP_MUTE_LED_MIC2,
5640 ALC269_FIXUP_HP_MUTE_LED_MIC3,
5641 ALC269_FIXUP_HP_GPIO_LED,
5642 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5643 ALC269_FIXUP_HP_LINE1_MIC1_LED,
5644 ALC269_FIXUP_INV_DMIC,
5645 ALC269_FIXUP_LENOVO_DOCK,
5646 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
5647 ALC269_FIXUP_NO_SHUTUP,
5648 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
5649 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
5650 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5651 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
5652 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5653 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
5654 ALC269_FIXUP_HEADSET_MODE,
5655 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
5656 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
5657 ALC269_FIXUP_ASUS_X101_FUNC,
5658 ALC269_FIXUP_ASUS_X101_VERB,
5659 ALC269_FIXUP_ASUS_X101,
5660 ALC271_FIXUP_AMIC_MIC2,
5661 ALC271_FIXUP_HP_GATE_MIC_JACK,
5662 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
5663 ALC269_FIXUP_ACER_AC700,
5664 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
5665 ALC269VB_FIXUP_ASUS_ZENBOOK,
5666 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
5667 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
5668 ALC269VB_FIXUP_ORDISSIMO_EVE2,
5669 ALC283_FIXUP_CHROME_BOOK,
5670 ALC283_FIXUP_SENSE_COMBO_JACK,
5671 ALC282_FIXUP_ASUS_TX300,
5672 ALC283_FIXUP_INT_MIC,
5673 ALC290_FIXUP_MONO_SPEAKERS,
5674 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5675 ALC290_FIXUP_SUBWOOFER,
5676 ALC290_FIXUP_SUBWOOFER_HSJACK,
5677 ALC269_FIXUP_THINKPAD_ACPI,
5678 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5679 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
5680 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
5681 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5682 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
5683 ALC255_FIXUP_HEADSET_MODE,
5684 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
5685 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5686 ALC292_FIXUP_TPT440_DOCK,
5687 ALC292_FIXUP_TPT440,
5688 ALC283_FIXUP_HEADSET_MIC,
5689 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
5690 ALC282_FIXUP_ASPIRE_V5_PINS,
5691 ALC280_FIXUP_HP_GPIO4,
5692 ALC286_FIXUP_HP_GPIO_LED,
5693 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
5694 ALC280_FIXUP_HP_DOCK_PINS,
5695 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
5696 ALC280_FIXUP_HP_9480M,
5697 ALC288_FIXUP_DELL_HEADSET_MODE,
5698 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
5699 ALC288_FIXUP_DELL_XPS_13,
5700 ALC288_FIXUP_DISABLE_AAMIX,
5701 ALC292_FIXUP_DELL_E7X,
5702 ALC292_FIXUP_DISABLE_AAMIX,
5703 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
5704 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
5705 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
5706 ALC275_FIXUP_DELL_XPS,
5707 ALC293_FIXUP_LENOVO_SPK_NOISE,
5708 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
5709 ALC255_FIXUP_DELL_SPK_NOISE,
5710 ALC225_FIXUP_DISABLE_MIC_VREF,
5711 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
5712 ALC295_FIXUP_DISABLE_DAC3,
5713 ALC285_FIXUP_SPEAKER2_TO_DAC1,
5714 ALC280_FIXUP_HP_HEADSET_MIC,
5715 ALC221_FIXUP_HP_FRONT_MIC,
5716 ALC292_FIXUP_TPT460,
5717 ALC298_FIXUP_SPK_VOLUME,
5718 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
5719 ALC269_FIXUP_ATIV_BOOK_8,
5720 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
5721 ALC256_FIXUP_ASUS_HEADSET_MODE,
5722 ALC256_FIXUP_ASUS_MIC,
5723 ALC256_FIXUP_ASUS_AIO_GPIO2,
5724 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5725 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
5726 ALC233_FIXUP_LENOVO_MULTI_CODECS,
5727 ALC233_FIXUP_ACER_HEADSET_MIC,
5728 ALC294_FIXUP_LENOVO_MIC_LOCATION,
5729 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
5730 ALC225_FIXUP_S3_POP_NOISE,
5731 ALC700_FIXUP_INTEL_REFERENCE,
5732 ALC274_FIXUP_DELL_BIND_DACS,
5733 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
5734 ALC298_FIXUP_TPT470_DOCK_FIX,
5735 ALC298_FIXUP_TPT470_DOCK,
5736 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
5737 ALC255_FIXUP_DELL_HEADSET_MIC,
5738 ALC256_FIXUP_HUAWEI_MBXP_PINS,
5739 ALC295_FIXUP_HP_X360,
5740 ALC221_FIXUP_HP_HEADSET_MIC,
5741 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
5742 ALC295_FIXUP_HP_AUTO_MUTE,
5743 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
5744 ALC294_FIXUP_ASUS_MIC,
5745 ALC294_FIXUP_ASUS_HEADSET_MIC,
5746 ALC294_FIXUP_ASUS_SPK,
5747 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
5748 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
5749 ALC255_FIXUP_ACER_HEADSET_MIC,
5750 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
5751 ALC225_FIXUP_WYSE_AUTO_MUTE,
5752 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
5753 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
5754 ALC256_FIXUP_ASUS_HEADSET_MIC,
5755 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
5756 ALC299_FIXUP_PREDATOR_SPK,
5757 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
5758 ALC289_FIXUP_DELL_SPK2,
5759 ALC289_FIXUP_DUAL_SPK,
5760 ALC294_FIXUP_SPK2_TO_DAC1,
5761 ALC294_FIXUP_ASUS_DUAL_SPK,
5762 ALC294_FIXUP_ASUS_HPE,
5763 ALC285_FIXUP_HP_GPIO_LED,
5766 static const struct hda_fixup alc269_fixups[] = {
5767 [ALC269_FIXUP_SONY_VAIO] = {
5768 .type = HDA_FIXUP_PINCTLS,
5769 .v.pins = (const struct hda_pintbl[]) {
5770 {0x19, PIN_VREFGRD},
5774 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
5775 .type = HDA_FIXUP_FUNC,
5776 .v.func = alc275_fixup_gpio4_off,
5777 .chained = true,
5778 .chain_id = ALC269_FIXUP_SONY_VAIO
5780 [ALC269_FIXUP_DELL_M101Z] = {
5781 .type = HDA_FIXUP_VERBS,
5782 .v.verbs = (const struct hda_verb[]) {
5783 /* Enables internal speaker */
5784 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5785 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5789 [ALC269_FIXUP_SKU_IGNORE] = {
5790 .type = HDA_FIXUP_FUNC,
5791 .v.func = alc_fixup_sku_ignore,
5793 [ALC269_FIXUP_ASUS_G73JW] = {
5794 .type = HDA_FIXUP_PINS,
5795 .v.pins = (const struct hda_pintbl[]) {
5796 { 0x17, 0x99130111 }, /* subwoofer */
5800 [ALC269_FIXUP_LENOVO_EAPD] = {
5801 .type = HDA_FIXUP_VERBS,
5802 .v.verbs = (const struct hda_verb[]) {
5803 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5807 [ALC275_FIXUP_SONY_HWEQ] = {
5808 .type = HDA_FIXUP_FUNC,
5809 .v.func = alc269_fixup_hweq,
5810 .chained = true,
5811 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5813 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5814 .type = HDA_FIXUP_FUNC,
5815 .v.func = alc_fixup_disable_aamix,
5816 .chained = true,
5817 .chain_id = ALC269_FIXUP_SONY_VAIO
5819 [ALC271_FIXUP_DMIC] = {
5820 .type = HDA_FIXUP_FUNC,
5821 .v.func = alc271_fixup_dmic,
5823 [ALC269_FIXUP_PCM_44K] = {
5824 .type = HDA_FIXUP_FUNC,
5825 .v.func = alc269_fixup_pcm_44k,
5826 .chained = true,
5827 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5829 [ALC269_FIXUP_STEREO_DMIC] = {
5830 .type = HDA_FIXUP_FUNC,
5831 .v.func = alc269_fixup_stereo_dmic,
5833 [ALC269_FIXUP_HEADSET_MIC] = {
5834 .type = HDA_FIXUP_FUNC,
5835 .v.func = alc269_fixup_headset_mic,
5837 [ALC269_FIXUP_QUANTA_MUTE] = {
5838 .type = HDA_FIXUP_FUNC,
5839 .v.func = alc269_fixup_quanta_mute,
5841 [ALC269_FIXUP_LIFEBOOK] = {
5842 .type = HDA_FIXUP_PINS,
5843 .v.pins = (const struct hda_pintbl[]) {
5844 { 0x1a, 0x2101103f }, /* dock line-out */
5845 { 0x1b, 0x23a11040 }, /* dock mic-in */
5848 .chained = true,
5849 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5851 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5852 .type = HDA_FIXUP_PINS,
5853 .v.pins = (const struct hda_pintbl[]) {
5854 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5858 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5859 .type = HDA_FIXUP_PINS,
5860 .v.pins = (const struct hda_pintbl[]) {
5861 { 0x21, 0x0221102f }, /* HP out */
5865 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5866 .type = HDA_FIXUP_FUNC,
5867 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5869 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5870 .type = HDA_FIXUP_FUNC,
5871 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5873 [ALC269_FIXUP_AMIC] = {
5874 .type = HDA_FIXUP_PINS,
5875 .v.pins = (const struct hda_pintbl[]) {
5876 { 0x14, 0x99130110 }, /* speaker */
5877 { 0x15, 0x0121401f }, /* HP out */
5878 { 0x18, 0x01a19c20 }, /* mic */
5879 { 0x19, 0x99a3092f }, /* int-mic */
5883 [ALC269_FIXUP_DMIC] = {
5884 .type = HDA_FIXUP_PINS,
5885 .v.pins = (const struct hda_pintbl[]) {
5886 { 0x12, 0x99a3092f }, /* int-mic */
5887 { 0x14, 0x99130110 }, /* speaker */
5888 { 0x15, 0x0121401f }, /* HP out */
5889 { 0x18, 0x01a19c20 }, /* mic */
5893 [ALC269VB_FIXUP_AMIC] = {
5894 .type = HDA_FIXUP_PINS,
5895 .v.pins = (const struct hda_pintbl[]) {
5896 { 0x14, 0x99130110 }, /* speaker */
5897 { 0x18, 0x01a19c20 }, /* mic */
5898 { 0x19, 0x99a3092f }, /* int-mic */
5899 { 0x21, 0x0121401f }, /* HP out */
5903 [ALC269VB_FIXUP_DMIC] = {
5904 .type = HDA_FIXUP_PINS,
5905 .v.pins = (const struct hda_pintbl[]) {
5906 { 0x12, 0x99a3092f }, /* int-mic */
5907 { 0x14, 0x99130110 }, /* speaker */
5908 { 0x18, 0x01a19c20 }, /* mic */
5909 { 0x21, 0x0121401f }, /* HP out */
5913 [ALC269_FIXUP_HP_MUTE_LED] = {
5914 .type = HDA_FIXUP_FUNC,
5915 .v.func = alc269_fixup_hp_mute_led,
5917 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5918 .type = HDA_FIXUP_FUNC,
5919 .v.func = alc269_fixup_hp_mute_led_mic1,
5921 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
5922 .type = HDA_FIXUP_FUNC,
5923 .v.func = alc269_fixup_hp_mute_led_mic2,
5925 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5926 .type = HDA_FIXUP_FUNC,
5927 .v.func = alc269_fixup_hp_mute_led_mic3,
5928 .chained = true,
5929 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
5931 [ALC269_FIXUP_HP_GPIO_LED] = {
5932 .type = HDA_FIXUP_FUNC,
5933 .v.func = alc269_fixup_hp_gpio_led,
5935 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5936 .type = HDA_FIXUP_FUNC,
5937 .v.func = alc269_fixup_hp_gpio_mic1_led,
5939 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5940 .type = HDA_FIXUP_FUNC,
5941 .v.func = alc269_fixup_hp_line1_mic1_led,
5943 [ALC269_FIXUP_INV_DMIC] = {
5944 .type = HDA_FIXUP_FUNC,
5945 .v.func = alc_fixup_inv_dmic,
5947 [ALC269_FIXUP_NO_SHUTUP] = {
5948 .type = HDA_FIXUP_FUNC,
5949 .v.func = alc_fixup_no_shutup,
5951 [ALC269_FIXUP_LENOVO_DOCK] = {
5952 .type = HDA_FIXUP_PINS,
5953 .v.pins = (const struct hda_pintbl[]) {
5954 { 0x19, 0x23a11040 }, /* dock mic */
5955 { 0x1b, 0x2121103f }, /* dock headphone */
5958 .chained = true,
5959 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5961 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
5962 .type = HDA_FIXUP_FUNC,
5963 .v.func = alc269_fixup_limit_int_mic_boost,
5964 .chained = true,
5965 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
5967 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
5968 .type = HDA_FIXUP_FUNC,
5969 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5970 .chained = true,
5971 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5973 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5974 .type = HDA_FIXUP_PINS,
5975 .v.pins = (const struct hda_pintbl[]) {
5976 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5977 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5980 .chained = true,
5981 .chain_id = ALC269_FIXUP_HEADSET_MODE
5983 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5984 .type = HDA_FIXUP_PINS,
5985 .v.pins = (const struct hda_pintbl[]) {
5986 { 0x16, 0x21014020 }, /* dock line out */
5987 { 0x19, 0x21a19030 }, /* dock mic */
5988 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5991 .chained = true,
5992 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5994 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5995 .type = HDA_FIXUP_PINS,
5996 .v.pins = (const struct hda_pintbl[]) {
5997 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6000 .chained = true,
6001 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6003 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6004 .type = HDA_FIXUP_PINS,
6005 .v.pins = (const struct hda_pintbl[]) {
6006 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6007 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6010 .chained = true,
6011 .chain_id = ALC269_FIXUP_HEADSET_MODE
6013 [ALC269_FIXUP_HEADSET_MODE] = {
6014 .type = HDA_FIXUP_FUNC,
6015 .v.func = alc_fixup_headset_mode,
6016 .chained = true,
6017 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6019 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6020 .type = HDA_FIXUP_FUNC,
6021 .v.func = alc_fixup_headset_mode_no_hp_mic,
6023 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6024 .type = HDA_FIXUP_PINS,
6025 .v.pins = (const struct hda_pintbl[]) {
6026 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6029 .chained = true,
6030 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6032 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6033 .type = HDA_FIXUP_PINS,
6034 .v.pins = (const struct hda_pintbl[]) {
6035 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6038 .chained = true,
6039 .chain_id = ALC269_FIXUP_HEADSET_MIC
6041 [ALC256_FIXUP_HUAWEI_MBXP_PINS] = {
6042 .type = HDA_FIXUP_PINS,
6043 .v.pins = (const struct hda_pintbl[]) {
6044 {0x12, 0x90a60130},
6045 {0x13, 0x40000000},
6046 {0x14, 0x90170110},
6047 {0x18, 0x411111f0},
6048 {0x19, 0x04a11040},
6049 {0x1a, 0x411111f0},
6050 {0x1b, 0x90170112},
6051 {0x1d, 0x40759a05},
6052 {0x1e, 0x411111f0},
6053 {0x21, 0x04211020},
6057 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6058 .type = HDA_FIXUP_FUNC,
6059 .v.func = alc269_fixup_x101_headset_mic,
6061 [ALC269_FIXUP_ASUS_X101_VERB] = {
6062 .type = HDA_FIXUP_VERBS,
6063 .v.verbs = (const struct hda_verb[]) {
6064 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6065 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6066 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6069 .chained = true,
6070 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6072 [ALC269_FIXUP_ASUS_X101] = {
6073 .type = HDA_FIXUP_PINS,
6074 .v.pins = (const struct hda_pintbl[]) {
6075 { 0x18, 0x04a1182c }, /* Headset mic */
6078 .chained = true,
6079 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6081 [ALC271_FIXUP_AMIC_MIC2] = {
6082 .type = HDA_FIXUP_PINS,
6083 .v.pins = (const struct hda_pintbl[]) {
6084 { 0x14, 0x99130110 }, /* speaker */
6085 { 0x19, 0x01a19c20 }, /* mic */
6086 { 0x1b, 0x99a7012f }, /* int-mic */
6087 { 0x21, 0x0121401f }, /* HP out */
6091 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
6092 .type = HDA_FIXUP_FUNC,
6093 .v.func = alc271_hp_gate_mic_jack,
6094 .chained = true,
6095 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6097 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6098 .type = HDA_FIXUP_FUNC,
6099 .v.func = alc269_fixup_limit_int_mic_boost,
6100 .chained = true,
6101 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6103 [ALC269_FIXUP_ACER_AC700] = {
6104 .type = HDA_FIXUP_PINS,
6105 .v.pins = (const struct hda_pintbl[]) {
6106 { 0x12, 0x99a3092f }, /* int-mic */
6107 { 0x14, 0x99130110 }, /* speaker */
6108 { 0x18, 0x03a11c20 }, /* mic */
6109 { 0x1e, 0x0346101e }, /* SPDIF1 */
6110 { 0x21, 0x0321101f }, /* HP out */
6113 .chained = true,
6114 .chain_id = ALC271_FIXUP_DMIC,
6116 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6117 .type = HDA_FIXUP_FUNC,
6118 .v.func = alc269_fixup_limit_int_mic_boost,
6119 .chained = true,
6120 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6122 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6123 .type = HDA_FIXUP_FUNC,
6124 .v.func = alc269_fixup_limit_int_mic_boost,
6125 .chained = true,
6126 .chain_id = ALC269VB_FIXUP_DMIC,
6128 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6129 .type = HDA_FIXUP_VERBS,
6130 .v.verbs = (const struct hda_verb[]) {
6131 /* class-D output amp +5dB */
6132 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6133 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6136 .chained = true,
6137 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6139 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6140 .type = HDA_FIXUP_FUNC,
6141 .v.func = alc269_fixup_limit_int_mic_boost,
6142 .chained = true,
6143 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6145 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6146 .type = HDA_FIXUP_PINS,
6147 .v.pins = (const struct hda_pintbl[]) {
6148 { 0x12, 0x99a3092f }, /* int-mic */
6149 { 0x18, 0x03a11d20 }, /* mic */
6150 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6154 [ALC283_FIXUP_CHROME_BOOK] = {
6155 .type = HDA_FIXUP_FUNC,
6156 .v.func = alc283_fixup_chromebook,
6158 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6159 .type = HDA_FIXUP_FUNC,
6160 .v.func = alc283_fixup_sense_combo_jack,
6161 .chained = true,
6162 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6164 [ALC282_FIXUP_ASUS_TX300] = {
6165 .type = HDA_FIXUP_FUNC,
6166 .v.func = alc282_fixup_asus_tx300,
6168 [ALC283_FIXUP_INT_MIC] = {
6169 .type = HDA_FIXUP_VERBS,
6170 .v.verbs = (const struct hda_verb[]) {
6171 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6172 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6175 .chained = true,
6176 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6178 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6179 .type = HDA_FIXUP_PINS,
6180 .v.pins = (const struct hda_pintbl[]) {
6181 { 0x17, 0x90170112 }, /* subwoofer */
6184 .chained = true,
6185 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6187 [ALC290_FIXUP_SUBWOOFER] = {
6188 .type = HDA_FIXUP_PINS,
6189 .v.pins = (const struct hda_pintbl[]) {
6190 { 0x17, 0x90170112 }, /* subwoofer */
6193 .chained = true,
6194 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6196 [ALC290_FIXUP_MONO_SPEAKERS] = {
6197 .type = HDA_FIXUP_FUNC,
6198 .v.func = alc290_fixup_mono_speakers,
6200 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6201 .type = HDA_FIXUP_FUNC,
6202 .v.func = alc290_fixup_mono_speakers,
6203 .chained = true,
6204 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6206 [ALC269_FIXUP_THINKPAD_ACPI] = {
6207 .type = HDA_FIXUP_FUNC,
6208 .v.func = alc_fixup_thinkpad_acpi,
6209 .chained = true,
6210 .chain_id = ALC269_FIXUP_SKU_IGNORE,
6212 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6213 .type = HDA_FIXUP_FUNC,
6214 .v.func = alc_fixup_inv_dmic,
6215 .chained = true,
6216 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6218 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
6219 .type = HDA_FIXUP_PINS,
6220 .v.pins = (const struct hda_pintbl[]) {
6221 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6224 .chained = true,
6225 .chain_id = ALC255_FIXUP_HEADSET_MODE
6227 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6228 .type = HDA_FIXUP_PINS,
6229 .v.pins = (const struct hda_pintbl[]) {
6230 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6233 .chained = true,
6234 .chain_id = ALC255_FIXUP_HEADSET_MODE
6236 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6237 .type = HDA_FIXUP_PINS,
6238 .v.pins = (const struct hda_pintbl[]) {
6239 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6240 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6243 .chained = true,
6244 .chain_id = ALC255_FIXUP_HEADSET_MODE
6246 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6247 .type = HDA_FIXUP_PINS,
6248 .v.pins = (const struct hda_pintbl[]) {
6249 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6252 .chained = true,
6253 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6255 [ALC255_FIXUP_HEADSET_MODE] = {
6256 .type = HDA_FIXUP_FUNC,
6257 .v.func = alc_fixup_headset_mode_alc255,
6258 .chained = true,
6259 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6261 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6262 .type = HDA_FIXUP_FUNC,
6263 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6265 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6266 .type = HDA_FIXUP_PINS,
6267 .v.pins = (const struct hda_pintbl[]) {
6268 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6269 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6272 .chained = true,
6273 .chain_id = ALC269_FIXUP_HEADSET_MODE
6275 [ALC292_FIXUP_TPT440_DOCK] = {
6276 .type = HDA_FIXUP_FUNC,
6277 .v.func = alc_fixup_tpt440_dock,
6278 .chained = true,
6279 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6281 [ALC292_FIXUP_TPT440] = {
6282 .type = HDA_FIXUP_FUNC,
6283 .v.func = alc_fixup_disable_aamix,
6284 .chained = true,
6285 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6287 [ALC283_FIXUP_HEADSET_MIC] = {
6288 .type = HDA_FIXUP_PINS,
6289 .v.pins = (const struct hda_pintbl[]) {
6290 { 0x19, 0x04a110f0 },
6291 { },
6294 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
6295 .type = HDA_FIXUP_FUNC,
6296 .v.func = alc_fixup_dell_wmi,
6298 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6299 .type = HDA_FIXUP_PINS,
6300 .v.pins = (const struct hda_pintbl[]) {
6301 { 0x12, 0x90a60130 },
6302 { 0x14, 0x90170110 },
6303 { 0x17, 0x40000008 },
6304 { 0x18, 0x411111f0 },
6305 { 0x19, 0x01a1913c },
6306 { 0x1a, 0x411111f0 },
6307 { 0x1b, 0x411111f0 },
6308 { 0x1d, 0x40f89b2d },
6309 { 0x1e, 0x411111f0 },
6310 { 0x21, 0x0321101f },
6311 { },
6314 [ALC280_FIXUP_HP_GPIO4] = {
6315 .type = HDA_FIXUP_FUNC,
6316 .v.func = alc280_fixup_hp_gpio4,
6318 [ALC286_FIXUP_HP_GPIO_LED] = {
6319 .type = HDA_FIXUP_FUNC,
6320 .v.func = alc286_fixup_hp_gpio_led,
6322 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6323 .type = HDA_FIXUP_FUNC,
6324 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6326 [ALC280_FIXUP_HP_DOCK_PINS] = {
6327 .type = HDA_FIXUP_PINS,
6328 .v.pins = (const struct hda_pintbl[]) {
6329 { 0x1b, 0x21011020 }, /* line-out */
6330 { 0x1a, 0x01a1903c }, /* headset mic */
6331 { 0x18, 0x2181103f }, /* line-in */
6332 { },
6334 .chained = true,
6335 .chain_id = ALC280_FIXUP_HP_GPIO4
6337 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6338 .type = HDA_FIXUP_PINS,
6339 .v.pins = (const struct hda_pintbl[]) {
6340 { 0x1b, 0x21011020 }, /* line-out */
6341 { 0x18, 0x2181103f }, /* line-in */
6342 { },
6344 .chained = true,
6345 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6347 [ALC280_FIXUP_HP_9480M] = {
6348 .type = HDA_FIXUP_FUNC,
6349 .v.func = alc280_fixup_hp_9480m,
6351 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6352 .type = HDA_FIXUP_FUNC,
6353 .v.func = alc_fixup_headset_mode_dell_alc288,
6354 .chained = true,
6355 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6357 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6358 .type = HDA_FIXUP_PINS,
6359 .v.pins = (const struct hda_pintbl[]) {
6360 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6361 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6364 .chained = true,
6365 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6367 [ALC288_FIXUP_DISABLE_AAMIX] = {
6368 .type = HDA_FIXUP_FUNC,
6369 .v.func = alc_fixup_disable_aamix,
6370 .chained = true,
6371 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
6373 [ALC288_FIXUP_DELL_XPS_13] = {
6374 .type = HDA_FIXUP_FUNC,
6375 .v.func = alc_fixup_dell_xps13,
6376 .chained = true,
6377 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6379 [ALC292_FIXUP_DISABLE_AAMIX] = {
6380 .type = HDA_FIXUP_FUNC,
6381 .v.func = alc_fixup_disable_aamix,
6382 .chained = true,
6383 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
6385 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6386 .type = HDA_FIXUP_FUNC,
6387 .v.func = alc_fixup_disable_aamix,
6388 .chained = true,
6389 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6391 [ALC292_FIXUP_DELL_E7X] = {
6392 .type = HDA_FIXUP_FUNC,
6393 .v.func = alc_fixup_dell_xps13,
6394 .chained = true,
6395 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6397 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6398 .type = HDA_FIXUP_PINS,
6399 .v.pins = (const struct hda_pintbl[]) {
6400 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6401 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6404 .chained = true,
6405 .chain_id = ALC269_FIXUP_HEADSET_MODE
6407 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6408 .type = HDA_FIXUP_PINS,
6409 .v.pins = (const struct hda_pintbl[]) {
6410 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6413 .chained = true,
6414 .chain_id = ALC269_FIXUP_HEADSET_MODE
6416 [ALC275_FIXUP_DELL_XPS] = {
6417 .type = HDA_FIXUP_VERBS,
6418 .v.verbs = (const struct hda_verb[]) {
6419 /* Enables internal speaker */
6420 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6421 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6422 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6423 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6427 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6428 .type = HDA_FIXUP_FUNC,
6429 .v.func = alc_fixup_disable_aamix,
6430 .chained = true,
6431 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6433 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6434 .type = HDA_FIXUP_FUNC,
6435 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6437 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6438 .type = HDA_FIXUP_FUNC,
6439 .v.func = alc_fixup_disable_aamix,
6440 .chained = true,
6441 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6443 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6444 .type = HDA_FIXUP_FUNC,
6445 .v.func = alc_fixup_disable_mic_vref,
6446 .chained = true,
6447 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6449 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6450 .type = HDA_FIXUP_VERBS,
6451 .v.verbs = (const struct hda_verb[]) {
6452 /* Disable pass-through path for FRONT 14h */
6453 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6454 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6457 .chained = true,
6458 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
6460 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6461 .type = HDA_FIXUP_FUNC,
6462 .v.func = alc_fixup_disable_aamix,
6463 .chained = true,
6464 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6466 [ALC221_FIXUP_HP_FRONT_MIC] = {
6467 .type = HDA_FIXUP_PINS,
6468 .v.pins = (const struct hda_pintbl[]) {
6469 { 0x19, 0x02a19020 }, /* Front Mic */
6473 [ALC292_FIXUP_TPT460] = {
6474 .type = HDA_FIXUP_FUNC,
6475 .v.func = alc_fixup_tpt440_dock,
6476 .chained = true,
6477 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6479 [ALC298_FIXUP_SPK_VOLUME] = {
6480 .type = HDA_FIXUP_FUNC,
6481 .v.func = alc298_fixup_speaker_volume,
6482 .chained = true,
6483 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6485 [ALC295_FIXUP_DISABLE_DAC3] = {
6486 .type = HDA_FIXUP_FUNC,
6487 .v.func = alc295_fixup_disable_dac3,
6489 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
6490 .type = HDA_FIXUP_FUNC,
6491 .v.func = alc285_fixup_speaker2_to_dac1,
6492 .chained = true,
6493 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6495 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6496 .type = HDA_FIXUP_PINS,
6497 .v.pins = (const struct hda_pintbl[]) {
6498 { 0x1b, 0x90170151 },
6501 .chained = true,
6502 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6504 [ALC269_FIXUP_ATIV_BOOK_8] = {
6505 .type = HDA_FIXUP_FUNC,
6506 .v.func = alc_fixup_auto_mute_via_amp,
6507 .chained = true,
6508 .chain_id = ALC269_FIXUP_NO_SHUTUP
6510 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6511 .type = HDA_FIXUP_PINS,
6512 .v.pins = (const struct hda_pintbl[]) {
6513 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6514 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6517 .chained = true,
6518 .chain_id = ALC269_FIXUP_HEADSET_MODE
6520 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6521 .type = HDA_FIXUP_FUNC,
6522 .v.func = alc_fixup_headset_mode,
6524 [ALC256_FIXUP_ASUS_MIC] = {
6525 .type = HDA_FIXUP_PINS,
6526 .v.pins = (const struct hda_pintbl[]) {
6527 { 0x13, 0x90a60160 }, /* use as internal mic */
6528 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6531 .chained = true,
6532 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6534 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
6535 .type = HDA_FIXUP_FUNC,
6536 /* Set up GPIO2 for the speaker amp */
6537 .v.func = alc_fixup_gpio4,
6539 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6540 .type = HDA_FIXUP_PINS,
6541 .v.pins = (const struct hda_pintbl[]) {
6542 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6545 .chained = true,
6546 .chain_id = ALC269_FIXUP_HEADSET_MIC
6548 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6549 .type = HDA_FIXUP_VERBS,
6550 .v.verbs = (const struct hda_verb[]) {
6551 /* Enables internal speaker */
6552 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6553 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6556 .chained = true,
6557 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6559 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6560 .type = HDA_FIXUP_FUNC,
6561 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6563 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
6564 .type = HDA_FIXUP_VERBS,
6565 .v.verbs = (const struct hda_verb[]) {
6566 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
6567 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
6570 .chained = true,
6571 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6573 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6574 .type = HDA_FIXUP_PINS,
6575 .v.pins = (const struct hda_pintbl[]) {
6576 /* Change the mic location from front to right, otherwise there are
6577 two front mics with the same name, pulseaudio can't handle them.
6578 This is just a temporary workaround, after applying this fixup,
6579 there will be one "Front Mic" and one "Mic" in this machine.
6581 { 0x1a, 0x04a19040 },
6585 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6586 .type = HDA_FIXUP_PINS,
6587 .v.pins = (const struct hda_pintbl[]) {
6588 { 0x16, 0x0101102f }, /* Rear Headset HP */
6589 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6590 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6591 { 0x1b, 0x02011020 },
6594 .chained = true,
6595 .chain_id = ALC225_FIXUP_S3_POP_NOISE
6597 [ALC225_FIXUP_S3_POP_NOISE] = {
6598 .type = HDA_FIXUP_FUNC,
6599 .v.func = alc225_fixup_s3_pop_noise,
6600 .chained = true,
6601 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6603 [ALC700_FIXUP_INTEL_REFERENCE] = {
6604 .type = HDA_FIXUP_VERBS,
6605 .v.verbs = (const struct hda_verb[]) {
6606 /* Enables internal speaker */
6607 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6608 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6609 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6610 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6611 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6612 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6613 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6614 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6618 [ALC274_FIXUP_DELL_BIND_DACS] = {
6619 .type = HDA_FIXUP_FUNC,
6620 .v.func = alc274_fixup_bind_dacs,
6621 .chained = true,
6622 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6624 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6625 .type = HDA_FIXUP_PINS,
6626 .v.pins = (const struct hda_pintbl[]) {
6627 { 0x1b, 0x0401102f },
6630 .chained = true,
6631 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6633 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
6634 .type = HDA_FIXUP_FUNC,
6635 .v.func = alc_fixup_tpt470_dock,
6636 .chained = true,
6637 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6639 [ALC298_FIXUP_TPT470_DOCK] = {
6640 .type = HDA_FIXUP_FUNC,
6641 .v.func = alc_fixup_tpt470_dacs,
6642 .chained = true,
6643 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
6645 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6646 .type = HDA_FIXUP_PINS,
6647 .v.pins = (const struct hda_pintbl[]) {
6648 { 0x14, 0x0201101f },
6651 .chained = true,
6652 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6654 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6655 .type = HDA_FIXUP_PINS,
6656 .v.pins = (const struct hda_pintbl[]) {
6657 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6660 .chained = true,
6661 .chain_id = ALC269_FIXUP_HEADSET_MIC
6663 [ALC295_FIXUP_HP_X360] = {
6664 .type = HDA_FIXUP_FUNC,
6665 .v.func = alc295_fixup_hp_top_speakers,
6666 .chained = true,
6667 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
6669 [ALC221_FIXUP_HP_HEADSET_MIC] = {
6670 .type = HDA_FIXUP_PINS,
6671 .v.pins = (const struct hda_pintbl[]) {
6672 { 0x19, 0x0181313f},
6675 .chained = true,
6676 .chain_id = ALC269_FIXUP_HEADSET_MIC
6678 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
6679 .type = HDA_FIXUP_FUNC,
6680 .v.func = alc285_fixup_invalidate_dacs,
6681 .chained = true,
6682 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6684 [ALC295_FIXUP_HP_AUTO_MUTE] = {
6685 .type = HDA_FIXUP_FUNC,
6686 .v.func = alc_fixup_auto_mute_via_amp,
6688 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
6689 .type = HDA_FIXUP_PINS,
6690 .v.pins = (const struct hda_pintbl[]) {
6691 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6694 .chained = true,
6695 .chain_id = ALC269_FIXUP_HEADSET_MIC
6697 [ALC294_FIXUP_ASUS_MIC] = {
6698 .type = HDA_FIXUP_PINS,
6699 .v.pins = (const struct hda_pintbl[]) {
6700 { 0x13, 0x90a60160 }, /* use as internal mic */
6701 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6704 .chained = true,
6705 .chain_id = ALC269_FIXUP_HEADSET_MIC
6707 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
6708 .type = HDA_FIXUP_PINS,
6709 .v.pins = (const struct hda_pintbl[]) {
6710 { 0x19, 0x01a1103c }, /* use as headset mic */
6713 .chained = true,
6714 .chain_id = ALC269_FIXUP_HEADSET_MIC
6716 [ALC294_FIXUP_ASUS_SPK] = {
6717 .type = HDA_FIXUP_VERBS,
6718 .v.verbs = (const struct hda_verb[]) {
6719 /* Set EAPD high */
6720 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
6721 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
6722 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
6723 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
6726 .chained = true,
6727 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
6729 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
6730 .type = HDA_FIXUP_PINS,
6731 .v.pins = (const struct hda_pintbl[]) {
6732 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6735 .chained = true,
6736 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6738 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
6739 .type = HDA_FIXUP_VERBS,
6740 .v.verbs = (const struct hda_verb[]) {
6741 /* Disable PCBEEP-IN passthrough */
6742 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6743 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6746 .chained = true,
6747 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
6749 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
6750 .type = HDA_FIXUP_PINS,
6751 .v.pins = (const struct hda_pintbl[]) {
6752 { 0x19, 0x03a11130 },
6753 { 0x1a, 0x90a60140 }, /* use as internal mic */
6756 .chained = true,
6757 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6759 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
6760 .type = HDA_FIXUP_PINS,
6761 .v.pins = (const struct hda_pintbl[]) {
6762 { 0x16, 0x01011020 }, /* Rear Line out */
6763 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
6766 .chained = true,
6767 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
6769 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
6770 .type = HDA_FIXUP_FUNC,
6771 .v.func = alc_fixup_auto_mute_via_amp,
6772 .chained = true,
6773 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
6775 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
6776 .type = HDA_FIXUP_FUNC,
6777 .v.func = alc_fixup_disable_mic_vref,
6778 .chained = true,
6779 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6781 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
6782 .type = HDA_FIXUP_VERBS,
6783 .v.verbs = (const struct hda_verb[]) {
6784 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
6785 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
6788 .chained = true,
6789 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
6791 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
6792 .type = HDA_FIXUP_PINS,
6793 .v.pins = (const struct hda_pintbl[]) {
6794 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
6797 .chained = true,
6798 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6800 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6801 .type = HDA_FIXUP_PINS,
6802 .v.pins = (const struct hda_pintbl[]) {
6803 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6806 .chained = true,
6807 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6809 [ALC299_FIXUP_PREDATOR_SPK] = {
6810 .type = HDA_FIXUP_PINS,
6811 .v.pins = (const struct hda_pintbl[]) {
6812 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
6816 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
6817 .type = HDA_FIXUP_PINS,
6818 .v.pins = (const struct hda_pintbl[]) {
6819 { 0x19, 0x04a11040 },
6820 { 0x21, 0x04211020 },
6823 .chained = true,
6824 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6826 [ALC289_FIXUP_DELL_SPK2] = {
6827 .type = HDA_FIXUP_PINS,
6828 .v.pins = (const struct hda_pintbl[]) {
6829 { 0x17, 0x90170130 }, /* bass spk */
6832 .chained = true,
6833 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
6835 [ALC289_FIXUP_DUAL_SPK] = {
6836 .type = HDA_FIXUP_FUNC,
6837 .v.func = alc285_fixup_speaker2_to_dac1,
6838 .chained = true,
6839 .chain_id = ALC289_FIXUP_DELL_SPK2
6841 [ALC294_FIXUP_SPK2_TO_DAC1] = {
6842 .type = HDA_FIXUP_FUNC,
6843 .v.func = alc285_fixup_speaker2_to_dac1,
6844 .chained = true,
6845 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
6847 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
6848 .type = HDA_FIXUP_FUNC,
6849 /* The GPIO must be pulled to initialize the AMP */
6850 .v.func = alc_fixup_gpio4,
6851 .chained = true,
6852 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
6854 [ALC294_FIXUP_ASUS_HPE] = {
6855 .type = HDA_FIXUP_VERBS,
6856 .v.verbs = (const struct hda_verb[]) {
6857 /* Set EAPD high */
6858 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
6859 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
6862 .chained = true,
6863 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
6865 [ALC285_FIXUP_HP_GPIO_LED] = {
6866 .type = HDA_FIXUP_FUNC,
6867 .v.func = alc285_fixup_hp_gpio_led,
6871 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6872 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
6873 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6874 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
6875 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
6876 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6877 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6878 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6879 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
6880 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
6881 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
6882 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
6883 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6884 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
6885 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
6886 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
6887 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
6888 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6889 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6890 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6891 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6892 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
6893 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
6894 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6895 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
6896 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
6897 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
6898 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6899 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
6900 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
6901 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6902 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6903 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6904 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6905 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6906 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
6907 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
6908 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
6909 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6910 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6911 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
6912 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
6913 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
6914 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
6915 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6916 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6917 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6918 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6919 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6920 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6921 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6922 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
6923 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
6924 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
6925 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
6926 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
6927 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
6928 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
6929 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
6930 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6931 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6932 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6933 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6934 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
6935 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
6936 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
6937 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6938 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
6939 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
6940 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
6941 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
6942 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6943 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6944 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
6945 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
6946 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
6947 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
6948 /* ALC282 */
6949 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6950 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6951 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6952 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6953 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6954 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6955 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6956 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6957 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6958 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6959 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6960 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6961 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
6962 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
6963 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
6964 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6965 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6966 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6967 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6968 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6969 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
6970 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6971 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6972 /* ALC290 */
6973 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6974 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6975 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6976 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6977 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6978 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6979 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6980 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6981 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6982 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
6983 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6984 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6985 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6986 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6987 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6988 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6989 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6990 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6991 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6992 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6993 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6994 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6995 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6996 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6997 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6998 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6999 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7000 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7001 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7002 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
7003 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7004 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7005 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
7006 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
7007 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
7008 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7009 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7010 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
7011 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
7012 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
7013 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_LED),
7014 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7015 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
7016 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7017 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
7018 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7019 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7020 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7021 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7022 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
7023 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
7024 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
7025 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
7026 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
7027 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
7028 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
7029 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
7030 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
7031 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
7032 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
7033 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
7034 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
7035 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
7036 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7037 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7038 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
7039 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
7040 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
7041 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
7042 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7043 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7044 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
7045 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
7046 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
7047 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
7048 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7049 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7050 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
7051 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
7052 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
7053 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
7054 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
7055 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
7056 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
7057 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
7058 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
7059 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
7060 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
7061 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
7062 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
7063 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
7064 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7065 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7066 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
7067 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
7068 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
7069 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
7070 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7071 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
7072 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
7073 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
7074 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
7075 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
7076 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
7077 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
7078 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
7079 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
7080 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
7081 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
7082 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
7083 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
7084 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
7085 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
7086 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7087 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
7088 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7089 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
7090 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
7091 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
7092 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7093 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7094 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
7095 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
7096 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
7097 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7098 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7099 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
7100 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7101 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7102 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7103 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7104 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
7105 SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
7106 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
7107 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
7108 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7109 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7110 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7111 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7112 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
7113 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7114 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7115 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
7116 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
7117 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
7118 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
7119 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7120 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
7121 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
7122 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7123 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
7124 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
7125 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
7126 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
7127 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
7128 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
7129 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
7130 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
7131 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7132 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7133 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7134 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
7135 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7136 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
7137 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
7138 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
7139 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MBXP", ALC256_FIXUP_HUAWEI_MBXP_PINS),
7140 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
7141 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
7142 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
7144 #if 0
7145 /* Below is a quirk table taken from the old code.
7146 * Basically the device should work as is without the fixup table.
7147 * If BIOS doesn't give a proper info, enable the corresponding
7148 * fixup entry.
7150 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
7151 ALC269_FIXUP_AMIC),
7152 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
7153 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
7154 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
7155 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
7156 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
7157 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
7158 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
7159 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
7160 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
7161 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
7162 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
7163 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
7164 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
7165 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
7166 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
7167 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
7168 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
7169 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
7170 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
7171 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
7172 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
7173 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
7174 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
7175 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
7176 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
7177 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
7178 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
7179 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
7180 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
7181 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
7182 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
7183 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
7184 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
7185 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
7186 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
7187 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
7188 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
7189 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
7190 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
7191 #endif
7195 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
7196 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
7197 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
7198 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
7199 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
7203 static const struct hda_model_fixup alc269_fixup_models[] = {
7204 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
7205 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
7206 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
7207 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
7208 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7209 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
7210 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
7211 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
7212 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
7213 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
7214 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
7215 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
7216 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
7217 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
7218 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
7219 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
7220 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
7221 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
7222 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
7223 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
7224 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
7225 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
7226 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
7227 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
7228 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
7229 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
7230 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
7231 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
7232 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
7233 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
7234 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
7235 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
7236 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
7237 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
7238 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
7239 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
7240 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
7241 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
7242 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
7243 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
7244 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
7245 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
7246 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
7247 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
7248 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
7249 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
7250 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
7251 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
7252 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
7253 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
7254 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
7255 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
7256 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
7257 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
7258 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
7259 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
7260 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
7261 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
7262 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
7263 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
7264 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
7265 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
7266 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
7267 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
7268 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
7269 {.id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, .name = "alc255-dell-mute"},
7270 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
7271 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
7272 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
7273 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
7274 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
7275 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
7276 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
7277 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
7278 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
7279 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
7280 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
7281 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
7282 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
7283 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
7284 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
7285 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
7286 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
7287 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
7288 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
7289 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
7290 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
7291 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
7292 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
7293 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
7294 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
7295 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
7296 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
7297 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
7298 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
7299 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
7300 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
7301 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
7302 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
7303 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
7304 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
7305 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
7306 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
7307 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
7308 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
7309 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
7312 #define ALC225_STANDARD_PINS \
7313 {0x21, 0x04211020}
7315 #define ALC256_STANDARD_PINS \
7316 {0x12, 0x90a60140}, \
7317 {0x14, 0x90170110}, \
7318 {0x21, 0x02211020}
7320 #define ALC282_STANDARD_PINS \
7321 {0x14, 0x90170110}
7323 #define ALC290_STANDARD_PINS \
7324 {0x12, 0x99a30130}
7326 #define ALC292_STANDARD_PINS \
7327 {0x14, 0x90170110}, \
7328 {0x15, 0x0221401f}
7330 #define ALC295_STANDARD_PINS \
7331 {0x12, 0xb7a60130}, \
7332 {0x14, 0x90170110}, \
7333 {0x21, 0x04211020}
7335 #define ALC298_STANDARD_PINS \
7336 {0x12, 0x90a60130}, \
7337 {0x21, 0x03211020}
7339 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
7340 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
7341 {0x14, 0x01014020},
7342 {0x17, 0x90170110},
7343 {0x18, 0x02a11030},
7344 {0x19, 0x0181303F},
7345 {0x21, 0x0221102f}),
7346 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7347 {0x12, 0x90a601c0},
7348 {0x14, 0x90171120},
7349 {0x21, 0x02211030}),
7350 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7351 {0x14, 0x90170110},
7352 {0x1b, 0x90a70130},
7353 {0x21, 0x03211020}),
7354 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7355 {0x1a, 0x90a70130},
7356 {0x1b, 0x90170110},
7357 {0x21, 0x03211020}),
7358 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7359 ALC225_STANDARD_PINS,
7360 {0x12, 0xb7a60130},
7361 {0x14, 0x901701a0}),
7362 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7363 ALC225_STANDARD_PINS,
7364 {0x12, 0xb7a60130},
7365 {0x14, 0x901701b0}),
7366 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7367 ALC225_STANDARD_PINS,
7368 {0x12, 0xb7a60150},
7369 {0x14, 0x901701a0}),
7370 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7371 ALC225_STANDARD_PINS,
7372 {0x12, 0xb7a60150},
7373 {0x14, 0x901701b0}),
7374 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7375 ALC225_STANDARD_PINS,
7376 {0x12, 0xb7a60130},
7377 {0x1b, 0x90170110}),
7378 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7379 {0x1b, 0x01111010},
7380 {0x1e, 0x01451130},
7381 {0x21, 0x02211020}),
7382 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7383 {0x12, 0x90a60140},
7384 {0x14, 0x90170110},
7385 {0x19, 0x02a11030},
7386 {0x21, 0x02211020}),
7387 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7388 {0x14, 0x90170110},
7389 {0x19, 0x02a11030},
7390 {0x1a, 0x02a11040},
7391 {0x1b, 0x01014020},
7392 {0x21, 0x0221101f}),
7393 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7394 {0x14, 0x90170110},
7395 {0x19, 0x02a11030},
7396 {0x1a, 0x02a11040},
7397 {0x1b, 0x01011020},
7398 {0x21, 0x0221101f}),
7399 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7400 {0x14, 0x90170110},
7401 {0x19, 0x02a11020},
7402 {0x1a, 0x02a11030},
7403 {0x21, 0x0221101f}),
7404 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7405 {0x12, 0x90a60140},
7406 {0x14, 0x90170110},
7407 {0x21, 0x02211020}),
7408 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7409 {0x12, 0x90a60140},
7410 {0x14, 0x90170150},
7411 {0x21, 0x02211020}),
7412 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7413 {0x21, 0x02211020}),
7414 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7415 {0x12, 0x40000000},
7416 {0x14, 0x90170110},
7417 {0x21, 0x02211020}),
7418 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7419 {0x14, 0x90170110},
7420 {0x21, 0x02211020}),
7421 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7422 {0x14, 0x90170130},
7423 {0x21, 0x02211040}),
7424 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7425 {0x12, 0x90a60140},
7426 {0x14, 0x90170110},
7427 {0x21, 0x02211020}),
7428 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7429 {0x12, 0x90a60160},
7430 {0x14, 0x90170120},
7431 {0x21, 0x02211030}),
7432 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7433 {0x14, 0x90170110},
7434 {0x1b, 0x02011020},
7435 {0x21, 0x0221101f}),
7436 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7437 {0x14, 0x90170110},
7438 {0x1b, 0x01011020},
7439 {0x21, 0x0221101f}),
7440 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7441 {0x14, 0x90170130},
7442 {0x1b, 0x01014020},
7443 {0x21, 0x0221103f}),
7444 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7445 {0x14, 0x90170130},
7446 {0x1b, 0x01011020},
7447 {0x21, 0x0221103f}),
7448 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7449 {0x14, 0x90170130},
7450 {0x1b, 0x02011020},
7451 {0x21, 0x0221103f}),
7452 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7453 {0x14, 0x90170150},
7454 {0x1b, 0x02011020},
7455 {0x21, 0x0221105f}),
7456 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7457 {0x14, 0x90170110},
7458 {0x1b, 0x01014020},
7459 {0x21, 0x0221101f}),
7460 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7461 {0x12, 0x90a60160},
7462 {0x14, 0x90170120},
7463 {0x17, 0x90170140},
7464 {0x21, 0x0321102f}),
7465 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7466 {0x12, 0x90a60160},
7467 {0x14, 0x90170130},
7468 {0x21, 0x02211040}),
7469 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7470 {0x12, 0x90a60160},
7471 {0x14, 0x90170140},
7472 {0x21, 0x02211050}),
7473 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7474 {0x12, 0x90a60170},
7475 {0x14, 0x90170120},
7476 {0x21, 0x02211030}),
7477 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7478 {0x12, 0x90a60170},
7479 {0x14, 0x90170130},
7480 {0x21, 0x02211040}),
7481 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7482 {0x12, 0x90a60170},
7483 {0x14, 0x90171130},
7484 {0x21, 0x02211040}),
7485 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7486 {0x12, 0x90a60170},
7487 {0x14, 0x90170140},
7488 {0x21, 0x02211050}),
7489 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7490 {0x12, 0x90a60180},
7491 {0x14, 0x90170130},
7492 {0x21, 0x02211040}),
7493 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7494 {0x12, 0x90a60180},
7495 {0x14, 0x90170120},
7496 {0x21, 0x02211030}),
7497 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7498 {0x1b, 0x01011020},
7499 {0x21, 0x02211010}),
7500 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7501 {0x12, 0x90a60130},
7502 {0x14, 0x90170110},
7503 {0x1b, 0x01011020},
7504 {0x21, 0x0221101f}),
7505 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7506 {0x12, 0x90a60160},
7507 {0x14, 0x90170120},
7508 {0x21, 0x02211030}),
7509 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7510 {0x12, 0x90a60170},
7511 {0x14, 0x90170120},
7512 {0x21, 0x02211030}),
7513 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7514 {0x12, 0x90a60180},
7515 {0x14, 0x90170120},
7516 {0x21, 0x02211030}),
7517 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7518 {0x12, 0xb7a60130},
7519 {0x14, 0x90170110},
7520 {0x21, 0x02211020}),
7521 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7522 {0x12, 0x90a60130},
7523 {0x14, 0x90170110},
7524 {0x14, 0x01011020},
7525 {0x21, 0x0221101f}),
7526 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7527 ALC256_STANDARD_PINS),
7528 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7529 {0x14, 0x90170110},
7530 {0x1b, 0x01011020},
7531 {0x21, 0x0221101f}),
7532 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7533 {0x14, 0x90170110},
7534 {0x1b, 0x90a70130},
7535 {0x21, 0x04211020}),
7536 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7537 {0x14, 0x90170110},
7538 {0x1b, 0x90a70130},
7539 {0x21, 0x03211020}),
7540 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7541 {0x12, 0x90a60130},
7542 {0x14, 0x90170110},
7543 {0x21, 0x03211020}),
7544 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7545 {0x12, 0x90a60130},
7546 {0x14, 0x90170110},
7547 {0x21, 0x04211020}),
7548 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7549 {0x1a, 0x90a70130},
7550 {0x1b, 0x90170110},
7551 {0x21, 0x03211020}),
7552 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7553 {0x12, 0xb7a60130},
7554 {0x13, 0xb8a61140},
7555 {0x16, 0x90170110},
7556 {0x21, 0x04211020}),
7557 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
7558 {0x12, 0x90a60130},
7559 {0x14, 0x90170110},
7560 {0x15, 0x0421101f},
7561 {0x1a, 0x04a11020}),
7562 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
7563 {0x12, 0x90a60140},
7564 {0x14, 0x90170110},
7565 {0x15, 0x0421101f},
7566 {0x18, 0x02811030},
7567 {0x1a, 0x04a1103f},
7568 {0x1b, 0x02011020}),
7569 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7570 ALC282_STANDARD_PINS,
7571 {0x12, 0x99a30130},
7572 {0x19, 0x03a11020},
7573 {0x21, 0x0321101f}),
7574 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7575 ALC282_STANDARD_PINS,
7576 {0x12, 0x99a30130},
7577 {0x19, 0x03a11020},
7578 {0x21, 0x03211040}),
7579 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7580 ALC282_STANDARD_PINS,
7581 {0x12, 0x99a30130},
7582 {0x19, 0x03a11030},
7583 {0x21, 0x03211020}),
7584 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7585 ALC282_STANDARD_PINS,
7586 {0x12, 0x99a30130},
7587 {0x19, 0x04a11020},
7588 {0x21, 0x0421101f}),
7589 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
7590 ALC282_STANDARD_PINS,
7591 {0x12, 0x90a60140},
7592 {0x19, 0x04a11030},
7593 {0x21, 0x04211020}),
7594 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7595 ALC282_STANDARD_PINS,
7596 {0x12, 0x90a60130},
7597 {0x21, 0x0321101f}),
7598 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7599 {0x12, 0x90a60160},
7600 {0x14, 0x90170120},
7601 {0x21, 0x02211030}),
7602 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7603 ALC282_STANDARD_PINS,
7604 {0x12, 0x90a60130},
7605 {0x19, 0x03a11020},
7606 {0x21, 0x0321101f}),
7607 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7608 {0x12, 0x90a60130},
7609 {0x14, 0x90170110},
7610 {0x19, 0x04a11040},
7611 {0x21, 0x04211020}),
7612 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7613 {0x12, 0x90a60130},
7614 {0x17, 0x90170110},
7615 {0x21, 0x02211020}),
7616 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7617 {0x12, 0x90a60120},
7618 {0x14, 0x90170110},
7619 {0x21, 0x0321101f}),
7620 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7621 {0x12, 0xb7a60130},
7622 {0x14, 0x90170110},
7623 {0x21, 0x04211020}),
7624 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7625 ALC290_STANDARD_PINS,
7626 {0x15, 0x04211040},
7627 {0x18, 0x90170112},
7628 {0x1a, 0x04a11020}),
7629 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7630 ALC290_STANDARD_PINS,
7631 {0x15, 0x04211040},
7632 {0x18, 0x90170110},
7633 {0x1a, 0x04a11020}),
7634 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7635 ALC290_STANDARD_PINS,
7636 {0x15, 0x0421101f},
7637 {0x1a, 0x04a11020}),
7638 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7639 ALC290_STANDARD_PINS,
7640 {0x15, 0x04211020},
7641 {0x1a, 0x04a11040}),
7642 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7643 ALC290_STANDARD_PINS,
7644 {0x14, 0x90170110},
7645 {0x15, 0x04211020},
7646 {0x1a, 0x04a11040}),
7647 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7648 ALC290_STANDARD_PINS,
7649 {0x14, 0x90170110},
7650 {0x15, 0x04211020},
7651 {0x1a, 0x04a11020}),
7652 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
7653 ALC290_STANDARD_PINS,
7654 {0x14, 0x90170110},
7655 {0x15, 0x0421101f},
7656 {0x1a, 0x04a11020}),
7657 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7658 ALC292_STANDARD_PINS,
7659 {0x12, 0x90a60140},
7660 {0x16, 0x01014020},
7661 {0x19, 0x01a19030}),
7662 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7663 ALC292_STANDARD_PINS,
7664 {0x12, 0x90a60140},
7665 {0x16, 0x01014020},
7666 {0x18, 0x02a19031},
7667 {0x19, 0x01a1903e}),
7668 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7669 ALC292_STANDARD_PINS,
7670 {0x12, 0x90a60140}),
7671 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7672 ALC292_STANDARD_PINS,
7673 {0x13, 0x90a60140},
7674 {0x16, 0x21014020},
7675 {0x19, 0x21a19030}),
7676 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7677 ALC292_STANDARD_PINS,
7678 {0x13, 0x90a60140}),
7679 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
7680 {0x14, 0x90170110},
7681 {0x1b, 0x90a70130},
7682 {0x21, 0x04211020}),
7683 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7684 {0x12, 0x90a60130},
7685 {0x17, 0x90170110},
7686 {0x21, 0x03211020}),
7687 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7688 {0x12, 0x90a60130},
7689 {0x17, 0x90170110},
7690 {0x21, 0x04211020}),
7691 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7692 {0x12, 0x90a60130},
7693 {0x17, 0x90170110},
7694 {0x21, 0x03211020}),
7695 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7696 {0x14, 0x90170110},
7697 {0x21, 0x04211020}),
7698 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7699 {0x14, 0x90170110},
7700 {0x21, 0x04211030}),
7701 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7702 ALC295_STANDARD_PINS,
7703 {0x17, 0x21014020},
7704 {0x18, 0x21a19030}),
7705 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7706 ALC295_STANDARD_PINS,
7707 {0x17, 0x21014040},
7708 {0x18, 0x21a19050}),
7709 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7710 ALC295_STANDARD_PINS),
7711 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7712 ALC298_STANDARD_PINS,
7713 {0x17, 0x90170110}),
7714 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7715 ALC298_STANDARD_PINS,
7716 {0x17, 0x90170140}),
7717 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7718 ALC298_STANDARD_PINS,
7719 {0x17, 0x90170150}),
7720 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7721 {0x12, 0xb7a60140},
7722 {0x13, 0xb7a60150},
7723 {0x17, 0x90170110},
7724 {0x1a, 0x03011020},
7725 {0x21, 0x03211030}),
7726 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7727 ALC225_STANDARD_PINS,
7728 {0x12, 0xb7a60130},
7729 {0x17, 0x90170110}),
7730 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
7731 {0x14, 0x01014010},
7732 {0x17, 0x90170120},
7733 {0x18, 0x02a11030},
7734 {0x19, 0x02a1103f},
7735 {0x21, 0x0221101f}),
7739 static void alc269_fill_coef(struct hda_codec *codec)
7741 struct alc_spec *spec = codec->spec;
7742 int val;
7744 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
7745 return;
7747 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
7748 alc_write_coef_idx(codec, 0xf, 0x960b);
7749 alc_write_coef_idx(codec, 0xe, 0x8817);
7752 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
7753 alc_write_coef_idx(codec, 0xf, 0x960b);
7754 alc_write_coef_idx(codec, 0xe, 0x8814);
7757 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
7758 /* Power up output pin */
7759 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
7762 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
7763 val = alc_read_coef_idx(codec, 0xd);
7764 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
7765 /* Capless ramp up clock control */
7766 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7768 val = alc_read_coef_idx(codec, 0x17);
7769 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
7770 /* Class D power on reset */
7771 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7775 /* HP */
7776 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
7781 static int patch_alc269(struct hda_codec *codec)
7783 struct alc_spec *spec;
7784 int err;
7786 err = alc_alloc_spec(codec, 0x0b);
7787 if (err < 0)
7788 return err;
7790 spec = codec->spec;
7791 spec->gen.shared_mic_vref_pin = 0x18;
7792 codec->power_save_node = 0;
7794 #ifdef CONFIG_PM
7795 codec->patch_ops.suspend = alc269_suspend;
7796 codec->patch_ops.resume = alc269_resume;
7797 #endif
7798 spec->shutup = alc_default_shutup;
7799 spec->init_hook = alc_default_init;
7801 switch (codec->core.vendor_id) {
7802 case 0x10ec0269:
7803 spec->codec_variant = ALC269_TYPE_ALC269VA;
7804 switch (alc_get_coef0(codec) & 0x00f0) {
7805 case 0x0010:
7806 if (codec->bus->pci &&
7807 codec->bus->pci->subsystem_vendor == 0x1025 &&
7808 spec->cdefine.platform_type == 1)
7809 err = alc_codec_rename(codec, "ALC271X");
7810 spec->codec_variant = ALC269_TYPE_ALC269VB;
7811 break;
7812 case 0x0020:
7813 if (codec->bus->pci &&
7814 codec->bus->pci->subsystem_vendor == 0x17aa &&
7815 codec->bus->pci->subsystem_device == 0x21f3)
7816 err = alc_codec_rename(codec, "ALC3202");
7817 spec->codec_variant = ALC269_TYPE_ALC269VC;
7818 break;
7819 case 0x0030:
7820 spec->codec_variant = ALC269_TYPE_ALC269VD;
7821 break;
7822 default:
7823 alc_fix_pll_init(codec, 0x20, 0x04, 15);
7825 if (err < 0)
7826 goto error;
7827 spec->shutup = alc269_shutup;
7828 spec->init_hook = alc269_fill_coef;
7829 alc269_fill_coef(codec);
7830 break;
7832 case 0x10ec0280:
7833 case 0x10ec0290:
7834 spec->codec_variant = ALC269_TYPE_ALC280;
7835 break;
7836 case 0x10ec0282:
7837 spec->codec_variant = ALC269_TYPE_ALC282;
7838 spec->shutup = alc282_shutup;
7839 spec->init_hook = alc282_init;
7840 break;
7841 case 0x10ec0233:
7842 case 0x10ec0283:
7843 spec->codec_variant = ALC269_TYPE_ALC283;
7844 spec->shutup = alc283_shutup;
7845 spec->init_hook = alc283_init;
7846 break;
7847 case 0x10ec0284:
7848 case 0x10ec0292:
7849 spec->codec_variant = ALC269_TYPE_ALC284;
7850 break;
7851 case 0x10ec0293:
7852 spec->codec_variant = ALC269_TYPE_ALC293;
7853 break;
7854 case 0x10ec0286:
7855 case 0x10ec0288:
7856 spec->codec_variant = ALC269_TYPE_ALC286;
7857 break;
7858 case 0x10ec0298:
7859 spec->codec_variant = ALC269_TYPE_ALC298;
7860 break;
7861 case 0x10ec0235:
7862 case 0x10ec0255:
7863 spec->codec_variant = ALC269_TYPE_ALC255;
7864 spec->shutup = alc256_shutup;
7865 spec->init_hook = alc256_init;
7866 break;
7867 case 0x10ec0236:
7868 case 0x10ec0256:
7869 spec->codec_variant = ALC269_TYPE_ALC256;
7870 spec->shutup = alc256_shutup;
7871 spec->init_hook = alc256_init;
7872 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
7873 break;
7874 case 0x10ec0257:
7875 spec->codec_variant = ALC269_TYPE_ALC257;
7876 spec->shutup = alc256_shutup;
7877 spec->init_hook = alc256_init;
7878 spec->gen.mixer_nid = 0;
7879 break;
7880 case 0x10ec0215:
7881 case 0x10ec0245:
7882 case 0x10ec0285:
7883 case 0x10ec0287:
7884 case 0x10ec0289:
7885 spec->codec_variant = ALC269_TYPE_ALC215;
7886 spec->shutup = alc225_shutup;
7887 spec->init_hook = alc225_init;
7888 spec->gen.mixer_nid = 0;
7889 break;
7890 case 0x10ec0225:
7891 case 0x10ec0295:
7892 case 0x10ec0299:
7893 spec->codec_variant = ALC269_TYPE_ALC225;
7894 spec->shutup = alc225_shutup;
7895 spec->init_hook = alc225_init;
7896 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
7897 break;
7898 case 0x10ec0234:
7899 case 0x10ec0274:
7900 case 0x10ec0294:
7901 spec->codec_variant = ALC269_TYPE_ALC294;
7902 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
7903 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
7904 spec->init_hook = alc294_init;
7905 break;
7906 case 0x10ec0300:
7907 spec->codec_variant = ALC269_TYPE_ALC300;
7908 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
7909 break;
7910 case 0x10ec0623:
7911 spec->codec_variant = ALC269_TYPE_ALC623;
7912 break;
7913 case 0x10ec0700:
7914 case 0x10ec0701:
7915 case 0x10ec0703:
7916 case 0x10ec0711:
7917 spec->codec_variant = ALC269_TYPE_ALC700;
7918 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
7919 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
7920 spec->init_hook = alc294_init;
7921 break;
7925 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
7926 spec->has_alc5505_dsp = 1;
7927 spec->init_hook = alc5505_dsp_init;
7930 snd_hda_pick_fixup(codec, alc269_fixup_models,
7931 alc269_fixup_tbl, alc269_fixups);
7932 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
7933 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7934 alc269_fixups);
7935 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7937 alc_auto_parse_customize_define(codec);
7939 if (has_cdefine_beep(codec))
7940 spec->gen.beep_nid = 0x01;
7942 /* automatic parse from the BIOS config */
7943 err = alc269_parse_auto_config(codec);
7944 if (err < 0)
7945 goto error;
7947 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
7948 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
7949 if (err < 0)
7950 goto error;
7953 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
7955 return 0;
7957 error:
7958 alc_free(codec);
7959 return err;
7963 * ALC861
7966 static int alc861_parse_auto_config(struct hda_codec *codec)
7968 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
7969 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7970 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
7973 /* Pin config fixes */
7974 enum {
7975 ALC861_FIXUP_FSC_AMILO_PI1505,
7976 ALC861_FIXUP_AMP_VREF_0F,
7977 ALC861_FIXUP_NO_JACK_DETECT,
7978 ALC861_FIXUP_ASUS_A6RP,
7979 ALC660_FIXUP_ASUS_W7J,
7982 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7983 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
7984 const struct hda_fixup *fix, int action)
7986 struct alc_spec *spec = codec->spec;
7987 unsigned int val;
7989 if (action != HDA_FIXUP_ACT_INIT)
7990 return;
7991 val = snd_hda_codec_get_pin_target(codec, 0x0f);
7992 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7993 val |= AC_PINCTL_IN_EN;
7994 val |= AC_PINCTL_VREF_50;
7995 snd_hda_set_pin_ctl(codec, 0x0f, val);
7996 spec->gen.keep_vref_in_automute = 1;
7999 /* suppress the jack-detection */
8000 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
8001 const struct hda_fixup *fix, int action)
8003 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8004 codec->no_jack_detect = 1;
8007 static const struct hda_fixup alc861_fixups[] = {
8008 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
8009 .type = HDA_FIXUP_PINS,
8010 .v.pins = (const struct hda_pintbl[]) {
8011 { 0x0b, 0x0221101f }, /* HP */
8012 { 0x0f, 0x90170310 }, /* speaker */
8016 [ALC861_FIXUP_AMP_VREF_0F] = {
8017 .type = HDA_FIXUP_FUNC,
8018 .v.func = alc861_fixup_asus_amp_vref_0f,
8020 [ALC861_FIXUP_NO_JACK_DETECT] = {
8021 .type = HDA_FIXUP_FUNC,
8022 .v.func = alc_fixup_no_jack_detect,
8024 [ALC861_FIXUP_ASUS_A6RP] = {
8025 .type = HDA_FIXUP_FUNC,
8026 .v.func = alc861_fixup_asus_amp_vref_0f,
8027 .chained = true,
8028 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
8030 [ALC660_FIXUP_ASUS_W7J] = {
8031 .type = HDA_FIXUP_VERBS,
8032 .v.verbs = (const struct hda_verb[]) {
8033 /* ASUS W7J needs a magic pin setup on unused NID 0x10
8034 * for enabling outputs
8036 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
8042 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
8043 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
8044 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
8045 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
8046 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
8047 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
8048 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
8049 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
8050 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
8056 static int patch_alc861(struct hda_codec *codec)
8058 struct alc_spec *spec;
8059 int err;
8061 err = alc_alloc_spec(codec, 0x15);
8062 if (err < 0)
8063 return err;
8065 spec = codec->spec;
8066 spec->gen.beep_nid = 0x23;
8068 #ifdef CONFIG_PM
8069 spec->power_hook = alc_power_eapd;
8070 #endif
8072 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
8073 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8075 /* automatic parse from the BIOS config */
8076 err = alc861_parse_auto_config(codec);
8077 if (err < 0)
8078 goto error;
8080 if (!spec->gen.no_analog) {
8081 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
8082 if (err < 0)
8083 goto error;
8086 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8088 return 0;
8090 error:
8091 alc_free(codec);
8092 return err;
8096 * ALC861-VD support
8098 * Based on ALC882
8100 * In addition, an independent DAC
8102 static int alc861vd_parse_auto_config(struct hda_codec *codec)
8104 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
8105 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
8106 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
8109 enum {
8110 ALC660VD_FIX_ASUS_GPIO1,
8111 ALC861VD_FIX_DALLAS,
8114 /* exclude VREF80 */
8115 static void alc861vd_fixup_dallas(struct hda_codec *codec,
8116 const struct hda_fixup *fix, int action)
8118 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8119 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
8120 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8124 /* reset GPIO1 */
8125 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
8126 const struct hda_fixup *fix, int action)
8128 struct alc_spec *spec = codec->spec;
8130 if (action == HDA_FIXUP_ACT_PRE_PROBE)
8131 spec->gpio_mask |= 0x02;
8132 alc_fixup_gpio(codec, action, 0x01);
8135 static const struct hda_fixup alc861vd_fixups[] = {
8136 [ALC660VD_FIX_ASUS_GPIO1] = {
8137 .type = HDA_FIXUP_FUNC,
8138 .v.func = alc660vd_fixup_asus_gpio1,
8140 [ALC861VD_FIX_DALLAS] = {
8141 .type = HDA_FIXUP_FUNC,
8142 .v.func = alc861vd_fixup_dallas,
8146 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8147 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
8148 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8149 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
8155 static int patch_alc861vd(struct hda_codec *codec)
8157 struct alc_spec *spec;
8158 int err;
8160 err = alc_alloc_spec(codec, 0x0b);
8161 if (err < 0)
8162 return err;
8164 spec = codec->spec;
8165 spec->gen.beep_nid = 0x23;
8167 spec->shutup = alc_eapd_shutup;
8169 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
8170 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8172 /* automatic parse from the BIOS config */
8173 err = alc861vd_parse_auto_config(codec);
8174 if (err < 0)
8175 goto error;
8177 if (!spec->gen.no_analog) {
8178 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8179 if (err < 0)
8180 goto error;
8183 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8185 return 0;
8187 error:
8188 alc_free(codec);
8189 return err;
8193 * ALC662 support
8195 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
8196 * configuration. Each pin widget can choose any input DACs and a mixer.
8197 * Each ADC is connected from a mixer of all inputs. This makes possible
8198 * 6-channel independent captures.
8200 * In addition, an independent DAC for the multi-playback (not used in this
8201 * driver yet).
8205 * BIOS auto configuration
8208 static int alc662_parse_auto_config(struct hda_codec *codec)
8210 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
8211 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
8212 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
8213 const hda_nid_t *ssids;
8215 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
8216 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
8217 codec->core.vendor_id == 0x10ec0671)
8218 ssids = alc663_ssids;
8219 else
8220 ssids = alc662_ssids;
8221 return alc_parse_auto_config(codec, alc662_ignore, ssids);
8224 static void alc272_fixup_mario(struct hda_codec *codec,
8225 const struct hda_fixup *fix, int action)
8227 if (action != HDA_FIXUP_ACT_PRE_PROBE)
8228 return;
8229 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
8230 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
8231 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
8232 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
8233 (0 << AC_AMPCAP_MUTE_SHIFT)))
8234 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
8237 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
8238 { .channels = 2,
8239 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
8240 { .channels = 4,
8241 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
8242 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
8246 /* override the 2.1 chmap */
8247 static void alc_fixup_bass_chmap(struct hda_codec *codec,
8248 const struct hda_fixup *fix, int action)
8250 if (action == HDA_FIXUP_ACT_BUILD) {
8251 struct alc_spec *spec = codec->spec;
8252 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8256 /* avoid D3 for keeping GPIO up */
8257 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
8258 hda_nid_t nid,
8259 unsigned int power_state)
8261 struct alc_spec *spec = codec->spec;
8262 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
8263 return AC_PWRST_D0;
8264 return power_state;
8267 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
8268 const struct hda_fixup *fix, int action)
8270 struct alc_spec *spec = codec->spec;
8272 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
8273 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8274 spec->mute_led_polarity = 1;
8275 codec->power_filter = gpio_led_power_filter;
8279 static void alc662_usi_automute_hook(struct hda_codec *codec,
8280 struct hda_jack_callback *jack)
8282 struct alc_spec *spec = codec->spec;
8283 int vref;
8284 msleep(200);
8285 snd_hda_gen_hp_automute(codec, jack);
8287 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
8288 msleep(100);
8289 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8290 vref);
8293 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
8294 const struct hda_fixup *fix, int action)
8296 struct alc_spec *spec = codec->spec;
8297 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8298 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
8299 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
8303 static struct coef_fw alc668_coefs[] = {
8304 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
8305 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
8306 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
8307 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
8308 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
8309 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
8310 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
8311 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
8312 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
8313 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
8314 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
8315 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
8316 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
8317 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
8318 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
8319 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
8320 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
8321 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
8322 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
8323 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
8327 static void alc668_restore_default_value(struct hda_codec *codec)
8329 alc_process_coef_fw(codec, alc668_coefs);
8332 enum {
8333 ALC662_FIXUP_ASPIRE,
8334 ALC662_FIXUP_LED_GPIO1,
8335 ALC662_FIXUP_IDEAPAD,
8336 ALC272_FIXUP_MARIO,
8337 ALC662_FIXUP_CZC_P10T,
8338 ALC662_FIXUP_SKU_IGNORE,
8339 ALC662_FIXUP_HP_RP5800,
8340 ALC662_FIXUP_ASUS_MODE1,
8341 ALC662_FIXUP_ASUS_MODE2,
8342 ALC662_FIXUP_ASUS_MODE3,
8343 ALC662_FIXUP_ASUS_MODE4,
8344 ALC662_FIXUP_ASUS_MODE5,
8345 ALC662_FIXUP_ASUS_MODE6,
8346 ALC662_FIXUP_ASUS_MODE7,
8347 ALC662_FIXUP_ASUS_MODE8,
8348 ALC662_FIXUP_NO_JACK_DETECT,
8349 ALC662_FIXUP_ZOTAC_Z68,
8350 ALC662_FIXUP_INV_DMIC,
8351 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
8352 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
8353 ALC662_FIXUP_HEADSET_MODE,
8354 ALC668_FIXUP_HEADSET_MODE,
8355 ALC662_FIXUP_BASS_MODE4_CHMAP,
8356 ALC662_FIXUP_BASS_16,
8357 ALC662_FIXUP_BASS_1A,
8358 ALC662_FIXUP_BASS_CHMAP,
8359 ALC668_FIXUP_AUTO_MUTE,
8360 ALC668_FIXUP_DELL_DISABLE_AAMIX,
8361 ALC668_FIXUP_DELL_XPS13,
8362 ALC662_FIXUP_ASUS_Nx50,
8363 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
8364 ALC668_FIXUP_ASUS_Nx51,
8365 ALC668_FIXUP_MIC_COEF,
8366 ALC668_FIXUP_ASUS_G751,
8367 ALC891_FIXUP_HEADSET_MODE,
8368 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8369 ALC662_FIXUP_ACER_VERITON,
8370 ALC892_FIXUP_ASROCK_MOBO,
8371 ALC662_FIXUP_USI_FUNC,
8372 ALC662_FIXUP_USI_HEADSET_MODE,
8373 ALC662_FIXUP_LENOVO_MULTI_CODECS,
8376 static const struct hda_fixup alc662_fixups[] = {
8377 [ALC662_FIXUP_ASPIRE] = {
8378 .type = HDA_FIXUP_PINS,
8379 .v.pins = (const struct hda_pintbl[]) {
8380 { 0x15, 0x99130112 }, /* subwoofer */
8384 [ALC662_FIXUP_LED_GPIO1] = {
8385 .type = HDA_FIXUP_FUNC,
8386 .v.func = alc662_fixup_led_gpio1,
8388 [ALC662_FIXUP_IDEAPAD] = {
8389 .type = HDA_FIXUP_PINS,
8390 .v.pins = (const struct hda_pintbl[]) {
8391 { 0x17, 0x99130112 }, /* subwoofer */
8394 .chained = true,
8395 .chain_id = ALC662_FIXUP_LED_GPIO1,
8397 [ALC272_FIXUP_MARIO] = {
8398 .type = HDA_FIXUP_FUNC,
8399 .v.func = alc272_fixup_mario,
8401 [ALC662_FIXUP_CZC_P10T] = {
8402 .type = HDA_FIXUP_VERBS,
8403 .v.verbs = (const struct hda_verb[]) {
8404 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8408 [ALC662_FIXUP_SKU_IGNORE] = {
8409 .type = HDA_FIXUP_FUNC,
8410 .v.func = alc_fixup_sku_ignore,
8412 [ALC662_FIXUP_HP_RP5800] = {
8413 .type = HDA_FIXUP_PINS,
8414 .v.pins = (const struct hda_pintbl[]) {
8415 { 0x14, 0x0221201f }, /* HP out */
8418 .chained = true,
8419 .chain_id = ALC662_FIXUP_SKU_IGNORE
8421 [ALC662_FIXUP_ASUS_MODE1] = {
8422 .type = HDA_FIXUP_PINS,
8423 .v.pins = (const struct hda_pintbl[]) {
8424 { 0x14, 0x99130110 }, /* speaker */
8425 { 0x18, 0x01a19c20 }, /* mic */
8426 { 0x19, 0x99a3092f }, /* int-mic */
8427 { 0x21, 0x0121401f }, /* HP out */
8430 .chained = true,
8431 .chain_id = ALC662_FIXUP_SKU_IGNORE
8433 [ALC662_FIXUP_ASUS_MODE2] = {
8434 .type = HDA_FIXUP_PINS,
8435 .v.pins = (const struct hda_pintbl[]) {
8436 { 0x14, 0x99130110 }, /* speaker */
8437 { 0x18, 0x01a19820 }, /* mic */
8438 { 0x19, 0x99a3092f }, /* int-mic */
8439 { 0x1b, 0x0121401f }, /* HP out */
8442 .chained = true,
8443 .chain_id = ALC662_FIXUP_SKU_IGNORE
8445 [ALC662_FIXUP_ASUS_MODE3] = {
8446 .type = HDA_FIXUP_PINS,
8447 .v.pins = (const struct hda_pintbl[]) {
8448 { 0x14, 0x99130110 }, /* speaker */
8449 { 0x15, 0x0121441f }, /* HP */
8450 { 0x18, 0x01a19840 }, /* mic */
8451 { 0x19, 0x99a3094f }, /* int-mic */
8452 { 0x21, 0x01211420 }, /* HP2 */
8455 .chained = true,
8456 .chain_id = ALC662_FIXUP_SKU_IGNORE
8458 [ALC662_FIXUP_ASUS_MODE4] = {
8459 .type = HDA_FIXUP_PINS,
8460 .v.pins = (const struct hda_pintbl[]) {
8461 { 0x14, 0x99130110 }, /* speaker */
8462 { 0x16, 0x99130111 }, /* speaker */
8463 { 0x18, 0x01a19840 }, /* mic */
8464 { 0x19, 0x99a3094f }, /* int-mic */
8465 { 0x21, 0x0121441f }, /* HP */
8468 .chained = true,
8469 .chain_id = ALC662_FIXUP_SKU_IGNORE
8471 [ALC662_FIXUP_ASUS_MODE5] = {
8472 .type = HDA_FIXUP_PINS,
8473 .v.pins = (const struct hda_pintbl[]) {
8474 { 0x14, 0x99130110 }, /* speaker */
8475 { 0x15, 0x0121441f }, /* HP */
8476 { 0x16, 0x99130111 }, /* speaker */
8477 { 0x18, 0x01a19840 }, /* mic */
8478 { 0x19, 0x99a3094f }, /* int-mic */
8481 .chained = true,
8482 .chain_id = ALC662_FIXUP_SKU_IGNORE
8484 [ALC662_FIXUP_ASUS_MODE6] = {
8485 .type = HDA_FIXUP_PINS,
8486 .v.pins = (const struct hda_pintbl[]) {
8487 { 0x14, 0x99130110 }, /* speaker */
8488 { 0x15, 0x01211420 }, /* HP2 */
8489 { 0x18, 0x01a19840 }, /* mic */
8490 { 0x19, 0x99a3094f }, /* int-mic */
8491 { 0x1b, 0x0121441f }, /* HP */
8494 .chained = true,
8495 .chain_id = ALC662_FIXUP_SKU_IGNORE
8497 [ALC662_FIXUP_ASUS_MODE7] = {
8498 .type = HDA_FIXUP_PINS,
8499 .v.pins = (const struct hda_pintbl[]) {
8500 { 0x14, 0x99130110 }, /* speaker */
8501 { 0x17, 0x99130111 }, /* speaker */
8502 { 0x18, 0x01a19840 }, /* mic */
8503 { 0x19, 0x99a3094f }, /* int-mic */
8504 { 0x1b, 0x01214020 }, /* HP */
8505 { 0x21, 0x0121401f }, /* HP */
8508 .chained = true,
8509 .chain_id = ALC662_FIXUP_SKU_IGNORE
8511 [ALC662_FIXUP_ASUS_MODE8] = {
8512 .type = HDA_FIXUP_PINS,
8513 .v.pins = (const struct hda_pintbl[]) {
8514 { 0x14, 0x99130110 }, /* speaker */
8515 { 0x12, 0x99a30970 }, /* int-mic */
8516 { 0x15, 0x01214020 }, /* HP */
8517 { 0x17, 0x99130111 }, /* speaker */
8518 { 0x18, 0x01a19840 }, /* mic */
8519 { 0x21, 0x0121401f }, /* HP */
8522 .chained = true,
8523 .chain_id = ALC662_FIXUP_SKU_IGNORE
8525 [ALC662_FIXUP_NO_JACK_DETECT] = {
8526 .type = HDA_FIXUP_FUNC,
8527 .v.func = alc_fixup_no_jack_detect,
8529 [ALC662_FIXUP_ZOTAC_Z68] = {
8530 .type = HDA_FIXUP_PINS,
8531 .v.pins = (const struct hda_pintbl[]) {
8532 { 0x1b, 0x02214020 }, /* Front HP */
8536 [ALC662_FIXUP_INV_DMIC] = {
8537 .type = HDA_FIXUP_FUNC,
8538 .v.func = alc_fixup_inv_dmic,
8540 [ALC668_FIXUP_DELL_XPS13] = {
8541 .type = HDA_FIXUP_FUNC,
8542 .v.func = alc_fixup_dell_xps13,
8543 .chained = true,
8544 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
8546 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
8547 .type = HDA_FIXUP_FUNC,
8548 .v.func = alc_fixup_disable_aamix,
8549 .chained = true,
8550 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8552 [ALC668_FIXUP_AUTO_MUTE] = {
8553 .type = HDA_FIXUP_FUNC,
8554 .v.func = alc_fixup_auto_mute_via_amp,
8555 .chained = true,
8556 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8558 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
8559 .type = HDA_FIXUP_PINS,
8560 .v.pins = (const struct hda_pintbl[]) {
8561 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8562 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
8565 .chained = true,
8566 .chain_id = ALC662_FIXUP_HEADSET_MODE
8568 [ALC662_FIXUP_HEADSET_MODE] = {
8569 .type = HDA_FIXUP_FUNC,
8570 .v.func = alc_fixup_headset_mode_alc662,
8572 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
8573 .type = HDA_FIXUP_PINS,
8574 .v.pins = (const struct hda_pintbl[]) {
8575 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8576 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8579 .chained = true,
8580 .chain_id = ALC668_FIXUP_HEADSET_MODE
8582 [ALC668_FIXUP_HEADSET_MODE] = {
8583 .type = HDA_FIXUP_FUNC,
8584 .v.func = alc_fixup_headset_mode_alc668,
8586 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8587 .type = HDA_FIXUP_FUNC,
8588 .v.func = alc_fixup_bass_chmap,
8589 .chained = true,
8590 .chain_id = ALC662_FIXUP_ASUS_MODE4
8592 [ALC662_FIXUP_BASS_16] = {
8593 .type = HDA_FIXUP_PINS,
8594 .v.pins = (const struct hda_pintbl[]) {
8595 {0x16, 0x80106111}, /* bass speaker */
8598 .chained = true,
8599 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8601 [ALC662_FIXUP_BASS_1A] = {
8602 .type = HDA_FIXUP_PINS,
8603 .v.pins = (const struct hda_pintbl[]) {
8604 {0x1a, 0x80106111}, /* bass speaker */
8607 .chained = true,
8608 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8610 [ALC662_FIXUP_BASS_CHMAP] = {
8611 .type = HDA_FIXUP_FUNC,
8612 .v.func = alc_fixup_bass_chmap,
8614 [ALC662_FIXUP_ASUS_Nx50] = {
8615 .type = HDA_FIXUP_FUNC,
8616 .v.func = alc_fixup_auto_mute_via_amp,
8617 .chained = true,
8618 .chain_id = ALC662_FIXUP_BASS_1A
8620 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
8621 .type = HDA_FIXUP_FUNC,
8622 .v.func = alc_fixup_headset_mode_alc668,
8623 .chain_id = ALC662_FIXUP_BASS_CHMAP
8625 [ALC668_FIXUP_ASUS_Nx51] = {
8626 .type = HDA_FIXUP_PINS,
8627 .v.pins = (const struct hda_pintbl[]) {
8628 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8629 { 0x1a, 0x90170151 }, /* bass speaker */
8630 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8633 .chained = true,
8634 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
8636 [ALC668_FIXUP_MIC_COEF] = {
8637 .type = HDA_FIXUP_VERBS,
8638 .v.verbs = (const struct hda_verb[]) {
8639 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
8640 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
8644 [ALC668_FIXUP_ASUS_G751] = {
8645 .type = HDA_FIXUP_PINS,
8646 .v.pins = (const struct hda_pintbl[]) {
8647 { 0x16, 0x0421101f }, /* HP */
8650 .chained = true,
8651 .chain_id = ALC668_FIXUP_MIC_COEF
8653 [ALC891_FIXUP_HEADSET_MODE] = {
8654 .type = HDA_FIXUP_FUNC,
8655 .v.func = alc_fixup_headset_mode,
8657 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
8658 .type = HDA_FIXUP_PINS,
8659 .v.pins = (const struct hda_pintbl[]) {
8660 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8661 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8664 .chained = true,
8665 .chain_id = ALC891_FIXUP_HEADSET_MODE
8667 [ALC662_FIXUP_ACER_VERITON] = {
8668 .type = HDA_FIXUP_PINS,
8669 .v.pins = (const struct hda_pintbl[]) {
8670 { 0x15, 0x50170120 }, /* no internal speaker */
8674 [ALC892_FIXUP_ASROCK_MOBO] = {
8675 .type = HDA_FIXUP_PINS,
8676 .v.pins = (const struct hda_pintbl[]) {
8677 { 0x15, 0x40f000f0 }, /* disabled */
8678 { 0x16, 0x40f000f0 }, /* disabled */
8682 [ALC662_FIXUP_USI_FUNC] = {
8683 .type = HDA_FIXUP_FUNC,
8684 .v.func = alc662_fixup_usi_headset_mic,
8686 [ALC662_FIXUP_USI_HEADSET_MODE] = {
8687 .type = HDA_FIXUP_PINS,
8688 .v.pins = (const struct hda_pintbl[]) {
8689 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
8690 { 0x18, 0x01a1903d },
8693 .chained = true,
8694 .chain_id = ALC662_FIXUP_USI_FUNC
8696 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
8697 .type = HDA_FIXUP_FUNC,
8698 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8702 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
8703 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
8704 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
8705 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
8706 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
8707 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
8708 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
8709 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
8710 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
8711 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8712 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8713 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
8714 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
8715 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
8716 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8717 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8718 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8719 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8720 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8721 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
8722 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
8723 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
8724 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
8725 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
8726 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
8727 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
8728 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
8729 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8730 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
8731 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
8732 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8733 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
8734 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
8735 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
8736 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
8737 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
8738 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
8739 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
8740 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
8741 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
8742 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
8743 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
8744 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
8746 #if 0
8747 /* Below is a quirk table taken from the old code.
8748 * Basically the device should work as is without the fixup table.
8749 * If BIOS doesn't give a proper info, enable the corresponding
8750 * fixup entry.
8752 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8753 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8754 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8755 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8756 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8757 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8758 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8759 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8760 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8761 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8762 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8763 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8764 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8765 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8766 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8767 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8768 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8769 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8770 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8771 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8772 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8773 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8774 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8775 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8776 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8777 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8778 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8779 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8780 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8781 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8782 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8783 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8784 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8785 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8786 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8787 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8788 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8789 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8790 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8791 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8792 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8793 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8794 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8795 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8796 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8797 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8798 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8799 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8800 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8801 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8802 #endif
8806 static const struct hda_model_fixup alc662_fixup_models[] = {
8807 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
8808 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
8809 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
8810 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
8811 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8812 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8813 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8814 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8815 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8816 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8817 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8818 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
8819 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
8820 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
8821 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
8822 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8823 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
8824 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
8825 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
8826 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
8827 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
8828 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
8829 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
8830 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
8831 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
8832 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
8833 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
8834 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
8835 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
8836 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
8840 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
8841 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8842 {0x17, 0x02211010},
8843 {0x18, 0x01a19030},
8844 {0x1a, 0x01813040},
8845 {0x21, 0x01014020}),
8846 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8847 {0x16, 0x01813030},
8848 {0x17, 0x02211010},
8849 {0x18, 0x01a19040},
8850 {0x21, 0x01014020}),
8851 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
8852 {0x14, 0x01014010},
8853 {0x18, 0x01a19020},
8854 {0x1a, 0x0181302f},
8855 {0x1b, 0x0221401f}),
8856 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8857 {0x12, 0x99a30130},
8858 {0x14, 0x90170110},
8859 {0x15, 0x0321101f},
8860 {0x16, 0x03011020}),
8861 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8862 {0x12, 0x99a30140},
8863 {0x14, 0x90170110},
8864 {0x15, 0x0321101f},
8865 {0x16, 0x03011020}),
8866 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8867 {0x12, 0x99a30150},
8868 {0x14, 0x90170110},
8869 {0x15, 0x0321101f},
8870 {0x16, 0x03011020}),
8871 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8872 {0x14, 0x90170110},
8873 {0x15, 0x0321101f},
8874 {0x16, 0x03011020}),
8875 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8876 {0x12, 0x90a60130},
8877 {0x14, 0x90170110},
8878 {0x15, 0x0321101f}),
8884 static int patch_alc662(struct hda_codec *codec)
8886 struct alc_spec *spec;
8887 int err;
8889 err = alc_alloc_spec(codec, 0x0b);
8890 if (err < 0)
8891 return err;
8893 spec = codec->spec;
8895 spec->shutup = alc_eapd_shutup;
8897 /* handle multiple HPs as is */
8898 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8900 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8902 switch (codec->core.vendor_id) {
8903 case 0x10ec0668:
8904 spec->init_hook = alc668_restore_default_value;
8905 break;
8908 snd_hda_pick_fixup(codec, alc662_fixup_models,
8909 alc662_fixup_tbl, alc662_fixups);
8910 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
8911 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8913 alc_auto_parse_customize_define(codec);
8915 if (has_cdefine_beep(codec))
8916 spec->gen.beep_nid = 0x01;
8918 if ((alc_get_coef0(codec) & (1 << 14)) &&
8919 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
8920 spec->cdefine.platform_type == 1) {
8921 err = alc_codec_rename(codec, "ALC272X");
8922 if (err < 0)
8923 goto error;
8926 /* automatic parse from the BIOS config */
8927 err = alc662_parse_auto_config(codec);
8928 if (err < 0)
8929 goto error;
8931 if (!spec->gen.no_analog && spec->gen.beep_nid) {
8932 switch (codec->core.vendor_id) {
8933 case 0x10ec0662:
8934 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8935 break;
8936 case 0x10ec0272:
8937 case 0x10ec0663:
8938 case 0x10ec0665:
8939 case 0x10ec0668:
8940 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
8941 break;
8942 case 0x10ec0273:
8943 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
8944 break;
8946 if (err < 0)
8947 goto error;
8950 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8952 return 0;
8954 error:
8955 alc_free(codec);
8956 return err;
8960 * ALC680 support
8963 static int alc680_parse_auto_config(struct hda_codec *codec)
8965 return alc_parse_auto_config(codec, NULL, NULL);
8970 static int patch_alc680(struct hda_codec *codec)
8972 int err;
8974 /* ALC680 has no aa-loopback mixer */
8975 err = alc_alloc_spec(codec, 0);
8976 if (err < 0)
8977 return err;
8979 /* automatic parse from the BIOS config */
8980 err = alc680_parse_auto_config(codec);
8981 if (err < 0) {
8982 alc_free(codec);
8983 return err;
8986 return 0;
8990 * patch entries
8992 static const struct hda_device_id snd_hda_id_realtek[] = {
8993 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
8994 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
8995 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
8996 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
8997 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8998 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
8999 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
9000 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
9001 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
9002 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
9003 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
9004 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
9005 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
9006 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
9007 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
9008 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
9009 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
9010 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
9011 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
9012 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
9013 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
9014 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
9015 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
9016 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
9017 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
9018 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
9019 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
9020 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
9021 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
9022 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
9023 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
9024 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
9025 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
9026 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
9027 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
9028 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
9029 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
9030 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
9031 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
9032 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
9033 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
9034 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
9035 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
9036 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
9037 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
9038 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
9039 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
9040 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
9041 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
9042 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
9043 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
9044 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
9045 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
9046 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
9047 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
9048 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
9049 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
9050 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
9051 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
9052 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
9053 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
9054 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
9055 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
9056 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
9057 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
9058 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
9059 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
9060 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
9061 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
9062 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
9063 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
9064 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
9065 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
9066 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
9067 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
9068 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
9069 {} /* terminator */
9071 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
9073 MODULE_LICENSE("GPL");
9074 MODULE_DESCRIPTION("Realtek HD-audio codec");
9076 static struct hda_codec_driver realtek_driver = {
9077 .id = snd_hda_id_realtek,
9080 module_hda_codec_driver(realtek_driver);