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