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