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