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