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