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