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