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