]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - sound/pci/hda/patch_realtek.c
PCI: PM: Skip devices in D0 for suspend-to-idle
[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:
394c97f8
KY
348 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
349 break;
3aabf94c
KY
350 case 0x10ec0275:
351 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
352 break;
394c97f8
KY
353 case 0x10ec0293:
354 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
355 break;
dcd4f0db
KY
356 case 0x10ec0234:
357 case 0x10ec0274:
358 case 0x10ec0294:
6fbae35a
KY
359 case 0x10ec0700:
360 case 0x10ec0701:
361 case 0x10ec0703:
dcd4f0db
KY
362 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
363 break;
394c97f8
KY
364 case 0x10ec0662:
365 if ((coef & 0x00f0) == 0x0030)
366 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
367 break;
368 case 0x10ec0272:
369 case 0x10ec0273:
370 case 0x10ec0663:
371 case 0x10ec0665:
372 case 0x10ec0670:
373 case 0x10ec0671:
374 case 0x10ec0672:
375 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
376 break;
377 case 0x10ec0668:
378 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
379 break;
380 case 0x10ec0867:
381 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
382 break;
383 case 0x10ec0888:
384 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
385 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
386 break;
387 case 0x10ec0892:
388 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
389 break;
390 case 0x10ec0899:
391 case 0x10ec0900:
65553b12 392 case 0x10ec1168:
a535ad57 393 case 0x10ec1220:
394c97f8
KY
394 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
395 break;
396 }
397}
398
f9423e7a
KY
399/* additional initialization for ALC888 variants */
400static void alc888_coef_init(struct hda_codec *codec)
401{
1df8874b
KY
402 switch (alc_get_coef0(codec) & 0x00f0) {
403 /* alc888-VA */
404 case 0x00:
405 /* alc888-VB */
406 case 0x10:
407 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
408 break;
409 }
87a8c370
JK
410}
411
3fb4a508
TI
412/* turn on/off EAPD control (only if available) */
413static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
414{
415 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
416 return;
417 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
418 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
419 on ? 2 : 0);
420}
421
691f1fcc
TI
422/* turn on/off EAPD controls of the codec */
423static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
424{
425 /* We currently only handle front, HP */
39fa84e9 426 static hda_nid_t pins[] = {
af95b414 427 0x0f, 0x10, 0x14, 0x15, 0x17, 0
39fa84e9
TI
428 };
429 hda_nid_t *p;
430 for (p = pins; *p; p++)
431 set_eapd(codec, *p, on);
691f1fcc
TI
432}
433
a8cdd64f
KY
434static int find_ext_mic_pin(struct hda_codec *codec);
435
436static void alc_headset_mic_no_shutup(struct hda_codec *codec)
437{
438 const struct hda_pincfg *pin;
439 int mic_pin = find_ext_mic_pin(codec);
440 int i;
441
442 /* don't shut up pins when unloading the driver; otherwise it breaks
443 * the default pin setup at the next load of the driver
444 */
445 if (codec->bus->shutdown)
446 return;
447
448 for (i = 0; i < codec->init_pins.used; i++) {
449 pin = snd_array_elem(&codec->init_pins, i);
450 /* use read here for syncing after issuing each verb */
451 if (pin->nid != mic_pin)
452 snd_hda_codec_read(codec, pin->nid, 0,
453 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
454 }
455
456 codec->pins_shutup = 1;
457}
458
b001f661
TI
459static void alc_shutup_pins(struct hda_codec *codec)
460{
461 struct alc_spec *spec = codec->spec;
462
a8cdd64f
KY
463 switch (codec->core.vendor_id) {
464 case 0x10ec0286:
465 case 0x10ec0288:
466 case 0x10ec0298:
467 alc_headset_mic_no_shutup(codec);
468 break;
469 default:
470 if (!spec->no_shutup_pins)
471 snd_hda_shutup_pins(codec);
472 break;
473 }
b001f661
TI
474}
475
1c716153 476/* generic shutup callback;
4ce8e6a5 477 * just turning off EAPD and a little pause for avoiding pop-noise
1c716153
TI
478 */
479static void alc_eapd_shutup(struct hda_codec *codec)
480{
97a26570
KY
481 struct alc_spec *spec = codec->spec;
482
1c716153 483 alc_auto_setup_eapd(codec, false);
97a26570
KY
484 if (!spec->no_depop_delay)
485 msleep(200);
b001f661 486 alc_shutup_pins(codec);
1c716153
TI
487}
488
1d045db9 489/* generic EAPD initialization */
4a79ba34 490static void alc_auto_init_amp(struct hda_codec *codec, int type)
bc9f98a9 491{
394c97f8 492 alc_fill_eapd_coef(codec);
39fa84e9 493 alc_auto_setup_eapd(codec, true);
4a79ba34
TI
494 switch (type) {
495 case ALC_INIT_GPIO1:
bc9f98a9
KY
496 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
497 break;
4a79ba34 498 case ALC_INIT_GPIO2:
bc9f98a9
KY
499 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
500 break;
4a79ba34 501 case ALC_INIT_GPIO3:
bdd148a3
KY
502 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
503 break;
4a79ba34 504 case ALC_INIT_DEFAULT:
7639a06c 505 switch (codec->core.vendor_id) {
c9b58006 506 case 0x10ec0260:
98b24883 507 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
c9b58006 508 break;
c9b58006
KY
509 case 0x10ec0880:
510 case 0x10ec0882:
511 case 0x10ec0883:
512 case 0x10ec0885:
1df8874b 513 alc_update_coef_idx(codec, 7, 0, 0x2030);
c9b58006 514 break;
f9423e7a 515 case 0x10ec0888:
4a79ba34 516 alc888_coef_init(codec);
f9423e7a 517 break;
bc9f98a9 518 }
4a79ba34
TI
519 break;
520 }
521}
522
80f10932
TI
523/* get a primary headphone pin if available */
524static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
525{
526 if (spec->gen.autocfg.hp_pins[0])
527 return spec->gen.autocfg.hp_pins[0];
528 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
529 return spec->gen.autocfg.line_out_pins[0];
530 return 0;
531}
08c189f2 532
1d045db9 533/*
08c189f2 534 * Realtek SSID verification
1d045db9 535 */
42cf0d01 536
08c189f2
TI
537/* Could be any non-zero and even value. When used as fixup, tells
538 * the driver to ignore any present sku defines.
539 */
540#define ALC_FIXUP_SKU_IGNORE (2)
1a1455de 541
08c189f2
TI
542static void alc_fixup_sku_ignore(struct hda_codec *codec,
543 const struct hda_fixup *fix, int action)
1a1455de 544{
1a1455de 545 struct alc_spec *spec = codec->spec;
08c189f2
TI
546 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
547 spec->cdefine.fixup = 1;
548 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
1a1455de 549 }
1a1455de
TI
550}
551
b5c6611f
ML
552static void alc_fixup_no_depop_delay(struct hda_codec *codec,
553 const struct hda_fixup *fix, int action)
554{
555 struct alc_spec *spec = codec->spec;
556
84d2dc3e 557 if (action == HDA_FIXUP_ACT_PROBE) {
b5c6611f 558 spec->no_depop_delay = 1;
84d2dc3e
ML
559 codec->depop_delay = 0;
560 }
b5c6611f
ML
561}
562
08c189f2 563static int alc_auto_parse_customize_define(struct hda_codec *codec)
4a79ba34 564{
08c189f2
TI
565 unsigned int ass, tmp, i;
566 unsigned nid = 0;
4a79ba34
TI
567 struct alc_spec *spec = codec->spec;
568
08c189f2 569 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
4a79ba34 570
08c189f2
TI
571 if (spec->cdefine.fixup) {
572 ass = spec->cdefine.sku_cfg;
573 if (ass == ALC_FIXUP_SKU_IGNORE)
574 return -1;
575 goto do_sku;
bb35febd
TI
576 }
577
5100cd07
TI
578 if (!codec->bus->pci)
579 return -1;
7639a06c 580 ass = codec->core.subsystem_id & 0xffff;
08c189f2
TI
581 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
582 goto do_sku;
4a79ba34 583
08c189f2 584 nid = 0x1d;
7639a06c 585 if (codec->core.vendor_id == 0x10ec0260)
08c189f2
TI
586 nid = 0x17;
587 ass = snd_hda_codec_get_pincfg(codec, nid);
42cf0d01 588
08c189f2 589 if (!(ass & 1)) {
4e76a883 590 codec_info(codec, "%s: SKU not ready 0x%08x\n",
7639a06c 591 codec->core.chip_name, ass);
08c189f2 592 return -1;
42cf0d01
DH
593 }
594
08c189f2
TI
595 /* check sum */
596 tmp = 0;
597 for (i = 1; i < 16; i++) {
598 if ((ass >> i) & 1)
599 tmp++;
ae8a60a5 600 }
08c189f2
TI
601 if (((ass >> 16) & 0xf) != tmp)
602 return -1;
ae8a60a5 603
da00c244
KY
604 spec->cdefine.port_connectivity = ass >> 30;
605 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
606 spec->cdefine.check_sum = (ass >> 16) & 0xf;
607 spec->cdefine.customization = ass >> 8;
608do_sku:
609 spec->cdefine.sku_cfg = ass;
610 spec->cdefine.external_amp = (ass & 0x38) >> 3;
611 spec->cdefine.platform_type = (ass & 0x4) >> 2;
612 spec->cdefine.swap = (ass & 0x2) >> 1;
613 spec->cdefine.override = ass & 0x1;
614
4e76a883 615 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
da00c244 616 nid, spec->cdefine.sku_cfg);
4e76a883 617 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
da00c244 618 spec->cdefine.port_connectivity);
4e76a883
TI
619 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
620 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
621 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
622 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
623 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
624 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
625 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
da00c244
KY
626
627 return 0;
628}
629
08c189f2
TI
630/* return the position of NID in the list, or -1 if not found */
631static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
632{
633 int i;
634 for (i = 0; i < nums; i++)
635 if (list[i] == nid)
636 return i;
637 return -1;
638}
1d045db9 639/* return true if the given NID is found in the list */
3af9ee6b
TI
640static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
641{
21268961 642 return find_idx_in_nid_list(nid, list, nums) >= 0;
3af9ee6b
TI
643}
644
4a79ba34
TI
645/* check subsystem ID and set up device-specific initialization;
646 * return 1 if initialized, 0 if invalid SSID
647 */
648/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
649 * 31 ~ 16 : Manufacture ID
650 * 15 ~ 8 : SKU ID
651 * 7 ~ 0 : Assembly ID
652 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
653 */
58c57cfa 654static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34
TI
655{
656 unsigned int ass, tmp, i;
657 unsigned nid;
658 struct alc_spec *spec = codec->spec;
659
90622917
DH
660 if (spec->cdefine.fixup) {
661 ass = spec->cdefine.sku_cfg;
662 if (ass == ALC_FIXUP_SKU_IGNORE)
663 return 0;
664 goto do_sku;
665 }
666
7639a06c 667 ass = codec->core.subsystem_id & 0xffff;
5100cd07
TI
668 if (codec->bus->pci &&
669 ass != codec->bus->pci->subsystem_device && (ass & 1))
4a79ba34
TI
670 goto do_sku;
671
672 /* invalid SSID, check the special NID pin defcfg instead */
673 /*
def319f9 674 * 31~30 : port connectivity
4a79ba34
TI
675 * 29~21 : reserve
676 * 20 : PCBEEP input
677 * 19~16 : Check sum (15:1)
678 * 15~1 : Custom
679 * 0 : override
680 */
681 nid = 0x1d;
7639a06c 682 if (codec->core.vendor_id == 0x10ec0260)
4a79ba34
TI
683 nid = 0x17;
684 ass = snd_hda_codec_get_pincfg(codec, nid);
4e76a883
TI
685 codec_dbg(codec,
686 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
cb6605c1 687 ass, nid);
6227cdce 688 if (!(ass & 1))
4a79ba34
TI
689 return 0;
690 if ((ass >> 30) != 1) /* no physical connection */
691 return 0;
692
693 /* check sum */
694 tmp = 0;
695 for (i = 1; i < 16; i++) {
696 if ((ass >> i) & 1)
697 tmp++;
698 }
699 if (((ass >> 16) & 0xf) != tmp)
700 return 0;
701do_sku:
4e76a883 702 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
7639a06c 703 ass & 0xffff, codec->core.vendor_id);
4a79ba34
TI
704 /*
705 * 0 : override
706 * 1 : Swap Jack
707 * 2 : 0 --> Desktop, 1 --> Laptop
708 * 3~5 : External Amplifier control
709 * 7~6 : Reserved
710 */
711 tmp = (ass & 0x38) >> 3; /* external Amp control */
712 switch (tmp) {
713 case 1:
714 spec->init_amp = ALC_INIT_GPIO1;
715 break;
716 case 3:
717 spec->init_amp = ALC_INIT_GPIO2;
718 break;
719 case 7:
720 spec->init_amp = ALC_INIT_GPIO3;
721 break;
722 case 5:
5a8cfb4e 723 default:
4a79ba34 724 spec->init_amp = ALC_INIT_DEFAULT;
bc9f98a9
KY
725 break;
726 }
ea1fb29a 727
8c427226 728 /* is laptop or Desktop and enable the function "Mute internal speaker
c9b58006
KY
729 * when the external headphone out jack is plugged"
730 */
8c427226 731 if (!(ass & 0x8000))
4a79ba34 732 return 1;
c9b58006
KY
733 /*
734 * 10~8 : Jack location
735 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
736 * 14~13: Resvered
737 * 15 : 1 --> enable the function "Mute internal speaker
738 * when the external headphone out jack is plugged"
739 */
80f10932 740 if (!alc_get_hp_pin(spec)) {
01d4825d 741 hda_nid_t nid;
c9b58006 742 tmp = (ass >> 11) & 0x3; /* HP to chassis */
58c57cfa 743 nid = ports[tmp];
08c189f2
TI
744 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
745 spec->gen.autocfg.line_outs))
3af9ee6b 746 return 1;
08c189f2 747 spec->gen.autocfg.hp_pins[0] = nid;
c9b58006 748 }
4a79ba34
TI
749 return 1;
750}
ea1fb29a 751
3e6179b8
TI
752/* Check the validity of ALC subsystem-id
753 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
754static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
4a79ba34 755{
58c57cfa 756 if (!alc_subsystem_id(codec, ports)) {
4a79ba34 757 struct alc_spec *spec = codec->spec;
4e76a883
TI
758 codec_dbg(codec,
759 "realtek: Enable default setup for auto mode as fallback\n");
4a79ba34 760 spec->init_amp = ALC_INIT_DEFAULT;
4a79ba34 761 }
21268961 762}
1a1455de 763
1d045db9 764/*
ef8ef5fb 765 */
f9e336f6 766
9d36a7dc
DH
767static void alc_fixup_inv_dmic(struct hda_codec *codec,
768 const struct hda_fixup *fix, int action)
125821ae
TI
769{
770 struct alc_spec *spec = codec->spec;
668d1e96 771
9d36a7dc 772 spec->gen.inv_dmic_split = 1;
6e72aa5f
TI
773}
774
e9edcee0 775
1d045db9
TI
776#ifdef CONFIG_SND_HDA_INPUT_BEEP
777/* additional beep mixers; the actual parameters are overwritten at build */
778static const struct snd_kcontrol_new alc_beep_mixer[] = {
779 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
780 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
16ded525
TI
781 { } /* end */
782};
1d045db9 783#endif
16ded525 784
08c189f2 785static int alc_build_controls(struct hda_codec *codec)
1d045db9
TI
786{
787 struct alc_spec *spec = codec->spec;
08c189f2 788 int i, err;
e9427969 789
08c189f2
TI
790 err = snd_hda_gen_build_controls(codec);
791 if (err < 0)
792 return err;
1da177e4
LT
793
794 for (i = 0; i < spec->num_mixers; i++) {
795 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
796 if (err < 0)
797 return err;
798 }
2134ea4f 799
67d634c0 800#ifdef CONFIG_SND_HDA_INPUT_BEEP
45bdd1c1
TI
801 /* create beep controls if needed */
802 if (spec->beep_amp) {
a9111321 803 const struct snd_kcontrol_new *knew;
45bdd1c1
TI
804 for (knew = alc_beep_mixer; knew->name; knew++) {
805 struct snd_kcontrol *kctl;
806 kctl = snd_ctl_new1(knew, codec);
807 if (!kctl)
08c189f2
TI
808 return -ENOMEM;
809 kctl->private_value = spec->beep_amp;
810 err = snd_hda_ctl_add(codec, 0, kctl);
811 if (err < 0)
812 return err;
1d045db9 813 }
863b4518 814 }
08c189f2 815#endif
1c4a54b4 816
1727a771 817 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
1c4a54b4 818 return 0;
a361d84b
KY
819}
820
a361d84b 821
df694daa 822/*
08c189f2 823 * Common callbacks
df694daa 824 */
a361d84b 825
08c189f2 826static int alc_init(struct hda_codec *codec)
1d045db9
TI
827{
828 struct alc_spec *spec = codec->spec;
a361d84b 829
08c189f2
TI
830 if (spec->init_hook)
831 spec->init_hook(codec);
a361d84b 832
08c189f2
TI
833 alc_fix_pll(codec);
834 alc_auto_init_amp(codec, spec->init_amp);
3abf2f36 835
08c189f2 836 snd_hda_gen_init(codec);
a361d84b 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,
9430d3a6
JS
1865 ALC1220_FIXUP_SYSTEM76_ORYP5,
1866 ALC1220_FIXUP_SYSTEM76_ORYP5_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
2104static void alc1220_fixup_system76_oryp5(struct hda_codec *codec,
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 },
9430d3a6
JS
2356 [ALC1220_FIXUP_SYSTEM76_ORYP5] = {
2357 .type = HDA_FIXUP_FUNC,
2358 .v.func = alc1220_fixup_system76_oryp5,
2359 },
2360 [ALC1220_FIXUP_SYSTEM76_ORYP5_PINS] = {
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,
2367 .chain_id = ALC1220_FIXUP_SYSTEM76_ORYP5,
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),
9430d3a6
JS
2445 SND_PCI_QUIRK(0x1558, 0x96e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
2446 SND_PCI_QUIRK(0x1558, 0x97e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
7a6069bf
TI
2447 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2448 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
ac9b1cdd 2449 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
68ef0561 2450 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
ff818c24
TI
2451 {}
2452};
2453
1727a771 2454static const struct hda_model_fixup alc882_fixup_models[] = {
912093bc
TI
2455 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2456 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2457 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
6e72aa5f 2458 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
e427c237 2459 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
ba90d6a6 2460 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
912093bc
TI
2461 {}
2462};
2463
f6a92248 2464/*
1d045db9 2465 * BIOS auto configuration
f6a92248 2466 */
1d045db9
TI
2467/* almost identical with ALC880 parser... */
2468static int alc882_parse_auto_config(struct hda_codec *codec)
2469{
1d045db9 2470 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2471 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2472 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
1d045db9 2473}
b896b4eb 2474
1d045db9
TI
2475/*
2476 */
1d045db9 2477static int patch_alc882(struct hda_codec *codec)
f6a92248
KY
2478{
2479 struct alc_spec *spec;
1a97b7f2 2480 int err;
f6a92248 2481
3de95173
TI
2482 err = alc_alloc_spec(codec, 0x0b);
2483 if (err < 0)
2484 return err;
f6a92248 2485
3de95173 2486 spec = codec->spec;
1f0f4b80 2487
7639a06c 2488 switch (codec->core.vendor_id) {
1d045db9
TI
2489 case 0x10ec0882:
2490 case 0x10ec0885:
acf08081 2491 case 0x10ec0900:
a535ad57 2492 case 0x10ec1220:
1d045db9
TI
2493 break;
2494 default:
2495 /* ALC883 and variants */
2496 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2497 break;
c793bec5 2498 }
977ddd6b 2499
1727a771 2500 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
912093bc 2501 alc882_fixups);
1727a771 2502 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
ff818c24 2503
1d045db9
TI
2504 alc_auto_parse_customize_define(codec);
2505
7504b6cd
TI
2506 if (has_cdefine_beep(codec))
2507 spec->gen.beep_nid = 0x01;
2508
1a97b7f2
TI
2509 /* automatic parse from the BIOS config */
2510 err = alc882_parse_auto_config(codec);
2511 if (err < 0)
2512 goto error;
f6a92248 2513
7504b6cd 2514 if (!spec->gen.no_analog && spec->gen.beep_nid)
1d045db9 2515 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
f6a92248 2516
1727a771 2517 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2518
f6a92248 2519 return 0;
e16fb6d1
TI
2520
2521 error:
2522 alc_free(codec);
2523 return err;
f6a92248
KY
2524}
2525
df694daa 2526
df694daa 2527/*
1d045db9 2528 * ALC262 support
df694daa 2529 */
1d045db9 2530static int alc262_parse_auto_config(struct hda_codec *codec)
df694daa 2531{
1d045db9 2532 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2533 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2534 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
df694daa
KY
2535}
2536
df694daa 2537/*
1d045db9 2538 * Pin config fixes
df694daa 2539 */
cfc9b06f 2540enum {
ea4e7af1 2541 ALC262_FIXUP_FSC_H270,
7513e6da 2542 ALC262_FIXUP_FSC_S7110,
ea4e7af1
TI
2543 ALC262_FIXUP_HP_Z200,
2544 ALC262_FIXUP_TYAN,
c470150c 2545 ALC262_FIXUP_LENOVO_3000,
b42590b8
TI
2546 ALC262_FIXUP_BENQ,
2547 ALC262_FIXUP_BENQ_T31,
6e72aa5f 2548 ALC262_FIXUP_INV_DMIC,
b5c6611f 2549 ALC262_FIXUP_INTEL_BAYLEYBAY,
cfc9b06f
TI
2550};
2551
1727a771 2552static const struct hda_fixup alc262_fixups[] = {
ea4e7af1 2553 [ALC262_FIXUP_FSC_H270] = {
1727a771
TI
2554 .type = HDA_FIXUP_PINS,
2555 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
2556 { 0x14, 0x99130110 }, /* speaker */
2557 { 0x15, 0x0221142f }, /* front HP */
2558 { 0x1b, 0x0121141f }, /* rear HP */
2559 { }
2560 }
2561 },
7513e6da
TI
2562 [ALC262_FIXUP_FSC_S7110] = {
2563 .type = HDA_FIXUP_PINS,
2564 .v.pins = (const struct hda_pintbl[]) {
2565 { 0x15, 0x90170110 }, /* speaker */
2566 { }
2567 },
2568 .chained = true,
2569 .chain_id = ALC262_FIXUP_BENQ,
2570 },
ea4e7af1 2571 [ALC262_FIXUP_HP_Z200] = {
1727a771
TI
2572 .type = HDA_FIXUP_PINS,
2573 .v.pins = (const struct hda_pintbl[]) {
1d045db9 2574 { 0x16, 0x99130120 }, /* internal speaker */
73413b12
TI
2575 { }
2576 }
cfc9b06f 2577 },
ea4e7af1 2578 [ALC262_FIXUP_TYAN] = {
1727a771
TI
2579 .type = HDA_FIXUP_PINS,
2580 .v.pins = (const struct hda_pintbl[]) {
ea4e7af1
TI
2581 { 0x14, 0x1993e1f0 }, /* int AUX */
2582 { }
2583 }
2584 },
c470150c 2585 [ALC262_FIXUP_LENOVO_3000] = {
fd108215
TI
2586 .type = HDA_FIXUP_PINCTLS,
2587 .v.pins = (const struct hda_pintbl[]) {
2588 { 0x19, PIN_VREF50 },
b42590b8
TI
2589 {}
2590 },
2591 .chained = true,
2592 .chain_id = ALC262_FIXUP_BENQ,
2593 },
2594 [ALC262_FIXUP_BENQ] = {
1727a771 2595 .type = HDA_FIXUP_VERBS,
b42590b8 2596 .v.verbs = (const struct hda_verb[]) {
c470150c
TI
2597 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2598 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2599 {}
2600 }
2601 },
b42590b8 2602 [ALC262_FIXUP_BENQ_T31] = {
1727a771 2603 .type = HDA_FIXUP_VERBS,
b42590b8
TI
2604 .v.verbs = (const struct hda_verb[]) {
2605 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2606 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2607 {}
2608 }
2609 },
6e72aa5f 2610 [ALC262_FIXUP_INV_DMIC] = {
1727a771 2611 .type = HDA_FIXUP_FUNC,
9d36a7dc 2612 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2613 },
b5c6611f
ML
2614 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2615 .type = HDA_FIXUP_FUNC,
2616 .v.func = alc_fixup_no_depop_delay,
2617 },
cfc9b06f
TI
2618};
2619
1d045db9 2620static const struct snd_pci_quirk alc262_fixup_tbl[] = {
ea4e7af1 2621 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
7513e6da 2622 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
3dcd3be3 2623 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
ea4e7af1 2624 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
4bf1bd42 2625 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
ea4e7af1 2626 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
c470150c 2627 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
b42590b8
TI
2628 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2629 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
b5c6611f 2630 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
cfc9b06f
TI
2631 {}
2632};
df694daa 2633
1727a771 2634static const struct hda_model_fixup alc262_fixup_models[] = {
6e72aa5f
TI
2635 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2636 {}
2637};
1d045db9 2638
1d045db9
TI
2639/*
2640 */
1d045db9 2641static int patch_alc262(struct hda_codec *codec)
df694daa
KY
2642{
2643 struct alc_spec *spec;
df694daa
KY
2644 int err;
2645
3de95173
TI
2646 err = alc_alloc_spec(codec, 0x0b);
2647 if (err < 0)
2648 return err;
df694daa 2649
3de95173 2650 spec = codec->spec;
08c189f2 2651 spec->gen.shared_mic_vref_pin = 0x18;
1d045db9 2652
225068ab
TI
2653 spec->shutup = alc_eapd_shutup;
2654
1d045db9
TI
2655#if 0
2656 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2657 * under-run
2658 */
98b24883 2659 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
1d045db9 2660#endif
1d045db9
TI
2661 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2662
1727a771 2663 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
6e72aa5f 2664 alc262_fixups);
1727a771 2665 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9c7f852e 2666
af741c15
TI
2667 alc_auto_parse_customize_define(codec);
2668
7504b6cd
TI
2669 if (has_cdefine_beep(codec))
2670 spec->gen.beep_nid = 0x01;
2671
42399f7a
TI
2672 /* automatic parse from the BIOS config */
2673 err = alc262_parse_auto_config(codec);
2674 if (err < 0)
2675 goto error;
df694daa 2676
7504b6cd 2677 if (!spec->gen.no_analog && spec->gen.beep_nid)
1d045db9 2678 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2134ea4f 2679
1727a771 2680 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 2681
1da177e4 2682 return 0;
e16fb6d1
TI
2683
2684 error:
2685 alc_free(codec);
2686 return err;
1da177e4
LT
2687}
2688
f32610ed 2689/*
1d045db9 2690 * ALC268
f32610ed 2691 */
1d045db9 2692/* bind Beep switches of both NID 0x0f and 0x10 */
a717777d
TI
2693static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2694 struct snd_ctl_elem_value *ucontrol)
2695{
2696 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2697 unsigned long pval;
2698 int err;
2699
2700 mutex_lock(&codec->control_mutex);
2701 pval = kcontrol->private_value;
2702 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2703 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2704 if (err >= 0) {
2705 kcontrol->private_value = (pval & ~0xff) | 0x10;
2706 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2707 }
2708 kcontrol->private_value = pval;
2709 mutex_unlock(&codec->control_mutex);
2710 return err;
2711}
f32610ed 2712
1d045db9
TI
2713static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2714 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
a717777d
TI
2715 {
2716 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2717 .name = "Beep Playback Switch",
2718 .subdevice = HDA_SUBDEV_AMP_FLAG,
2719 .info = snd_hda_mixer_amp_switch_info,
2720 .get = snd_hda_mixer_amp_switch_get,
2721 .put = alc268_beep_switch_put,
2722 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2723 },
1d045db9 2724 { }
f32610ed
JS
2725};
2726
1d045db9
TI
2727/* set PCBEEP vol = 0, mute connections */
2728static const struct hda_verb alc268_beep_init_verbs[] = {
2729 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2730 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2731 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2732 { }
f32610ed
JS
2733};
2734
6e72aa5f
TI
2735enum {
2736 ALC268_FIXUP_INV_DMIC,
cb766404 2737 ALC268_FIXUP_HP_EAPD,
24eff328 2738 ALC268_FIXUP_SPDIF,
6e72aa5f
TI
2739};
2740
1727a771 2741static const struct hda_fixup alc268_fixups[] = {
6e72aa5f 2742 [ALC268_FIXUP_INV_DMIC] = {
1727a771 2743 .type = HDA_FIXUP_FUNC,
9d36a7dc 2744 .v.func = alc_fixup_inv_dmic,
6e72aa5f 2745 },
cb766404 2746 [ALC268_FIXUP_HP_EAPD] = {
1727a771 2747 .type = HDA_FIXUP_VERBS,
cb766404
TI
2748 .v.verbs = (const struct hda_verb[]) {
2749 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2750 {}
2751 }
2752 },
24eff328
TI
2753 [ALC268_FIXUP_SPDIF] = {
2754 .type = HDA_FIXUP_PINS,
2755 .v.pins = (const struct hda_pintbl[]) {
2756 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2757 {}
2758 }
2759 },
6e72aa5f
TI
2760};
2761
1727a771 2762static const struct hda_model_fixup alc268_fixup_models[] = {
6e72aa5f 2763 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
cb766404
TI
2764 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2765 {}
2766};
2767
2768static const struct snd_pci_quirk alc268_fixup_tbl[] = {
24eff328 2769 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
fcd8f3b1 2770 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
cb766404
TI
2771 /* below is codec SSID since multiple Toshiba laptops have the
2772 * same PCI SSID 1179:ff00
2773 */
2774 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
6e72aa5f
TI
2775 {}
2776};
2777
f32610ed
JS
2778/*
2779 * BIOS auto configuration
2780 */
1d045db9 2781static int alc268_parse_auto_config(struct hda_codec *codec)
f32610ed 2782{
3e6179b8 2783 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7504b6cd 2784 return alc_parse_auto_config(codec, NULL, alc268_ssids);
f32610ed
JS
2785}
2786
1d045db9
TI
2787/*
2788 */
1d045db9 2789static int patch_alc268(struct hda_codec *codec)
f32610ed
JS
2790{
2791 struct alc_spec *spec;
7504b6cd 2792 int err;
f32610ed 2793
1d045db9 2794 /* ALC268 has no aa-loopback mixer */
3de95173
TI
2795 err = alc_alloc_spec(codec, 0);
2796 if (err < 0)
2797 return err;
2798
2799 spec = codec->spec;
7504b6cd 2800 spec->gen.beep_nid = 0x01;
1f0f4b80 2801
225068ab
TI
2802 spec->shutup = alc_eapd_shutup;
2803
1727a771
TI
2804 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2805 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6e72aa5f 2806
6ebb8053
TI
2807 /* automatic parse from the BIOS config */
2808 err = alc268_parse_auto_config(codec);
e16fb6d1
TI
2809 if (err < 0)
2810 goto error;
f32610ed 2811
7504b6cd
TI
2812 if (err > 0 && !spec->gen.no_analog &&
2813 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2814 add_mixer(spec, alc268_beep_mixer);
2815 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
1d045db9
TI
2816 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2817 /* override the amp caps for beep generator */
2818 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2819 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2820 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2821 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2822 (0 << AC_AMPCAP_MUTE_SHIFT));
2f893286
KY
2823 }
2824
1727a771 2825 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6e72aa5f 2826
f32610ed 2827 return 0;
e16fb6d1
TI
2828
2829 error:
2830 alc_free(codec);
2831 return err;
f32610ed
JS
2832}
2833
bc9f98a9 2834/*
1d045db9 2835 * ALC269
bc9f98a9 2836 */
08c189f2 2837
1d045db9 2838static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
1d045db9 2839 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9
KY
2840};
2841
1d045db9 2842static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
1d045db9 2843 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
bc9f98a9 2844};
291702f0 2845
1d045db9
TI
2846/* different alc269-variants */
2847enum {
2848 ALC269_TYPE_ALC269VA,
2849 ALC269_TYPE_ALC269VB,
2850 ALC269_TYPE_ALC269VC,
adcc70b2 2851 ALC269_TYPE_ALC269VD,
065380f0
KY
2852 ALC269_TYPE_ALC280,
2853 ALC269_TYPE_ALC282,
2af02be7 2854 ALC269_TYPE_ALC283,
065380f0 2855 ALC269_TYPE_ALC284,
4731d5de 2856 ALC269_TYPE_ALC293,
7fc7d047 2857 ALC269_TYPE_ALC286,
506b62c3 2858 ALC269_TYPE_ALC298,
1d04c9de 2859 ALC269_TYPE_ALC255,
4344aec8 2860 ALC269_TYPE_ALC256,
f429e7e4 2861 ALC269_TYPE_ALC257,
0a6f0600 2862 ALC269_TYPE_ALC215,
4231430d 2863 ALC269_TYPE_ALC225,
dcd4f0db 2864 ALC269_TYPE_ALC294,
6fbae35a 2865 ALC269_TYPE_ALC700,
bc9f98a9
KY
2866};
2867
2868/*
1d045db9 2869 * BIOS auto configuration
bc9f98a9 2870 */
1d045db9
TI
2871static int alc269_parse_auto_config(struct hda_codec *codec)
2872{
1d045db9 2873 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3e6179b8
TI
2874 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2875 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2876 struct alc_spec *spec = codec->spec;
adcc70b2
KY
2877 const hda_nid_t *ssids;
2878
2879 switch (spec->codec_variant) {
2880 case ALC269_TYPE_ALC269VA:
2881 case ALC269_TYPE_ALC269VC:
065380f0
KY
2882 case ALC269_TYPE_ALC280:
2883 case ALC269_TYPE_ALC284:
4731d5de 2884 case ALC269_TYPE_ALC293:
adcc70b2
KY
2885 ssids = alc269va_ssids;
2886 break;
2887 case ALC269_TYPE_ALC269VB:
2888 case ALC269_TYPE_ALC269VD:
065380f0 2889 case ALC269_TYPE_ALC282:
2af02be7 2890 case ALC269_TYPE_ALC283:
7fc7d047 2891 case ALC269_TYPE_ALC286:
506b62c3 2892 case ALC269_TYPE_ALC298:
1d04c9de 2893 case ALC269_TYPE_ALC255:
4344aec8 2894 case ALC269_TYPE_ALC256:
f429e7e4 2895 case ALC269_TYPE_ALC257:
0a6f0600 2896 case ALC269_TYPE_ALC215:
4231430d 2897 case ALC269_TYPE_ALC225:
dcd4f0db 2898 case ALC269_TYPE_ALC294:
6fbae35a 2899 case ALC269_TYPE_ALC700:
adcc70b2
KY
2900 ssids = alc269_ssids;
2901 break;
2902 default:
2903 ssids = alc269_ssids;
2904 break;
2905 }
bc9f98a9 2906
3e6179b8 2907 return alc_parse_auto_config(codec, alc269_ignore, ssids);
1d045db9 2908}
bc9f98a9 2909
1387e2d1 2910static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
1d045db9 2911{
98b24883 2912 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
1d045db9 2913}
291702f0 2914
1d045db9
TI
2915static void alc269_shutup(struct hda_codec *codec)
2916{
adcc70b2
KY
2917 struct alc_spec *spec = codec->spec;
2918
1387e2d1
KY
2919 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2920 alc269vb_toggle_power_output(codec, 0);
2921 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2922 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
2923 msleep(150);
2924 }
b001f661 2925 alc_shutup_pins(codec);
1d045db9 2926}
291702f0 2927
54db6c39
TI
2928static struct coef_fw alc282_coefs[] = {
2929 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
32fa7e49 2930 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
2931 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2932 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2933 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2934 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2935 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2936 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2937 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2938 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2939 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2940 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2941 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2942 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2943 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2944 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2945 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2946 WRITE_COEF(0x63, 0x2902), /* PLL */
2947 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2948 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2949 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2950 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2951 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2952 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2953 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2954 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2955 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2956 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2957 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2958 {}
2959};
2960
cb149cb3
KY
2961static void alc282_restore_default_value(struct hda_codec *codec)
2962{
54db6c39 2963 alc_process_coef_fw(codec, alc282_coefs);
cb149cb3
KY
2964}
2965
7b5c7a02
KY
2966static void alc282_init(struct hda_codec *codec)
2967{
2968 struct alc_spec *spec = codec->spec;
80f10932 2969 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
2970 bool hp_pin_sense;
2971 int coef78;
2972
cb149cb3
KY
2973 alc282_restore_default_value(codec);
2974
7b5c7a02
KY
2975 if (!hp_pin)
2976 return;
2977 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2978 coef78 = alc_read_coef_idx(codec, 0x78);
2979
2980 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2981 /* Headphone capless set to high power mode */
2982 alc_write_coef_idx(codec, 0x78, 0x9004);
2983
2984 if (hp_pin_sense)
2985 msleep(2);
2986
2987 snd_hda_codec_write(codec, hp_pin, 0,
2988 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2989
2990 if (hp_pin_sense)
2991 msleep(85);
2992
2993 snd_hda_codec_write(codec, hp_pin, 0,
2994 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2995
2996 if (hp_pin_sense)
2997 msleep(100);
2998
2999 /* Headphone capless set to normal mode */
3000 alc_write_coef_idx(codec, 0x78, coef78);
3001}
3002
3003static void alc282_shutup(struct hda_codec *codec)
3004{
3005 struct alc_spec *spec = codec->spec;
80f10932 3006 hda_nid_t hp_pin = alc_get_hp_pin(spec);
7b5c7a02
KY
3007 bool hp_pin_sense;
3008 int coef78;
3009
3010 if (!hp_pin) {
3011 alc269_shutup(codec);
3012 return;
3013 }
3014
3015 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3016 coef78 = alc_read_coef_idx(codec, 0x78);
3017 alc_write_coef_idx(codec, 0x78, 0x9004);
3018
3019 if (hp_pin_sense)
3020 msleep(2);
3021
3022 snd_hda_codec_write(codec, hp_pin, 0,
3023 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3024
3025 if (hp_pin_sense)
3026 msleep(85);
3027
b001f661
TI
3028 if (!spec->no_shutup_pins)
3029 snd_hda_codec_write(codec, hp_pin, 0,
3030 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7b5c7a02
KY
3031
3032 if (hp_pin_sense)
3033 msleep(100);
3034
3035 alc_auto_setup_eapd(codec, false);
b001f661 3036 alc_shutup_pins(codec);
7b5c7a02
KY
3037 alc_write_coef_idx(codec, 0x78, coef78);
3038}
3039
54db6c39
TI
3040static struct coef_fw alc283_coefs[] = {
3041 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
56779864 3042 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
54db6c39
TI
3043 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3044 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3045 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3046 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3047 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3048 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3049 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3050 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3051 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3052 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3053 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3054 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3055 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3056 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3057 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3058 WRITE_COEF(0x2e, 0x2902), /* PLL */
3059 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3060 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3061 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3062 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3063 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3064 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3065 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3066 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3067 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3068 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3069 WRITE_COEF(0x49, 0x0), /* test mode */
3070 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3071 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3072 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
56779864 3073 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
54db6c39
TI
3074 {}
3075};
3076
6bd55b04
KY
3077static void alc283_restore_default_value(struct hda_codec *codec)
3078{
54db6c39 3079 alc_process_coef_fw(codec, alc283_coefs);
6bd55b04
KY
3080}
3081
2af02be7
KY
3082static void alc283_init(struct hda_codec *codec)
3083{
3084 struct alc_spec *spec = codec->spec;
80f10932 3085 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3086 bool hp_pin_sense;
2af02be7 3087
6bd55b04
KY
3088 alc283_restore_default_value(codec);
3089
2af02be7
KY
3090 if (!hp_pin)
3091 return;
a59d7199
KY
3092
3093 msleep(30);
2af02be7
KY
3094 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3095
3096 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3097 /* Headphone capless set to high power mode */
3098 alc_write_coef_idx(codec, 0x43, 0x9004);
3099
3100 snd_hda_codec_write(codec, hp_pin, 0,
3101 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3102
3103 if (hp_pin_sense)
3104 msleep(85);
3105
3106 snd_hda_codec_write(codec, hp_pin, 0,
3107 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3108
3109 if (hp_pin_sense)
3110 msleep(85);
3111 /* Index 0x46 Combo jack auto switch control 2 */
3112 /* 3k pull low control for Headset jack. */
98b24883 3113 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
2af02be7
KY
3114 /* Headphone capless set to normal mode */
3115 alc_write_coef_idx(codec, 0x43, 0x9614);
3116}
3117
3118static void alc283_shutup(struct hda_codec *codec)
3119{
3120 struct alc_spec *spec = codec->spec;
80f10932 3121 hda_nid_t hp_pin = alc_get_hp_pin(spec);
2af02be7 3122 bool hp_pin_sense;
2af02be7
KY
3123
3124 if (!hp_pin) {
3125 alc269_shutup(codec);
3126 return;
3127 }
3128
3129 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3130
3131 alc_write_coef_idx(codec, 0x43, 0x9004);
3132
b450b17c
HP
3133 /*depop hp during suspend*/
3134 alc_write_coef_idx(codec, 0x06, 0x2100);
3135
2af02be7
KY
3136 snd_hda_codec_write(codec, hp_pin, 0,
3137 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3138
3139 if (hp_pin_sense)
88011c09 3140 msleep(100);
2af02be7 3141
b001f661
TI
3142 if (!spec->no_shutup_pins)
3143 snd_hda_codec_write(codec, hp_pin, 0,
3144 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2af02be7 3145
98b24883 3146 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
2af02be7
KY
3147
3148 if (hp_pin_sense)
88011c09 3149 msleep(100);
0435b3ff 3150 alc_auto_setup_eapd(codec, false);
b001f661 3151 alc_shutup_pins(codec);
2af02be7
KY
3152 alc_write_coef_idx(codec, 0x43, 0x9614);
3153}
3154
4a219ef8
KY
3155static void alc256_init(struct hda_codec *codec)
3156{
3157 struct alc_spec *spec = codec->spec;
80f10932 3158 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3159 bool hp_pin_sense;
3160
3161 if (!hp_pin)
3162 return;
3163
3164 msleep(30);
3165
3166 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3167
3168 if (hp_pin_sense)
3169 msleep(2);
3170
3171 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3172
3173 snd_hda_codec_write(codec, hp_pin, 0,
3174 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3175
3176 if (hp_pin_sense)
3177 msleep(85);
3178
3179 snd_hda_codec_write(codec, hp_pin, 0,
3180 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3181
3182 if (hp_pin_sense)
3183 msleep(100);
3184
3185 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3186 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
fc434f5a
KY
3187 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3188 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
4a219ef8
KY
3189}
3190
3191static void alc256_shutup(struct hda_codec *codec)
3192{
3193 struct alc_spec *spec = codec->spec;
80f10932 3194 hda_nid_t hp_pin = alc_get_hp_pin(spec);
4a219ef8
KY
3195 bool hp_pin_sense;
3196
3197 if (!hp_pin) {
3198 alc269_shutup(codec);
3199 return;
3200 }
3201
3202 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3203
3204 if (hp_pin_sense)
3205 msleep(2);
3206
3207 snd_hda_codec_write(codec, hp_pin, 0,
3208 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3209
3210 if (hp_pin_sense)
3211 msleep(85);
3212
e9d7786a
TI
3213 /* 3k pull low control for Headset jack. */
3214 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3215 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3216
b001f661
TI
3217 if (!spec->no_shutup_pins)
3218 snd_hda_codec_write(codec, hp_pin, 0,
3219 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4a219ef8 3220
4a219ef8
KY
3221 if (hp_pin_sense)
3222 msleep(100);
3223
3224 alc_auto_setup_eapd(codec, false);
b001f661 3225 alc_shutup_pins(codec);
4a219ef8
KY
3226}
3227
0b4d8f55
KY
3228static void alc225_init(struct hda_codec *codec)
3229{
3230 struct alc_spec *spec = codec->spec;
80f10932 3231 hda_nid_t hp_pin = alc_get_hp_pin(spec);
0b4d8f55
KY
3232 bool hp1_pin_sense, hp2_pin_sense;
3233
3234 if (!hp_pin)
3235 return;
3236
3237 msleep(30);
3238
3239 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3240 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3241
3242 if (hp1_pin_sense || hp2_pin_sense)
3243 msleep(2);
3244
3245 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3246
3247 if (hp1_pin_sense)
3248 snd_hda_codec_write(codec, hp_pin, 0,
3249 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3250 if (hp2_pin_sense)
3251 snd_hda_codec_write(codec, 0x16, 0,
3252 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3253
3254 if (hp1_pin_sense || hp2_pin_sense)
3255 msleep(85);
3256
3257 if (hp1_pin_sense)
3258 snd_hda_codec_write(codec, hp_pin, 0,
3259 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3260 if (hp2_pin_sense)
3261 snd_hda_codec_write(codec, 0x16, 0,
3262 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3263
3264 if (hp1_pin_sense || hp2_pin_sense)
3265 msleep(100);
3266
3267 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3268 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3269}
3270
3271static void alc225_shutup(struct hda_codec *codec)
3272{
3273 struct alc_spec *spec = codec->spec;
80f10932 3274 hda_nid_t hp_pin = alc_get_hp_pin(spec);
0b4d8f55
KY
3275 bool hp1_pin_sense, hp2_pin_sense;
3276
3277 if (!hp_pin) {
3278 alc269_shutup(codec);
3279 return;
3280 }
3281
3282 /* 3k pull low control for Headset jack. */
3283 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3284
3285 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3286 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3287
3288 if (hp1_pin_sense || hp2_pin_sense)
3289 msleep(2);
3290
3291 if (hp1_pin_sense)
3292 snd_hda_codec_write(codec, hp_pin, 0,
3293 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3294 if (hp2_pin_sense)
3295 snd_hda_codec_write(codec, 0x16, 0,
3296 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3297
3298 if (hp1_pin_sense || hp2_pin_sense)
3299 msleep(85);
3300
3301 if (hp1_pin_sense)
3302 snd_hda_codec_write(codec, hp_pin, 0,
3303 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3304 if (hp2_pin_sense)
3305 snd_hda_codec_write(codec, 0x16, 0,
3306 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3307
3308 if (hp1_pin_sense || hp2_pin_sense)
3309 msleep(100);
3310
3311 alc_auto_setup_eapd(codec, false);
b001f661 3312 alc_shutup_pins(codec);
0b4d8f55
KY
3313}
3314
c2d6af53
KY
3315static void alc_default_init(struct hda_codec *codec)
3316{
3317 struct alc_spec *spec = codec->spec;
80f10932 3318 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3319 bool hp_pin_sense;
3320
3321 if (!hp_pin)
3322 return;
3323
3324 msleep(30);
3325
3326 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3327
3328 if (hp_pin_sense)
3329 msleep(2);
3330
3331 snd_hda_codec_write(codec, hp_pin, 0,
3332 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3333
3334 if (hp_pin_sense)
3335 msleep(85);
3336
3337 snd_hda_codec_write(codec, hp_pin, 0,
3338 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3339
3340 if (hp_pin_sense)
3341 msleep(100);
3342}
3343
3344static void alc_default_shutup(struct hda_codec *codec)
3345{
3346 struct alc_spec *spec = codec->spec;
80f10932 3347 hda_nid_t hp_pin = alc_get_hp_pin(spec);
c2d6af53
KY
3348 bool hp_pin_sense;
3349
3350 if (!hp_pin) {
3351 alc269_shutup(codec);
3352 return;
3353 }
3354
3355 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3356
3357 if (hp_pin_sense)
3358 msleep(2);
3359
3360 snd_hda_codec_write(codec, hp_pin, 0,
3361 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3362
3363 if (hp_pin_sense)
3364 msleep(85);
3365
b001f661
TI
3366 if (!spec->no_shutup_pins)
3367 snd_hda_codec_write(codec, hp_pin, 0,
3368 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
c2d6af53
KY
3369
3370 if (hp_pin_sense)
3371 msleep(100);
3372
3373 alc_auto_setup_eapd(codec, false);
b001f661 3374 alc_shutup_pins(codec);
c2d6af53
KY
3375}
3376
6e25f0c7
KY
3377static void alc294_hp_init(struct hda_codec *codec)
3378{
3379 struct alc_spec *spec = codec->spec;
80f10932 3380 hda_nid_t hp_pin = alc_get_hp_pin(spec);
6e25f0c7
KY
3381 int i, val;
3382
3383 if (!hp_pin)
3384 return;
3385
3386 snd_hda_codec_write(codec, hp_pin, 0,
3387 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3388
3389 msleep(100);
3390
3391 snd_hda_codec_write(codec, hp_pin, 0,
3392 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3393
3394 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3395 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3396
3397 /* Wait for depop procedure finish */
3398 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3399 for (i = 0; i < 20 && val & 0x0080; i++) {
3400 msleep(50);
3401 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3402 }
3403 /* Set HP depop to auto mode */
3404 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3405 msleep(50);
3406}
3407
3408static void alc294_init(struct hda_codec *codec)
3409{
3410 struct alc_spec *spec = codec->spec;
3411
3412 if (!spec->done_hp_init) {
3413 alc294_hp_init(codec);
3414 spec->done_hp_init = true;
3415 }
3416 alc_default_init(codec);
3417}
3418
ad60d502
KY
3419static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3420 unsigned int val)
3421{
3422 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3423 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3424 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3425}
3426
3427static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3428{
3429 unsigned int val;
3430
3431 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3432 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3433 & 0xffff;
3434 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3435 << 16;
3436 return val;
3437}
3438
3439static void alc5505_dsp_halt(struct hda_codec *codec)
3440{
3441 unsigned int val;
3442
3443 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3444 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3445 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3446 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3447 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3448 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3449 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3450 val = alc5505_coef_get(codec, 0x6220);
3451 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3452}
3453
3454static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3455{
3456 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3457 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3458 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3459 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3460 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3461 alc5505_coef_set(codec, 0x880c, 0x00000004);
3462}
3463
3464static void alc5505_dsp_init(struct hda_codec *codec)
3465{
3466 unsigned int val;
3467
3468 alc5505_dsp_halt(codec);
3469 alc5505_dsp_back_from_halt(codec);
3470 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3471 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3472 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3473 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3474 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3475 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3476 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3477 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3478 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3479 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3480 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3481 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3482 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3483
3484 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3485 if (val <= 3)
3486 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3487 else
3488 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3489
3490 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3491 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3492 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3493 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3494 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3495 alc5505_coef_set(codec, 0x880c, 0x00000003);
3496 alc5505_coef_set(codec, 0x880c, 0x00000010);
cd63a5ff
TI
3497
3498#ifdef HALT_REALTEK_ALC5505
3499 alc5505_dsp_halt(codec);
3500#endif
ad60d502
KY
3501}
3502
cd63a5ff
TI
3503#ifdef HALT_REALTEK_ALC5505
3504#define alc5505_dsp_suspend(codec) /* NOP */
3505#define alc5505_dsp_resume(codec) /* NOP */
3506#else
3507#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3508#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3509#endif
3510
2a43952a 3511#ifdef CONFIG_PM
ad60d502
KY
3512static int alc269_suspend(struct hda_codec *codec)
3513{
3514 struct alc_spec *spec = codec->spec;
3515
3516 if (spec->has_alc5505_dsp)
cd63a5ff 3517 alc5505_dsp_suspend(codec);
ad60d502
KY
3518 return alc_suspend(codec);
3519}
3520
1d045db9
TI
3521static int alc269_resume(struct hda_codec *codec)
3522{
adcc70b2
KY
3523 struct alc_spec *spec = codec->spec;
3524
1387e2d1
KY
3525 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3526 alc269vb_toggle_power_output(codec, 0);
3527 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3528 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9
TI
3529 msleep(150);
3530 }
8c427226 3531
1d045db9 3532 codec->patch_ops.init(codec);
f1d4e28b 3533
1387e2d1
KY
3534 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3535 alc269vb_toggle_power_output(codec, 1);
3536 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
adcc70b2 3537 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9
TI
3538 msleep(200);
3539 }
f1d4e28b 3540
eeecd9d1 3541 regcache_sync(codec->core.regmap);
1d045db9 3542 hda_call_check_power_status(codec, 0x01);
f475371a
HW
3543
3544 /* on some machine, the BIOS will clear the codec gpio data when enter
3545 * suspend, and won't restore the data after resume, so we restore it
3546 * in the driver.
3547 */
3548 if (spec->gpio_led)
7639a06c 3549 snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA,
f475371a
HW
3550 spec->gpio_led);
3551
ad60d502 3552 if (spec->has_alc5505_dsp)
cd63a5ff 3553 alc5505_dsp_resume(codec);
c5177c86 3554
1d045db9
TI
3555 return 0;
3556}
2a43952a 3557#endif /* CONFIG_PM */
f1d4e28b 3558
108cc108 3559static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1727a771 3560 const struct hda_fixup *fix, int action)
108cc108
DH
3561{
3562 struct alc_spec *spec = codec->spec;
3563
1727a771 3564 if (action == HDA_FIXUP_ACT_PRE_PROBE)
108cc108
DH
3565 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3566}
3567
0dcd451c
JMG
3568static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3569 const struct hda_fixup *fix,
3570 int action)
3571{
3572 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3573 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3574
3575 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3576 snd_hda_codec_set_pincfg(codec, 0x19,
3577 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3578 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3579}
3580
1d045db9 3581static void alc269_fixup_hweq(struct hda_codec *codec,
1727a771 3582 const struct hda_fixup *fix, int action)
1d045db9 3583{
98b24883
TI
3584 if (action == HDA_FIXUP_ACT_INIT)
3585 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1d045db9 3586}
f1d4e28b 3587
7c478f03
DH
3588static void alc269_fixup_headset_mic(struct hda_codec *codec,
3589 const struct hda_fixup *fix, int action)
3590{
3591 struct alc_spec *spec = codec->spec;
3592
3593 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3594 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3595}
3596
1d045db9 3597static void alc271_fixup_dmic(struct hda_codec *codec,
1727a771 3598 const struct hda_fixup *fix, int action)
1d045db9
TI
3599{
3600 static const struct hda_verb verbs[] = {
3601 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3602 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3603 {}
3604 };
3605 unsigned int cfg;
f1d4e28b 3606
7639a06c
TI
3607 if (strcmp(codec->core.chip_name, "ALC271X") &&
3608 strcmp(codec->core.chip_name, "ALC269VB"))
1d045db9
TI
3609 return;
3610 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3611 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3612 snd_hda_sequence_write(codec, verbs);
3613}
f1d4e28b 3614
017f2a10 3615static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1727a771 3616 const struct hda_fixup *fix, int action)
017f2a10
TI
3617{
3618 struct alc_spec *spec = codec->spec;
3619
1727a771 3620 if (action != HDA_FIXUP_ACT_PROBE)
017f2a10
TI
3621 return;
3622
3623 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3624 * fix the sample rate of analog I/O to 44.1kHz
3625 */
08c189f2
TI
3626 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3627 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
017f2a10
TI
3628}
3629
adabb3ec 3630static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1727a771 3631 const struct hda_fixup *fix, int action)
adabb3ec 3632{
adabb3ec
TI
3633 /* The digital-mic unit sends PDM (differential signal) instead of
3634 * the standard PCM, thus you can't record a valid mono stream as is.
3635 * Below is a workaround specific to ALC269 to control the dmic
3636 * signal source as mono.
3637 */
98b24883
TI
3638 if (action == HDA_FIXUP_ACT_INIT)
3639 alc_update_coef_idx(codec, 0x07, 0, 0x80);
adabb3ec
TI
3640}
3641
24519911
TI
3642static void alc269_quanta_automute(struct hda_codec *codec)
3643{
08c189f2 3644 snd_hda_gen_update_outputs(codec);
24519911 3645
1687ccc8
TI
3646 alc_write_coef_idx(codec, 0x0c, 0x680);
3647 alc_write_coef_idx(codec, 0x0c, 0x480);
24519911
TI
3648}
3649
3650static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1727a771 3651 const struct hda_fixup *fix, int action)
24519911
TI
3652{
3653 struct alc_spec *spec = codec->spec;
1727a771 3654 if (action != HDA_FIXUP_ACT_PROBE)
24519911 3655 return;
08c189f2 3656 spec->gen.automute_hook = alc269_quanta_automute;
24519911
TI
3657}
3658
d240d1dc 3659static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 3660 struct hda_jack_callback *jack)
d240d1dc
DH
3661{
3662 struct alc_spec *spec = codec->spec;
3663 int vref;
3664 msleep(200);
3665 snd_hda_gen_hp_automute(codec, jack);
3666
3667 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3668 msleep(100);
3669 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3670 vref);
3671 msleep(500);
3672 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3673 vref);
3674}
3675
3676static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3677 const struct hda_fixup *fix, int action)
3678{
3679 struct alc_spec *spec = codec->spec;
3680 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3681 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3682 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3683 }
3684}
3685
3686
08fb0d0e
TI
3687/* update mute-LED according to the speaker mute state via mic VREF pin */
3688static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
6d3cd5d4
DH
3689{
3690 struct hda_codec *codec = private_data;
08fb0d0e
TI
3691 struct alc_spec *spec = codec->spec;
3692 unsigned int pinval;
3693
3694 if (spec->mute_led_polarity)
3695 enabled = !enabled;
415d555e
TI
3696 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3697 pinval &= ~AC_PINCTL_VREFEN;
3698 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
52401e2a
TI
3699 if (spec->mute_led_nid) {
3700 /* temporarily power up/down for setting VREF */
3701 snd_hda_power_up_pm(codec);
08fb0d0e 3702 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
52401e2a
TI
3703 snd_hda_power_down_pm(codec);
3704 }
6d3cd5d4
DH
3705}
3706
d5b6b65e
DH
3707/* Make sure the led works even in runtime suspend */
3708static unsigned int led_power_filter(struct hda_codec *codec,
3709 hda_nid_t nid,
3710 unsigned int power_state)
3711{
3712 struct alc_spec *spec = codec->spec;
3713
50dd9050
HW
3714 if (power_state != AC_PWRST_D3 || nid == 0 ||
3715 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
d5b6b65e
DH
3716 return power_state;
3717
3718 /* Set pin ctl again, it might have just been set to 0 */
3719 snd_hda_set_pin_ctl(codec, nid,
3720 snd_hda_codec_get_pin_target(codec, nid));
3721
cffd3966 3722 return snd_hda_gen_path_power_filter(codec, nid, power_state);
d5b6b65e
DH
3723}
3724
08fb0d0e
TI
3725static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3726 const struct hda_fixup *fix, int action)
6d3cd5d4
DH
3727{
3728 struct alc_spec *spec = codec->spec;
08fb0d0e
TI
3729 const struct dmi_device *dev = NULL;
3730
3731 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3732 return;
3733
3734 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3735 int pol, pin;
3736 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3737 continue;
3738 if (pin < 0x0a || pin >= 0x10)
3739 break;
3740 spec->mute_led_polarity = pol;
3741 spec->mute_led_nid = pin - 0x0a + 0x18;
3742 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
fd25a97a 3743 spec->gen.vmaster_mute_enum = 1;
d5b6b65e 3744 codec->power_filter = led_power_filter;
4e76a883
TI
3745 codec_dbg(codec,
3746 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
08fb0d0e 3747 spec->mute_led_polarity);
6d3cd5d4
DH
3748 break;
3749 }
3750}
3751
d06ac143
DH
3752static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3753 const struct hda_fixup *fix, int action)
3754{
3755 struct alc_spec *spec = codec->spec;
3756 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3757 spec->mute_led_polarity = 0;
3758 spec->mute_led_nid = 0x18;
3759 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3760 spec->gen.vmaster_mute_enum = 1;
d5b6b65e 3761 codec->power_filter = led_power_filter;
d06ac143
DH
3762 }
3763}
3764
08fb0d0e
TI
3765static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3766 const struct hda_fixup *fix, int action)
420b0feb
TI
3767{
3768 struct alc_spec *spec = codec->spec;
9bb1f06f 3769 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
08fb0d0e
TI
3770 spec->mute_led_polarity = 0;
3771 spec->mute_led_nid = 0x19;
3772 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
fd25a97a 3773 spec->gen.vmaster_mute_enum = 1;
d5b6b65e 3774 codec->power_filter = led_power_filter;
420b0feb
TI
3775 }
3776}
3777
0f32fd19
TI
3778/* update LED status via GPIO */
3779static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3780 bool enabled)
9f5c6faf 3781{
9f5c6faf
TI
3782 struct alc_spec *spec = codec->spec;
3783 unsigned int oldval = spec->gpio_led;
3784
0f32fd19
TI
3785 if (spec->mute_led_polarity)
3786 enabled = !enabled;
3787
9f5c6faf 3788 if (enabled)
0f32fd19 3789 spec->gpio_led &= ~mask;
9f5c6faf 3790 else
0f32fd19 3791 spec->gpio_led |= mask;
9f5c6faf
TI
3792 if (spec->gpio_led != oldval)
3793 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3794 spec->gpio_led);
3795}
3796
0f32fd19
TI
3797/* turn on/off mute LED via GPIO per vmaster hook */
3798static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
9f5c6faf 3799{
0f32fd19 3800 struct hda_codec *codec = private_data;
9f5c6faf 3801 struct alc_spec *spec = codec->spec;
9f5c6faf 3802
0f32fd19
TI
3803 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3804}
9f5c6faf 3805
0f32fd19
TI
3806/* turn on/off mic-mute LED via GPIO per capture hook */
3807static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec,
3808 struct snd_kcontrol *kcontrol,
3809 struct snd_ctl_elem_value *ucontrol)
3810{
3811 struct alc_spec *spec = codec->spec;
3812
3813 if (ucontrol)
3814 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3815 ucontrol->value.integer.value[0] ||
3816 ucontrol->value.integer.value[1]);
9f5c6faf
TI
3817}
3818
3819static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3820 const struct hda_fixup *fix, int action)
3821{
3822 struct alc_spec *spec = codec->spec;
3823 static const struct hda_verb gpio_init[] = {
3824 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3825 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3826 {}
3827 };
3828
3829 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19
TI
3830 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3831 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
9f5c6faf 3832 spec->gpio_led = 0;
0f32fd19
TI
3833 spec->mute_led_polarity = 0;
3834 spec->gpio_mute_led_mask = 0x08;
3835 spec->gpio_mic_led_mask = 0x10;
9f5c6faf
TI
3836 snd_hda_add_verbs(codec, gpio_init);
3837 }
3838}
3839
eaa8e5ef
KY
3840static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3841 const struct hda_fixup *fix, int action)
3842{
3843 struct alc_spec *spec = codec->spec;
3844 static const struct hda_verb gpio_init[] = {
3845 { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
3846 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
3847 {}
3848 };
3849
3850 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3851 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3852 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
9f5c6faf 3853 spec->gpio_led = 0;
eaa8e5ef
KY
3854 spec->mute_led_polarity = 0;
3855 spec->gpio_mute_led_mask = 0x02;
3856 spec->gpio_mic_led_mask = 0x20;
9f5c6faf
TI
3857 snd_hda_add_verbs(codec, gpio_init);
3858 }
3859}
3860
9c5dc3bf
KY
3861/* turn on/off mic-mute LED per capture hook */
3862static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3863 struct snd_kcontrol *kcontrol,
3864 struct snd_ctl_elem_value *ucontrol)
3865{
3866 struct alc_spec *spec = codec->spec;
3867 unsigned int pinval, enable, disable;
3868
fc1fad93 3869 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
9c5dc3bf
KY
3870 pinval &= ~AC_PINCTL_VREFEN;
3871 enable = pinval | AC_PINCTL_VREF_80;
3872 disable = pinval | AC_PINCTL_VREF_HIZ;
3873
3874 if (!ucontrol)
3875 return;
3876
3877 if (ucontrol->value.integer.value[0] ||
3878 ucontrol->value.integer.value[1])
3879 pinval = disable;
3880 else
3881 pinval = enable;
3882
3883 if (spec->cap_mute_led_nid)
3884 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3885}
3886
3887static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3888 const struct hda_fixup *fix, int action)
3889{
3890 struct alc_spec *spec = codec->spec;
3891 static const struct hda_verb gpio_init[] = {
3892 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3893 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3894 {}
3895 };
3896
3897 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 3898 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
9c5dc3bf
KY
3899 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3900 spec->gpio_led = 0;
0f32fd19
TI
3901 spec->mute_led_polarity = 0;
3902 spec->gpio_mute_led_mask = 0x08;
9c5dc3bf
KY
3903 spec->cap_mute_led_nid = 0x18;
3904 snd_hda_add_verbs(codec, gpio_init);
50dd9050 3905 codec->power_filter = led_power_filter;
9c5dc3bf
KY
3906 }
3907}
3908
7a5255f1
DH
3909static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3910 const struct hda_fixup *fix, int action)
3911{
3912 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3913 struct alc_spec *spec = codec->spec;
3914 static const struct hda_verb gpio_init[] = {
3915 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3916 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3917 {}
3918 };
3919
3920 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 3921 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
7a5255f1
DH
3922 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3923 spec->gpio_led = 0;
0f32fd19
TI
3924 spec->mute_led_polarity = 0;
3925 spec->gpio_mute_led_mask = 0x08;
7a5255f1
DH
3926 spec->cap_mute_led_nid = 0x18;
3927 snd_hda_add_verbs(codec, gpio_init);
3928 codec->power_filter = led_power_filter;
3929 }
3930}
3931
b12263b7 3932#if IS_REACHABLE(CONFIG_INPUT)
33f4acd3
DH
3933static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3934 struct hda_jack_callback *event)
3935{
3936 struct alc_spec *spec = codec->spec;
3937
3938 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3939 send both key on and key off event for every interrupt. */
c7b60a89 3940 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
33f4acd3 3941 input_sync(spec->kb_dev);
c7b60a89 3942 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
33f4acd3
DH
3943 input_sync(spec->kb_dev);
3944}
33f4acd3 3945
3694cb29
K
3946static int alc_register_micmute_input_device(struct hda_codec *codec)
3947{
3948 struct alc_spec *spec = codec->spec;
c7b60a89 3949 int i;
3694cb29
K
3950
3951 spec->kb_dev = input_allocate_device();
3952 if (!spec->kb_dev) {
3953 codec_err(codec, "Out of memory (input_allocate_device)\n");
3954 return -ENOMEM;
3955 }
c7b60a89
HW
3956
3957 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3958
3694cb29
K
3959 spec->kb_dev->name = "Microphone Mute Button";
3960 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
c7b60a89
HW
3961 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3962 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3963 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3964 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3965 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3694cb29
K
3966
3967 if (input_register_device(spec->kb_dev)) {
3968 codec_err(codec, "input_register_device failed\n");
3969 input_free_device(spec->kb_dev);
3970 spec->kb_dev = NULL;
3971 return -ENOMEM;
3972 }
3973
3974 return 0;
3975}
3976
33f4acd3
DH
3977static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3978 const struct hda_fixup *fix, int action)
3979{
33f4acd3
DH
3980 /* GPIO1 = set according to SKU external amp
3981 GPIO2 = mic mute hotkey
3982 GPIO3 = mute LED
3983 GPIO4 = mic mute LED */
3984 static const struct hda_verb gpio_init[] = {
3985 { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e },
3986 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a },
3987 { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 },
3988 {}
3989 };
3990
3991 struct alc_spec *spec = codec->spec;
3992
3993 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3694cb29 3994 if (alc_register_micmute_input_device(codec) != 0)
33f4acd3 3995 return;
33f4acd3
DH
3996
3997 snd_hda_add_verbs(codec, gpio_init);
7639a06c 3998 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
33f4acd3 3999 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
7639a06c 4000 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
33f4acd3
DH
4001 gpio2_mic_hotkey_event);
4002
4003 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
4004 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
4005 spec->gpio_led = 0;
4006 spec->mute_led_polarity = 0;
4007 spec->gpio_mute_led_mask = 0x08;
4008 spec->gpio_mic_led_mask = 0x10;
4009 return;
4010 }
4011
4012 if (!spec->kb_dev)
4013 return;
4014
4015 switch (action) {
4016 case HDA_FIXUP_ACT_PROBE:
4017 spec->init_amp = ALC_INIT_DEFAULT;
4018 break;
4019 case HDA_FIXUP_ACT_FREE:
4020 input_unregister_device(spec->kb_dev);
33f4acd3
DH
4021 spec->kb_dev = NULL;
4022 }
33f4acd3
DH
4023}
4024
3694cb29
K
4025static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4026 const struct hda_fixup *fix, int action)
4027{
4028 /* Line2 = mic mute hotkey
4029 GPIO2 = mic mute LED */
4030 static const struct hda_verb gpio_init[] = {
4031 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
4032 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
4033 {}
4034 };
4035
4036 struct alc_spec *spec = codec->spec;
4037
4038 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4039 if (alc_register_micmute_input_device(codec) != 0)
4040 return;
4041
4042 snd_hda_add_verbs(codec, gpio_init);
4043 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4044 gpio2_mic_hotkey_event);
4045
4046 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
4047 spec->gpio_led = 0;
4048 spec->mute_led_polarity = 0;
4049 spec->gpio_mic_led_mask = 0x04;
4050 return;
4051 }
4052
4053 if (!spec->kb_dev)
4054 return;
4055
4056 switch (action) {
4057 case HDA_FIXUP_ACT_PROBE:
4058 spec->init_amp = ALC_INIT_DEFAULT;
4059 break;
4060 case HDA_FIXUP_ACT_FREE:
4061 input_unregister_device(spec->kb_dev);
4062 spec->kb_dev = NULL;
4063 }
4064}
63c4da64
TI
4065#else /* INPUT */
4066#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4067#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4068#endif /* INPUT */
3694cb29 4069
9c5dc3bf
KY
4070static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4071 const struct hda_fixup *fix, int action)
4072{
4073 struct alc_spec *spec = codec->spec;
4074
4075 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4076 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
4077 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
4078 spec->mute_led_polarity = 0;
4079 spec->mute_led_nid = 0x1a;
4080 spec->cap_mute_led_nid = 0x18;
4081 spec->gen.vmaster_mute_enum = 1;
4082 codec->power_filter = led_power_filter;
4083 }
4084}
4085
5a36767a
KY
4086static struct coef_fw alc225_pre_hsmode[] = {
4087 UPDATE_COEF(0x4a, 1<<8, 0),
4088 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4089 UPDATE_COEF(0x63, 3<<14, 3<<14),
4090 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4091 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4092 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4093 UPDATE_COEF(0x4a, 3<<10, 0),
4094 {}
4095};
4096
73bdd597
DH
4097static void alc_headset_mode_unplugged(struct hda_codec *codec)
4098{
54db6c39 4099 static struct coef_fw coef0255[] = {
54db6c39
TI
4100 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4101 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4102 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4103 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4104 {}
4105 };
e69e7e03
KY
4106 static struct coef_fw coef0255_1[] = {
4107 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4108 {}
4109 };
4110 static struct coef_fw coef0256[] = {
4111 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4112 {}
4113 };
54db6c39
TI
4114 static struct coef_fw coef0233[] = {
4115 WRITE_COEF(0x1b, 0x0c0b),
4116 WRITE_COEF(0x45, 0xc429),
4117 UPDATE_COEF(0x35, 0x4000, 0),
4118 WRITE_COEF(0x06, 0x2104),
4119 WRITE_COEF(0x1a, 0x0001),
4120 WRITE_COEF(0x26, 0x0004),
4121 WRITE_COEF(0x32, 0x42a3),
4122 {}
4123 };
f3b70332
KY
4124 static struct coef_fw coef0288[] = {
4125 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4126 UPDATE_COEF(0x50, 0x2000, 0x2000),
4127 UPDATE_COEF(0x56, 0x0006, 0x0006),
4128 UPDATE_COEF(0x66, 0x0008, 0),
4129 UPDATE_COEF(0x67, 0x2000, 0),
4130 {}
4131 };
89542936
KY
4132 static struct coef_fw coef0298[] = {
4133 UPDATE_COEF(0x19, 0x1300, 0x0300),
4134 {}
4135 };
54db6c39
TI
4136 static struct coef_fw coef0292[] = {
4137 WRITE_COEF(0x76, 0x000e),
4138 WRITE_COEF(0x6c, 0x2400),
4139 WRITE_COEF(0x18, 0x7308),
4140 WRITE_COEF(0x6b, 0xc429),
4141 {}
4142 };
4143 static struct coef_fw coef0293[] = {
4144 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4145 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4146 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4147 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4148 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4149 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4150 {}
4151 };
4152 static struct coef_fw coef0668[] = {
4153 WRITE_COEF(0x15, 0x0d40),
4154 WRITE_COEF(0xb7, 0x802b),
4155 {}
4156 };
4cc9b9d6 4157 static struct coef_fw coef0225[] = {
5a36767a 4158 UPDATE_COEF(0x63, 3<<14, 0),
4cc9b9d6
KY
4159 {}
4160 };
71683c32
KY
4161 static struct coef_fw coef0274[] = {
4162 UPDATE_COEF(0x4a, 0x0100, 0),
4163 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4164 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4165 UPDATE_COEF(0x4a, 0x0010, 0),
4166 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4167 WRITE_COEF(0x45, 0x5289),
4168 UPDATE_COEF(0x4a, 0x0c00, 0),
4169 {}
4170 };
54db6c39 4171
7639a06c 4172 switch (codec->core.vendor_id) {
9a22a8f5 4173 case 0x10ec0255:
e69e7e03
KY
4174 alc_process_coef_fw(codec, coef0255_1);
4175 alc_process_coef_fw(codec, coef0255);
4176 break;
736f20a7 4177 case 0x10ec0236:
7081adf3 4178 case 0x10ec0256:
e69e7e03 4179 alc_process_coef_fw(codec, coef0256);
54db6c39 4180 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4181 break;
71683c32
KY
4182 case 0x10ec0234:
4183 case 0x10ec0274:
4184 case 0x10ec0294:
4185 alc_process_coef_fw(codec, coef0274);
4186 break;
13fd08a3 4187 case 0x10ec0233:
73bdd597 4188 case 0x10ec0283:
54db6c39 4189 alc_process_coef_fw(codec, coef0233);
73bdd597 4190 break;
f3b70332
KY
4191 case 0x10ec0286:
4192 case 0x10ec0288:
89542936
KY
4193 alc_process_coef_fw(codec, coef0288);
4194 break;
1a5bc8d9 4195 case 0x10ec0298:
89542936 4196 alc_process_coef_fw(codec, coef0298);
f3b70332
KY
4197 alc_process_coef_fw(codec, coef0288);
4198 break;
73bdd597 4199 case 0x10ec0292:
54db6c39 4200 alc_process_coef_fw(codec, coef0292);
73bdd597 4201 break;
a22aa26f 4202 case 0x10ec0293:
54db6c39 4203 alc_process_coef_fw(codec, coef0293);
a22aa26f 4204 break;
73bdd597 4205 case 0x10ec0668:
54db6c39 4206 alc_process_coef_fw(codec, coef0668);
73bdd597 4207 break;
638aad63 4208 case 0x10ec0215:
4cc9b9d6 4209 case 0x10ec0225:
638aad63 4210 case 0x10ec0285:
7d727869 4211 case 0x10ec0295:
638aad63 4212 case 0x10ec0289:
28f1f9b2 4213 case 0x10ec0299:
ba6d77fa 4214 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4215 alc_process_coef_fw(codec, coef0225);
4216 break;
78f4f7c2
KY
4217 case 0x10ec0867:
4218 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4219 break;
73bdd597 4220 }
4e76a883 4221 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
73bdd597
DH
4222}
4223
4224
4225static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4226 hda_nid_t mic_pin)
4227{
54db6c39
TI
4228 static struct coef_fw coef0255[] = {
4229 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4230 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4231 {}
4232 };
4233 static struct coef_fw coef0233[] = {
4234 UPDATE_COEF(0x35, 0, 1<<14),
4235 WRITE_COEF(0x06, 0x2100),
4236 WRITE_COEF(0x1a, 0x0021),
4237 WRITE_COEF(0x26, 0x008c),
4238 {}
4239 };
f3b70332 4240 static struct coef_fw coef0288[] = {
89542936 4241 UPDATE_COEF(0x4f, 0x00c0, 0),
f3b70332
KY
4242 UPDATE_COEF(0x50, 0x2000, 0),
4243 UPDATE_COEF(0x56, 0x0006, 0),
4244 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4245 UPDATE_COEF(0x66, 0x0008, 0x0008),
4246 UPDATE_COEF(0x67, 0x2000, 0x2000),
4247 {}
4248 };
54db6c39
TI
4249 static struct coef_fw coef0292[] = {
4250 WRITE_COEF(0x19, 0xa208),
4251 WRITE_COEF(0x2e, 0xacf0),
4252 {}
4253 };
4254 static struct coef_fw coef0293[] = {
4255 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4256 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4257 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4258 {}
4259 };
4260 static struct coef_fw coef0688[] = {
4261 WRITE_COEF(0xb7, 0x802b),
4262 WRITE_COEF(0xb5, 0x1040),
4263 UPDATE_COEF(0xc3, 0, 1<<12),
4264 {}
4265 };
4cc9b9d6
KY
4266 static struct coef_fw coef0225[] = {
4267 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4268 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4269 UPDATE_COEF(0x63, 3<<14, 0),
4270 {}
4271 };
71683c32
KY
4272 static struct coef_fw coef0274[] = {
4273 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4274 UPDATE_COEF(0x4a, 0x0010, 0),
4275 UPDATE_COEF(0x6b, 0xf000, 0),
4276 {}
4277 };
54db6c39 4278
7639a06c 4279 switch (codec->core.vendor_id) {
736f20a7 4280 case 0x10ec0236:
9a22a8f5 4281 case 0x10ec0255:
7081adf3 4282 case 0x10ec0256:
9a22a8f5
KY
4283 alc_write_coef_idx(codec, 0x45, 0xc489);
4284 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4285 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
4286 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4287 break;
71683c32
KY
4288 case 0x10ec0234:
4289 case 0x10ec0274:
4290 case 0x10ec0294:
4291 alc_write_coef_idx(codec, 0x45, 0x4689);
4292 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4293 alc_process_coef_fw(codec, coef0274);
4294 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4295 break;
13fd08a3 4296 case 0x10ec0233:
73bdd597
DH
4297 case 0x10ec0283:
4298 alc_write_coef_idx(codec, 0x45, 0xc429);
4299 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4300 alc_process_coef_fw(codec, coef0233);
73bdd597
DH
4301 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4302 break;
f3b70332
KY
4303 case 0x10ec0286:
4304 case 0x10ec0288:
1a5bc8d9 4305 case 0x10ec0298:
f3b70332
KY
4306 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4307 alc_process_coef_fw(codec, coef0288);
4308 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4309 break;
73bdd597
DH
4310 case 0x10ec0292:
4311 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4312 alc_process_coef_fw(codec, coef0292);
73bdd597 4313 break;
a22aa26f
KY
4314 case 0x10ec0293:
4315 /* Set to TRS mode */
4316 alc_write_coef_idx(codec, 0x45, 0xc429);
4317 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4318 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
4319 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4320 break;
78f4f7c2
KY
4321 case 0x10ec0867:
4322 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4323 /* fallthru */
9eb5d0e6 4324 case 0x10ec0221:
1f8b46cd
DH
4325 case 0x10ec0662:
4326 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4327 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4328 break;
73bdd597
DH
4329 case 0x10ec0668:
4330 alc_write_coef_idx(codec, 0x11, 0x0001);
4331 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
54db6c39 4332 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
4333 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4334 break;
638aad63 4335 case 0x10ec0215:
4cc9b9d6 4336 case 0x10ec0225:
638aad63 4337 case 0x10ec0285:
7d727869 4338 case 0x10ec0295:
638aad63 4339 case 0x10ec0289:
28f1f9b2 4340 case 0x10ec0299:
5a36767a 4341 alc_process_coef_fw(codec, alc225_pre_hsmode);
4cc9b9d6
KY
4342 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4343 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4344 alc_process_coef_fw(codec, coef0225);
4345 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4346 break;
73bdd597 4347 }
4e76a883 4348 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
73bdd597
DH
4349}
4350
4351static void alc_headset_mode_default(struct hda_codec *codec)
4352{
2ae95577 4353 static struct coef_fw coef0225[] = {
5a36767a
KY
4354 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4355 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4356 UPDATE_COEF(0x49, 3<<8, 0<<8),
4357 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4358 UPDATE_COEF(0x63, 3<<14, 0),
4359 UPDATE_COEF(0x67, 0xf000, 0x3000),
2ae95577
DH
4360 {}
4361 };
54db6c39
TI
4362 static struct coef_fw coef0255[] = {
4363 WRITE_COEF(0x45, 0xc089),
4364 WRITE_COEF(0x45, 0xc489),
4365 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4366 WRITE_COEF(0x49, 0x0049),
4367 {}
4368 };
4369 static struct coef_fw coef0233[] = {
4370 WRITE_COEF(0x06, 0x2100),
4371 WRITE_COEF(0x32, 0x4ea3),
4372 {}
4373 };
f3b70332
KY
4374 static struct coef_fw coef0288[] = {
4375 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4376 UPDATE_COEF(0x50, 0x2000, 0x2000),
4377 UPDATE_COEF(0x56, 0x0006, 0x0006),
4378 UPDATE_COEF(0x66, 0x0008, 0),
4379 UPDATE_COEF(0x67, 0x2000, 0),
4380 {}
4381 };
54db6c39
TI
4382 static struct coef_fw coef0292[] = {
4383 WRITE_COEF(0x76, 0x000e),
4384 WRITE_COEF(0x6c, 0x2400),
4385 WRITE_COEF(0x6b, 0xc429),
4386 WRITE_COEF(0x18, 0x7308),
4387 {}
4388 };
4389 static struct coef_fw coef0293[] = {
4390 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4391 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4392 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4393 {}
4394 };
4395 static struct coef_fw coef0688[] = {
4396 WRITE_COEF(0x11, 0x0041),
4397 WRITE_COEF(0x15, 0x0d40),
4398 WRITE_COEF(0xb7, 0x802b),
4399 {}
4400 };
71683c32
KY
4401 static struct coef_fw coef0274[] = {
4402 WRITE_COEF(0x45, 0x4289),
4403 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4404 UPDATE_COEF(0x6b, 0x0f00, 0),
4405 UPDATE_COEF(0x49, 0x0300, 0x0300),
4406 {}
4407 };
54db6c39 4408
7639a06c 4409 switch (codec->core.vendor_id) {
638aad63 4410 case 0x10ec0215:
2ae95577 4411 case 0x10ec0225:
638aad63 4412 case 0x10ec0285:
7d727869 4413 case 0x10ec0295:
638aad63 4414 case 0x10ec0289:
28f1f9b2 4415 case 0x10ec0299:
5a36767a 4416 alc_process_coef_fw(codec, alc225_pre_hsmode);
2ae95577
DH
4417 alc_process_coef_fw(codec, coef0225);
4418 break;
736f20a7 4419 case 0x10ec0236:
9a22a8f5 4420 case 0x10ec0255:
7081adf3 4421 case 0x10ec0256:
54db6c39 4422 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4423 break;
71683c32
KY
4424 case 0x10ec0234:
4425 case 0x10ec0274:
4426 case 0x10ec0294:
4427 alc_process_coef_fw(codec, coef0274);
4428 break;
13fd08a3 4429 case 0x10ec0233:
73bdd597 4430 case 0x10ec0283:
54db6c39 4431 alc_process_coef_fw(codec, coef0233);
73bdd597 4432 break;
f3b70332
KY
4433 case 0x10ec0286:
4434 case 0x10ec0288:
1a5bc8d9 4435 case 0x10ec0298:
f3b70332
KY
4436 alc_process_coef_fw(codec, coef0288);
4437 break;
73bdd597 4438 case 0x10ec0292:
54db6c39 4439 alc_process_coef_fw(codec, coef0292);
73bdd597 4440 break;
a22aa26f 4441 case 0x10ec0293:
54db6c39 4442 alc_process_coef_fw(codec, coef0293);
a22aa26f 4443 break;
73bdd597 4444 case 0x10ec0668:
54db6c39 4445 alc_process_coef_fw(codec, coef0688);
73bdd597 4446 break;
78f4f7c2
KY
4447 case 0x10ec0867:
4448 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4449 break;
73bdd597 4450 }
4e76a883 4451 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
73bdd597
DH
4452}
4453
4454/* Iphone type */
4455static void alc_headset_mode_ctia(struct hda_codec *codec)
4456{
89542936
KY
4457 int val;
4458
54db6c39
TI
4459 static struct coef_fw coef0255[] = {
4460 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4461 WRITE_COEF(0x1b, 0x0c2b),
4462 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4463 {}
4464 };
e69e7e03
KY
4465 static struct coef_fw coef0256[] = {
4466 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4467 WRITE_COEF(0x1b, 0x0c6b),
4468 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4469 {}
4470 };
54db6c39
TI
4471 static struct coef_fw coef0233[] = {
4472 WRITE_COEF(0x45, 0xd429),
4473 WRITE_COEF(0x1b, 0x0c2b),
4474 WRITE_COEF(0x32, 0x4ea3),
4475 {}
4476 };
f3b70332
KY
4477 static struct coef_fw coef0288[] = {
4478 UPDATE_COEF(0x50, 0x2000, 0x2000),
4479 UPDATE_COEF(0x56, 0x0006, 0x0006),
4480 UPDATE_COEF(0x66, 0x0008, 0),
4481 UPDATE_COEF(0x67, 0x2000, 0),
4482 {}
4483 };
54db6c39
TI
4484 static struct coef_fw coef0292[] = {
4485 WRITE_COEF(0x6b, 0xd429),
4486 WRITE_COEF(0x76, 0x0008),
4487 WRITE_COEF(0x18, 0x7388),
4488 {}
4489 };
4490 static struct coef_fw coef0293[] = {
4491 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4492 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4493 {}
4494 };
4495 static struct coef_fw coef0688[] = {
4496 WRITE_COEF(0x11, 0x0001),
4497 WRITE_COEF(0x15, 0x0d60),
4498 WRITE_COEF(0xc3, 0x0000),
4499 {}
4500 };
5a36767a 4501 static struct coef_fw coef0225_1[] = {
4cc9b9d6 4502 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5a36767a
KY
4503 UPDATE_COEF(0x63, 3<<14, 2<<14),
4504 {}
4505 };
4506 static struct coef_fw coef0225_2[] = {
4507 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4508 UPDATE_COEF(0x63, 3<<14, 1<<14),
4cc9b9d6
KY
4509 {}
4510 };
54db6c39 4511
7639a06c 4512 switch (codec->core.vendor_id) {
9a22a8f5 4513 case 0x10ec0255:
54db6c39 4514 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4515 break;
736f20a7 4516 case 0x10ec0236:
e69e7e03
KY
4517 case 0x10ec0256:
4518 alc_process_coef_fw(codec, coef0256);
4519 break;
71683c32
KY
4520 case 0x10ec0234:
4521 case 0x10ec0274:
4522 case 0x10ec0294:
4523 alc_write_coef_idx(codec, 0x45, 0xd689);
4524 break;
13fd08a3 4525 case 0x10ec0233:
73bdd597 4526 case 0x10ec0283:
54db6c39 4527 alc_process_coef_fw(codec, coef0233);
73bdd597 4528 break;
1a5bc8d9 4529 case 0x10ec0298:
89542936
KY
4530 val = alc_read_coef_idx(codec, 0x50);
4531 if (val & (1 << 12)) {
4532 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4533 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4534 msleep(300);
4535 } else {
4536 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4537 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4538 msleep(300);
4539 }
4540 break;
f3b70332
KY
4541 case 0x10ec0286:
4542 case 0x10ec0288:
4543 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4544 msleep(300);
4545 alc_process_coef_fw(codec, coef0288);
4546 break;
73bdd597 4547 case 0x10ec0292:
54db6c39 4548 alc_process_coef_fw(codec, coef0292);
73bdd597 4549 break;
a22aa26f 4550 case 0x10ec0293:
54db6c39 4551 alc_process_coef_fw(codec, coef0293);
a22aa26f 4552 break;
73bdd597 4553 case 0x10ec0668:
54db6c39 4554 alc_process_coef_fw(codec, coef0688);
73bdd597 4555 break;
638aad63 4556 case 0x10ec0215:
4cc9b9d6 4557 case 0x10ec0225:
638aad63 4558 case 0x10ec0285:
7d727869 4559 case 0x10ec0295:
638aad63 4560 case 0x10ec0289:
28f1f9b2 4561 case 0x10ec0299:
5a36767a
KY
4562 val = alc_read_coef_idx(codec, 0x45);
4563 if (val & (1 << 9))
4564 alc_process_coef_fw(codec, coef0225_2);
4565 else
4566 alc_process_coef_fw(codec, coef0225_1);
4cc9b9d6 4567 break;
78f4f7c2
KY
4568 case 0x10ec0867:
4569 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4570 break;
73bdd597 4571 }
4e76a883 4572 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
73bdd597
DH
4573}
4574
4575/* Nokia type */
4576static void alc_headset_mode_omtp(struct hda_codec *codec)
4577{
54db6c39
TI
4578 static struct coef_fw coef0255[] = {
4579 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4580 WRITE_COEF(0x1b, 0x0c2b),
4581 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4582 {}
4583 };
e69e7e03
KY
4584 static struct coef_fw coef0256[] = {
4585 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4586 WRITE_COEF(0x1b, 0x0c6b),
4587 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4588 {}
4589 };
54db6c39
TI
4590 static struct coef_fw coef0233[] = {
4591 WRITE_COEF(0x45, 0xe429),
4592 WRITE_COEF(0x1b, 0x0c2b),
4593 WRITE_COEF(0x32, 0x4ea3),
4594 {}
4595 };
f3b70332
KY
4596 static struct coef_fw coef0288[] = {
4597 UPDATE_COEF(0x50, 0x2000, 0x2000),
4598 UPDATE_COEF(0x56, 0x0006, 0x0006),
4599 UPDATE_COEF(0x66, 0x0008, 0),
4600 UPDATE_COEF(0x67, 0x2000, 0),
4601 {}
4602 };
54db6c39
TI
4603 static struct coef_fw coef0292[] = {
4604 WRITE_COEF(0x6b, 0xe429),
4605 WRITE_COEF(0x76, 0x0008),
4606 WRITE_COEF(0x18, 0x7388),
4607 {}
4608 };
4609 static struct coef_fw coef0293[] = {
4610 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4611 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4612 {}
4613 };
4614 static struct coef_fw coef0688[] = {
4615 WRITE_COEF(0x11, 0x0001),
4616 WRITE_COEF(0x15, 0x0d50),
4617 WRITE_COEF(0xc3, 0x0000),
4618 {}
4619 };
4cc9b9d6
KY
4620 static struct coef_fw coef0225[] = {
4621 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5a36767a 4622 UPDATE_COEF(0x63, 3<<14, 2<<14),
4cc9b9d6
KY
4623 {}
4624 };
54db6c39 4625
7639a06c 4626 switch (codec->core.vendor_id) {
9a22a8f5 4627 case 0x10ec0255:
54db6c39 4628 alc_process_coef_fw(codec, coef0255);
9a22a8f5 4629 break;
736f20a7 4630 case 0x10ec0236:
e69e7e03
KY
4631 case 0x10ec0256:
4632 alc_process_coef_fw(codec, coef0256);
4633 break;
71683c32
KY
4634 case 0x10ec0234:
4635 case 0x10ec0274:
4636 case 0x10ec0294:
4637 alc_write_coef_idx(codec, 0x45, 0xe689);
4638 break;
13fd08a3 4639 case 0x10ec0233:
73bdd597 4640 case 0x10ec0283:
54db6c39 4641 alc_process_coef_fw(codec, coef0233);
73bdd597 4642 break;
1a5bc8d9
KY
4643 case 0x10ec0298:
4644 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
89542936
KY
4645 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4646 msleep(300);
4647 break;
f3b70332
KY
4648 case 0x10ec0286:
4649 case 0x10ec0288:
4650 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4651 msleep(300);
4652 alc_process_coef_fw(codec, coef0288);
4653 break;
73bdd597 4654 case 0x10ec0292:
54db6c39 4655 alc_process_coef_fw(codec, coef0292);
73bdd597 4656 break;
a22aa26f 4657 case 0x10ec0293:
54db6c39 4658 alc_process_coef_fw(codec, coef0293);
a22aa26f 4659 break;
73bdd597 4660 case 0x10ec0668:
54db6c39 4661 alc_process_coef_fw(codec, coef0688);
73bdd597 4662 break;
638aad63 4663 case 0x10ec0215:
4cc9b9d6 4664 case 0x10ec0225:
638aad63 4665 case 0x10ec0285:
7d727869 4666 case 0x10ec0295:
638aad63 4667 case 0x10ec0289:
28f1f9b2 4668 case 0x10ec0299:
4cc9b9d6
KY
4669 alc_process_coef_fw(codec, coef0225);
4670 break;
73bdd597 4671 }
4e76a883 4672 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
73bdd597
DH
4673}
4674
4675static void alc_determine_headset_type(struct hda_codec *codec)
4676{
4677 int val;
4678 bool is_ctia = false;
4679 struct alc_spec *spec = codec->spec;
54db6c39
TI
4680 static struct coef_fw coef0255[] = {
4681 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4682 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4683 conteol) */
4684 {}
4685 };
f3b70332
KY
4686 static struct coef_fw coef0288[] = {
4687 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4688 {}
4689 };
89542936
KY
4690 static struct coef_fw coef0298[] = {
4691 UPDATE_COEF(0x50, 0x2000, 0x2000),
4692 UPDATE_COEF(0x56, 0x0006, 0x0006),
4693 UPDATE_COEF(0x66, 0x0008, 0),
4694 UPDATE_COEF(0x67, 0x2000, 0),
4695 UPDATE_COEF(0x19, 0x1300, 0x1300),
4696 {}
4697 };
54db6c39
TI
4698 static struct coef_fw coef0293[] = {
4699 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4700 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4701 {}
4702 };
4703 static struct coef_fw coef0688[] = {
4704 WRITE_COEF(0x11, 0x0001),
4705 WRITE_COEF(0xb7, 0x802b),
4706 WRITE_COEF(0x15, 0x0d60),
4707 WRITE_COEF(0xc3, 0x0c00),
4708 {}
4709 };
71683c32
KY
4710 static struct coef_fw coef0274[] = {
4711 UPDATE_COEF(0x4a, 0x0010, 0),
4712 UPDATE_COEF(0x4a, 0x8000, 0),
4713 WRITE_COEF(0x45, 0xd289),
4714 UPDATE_COEF(0x49, 0x0300, 0x0300),
4715 {}
4716 };
73bdd597 4717
7639a06c 4718 switch (codec->core.vendor_id) {
736f20a7 4719 case 0x10ec0236:
9a22a8f5 4720 case 0x10ec0255:
7081adf3 4721 case 0x10ec0256:
54db6c39 4722 alc_process_coef_fw(codec, coef0255);
9a22a8f5
KY
4723 msleep(300);
4724 val = alc_read_coef_idx(codec, 0x46);
4725 is_ctia = (val & 0x0070) == 0x0070;
4726 break;
71683c32
KY
4727 case 0x10ec0234:
4728 case 0x10ec0274:
4729 case 0x10ec0294:
4730 alc_process_coef_fw(codec, coef0274);
4731 msleep(80);
4732 val = alc_read_coef_idx(codec, 0x46);
4733 is_ctia = (val & 0x00f0) == 0x00f0;
4734 break;
13fd08a3 4735 case 0x10ec0233:
73bdd597
DH
4736 case 0x10ec0283:
4737 alc_write_coef_idx(codec, 0x45, 0xd029);
4738 msleep(300);
4739 val = alc_read_coef_idx(codec, 0x46);
4740 is_ctia = (val & 0x0070) == 0x0070;
4741 break;
1a5bc8d9 4742 case 0x10ec0298:
89542936
KY
4743 snd_hda_codec_write(codec, 0x21, 0,
4744 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4745 msleep(100);
4746 snd_hda_codec_write(codec, 0x21, 0,
4747 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4748 msleep(200);
4749
4750 val = alc_read_coef_idx(codec, 0x50);
4751 if (val & (1 << 12)) {
4752 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4753 alc_process_coef_fw(codec, coef0288);
4754 msleep(350);
4755 val = alc_read_coef_idx(codec, 0x50);
4756 is_ctia = (val & 0x0070) == 0x0070;
4757 } else {
4758 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4759 alc_process_coef_fw(codec, coef0288);
4760 msleep(350);
4761 val = alc_read_coef_idx(codec, 0x50);
4762 is_ctia = (val & 0x0070) == 0x0070;
4763 }
4764 alc_process_coef_fw(codec, coef0298);
4765 snd_hda_codec_write(codec, 0x21, 0,
4766 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4767 msleep(75);
4768 snd_hda_codec_write(codec, 0x21, 0,
4769 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4770 break;
f3b70332
KY
4771 case 0x10ec0286:
4772 case 0x10ec0288:
4773 alc_process_coef_fw(codec, coef0288);
4774 msleep(350);
4775 val = alc_read_coef_idx(codec, 0x50);
4776 is_ctia = (val & 0x0070) == 0x0070;
4777 break;
73bdd597
DH
4778 case 0x10ec0292:
4779 alc_write_coef_idx(codec, 0x6b, 0xd429);
4780 msleep(300);
4781 val = alc_read_coef_idx(codec, 0x6c);
4782 is_ctia = (val & 0x001c) == 0x001c;
4783 break;
a22aa26f 4784 case 0x10ec0293:
54db6c39 4785 alc_process_coef_fw(codec, coef0293);
a22aa26f
KY
4786 msleep(300);
4787 val = alc_read_coef_idx(codec, 0x46);
4788 is_ctia = (val & 0x0070) == 0x0070;
4789 break;
73bdd597 4790 case 0x10ec0668:
54db6c39 4791 alc_process_coef_fw(codec, coef0688);
73bdd597
DH
4792 msleep(300);
4793 val = alc_read_coef_idx(codec, 0xbe);
4794 is_ctia = (val & 0x1c02) == 0x1c02;
4795 break;
638aad63 4796 case 0x10ec0215:
4cc9b9d6 4797 case 0x10ec0225:
638aad63 4798 case 0x10ec0285:
7d727869 4799 case 0x10ec0295:
638aad63 4800 case 0x10ec0289:
28f1f9b2 4801 case 0x10ec0299:
0b4d8f55
KY
4802 snd_hda_codec_write(codec, 0x21, 0,
4803 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4804 msleep(80);
4805 snd_hda_codec_write(codec, 0x21, 0,
4806 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4807
5a36767a
KY
4808 alc_process_coef_fw(codec, alc225_pre_hsmode);
4809 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4810 val = alc_read_coef_idx(codec, 0x45);
4811 if (val & (1 << 9)) {
4812 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4813 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4814 msleep(800);
4815 val = alc_read_coef_idx(codec, 0x46);
4816 is_ctia = (val & 0x00f0) == 0x00f0;
4817 } else {
4818 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4819 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4820 msleep(800);
4821 val = alc_read_coef_idx(codec, 0x46);
4822 is_ctia = (val & 0x00f0) == 0x00f0;
4823 }
4824 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4825 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4826 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
0b4d8f55
KY
4827
4828 snd_hda_codec_write(codec, 0x21, 0,
4829 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4830 msleep(80);
4831 snd_hda_codec_write(codec, 0x21, 0,
4832 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4cc9b9d6 4833 break;
78f4f7c2
KY
4834 case 0x10ec0867:
4835 is_ctia = true;
4836 break;
73bdd597
DH
4837 }
4838
4e76a883 4839 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
73bdd597
DH
4840 is_ctia ? "yes" : "no");
4841 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4842}
4843
4844static void alc_update_headset_mode(struct hda_codec *codec)
4845{
4846 struct alc_spec *spec = codec->spec;
4847
4848 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
80f10932 4849 hda_nid_t hp_pin = alc_get_hp_pin(spec);
73bdd597
DH
4850
4851 int new_headset_mode;
4852
4853 if (!snd_hda_jack_detect(codec, hp_pin))
4854 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4855 else if (mux_pin == spec->headset_mic_pin)
4856 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4857 else if (mux_pin == spec->headphone_mic_pin)
4858 new_headset_mode = ALC_HEADSET_MODE_MIC;
4859 else
4860 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4861
5959a6bc
DH
4862 if (new_headset_mode == spec->current_headset_mode) {
4863 snd_hda_gen_update_outputs(codec);
73bdd597 4864 return;
5959a6bc 4865 }
73bdd597
DH
4866
4867 switch (new_headset_mode) {
4868 case ALC_HEADSET_MODE_UNPLUGGED:
4869 alc_headset_mode_unplugged(codec);
4870 spec->gen.hp_jack_present = false;
4871 break;
4872 case ALC_HEADSET_MODE_HEADSET:
4873 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4874 alc_determine_headset_type(codec);
4875 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4876 alc_headset_mode_ctia(codec);
4877 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4878 alc_headset_mode_omtp(codec);
4879 spec->gen.hp_jack_present = true;
4880 break;
4881 case ALC_HEADSET_MODE_MIC:
4882 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4883 spec->gen.hp_jack_present = false;
4884 break;
4885 case ALC_HEADSET_MODE_HEADPHONE:
4886 alc_headset_mode_default(codec);
4887 spec->gen.hp_jack_present = true;
4888 break;
4889 }
4890 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4891 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4892 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
1f8b46cd 4893 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
73bdd597
DH
4894 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4895 PIN_VREFHIZ);
4896 }
4897 spec->current_headset_mode = new_headset_mode;
4898
4899 snd_hda_gen_update_outputs(codec);
4900}
4901
4902static void alc_update_headset_mode_hook(struct hda_codec *codec,
7fe30711
TI
4903 struct snd_kcontrol *kcontrol,
4904 struct snd_ctl_elem_value *ucontrol)
73bdd597
DH
4905{
4906 alc_update_headset_mode(codec);
4907}
4908
1a4f69d5
TI
4909static void alc_update_headset_jack_cb(struct hda_codec *codec,
4910 struct hda_jack_callback *jack)
73bdd597
DH
4911{
4912 struct alc_spec *spec = codec->spec;
5db4d34b 4913 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
73bdd597
DH
4914 snd_hda_gen_hp_automute(codec, jack);
4915}
4916
4917static void alc_probe_headset_mode(struct hda_codec *codec)
4918{
4919 int i;
4920 struct alc_spec *spec = codec->spec;
4921 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4922
4923 /* Find mic pins */
4924 for (i = 0; i < cfg->num_inputs; i++) {
4925 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4926 spec->headset_mic_pin = cfg->inputs[i].pin;
4927 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4928 spec->headphone_mic_pin = cfg->inputs[i].pin;
4929 }
4930
4931 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4932 spec->gen.automute_hook = alc_update_headset_mode;
4933 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4934}
4935
4936static void alc_fixup_headset_mode(struct hda_codec *codec,
4937 const struct hda_fixup *fix, int action)
4938{
4939 struct alc_spec *spec = codec->spec;
4940
4941 switch (action) {
4942 case HDA_FIXUP_ACT_PRE_PROBE:
4943 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4944 break;
4945 case HDA_FIXUP_ACT_PROBE:
4946 alc_probe_headset_mode(codec);
4947 break;
4948 case HDA_FIXUP_ACT_INIT:
4949 spec->current_headset_mode = 0;
4950 alc_update_headset_mode(codec);
4951 break;
4952 }
4953}
4954
4955static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4956 const struct hda_fixup *fix, int action)
4957{
4958 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4959 struct alc_spec *spec = codec->spec;
4960 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4961 }
4962 else
4963 alc_fixup_headset_mode(codec, fix, action);
4964}
4965
31278997
KY
4966static void alc255_set_default_jack_type(struct hda_codec *codec)
4967{
4968 /* Set to iphone type */
e69e7e03 4969 static struct coef_fw alc255fw[] = {
54db6c39
TI
4970 WRITE_COEF(0x1b, 0x880b),
4971 WRITE_COEF(0x45, 0xd089),
4972 WRITE_COEF(0x1b, 0x080b),
4973 WRITE_COEF(0x46, 0x0004),
4974 WRITE_COEF(0x1b, 0x0c0b),
4975 {}
4976 };
e69e7e03
KY
4977 static struct coef_fw alc256fw[] = {
4978 WRITE_COEF(0x1b, 0x884b),
4979 WRITE_COEF(0x45, 0xd089),
4980 WRITE_COEF(0x1b, 0x084b),
4981 WRITE_COEF(0x46, 0x0004),
4982 WRITE_COEF(0x1b, 0x0c4b),
4983 {}
4984 };
4985 switch (codec->core.vendor_id) {
4986 case 0x10ec0255:
4987 alc_process_coef_fw(codec, alc255fw);
4988 break;
736f20a7 4989 case 0x10ec0236:
e69e7e03
KY
4990 case 0x10ec0256:
4991 alc_process_coef_fw(codec, alc256fw);
4992 break;
4993 }
31278997
KY
4994 msleep(30);
4995}
4996
9a22a8f5
KY
4997static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4998 const struct hda_fixup *fix, int action)
4999{
5000 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
31278997 5001 alc255_set_default_jack_type(codec);
9a22a8f5
KY
5002 }
5003 alc_fixup_headset_mode(codec, fix, action);
5004}
5005
31278997
KY
5006static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5007 const struct hda_fixup *fix, int action)
5008{
5009 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5010 struct alc_spec *spec = codec->spec;
5011 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5012 alc255_set_default_jack_type(codec);
5013 }
5014 else
5015 alc_fixup_headset_mode(codec, fix, action);
5016}
5017
e1e62b98
KY
5018static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5019 struct hda_jack_callback *jack)
5020{
5021 struct alc_spec *spec = codec->spec;
5022 int present;
5023
5024 alc_update_headset_jack_cb(codec, jack);
5025 /* Headset Mic enable or disable, only for Dell Dino */
5026 present = spec->gen.hp_jack_present ? 0x40 : 0;
5027 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
5028 present);
5029}
5030
5031static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5032 const struct hda_fixup *fix, int action)
5033{
5034 alc_fixup_headset_mode(codec, fix, action);
5035 if (action == HDA_FIXUP_ACT_PROBE) {
5036 struct alc_spec *spec = codec->spec;
5037 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5038 }
5039}
5040
493a52a9
HW
5041static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5042 const struct hda_fixup *fix, int action)
5043{
5044 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5045 struct alc_spec *spec = codec->spec;
5046 spec->gen.auto_mute_via_amp = 1;
5047 }
5048}
5049
9b745ab8
TI
5050static void alc_fixup_no_shutup(struct hda_codec *codec,
5051 const struct hda_fixup *fix, int action)
5052{
972aa2c7 5053 if (action == HDA_FIXUP_ACT_PROBE) {
9b745ab8 5054 struct alc_spec *spec = codec->spec;
b001f661 5055 spec->no_shutup_pins = 1;
9b745ab8
TI
5056 }
5057}
5058
5e6db669
GM
5059static void alc_fixup_disable_aamix(struct hda_codec *codec,
5060 const struct hda_fixup *fix, int action)
5061{
5062 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5063 struct alc_spec *spec = codec->spec;
5064 /* Disable AA-loopback as it causes white noise */
5065 spec->gen.mixer_nid = 0;
5066 }
5067}
5068
7f57d803
TI
5069/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5070static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5071 const struct hda_fixup *fix, int action)
5072{
5073 static const struct hda_pintbl pincfgs[] = {
5074 { 0x16, 0x21211010 }, /* dock headphone */
5075 { 0x19, 0x21a11010 }, /* dock mic */
5076 { }
5077 };
5078 struct alc_spec *spec = codec->spec;
5079
5080 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
70a0976b 5081 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
7f57d803
TI
5082 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5083 codec->power_save_node = 0; /* avoid click noises */
5084 snd_hda_apply_pincfgs(codec, pincfgs);
5085 }
5086}
5087
114745cd
KY
5088static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5089 const struct hda_fixup *fix, int action)
5090{
5091 static const struct hda_pintbl pincfgs[] = {
5092 { 0x17, 0x21211010 }, /* dock headphone */
5093 { 0x19, 0x21a11010 }, /* dock mic */
5094 { }
5095 };
5096 struct alc_spec *spec = codec->spec;
5097
5098 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5099 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
35bc709a
TI
5100 snd_hda_apply_pincfgs(codec, pincfgs);
5101 } else if (action == HDA_FIXUP_ACT_INIT) {
114745cd
KY
5102 /* Enable DOCK device */
5103 snd_hda_codec_write(codec, 0x17, 0,
5104 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5105 /* Enable DOCK device */
5106 snd_hda_codec_write(codec, 0x19, 0,
5107 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
114745cd
KY
5108 }
5109}
5110
9476d369 5111static void alc_shutup_dell_xps13(struct hda_codec *codec)
033b0a7c
GM
5112{
5113 struct alc_spec *spec = codec->spec;
80f10932 5114 int hp_pin = alc_get_hp_pin(spec);
033b0a7c 5115
9476d369
GM
5116 /* Prevent pop noises when headphones are plugged in */
5117 snd_hda_codec_write(codec, hp_pin, 0,
5118 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5119 msleep(20);
033b0a7c
GM
5120}
5121
5122static void alc_fixup_dell_xps13(struct hda_codec *codec,
5123 const struct hda_fixup *fix, int action)
5124{
3e1b0c4a
TI
5125 struct alc_spec *spec = codec->spec;
5126 struct hda_input_mux *imux = &spec->gen.input_mux;
5127 int i;
f38663ab 5128
3e1b0c4a
TI
5129 switch (action) {
5130 case HDA_FIXUP_ACT_PRE_PROBE:
5131 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5132 * it causes a click noise at start up
5133 */
5134 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5135 break;
5136 case HDA_FIXUP_ACT_PROBE:
9476d369 5137 spec->shutup = alc_shutup_dell_xps13;
f38663ab
GM
5138
5139 /* Make the internal mic the default input source. */
5140 for (i = 0; i < imux->num_items; i++) {
5141 if (spec->gen.imux_pins[i] == 0x12) {
5142 spec->gen.cur_mux[0] = i;
5143 break;
5144 }
5145 }
3e1b0c4a 5146 break;
033b0a7c
GM
5147 }
5148}
5149
1f8b46cd
DH
5150static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5151 const struct hda_fixup *fix, int action)
5152{
5153 struct alc_spec *spec = codec->spec;
5154
5155 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5156 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5157 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
b40eda64
DH
5158
5159 /* Disable boost for mic-in permanently. (This code is only called
5160 from quirks that guarantee that the headphone is at NID 0x1b.) */
5161 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5162 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
1f8b46cd
DH
5163 } else
5164 alc_fixup_headset_mode(codec, fix, action);
5165}
5166
73bdd597
DH
5167static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5168 const struct hda_fixup *fix, int action)
5169{
5170 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
73bdd597 5171 alc_write_coef_idx(codec, 0xc4, 0x8000);
98b24883 5172 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
73bdd597
DH
5173 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5174 }
5175 alc_fixup_headset_mode(codec, fix, action);
5176}
5177
bde7bc60
CCC
5178/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5179static int find_ext_mic_pin(struct hda_codec *codec)
5180{
5181 struct alc_spec *spec = codec->spec;
5182 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5183 hda_nid_t nid;
5184 unsigned int defcfg;
5185 int i;
5186
5187 for (i = 0; i < cfg->num_inputs; i++) {
5188 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5189 continue;
5190 nid = cfg->inputs[i].pin;
5191 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5192 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5193 continue;
5194 return nid;
5195 }
5196
5197 return 0;
5198}
5199
08a978db 5200static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
1727a771 5201 const struct hda_fixup *fix,
08a978db
DR
5202 int action)
5203{
5204 struct alc_spec *spec = codec->spec;
5205
0db75790 5206 if (action == HDA_FIXUP_ACT_PROBE) {
bde7bc60 5207 int mic_pin = find_ext_mic_pin(codec);
80f10932 5208 int hp_pin = alc_get_hp_pin(spec);
bde7bc60
CCC
5209
5210 if (snd_BUG_ON(!mic_pin || !hp_pin))
0db75790 5211 return;
bde7bc60 5212 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
0db75790 5213 }
08a978db 5214}
693b613d 5215
3e0d611b
DH
5216static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5217 const struct hda_fixup *fix,
5218 int action)
5219{
5220 struct alc_spec *spec = codec->spec;
5221 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5222 int i;
5223
5224 /* The mic boosts on level 2 and 3 are too noisy
5225 on the internal mic input.
5226 Therefore limit the boost to 0 or 1. */
5227
5228 if (action != HDA_FIXUP_ACT_PROBE)
5229 return;
5230
5231 for (i = 0; i < cfg->num_inputs; i++) {
5232 hda_nid_t nid = cfg->inputs[i].pin;
5233 unsigned int defcfg;
5234 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5235 continue;
5236 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5237 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5238 continue;
5239
5240 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5241 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5242 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5243 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5244 (0 << AC_AMPCAP_MUTE_SHIFT));
5245 }
5246}
5247
cd217a63 5248static void alc283_hp_automute_hook(struct hda_codec *codec,
1a4f69d5 5249 struct hda_jack_callback *jack)
cd217a63
KY
5250{
5251 struct alc_spec *spec = codec->spec;
5252 int vref;
5253
5254 msleep(200);
5255 snd_hda_gen_hp_automute(codec, jack);
5256
5257 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5258
5259 msleep(600);
5260 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5261 vref);
5262}
5263
cd217a63
KY
5264static void alc283_fixup_chromebook(struct hda_codec *codec,
5265 const struct hda_fixup *fix, int action)
5266{
5267 struct alc_spec *spec = codec->spec;
cd217a63
KY
5268
5269 switch (action) {
5270 case HDA_FIXUP_ACT_PRE_PROBE:
0202e99c 5271 snd_hda_override_wcaps(codec, 0x03, 0);
d2e92709
TI
5272 /* Disable AA-loopback as it causes white noise */
5273 spec->gen.mixer_nid = 0;
38070219 5274 break;
0202e99c 5275 case HDA_FIXUP_ACT_INIT:
de9481cb
KY
5276 /* MIC2-VREF control */
5277 /* Set to manual mode */
98b24883 5278 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
0202e99c 5279 /* Enable Line1 input control by verb */
98b24883 5280 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
0202e99c
KY
5281 break;
5282 }
5283}
5284
5285static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5286 const struct hda_fixup *fix, int action)
5287{
5288 struct alc_spec *spec = codec->spec;
0202e99c
KY
5289
5290 switch (action) {
5291 case HDA_FIXUP_ACT_PRE_PROBE:
cd217a63 5292 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
38070219
KY
5293 break;
5294 case HDA_FIXUP_ACT_INIT:
cd217a63
KY
5295 /* MIC2-VREF control */
5296 /* Set to manual mode */
98b24883 5297 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
cd217a63
KY
5298 break;
5299 }
5300}
5301
7bba2157
TI
5302/* mute tablet speaker pin (0x14) via dock plugging in addition */
5303static void asus_tx300_automute(struct hda_codec *codec)
5304{
5305 struct alc_spec *spec = codec->spec;
5306 snd_hda_gen_update_outputs(codec);
5307 if (snd_hda_jack_detect(codec, 0x1b))
5308 spec->gen.mute_bits |= (1ULL << 0x14);
5309}
5310
5311static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5312 const struct hda_fixup *fix, int action)
5313{
5314 struct alc_spec *spec = codec->spec;
5315 /* TX300 needs to set up GPIO2 for the speaker amp */
5316 static const struct hda_verb gpio2_verbs[] = {
5317 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
5318 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
5319 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
5320 {}
5321 };
5322 static const struct hda_pintbl dock_pins[] = {
5323 { 0x1b, 0x21114000 }, /* dock speaker pin */
5324 {}
5325 };
7bba2157
TI
5326
5327 switch (action) {
5328 case HDA_FIXUP_ACT_PRE_PROBE:
5329 snd_hda_add_verbs(codec, gpio2_verbs);
5330 snd_hda_apply_pincfgs(codec, dock_pins);
5331 spec->gen.auto_mute_via_amp = 1;
5332 spec->gen.automute_hook = asus_tx300_automute;
5333 snd_hda_jack_detect_enable_callback(codec, 0x1b,
7bba2157
TI
5334 snd_hda_gen_hp_automute);
5335 break;
5336 case HDA_FIXUP_ACT_BUILD:
5337 /* this is a bit tricky; give more sane names for the main
5338 * (tablet) speaker and the dock speaker, respectively
5339 */
56798e6b
TI
5340 rename_ctl(codec, "Speaker Playback Switch",
5341 "Dock Speaker Playback Switch");
5342 rename_ctl(codec, "Bass Speaker Playback Switch",
5343 "Speaker Playback Switch");
7bba2157
TI
5344 break;
5345 }
5346}
5347
338cae56
DH
5348static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5349 const struct hda_fixup *fix, int action)
5350{
0f4881dc
DH
5351 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5352 /* DAC node 0x03 is giving mono output. We therefore want to
5353 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5354 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5355 hda_nid_t conn1[2] = { 0x0c };
5356 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5357 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5358 }
338cae56
DH
5359}
5360
dd9aa335
HW
5361static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5362 const struct hda_fixup *fix, int action)
5363{
5364 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5365 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5366 we can't adjust the speaker's volume since this node does not has
5367 Amp-out capability. we change the speaker's route to:
5368 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5369 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5370 speaker's volume now. */
5371
5372 hda_nid_t conn1[1] = { 0x0c };
5373 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5374 }
5375}
5376
214839a8
TI
5377/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5378static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5379 const struct hda_fixup *fix, int action)
5380{
5381 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5382 hda_nid_t conn[2] = { 0x02, 0x03 };
5383 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5384 }
5385}
5386
98973f2f
KP
5387/* Hook to update amp GPIO4 for automute */
5388static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5389 struct hda_jack_callback *jack)
5390{
5391 struct alc_spec *spec = codec->spec;
5392
5393 snd_hda_gen_hp_automute(codec, jack);
5394 /* mute_led_polarity is set to 0, so we pass inverted value here */
5395 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5396}
5397
5398/* Manage GPIOs for HP EliteBook Folio 9480m.
5399 *
5400 * GPIO4 is the headphone amplifier power control
5401 * GPIO3 is the audio output mute indicator LED
5402 */
5403
5404static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5405 const struct hda_fixup *fix,
5406 int action)
5407{
5408 struct alc_spec *spec = codec->spec;
5409 static const struct hda_verb gpio_init[] = {
5410 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
5411 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
5412 {}
5413 };
5414
5415 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5416 /* Set the hooks to turn the headphone amp on/off
5417 * as needed
5418 */
5419 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
5420 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
5421
5422 /* The GPIOs are currently off */
5423 spec->gpio_led = 0;
5424
5425 /* GPIO3 is connected to the output mute LED,
5426 * high is on, low is off
5427 */
5428 spec->mute_led_polarity = 0;
5429 spec->gpio_mute_led_mask = 0x08;
5430
5431 /* Initialize GPIO configuration */
5432 snd_hda_add_verbs(codec, gpio_init);
5433 }
5434}
5435
ca169cc2
KY
5436static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5437 const struct hda_fixup *fix,
5438 int action)
5439{
5440 alc_fixup_dual_codecs(codec, fix, action);
5441 switch (action) {
5442 case HDA_FIXUP_ACT_PRE_PROBE:
5443 /* override card longname to provide a unique UCM profile */
5444 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5445 break;
5446 case HDA_FIXUP_ACT_BUILD:
5447 /* rename Capture controls depending on the codec */
5448 rename_ctl(codec, "Capture Volume",
5449 codec->addr == 0 ?
5450 "Rear-Panel Capture Volume" :
5451 "Front-Panel Capture Volume");
5452 rename_ctl(codec, "Capture Switch",
5453 codec->addr == 0 ?
5454 "Rear-Panel Capture Switch" :
5455 "Front-Panel Capture Switch");
5456 break;
5457 }
5458}
5459
92266651
KY
5460/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5461static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5462 const struct hda_fixup *fix, int action)
5463{
5464 struct alc_spec *spec = codec->spec;
5465 static hda_nid_t preferred_pairs[] = {
5466 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5467 0
5468 };
5469
5470 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5471 return;
5472
5473 spec->gen.preferred_dacs = preferred_pairs;
fde563b0
KY
5474 spec->gen.auto_mute_via_amp = 1;
5475 codec->power_save_node = 0;
92266651
KY
5476}
5477
ea7118da
HW
5478/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
5479static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
5480 const struct hda_fixup *fix, int action)
5481{
5482 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5483 return;
5484
5485 snd_hda_override_wcaps(codec, 0x03, 0);
5486}
5487
f4ccb37c
KY
5488static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
5489 const struct hda_fixup *fix, int action)
5490{
5491 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5492 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5493}
5494
b317b032
TI
5495/* for hda_fixup_thinkpad_acpi() */
5496#include "thinkpad_helper.c"
b67ae3f1 5497
2ae22638
TI
5498static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5499 const struct hda_fixup *fix, int action)
5500{
5501 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5502 hda_fixup_thinkpad_acpi(codec, fix, action);
5503}
5504
00ef9940
HW
5505/* for dell wmi mic mute led */
5506#include "dell_wmi_helper.c"
5507
1d045db9
TI
5508enum {
5509 ALC269_FIXUP_SONY_VAIO,
5510 ALC275_FIXUP_SONY_VAIO_GPIO2,
5511 ALC269_FIXUP_DELL_M101Z,
5512 ALC269_FIXUP_SKU_IGNORE,
5513 ALC269_FIXUP_ASUS_G73JW,
5514 ALC269_FIXUP_LENOVO_EAPD,
5515 ALC275_FIXUP_SONY_HWEQ,
e9bd7d5c 5516 ALC275_FIXUP_SONY_DISABLE_AAMIX,
1d045db9 5517 ALC271_FIXUP_DMIC,
017f2a10 5518 ALC269_FIXUP_PCM_44K,
adabb3ec 5519 ALC269_FIXUP_STEREO_DMIC,
7c478f03 5520 ALC269_FIXUP_HEADSET_MIC,
24519911
TI
5521 ALC269_FIXUP_QUANTA_MUTE,
5522 ALC269_FIXUP_LIFEBOOK,
2041d564 5523 ALC269_FIXUP_LIFEBOOK_EXTMIC,
cc7016ab 5524 ALC269_FIXUP_LIFEBOOK_HP_PIN,
4df3fd17 5525 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
0dcd451c 5526 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
a4297b5d
TI
5527 ALC269_FIXUP_AMIC,
5528 ALC269_FIXUP_DMIC,
5529 ALC269VB_FIXUP_AMIC,
5530 ALC269VB_FIXUP_DMIC,
08fb0d0e 5531 ALC269_FIXUP_HP_MUTE_LED,
d06ac143 5532 ALC269_FIXUP_HP_MUTE_LED_MIC1,
08fb0d0e 5533 ALC269_FIXUP_HP_MUTE_LED_MIC2,
9f5c6faf 5534 ALC269_FIXUP_HP_GPIO_LED,
9c5dc3bf
KY
5535 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5536 ALC269_FIXUP_HP_LINE1_MIC1_LED,
693b613d 5537 ALC269_FIXUP_INV_DMIC,
108cc108 5538 ALC269_FIXUP_LENOVO_DOCK,
9b745ab8 5539 ALC269_FIXUP_NO_SHUTUP,
88cfcf86 5540 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
108cc108 5541 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
73bdd597
DH
5542 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5543 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
338cae56 5544 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
fcc6c877 5545 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
73bdd597
DH
5546 ALC269_FIXUP_HEADSET_MODE,
5547 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7819717b 5548 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
d240d1dc
DH
5549 ALC269_FIXUP_ASUS_X101_FUNC,
5550 ALC269_FIXUP_ASUS_X101_VERB,
5551 ALC269_FIXUP_ASUS_X101,
08a978db
DR
5552 ALC271_FIXUP_AMIC_MIC2,
5553 ALC271_FIXUP_HP_GATE_MIC_JACK,
b1e8972e 5554 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
42397004 5555 ALC269_FIXUP_ACER_AC700,
3e0d611b 5556 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
2cede303 5557 ALC269VB_FIXUP_ASUS_ZENBOOK,
23870831 5558 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
8e35cd4a 5559 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
02b504d9 5560 ALC269VB_FIXUP_ORDISSIMO_EVE2,
cd217a63 5561 ALC283_FIXUP_CHROME_BOOK,
0202e99c 5562 ALC283_FIXUP_SENSE_COMBO_JACK,
7bba2157 5563 ALC282_FIXUP_ASUS_TX300,
1bb3e062 5564 ALC283_FIXUP_INT_MIC,
338cae56 5565 ALC290_FIXUP_MONO_SPEAKERS,
0f4881dc
DH
5566 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5567 ALC290_FIXUP_SUBWOOFER,
5568 ALC290_FIXUP_SUBWOOFER_HSJACK,
b67ae3f1 5569 ALC269_FIXUP_THINKPAD_ACPI,
56f27013 5570 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
5824ce8d 5571 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
615966ad 5572 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9a22a8f5 5573 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
31278997 5574 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9a22a8f5 5575 ALC255_FIXUP_HEADSET_MODE,
31278997 5576 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
a22aa26f 5577 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
1c37c223 5578 ALC292_FIXUP_TPT440_DOCK,
9a811230 5579 ALC292_FIXUP_TPT440,
abaa2274 5580 ALC283_FIXUP_HEADSET_MIC,
00ef9940 5581 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
1a22e775 5582 ALC282_FIXUP_ASPIRE_V5_PINS,
7a5255f1 5583 ALC280_FIXUP_HP_GPIO4,
eaa8e5ef 5584 ALC286_FIXUP_HP_GPIO_LED,
33f4acd3 5585 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
b4b33f9d 5586 ALC280_FIXUP_HP_DOCK_PINS,
04d5466a 5587 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
98973f2f 5588 ALC280_FIXUP_HP_9480M,
e1e62b98
KY
5589 ALC288_FIXUP_DELL_HEADSET_MODE,
5590 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
5591 ALC288_FIXUP_DELL_XPS_13_GPIO6,
831bfdf9
HW
5592 ALC288_FIXUP_DELL_XPS_13,
5593 ALC288_FIXUP_DISABLE_AAMIX,
8b99aba7
TI
5594 ALC292_FIXUP_DELL_E7X,
5595 ALC292_FIXUP_DISABLE_AAMIX,
c04017ea 5596 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
977e6276 5597 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
2f726aec 5598 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6ed1131f 5599 ALC275_FIXUP_DELL_XPS,
8c69729b 5600 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
23adc192 5601 ALC293_FIXUP_LENOVO_SPK_NOISE,
3694cb29 5602 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
3b43b71f 5603 ALC255_FIXUP_DELL_SPK_NOISE,
f4ccb37c 5604 ALC225_FIXUP_DISABLE_MIC_VREF,
2ae95577 5605 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
214839a8 5606 ALC295_FIXUP_DISABLE_DAC3,
f883982d 5607 ALC280_FIXUP_HP_HEADSET_MIC,
e549d190 5608 ALC221_FIXUP_HP_FRONT_MIC,
c636b95e 5609 ALC292_FIXUP_TPT460,
dd9aa335 5610 ALC298_FIXUP_SPK_VOLUME,
fd06c77e 5611 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
823ff161 5612 ALC269_FIXUP_ATIV_BOOK_8,
9eb5d0e6 5613 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
c1732ede
CC
5614 ALC256_FIXUP_ASUS_HEADSET_MODE,
5615 ALC256_FIXUP_ASUS_MIC,
eeed4cd1 5616 ALC256_FIXUP_ASUS_AIO_GPIO2,
216d7aeb
CC
5617 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5618 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
ca169cc2 5619 ALC233_FIXUP_LENOVO_MULTI_CODECS,
f33f79f3 5620 ALC294_FIXUP_LENOVO_MIC_LOCATION,
9423a273 5621 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
b84e8436 5622 ALC700_FIXUP_INTEL_REFERENCE,
92266651
KY
5623 ALC274_FIXUP_DELL_BIND_DACS,
5624 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
114745cd 5625 ALC298_FIXUP_TPT470_DOCK,
9cfdabca 5626 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
4c574ad4 5627 ALC255_FIXUP_DELL_HEADSET_MIC,
32e2ee86 5628 ALC221_FIXUP_HP_HEADSET_MIC,
ea7118da 5629 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
0a60c116 5630 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
09416ef0 5631 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
20616fb0
KY
5632 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
5633 ALC225_FIXUP_WYSE_AUTO_MUTE,
5634 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
f1d4e28b
KY
5635};
5636
1727a771 5637static const struct hda_fixup alc269_fixups[] = {
1d045db9 5638 [ALC269_FIXUP_SONY_VAIO] = {
fd108215
TI
5639 .type = HDA_FIXUP_PINCTLS,
5640 .v.pins = (const struct hda_pintbl[]) {
5641 {0x19, PIN_VREFGRD},
1d045db9
TI
5642 {}
5643 }
f1d4e28b 5644 },
1d045db9 5645 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
1727a771 5646 .type = HDA_FIXUP_VERBS,
1d045db9
TI
5647 .v.verbs = (const struct hda_verb[]) {
5648 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
5649 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
5650 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5651 { }
5652 },
5653 .chained = true,
5654 .chain_id = ALC269_FIXUP_SONY_VAIO
5655 },
5656 [ALC269_FIXUP_DELL_M101Z] = {
1727a771 5657 .type = HDA_FIXUP_VERBS,
1d045db9
TI
5658 .v.verbs = (const struct hda_verb[]) {
5659 /* Enables internal speaker */
5660 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5661 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5662 {}
5663 }
5664 },
5665 [ALC269_FIXUP_SKU_IGNORE] = {
1727a771 5666 .type = HDA_FIXUP_FUNC,
23d30f28 5667 .v.func = alc_fixup_sku_ignore,
1d045db9
TI
5668 },
5669 [ALC269_FIXUP_ASUS_G73JW] = {
1727a771
TI
5670 .type = HDA_FIXUP_PINS,
5671 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
5672 { 0x17, 0x99130111 }, /* subwoofer */
5673 { }
5674 }
5675 },
5676 [ALC269_FIXUP_LENOVO_EAPD] = {
1727a771 5677 .type = HDA_FIXUP_VERBS,
1d045db9
TI
5678 .v.verbs = (const struct hda_verb[]) {
5679 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5680 {}
5681 }
5682 },
5683 [ALC275_FIXUP_SONY_HWEQ] = {
1727a771 5684 .type = HDA_FIXUP_FUNC,
1d045db9
TI
5685 .v.func = alc269_fixup_hweq,
5686 .chained = true,
5687 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5688 },
e9bd7d5c
TI
5689 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5690 .type = HDA_FIXUP_FUNC,
5691 .v.func = alc_fixup_disable_aamix,
5692 .chained = true,
5693 .chain_id = ALC269_FIXUP_SONY_VAIO
5694 },
1d045db9 5695 [ALC271_FIXUP_DMIC] = {
1727a771 5696 .type = HDA_FIXUP_FUNC,
1d045db9 5697 .v.func = alc271_fixup_dmic,
f1d4e28b 5698 },
017f2a10 5699 [ALC269_FIXUP_PCM_44K] = {
1727a771 5700 .type = HDA_FIXUP_FUNC,
017f2a10 5701 .v.func = alc269_fixup_pcm_44k,
012e7eb1
DH
5702 .chained = true,
5703 .chain_id = ALC269_FIXUP_QUANTA_MUTE
017f2a10 5704 },
adabb3ec 5705 [ALC269_FIXUP_STEREO_DMIC] = {
1727a771 5706 .type = HDA_FIXUP_FUNC,
adabb3ec
TI
5707 .v.func = alc269_fixup_stereo_dmic,
5708 },
7c478f03
DH
5709 [ALC269_FIXUP_HEADSET_MIC] = {
5710 .type = HDA_FIXUP_FUNC,
5711 .v.func = alc269_fixup_headset_mic,
5712 },
24519911 5713 [ALC269_FIXUP_QUANTA_MUTE] = {
1727a771 5714 .type = HDA_FIXUP_FUNC,
24519911
TI
5715 .v.func = alc269_fixup_quanta_mute,
5716 },
5717 [ALC269_FIXUP_LIFEBOOK] = {
1727a771
TI
5718 .type = HDA_FIXUP_PINS,
5719 .v.pins = (const struct hda_pintbl[]) {
24519911
TI
5720 { 0x1a, 0x2101103f }, /* dock line-out */
5721 { 0x1b, 0x23a11040 }, /* dock mic-in */
5722 { }
5723 },
5724 .chained = true,
5725 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5726 },
2041d564
DH
5727 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5728 .type = HDA_FIXUP_PINS,
5729 .v.pins = (const struct hda_pintbl[]) {
5730 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5731 { }
5732 },
5733 },
cc7016ab
TI
5734 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5735 .type = HDA_FIXUP_PINS,
5736 .v.pins = (const struct hda_pintbl[]) {
5737 { 0x21, 0x0221102f }, /* HP out */
5738 { }
5739 },
5740 },
4df3fd17
TI
5741 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5742 .type = HDA_FIXUP_FUNC,
5743 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5744 },
0dcd451c
JMG
5745 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5746 .type = HDA_FIXUP_FUNC,
5747 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5748 },
a4297b5d 5749 [ALC269_FIXUP_AMIC] = {
1727a771
TI
5750 .type = HDA_FIXUP_PINS,
5751 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
5752 { 0x14, 0x99130110 }, /* speaker */
5753 { 0x15, 0x0121401f }, /* HP out */
5754 { 0x18, 0x01a19c20 }, /* mic */
5755 { 0x19, 0x99a3092f }, /* int-mic */
5756 { }
5757 },
5758 },
5759 [ALC269_FIXUP_DMIC] = {
1727a771
TI
5760 .type = HDA_FIXUP_PINS,
5761 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
5762 { 0x12, 0x99a3092f }, /* int-mic */
5763 { 0x14, 0x99130110 }, /* speaker */
5764 { 0x15, 0x0121401f }, /* HP out */
5765 { 0x18, 0x01a19c20 }, /* mic */
5766 { }
5767 },
5768 },
5769 [ALC269VB_FIXUP_AMIC] = {
1727a771
TI
5770 .type = HDA_FIXUP_PINS,
5771 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
5772 { 0x14, 0x99130110 }, /* speaker */
5773 { 0x18, 0x01a19c20 }, /* mic */
5774 { 0x19, 0x99a3092f }, /* int-mic */
5775 { 0x21, 0x0121401f }, /* HP out */
5776 { }
5777 },
5778 },
2267ea97 5779 [ALC269VB_FIXUP_DMIC] = {
1727a771
TI
5780 .type = HDA_FIXUP_PINS,
5781 .v.pins = (const struct hda_pintbl[]) {
a4297b5d
TI
5782 { 0x12, 0x99a3092f }, /* int-mic */
5783 { 0x14, 0x99130110 }, /* speaker */
5784 { 0x18, 0x01a19c20 }, /* mic */
5785 { 0x21, 0x0121401f }, /* HP out */
5786 { }
5787 },
5788 },
08fb0d0e 5789 [ALC269_FIXUP_HP_MUTE_LED] = {
1727a771 5790 .type = HDA_FIXUP_FUNC,
08fb0d0e 5791 .v.func = alc269_fixup_hp_mute_led,
6d3cd5d4 5792 },
d06ac143
DH
5793 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5794 .type = HDA_FIXUP_FUNC,
5795 .v.func = alc269_fixup_hp_mute_led_mic1,
5796 },
08fb0d0e 5797 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
1727a771 5798 .type = HDA_FIXUP_FUNC,
08fb0d0e 5799 .v.func = alc269_fixup_hp_mute_led_mic2,
420b0feb 5800 },
9f5c6faf
TI
5801 [ALC269_FIXUP_HP_GPIO_LED] = {
5802 .type = HDA_FIXUP_FUNC,
5803 .v.func = alc269_fixup_hp_gpio_led,
5804 },
9c5dc3bf
KY
5805 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5806 .type = HDA_FIXUP_FUNC,
5807 .v.func = alc269_fixup_hp_gpio_mic1_led,
5808 },
5809 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5810 .type = HDA_FIXUP_FUNC,
5811 .v.func = alc269_fixup_hp_line1_mic1_led,
5812 },
693b613d 5813 [ALC269_FIXUP_INV_DMIC] = {
1727a771 5814 .type = HDA_FIXUP_FUNC,
9d36a7dc 5815 .v.func = alc_fixup_inv_dmic,
693b613d 5816 },
9b745ab8
TI
5817 [ALC269_FIXUP_NO_SHUTUP] = {
5818 .type = HDA_FIXUP_FUNC,
5819 .v.func = alc_fixup_no_shutup,
5820 },
108cc108 5821 [ALC269_FIXUP_LENOVO_DOCK] = {
1727a771
TI
5822 .type = HDA_FIXUP_PINS,
5823 .v.pins = (const struct hda_pintbl[]) {
108cc108
DH
5824 { 0x19, 0x23a11040 }, /* dock mic */
5825 { 0x1b, 0x2121103f }, /* dock headphone */
5826 { }
5827 },
5828 .chained = true,
5829 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5830 },
5831 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
1727a771 5832 .type = HDA_FIXUP_FUNC,
108cc108 5833 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
52129000
DH
5834 .chained = true,
5835 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
108cc108 5836 },
73bdd597
DH
5837 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5838 .type = HDA_FIXUP_PINS,
5839 .v.pins = (const struct hda_pintbl[]) {
5840 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5841 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5842 { }
5843 },
5844 .chained = true,
5845 .chain_id = ALC269_FIXUP_HEADSET_MODE
5846 },
5847 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5848 .type = HDA_FIXUP_PINS,
5849 .v.pins = (const struct hda_pintbl[]) {
5850 { 0x16, 0x21014020 }, /* dock line out */
5851 { 0x19, 0x21a19030 }, /* dock mic */
5852 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5853 { }
5854 },
5855 .chained = true,
5856 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5857 },
338cae56
DH
5858 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5859 .type = HDA_FIXUP_PINS,
5860 .v.pins = (const struct hda_pintbl[]) {
5861 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5862 { }
5863 },
5864 .chained = true,
5865 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5866 },
fcc6c877
KY
5867 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5868 .type = HDA_FIXUP_PINS,
5869 .v.pins = (const struct hda_pintbl[]) {
5870 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5871 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5872 { }
5873 },
5874 .chained = true,
5875 .chain_id = ALC269_FIXUP_HEADSET_MODE
5876 },
73bdd597
DH
5877 [ALC269_FIXUP_HEADSET_MODE] = {
5878 .type = HDA_FIXUP_FUNC,
5879 .v.func = alc_fixup_headset_mode,
6676f308
HW
5880 .chained = true,
5881 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
73bdd597
DH
5882 },
5883 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5884 .type = HDA_FIXUP_FUNC,
5885 .v.func = alc_fixup_headset_mode_no_hp_mic,
5886 },
7819717b
TI
5887 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5888 .type = HDA_FIXUP_PINS,
5889 .v.pins = (const struct hda_pintbl[]) {
5890 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5891 { }
5892 },
5893 .chained = true,
5894 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5895 },
88cfcf86
DH
5896 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5897 .type = HDA_FIXUP_PINS,
5898 .v.pins = (const struct hda_pintbl[]) {
5899 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5900 { }
5901 },
fbc78ad6
DH
5902 .chained = true,
5903 .chain_id = ALC269_FIXUP_HEADSET_MIC
88cfcf86 5904 },
d240d1dc
DH
5905 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5906 .type = HDA_FIXUP_FUNC,
5907 .v.func = alc269_fixup_x101_headset_mic,
5908 },
5909 [ALC269_FIXUP_ASUS_X101_VERB] = {
5910 .type = HDA_FIXUP_VERBS,
5911 .v.verbs = (const struct hda_verb[]) {
5912 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5913 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5914 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5915 { }
5916 },
5917 .chained = true,
5918 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5919 },
5920 [ALC269_FIXUP_ASUS_X101] = {
5921 .type = HDA_FIXUP_PINS,
5922 .v.pins = (const struct hda_pintbl[]) {
5923 { 0x18, 0x04a1182c }, /* Headset mic */
5924 { }
5925 },
5926 .chained = true,
5927 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
5928 },
08a978db 5929 [ALC271_FIXUP_AMIC_MIC2] = {
1727a771
TI
5930 .type = HDA_FIXUP_PINS,
5931 .v.pins = (const struct hda_pintbl[]) {
08a978db
DR
5932 { 0x14, 0x99130110 }, /* speaker */
5933 { 0x19, 0x01a19c20 }, /* mic */
5934 { 0x1b, 0x99a7012f }, /* int-mic */
5935 { 0x21, 0x0121401f }, /* HP out */
5936 { }
5937 },
5938 },
5939 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
1727a771 5940 .type = HDA_FIXUP_FUNC,
08a978db
DR
5941 .v.func = alc271_hp_gate_mic_jack,
5942 .chained = true,
5943 .chain_id = ALC271_FIXUP_AMIC_MIC2,
5944 },
b1e8972e
OR
5945 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
5946 .type = HDA_FIXUP_FUNC,
5947 .v.func = alc269_fixup_limit_int_mic_boost,
5948 .chained = true,
5949 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
5950 },
42397004
DR
5951 [ALC269_FIXUP_ACER_AC700] = {
5952 .type = HDA_FIXUP_PINS,
5953 .v.pins = (const struct hda_pintbl[]) {
5954 { 0x12, 0x99a3092f }, /* int-mic */
5955 { 0x14, 0x99130110 }, /* speaker */
5956 { 0x18, 0x03a11c20 }, /* mic */
5957 { 0x1e, 0x0346101e }, /* SPDIF1 */
5958 { 0x21, 0x0321101f }, /* HP out */
5959 { }
5960 },
5961 .chained = true,
5962 .chain_id = ALC271_FIXUP_DMIC,
5963 },
3e0d611b
DH
5964 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
5965 .type = HDA_FIXUP_FUNC,
5966 .v.func = alc269_fixup_limit_int_mic_boost,
2793769f
DH
5967 .chained = true,
5968 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
3e0d611b 5969 },
2cede303
OR
5970 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
5971 .type = HDA_FIXUP_FUNC,
5972 .v.func = alc269_fixup_limit_int_mic_boost,
5973 .chained = true,
5974 .chain_id = ALC269VB_FIXUP_DMIC,
5975 },
23870831
TI
5976 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
5977 .type = HDA_FIXUP_VERBS,
5978 .v.verbs = (const struct hda_verb[]) {
5979 /* class-D output amp +5dB */
5980 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
5981 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
5982 {}
5983 },
5984 .chained = true,
5985 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
5986 },
8e35cd4a
DH
5987 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
5988 .type = HDA_FIXUP_FUNC,
5989 .v.func = alc269_fixup_limit_int_mic_boost,
5990 .chained = true,
5991 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
5992 },
02b504d9
AA
5993 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
5994 .type = HDA_FIXUP_PINS,
5995 .v.pins = (const struct hda_pintbl[]) {
5996 { 0x12, 0x99a3092f }, /* int-mic */
5997 { 0x18, 0x03a11d20 }, /* mic */
5998 { 0x19, 0x411111f0 }, /* Unused bogus pin */
5999 { }
6000 },
6001 },
cd217a63
KY
6002 [ALC283_FIXUP_CHROME_BOOK] = {
6003 .type = HDA_FIXUP_FUNC,
6004 .v.func = alc283_fixup_chromebook,
6005 },
0202e99c
KY
6006 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6007 .type = HDA_FIXUP_FUNC,
6008 .v.func = alc283_fixup_sense_combo_jack,
6009 .chained = true,
6010 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6011 },
7bba2157
TI
6012 [ALC282_FIXUP_ASUS_TX300] = {
6013 .type = HDA_FIXUP_FUNC,
6014 .v.func = alc282_fixup_asus_tx300,
6015 },
1bb3e062
KY
6016 [ALC283_FIXUP_INT_MIC] = {
6017 .type = HDA_FIXUP_VERBS,
6018 .v.verbs = (const struct hda_verb[]) {
6019 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6020 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6021 { }
6022 },
6023 .chained = true,
6024 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6025 },
0f4881dc
DH
6026 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6027 .type = HDA_FIXUP_PINS,
6028 .v.pins = (const struct hda_pintbl[]) {
6029 { 0x17, 0x90170112 }, /* subwoofer */
6030 { }
6031 },
6032 .chained = true,
6033 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6034 },
6035 [ALC290_FIXUP_SUBWOOFER] = {
6036 .type = HDA_FIXUP_PINS,
6037 .v.pins = (const struct hda_pintbl[]) {
6038 { 0x17, 0x90170112 }, /* subwoofer */
6039 { }
6040 },
6041 .chained = true,
6042 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6043 },
338cae56
DH
6044 [ALC290_FIXUP_MONO_SPEAKERS] = {
6045 .type = HDA_FIXUP_FUNC,
6046 .v.func = alc290_fixup_mono_speakers,
0f4881dc
DH
6047 },
6048 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6049 .type = HDA_FIXUP_FUNC,
6050 .v.func = alc290_fixup_mono_speakers,
338cae56
DH
6051 .chained = true,
6052 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6053 },
b67ae3f1
DH
6054 [ALC269_FIXUP_THINKPAD_ACPI] = {
6055 .type = HDA_FIXUP_FUNC,
2ae22638 6056 .v.func = alc_fixup_thinkpad_acpi,
09da111a
TI
6057 .chained = true,
6058 .chain_id = ALC269_FIXUP_SKU_IGNORE,
b67ae3f1 6059 },
56f27013
DH
6060 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6061 .type = HDA_FIXUP_FUNC,
6062 .v.func = alc_fixup_inv_dmic,
6063 .chained = true,
6064 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6065 },
5824ce8d
CC
6066 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
6067 .type = HDA_FIXUP_PINS,
6068 .v.pins = (const struct hda_pintbl[]) {
6069 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6070 { }
6071 },
6072 .chained = true,
6073 .chain_id = ALC255_FIXUP_HEADSET_MODE
6074 },
615966ad
CC
6075 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6076 .type = HDA_FIXUP_PINS,
6077 .v.pins = (const struct hda_pintbl[]) {
6078 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6079 { }
6080 },
6081 .chained = true,
6082 .chain_id = ALC255_FIXUP_HEADSET_MODE
6083 },
9a22a8f5
KY
6084 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6085 .type = HDA_FIXUP_PINS,
6086 .v.pins = (const struct hda_pintbl[]) {
6087 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6088 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6089 { }
6090 },
6091 .chained = true,
6092 .chain_id = ALC255_FIXUP_HEADSET_MODE
6093 },
31278997
KY
6094 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6095 .type = HDA_FIXUP_PINS,
6096 .v.pins = (const struct hda_pintbl[]) {
6097 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6098 { }
6099 },
6100 .chained = true,
6101 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6102 },
9a22a8f5
KY
6103 [ALC255_FIXUP_HEADSET_MODE] = {
6104 .type = HDA_FIXUP_FUNC,
6105 .v.func = alc_fixup_headset_mode_alc255,
4a83d42a
HW
6106 .chained = true,
6107 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
9a22a8f5 6108 },
31278997
KY
6109 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6110 .type = HDA_FIXUP_FUNC,
6111 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6112 },
a22aa26f
KY
6113 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6114 .type = HDA_FIXUP_PINS,
6115 .v.pins = (const struct hda_pintbl[]) {
6116 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6117 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6118 { }
6119 },
6120 .chained = true,
6121 .chain_id = ALC269_FIXUP_HEADSET_MODE
6122 },
1c37c223 6123 [ALC292_FIXUP_TPT440_DOCK] = {
ec56af67 6124 .type = HDA_FIXUP_FUNC,
7f57d803 6125 .v.func = alc_fixup_tpt440_dock,
1c37c223
TI
6126 .chained = true,
6127 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6128 },
9a811230
TI
6129 [ALC292_FIXUP_TPT440] = {
6130 .type = HDA_FIXUP_FUNC,
157f0b7f 6131 .v.func = alc_fixup_disable_aamix,
9a811230
TI
6132 .chained = true,
6133 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6134 },
abaa2274 6135 [ALC283_FIXUP_HEADSET_MIC] = {
9dc12862
DD
6136 .type = HDA_FIXUP_PINS,
6137 .v.pins = (const struct hda_pintbl[]) {
6138 { 0x19, 0x04a110f0 },
6139 { },
6140 },
6141 },
00ef9940
HW
6142 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
6143 .type = HDA_FIXUP_FUNC,
6144 .v.func = alc_fixup_dell_wmi,
00ef9940 6145 },
1a22e775
TI
6146 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6147 .type = HDA_FIXUP_PINS,
6148 .v.pins = (const struct hda_pintbl[]) {
6149 { 0x12, 0x90a60130 },
6150 { 0x14, 0x90170110 },
6151 { 0x17, 0x40000008 },
6152 { 0x18, 0x411111f0 },
0420694d 6153 { 0x19, 0x01a1913c },
1a22e775
TI
6154 { 0x1a, 0x411111f0 },
6155 { 0x1b, 0x411111f0 },
6156 { 0x1d, 0x40f89b2d },
6157 { 0x1e, 0x411111f0 },
6158 { 0x21, 0x0321101f },
6159 { },
6160 },
6161 },
7a5255f1
DH
6162 [ALC280_FIXUP_HP_GPIO4] = {
6163 .type = HDA_FIXUP_FUNC,
6164 .v.func = alc280_fixup_hp_gpio4,
6165 },
eaa8e5ef
KY
6166 [ALC286_FIXUP_HP_GPIO_LED] = {
6167 .type = HDA_FIXUP_FUNC,
6168 .v.func = alc286_fixup_hp_gpio_led,
6169 },
33f4acd3
DH
6170 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6171 .type = HDA_FIXUP_FUNC,
6172 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6173 },
b4b33f9d
TC
6174 [ALC280_FIXUP_HP_DOCK_PINS] = {
6175 .type = HDA_FIXUP_PINS,
6176 .v.pins = (const struct hda_pintbl[]) {
6177 { 0x1b, 0x21011020 }, /* line-out */
6178 { 0x1a, 0x01a1903c }, /* headset mic */
6179 { 0x18, 0x2181103f }, /* line-in */
6180 { },
6181 },
6182 .chained = true,
6183 .chain_id = ALC280_FIXUP_HP_GPIO4
6184 },
04d5466a
JK
6185 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6186 .type = HDA_FIXUP_PINS,
6187 .v.pins = (const struct hda_pintbl[]) {
6188 { 0x1b, 0x21011020 }, /* line-out */
6189 { 0x18, 0x2181103f }, /* line-in */
6190 { },
6191 },
6192 .chained = true,
6193 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6194 },
98973f2f
KP
6195 [ALC280_FIXUP_HP_9480M] = {
6196 .type = HDA_FIXUP_FUNC,
6197 .v.func = alc280_fixup_hp_9480m,
6198 },
e1e62b98
KY
6199 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6200 .type = HDA_FIXUP_FUNC,
6201 .v.func = alc_fixup_headset_mode_dell_alc288,
6202 .chained = true,
6203 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6204 },
6205 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6206 .type = HDA_FIXUP_PINS,
6207 .v.pins = (const struct hda_pintbl[]) {
6208 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6209 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6210 { }
6211 },
6212 .chained = true,
6213 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6214 },
6215 [ALC288_FIXUP_DELL_XPS_13_GPIO6] = {
6216 .type = HDA_FIXUP_VERBS,
6217 .v.verbs = (const struct hda_verb[]) {
6218 {0x01, AC_VERB_SET_GPIO_MASK, 0x40},
6219 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40},
6220 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6221 { }
6222 },
6223 .chained = true,
6224 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
6225 },
831bfdf9
HW
6226 [ALC288_FIXUP_DISABLE_AAMIX] = {
6227 .type = HDA_FIXUP_FUNC,
6228 .v.func = alc_fixup_disable_aamix,
6229 .chained = true,
6230 .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6
6231 },
6232 [ALC288_FIXUP_DELL_XPS_13] = {
6233 .type = HDA_FIXUP_FUNC,
6234 .v.func = alc_fixup_dell_xps13,
6235 .chained = true,
6236 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6237 },
8b99aba7
TI
6238 [ALC292_FIXUP_DISABLE_AAMIX] = {
6239 .type = HDA_FIXUP_FUNC,
6240 .v.func = alc_fixup_disable_aamix,
831bfdf9
HW
6241 .chained = true,
6242 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8b99aba7 6243 },
c04017ea
DH
6244 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6245 .type = HDA_FIXUP_FUNC,
6246 .v.func = alc_fixup_disable_aamix,
6247 .chained = true,
6248 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6249 },
8b99aba7
TI
6250 [ALC292_FIXUP_DELL_E7X] = {
6251 .type = HDA_FIXUP_FUNC,
6252 .v.func = alc_fixup_dell_xps13,
6253 .chained = true,
6254 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6255 },
977e6276
KY
6256 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6257 .type = HDA_FIXUP_PINS,
6258 .v.pins = (const struct hda_pintbl[]) {
6259 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6260 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6261 { }
6262 },
6263 .chained = true,
6264 .chain_id = ALC269_FIXUP_HEADSET_MODE
6265 },
2f726aec
HW
6266 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6267 .type = HDA_FIXUP_PINS,
6268 .v.pins = (const struct hda_pintbl[]) {
6269 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6270 { }
6271 },
6272 .chained = true,
6273 .chain_id = ALC269_FIXUP_HEADSET_MODE
6274 },
6ed1131f
KY
6275 [ALC275_FIXUP_DELL_XPS] = {
6276 .type = HDA_FIXUP_VERBS,
6277 .v.verbs = (const struct hda_verb[]) {
6278 /* Enables internal speaker */
6279 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6280 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6281 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6282 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6283 {}
6284 }
6285 },
8c69729b
HW
6286 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6287 .type = HDA_FIXUP_VERBS,
6288 .v.verbs = (const struct hda_verb[]) {
6289 /* Disable pass-through path for FRONT 14h */
6290 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6291 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6292 {}
6293 },
6294 .chained = true,
6295 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6296 },
23adc192
HW
6297 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6298 .type = HDA_FIXUP_FUNC,
6299 .v.func = alc_fixup_disable_aamix,
6300 .chained = true,
6301 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6302 },
3694cb29
K
6303 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6304 .type = HDA_FIXUP_FUNC,
6305 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6306 },
3b43b71f
KHF
6307 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6308 .type = HDA_FIXUP_FUNC,
6309 .v.func = alc_fixup_disable_aamix,
6310 .chained = true,
6311 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6312 },
f4ccb37c
KY
6313 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6314 .type = HDA_FIXUP_FUNC,
6315 .v.func = alc_fixup_disable_mic_vref,
6316 .chained = true,
6317 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6318 },
2ae95577
DH
6319 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6320 .type = HDA_FIXUP_VERBS,
6321 .v.verbs = (const struct hda_verb[]) {
6322 /* Disable pass-through path for FRONT 14h */
6323 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6324 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6325 {}
6326 },
6327 .chained = true,
f4ccb37c 6328 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
2ae95577 6329 },
f883982d
TI
6330 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6331 .type = HDA_FIXUP_FUNC,
6332 .v.func = alc_fixup_disable_aamix,
6333 .chained = true,
6334 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6335 },
e549d190
HW
6336 [ALC221_FIXUP_HP_FRONT_MIC] = {
6337 .type = HDA_FIXUP_PINS,
6338 .v.pins = (const struct hda_pintbl[]) {
6339 { 0x19, 0x02a19020 }, /* Front Mic */
6340 { }
6341 },
6342 },
c636b95e
SE
6343 [ALC292_FIXUP_TPT460] = {
6344 .type = HDA_FIXUP_FUNC,
6345 .v.func = alc_fixup_tpt440_dock,
6346 .chained = true,
6347 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6348 },
dd9aa335
HW
6349 [ALC298_FIXUP_SPK_VOLUME] = {
6350 .type = HDA_FIXUP_FUNC,
6351 .v.func = alc298_fixup_speaker_volume,
59ec4b57 6352 .chained = true,
2f726aec 6353 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
dd9aa335 6354 },
214839a8
TI
6355 [ALC295_FIXUP_DISABLE_DAC3] = {
6356 .type = HDA_FIXUP_FUNC,
6357 .v.func = alc295_fixup_disable_dac3,
6358 },
fd06c77e
KHF
6359 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6360 .type = HDA_FIXUP_PINS,
6361 .v.pins = (const struct hda_pintbl[]) {
6362 { 0x1b, 0x90170151 },
6363 { }
6364 },
6365 .chained = true,
6366 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6367 },
823ff161
GM
6368 [ALC269_FIXUP_ATIV_BOOK_8] = {
6369 .type = HDA_FIXUP_FUNC,
6370 .v.func = alc_fixup_auto_mute_via_amp,
6371 .chained = true,
6372 .chain_id = ALC269_FIXUP_NO_SHUTUP
6373 },
9eb5d0e6
KY
6374 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6375 .type = HDA_FIXUP_PINS,
6376 .v.pins = (const struct hda_pintbl[]) {
6377 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6378 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6379 { }
6380 },
6381 .chained = true,
6382 .chain_id = ALC269_FIXUP_HEADSET_MODE
6383 },
c1732ede
CC
6384 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6385 .type = HDA_FIXUP_FUNC,
6386 .v.func = alc_fixup_headset_mode,
6387 },
6388 [ALC256_FIXUP_ASUS_MIC] = {
6389 .type = HDA_FIXUP_PINS,
6390 .v.pins = (const struct hda_pintbl[]) {
6391 { 0x13, 0x90a60160 }, /* use as internal mic */
6392 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6393 { }
6394 },
6395 .chained = true,
6396 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6397 },
eeed4cd1
CC
6398 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
6399 .type = HDA_FIXUP_VERBS,
6400 .v.verbs = (const struct hda_verb[]) {
6401 /* Set up GPIO2 for the speaker amp */
6402 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
6403 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
6404 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
6405 {}
6406 },
6407 },
216d7aeb
CC
6408 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6409 .type = HDA_FIXUP_PINS,
6410 .v.pins = (const struct hda_pintbl[]) {
6411 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6412 { }
6413 },
6414 .chained = true,
6415 .chain_id = ALC269_FIXUP_HEADSET_MIC
6416 },
6417 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6418 .type = HDA_FIXUP_VERBS,
6419 .v.verbs = (const struct hda_verb[]) {
6420 /* Enables internal speaker */
6421 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6422 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6423 {}
6424 },
6425 .chained = true,
6426 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6427 },
ca169cc2
KY
6428 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6429 .type = HDA_FIXUP_FUNC,
6430 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6431 },
f33f79f3
HW
6432 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6433 .type = HDA_FIXUP_PINS,
6434 .v.pins = (const struct hda_pintbl[]) {
6435 /* Change the mic location from front to right, otherwise there are
6436 two front mics with the same name, pulseaudio can't handle them.
6437 This is just a temporary workaround, after applying this fixup,
6438 there will be one "Front Mic" and one "Mic" in this machine.
6439 */
6440 { 0x1a, 0x04a19040 },
6441 { }
6442 },
6443 },
9423a273
KY
6444 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6445 .type = HDA_FIXUP_PINS,
6446 .v.pins = (const struct hda_pintbl[]) {
6447 { 0x16, 0x0101102f }, /* Rear Headset HP */
6448 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6449 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6450 { 0x1b, 0x02011020 },
6451 { }
6452 },
6453 .chained = true,
6454 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6455 },
b84e8436
PH
6456 [ALC700_FIXUP_INTEL_REFERENCE] = {
6457 .type = HDA_FIXUP_VERBS,
6458 .v.verbs = (const struct hda_verb[]) {
6459 /* Enables internal speaker */
6460 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6461 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6462 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6463 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6464 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6465 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6466 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6467 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6468 {}
6469 }
6470 },
92266651
KY
6471 [ALC274_FIXUP_DELL_BIND_DACS] = {
6472 .type = HDA_FIXUP_FUNC,
6473 .v.func = alc274_fixup_bind_dacs,
6474 .chained = true,
6475 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6476 },
6477 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6478 .type = HDA_FIXUP_PINS,
6479 .v.pins = (const struct hda_pintbl[]) {
6480 { 0x1b, 0x0401102f },
6481 { }
6482 },
6483 .chained = true,
6484 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6485 },
114745cd
KY
6486 [ALC298_FIXUP_TPT470_DOCK] = {
6487 .type = HDA_FIXUP_FUNC,
6488 .v.func = alc_fixup_tpt470_dock,
6489 .chained = true,
6490 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6491 },
9cfdabca
KY
6492 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6493 .type = HDA_FIXUP_PINS,
6494 .v.pins = (const struct hda_pintbl[]) {
6495 { 0x14, 0x0201101f },
6496 { }
6497 },
6498 .chained = true,
6499 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6500 },
4c574ad4
KY
6501 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6502 .type = HDA_FIXUP_PINS,
6503 .v.pins = (const struct hda_pintbl[]) {
6504 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6505 { }
6506 },
431b427b
HW
6507 .chained = true,
6508 .chain_id = ALC269_FIXUP_HEADSET_MIC
4c574ad4 6509 },
32e2ee86
KY
6510 [ALC221_FIXUP_HP_HEADSET_MIC] = {
6511 .type = HDA_FIXUP_PINS,
6512 .v.pins = (const struct hda_pintbl[]) {
6513 { 0x19, 0x0181313f},
6514 { }
6515 },
6516 .chained = true,
6517 .chain_id = ALC269_FIXUP_HEADSET_MIC
6518 },
ea7118da
HW
6519 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
6520 .type = HDA_FIXUP_FUNC,
6521 .v.func = alc285_fixup_invalidate_dacs,
3b01ea18
HW
6522 .chained = true,
6523 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
ea7118da 6524 },
0a60c116
HW
6525 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
6526 .type = HDA_FIXUP_VERBS,
6527 .v.verbs = (const struct hda_verb[]) {
6528 /* Disable PCBEEP-IN passthrough */
6529 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6530 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6531 { }
6532 },
6533 .chained = true,
6534 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
6535 },
09416ef0
JS
6536 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
6537 .type = HDA_FIXUP_PINS,
6538 .v.pins = (const struct hda_pintbl[]) {
6539 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6540 { }
6541 },
6542 .chained = true,
6543 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6544 },
20616fb0
KY
6545 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
6546 .type = HDA_FIXUP_PINS,
6547 .v.pins = (const struct hda_pintbl[]) {
6548 { 0x16, 0x01011020 }, /* Rear Line out */
6549 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
6550 { }
6551 },
6552 .chained = true,
6553 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
6554 },
6555 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
6556 .type = HDA_FIXUP_FUNC,
6557 .v.func = alc_fixup_auto_mute_via_amp,
6558 .chained = true,
6559 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
6560 },
6561 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
6562 .type = HDA_FIXUP_FUNC,
6563 .v.func = alc_fixup_disable_mic_vref,
6564 .chained = true,
6565 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6566 },
f1d4e28b
KY
6567};
6568
1d045db9 6569static const struct snd_pci_quirk alc269_fixup_tbl[] = {
a6b92b66 6570 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
693b613d
DH
6571 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6572 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
aaedfb47 6573 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
7819717b
TI
6574 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6575 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
aaedfb47
DH
6576 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6577 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
02322ac9 6578 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
b1e8972e 6579 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
1a22e775 6580 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
b9c2fa52 6581 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
aaedfb47 6582 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6ed1131f 6583 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
86f799b8 6584 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
cf52103a 6585 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8b99aba7
TI
6586 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6587 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
0f4881dc 6588 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
73bdd597
DH
6589 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6590 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6591 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
0f4881dc
DH
6592 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6593 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
98070576 6594 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
4275554d 6595 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
0f4881dc 6596 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
a22aa26f
KY
6597 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6598 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
831bfdf9 6599 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
afecb146 6600 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
3a05d12f 6601 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8b72415d 6602 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
b734304f
KY
6603 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6604 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
c04017ea
DH
6605 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6606 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6607 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6608 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6609 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
423cd785 6610 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
fd06c77e 6611 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
3b43b71f 6612 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
b001f661 6613 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
423cd785 6614 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
dd9aa335 6615 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
214839a8 6616 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
493de342 6617 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9423a273 6618 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
e4c9fd10 6619 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
a98cf497
KY
6620 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6621 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
4c574ad4
KY
6622 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6623 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9cfdabca 6624 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
20616fb0 6625 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
1fddba4b 6626 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
1b48c755 6627 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
a22aa26f
KY
6628 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6629 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
08fb0d0e 6630 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9f5c6faf 6631 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8e35cd4a 6632 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
33f4acd3 6633 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
c60666bd 6634 /* ALC282 */
7976eb49 6635 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 6636 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 6637 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9c5dc3bf
KY
6638 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6639 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6640 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6641 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9c5dc3bf 6642 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
c60666bd 6643 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
6644 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6645 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164 6646 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
eaa8e5ef 6647 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
b4b33f9d 6648 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
3271cb22 6649 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
c60666bd 6650 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
6651 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6652 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6653 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 6654 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
98973f2f 6655 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9c5dc3bf
KY
6656 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6657 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 6658 /* ALC290 */
9c5dc3bf 6659 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 6660 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 6661 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf
KY
6662 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6663 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6664 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6665 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6666 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 6667 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
04d5466a 6668 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
c60666bd 6669 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
6670 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6671 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6672 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9c5dc3bf
KY
6673 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6674 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9c5dc3bf 6675 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
c60666bd 6676 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 6677 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 6678 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
6679 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6680 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd
KY
6681 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6682 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
c60666bd 6683 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8a02b164
KY
6684 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6685 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6686 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6687 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
f883982d 6688 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
e549d190 6689 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9eb5d0e6
KY
6690 SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6691 SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
c1732ede 6692 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
7bba2157 6693 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
3e0d611b 6694 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 6695 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
4eab0ea1 6696 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
3e0d611b 6697 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4eab0ea1
TI
6698 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6699 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6700 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
c1732ede
CC
6701 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6702 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6703 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
2cede303 6704 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
23870831 6705 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
3e0d611b 6706 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
017f2a10 6707 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
28e8af8a 6708 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
693b613d 6709 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
615966ad 6710 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
4eab0ea1 6711 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
c1732ede 6712 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
eeed4cd1 6713 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
adabb3ec
TI
6714 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6715 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6716 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6717 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
d240d1dc 6718 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
f88abaa0 6719 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
88cfcf86 6720 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
1d045db9
TI
6721 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6722 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6723 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
e9bd7d5c 6724 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
24519911 6725 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4df3fd17 6726 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
cc7016ab 6727 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
88776f36 6728 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
0dcd451c 6729 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
2041d564 6730 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
b84e8436 6731 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
f4900a15 6732 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
a33cc48d 6733 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
823ff161 6734 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
abaa2274
AA
6735 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6736 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
09416ef0 6737 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8ece3055 6738 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
6f616691
JS
6739 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
6740 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
6741 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
ca169cc2 6742 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
1d045db9
TI
6743 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6744 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6745 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6746 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6747 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
707fba3f 6748 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
c8415a48 6749 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
84f98fdf 6750 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
4407be6b 6751 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
108cc108 6752 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
aaedfb47 6753 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9a811230 6754 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
1c37c223 6755 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
a12137e7 6756 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
59a51a6b 6757 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
6d16941a 6758 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
7c21539c 6759 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
a4a9e082 6760 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
b6903c0e 6761 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
d05ea7da 6762 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
c0278669 6763 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
114745cd
KY
6764 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6765 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
dab38e43 6766 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
c636b95e 6767 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
114745cd
KY
6768 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
6769 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6770 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
3051e378 6771 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
114745cd
KY
6772 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6773 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6774 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8c85df50 6775 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
3694cb29 6776 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6ef2f68f 6777 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
f33f79f3 6778 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
b4ceb446 6779 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
74ef8b43 6780 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8da5bbfc 6781 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
56f27013 6782 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
fedb2245 6783 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
9b745ab8 6784 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
a4a9e082 6785 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
1bb3e062 6786 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
c497d9f9 6787 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
cd5302c0 6788 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
f2aa1110 6789 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
80b311d3 6790 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
09ea9976 6791 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
037e1197 6792 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
23adc192 6793 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
0f087ee3 6794 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9cd25743 6795 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
0f087ee3 6796 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
114745cd
KY
6797 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6798 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6799 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
cd5302c0 6800 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
114745cd
KY
6801 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6802 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
012e7eb1 6803 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
1d045db9 6804 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
02b504d9 6805 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
a4297b5d 6806
a7f3eedc 6807#if 0
a4297b5d
TI
6808 /* Below is a quirk table taken from the old code.
6809 * Basically the device should work as is without the fixup table.
6810 * If BIOS doesn't give a proper info, enable the corresponding
6811 * fixup entry.
7d7eb9ea 6812 */
a4297b5d
TI
6813 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6814 ALC269_FIXUP_AMIC),
6815 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
a4297b5d
TI
6816 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
6817 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
6818 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
6819 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
6820 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
6821 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
6822 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
6823 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
6824 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
6825 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
6826 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
6827 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
6828 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
6829 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
6830 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
6831 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
6832 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
6833 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
6834 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
6835 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
6836 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
6837 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
6838 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
6839 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
6840 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
6841 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
6842 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
6843 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
6844 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
6845 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
6846 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
6847 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
6848 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
6849 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
6850 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
6851 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
6852 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
6853 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
6854#endif
6855 {}
6856};
6857
214eef76
DH
6858static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
6859 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6860 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
6861 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6862 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
6863 {}
6864};
6865
1727a771 6866static const struct hda_model_fixup alc269_fixup_models[] = {
a4297b5d
TI
6867 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
6868 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
6e72aa5f
TI
6869 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
6870 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
6871 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
7c478f03 6872 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
b016951e
TI
6873 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
6874 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
108cc108 6875 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
9f5c6faf 6876 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
04d5466a 6877 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
e32aa85a
DH
6878 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6879 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
be8ef16a 6880 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
0202e99c 6881 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
1c37c223 6882 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9a811230 6883 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
c636b95e 6884 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
ba90d6a6 6885 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
28d1d6d2 6886 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
1d045db9 6887 {}
6dda9f4a 6888};
cfc5a845 6889#define ALC225_STANDARD_PINS \
cfc5a845 6890 {0x21, 0x04211020}
6dda9f4a 6891
e8191a8e
HW
6892#define ALC256_STANDARD_PINS \
6893 {0x12, 0x90a60140}, \
6894 {0x14, 0x90170110}, \
e8191a8e
HW
6895 {0x21, 0x02211020}
6896
fea185e2 6897#define ALC282_STANDARD_PINS \
11580297 6898 {0x14, 0x90170110}
e1e62b98 6899
fea185e2 6900#define ALC290_STANDARD_PINS \
11580297 6901 {0x12, 0x99a30130}
fea185e2
DH
6902
6903#define ALC292_STANDARD_PINS \
6904 {0x14, 0x90170110}, \
11580297 6905 {0x15, 0x0221401f}
977e6276 6906
3f640970
HW
6907#define ALC295_STANDARD_PINS \
6908 {0x12, 0xb7a60130}, \
6909 {0x14, 0x90170110}, \
3f640970
HW
6910 {0x21, 0x04211020}
6911
703867e2
WS
6912#define ALC298_STANDARD_PINS \
6913 {0x12, 0x90a60130}, \
6914 {0x21, 0x03211020}
6915
e1918938 6916static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
32e2ee86
KY
6917 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
6918 {0x14, 0x01014020},
6919 {0x17, 0x90170110},
6920 {0x18, 0x02a11030},
6921 {0x19, 0x0181303F},
6922 {0x21, 0x0221102f}),
5824ce8d
CC
6923 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6924 {0x12, 0x90a601c0},
6925 {0x14, 0x90171120},
6926 {0x21, 0x02211030}),
615966ad
CC
6927 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6928 {0x14, 0x90170110},
6929 {0x1b, 0x90a70130},
6930 {0x21, 0x03211020}),
6931 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6932 {0x1a, 0x90a70130},
6933 {0x1b, 0x90170110},
6934 {0x21, 0x03211020}),
2ae95577 6935 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 6936 ALC225_STANDARD_PINS,
8a132099 6937 {0x12, 0xb7a60130},
cfc5a845 6938 {0x14, 0x901701a0}),
2ae95577 6939 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
cfc5a845 6940 ALC225_STANDARD_PINS,
8a132099 6941 {0x12, 0xb7a60130},
cfc5a845 6942 {0x14, 0x901701b0}),
8a132099
HW
6943 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6944 ALC225_STANDARD_PINS,
6945 {0x12, 0xb7a60150},
6946 {0x14, 0x901701a0}),
6947 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6948 ALC225_STANDARD_PINS,
6949 {0x12, 0xb7a60150},
6950 {0x14, 0x901701b0}),
6951 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6952 ALC225_STANDARD_PINS,
6953 {0x12, 0xb7a60130},
6954 {0x1b, 0x90170110}),
0ce48e17
KHF
6955 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6956 {0x1b, 0x01111010},
6957 {0x1e, 0x01451130},
6958 {0x21, 0x02211020}),
56d3b887
HW
6959 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6960 {0x12, 0x90a60140},
6961 {0x14, 0x90170110},
6962 {0x19, 0x02a11030},
6963 {0x21, 0x02211020}),
74ef8b43
HW
6964 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
6965 {0x14, 0x90170110},
6966 {0x19, 0x02a11030},
6967 {0x1a, 0x02a11040},
6968 {0x1b, 0x01014020},
6969 {0x21, 0x0221101f}),
66a0e1cc
HW
6970 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
6971 {0x14, 0x90170110},
6972 {0x19, 0x02a11030},
6973 {0x1a, 0x02a11040},
6974 {0x1b, 0x01011020},
6975 {0x21, 0x0221101f}),
3374ea95
HW
6976 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
6977 {0x14, 0x90170110},
6978 {0x19, 0x02a11020},
6979 {0x1a, 0x02a11030},
6980 {0x21, 0x0221101f}),
f265788c
HW
6981 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6982 {0x12, 0x90a60140},
6983 {0x14, 0x90170110},
6984 {0x21, 0x02211020}),
19412c71
TI
6985 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6986 {0x12, 0x90a60140},
6987 {0x14, 0x90170110},
6988 {0x19, 0x02a11030},
6989 {0x21, 0x02211020}),
f265788c
HW
6990 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6991 {0x12, 0x90a60140},
6992 {0x14, 0x90170150},
6993 {0x21, 0x02211020}),
be620cc7
HW
6994 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6995 {0x21, 0x02211020}),
c77900e6 6996 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
c77900e6 6997 {0x14, 0x90170110},
c77900e6 6998 {0x21, 0x02211020}),
86c72d1c
HW
6999 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7000 {0x14, 0x90170130},
7001 {0x21, 0x02211040}),
76c2132e
DH
7002 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7003 {0x12, 0x90a60140},
7004 {0x14, 0x90170110},
76c2132e
DH
7005 {0x21, 0x02211020}),
7006 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7007 {0x12, 0x90a60160},
7008 {0x14, 0x90170120},
76c2132e 7009 {0x21, 0x02211030}),
392c9da2
HW
7010 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7011 {0x14, 0x90170110},
7012 {0x1b, 0x02011020},
7013 {0x21, 0x0221101f}),
6aecd871
HW
7014 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7015 {0x14, 0x90170110},
7016 {0x1b, 0x01011020},
7017 {0x21, 0x0221101f}),
cba59972 7018 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
cba59972 7019 {0x14, 0x90170130},
cba59972 7020 {0x1b, 0x01014020},
cba59972 7021 {0x21, 0x0221103f}),
6aecd871
HW
7022 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7023 {0x14, 0x90170130},
7024 {0x1b, 0x01011020},
7025 {0x21, 0x0221103f}),
59ec4b57
HW
7026 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7027 {0x14, 0x90170130},
7028 {0x1b, 0x02011020},
7029 {0x21, 0x0221103f}),
e9c28e16 7030 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 7031 {0x14, 0x90170150},
e9c28e16 7032 {0x1b, 0x02011020},
e9c28e16
WS
7033 {0x21, 0x0221105f}),
7034 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
e9c28e16 7035 {0x14, 0x90170110},
e9c28e16 7036 {0x1b, 0x01014020},
e9c28e16 7037 {0x21, 0x0221101f}),
76c2132e
DH
7038 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7039 {0x12, 0x90a60160},
7040 {0x14, 0x90170120},
7041 {0x17, 0x90170140},
76c2132e
DH
7042 {0x21, 0x0321102f}),
7043 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7044 {0x12, 0x90a60160},
7045 {0x14, 0x90170130},
76c2132e
DH
7046 {0x21, 0x02211040}),
7047 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7048 {0x12, 0x90a60160},
7049 {0x14, 0x90170140},
76c2132e
DH
7050 {0x21, 0x02211050}),
7051 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7052 {0x12, 0x90a60170},
7053 {0x14, 0x90170120},
76c2132e
DH
7054 {0x21, 0x02211030}),
7055 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7056 {0x12, 0x90a60170},
7057 {0x14, 0x90170130},
76c2132e 7058 {0x21, 0x02211040}),
0a1f90a9
HW
7059 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7060 {0x12, 0x90a60170},
7061 {0x14, 0x90171130},
7062 {0x21, 0x02211040}),
70658b99 7063 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
70658b99
HW
7064 {0x12, 0x90a60170},
7065 {0x14, 0x90170140},
70658b99 7066 {0x21, 0x02211050}),
9b5a4e39 7067 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9b5a4e39
DH
7068 {0x12, 0x90a60180},
7069 {0x14, 0x90170130},
9b5a4e39 7070 {0x21, 0x02211040}),
f90d83b3
AK
7071 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7072 {0x12, 0x90a60180},
7073 {0x14, 0x90170120},
7074 {0x21, 0x02211030}),
989dbe4a
HW
7075 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7076 {0x1b, 0x01011020},
7077 {0x21, 0x02211010}),
285d5ddc
HW
7078 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7079 {0x12, 0x90a60130},
7080 {0x14, 0x90170110},
7081 {0x1b, 0x01011020},
7082 {0x21, 0x0221101f}),
81a1231b 7083 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
81a1231b
KY
7084 {0x12, 0x90a60160},
7085 {0x14, 0x90170120},
81a1231b 7086 {0x21, 0x02211030}),
f83c3292
WS
7087 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7088 {0x12, 0x90a60170},
7089 {0x14, 0x90170120},
7090 {0x21, 0x02211030}),
311042d1
SB
7091 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7092 {0x12, 0x90a60180},
7093 {0x14, 0x90170120},
7094 {0x21, 0x02211030}),
3f640970
HW
7095 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7096 {0x12, 0xb7a60130},
7097 {0x14, 0x90170110},
7098 {0x21, 0x02211020}),
b4fd4012
HW
7099 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7100 {0x12, 0x90a60130},
7101 {0x14, 0x90170110},
7102 {0x14, 0x01011020},
7103 {0x21, 0x0221101f}),
7081adf3 7104 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
11580297 7105 ALC256_STANDARD_PINS),
be620cc7
HW
7106 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7107 {0x14, 0x90170110},
7108 {0x1b, 0x01011020},
7109 {0x21, 0x0221101f}),
c1732ede
CC
7110 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7111 {0x14, 0x90170110},
7112 {0x1b, 0x90a70130},
7113 {0x21, 0x04211020}),
7114 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7115 {0x14, 0x90170110},
7116 {0x1b, 0x90a70130},
7117 {0x21, 0x03211020}),
92266651 7118 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
75ee94b2
HW
7119 {0x12, 0xb7a60130},
7120 {0x13, 0xb8a61140},
7121 {0x16, 0x90170110},
7122 {0x21, 0x04211020}),
cf51eb9d
DH
7123 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
7124 {0x12, 0x90a60130},
cf51eb9d
DH
7125 {0x14, 0x90170110},
7126 {0x15, 0x0421101f},
11580297 7127 {0x1a, 0x04a11020}),
0279661b
HW
7128 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
7129 {0x12, 0x90a60140},
0279661b
HW
7130 {0x14, 0x90170110},
7131 {0x15, 0x0421101f},
0279661b 7132 {0x18, 0x02811030},
0279661b 7133 {0x1a, 0x04a1103f},
11580297 7134 {0x1b, 0x02011020}),
42304474 7135 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7136 ALC282_STANDARD_PINS,
42304474 7137 {0x12, 0x99a30130},
42304474 7138 {0x19, 0x03a11020},
42304474 7139 {0x21, 0x0321101f}),
2c609999 7140 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7141 ALC282_STANDARD_PINS,
2c609999 7142 {0x12, 0x99a30130},
2c609999 7143 {0x19, 0x03a11020},
2c609999
HW
7144 {0x21, 0x03211040}),
7145 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7146 ALC282_STANDARD_PINS,
2c609999 7147 {0x12, 0x99a30130},
2c609999 7148 {0x19, 0x03a11030},
2c609999
HW
7149 {0x21, 0x03211020}),
7150 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7151 ALC282_STANDARD_PINS,
2c609999 7152 {0x12, 0x99a30130},
2c609999 7153 {0x19, 0x04a11020},
2c609999 7154 {0x21, 0x0421101f}),
200afc09 7155 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
aec856d0 7156 ALC282_STANDARD_PINS,
200afc09 7157 {0x12, 0x90a60140},
200afc09 7158 {0x19, 0x04a11030},
200afc09 7159 {0x21, 0x04211020}),
76c2132e 7160 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 7161 ALC282_STANDARD_PINS,
76c2132e 7162 {0x12, 0x90a60130},
76c2132e
DH
7163 {0x21, 0x0321101f}),
7164 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7165 {0x12, 0x90a60160},
7166 {0x14, 0x90170120},
76c2132e 7167 {0x21, 0x02211030}),
bc262179 7168 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 7169 ALC282_STANDARD_PINS,
bc262179 7170 {0x12, 0x90a60130},
bc262179 7171 {0x19, 0x03a11020},
bc262179 7172 {0x21, 0x0321101f}),
0a60c116 7173 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
ea7118da
HW
7174 {0x12, 0x90a60130},
7175 {0x14, 0x90170110},
7176 {0x19, 0x04a11040},
7177 {0x21, 0x04211020}),
e1e62b98 7178 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6,
e1e62b98 7179 {0x12, 0x90a60120},
e1e62b98 7180 {0x14, 0x90170110},
e1e62b98 7181 {0x21, 0x0321101f}),
1c303728 7182 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
b4fd4012
HW
7183 {0x12, 0xb7a60130},
7184 {0x14, 0x90170110},
7185 {0x21, 0x04211020}),
e4442bcf 7186 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7187 ALC290_STANDARD_PINS,
e4442bcf 7188 {0x15, 0x04211040},
e4442bcf 7189 {0x18, 0x90170112},
11580297 7190 {0x1a, 0x04a11020}),
e4442bcf 7191 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7192 ALC290_STANDARD_PINS,
e4442bcf 7193 {0x15, 0x04211040},
e4442bcf 7194 {0x18, 0x90170110},
11580297 7195 {0x1a, 0x04a11020}),
e4442bcf 7196 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7197 ALC290_STANDARD_PINS,
e4442bcf 7198 {0x15, 0x0421101f},
11580297 7199 {0x1a, 0x04a11020}),
e4442bcf 7200 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7201 ALC290_STANDARD_PINS,
e4442bcf 7202 {0x15, 0x04211020},
11580297 7203 {0x1a, 0x04a11040}),
e4442bcf 7204 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7205 ALC290_STANDARD_PINS,
e4442bcf
HW
7206 {0x14, 0x90170110},
7207 {0x15, 0x04211020},
11580297 7208 {0x1a, 0x04a11040}),
e4442bcf 7209 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7210 ALC290_STANDARD_PINS,
e4442bcf
HW
7211 {0x14, 0x90170110},
7212 {0x15, 0x04211020},
11580297 7213 {0x1a, 0x04a11020}),
e4442bcf 7214 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
aec856d0 7215 ALC290_STANDARD_PINS,
e4442bcf
HW
7216 {0x14, 0x90170110},
7217 {0x15, 0x0421101f},
11580297 7218 {0x1a, 0x04a11020}),
e8818fa8 7219 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 7220 ALC292_STANDARD_PINS,
e8818fa8 7221 {0x12, 0x90a60140},
e8818fa8 7222 {0x16, 0x01014020},
11580297 7223 {0x19, 0x01a19030}),
e8818fa8 7224 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
aec856d0 7225 ALC292_STANDARD_PINS,
e8818fa8 7226 {0x12, 0x90a60140},
e8818fa8
HW
7227 {0x16, 0x01014020},
7228 {0x18, 0x02a19031},
11580297 7229 {0x19, 0x01a1903e}),
76c2132e 7230 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
aec856d0 7231 ALC292_STANDARD_PINS,
11580297 7232 {0x12, 0x90a60140}),
76c2132e 7233 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 7234 ALC292_STANDARD_PINS,
76c2132e 7235 {0x13, 0x90a60140},
76c2132e 7236 {0x16, 0x21014020},
11580297 7237 {0x19, 0x21a19030}),
e03fdbde 7238 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
aec856d0 7239 ALC292_STANDARD_PINS,
11580297 7240 {0x13, 0x90a60140}),
3f640970 7241 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
f771d5bb
HW
7242 ALC295_STANDARD_PINS,
7243 {0x17, 0x21014020},
7244 {0x18, 0x21a19030}),
7245 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7246 ALC295_STANDARD_PINS,
7247 {0x17, 0x21014040},
7248 {0x18, 0x21a19050}),
3f307834
HW
7249 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7250 ALC295_STANDARD_PINS),
9f502ff5
TI
7251 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7252 ALC298_STANDARD_PINS,
7253 {0x17, 0x90170110}),
977e6276 7254 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
703867e2
WS
7255 ALC298_STANDARD_PINS,
7256 {0x17, 0x90170140}),
7257 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7258 ALC298_STANDARD_PINS,
9f502ff5 7259 {0x17, 0x90170150}),
9f1bc2c4
KHF
7260 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7261 {0x12, 0xb7a60140},
7262 {0x13, 0xb7a60150},
7263 {0x17, 0x90170110},
7264 {0x1a, 0x03011020},
7265 {0x21, 0x03211030}),
fcc6c877
KY
7266 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7267 ALC225_STANDARD_PINS,
7268 {0x12, 0xb7a60130},
fcc6c877 7269 {0x17, 0x90170110}),
e1918938
HW
7270 {}
7271};
6dda9f4a 7272
546bb678 7273static void alc269_fill_coef(struct hda_codec *codec)
1d045db9 7274{
526af6eb 7275 struct alc_spec *spec = codec->spec;
1d045db9 7276 int val;
ebb83eeb 7277
526af6eb 7278 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
546bb678 7279 return;
526af6eb 7280
1bb7e43e 7281 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
1d045db9
TI
7282 alc_write_coef_idx(codec, 0xf, 0x960b);
7283 alc_write_coef_idx(codec, 0xe, 0x8817);
7284 }
ebb83eeb 7285
1bb7e43e 7286 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
1d045db9
TI
7287 alc_write_coef_idx(codec, 0xf, 0x960b);
7288 alc_write_coef_idx(codec, 0xe, 0x8814);
7289 }
ebb83eeb 7290
1bb7e43e 7291 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
1d045db9 7292 /* Power up output pin */
98b24883 7293 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
1d045db9 7294 }
ebb83eeb 7295
1bb7e43e 7296 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
1d045db9 7297 val = alc_read_coef_idx(codec, 0xd);
f3ee07d8 7298 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
1d045db9
TI
7299 /* Capless ramp up clock control */
7300 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7301 }
7302 val = alc_read_coef_idx(codec, 0x17);
f3ee07d8 7303 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
1d045db9
TI
7304 /* Class D power on reset */
7305 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7306 }
7307 }
ebb83eeb 7308
98b24883
TI
7309 /* HP */
7310 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
1d045db9 7311}
a7f2371f 7312
1d045db9
TI
7313/*
7314 */
1d045db9
TI
7315static int patch_alc269(struct hda_codec *codec)
7316{
7317 struct alc_spec *spec;
3de95173 7318 int err;
f1d4e28b 7319
3de95173 7320 err = alc_alloc_spec(codec, 0x0b);
e16fb6d1 7321 if (err < 0)
3de95173
TI
7322 return err;
7323
7324 spec = codec->spec;
08c189f2 7325 spec->gen.shared_mic_vref_pin = 0x18;
8b99aba7 7326 codec->power_save_node = 1;
e16fb6d1 7327
225068ab
TI
7328#ifdef CONFIG_PM
7329 codec->patch_ops.suspend = alc269_suspend;
7330 codec->patch_ops.resume = alc269_resume;
7331#endif
c2d6af53
KY
7332 spec->shutup = alc_default_shutup;
7333 spec->init_hook = alc_default_init;
225068ab 7334
1727a771 7335 snd_hda_pick_fixup(codec, alc269_fixup_models,
9f720bb9 7336 alc269_fixup_tbl, alc269_fixups);
e1918938 7337 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
214eef76
DH
7338 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7339 alc269_fixups);
1727a771 7340 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9f720bb9
HRK
7341
7342 alc_auto_parse_customize_define(codec);
7343
7504b6cd
TI
7344 if (has_cdefine_beep(codec))
7345 spec->gen.beep_nid = 0x01;
7346
7639a06c 7347 switch (codec->core.vendor_id) {
065380f0 7348 case 0x10ec0269:
1d045db9 7349 spec->codec_variant = ALC269_TYPE_ALC269VA;
1bb7e43e
TI
7350 switch (alc_get_coef0(codec) & 0x00f0) {
7351 case 0x0010:
5100cd07
TI
7352 if (codec->bus->pci &&
7353 codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 7354 spec->cdefine.platform_type == 1)
20ca0c35 7355 err = alc_codec_rename(codec, "ALC271X");
1d045db9 7356 spec->codec_variant = ALC269_TYPE_ALC269VB;
1bb7e43e
TI
7357 break;
7358 case 0x0020:
5100cd07
TI
7359 if (codec->bus->pci &&
7360 codec->bus->pci->subsystem_vendor == 0x17aa &&
e16fb6d1 7361 codec->bus->pci->subsystem_device == 0x21f3)
20ca0c35 7362 err = alc_codec_rename(codec, "ALC3202");
1d045db9 7363 spec->codec_variant = ALC269_TYPE_ALC269VC;
1bb7e43e 7364 break;
adcc70b2
KY
7365 case 0x0030:
7366 spec->codec_variant = ALC269_TYPE_ALC269VD;
7367 break;
1bb7e43e 7368 default:
1d045db9 7369 alc_fix_pll_init(codec, 0x20, 0x04, 15);
1bb7e43e 7370 }
e16fb6d1
TI
7371 if (err < 0)
7372 goto error;
c2d6af53 7373 spec->shutup = alc269_shutup;
546bb678 7374 spec->init_hook = alc269_fill_coef;
1d045db9 7375 alc269_fill_coef(codec);
065380f0
KY
7376 break;
7377
7378 case 0x10ec0280:
7379 case 0x10ec0290:
7380 spec->codec_variant = ALC269_TYPE_ALC280;
7381 break;
7382 case 0x10ec0282:
065380f0 7383 spec->codec_variant = ALC269_TYPE_ALC282;
7b5c7a02
KY
7384 spec->shutup = alc282_shutup;
7385 spec->init_hook = alc282_init;
065380f0 7386 break;
2af02be7
KY
7387 case 0x10ec0233:
7388 case 0x10ec0283:
7389 spec->codec_variant = ALC269_TYPE_ALC283;
7390 spec->shutup = alc283_shutup;
7391 spec->init_hook = alc283_init;
7392 break;
065380f0
KY
7393 case 0x10ec0284:
7394 case 0x10ec0292:
7395 spec->codec_variant = ALC269_TYPE_ALC284;
7396 break;
161ebf29 7397 case 0x10ec0293:
4731d5de 7398 spec->codec_variant = ALC269_TYPE_ALC293;
161ebf29 7399 break;
7fc7d047 7400 case 0x10ec0286:
7c665932 7401 case 0x10ec0288:
7fc7d047
KY
7402 spec->codec_variant = ALC269_TYPE_ALC286;
7403 break;
506b62c3
KY
7404 case 0x10ec0298:
7405 spec->codec_variant = ALC269_TYPE_ALC298;
7406 break;
583142ca 7407 case 0x10ec0235:
1d04c9de
KY
7408 case 0x10ec0255:
7409 spec->codec_variant = ALC269_TYPE_ALC255;
016c6fdd
KY
7410 spec->shutup = alc256_shutup;
7411 spec->init_hook = alc256_init;
1d04c9de 7412 break;
736f20a7 7413 case 0x10ec0236:
4344aec8
KY
7414 case 0x10ec0256:
7415 spec->codec_variant = ALC269_TYPE_ALC256;
4a219ef8
KY
7416 spec->shutup = alc256_shutup;
7417 spec->init_hook = alc256_init;
7d1b6e29 7418 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
d32b6666 7419 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
4344aec8 7420 break;
f429e7e4
KY
7421 case 0x10ec0257:
7422 spec->codec_variant = ALC269_TYPE_ALC257;
fc434f5a
KY
7423 spec->shutup = alc256_shutup;
7424 spec->init_hook = alc256_init;
f429e7e4
KY
7425 spec->gen.mixer_nid = 0;
7426 break;
0a6f0600
KY
7427 case 0x10ec0215:
7428 case 0x10ec0285:
7429 case 0x10ec0289:
7430 spec->codec_variant = ALC269_TYPE_ALC215;
7431 spec->gen.mixer_nid = 0;
7432 break;
4231430d 7433 case 0x10ec0225:
7d727869 7434 case 0x10ec0295:
fa16b69f 7435 spec->codec_variant = ALC269_TYPE_ALC225;
e674ac9a 7436 spec->gen.mixer_nid = 0; /* no loopback on ALC225 ALC295 */
fa16b69f 7437 break;
28f1f9b2 7438 case 0x10ec0299:
4231430d 7439 spec->codec_variant = ALC269_TYPE_ALC225;
0b4d8f55
KY
7440 spec->shutup = alc225_shutup;
7441 spec->init_hook = alc225_init;
7442 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
4231430d 7443 break;
dcd4f0db
KY
7444 case 0x10ec0234:
7445 case 0x10ec0274:
7446 case 0x10ec0294:
7447 spec->codec_variant = ALC269_TYPE_ALC294;
532a7784 7448 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
71683c32 7449 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
6e25f0c7 7450 spec->init_hook = alc294_init;
dcd4f0db 7451 break;
6fbae35a
KY
7452 case 0x10ec0700:
7453 case 0x10ec0701:
7454 case 0x10ec0703:
7455 spec->codec_variant = ALC269_TYPE_ALC700;
7456 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
2d7fe618 7457 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
6e25f0c7 7458 spec->init_hook = alc294_init;
6fbae35a
KY
7459 break;
7460
1d045db9 7461 }
6dda9f4a 7462
ad60d502 7463 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
97a26570 7464 spec->has_alc5505_dsp = 1;
ad60d502
KY
7465 spec->init_hook = alc5505_dsp_init;
7466 }
7467
a4297b5d
TI
7468 /* automatic parse from the BIOS config */
7469 err = alc269_parse_auto_config(codec);
e16fb6d1
TI
7470 if (err < 0)
7471 goto error;
6dda9f4a 7472
7d1b6e29
DH
7473 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
7474 set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
f1d4e28b 7475
1727a771 7476 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 7477
1d045db9 7478 return 0;
e16fb6d1
TI
7479
7480 error:
7481 alc_free(codec);
7482 return err;
1d045db9 7483}
f1d4e28b 7484
1d045db9
TI
7485/*
7486 * ALC861
7487 */
622e84cd 7488
1d045db9 7489static int alc861_parse_auto_config(struct hda_codec *codec)
6dda9f4a 7490{
1d045db9 7491 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
3e6179b8
TI
7492 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7493 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
604401a9
TI
7494}
7495
1d045db9
TI
7496/* Pin config fixes */
7497enum {
e652f4c8
TI
7498 ALC861_FIXUP_FSC_AMILO_PI1505,
7499 ALC861_FIXUP_AMP_VREF_0F,
7500 ALC861_FIXUP_NO_JACK_DETECT,
7501 ALC861_FIXUP_ASUS_A6RP,
6ddf0fd1 7502 ALC660_FIXUP_ASUS_W7J,
1d045db9 7503};
7085ec12 7504
31150f23
TI
7505/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7506static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
1727a771 7507 const struct hda_fixup *fix, int action)
31150f23
TI
7508{
7509 struct alc_spec *spec = codec->spec;
7510 unsigned int val;
7511
1727a771 7512 if (action != HDA_FIXUP_ACT_INIT)
31150f23 7513 return;
d3f02d60 7514 val = snd_hda_codec_get_pin_target(codec, 0x0f);
31150f23
TI
7515 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7516 val |= AC_PINCTL_IN_EN;
7517 val |= AC_PINCTL_VREF_50;
cdd03ced 7518 snd_hda_set_pin_ctl(codec, 0x0f, val);
08c189f2 7519 spec->gen.keep_vref_in_automute = 1;
31150f23
TI
7520}
7521
e652f4c8
TI
7522/* suppress the jack-detection */
7523static void alc_fixup_no_jack_detect(struct hda_codec *codec,
1727a771 7524 const struct hda_fixup *fix, int action)
e652f4c8 7525{
1727a771 7526 if (action == HDA_FIXUP_ACT_PRE_PROBE)
e652f4c8 7527 codec->no_jack_detect = 1;
7d7eb9ea 7528}
e652f4c8 7529
1727a771 7530static const struct hda_fixup alc861_fixups[] = {
e652f4c8 7531 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
1727a771
TI
7532 .type = HDA_FIXUP_PINS,
7533 .v.pins = (const struct hda_pintbl[]) {
1d045db9
TI
7534 { 0x0b, 0x0221101f }, /* HP */
7535 { 0x0f, 0x90170310 }, /* speaker */
7536 { }
7537 }
7538 },
e652f4c8 7539 [ALC861_FIXUP_AMP_VREF_0F] = {
1727a771 7540 .type = HDA_FIXUP_FUNC,
31150f23 7541 .v.func = alc861_fixup_asus_amp_vref_0f,
3b25eb69 7542 },
e652f4c8 7543 [ALC861_FIXUP_NO_JACK_DETECT] = {
1727a771 7544 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
7545 .v.func = alc_fixup_no_jack_detect,
7546 },
7547 [ALC861_FIXUP_ASUS_A6RP] = {
1727a771 7548 .type = HDA_FIXUP_FUNC,
e652f4c8
TI
7549 .v.func = alc861_fixup_asus_amp_vref_0f,
7550 .chained = true,
7551 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
6ddf0fd1
TI
7552 },
7553 [ALC660_FIXUP_ASUS_W7J] = {
7554 .type = HDA_FIXUP_VERBS,
7555 .v.verbs = (const struct hda_verb[]) {
7556 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7557 * for enabling outputs
7558 */
7559 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7560 { }
7561 },
e652f4c8 7562 }
1d045db9 7563};
7085ec12 7564
1d045db9 7565static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6ddf0fd1 7566 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
e7ca237b 7567 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
e652f4c8
TI
7568 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7569 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7570 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7571 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7572 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7573 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
1d045db9
TI
7574 {}
7575};
3af9ee6b 7576
1d045db9
TI
7577/*
7578 */
1d045db9 7579static int patch_alc861(struct hda_codec *codec)
7085ec12 7580{
1d045db9 7581 struct alc_spec *spec;
1d045db9 7582 int err;
7085ec12 7583
3de95173
TI
7584 err = alc_alloc_spec(codec, 0x15);
7585 if (err < 0)
7586 return err;
1d045db9 7587
3de95173 7588 spec = codec->spec;
7504b6cd 7589 spec->gen.beep_nid = 0x23;
1d045db9 7590
225068ab
TI
7591#ifdef CONFIG_PM
7592 spec->power_hook = alc_power_eapd;
7593#endif
7594
1727a771
TI
7595 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7596 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3af9ee6b 7597
cb4e4824
TI
7598 /* automatic parse from the BIOS config */
7599 err = alc861_parse_auto_config(codec);
e16fb6d1
TI
7600 if (err < 0)
7601 goto error;
3af9ee6b 7602
7504b6cd 7603 if (!spec->gen.no_analog)
3e6179b8 7604 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
7085ec12 7605
1727a771 7606 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 7607
1d045db9 7608 return 0;
e16fb6d1
TI
7609
7610 error:
7611 alc_free(codec);
7612 return err;
7085ec12
TI
7613}
7614
1d045db9
TI
7615/*
7616 * ALC861-VD support
7617 *
7618 * Based on ALC882
7619 *
7620 * In addition, an independent DAC
7621 */
1d045db9 7622static int alc861vd_parse_auto_config(struct hda_codec *codec)
bc9f98a9 7623{
1d045db9 7624 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
3e6179b8
TI
7625 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7626 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
ce764ab2
TI
7627}
7628
1d045db9 7629enum {
8fdcb6fe
TI
7630 ALC660VD_FIX_ASUS_GPIO1,
7631 ALC861VD_FIX_DALLAS,
1d045db9 7632};
ce764ab2 7633
8fdcb6fe
TI
7634/* exclude VREF80 */
7635static void alc861vd_fixup_dallas(struct hda_codec *codec,
1727a771 7636 const struct hda_fixup *fix, int action)
8fdcb6fe 7637{
1727a771 7638 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
b78562b1
TI
7639 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7640 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
8fdcb6fe
TI
7641 }
7642}
7643
1727a771 7644static const struct hda_fixup alc861vd_fixups[] = {
1d045db9 7645 [ALC660VD_FIX_ASUS_GPIO1] = {
1727a771 7646 .type = HDA_FIXUP_VERBS,
1d045db9 7647 .v.verbs = (const struct hda_verb[]) {
8fdcb6fe 7648 /* reset GPIO1 */
1d045db9
TI
7649 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7650 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
7651 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
7652 { }
7653 }
7654 },
8fdcb6fe 7655 [ALC861VD_FIX_DALLAS] = {
1727a771 7656 .type = HDA_FIXUP_FUNC,
8fdcb6fe
TI
7657 .v.func = alc861vd_fixup_dallas,
7658 },
1d045db9 7659};
ce764ab2 7660
1d045db9 7661static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
8fdcb6fe 7662 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
1d045db9 7663 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
8fdcb6fe 7664 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
1d045db9
TI
7665 {}
7666};
ce764ab2 7667
1d045db9
TI
7668/*
7669 */
1d045db9 7670static int patch_alc861vd(struct hda_codec *codec)
ce764ab2 7671{
1d045db9 7672 struct alc_spec *spec;
cb4e4824 7673 int err;
ce764ab2 7674
3de95173
TI
7675 err = alc_alloc_spec(codec, 0x0b);
7676 if (err < 0)
7677 return err;
1d045db9 7678
3de95173 7679 spec = codec->spec;
7504b6cd 7680 spec->gen.beep_nid = 0x23;
1d045db9 7681
225068ab
TI
7682 spec->shutup = alc_eapd_shutup;
7683
1727a771
TI
7684 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
7685 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1d045db9 7686
cb4e4824
TI
7687 /* automatic parse from the BIOS config */
7688 err = alc861vd_parse_auto_config(codec);
e16fb6d1
TI
7689 if (err < 0)
7690 goto error;
ce764ab2 7691
7504b6cd 7692 if (!spec->gen.no_analog)
3e6179b8 7693 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1d045db9 7694
1727a771 7695 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 7696
ce764ab2 7697 return 0;
e16fb6d1
TI
7698
7699 error:
7700 alc_free(codec);
7701 return err;
ce764ab2
TI
7702}
7703
1d045db9
TI
7704/*
7705 * ALC662 support
7706 *
7707 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
7708 * configuration. Each pin widget can choose any input DACs and a mixer.
7709 * Each ADC is connected from a mixer of all inputs. This makes possible
7710 * 6-channel independent captures.
7711 *
7712 * In addition, an independent DAC for the multi-playback (not used in this
7713 * driver yet).
7714 */
1d045db9
TI
7715
7716/*
7717 * BIOS auto configuration
7718 */
7719
bc9f98a9
KY
7720static int alc662_parse_auto_config(struct hda_codec *codec)
7721{
4c6d72d1 7722 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
3e6179b8
TI
7723 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
7724 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7725 const hda_nid_t *ssids;
ee979a14 7726
7639a06c
TI
7727 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
7728 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
7729 codec->core.vendor_id == 0x10ec0671)
3e6179b8 7730 ssids = alc663_ssids;
6227cdce 7731 else
3e6179b8
TI
7732 ssids = alc662_ssids;
7733 return alc_parse_auto_config(codec, alc662_ignore, ssids);
bc9f98a9
KY
7734}
7735
6be7948f 7736static void alc272_fixup_mario(struct hda_codec *codec,
1727a771 7737 const struct hda_fixup *fix, int action)
6fc398cb 7738{
9bb1f06f 7739 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6fc398cb 7740 return;
6be7948f
TB
7741 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
7742 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
7743 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
7744 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
7745 (0 << AC_AMPCAP_MUTE_SHIFT)))
4e76a883 7746 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
6be7948f
TB
7747}
7748
8e383953
TI
7749static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
7750 { .channels = 2,
7751 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
7752 { .channels = 4,
7753 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
7754 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
7755 { }
7756};
7757
7758/* override the 2.1 chmap */
eb9ca3ab 7759static void alc_fixup_bass_chmap(struct hda_codec *codec,
8e383953
TI
7760 const struct hda_fixup *fix, int action)
7761{
7762 if (action == HDA_FIXUP_ACT_BUILD) {
7763 struct alc_spec *spec = codec->spec;
bbbc7e85 7764 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
8e383953
TI
7765 }
7766}
7767
bf68665d
TI
7768/* avoid D3 for keeping GPIO up */
7769static unsigned int gpio_led_power_filter(struct hda_codec *codec,
7770 hda_nid_t nid,
7771 unsigned int power_state)
7772{
7773 struct alc_spec *spec = codec->spec;
7639a06c 7774 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led)
bf68665d
TI
7775 return AC_PWRST_D0;
7776 return power_state;
7777}
7778
3e887f37
TI
7779static void alc662_fixup_led_gpio1(struct hda_codec *codec,
7780 const struct hda_fixup *fix, int action)
7781{
7782 struct alc_spec *spec = codec->spec;
7783 static const struct hda_verb gpio_init[] = {
7784 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
7785 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
7786 {}
7787 };
7788
7789 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
0f32fd19 7790 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3e887f37 7791 spec->gpio_led = 0;
0f32fd19
TI
7792 spec->mute_led_polarity = 1;
7793 spec->gpio_mute_led_mask = 0x01;
3e887f37 7794 snd_hda_add_verbs(codec, gpio_init);
bf68665d 7795 codec->power_filter = gpio_led_power_filter;
3e887f37
TI
7796 }
7797}
7798
c6790c8e
KY
7799static void alc662_usi_automute_hook(struct hda_codec *codec,
7800 struct hda_jack_callback *jack)
7801{
7802 struct alc_spec *spec = codec->spec;
7803 int vref;
7804 msleep(200);
7805 snd_hda_gen_hp_automute(codec, jack);
7806
7807 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
7808 msleep(100);
7809 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7810 vref);
7811}
7812
7813static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
7814 const struct hda_fixup *fix, int action)
7815{
7816 struct alc_spec *spec = codec->spec;
7817 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7818 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7819 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
7820 }
7821}
7822
f3f9185f
KY
7823static struct coef_fw alc668_coefs[] = {
7824 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
7825 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
7826 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
7827 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
7828 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
7829 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
7830 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
7831 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
7832 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
7833 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
7834 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
7835 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
7836 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
7837 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
7838 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
7839 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
7840 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
7841 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
7842 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
7843 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
7844 {}
7845};
7846
7847static void alc668_restore_default_value(struct hda_codec *codec)
7848{
7849 alc_process_coef_fw(codec, alc668_coefs);
7850}
7851
6cb3b707 7852enum {
2df03514 7853 ALC662_FIXUP_ASPIRE,
3e887f37 7854 ALC662_FIXUP_LED_GPIO1,
6cb3b707 7855 ALC662_FIXUP_IDEAPAD,
6be7948f 7856 ALC272_FIXUP_MARIO,
d2ebd479 7857 ALC662_FIXUP_CZC_P10T,
94024cd1 7858 ALC662_FIXUP_SKU_IGNORE,
e59ea3ed 7859 ALC662_FIXUP_HP_RP5800,
53c334ad
TI
7860 ALC662_FIXUP_ASUS_MODE1,
7861 ALC662_FIXUP_ASUS_MODE2,
7862 ALC662_FIXUP_ASUS_MODE3,
7863 ALC662_FIXUP_ASUS_MODE4,
7864 ALC662_FIXUP_ASUS_MODE5,
7865 ALC662_FIXUP_ASUS_MODE6,
7866 ALC662_FIXUP_ASUS_MODE7,
7867 ALC662_FIXUP_ASUS_MODE8,
1565cc35 7868 ALC662_FIXUP_NO_JACK_DETECT,
edfe3bfc 7869 ALC662_FIXUP_ZOTAC_Z68,
125821ae 7870 ALC662_FIXUP_INV_DMIC,
1f8b46cd 7871 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
73bdd597 7872 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 7873 ALC662_FIXUP_HEADSET_MODE,
73bdd597 7874 ALC668_FIXUP_HEADSET_MODE,
8e54b4ac 7875 ALC662_FIXUP_BASS_MODE4_CHMAP,
61a75f13 7876 ALC662_FIXUP_BASS_16,
a30c9aaa 7877 ALC662_FIXUP_BASS_1A,
8e54b4ac 7878 ALC662_FIXUP_BASS_CHMAP,
493a52a9 7879 ALC668_FIXUP_AUTO_MUTE,
5e6db669 7880 ALC668_FIXUP_DELL_DISABLE_AAMIX,
033b0a7c 7881 ALC668_FIXUP_DELL_XPS13,
9d4dc584 7882 ALC662_FIXUP_ASUS_Nx50,
fc7438b1 7883 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 7884 ALC668_FIXUP_ASUS_Nx51,
78f4f7c2
KY
7885 ALC891_FIXUP_HEADSET_MODE,
7886 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9b51fe3e 7887 ALC662_FIXUP_ACER_VERITON,
1a3f0991 7888 ALC892_FIXUP_ASROCK_MOBO,
c6790c8e
KY
7889 ALC662_FIXUP_USI_FUNC,
7890 ALC662_FIXUP_USI_HEADSET_MODE,
ca169cc2 7891 ALC662_FIXUP_LENOVO_MULTI_CODECS,
6cb3b707
DH
7892};
7893
1727a771 7894static const struct hda_fixup alc662_fixups[] = {
2df03514 7895 [ALC662_FIXUP_ASPIRE] = {
1727a771
TI
7896 .type = HDA_FIXUP_PINS,
7897 .v.pins = (const struct hda_pintbl[]) {
2df03514
DC
7898 { 0x15, 0x99130112 }, /* subwoofer */
7899 { }
7900 }
7901 },
3e887f37
TI
7902 [ALC662_FIXUP_LED_GPIO1] = {
7903 .type = HDA_FIXUP_FUNC,
7904 .v.func = alc662_fixup_led_gpio1,
7905 },
6cb3b707 7906 [ALC662_FIXUP_IDEAPAD] = {
1727a771
TI
7907 .type = HDA_FIXUP_PINS,
7908 .v.pins = (const struct hda_pintbl[]) {
6cb3b707
DH
7909 { 0x17, 0x99130112 }, /* subwoofer */
7910 { }
3e887f37
TI
7911 },
7912 .chained = true,
7913 .chain_id = ALC662_FIXUP_LED_GPIO1,
6cb3b707 7914 },
6be7948f 7915 [ALC272_FIXUP_MARIO] = {
1727a771 7916 .type = HDA_FIXUP_FUNC,
b5bfbc67 7917 .v.func = alc272_fixup_mario,
d2ebd479
AA
7918 },
7919 [ALC662_FIXUP_CZC_P10T] = {
1727a771 7920 .type = HDA_FIXUP_VERBS,
d2ebd479
AA
7921 .v.verbs = (const struct hda_verb[]) {
7922 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7923 {}
7924 }
7925 },
94024cd1 7926 [ALC662_FIXUP_SKU_IGNORE] = {
1727a771 7927 .type = HDA_FIXUP_FUNC,
23d30f28 7928 .v.func = alc_fixup_sku_ignore,
c6b35874 7929 },
e59ea3ed 7930 [ALC662_FIXUP_HP_RP5800] = {
1727a771
TI
7931 .type = HDA_FIXUP_PINS,
7932 .v.pins = (const struct hda_pintbl[]) {
e59ea3ed
TI
7933 { 0x14, 0x0221201f }, /* HP out */
7934 { }
7935 },
7936 .chained = true,
7937 .chain_id = ALC662_FIXUP_SKU_IGNORE
7938 },
53c334ad 7939 [ALC662_FIXUP_ASUS_MODE1] = {
1727a771
TI
7940 .type = HDA_FIXUP_PINS,
7941 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
7942 { 0x14, 0x99130110 }, /* speaker */
7943 { 0x18, 0x01a19c20 }, /* mic */
7944 { 0x19, 0x99a3092f }, /* int-mic */
7945 { 0x21, 0x0121401f }, /* HP out */
7946 { }
7947 },
7948 .chained = true,
7949 .chain_id = ALC662_FIXUP_SKU_IGNORE
7950 },
7951 [ALC662_FIXUP_ASUS_MODE2] = {
1727a771
TI
7952 .type = HDA_FIXUP_PINS,
7953 .v.pins = (const struct hda_pintbl[]) {
2996bdba
TI
7954 { 0x14, 0x99130110 }, /* speaker */
7955 { 0x18, 0x01a19820 }, /* mic */
7956 { 0x19, 0x99a3092f }, /* int-mic */
7957 { 0x1b, 0x0121401f }, /* HP out */
7958 { }
7959 },
53c334ad
TI
7960 .chained = true,
7961 .chain_id = ALC662_FIXUP_SKU_IGNORE
7962 },
7963 [ALC662_FIXUP_ASUS_MODE3] = {
1727a771
TI
7964 .type = HDA_FIXUP_PINS,
7965 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
7966 { 0x14, 0x99130110 }, /* speaker */
7967 { 0x15, 0x0121441f }, /* HP */
7968 { 0x18, 0x01a19840 }, /* mic */
7969 { 0x19, 0x99a3094f }, /* int-mic */
7970 { 0x21, 0x01211420 }, /* HP2 */
7971 { }
7972 },
7973 .chained = true,
7974 .chain_id = ALC662_FIXUP_SKU_IGNORE
7975 },
7976 [ALC662_FIXUP_ASUS_MODE4] = {
1727a771
TI
7977 .type = HDA_FIXUP_PINS,
7978 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
7979 { 0x14, 0x99130110 }, /* speaker */
7980 { 0x16, 0x99130111 }, /* speaker */
7981 { 0x18, 0x01a19840 }, /* mic */
7982 { 0x19, 0x99a3094f }, /* int-mic */
7983 { 0x21, 0x0121441f }, /* HP */
7984 { }
7985 },
7986 .chained = true,
7987 .chain_id = ALC662_FIXUP_SKU_IGNORE
7988 },
7989 [ALC662_FIXUP_ASUS_MODE5] = {
1727a771
TI
7990 .type = HDA_FIXUP_PINS,
7991 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
7992 { 0x14, 0x99130110 }, /* speaker */
7993 { 0x15, 0x0121441f }, /* HP */
7994 { 0x16, 0x99130111 }, /* speaker */
7995 { 0x18, 0x01a19840 }, /* mic */
7996 { 0x19, 0x99a3094f }, /* int-mic */
7997 { }
7998 },
7999 .chained = true,
8000 .chain_id = ALC662_FIXUP_SKU_IGNORE
8001 },
8002 [ALC662_FIXUP_ASUS_MODE6] = {
1727a771
TI
8003 .type = HDA_FIXUP_PINS,
8004 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8005 { 0x14, 0x99130110 }, /* speaker */
8006 { 0x15, 0x01211420 }, /* HP2 */
8007 { 0x18, 0x01a19840 }, /* mic */
8008 { 0x19, 0x99a3094f }, /* int-mic */
8009 { 0x1b, 0x0121441f }, /* HP */
8010 { }
8011 },
8012 .chained = true,
8013 .chain_id = ALC662_FIXUP_SKU_IGNORE
8014 },
8015 [ALC662_FIXUP_ASUS_MODE7] = {
1727a771
TI
8016 .type = HDA_FIXUP_PINS,
8017 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8018 { 0x14, 0x99130110 }, /* speaker */
8019 { 0x17, 0x99130111 }, /* speaker */
8020 { 0x18, 0x01a19840 }, /* mic */
8021 { 0x19, 0x99a3094f }, /* int-mic */
8022 { 0x1b, 0x01214020 }, /* HP */
8023 { 0x21, 0x0121401f }, /* HP */
8024 { }
8025 },
8026 .chained = true,
8027 .chain_id = ALC662_FIXUP_SKU_IGNORE
8028 },
8029 [ALC662_FIXUP_ASUS_MODE8] = {
1727a771
TI
8030 .type = HDA_FIXUP_PINS,
8031 .v.pins = (const struct hda_pintbl[]) {
53c334ad
TI
8032 { 0x14, 0x99130110 }, /* speaker */
8033 { 0x12, 0x99a30970 }, /* int-mic */
8034 { 0x15, 0x01214020 }, /* HP */
8035 { 0x17, 0x99130111 }, /* speaker */
8036 { 0x18, 0x01a19840 }, /* mic */
8037 { 0x21, 0x0121401f }, /* HP */
8038 { }
8039 },
8040 .chained = true,
8041 .chain_id = ALC662_FIXUP_SKU_IGNORE
2996bdba 8042 },
1565cc35 8043 [ALC662_FIXUP_NO_JACK_DETECT] = {
1727a771 8044 .type = HDA_FIXUP_FUNC,
1565cc35
TI
8045 .v.func = alc_fixup_no_jack_detect,
8046 },
edfe3bfc 8047 [ALC662_FIXUP_ZOTAC_Z68] = {
1727a771
TI
8048 .type = HDA_FIXUP_PINS,
8049 .v.pins = (const struct hda_pintbl[]) {
edfe3bfc
DH
8050 { 0x1b, 0x02214020 }, /* Front HP */
8051 { }
8052 }
8053 },
125821ae 8054 [ALC662_FIXUP_INV_DMIC] = {
1727a771 8055 .type = HDA_FIXUP_FUNC,
9d36a7dc 8056 .v.func = alc_fixup_inv_dmic,
125821ae 8057 },
033b0a7c
GM
8058 [ALC668_FIXUP_DELL_XPS13] = {
8059 .type = HDA_FIXUP_FUNC,
8060 .v.func = alc_fixup_dell_xps13,
8061 .chained = true,
8062 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
8063 },
5e6db669
GM
8064 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
8065 .type = HDA_FIXUP_FUNC,
8066 .v.func = alc_fixup_disable_aamix,
8067 .chained = true,
8068 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8069 },
493a52a9
HW
8070 [ALC668_FIXUP_AUTO_MUTE] = {
8071 .type = HDA_FIXUP_FUNC,
8072 .v.func = alc_fixup_auto_mute_via_amp,
8073 .chained = true,
8074 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8075 },
1f8b46cd
DH
8076 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
8077 .type = HDA_FIXUP_PINS,
8078 .v.pins = (const struct hda_pintbl[]) {
8079 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8080 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
8081 { }
8082 },
8083 .chained = true,
8084 .chain_id = ALC662_FIXUP_HEADSET_MODE
8085 },
8086 [ALC662_FIXUP_HEADSET_MODE] = {
8087 .type = HDA_FIXUP_FUNC,
8088 .v.func = alc_fixup_headset_mode_alc662,
8089 },
73bdd597
DH
8090 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
8091 .type = HDA_FIXUP_PINS,
8092 .v.pins = (const struct hda_pintbl[]) {
8093 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8094 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8095 { }
8096 },
8097 .chained = true,
8098 .chain_id = ALC668_FIXUP_HEADSET_MODE
8099 },
8100 [ALC668_FIXUP_HEADSET_MODE] = {
8101 .type = HDA_FIXUP_FUNC,
8102 .v.func = alc_fixup_headset_mode_alc668,
8103 },
8e54b4ac 8104 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
8e383953 8105 .type = HDA_FIXUP_FUNC,
eb9ca3ab 8106 .v.func = alc_fixup_bass_chmap,
8e383953
TI
8107 .chained = true,
8108 .chain_id = ALC662_FIXUP_ASUS_MODE4
8109 },
61a75f13
DH
8110 [ALC662_FIXUP_BASS_16] = {
8111 .type = HDA_FIXUP_PINS,
8112 .v.pins = (const struct hda_pintbl[]) {
8113 {0x16, 0x80106111}, /* bass speaker */
8114 {}
8115 },
8116 .chained = true,
8117 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8118 },
a30c9aaa
TI
8119 [ALC662_FIXUP_BASS_1A] = {
8120 .type = HDA_FIXUP_PINS,
8121 .v.pins = (const struct hda_pintbl[]) {
8122 {0x1a, 0x80106111}, /* bass speaker */
8123 {}
8124 },
8e54b4ac
DH
8125 .chained = true,
8126 .chain_id = ALC662_FIXUP_BASS_CHMAP,
a30c9aaa 8127 },
8e54b4ac 8128 [ALC662_FIXUP_BASS_CHMAP] = {
a30c9aaa 8129 .type = HDA_FIXUP_FUNC,
eb9ca3ab 8130 .v.func = alc_fixup_bass_chmap,
a30c9aaa 8131 },
9d4dc584
BM
8132 [ALC662_FIXUP_ASUS_Nx50] = {
8133 .type = HDA_FIXUP_FUNC,
8134 .v.func = alc_fixup_auto_mute_via_amp,
8135 .chained = true,
8136 .chain_id = ALC662_FIXUP_BASS_1A
8137 },
fc7438b1
MP
8138 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
8139 .type = HDA_FIXUP_FUNC,
8140 .v.func = alc_fixup_headset_mode_alc668,
8141 .chain_id = ALC662_FIXUP_BASS_CHMAP
8142 },
3231e205
YP
8143 [ALC668_FIXUP_ASUS_Nx51] = {
8144 .type = HDA_FIXUP_PINS,
8145 .v.pins = (const struct hda_pintbl[]) {
fc7438b1
MP
8146 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8147 { 0x1a, 0x90170151 }, /* bass speaker */
8148 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
3231e205
YP
8149 {}
8150 },
8151 .chained = true,
fc7438b1 8152 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
3231e205 8153 },
78f4f7c2
KY
8154 [ALC891_FIXUP_HEADSET_MODE] = {
8155 .type = HDA_FIXUP_FUNC,
8156 .v.func = alc_fixup_headset_mode,
8157 },
8158 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
8159 .type = HDA_FIXUP_PINS,
8160 .v.pins = (const struct hda_pintbl[]) {
8161 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8162 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8163 { }
8164 },
8165 .chained = true,
8166 .chain_id = ALC891_FIXUP_HEADSET_MODE
8167 },
9b51fe3e
SB
8168 [ALC662_FIXUP_ACER_VERITON] = {
8169 .type = HDA_FIXUP_PINS,
8170 .v.pins = (const struct hda_pintbl[]) {
8171 { 0x15, 0x50170120 }, /* no internal speaker */
8172 { }
8173 }
8174 },
1a3f0991
TI
8175 [ALC892_FIXUP_ASROCK_MOBO] = {
8176 .type = HDA_FIXUP_PINS,
8177 .v.pins = (const struct hda_pintbl[]) {
8178 { 0x15, 0x40f000f0 }, /* disabled */
8179 { 0x16, 0x40f000f0 }, /* disabled */
1a3f0991
TI
8180 { }
8181 }
8182 },
c6790c8e
KY
8183 [ALC662_FIXUP_USI_FUNC] = {
8184 .type = HDA_FIXUP_FUNC,
8185 .v.func = alc662_fixup_usi_headset_mic,
8186 },
8187 [ALC662_FIXUP_USI_HEADSET_MODE] = {
8188 .type = HDA_FIXUP_PINS,
8189 .v.pins = (const struct hda_pintbl[]) {
8190 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
8191 { 0x18, 0x01a1903d },
8192 { }
8193 },
8194 .chained = true,
8195 .chain_id = ALC662_FIXUP_USI_FUNC
8196 },
ca169cc2
KY
8197 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
8198 .type = HDA_FIXUP_FUNC,
8199 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8200 },
6cb3b707
DH
8201};
8202
a9111321 8203static const struct snd_pci_quirk alc662_fixup_tbl[] = {
53c334ad 8204 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
d3d3835c 8205 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
02f6ff90 8206 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
a6c47a85 8207 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
94024cd1 8208 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
125821ae 8209 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
1801928e 8210 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
2df03514 8211 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
73bdd597
DH
8212 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8213 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
c5d019c3 8214 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
033b0a7c 8215 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
467e1436 8216 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
09d2014f 8217 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
ad8ff99e 8218 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8dc9abb9
KY
8219 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8220 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6a98e34b 8221 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
e59ea3ed 8222 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
2da2dc9e 8223 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
83a9efb5 8224 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
db8948e6 8225 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
9d4dc584 8226 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
8e54b4ac 8227 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
61a75f13 8228 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
3231e205
YP
8229 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8230 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
c7efff92 8231 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
61a75f13 8232 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
8e54b4ac 8233 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
1565cc35 8234 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
53c334ad 8235 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
a0e90acc 8236 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
c6790c8e 8237 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
ca169cc2 8238 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
d4118588 8239 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
6cb3b707 8240 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1a3f0991 8241 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
edfe3bfc 8242 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
9b51fe3e 8243 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
d2ebd479 8244 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
53c334ad
TI
8245
8246#if 0
8247 /* Below is a quirk table taken from the old code.
8248 * Basically the device should work as is without the fixup table.
8249 * If BIOS doesn't give a proper info, enable the corresponding
8250 * fixup entry.
7d7eb9ea 8251 */
53c334ad
TI
8252 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8253 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8254 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8255 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8256 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8257 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8258 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8259 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8260 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8261 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8262 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8263 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8264 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8265 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8266 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8267 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8268 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8269 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8270 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8271 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8272 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8273 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8274 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8275 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8276 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8277 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8278 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8279 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8280 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8281 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8282 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8283 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8284 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8285 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8286 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8287 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8288 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8289 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8290 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8291 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8292 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8293 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8294 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8295 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8296 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8297 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8298 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8299 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8300 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8301 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8302#endif
6cb3b707
DH
8303 {}
8304};
8305
1727a771 8306static const struct hda_model_fixup alc662_fixup_models[] = {
6be7948f 8307 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
53c334ad
TI
8308 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8309 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8310 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8311 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8312 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8313 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8314 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8315 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
6e72aa5f 8316 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
e32aa85a 8317 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
ba90d6a6 8318 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
6be7948f
TB
8319 {}
8320};
6cb3b707 8321
532895c5 8322static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
78f4f7c2
KY
8323 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8324 {0x17, 0x02211010},
8325 {0x18, 0x01a19030},
8326 {0x1a, 0x01813040},
8327 {0x21, 0x01014020}),
1f8b46cd 8328 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
1f8b46cd 8329 {0x14, 0x01014010},
1f8b46cd 8330 {0x18, 0x01a19020},
1f8b46cd 8331 {0x1a, 0x0181302f},
11580297 8332 {0x1b, 0x0221401f}),
76c2132e
DH
8333 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8334 {0x12, 0x99a30130},
8335 {0x14, 0x90170110},
8336 {0x15, 0x0321101f},
11580297 8337 {0x16, 0x03011020}),
76c2132e
DH
8338 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8339 {0x12, 0x99a30140},
8340 {0x14, 0x90170110},
8341 {0x15, 0x0321101f},
11580297 8342 {0x16, 0x03011020}),
76c2132e
DH
8343 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8344 {0x12, 0x99a30150},
8345 {0x14, 0x90170110},
8346 {0x15, 0x0321101f},
11580297 8347 {0x16, 0x03011020}),
76c2132e 8348 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
76c2132e
DH
8349 {0x14, 0x90170110},
8350 {0x15, 0x0321101f},
11580297 8351 {0x16, 0x03011020}),
76c2132e
DH
8352 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8353 {0x12, 0x90a60130},
8354 {0x14, 0x90170110},
11580297 8355 {0x15, 0x0321101f}),
532895c5
HW
8356 {}
8357};
8358
1d045db9
TI
8359/*
8360 */
bc9f98a9
KY
8361static int patch_alc662(struct hda_codec *codec)
8362{
8363 struct alc_spec *spec;
3de95173 8364 int err;
bc9f98a9 8365
3de95173
TI
8366 err = alc_alloc_spec(codec, 0x0b);
8367 if (err < 0)
8368 return err;
bc9f98a9 8369
3de95173 8370 spec = codec->spec;
1f0f4b80 8371
225068ab
TI
8372 spec->shutup = alc_eapd_shutup;
8373
53c334ad
TI
8374 /* handle multiple HPs as is */
8375 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8376
2c3bf9ab
TI
8377 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8378
7639a06c 8379 switch (codec->core.vendor_id) {
f3f9185f
KY
8380 case 0x10ec0668:
8381 spec->init_hook = alc668_restore_default_value;
8382 break;
f3f9185f 8383 }
8663ff75 8384
1727a771 8385 snd_hda_pick_fixup(codec, alc662_fixup_models,
8e5a0509 8386 alc662_fixup_tbl, alc662_fixups);
532895c5 8387 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
1727a771 8388 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8e5a0509
TI
8389
8390 alc_auto_parse_customize_define(codec);
8391
7504b6cd
TI
8392 if (has_cdefine_beep(codec))
8393 spec->gen.beep_nid = 0x01;
8394
1bb7e43e 8395 if ((alc_get_coef0(codec) & (1 << 14)) &&
5100cd07 8396 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
e16fb6d1 8397 spec->cdefine.platform_type == 1) {
6134b1a2
WY
8398 err = alc_codec_rename(codec, "ALC272X");
8399 if (err < 0)
e16fb6d1 8400 goto error;
20ca0c35 8401 }
274693f3 8402
b9c5106c
TI
8403 /* automatic parse from the BIOS config */
8404 err = alc662_parse_auto_config(codec);
e16fb6d1
TI
8405 if (err < 0)
8406 goto error;
bc9f98a9 8407
7504b6cd 8408 if (!spec->gen.no_analog && spec->gen.beep_nid) {
7639a06c 8409 switch (codec->core.vendor_id) {
da00c244
KY
8410 case 0x10ec0662:
8411 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8412 break;
8413 case 0x10ec0272:
8414 case 0x10ec0663:
8415 case 0x10ec0665:
9ad54547 8416 case 0x10ec0668:
da00c244
KY
8417 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
8418 break;
8419 case 0x10ec0273:
8420 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
8421 break;
8422 }
cec27c89 8423 }
2134ea4f 8424
1727a771 8425 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
589876e2 8426
bc9f98a9 8427 return 0;
801f49d3 8428
e16fb6d1
TI
8429 error:
8430 alc_free(codec);
8431 return err;
b478b998
KY
8432}
8433
d1eb57f4
KY
8434/*
8435 * ALC680 support
8436 */
d1eb57f4 8437
d1eb57f4
KY
8438static int alc680_parse_auto_config(struct hda_codec *codec)
8439{
3e6179b8 8440 return alc_parse_auto_config(codec, NULL, NULL);
d1eb57f4
KY
8441}
8442
d1eb57f4 8443/*
d1eb57f4 8444 */
d1eb57f4
KY
8445static int patch_alc680(struct hda_codec *codec)
8446{
d1eb57f4
KY
8447 int err;
8448
1f0f4b80 8449 /* ALC680 has no aa-loopback mixer */
3de95173
TI
8450 err = alc_alloc_spec(codec, 0);
8451 if (err < 0)
8452 return err;
1f0f4b80 8453
1ebec5f2
TI
8454 /* automatic parse from the BIOS config */
8455 err = alc680_parse_auto_config(codec);
8456 if (err < 0) {
8457 alc_free(codec);
8458 return err;
d1eb57f4
KY
8459 }
8460
d1eb57f4
KY
8461 return 0;
8462}
8463
1da177e4
LT
8464/*
8465 * patch entries
8466 */
b9a94a9c 8467static const struct hda_device_id snd_hda_id_realtek[] = {
0a6f0600 8468 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
b9a94a9c 8469 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
4231430d 8470 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
b9a94a9c
TI
8471 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8472 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
dcd4f0db 8473 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
b9a94a9c 8474 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
736f20a7 8475 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
b9a94a9c
TI
8476 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8477 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
f429e7e4 8478 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
b9a94a9c
TI
8479 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8480 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8481 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8482 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8483 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8484 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8485 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
dcd4f0db 8486 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
b9a94a9c
TI
8487 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8488 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8489 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8490 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8491 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8492 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
0a6f0600 8493 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
b9a94a9c
TI
8494 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8495 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
0a6f0600 8496 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
b9a94a9c
TI
8497 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8498 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8499 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
dcd4f0db 8500 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
7d727869 8501 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
b9a94a9c 8502 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
28f1f9b2 8503 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
b9a94a9c
TI
8504 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8505 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8506 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8507 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8508 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8509 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8510 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8511 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8512 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8513 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8514 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8515 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8516 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8517 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
6fbae35a
KY
8518 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8519 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8520 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
78f4f7c2 8521 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
b9a94a9c
TI
8522 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8523 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8524 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8525 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8526 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8527 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8528 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8529 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8530 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8531 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8532 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8533 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8534 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
65553b12 8535 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
a535ad57 8536 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
1da177e4
LT
8537 {} /* terminator */
8538};
b9a94a9c 8539MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
1289e9e8
TI
8540
8541MODULE_LICENSE("GPL");
8542MODULE_DESCRIPTION("Realtek HD-audio codec");
8543
d8a766a1 8544static struct hda_codec_driver realtek_driver = {
b9a94a9c 8545 .id = snd_hda_id_realtek,
1289e9e8
TI
8546};
8547
d8a766a1 8548module_hda_codec_driver(realtek_driver);