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