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