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