blob: 3bd37c02ce0eda2ca2d0983d46fb467c39751893 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001// SPDX-License-Identifier: GPL-2.0-or-later
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
5 * HD audio interface patch for Realtek ALC codecs
6 *
7 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
9 * Takashi Iwai <tiwai@suse.de>
10 * Jonathan Woithe <jwoithe@just42.net>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011 */
12
13#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
17#include <linux/dmi.h>
18#include <linux/module.h>
19#include <linux/input.h>
Olivier Deprez157378f2022-04-04 15:47:50 +020020#include <linux/leds.h>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000021#include <sound/core.h>
22#include <sound/jack.h>
David Brazdil0f672f62019-12-10 10:32:29 +000023#include <sound/hda_codec.h>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000024#include "hda_local.h"
25#include "hda_auto_parser.h"
26#include "hda_jack.h"
27#include "hda_generic.h"
28
29/* keep halting ALC5505 DSP, for power saving */
30#define HALT_REALTEK_ALC5505
31
32/* extra amp-initialization sequence types */
33enum {
34 ALC_INIT_UNDEFINED,
35 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
37};
38
39enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45};
46
47enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51};
52
53enum {
54 ALC_KEY_MICMUTE_INDEX,
55};
56
57struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
67 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
68};
69
Olivier Deprez157378f2022-04-04 15:47:50 +020070struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75};
76
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000077struct alc_spec {
78 struct hda_gen_spec gen; /* must be at head */
79
80 /* codec parameterization */
81 struct alc_customize_define cdefine;
82 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
83
84 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
88 bool gpio_write_delay; /* add a delay before writing gpio_data */
89
Olivier Deprez157378f2022-04-04 15:47:50 +020090 /* mute LED for HP laptops, see vref_mute_led_set() */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000091 int mute_led_polarity;
Olivier Deprez0e641232021-09-23 10:07:05 +020092 int micmute_led_polarity;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000093 hda_nid_t mute_led_nid;
94 hda_nid_t cap_mute_led_nid;
95
96 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
Olivier Deprez157378f2022-04-04 15:47:50 +020098 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
100 struct mutex coef_mutex;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000101
102 hda_nid_t headset_mic_pin;
103 hda_nid_t headphone_mic_pin;
104 int current_headset_mode;
105 int current_headset_type;
106
107 /* hooks */
108 void (*init_hook)(struct hda_codec *codec);
109#ifdef CONFIG_PM
110 void (*power_hook)(struct hda_codec *codec);
111#endif
112 void (*shutup)(struct hda_codec *codec);
113 void (*reboot_notify)(struct hda_codec *codec);
114
115 int init_amp;
116 int codec_variant; /* flag for other variants */
117 unsigned int has_alc5505_dsp:1;
118 unsigned int no_depop_delay:1;
David Brazdil0f672f62019-12-10 10:32:29 +0000119 unsigned int done_hp_init:1;
120 unsigned int no_shutup_pins:1;
121 unsigned int ultra_low_power:1;
Olivier Deprez0e641232021-09-23 10:07:05 +0200122 unsigned int has_hs_key:1;
Olivier Deprez157378f2022-04-04 15:47:50 +0200123 unsigned int no_internal_mic_pin:1;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000124
125 /* for PLL fix */
126 hda_nid_t pll_nid;
127 unsigned int pll_coef_idx, pll_coef_bit;
128 unsigned int coef0;
129 struct input_dev *kb_dev;
130 u8 alc_mute_keycode_map[1];
131};
132
133/*
134 * COEF access helper functions
135 */
136
Olivier Deprez157378f2022-04-04 15:47:50 +0200137static void coef_mutex_lock(struct hda_codec *codec)
138{
139 struct alc_spec *spec = codec->spec;
140
141 snd_hda_power_up_pm(codec);
142 mutex_lock(&spec->coef_mutex);
143}
144
145static void coef_mutex_unlock(struct hda_codec *codec)
146{
147 struct alc_spec *spec = codec->spec;
148
149 mutex_unlock(&spec->coef_mutex);
150 snd_hda_power_down_pm(codec);
151}
152
153static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
154 unsigned int coef_idx)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000155{
156 unsigned int val;
157
158 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
159 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
160 return val;
161}
162
Olivier Deprez157378f2022-04-04 15:47:50 +0200163static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
164 unsigned int coef_idx)
165{
166 unsigned int val;
167
168 coef_mutex_lock(codec);
169 val = __alc_read_coefex_idx(codec, nid, coef_idx);
170 coef_mutex_unlock(codec);
171 return val;
172}
173
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000174#define alc_read_coef_idx(codec, coef_idx) \
175 alc_read_coefex_idx(codec, 0x20, coef_idx)
176
Olivier Deprez157378f2022-04-04 15:47:50 +0200177static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
178 unsigned int coef_idx, unsigned int coef_val)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000179{
180 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
181 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
182}
183
Olivier Deprez157378f2022-04-04 15:47:50 +0200184static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
185 unsigned int coef_idx, unsigned int coef_val)
186{
187 coef_mutex_lock(codec);
188 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
189 coef_mutex_unlock(codec);
190}
191
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000192#define alc_write_coef_idx(codec, coef_idx, coef_val) \
193 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
194
Olivier Deprez157378f2022-04-04 15:47:50 +0200195static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
196 unsigned int coef_idx, unsigned int mask,
197 unsigned int bits_set)
198{
199 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
200
201 if (val != -1)
202 __alc_write_coefex_idx(codec, nid, coef_idx,
203 (val & ~mask) | bits_set);
204}
205
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000206static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
207 unsigned int coef_idx, unsigned int mask,
208 unsigned int bits_set)
209{
Olivier Deprez157378f2022-04-04 15:47:50 +0200210 coef_mutex_lock(codec);
211 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
212 coef_mutex_unlock(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000213}
214
215#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
216 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
217
218/* a special bypass for COEF 0; read the cached value at the second time */
219static unsigned int alc_get_coef0(struct hda_codec *codec)
220{
221 struct alc_spec *spec = codec->spec;
222
223 if (!spec->coef0)
224 spec->coef0 = alc_read_coef_idx(codec, 0);
225 return spec->coef0;
226}
227
228/* coef writes/updates batch */
229struct coef_fw {
230 unsigned char nid;
231 unsigned char idx;
232 unsigned short mask;
233 unsigned short val;
234};
235
236#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
237 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
238#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
239#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
240#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
241
242static void alc_process_coef_fw(struct hda_codec *codec,
243 const struct coef_fw *fw)
244{
Olivier Deprez157378f2022-04-04 15:47:50 +0200245 coef_mutex_lock(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000246 for (; fw->nid; fw++) {
247 if (fw->mask == (unsigned short)-1)
Olivier Deprez157378f2022-04-04 15:47:50 +0200248 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000249 else
Olivier Deprez157378f2022-04-04 15:47:50 +0200250 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
251 fw->mask, fw->val);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000252 }
Olivier Deprez157378f2022-04-04 15:47:50 +0200253 coef_mutex_unlock(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000254}
255
256/*
257 * GPIO setup tables, used in initialization
258 */
259
260/* Enable GPIO mask and set output */
261static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
262{
263 struct alc_spec *spec = codec->spec;
264
265 spec->gpio_mask |= mask;
266 spec->gpio_dir |= mask;
267 spec->gpio_data |= mask;
268}
269
270static void alc_write_gpio_data(struct hda_codec *codec)
271{
272 struct alc_spec *spec = codec->spec;
273
274 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
275 spec->gpio_data);
276}
277
278static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
279 bool on)
280{
281 struct alc_spec *spec = codec->spec;
282 unsigned int oldval = spec->gpio_data;
283
284 if (on)
285 spec->gpio_data |= mask;
286 else
287 spec->gpio_data &= ~mask;
288 if (oldval != spec->gpio_data)
289 alc_write_gpio_data(codec);
290}
291
292static void alc_write_gpio(struct hda_codec *codec)
293{
294 struct alc_spec *spec = codec->spec;
295
296 if (!spec->gpio_mask)
297 return;
298
299 snd_hda_codec_write(codec, codec->core.afg, 0,
300 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
301 snd_hda_codec_write(codec, codec->core.afg, 0,
302 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
303 if (spec->gpio_write_delay)
304 msleep(1);
305 alc_write_gpio_data(codec);
306}
307
308static void alc_fixup_gpio(struct hda_codec *codec, int action,
309 unsigned int mask)
310{
311 if (action == HDA_FIXUP_ACT_PRE_PROBE)
312 alc_setup_gpio(codec, mask);
313}
314
315static void alc_fixup_gpio1(struct hda_codec *codec,
316 const struct hda_fixup *fix, int action)
317{
318 alc_fixup_gpio(codec, action, 0x01);
319}
320
321static void alc_fixup_gpio2(struct hda_codec *codec,
322 const struct hda_fixup *fix, int action)
323{
324 alc_fixup_gpio(codec, action, 0x02);
325}
326
327static void alc_fixup_gpio3(struct hda_codec *codec,
328 const struct hda_fixup *fix, int action)
329{
330 alc_fixup_gpio(codec, action, 0x03);
331}
332
333static void alc_fixup_gpio4(struct hda_codec *codec,
334 const struct hda_fixup *fix, int action)
335{
336 alc_fixup_gpio(codec, action, 0x04);
337}
338
Olivier Deprez157378f2022-04-04 15:47:50 +0200339static void alc_fixup_micmute_led(struct hda_codec *codec,
340 const struct hda_fixup *fix, int action)
341{
342 if (action == HDA_FIXUP_ACT_PROBE)
343 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
344}
345
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000346/*
347 * Fix hardware PLL issue
348 * On some codecs, the analog PLL gating control must be off while
349 * the default value is 1.
350 */
351static void alc_fix_pll(struct hda_codec *codec)
352{
353 struct alc_spec *spec = codec->spec;
354
355 if (spec->pll_nid)
356 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
357 1 << spec->pll_coef_bit, 0);
358}
359
360static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
361 unsigned int coef_idx, unsigned int coef_bit)
362{
363 struct alc_spec *spec = codec->spec;
364 spec->pll_nid = nid;
365 spec->pll_coef_idx = coef_idx;
366 spec->pll_coef_bit = coef_bit;
367 alc_fix_pll(codec);
368}
369
370/* update the master volume per volume-knob's unsol event */
371static void alc_update_knob_master(struct hda_codec *codec,
372 struct hda_jack_callback *jack)
373{
374 unsigned int val;
375 struct snd_kcontrol *kctl;
376 struct snd_ctl_elem_value *uctl;
377
378 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
379 if (!kctl)
380 return;
381 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
382 if (!uctl)
383 return;
384 val = snd_hda_codec_read(codec, jack->nid, 0,
385 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
386 val &= HDA_AMP_VOLMASK;
387 uctl->value.integer.value[0] = val;
388 uctl->value.integer.value[1] = val;
389 kctl->put(kctl, uctl);
390 kfree(uctl);
391}
392
393static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
394{
395 /* For some reason, the res given from ALC880 is broken.
396 Here we adjust it properly. */
397 snd_hda_jack_unsol_event(codec, res >> 2);
398}
399
400/* Change EAPD to verb control */
401static void alc_fill_eapd_coef(struct hda_codec *codec)
402{
403 int coef;
404
405 coef = alc_get_coef0(codec);
406
407 switch (codec->core.vendor_id) {
408 case 0x10ec0262:
409 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
410 break;
411 case 0x10ec0267:
412 case 0x10ec0268:
413 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
414 break;
415 case 0x10ec0269:
416 if ((coef & 0x00f0) == 0x0010)
417 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
418 if ((coef & 0x00f0) == 0x0020)
419 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
420 if ((coef & 0x00f0) == 0x0030)
421 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
422 break;
423 case 0x10ec0280:
424 case 0x10ec0284:
425 case 0x10ec0290:
426 case 0x10ec0292:
427 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
428 break;
429 case 0x10ec0225:
430 case 0x10ec0295:
431 case 0x10ec0299:
432 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Olivier Deprez157378f2022-04-04 15:47:50 +0200433 fallthrough;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000434 case 0x10ec0215:
Olivier Deprez0e641232021-09-23 10:07:05 +0200435 case 0x10ec0230:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000436 case 0x10ec0233:
437 case 0x10ec0235:
438 case 0x10ec0236:
Olivier Deprez0e641232021-09-23 10:07:05 +0200439 case 0x10ec0245:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000440 case 0x10ec0255:
441 case 0x10ec0256:
442 case 0x10ec0257:
443 case 0x10ec0282:
444 case 0x10ec0283:
445 case 0x10ec0286:
446 case 0x10ec0288:
447 case 0x10ec0285:
448 case 0x10ec0298:
449 case 0x10ec0289:
450 case 0x10ec0300:
451 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
452 break;
453 case 0x10ec0275:
454 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
455 break;
Olivier Deprez0e641232021-09-23 10:07:05 +0200456 case 0x10ec0287:
457 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
458 alc_write_coef_idx(codec, 0x8, 0x4ab7);
459 break;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000460 case 0x10ec0293:
461 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
462 break;
463 case 0x10ec0234:
464 case 0x10ec0274:
465 case 0x10ec0294:
466 case 0x10ec0700:
467 case 0x10ec0701:
468 case 0x10ec0703:
David Brazdil0f672f62019-12-10 10:32:29 +0000469 case 0x10ec0711:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000470 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
471 break;
472 case 0x10ec0662:
473 if ((coef & 0x00f0) == 0x0030)
474 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
475 break;
476 case 0x10ec0272:
477 case 0x10ec0273:
478 case 0x10ec0663:
479 case 0x10ec0665:
480 case 0x10ec0670:
481 case 0x10ec0671:
482 case 0x10ec0672:
483 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
484 break;
Olivier Deprez0e641232021-09-23 10:07:05 +0200485 case 0x10ec0222:
David Brazdil0f672f62019-12-10 10:32:29 +0000486 case 0x10ec0623:
487 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
488 break;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000489 case 0x10ec0668:
490 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
491 break;
492 case 0x10ec0867:
493 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
494 break;
495 case 0x10ec0888:
496 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
497 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
498 break;
499 case 0x10ec0892:
Olivier Deprez0e641232021-09-23 10:07:05 +0200500 case 0x10ec0897:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000501 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
502 break;
503 case 0x10ec0899:
504 case 0x10ec0900:
Olivier Deprez0e641232021-09-23 10:07:05 +0200505 case 0x10ec0b00:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000506 case 0x10ec1168:
507 case 0x10ec1220:
508 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
509 break;
510 }
511}
512
513/* additional initialization for ALC888 variants */
514static void alc888_coef_init(struct hda_codec *codec)
515{
516 switch (alc_get_coef0(codec) & 0x00f0) {
517 /* alc888-VA */
518 case 0x00:
519 /* alc888-VB */
520 case 0x10:
521 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
522 break;
523 }
524}
525
526/* turn on/off EAPD control (only if available) */
527static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
528{
529 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
530 return;
531 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
532 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
533 on ? 2 : 0);
534}
535
536/* turn on/off EAPD controls of the codec */
537static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
538{
539 /* We currently only handle front, HP */
Olivier Deprez0e641232021-09-23 10:07:05 +0200540 static const hda_nid_t pins[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000541 0x0f, 0x10, 0x14, 0x15, 0x17, 0
542 };
Olivier Deprez0e641232021-09-23 10:07:05 +0200543 const hda_nid_t *p;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000544 for (p = pins; *p; p++)
545 set_eapd(codec, *p, on);
546}
547
David Brazdil0f672f62019-12-10 10:32:29 +0000548static int find_ext_mic_pin(struct hda_codec *codec);
549
550static void alc_headset_mic_no_shutup(struct hda_codec *codec)
551{
552 const struct hda_pincfg *pin;
553 int mic_pin = find_ext_mic_pin(codec);
554 int i;
555
556 /* don't shut up pins when unloading the driver; otherwise it breaks
557 * the default pin setup at the next load of the driver
558 */
559 if (codec->bus->shutdown)
560 return;
561
562 snd_array_for_each(&codec->init_pins, i, pin) {
563 /* use read here for syncing after issuing each verb */
564 if (pin->nid != mic_pin)
565 snd_hda_codec_read(codec, pin->nid, 0,
566 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
567 }
568
569 codec->pins_shutup = 1;
570}
571
572static void alc_shutup_pins(struct hda_codec *codec)
573{
574 struct alc_spec *spec = codec->spec;
575
576 switch (codec->core.vendor_id) {
Olivier Deprez157378f2022-04-04 15:47:50 +0200577 case 0x10ec0236:
578 case 0x10ec0256:
Olivier Deprez0e641232021-09-23 10:07:05 +0200579 case 0x10ec0283:
David Brazdil0f672f62019-12-10 10:32:29 +0000580 case 0x10ec0286:
581 case 0x10ec0288:
582 case 0x10ec0298:
583 alc_headset_mic_no_shutup(codec);
584 break;
585 default:
586 if (!spec->no_shutup_pins)
587 snd_hda_shutup_pins(codec);
588 break;
589 }
590}
591
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000592/* generic shutup callback;
593 * just turning off EAPD and a little pause for avoiding pop-noise
594 */
595static void alc_eapd_shutup(struct hda_codec *codec)
596{
597 struct alc_spec *spec = codec->spec;
598
599 alc_auto_setup_eapd(codec, false);
600 if (!spec->no_depop_delay)
601 msleep(200);
David Brazdil0f672f62019-12-10 10:32:29 +0000602 alc_shutup_pins(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000603}
604
605/* generic EAPD initialization */
606static void alc_auto_init_amp(struct hda_codec *codec, int type)
607{
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000608 alc_auto_setup_eapd(codec, true);
609 alc_write_gpio(codec);
610 switch (type) {
611 case ALC_INIT_DEFAULT:
612 switch (codec->core.vendor_id) {
613 case 0x10ec0260:
614 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
615 break;
616 case 0x10ec0880:
617 case 0x10ec0882:
618 case 0x10ec0883:
619 case 0x10ec0885:
620 alc_update_coef_idx(codec, 7, 0, 0x2030);
621 break;
622 case 0x10ec0888:
623 alc888_coef_init(codec);
624 break;
625 }
626 break;
627 }
628}
629
David Brazdil0f672f62019-12-10 10:32:29 +0000630/* get a primary headphone pin if available */
631static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
632{
633 if (spec->gen.autocfg.hp_pins[0])
634 return spec->gen.autocfg.hp_pins[0];
635 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
636 return spec->gen.autocfg.line_out_pins[0];
637 return 0;
638}
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000639
640/*
641 * Realtek SSID verification
642 */
643
644/* Could be any non-zero and even value. When used as fixup, tells
645 * the driver to ignore any present sku defines.
646 */
647#define ALC_FIXUP_SKU_IGNORE (2)
648
649static void alc_fixup_sku_ignore(struct hda_codec *codec,
650 const struct hda_fixup *fix, int action)
651{
652 struct alc_spec *spec = codec->spec;
653 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
654 spec->cdefine.fixup = 1;
655 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
656 }
657}
658
659static void alc_fixup_no_depop_delay(struct hda_codec *codec,
660 const struct hda_fixup *fix, int action)
661{
662 struct alc_spec *spec = codec->spec;
663
664 if (action == HDA_FIXUP_ACT_PROBE) {
665 spec->no_depop_delay = 1;
666 codec->depop_delay = 0;
667 }
668}
669
670static int alc_auto_parse_customize_define(struct hda_codec *codec)
671{
672 unsigned int ass, tmp, i;
673 unsigned nid = 0;
674 struct alc_spec *spec = codec->spec;
675
676 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
677
678 if (spec->cdefine.fixup) {
679 ass = spec->cdefine.sku_cfg;
680 if (ass == ALC_FIXUP_SKU_IGNORE)
681 return -1;
682 goto do_sku;
683 }
684
685 if (!codec->bus->pci)
686 return -1;
687 ass = codec->core.subsystem_id & 0xffff;
688 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
689 goto do_sku;
690
691 nid = 0x1d;
692 if (codec->core.vendor_id == 0x10ec0260)
693 nid = 0x17;
694 ass = snd_hda_codec_get_pincfg(codec, nid);
695
696 if (!(ass & 1)) {
697 codec_info(codec, "%s: SKU not ready 0x%08x\n",
698 codec->core.chip_name, ass);
699 return -1;
700 }
701
702 /* check sum */
703 tmp = 0;
704 for (i = 1; i < 16; i++) {
705 if ((ass >> i) & 1)
706 tmp++;
707 }
708 if (((ass >> 16) & 0xf) != tmp)
709 return -1;
710
711 spec->cdefine.port_connectivity = ass >> 30;
712 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
713 spec->cdefine.check_sum = (ass >> 16) & 0xf;
714 spec->cdefine.customization = ass >> 8;
715do_sku:
716 spec->cdefine.sku_cfg = ass;
717 spec->cdefine.external_amp = (ass & 0x38) >> 3;
718 spec->cdefine.platform_type = (ass & 0x4) >> 2;
719 spec->cdefine.swap = (ass & 0x2) >> 1;
720 spec->cdefine.override = ass & 0x1;
721
722 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
723 nid, spec->cdefine.sku_cfg);
724 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
725 spec->cdefine.port_connectivity);
726 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
727 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
728 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
729 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
730 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
731 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
732 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
733
734 return 0;
735}
736
737/* return the position of NID in the list, or -1 if not found */
738static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
739{
740 int i;
741 for (i = 0; i < nums; i++)
742 if (list[i] == nid)
743 return i;
744 return -1;
745}
746/* return true if the given NID is found in the list */
747static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
748{
749 return find_idx_in_nid_list(nid, list, nums) >= 0;
750}
751
752/* check subsystem ID and set up device-specific initialization;
753 * return 1 if initialized, 0 if invalid SSID
754 */
755/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
756 * 31 ~ 16 : Manufacture ID
757 * 15 ~ 8 : SKU ID
758 * 7 ~ 0 : Assembly ID
759 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
760 */
761static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
762{
763 unsigned int ass, tmp, i;
764 unsigned nid;
765 struct alc_spec *spec = codec->spec;
766
767 if (spec->cdefine.fixup) {
768 ass = spec->cdefine.sku_cfg;
769 if (ass == ALC_FIXUP_SKU_IGNORE)
770 return 0;
771 goto do_sku;
772 }
773
774 ass = codec->core.subsystem_id & 0xffff;
775 if (codec->bus->pci &&
776 ass != codec->bus->pci->subsystem_device && (ass & 1))
777 goto do_sku;
778
779 /* invalid SSID, check the special NID pin defcfg instead */
780 /*
781 * 31~30 : port connectivity
782 * 29~21 : reserve
783 * 20 : PCBEEP input
784 * 19~16 : Check sum (15:1)
785 * 15~1 : Custom
786 * 0 : override
787 */
788 nid = 0x1d;
789 if (codec->core.vendor_id == 0x10ec0260)
790 nid = 0x17;
791 ass = snd_hda_codec_get_pincfg(codec, nid);
792 codec_dbg(codec,
793 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
794 ass, nid);
795 if (!(ass & 1))
796 return 0;
797 if ((ass >> 30) != 1) /* no physical connection */
798 return 0;
799
800 /* check sum */
801 tmp = 0;
802 for (i = 1; i < 16; i++) {
803 if ((ass >> i) & 1)
804 tmp++;
805 }
806 if (((ass >> 16) & 0xf) != tmp)
807 return 0;
808do_sku:
809 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
810 ass & 0xffff, codec->core.vendor_id);
811 /*
812 * 0 : override
813 * 1 : Swap Jack
814 * 2 : 0 --> Desktop, 1 --> Laptop
815 * 3~5 : External Amplifier control
816 * 7~6 : Reserved
817 */
818 tmp = (ass & 0x38) >> 3; /* external Amp control */
819 if (spec->init_amp == ALC_INIT_UNDEFINED) {
820 switch (tmp) {
821 case 1:
822 alc_setup_gpio(codec, 0x01);
823 break;
824 case 3:
825 alc_setup_gpio(codec, 0x02);
826 break;
827 case 7:
828 alc_setup_gpio(codec, 0x03);
829 break;
830 case 5:
831 default:
832 spec->init_amp = ALC_INIT_DEFAULT;
833 break;
834 }
835 }
836
837 /* is laptop or Desktop and enable the function "Mute internal speaker
838 * when the external headphone out jack is plugged"
839 */
840 if (!(ass & 0x8000))
841 return 1;
842 /*
843 * 10~8 : Jack location
844 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
845 * 14~13: Resvered
846 * 15 : 1 --> enable the function "Mute internal speaker
847 * when the external headphone out jack is plugged"
848 */
David Brazdil0f672f62019-12-10 10:32:29 +0000849 if (!alc_get_hp_pin(spec)) {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000850 hda_nid_t nid;
851 tmp = (ass >> 11) & 0x3; /* HP to chassis */
852 nid = ports[tmp];
853 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
854 spec->gen.autocfg.line_outs))
855 return 1;
856 spec->gen.autocfg.hp_pins[0] = nid;
857 }
858 return 1;
859}
860
861/* Check the validity of ALC subsystem-id
862 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
863static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
864{
865 if (!alc_subsystem_id(codec, ports)) {
866 struct alc_spec *spec = codec->spec;
Olivier Deprez0e641232021-09-23 10:07:05 +0200867 if (spec->init_amp == ALC_INIT_UNDEFINED) {
868 codec_dbg(codec,
869 "realtek: Enable default setup for auto mode as fallback\n");
870 spec->init_amp = ALC_INIT_DEFAULT;
871 }
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000872 }
873}
874
875/*
876 */
877
878static void alc_fixup_inv_dmic(struct hda_codec *codec,
879 const struct hda_fixup *fix, int action)
880{
881 struct alc_spec *spec = codec->spec;
882
883 spec->gen.inv_dmic_split = 1;
884}
885
886
887static int alc_build_controls(struct hda_codec *codec)
888{
889 int err;
890
891 err = snd_hda_gen_build_controls(codec);
892 if (err < 0)
893 return err;
894
895 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
896 return 0;
897}
898
899
900/*
901 * Common callbacks
902 */
903
David Brazdil0f672f62019-12-10 10:32:29 +0000904static void alc_pre_init(struct hda_codec *codec)
905{
906 alc_fill_eapd_coef(codec);
907}
908
909#define is_s3_resume(codec) \
910 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
911#define is_s4_resume(codec) \
912 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
913
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000914static int alc_init(struct hda_codec *codec)
915{
916 struct alc_spec *spec = codec->spec;
917
David Brazdil0f672f62019-12-10 10:32:29 +0000918 /* hibernation resume needs the full chip initialization */
919 if (is_s4_resume(codec))
920 alc_pre_init(codec);
921
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000922 if (spec->init_hook)
923 spec->init_hook(codec);
924
David Brazdil0f672f62019-12-10 10:32:29 +0000925 spec->gen.skip_verbs = 1; /* applied in below */
926 snd_hda_gen_init(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000927 alc_fix_pll(codec);
928 alc_auto_init_amp(codec, spec->init_amp);
David Brazdil0f672f62019-12-10 10:32:29 +0000929 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000930
931 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
932
933 return 0;
934}
935
936static inline void alc_shutup(struct hda_codec *codec)
937{
938 struct alc_spec *spec = codec->spec;
939
940 if (!snd_hda_get_bool_hint(codec, "shutup"))
941 return; /* disabled explicitly by hints */
942
943 if (spec && spec->shutup)
944 spec->shutup(codec);
945 else
David Brazdil0f672f62019-12-10 10:32:29 +0000946 alc_shutup_pins(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000947}
948
949static void alc_reboot_notify(struct hda_codec *codec)
950{
951 struct alc_spec *spec = codec->spec;
952
953 if (spec && spec->reboot_notify)
954 spec->reboot_notify(codec);
955 else
956 alc_shutup(codec);
957}
958
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000959#define alc_free snd_hda_gen_free
960
961#ifdef CONFIG_PM
962static void alc_power_eapd(struct hda_codec *codec)
963{
964 alc_auto_setup_eapd(codec, false);
965}
966
967static int alc_suspend(struct hda_codec *codec)
968{
969 struct alc_spec *spec = codec->spec;
970 alc_shutup(codec);
971 if (spec && spec->power_hook)
972 spec->power_hook(codec);
973 return 0;
974}
975#endif
976
977#ifdef CONFIG_PM
978static int alc_resume(struct hda_codec *codec)
979{
980 struct alc_spec *spec = codec->spec;
981
982 if (!spec->no_depop_delay)
983 msleep(150); /* to avoid pop noise */
984 codec->patch_ops.init(codec);
Olivier Deprez0e641232021-09-23 10:07:05 +0200985 snd_hda_regmap_sync(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +0000986 hda_call_check_power_status(codec, 0x01);
987 return 0;
988}
989#endif
990
991/*
992 */
993static const struct hda_codec_ops alc_patch_ops = {
994 .build_controls = alc_build_controls,
995 .build_pcms = snd_hda_gen_build_pcms,
996 .init = alc_init,
997 .free = alc_free,
998 .unsol_event = snd_hda_jack_unsol_event,
999#ifdef CONFIG_PM
1000 .resume = alc_resume,
1001 .suspend = alc_suspend,
1002 .check_power_status = snd_hda_gen_check_power_status,
1003#endif
1004 .reboot_notify = alc_reboot_notify,
1005};
1006
1007
1008#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1009
1010/*
1011 * Rename codecs appropriately from COEF value or subvendor id
1012 */
1013struct alc_codec_rename_table {
1014 unsigned int vendor_id;
1015 unsigned short coef_mask;
1016 unsigned short coef_bits;
1017 const char *name;
1018};
1019
1020struct alc_codec_rename_pci_table {
1021 unsigned int codec_vendor_id;
1022 unsigned short pci_subvendor;
1023 unsigned short pci_subdevice;
1024 const char *name;
1025};
1026
Olivier Deprez0e641232021-09-23 10:07:05 +02001027static const struct alc_codec_rename_table rename_tbl[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001028 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1029 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1030 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1031 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1032 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1033 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1034 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1035 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1036 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1037 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1038 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1039 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1040 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1041 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1042 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1043 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1044 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1045 { } /* terminator */
1046};
1047
Olivier Deprez0e641232021-09-23 10:07:05 +02001048static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001049 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1050 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1051 { 0x10ec0283, 0x1028, 0, "ALC3223" },
1052 { 0x10ec0288, 0x1028, 0, "ALC3263" },
1053 { 0x10ec0292, 0x1028, 0, "ALC3226" },
1054 { 0x10ec0293, 0x1028, 0, "ALC3235" },
1055 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1056 { 0x10ec0668, 0x1028, 0, "ALC3661" },
1057 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1058 { 0x10ec0899, 0x1028, 0, "ALC3861" },
1059 { 0x10ec0298, 0x1028, 0, "ALC3266" },
1060 { 0x10ec0236, 0x1028, 0, "ALC3204" },
1061 { 0x10ec0256, 0x1028, 0, "ALC3246" },
1062 { 0x10ec0225, 0x1028, 0, "ALC3253" },
1063 { 0x10ec0295, 0x1028, 0, "ALC3254" },
1064 { 0x10ec0299, 0x1028, 0, "ALC3271" },
1065 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1066 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1067 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1068 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1069 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1070 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1071 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1072 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1073 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1074 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1075 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1076 { } /* terminator */
1077};
1078
1079static int alc_codec_rename_from_preset(struct hda_codec *codec)
1080{
1081 const struct alc_codec_rename_table *p;
1082 const struct alc_codec_rename_pci_table *q;
1083
1084 for (p = rename_tbl; p->vendor_id; p++) {
1085 if (p->vendor_id != codec->core.vendor_id)
1086 continue;
1087 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1088 return alc_codec_rename(codec, p->name);
1089 }
1090
1091 if (!codec->bus->pci)
1092 return 0;
1093 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1094 if (q->codec_vendor_id != codec->core.vendor_id)
1095 continue;
1096 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1097 continue;
1098 if (!q->pci_subdevice ||
1099 q->pci_subdevice == codec->bus->pci->subsystem_device)
1100 return alc_codec_rename(codec, q->name);
1101 }
1102
1103 return 0;
1104}
1105
1106
1107/*
1108 * Digital-beep handlers
1109 */
1110#ifdef CONFIG_SND_HDA_INPUT_BEEP
1111
1112/* additional beep mixers; private_value will be overwritten */
1113static const struct snd_kcontrol_new alc_beep_mixer[] = {
1114 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1115 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1116};
1117
1118/* set up and create beep controls */
1119static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1120 int idx, int dir)
1121{
1122 struct snd_kcontrol_new *knew;
1123 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1124 int i;
1125
1126 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1127 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1128 &alc_beep_mixer[i]);
1129 if (!knew)
1130 return -ENOMEM;
1131 knew->private_value = beep_amp;
1132 }
1133 return 0;
1134}
1135
Olivier Deprez157378f2022-04-04 15:47:50 +02001136static const struct snd_pci_quirk beep_allow_list[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001137 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1138 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1139 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1140 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1141 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1142 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1143 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1144 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1145 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
Olivier Deprez157378f2022-04-04 15:47:50 +02001146 /* denylist -- no beep available */
David Brazdil0f672f62019-12-10 10:32:29 +00001147 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1148 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001149 {}
1150};
1151
1152static inline int has_cdefine_beep(struct hda_codec *codec)
1153{
1154 struct alc_spec *spec = codec->spec;
1155 const struct snd_pci_quirk *q;
Olivier Deprez157378f2022-04-04 15:47:50 +02001156 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001157 if (q)
1158 return q->value;
1159 return spec->cdefine.enable_pcbeep;
1160}
1161#else
1162#define set_beep_amp(spec, nid, idx, dir) 0
1163#define has_cdefine_beep(codec) 0
1164#endif
1165
1166/* parse the BIOS configuration and set up the alc_spec */
1167/* return 1 if successful, 0 if the proper config is not found,
1168 * or a negative error code
1169 */
1170static int alc_parse_auto_config(struct hda_codec *codec,
1171 const hda_nid_t *ignore_nids,
1172 const hda_nid_t *ssid_nids)
1173{
1174 struct alc_spec *spec = codec->spec;
1175 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1176 int err;
1177
1178 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1179 spec->parse_flags);
1180 if (err < 0)
1181 return err;
1182
1183 if (ssid_nids)
1184 alc_ssid_check(codec, ssid_nids);
1185
1186 err = snd_hda_gen_parse_auto_config(codec, cfg);
1187 if (err < 0)
1188 return err;
1189
1190 return 1;
1191}
1192
1193/* common preparation job for alc_spec */
1194static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1195{
1196 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1197 int err;
1198
1199 if (!spec)
1200 return -ENOMEM;
1201 codec->spec = spec;
1202 snd_hda_gen_spec_init(&spec->gen);
1203 spec->gen.mixer_nid = mixer_nid;
1204 spec->gen.own_eapd_ctl = 1;
1205 codec->single_adc_amp = 1;
1206 /* FIXME: do we need this for all Realtek codec models? */
1207 codec->spdif_status_reset = 1;
Olivier Deprez0e641232021-09-23 10:07:05 +02001208 codec->forced_resume = 1;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001209 codec->patch_ops = alc_patch_ops;
Olivier Deprez157378f2022-04-04 15:47:50 +02001210 mutex_init(&spec->coef_mutex);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001211
1212 err = alc_codec_rename_from_preset(codec);
1213 if (err < 0) {
1214 kfree(spec);
1215 return err;
1216 }
1217 return 0;
1218}
1219
1220static int alc880_parse_auto_config(struct hda_codec *codec)
1221{
1222 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1223 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1224 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1225}
1226
1227/*
1228 * ALC880 fix-ups
1229 */
1230enum {
1231 ALC880_FIXUP_GPIO1,
1232 ALC880_FIXUP_GPIO2,
1233 ALC880_FIXUP_MEDION_RIM,
1234 ALC880_FIXUP_LG,
1235 ALC880_FIXUP_LG_LW25,
1236 ALC880_FIXUP_W810,
1237 ALC880_FIXUP_EAPD_COEF,
1238 ALC880_FIXUP_TCL_S700,
1239 ALC880_FIXUP_VOL_KNOB,
1240 ALC880_FIXUP_FUJITSU,
1241 ALC880_FIXUP_F1734,
1242 ALC880_FIXUP_UNIWILL,
1243 ALC880_FIXUP_UNIWILL_DIG,
1244 ALC880_FIXUP_Z71V,
1245 ALC880_FIXUP_ASUS_W5A,
1246 ALC880_FIXUP_3ST_BASE,
1247 ALC880_FIXUP_3ST,
1248 ALC880_FIXUP_3ST_DIG,
1249 ALC880_FIXUP_5ST_BASE,
1250 ALC880_FIXUP_5ST,
1251 ALC880_FIXUP_5ST_DIG,
1252 ALC880_FIXUP_6ST_BASE,
1253 ALC880_FIXUP_6ST,
1254 ALC880_FIXUP_6ST_DIG,
1255 ALC880_FIXUP_6ST_AUTOMUTE,
1256};
1257
1258/* enable the volume-knob widget support on NID 0x21 */
1259static void alc880_fixup_vol_knob(struct hda_codec *codec,
1260 const struct hda_fixup *fix, int action)
1261{
1262 if (action == HDA_FIXUP_ACT_PROBE)
1263 snd_hda_jack_detect_enable_callback(codec, 0x21,
1264 alc_update_knob_master);
1265}
1266
1267static const struct hda_fixup alc880_fixups[] = {
1268 [ALC880_FIXUP_GPIO1] = {
1269 .type = HDA_FIXUP_FUNC,
1270 .v.func = alc_fixup_gpio1,
1271 },
1272 [ALC880_FIXUP_GPIO2] = {
1273 .type = HDA_FIXUP_FUNC,
1274 .v.func = alc_fixup_gpio2,
1275 },
1276 [ALC880_FIXUP_MEDION_RIM] = {
1277 .type = HDA_FIXUP_VERBS,
1278 .v.verbs = (const struct hda_verb[]) {
1279 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1280 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1281 { }
1282 },
1283 .chained = true,
1284 .chain_id = ALC880_FIXUP_GPIO2,
1285 },
1286 [ALC880_FIXUP_LG] = {
1287 .type = HDA_FIXUP_PINS,
1288 .v.pins = (const struct hda_pintbl[]) {
1289 /* disable bogus unused pins */
1290 { 0x16, 0x411111f0 },
1291 { 0x18, 0x411111f0 },
1292 { 0x1a, 0x411111f0 },
1293 { }
1294 }
1295 },
1296 [ALC880_FIXUP_LG_LW25] = {
1297 .type = HDA_FIXUP_PINS,
1298 .v.pins = (const struct hda_pintbl[]) {
1299 { 0x1a, 0x0181344f }, /* line-in */
1300 { 0x1b, 0x0321403f }, /* headphone */
1301 { }
1302 }
1303 },
1304 [ALC880_FIXUP_W810] = {
1305 .type = HDA_FIXUP_PINS,
1306 .v.pins = (const struct hda_pintbl[]) {
1307 /* disable bogus unused pins */
1308 { 0x17, 0x411111f0 },
1309 { }
1310 },
1311 .chained = true,
1312 .chain_id = ALC880_FIXUP_GPIO2,
1313 },
1314 [ALC880_FIXUP_EAPD_COEF] = {
1315 .type = HDA_FIXUP_VERBS,
1316 .v.verbs = (const struct hda_verb[]) {
1317 /* change to EAPD mode */
1318 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1319 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1320 {}
1321 },
1322 },
1323 [ALC880_FIXUP_TCL_S700] = {
1324 .type = HDA_FIXUP_VERBS,
1325 .v.verbs = (const struct hda_verb[]) {
1326 /* change to EAPD mode */
1327 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1328 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1329 {}
1330 },
1331 .chained = true,
1332 .chain_id = ALC880_FIXUP_GPIO2,
1333 },
1334 [ALC880_FIXUP_VOL_KNOB] = {
1335 .type = HDA_FIXUP_FUNC,
1336 .v.func = alc880_fixup_vol_knob,
1337 },
1338 [ALC880_FIXUP_FUJITSU] = {
1339 /* override all pins as BIOS on old Amilo is broken */
1340 .type = HDA_FIXUP_PINS,
1341 .v.pins = (const struct hda_pintbl[]) {
1342 { 0x14, 0x0121401f }, /* HP */
1343 { 0x15, 0x99030120 }, /* speaker */
1344 { 0x16, 0x99030130 }, /* bass speaker */
1345 { 0x17, 0x411111f0 }, /* N/A */
1346 { 0x18, 0x411111f0 }, /* N/A */
1347 { 0x19, 0x01a19950 }, /* mic-in */
1348 { 0x1a, 0x411111f0 }, /* N/A */
1349 { 0x1b, 0x411111f0 }, /* N/A */
1350 { 0x1c, 0x411111f0 }, /* N/A */
1351 { 0x1d, 0x411111f0 }, /* N/A */
1352 { 0x1e, 0x01454140 }, /* SPDIF out */
1353 { }
1354 },
1355 .chained = true,
1356 .chain_id = ALC880_FIXUP_VOL_KNOB,
1357 },
1358 [ALC880_FIXUP_F1734] = {
1359 /* almost compatible with FUJITSU, but no bass and SPDIF */
1360 .type = HDA_FIXUP_PINS,
1361 .v.pins = (const struct hda_pintbl[]) {
1362 { 0x14, 0x0121401f }, /* HP */
1363 { 0x15, 0x99030120 }, /* speaker */
1364 { 0x16, 0x411111f0 }, /* N/A */
1365 { 0x17, 0x411111f0 }, /* N/A */
1366 { 0x18, 0x411111f0 }, /* N/A */
1367 { 0x19, 0x01a19950 }, /* mic-in */
1368 { 0x1a, 0x411111f0 }, /* N/A */
1369 { 0x1b, 0x411111f0 }, /* N/A */
1370 { 0x1c, 0x411111f0 }, /* N/A */
1371 { 0x1d, 0x411111f0 }, /* N/A */
1372 { 0x1e, 0x411111f0 }, /* N/A */
1373 { }
1374 },
1375 .chained = true,
1376 .chain_id = ALC880_FIXUP_VOL_KNOB,
1377 },
1378 [ALC880_FIXUP_UNIWILL] = {
1379 /* need to fix HP and speaker pins to be parsed correctly */
1380 .type = HDA_FIXUP_PINS,
1381 .v.pins = (const struct hda_pintbl[]) {
1382 { 0x14, 0x0121411f }, /* HP */
1383 { 0x15, 0x99030120 }, /* speaker */
1384 { 0x16, 0x99030130 }, /* bass speaker */
1385 { }
1386 },
1387 },
1388 [ALC880_FIXUP_UNIWILL_DIG] = {
1389 .type = HDA_FIXUP_PINS,
1390 .v.pins = (const struct hda_pintbl[]) {
1391 /* disable bogus unused pins */
1392 { 0x17, 0x411111f0 },
1393 { 0x19, 0x411111f0 },
1394 { 0x1b, 0x411111f0 },
1395 { 0x1f, 0x411111f0 },
1396 { }
1397 }
1398 },
1399 [ALC880_FIXUP_Z71V] = {
1400 .type = HDA_FIXUP_PINS,
1401 .v.pins = (const struct hda_pintbl[]) {
1402 /* set up the whole pins as BIOS is utterly broken */
1403 { 0x14, 0x99030120 }, /* speaker */
1404 { 0x15, 0x0121411f }, /* HP */
1405 { 0x16, 0x411111f0 }, /* N/A */
1406 { 0x17, 0x411111f0 }, /* N/A */
1407 { 0x18, 0x01a19950 }, /* mic-in */
1408 { 0x19, 0x411111f0 }, /* N/A */
1409 { 0x1a, 0x01813031 }, /* line-in */
1410 { 0x1b, 0x411111f0 }, /* N/A */
1411 { 0x1c, 0x411111f0 }, /* N/A */
1412 { 0x1d, 0x411111f0 }, /* N/A */
1413 { 0x1e, 0x0144111e }, /* SPDIF */
1414 { }
1415 }
1416 },
1417 [ALC880_FIXUP_ASUS_W5A] = {
1418 .type = HDA_FIXUP_PINS,
1419 .v.pins = (const struct hda_pintbl[]) {
1420 /* set up the whole pins as BIOS is utterly broken */
1421 { 0x14, 0x0121411f }, /* HP */
1422 { 0x15, 0x411111f0 }, /* N/A */
1423 { 0x16, 0x411111f0 }, /* N/A */
1424 { 0x17, 0x411111f0 }, /* N/A */
1425 { 0x18, 0x90a60160 }, /* mic */
1426 { 0x19, 0x411111f0 }, /* N/A */
1427 { 0x1a, 0x411111f0 }, /* N/A */
1428 { 0x1b, 0x411111f0 }, /* N/A */
1429 { 0x1c, 0x411111f0 }, /* N/A */
1430 { 0x1d, 0x411111f0 }, /* N/A */
1431 { 0x1e, 0xb743111e }, /* SPDIF out */
1432 { }
1433 },
1434 .chained = true,
1435 .chain_id = ALC880_FIXUP_GPIO1,
1436 },
1437 [ALC880_FIXUP_3ST_BASE] = {
1438 .type = HDA_FIXUP_PINS,
1439 .v.pins = (const struct hda_pintbl[]) {
1440 { 0x14, 0x01014010 }, /* line-out */
1441 { 0x15, 0x411111f0 }, /* N/A */
1442 { 0x16, 0x411111f0 }, /* N/A */
1443 { 0x17, 0x411111f0 }, /* N/A */
1444 { 0x18, 0x01a19c30 }, /* mic-in */
1445 { 0x19, 0x0121411f }, /* HP */
1446 { 0x1a, 0x01813031 }, /* line-in */
1447 { 0x1b, 0x02a19c40 }, /* front-mic */
1448 { 0x1c, 0x411111f0 }, /* N/A */
1449 { 0x1d, 0x411111f0 }, /* N/A */
1450 /* 0x1e is filled in below */
1451 { 0x1f, 0x411111f0 }, /* N/A */
1452 { }
1453 }
1454 },
1455 [ALC880_FIXUP_3ST] = {
1456 .type = HDA_FIXUP_PINS,
1457 .v.pins = (const struct hda_pintbl[]) {
1458 { 0x1e, 0x411111f0 }, /* N/A */
1459 { }
1460 },
1461 .chained = true,
1462 .chain_id = ALC880_FIXUP_3ST_BASE,
1463 },
1464 [ALC880_FIXUP_3ST_DIG] = {
1465 .type = HDA_FIXUP_PINS,
1466 .v.pins = (const struct hda_pintbl[]) {
1467 { 0x1e, 0x0144111e }, /* SPDIF */
1468 { }
1469 },
1470 .chained = true,
1471 .chain_id = ALC880_FIXUP_3ST_BASE,
1472 },
1473 [ALC880_FIXUP_5ST_BASE] = {
1474 .type = HDA_FIXUP_PINS,
1475 .v.pins = (const struct hda_pintbl[]) {
1476 { 0x14, 0x01014010 }, /* front */
1477 { 0x15, 0x411111f0 }, /* N/A */
1478 { 0x16, 0x01011411 }, /* CLFE */
1479 { 0x17, 0x01016412 }, /* surr */
1480 { 0x18, 0x01a19c30 }, /* mic-in */
1481 { 0x19, 0x0121411f }, /* HP */
1482 { 0x1a, 0x01813031 }, /* line-in */
1483 { 0x1b, 0x02a19c40 }, /* front-mic */
1484 { 0x1c, 0x411111f0 }, /* N/A */
1485 { 0x1d, 0x411111f0 }, /* N/A */
1486 /* 0x1e is filled in below */
1487 { 0x1f, 0x411111f0 }, /* N/A */
1488 { }
1489 }
1490 },
1491 [ALC880_FIXUP_5ST] = {
1492 .type = HDA_FIXUP_PINS,
1493 .v.pins = (const struct hda_pintbl[]) {
1494 { 0x1e, 0x411111f0 }, /* N/A */
1495 { }
1496 },
1497 .chained = true,
1498 .chain_id = ALC880_FIXUP_5ST_BASE,
1499 },
1500 [ALC880_FIXUP_5ST_DIG] = {
1501 .type = HDA_FIXUP_PINS,
1502 .v.pins = (const struct hda_pintbl[]) {
1503 { 0x1e, 0x0144111e }, /* SPDIF */
1504 { }
1505 },
1506 .chained = true,
1507 .chain_id = ALC880_FIXUP_5ST_BASE,
1508 },
1509 [ALC880_FIXUP_6ST_BASE] = {
1510 .type = HDA_FIXUP_PINS,
1511 .v.pins = (const struct hda_pintbl[]) {
1512 { 0x14, 0x01014010 }, /* front */
1513 { 0x15, 0x01016412 }, /* surr */
1514 { 0x16, 0x01011411 }, /* CLFE */
1515 { 0x17, 0x01012414 }, /* side */
1516 { 0x18, 0x01a19c30 }, /* mic-in */
1517 { 0x19, 0x02a19c40 }, /* front-mic */
1518 { 0x1a, 0x01813031 }, /* line-in */
1519 { 0x1b, 0x0121411f }, /* HP */
1520 { 0x1c, 0x411111f0 }, /* N/A */
1521 { 0x1d, 0x411111f0 }, /* N/A */
1522 /* 0x1e is filled in below */
1523 { 0x1f, 0x411111f0 }, /* N/A */
1524 { }
1525 }
1526 },
1527 [ALC880_FIXUP_6ST] = {
1528 .type = HDA_FIXUP_PINS,
1529 .v.pins = (const struct hda_pintbl[]) {
1530 { 0x1e, 0x411111f0 }, /* N/A */
1531 { }
1532 },
1533 .chained = true,
1534 .chain_id = ALC880_FIXUP_6ST_BASE,
1535 },
1536 [ALC880_FIXUP_6ST_DIG] = {
1537 .type = HDA_FIXUP_PINS,
1538 .v.pins = (const struct hda_pintbl[]) {
1539 { 0x1e, 0x0144111e }, /* SPDIF */
1540 { }
1541 },
1542 .chained = true,
1543 .chain_id = ALC880_FIXUP_6ST_BASE,
1544 },
1545 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1546 .type = HDA_FIXUP_PINS,
1547 .v.pins = (const struct hda_pintbl[]) {
1548 { 0x1b, 0x0121401f }, /* HP with jack detect */
1549 { }
1550 },
1551 .chained_before = true,
1552 .chain_id = ALC880_FIXUP_6ST_BASE,
1553 },
1554};
1555
1556static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1557 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1558 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1559 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1560 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1561 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1562 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1563 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1564 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1565 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1566 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1567 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1568 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1569 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1570 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1571 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1572 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1573 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1574 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1575 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1576 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1577 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1578 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1579 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1580
1581 /* Below is the copied entries from alc880_quirks.c.
1582 * It's not quite sure whether BIOS sets the correct pin-config table
1583 * on these machines, thus they are kept to be compatible with
1584 * the old static quirks. Once when it's confirmed to work without
1585 * these overrides, it'd be better to remove.
1586 */
1587 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1588 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1589 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1590 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1591 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1592 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1593 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1594 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1595 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1596 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1597 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1598 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1599 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1600 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1601 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1602 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1603 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1604 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1605 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1606 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1607 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1608 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1609 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1610 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1611 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1612 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1613 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1614 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1615 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1616 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1617 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1618 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1619 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1620 /* default Intel */
1621 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1622 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1623 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1624 {}
1625};
1626
1627static const struct hda_model_fixup alc880_fixup_models[] = {
1628 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1629 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1630 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1631 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1632 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1633 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1634 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1635 {}
1636};
1637
1638
1639/*
1640 * OK, here we have finally the patch for ALC880
1641 */
1642static int patch_alc880(struct hda_codec *codec)
1643{
1644 struct alc_spec *spec;
1645 int err;
1646
1647 err = alc_alloc_spec(codec, 0x0b);
1648 if (err < 0)
1649 return err;
1650
1651 spec = codec->spec;
1652 spec->gen.need_dac_fix = 1;
1653 spec->gen.beep_nid = 0x01;
1654
1655 codec->patch_ops.unsol_event = alc880_unsol_event;
1656
David Brazdil0f672f62019-12-10 10:32:29 +00001657 alc_pre_init(codec);
1658
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001659 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1660 alc880_fixups);
1661 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1662
1663 /* automatic parse from the BIOS config */
1664 err = alc880_parse_auto_config(codec);
1665 if (err < 0)
1666 goto error;
1667
1668 if (!spec->gen.no_analog) {
1669 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1670 if (err < 0)
1671 goto error;
1672 }
1673
1674 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1675
1676 return 0;
1677
1678 error:
1679 alc_free(codec);
1680 return err;
1681}
1682
1683
1684/*
1685 * ALC260 support
1686 */
1687static int alc260_parse_auto_config(struct hda_codec *codec)
1688{
1689 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1690 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1691 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1692}
1693
1694/*
1695 * Pin config fixes
1696 */
1697enum {
1698 ALC260_FIXUP_HP_DC5750,
1699 ALC260_FIXUP_HP_PIN_0F,
1700 ALC260_FIXUP_COEF,
1701 ALC260_FIXUP_GPIO1,
1702 ALC260_FIXUP_GPIO1_TOGGLE,
1703 ALC260_FIXUP_REPLACER,
1704 ALC260_FIXUP_HP_B1900,
1705 ALC260_FIXUP_KN1,
1706 ALC260_FIXUP_FSC_S7020,
1707 ALC260_FIXUP_FSC_S7020_JWSE,
1708 ALC260_FIXUP_VAIO_PINS,
1709};
1710
1711static void alc260_gpio1_automute(struct hda_codec *codec)
1712{
1713 struct alc_spec *spec = codec->spec;
1714
1715 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1716}
1717
1718static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1719 const struct hda_fixup *fix, int action)
1720{
1721 struct alc_spec *spec = codec->spec;
1722 if (action == HDA_FIXUP_ACT_PROBE) {
1723 /* although the machine has only one output pin, we need to
1724 * toggle GPIO1 according to the jack state
1725 */
1726 spec->gen.automute_hook = alc260_gpio1_automute;
1727 spec->gen.detect_hp = 1;
1728 spec->gen.automute_speaker = 1;
1729 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1730 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1731 snd_hda_gen_hp_automute);
1732 alc_setup_gpio(codec, 0x01);
1733 }
1734}
1735
1736static void alc260_fixup_kn1(struct hda_codec *codec,
1737 const struct hda_fixup *fix, int action)
1738{
1739 struct alc_spec *spec = codec->spec;
1740 static const struct hda_pintbl pincfgs[] = {
1741 { 0x0f, 0x02214000 }, /* HP/speaker */
1742 { 0x12, 0x90a60160 }, /* int mic */
1743 { 0x13, 0x02a19000 }, /* ext mic */
1744 { 0x18, 0x01446000 }, /* SPDIF out */
1745 /* disable bogus I/O pins */
1746 { 0x10, 0x411111f0 },
1747 { 0x11, 0x411111f0 },
1748 { 0x14, 0x411111f0 },
1749 { 0x15, 0x411111f0 },
1750 { 0x16, 0x411111f0 },
1751 { 0x17, 0x411111f0 },
1752 { 0x19, 0x411111f0 },
1753 { }
1754 };
1755
1756 switch (action) {
1757 case HDA_FIXUP_ACT_PRE_PROBE:
1758 snd_hda_apply_pincfgs(codec, pincfgs);
1759 spec->init_amp = ALC_INIT_NONE;
1760 break;
1761 }
1762}
1763
1764static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1765 const struct hda_fixup *fix, int action)
1766{
1767 struct alc_spec *spec = codec->spec;
1768 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1769 spec->init_amp = ALC_INIT_NONE;
1770}
1771
1772static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1773 const struct hda_fixup *fix, int action)
1774{
1775 struct alc_spec *spec = codec->spec;
1776 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1777 spec->gen.add_jack_modes = 1;
1778 spec->gen.hp_mic = 1;
1779 }
1780}
1781
1782static const struct hda_fixup alc260_fixups[] = {
1783 [ALC260_FIXUP_HP_DC5750] = {
1784 .type = HDA_FIXUP_PINS,
1785 .v.pins = (const struct hda_pintbl[]) {
1786 { 0x11, 0x90130110 }, /* speaker */
1787 { }
1788 }
1789 },
1790 [ALC260_FIXUP_HP_PIN_0F] = {
1791 .type = HDA_FIXUP_PINS,
1792 .v.pins = (const struct hda_pintbl[]) {
1793 { 0x0f, 0x01214000 }, /* HP */
1794 { }
1795 }
1796 },
1797 [ALC260_FIXUP_COEF] = {
1798 .type = HDA_FIXUP_VERBS,
1799 .v.verbs = (const struct hda_verb[]) {
1800 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1801 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1802 { }
1803 },
1804 },
1805 [ALC260_FIXUP_GPIO1] = {
1806 .type = HDA_FIXUP_FUNC,
1807 .v.func = alc_fixup_gpio1,
1808 },
1809 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1810 .type = HDA_FIXUP_FUNC,
1811 .v.func = alc260_fixup_gpio1_toggle,
1812 .chained = true,
1813 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1814 },
1815 [ALC260_FIXUP_REPLACER] = {
1816 .type = HDA_FIXUP_VERBS,
1817 .v.verbs = (const struct hda_verb[]) {
1818 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1819 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1820 { }
1821 },
1822 .chained = true,
1823 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1824 },
1825 [ALC260_FIXUP_HP_B1900] = {
1826 .type = HDA_FIXUP_FUNC,
1827 .v.func = alc260_fixup_gpio1_toggle,
1828 .chained = true,
1829 .chain_id = ALC260_FIXUP_COEF,
1830 },
1831 [ALC260_FIXUP_KN1] = {
1832 .type = HDA_FIXUP_FUNC,
1833 .v.func = alc260_fixup_kn1,
1834 },
1835 [ALC260_FIXUP_FSC_S7020] = {
1836 .type = HDA_FIXUP_FUNC,
1837 .v.func = alc260_fixup_fsc_s7020,
1838 },
1839 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1840 .type = HDA_FIXUP_FUNC,
1841 .v.func = alc260_fixup_fsc_s7020_jwse,
1842 .chained = true,
1843 .chain_id = ALC260_FIXUP_FSC_S7020,
1844 },
1845 [ALC260_FIXUP_VAIO_PINS] = {
1846 .type = HDA_FIXUP_PINS,
1847 .v.pins = (const struct hda_pintbl[]) {
1848 /* Pin configs are missing completely on some VAIOs */
1849 { 0x0f, 0x01211020 },
1850 { 0x10, 0x0001003f },
1851 { 0x11, 0x411111f0 },
1852 { 0x12, 0x01a15930 },
1853 { 0x13, 0x411111f0 },
1854 { 0x14, 0x411111f0 },
1855 { 0x15, 0x411111f0 },
1856 { 0x16, 0x411111f0 },
1857 { 0x17, 0x411111f0 },
1858 { 0x18, 0x411111f0 },
1859 { 0x19, 0x411111f0 },
1860 { }
1861 }
1862 },
1863};
1864
1865static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1866 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1867 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1868 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1869 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1870 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1871 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1872 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1873 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1874 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1875 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1876 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1877 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1878 {}
1879};
1880
1881static const struct hda_model_fixup alc260_fixup_models[] = {
1882 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1883 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1884 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1885 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1886 {}
1887};
1888
1889/*
1890 */
1891static int patch_alc260(struct hda_codec *codec)
1892{
1893 struct alc_spec *spec;
1894 int err;
1895
1896 err = alc_alloc_spec(codec, 0x07);
1897 if (err < 0)
1898 return err;
1899
1900 spec = codec->spec;
1901 /* as quite a few machines require HP amp for speaker outputs,
1902 * it's easier to enable it unconditionally; even if it's unneeded,
1903 * it's almost harmless.
1904 */
1905 spec->gen.prefer_hp_amp = 1;
1906 spec->gen.beep_nid = 0x01;
1907
1908 spec->shutup = alc_eapd_shutup;
1909
David Brazdil0f672f62019-12-10 10:32:29 +00001910 alc_pre_init(codec);
1911
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001912 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1913 alc260_fixups);
1914 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1915
1916 /* automatic parse from the BIOS config */
1917 err = alc260_parse_auto_config(codec);
1918 if (err < 0)
1919 goto error;
1920
1921 if (!spec->gen.no_analog) {
1922 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1923 if (err < 0)
1924 goto error;
1925 }
1926
1927 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1928
1929 return 0;
1930
1931 error:
1932 alc_free(codec);
1933 return err;
1934}
1935
1936
1937/*
1938 * ALC882/883/885/888/889 support
1939 *
1940 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1941 * configuration. Each pin widget can choose any input DACs and a mixer.
1942 * Each ADC is connected from a mixer of all inputs. This makes possible
1943 * 6-channel independent captures.
1944 *
1945 * In addition, an independent DAC for the multi-playback (not used in this
1946 * driver yet).
1947 */
1948
1949/*
1950 * Pin config fixes
1951 */
1952enum {
1953 ALC882_FIXUP_ABIT_AW9D_MAX,
1954 ALC882_FIXUP_LENOVO_Y530,
1955 ALC882_FIXUP_PB_M5210,
1956 ALC882_FIXUP_ACER_ASPIRE_7736,
1957 ALC882_FIXUP_ASUS_W90V,
1958 ALC889_FIXUP_CD,
1959 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1960 ALC889_FIXUP_VAIO_TT,
1961 ALC888_FIXUP_EEE1601,
Olivier Deprez0e641232021-09-23 10:07:05 +02001962 ALC886_FIXUP_EAPD,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001963 ALC882_FIXUP_EAPD,
1964 ALC883_FIXUP_EAPD,
1965 ALC883_FIXUP_ACER_EAPD,
1966 ALC882_FIXUP_GPIO1,
1967 ALC882_FIXUP_GPIO2,
1968 ALC882_FIXUP_GPIO3,
1969 ALC889_FIXUP_COEF,
1970 ALC882_FIXUP_ASUS_W2JC,
1971 ALC882_FIXUP_ACER_ASPIRE_4930G,
1972 ALC882_FIXUP_ACER_ASPIRE_8930G,
1973 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1974 ALC885_FIXUP_MACPRO_GPIO,
1975 ALC889_FIXUP_DAC_ROUTE,
1976 ALC889_FIXUP_MBP_VREF,
1977 ALC889_FIXUP_IMAC91_VREF,
1978 ALC889_FIXUP_MBA11_VREF,
1979 ALC889_FIXUP_MBA21_VREF,
1980 ALC889_FIXUP_MP11_VREF,
1981 ALC889_FIXUP_MP41_VREF,
1982 ALC882_FIXUP_INV_DMIC,
1983 ALC882_FIXUP_NO_PRIMARY_HP,
1984 ALC887_FIXUP_ASUS_BASS,
1985 ALC887_FIXUP_BASS_CHMAP,
1986 ALC1220_FIXUP_GB_DUAL_CODECS,
Olivier Deprez157378f2022-04-04 15:47:50 +02001987 ALC1220_FIXUP_GB_X570,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001988 ALC1220_FIXUP_CLEVO_P950,
David Brazdil0f672f62019-12-10 10:32:29 +00001989 ALC1220_FIXUP_CLEVO_PB51ED,
1990 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Olivier Deprez0e641232021-09-23 10:07:05 +02001991 ALC887_FIXUP_ASUS_AUDIO,
1992 ALC887_FIXUP_ASUS_HMIC,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001993};
1994
1995static void alc889_fixup_coef(struct hda_codec *codec,
1996 const struct hda_fixup *fix, int action)
1997{
1998 if (action != HDA_FIXUP_ACT_INIT)
1999 return;
2000 alc_update_coef_idx(codec, 7, 0, 0x2030);
2001}
2002
2003/* set up GPIO at initialization */
2004static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2005 const struct hda_fixup *fix, int action)
2006{
2007 struct alc_spec *spec = codec->spec;
2008
2009 spec->gpio_write_delay = true;
2010 alc_fixup_gpio3(codec, fix, action);
2011}
2012
2013/* Fix the connection of some pins for ALC889:
2014 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2015 * work correctly (bko#42740)
2016 */
2017static void alc889_fixup_dac_route(struct hda_codec *codec,
2018 const struct hda_fixup *fix, int action)
2019{
2020 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2021 /* fake the connections during parsing the tree */
Olivier Deprez0e641232021-09-23 10:07:05 +02002022 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2023 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2024 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2025 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2026 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2027 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002028 } else if (action == HDA_FIXUP_ACT_PROBE) {
2029 /* restore the connections */
Olivier Deprez0e641232021-09-23 10:07:05 +02002030 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2031 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2032 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2033 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2034 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002035 }
2036}
2037
2038/* Set VREF on HP pin */
2039static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2040 const struct hda_fixup *fix, int action)
2041{
Olivier Deprez0e641232021-09-23 10:07:05 +02002042 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002043 struct alc_spec *spec = codec->spec;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002044 int i;
2045
2046 if (action != HDA_FIXUP_ACT_INIT)
2047 return;
2048 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2049 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2050 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2051 continue;
2052 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2053 val |= AC_PINCTL_VREF_80;
2054 snd_hda_set_pin_ctl(codec, nids[i], val);
2055 spec->gen.keep_vref_in_automute = 1;
2056 break;
2057 }
2058}
2059
2060static void alc889_fixup_mac_pins(struct hda_codec *codec,
2061 const hda_nid_t *nids, int num_nids)
2062{
2063 struct alc_spec *spec = codec->spec;
2064 int i;
2065
2066 for (i = 0; i < num_nids; i++) {
2067 unsigned int val;
2068 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2069 val |= AC_PINCTL_VREF_50;
2070 snd_hda_set_pin_ctl(codec, nids[i], val);
2071 }
2072 spec->gen.keep_vref_in_automute = 1;
2073}
2074
2075/* Set VREF on speaker pins on imac91 */
2076static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2077 const struct hda_fixup *fix, int action)
2078{
Olivier Deprez0e641232021-09-23 10:07:05 +02002079 static const hda_nid_t nids[] = { 0x18, 0x1a };
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002080
2081 if (action == HDA_FIXUP_ACT_INIT)
2082 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2083}
2084
2085/* Set VREF on speaker pins on mba11 */
2086static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2087 const struct hda_fixup *fix, int action)
2088{
Olivier Deprez0e641232021-09-23 10:07:05 +02002089 static const hda_nid_t nids[] = { 0x18 };
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002090
2091 if (action == HDA_FIXUP_ACT_INIT)
2092 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2093}
2094
2095/* Set VREF on speaker pins on mba21 */
2096static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2097 const struct hda_fixup *fix, int action)
2098{
Olivier Deprez0e641232021-09-23 10:07:05 +02002099 static const hda_nid_t nids[] = { 0x18, 0x19 };
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002100
2101 if (action == HDA_FIXUP_ACT_INIT)
2102 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2103}
2104
2105/* Don't take HP output as primary
2106 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2107 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2108 */
2109static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2110 const struct hda_fixup *fix, int action)
2111{
2112 struct alc_spec *spec = codec->spec;
2113 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2114 spec->gen.no_primary_hp = 1;
2115 spec->gen.no_multi_io = 1;
2116 }
2117}
2118
2119static void alc_fixup_bass_chmap(struct hda_codec *codec,
2120 const struct hda_fixup *fix, int action);
2121
2122/* For dual-codec configuration, we need to disable some features to avoid
2123 * conflicts of kctls and PCM streams
2124 */
2125static void alc_fixup_dual_codecs(struct hda_codec *codec,
2126 const struct hda_fixup *fix, int action)
2127{
2128 struct alc_spec *spec = codec->spec;
2129
2130 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2131 return;
2132 /* disable vmaster */
2133 spec->gen.suppress_vmaster = 1;
2134 /* auto-mute and auto-mic switch don't work with multiple codecs */
2135 spec->gen.suppress_auto_mute = 1;
2136 spec->gen.suppress_auto_mic = 1;
2137 /* disable aamix as well */
2138 spec->gen.mixer_nid = 0;
2139 /* add location prefix to avoid conflicts */
2140 codec->force_pin_prefix = 1;
2141}
2142
2143static void rename_ctl(struct hda_codec *codec, const char *oldname,
2144 const char *newname)
2145{
2146 struct snd_kcontrol *kctl;
2147
2148 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2149 if (kctl)
2150 strcpy(kctl->id.name, newname);
2151}
2152
2153static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2154 const struct hda_fixup *fix,
2155 int action)
2156{
2157 alc_fixup_dual_codecs(codec, fix, action);
2158 switch (action) {
2159 case HDA_FIXUP_ACT_PRE_PROBE:
2160 /* override card longname to provide a unique UCM profile */
2161 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2162 break;
2163 case HDA_FIXUP_ACT_BUILD:
2164 /* rename Capture controls depending on the codec */
2165 rename_ctl(codec, "Capture Volume",
2166 codec->addr == 0 ?
2167 "Rear-Panel Capture Volume" :
2168 "Front-Panel Capture Volume");
2169 rename_ctl(codec, "Capture Switch",
2170 codec->addr == 0 ?
2171 "Rear-Panel Capture Switch" :
2172 "Front-Panel Capture Switch");
2173 break;
2174 }
2175}
2176
Olivier Deprez157378f2022-04-04 15:47:50 +02002177static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2178 const struct hda_fixup *fix,
2179 int action)
2180{
2181 static const hda_nid_t conn1[] = { 0x0c };
2182 static const struct coef_fw gb_x570_coefs[] = {
2183 WRITE_COEF(0x07, 0x03c0),
2184 WRITE_COEF(0x1a, 0x01c1),
2185 WRITE_COEF(0x1b, 0x0202),
2186 WRITE_COEF(0x43, 0x3005),
2187 {}
2188 };
2189
2190 switch (action) {
2191 case HDA_FIXUP_ACT_PRE_PROBE:
2192 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2193 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2194 break;
2195 case HDA_FIXUP_ACT_INIT:
2196 alc_process_coef_fw(codec, gb_x570_coefs);
2197 break;
2198 }
2199}
2200
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002201static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2202 const struct hda_fixup *fix,
2203 int action)
2204{
Olivier Deprez0e641232021-09-23 10:07:05 +02002205 static const hda_nid_t conn1[] = { 0x0c };
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002206
2207 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2208 return;
2209
2210 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2211 /* We therefore want to make sure 0x14 (front headphone) and
2212 * 0x1b (speakers) use the stereo DAC 0x02
2213 */
Olivier Deprez0e641232021-09-23 10:07:05 +02002214 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2215 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002216}
2217
David Brazdil0f672f62019-12-10 10:32:29 +00002218static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2219 const struct hda_fixup *fix, int action);
2220
2221static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2222 const struct hda_fixup *fix,
2223 int action)
2224{
2225 alc1220_fixup_clevo_p950(codec, fix, action);
2226 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2227}
2228
Olivier Deprez0e641232021-09-23 10:07:05 +02002229static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2230 struct hda_jack_callback *jack)
2231{
2232 struct alc_spec *spec = codec->spec;
2233 unsigned int vref;
2234
2235 snd_hda_gen_hp_automute(codec, jack);
2236
2237 if (spec->gen.hp_jack_present)
2238 vref = AC_PINCTL_VREF_80;
2239 else
2240 vref = AC_PINCTL_VREF_HIZ;
2241 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2242}
2243
2244static void alc887_fixup_asus_jack(struct hda_codec *codec,
2245 const struct hda_fixup *fix, int action)
2246{
2247 struct alc_spec *spec = codec->spec;
2248 if (action != HDA_FIXUP_ACT_PROBE)
2249 return;
2250 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2251 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2252}
2253
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002254static const struct hda_fixup alc882_fixups[] = {
2255 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2256 .type = HDA_FIXUP_PINS,
2257 .v.pins = (const struct hda_pintbl[]) {
2258 { 0x15, 0x01080104 }, /* side */
2259 { 0x16, 0x01011012 }, /* rear */
2260 { 0x17, 0x01016011 }, /* clfe */
2261 { }
2262 }
2263 },
2264 [ALC882_FIXUP_LENOVO_Y530] = {
2265 .type = HDA_FIXUP_PINS,
2266 .v.pins = (const struct hda_pintbl[]) {
2267 { 0x15, 0x99130112 }, /* rear int speakers */
2268 { 0x16, 0x99130111 }, /* subwoofer */
2269 { }
2270 }
2271 },
2272 [ALC882_FIXUP_PB_M5210] = {
2273 .type = HDA_FIXUP_PINCTLS,
2274 .v.pins = (const struct hda_pintbl[]) {
2275 { 0x19, PIN_VREF50 },
2276 {}
2277 }
2278 },
2279 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2280 .type = HDA_FIXUP_FUNC,
2281 .v.func = alc_fixup_sku_ignore,
2282 },
2283 [ALC882_FIXUP_ASUS_W90V] = {
2284 .type = HDA_FIXUP_PINS,
2285 .v.pins = (const struct hda_pintbl[]) {
2286 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2287 { }
2288 }
2289 },
2290 [ALC889_FIXUP_CD] = {
2291 .type = HDA_FIXUP_PINS,
2292 .v.pins = (const struct hda_pintbl[]) {
2293 { 0x1c, 0x993301f0 }, /* CD */
2294 { }
2295 }
2296 },
2297 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2298 .type = HDA_FIXUP_PINS,
2299 .v.pins = (const struct hda_pintbl[]) {
2300 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2301 { }
2302 },
2303 .chained = true,
2304 .chain_id = ALC889_FIXUP_CD,
2305 },
2306 [ALC889_FIXUP_VAIO_TT] = {
2307 .type = HDA_FIXUP_PINS,
2308 .v.pins = (const struct hda_pintbl[]) {
2309 { 0x17, 0x90170111 }, /* hidden surround speaker */
2310 { }
2311 }
2312 },
2313 [ALC888_FIXUP_EEE1601] = {
2314 .type = HDA_FIXUP_VERBS,
2315 .v.verbs = (const struct hda_verb[]) {
2316 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2317 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2318 { }
2319 }
2320 },
Olivier Deprez0e641232021-09-23 10:07:05 +02002321 [ALC886_FIXUP_EAPD] = {
2322 .type = HDA_FIXUP_VERBS,
2323 .v.verbs = (const struct hda_verb[]) {
2324 /* change to EAPD mode */
2325 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2326 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2327 { }
2328 }
2329 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002330 [ALC882_FIXUP_EAPD] = {
2331 .type = HDA_FIXUP_VERBS,
2332 .v.verbs = (const struct hda_verb[]) {
2333 /* change to EAPD mode */
2334 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2335 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2336 { }
2337 }
2338 },
2339 [ALC883_FIXUP_EAPD] = {
2340 .type = HDA_FIXUP_VERBS,
2341 .v.verbs = (const struct hda_verb[]) {
2342 /* change to EAPD mode */
2343 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2344 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2345 { }
2346 }
2347 },
2348 [ALC883_FIXUP_ACER_EAPD] = {
2349 .type = HDA_FIXUP_VERBS,
2350 .v.verbs = (const struct hda_verb[]) {
2351 /* eanable EAPD on Acer laptops */
2352 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2353 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2354 { }
2355 }
2356 },
2357 [ALC882_FIXUP_GPIO1] = {
2358 .type = HDA_FIXUP_FUNC,
2359 .v.func = alc_fixup_gpio1,
2360 },
2361 [ALC882_FIXUP_GPIO2] = {
2362 .type = HDA_FIXUP_FUNC,
2363 .v.func = alc_fixup_gpio2,
2364 },
2365 [ALC882_FIXUP_GPIO3] = {
2366 .type = HDA_FIXUP_FUNC,
2367 .v.func = alc_fixup_gpio3,
2368 },
2369 [ALC882_FIXUP_ASUS_W2JC] = {
2370 .type = HDA_FIXUP_FUNC,
2371 .v.func = alc_fixup_gpio1,
2372 .chained = true,
2373 .chain_id = ALC882_FIXUP_EAPD,
2374 },
2375 [ALC889_FIXUP_COEF] = {
2376 .type = HDA_FIXUP_FUNC,
2377 .v.func = alc889_fixup_coef,
2378 },
2379 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2380 .type = HDA_FIXUP_PINS,
2381 .v.pins = (const struct hda_pintbl[]) {
2382 { 0x16, 0x99130111 }, /* CLFE speaker */
2383 { 0x17, 0x99130112 }, /* surround speaker */
2384 { }
2385 },
2386 .chained = true,
2387 .chain_id = ALC882_FIXUP_GPIO1,
2388 },
2389 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2390 .type = HDA_FIXUP_PINS,
2391 .v.pins = (const struct hda_pintbl[]) {
2392 { 0x16, 0x99130111 }, /* CLFE speaker */
2393 { 0x1b, 0x99130112 }, /* surround speaker */
2394 { }
2395 },
2396 .chained = true,
2397 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2398 },
2399 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2400 /* additional init verbs for Acer Aspire 8930G */
2401 .type = HDA_FIXUP_VERBS,
2402 .v.verbs = (const struct hda_verb[]) {
2403 /* Enable all DACs */
2404 /* DAC DISABLE/MUTE 1? */
2405 /* setting bits 1-5 disables DAC nids 0x02-0x06
2406 * apparently. Init=0x38 */
2407 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2408 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2409 /* DAC DISABLE/MUTE 2? */
2410 /* some bit here disables the other DACs.
2411 * Init=0x4900 */
2412 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2413 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2414 /* DMIC fix
2415 * This laptop has a stereo digital microphone.
2416 * The mics are only 1cm apart which makes the stereo
2417 * useless. However, either the mic or the ALC889
2418 * makes the signal become a difference/sum signal
2419 * instead of standard stereo, which is annoying.
2420 * So instead we flip this bit which makes the
2421 * codec replicate the sum signal to both channels,
2422 * turning it into a normal mono mic.
2423 */
2424 /* DMIC_CONTROL? Init value = 0x0001 */
2425 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2426 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2427 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2428 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2429 { }
2430 },
2431 .chained = true,
2432 .chain_id = ALC882_FIXUP_GPIO1,
2433 },
2434 [ALC885_FIXUP_MACPRO_GPIO] = {
2435 .type = HDA_FIXUP_FUNC,
2436 .v.func = alc885_fixup_macpro_gpio,
2437 },
2438 [ALC889_FIXUP_DAC_ROUTE] = {
2439 .type = HDA_FIXUP_FUNC,
2440 .v.func = alc889_fixup_dac_route,
2441 },
2442 [ALC889_FIXUP_MBP_VREF] = {
2443 .type = HDA_FIXUP_FUNC,
2444 .v.func = alc889_fixup_mbp_vref,
2445 .chained = true,
2446 .chain_id = ALC882_FIXUP_GPIO1,
2447 },
2448 [ALC889_FIXUP_IMAC91_VREF] = {
2449 .type = HDA_FIXUP_FUNC,
2450 .v.func = alc889_fixup_imac91_vref,
2451 .chained = true,
2452 .chain_id = ALC882_FIXUP_GPIO1,
2453 },
2454 [ALC889_FIXUP_MBA11_VREF] = {
2455 .type = HDA_FIXUP_FUNC,
2456 .v.func = alc889_fixup_mba11_vref,
2457 .chained = true,
2458 .chain_id = ALC889_FIXUP_MBP_VREF,
2459 },
2460 [ALC889_FIXUP_MBA21_VREF] = {
2461 .type = HDA_FIXUP_FUNC,
2462 .v.func = alc889_fixup_mba21_vref,
2463 .chained = true,
2464 .chain_id = ALC889_FIXUP_MBP_VREF,
2465 },
2466 [ALC889_FIXUP_MP11_VREF] = {
2467 .type = HDA_FIXUP_FUNC,
2468 .v.func = alc889_fixup_mba11_vref,
2469 .chained = true,
2470 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2471 },
2472 [ALC889_FIXUP_MP41_VREF] = {
2473 .type = HDA_FIXUP_FUNC,
2474 .v.func = alc889_fixup_mbp_vref,
2475 .chained = true,
2476 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2477 },
2478 [ALC882_FIXUP_INV_DMIC] = {
2479 .type = HDA_FIXUP_FUNC,
2480 .v.func = alc_fixup_inv_dmic,
2481 },
2482 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2483 .type = HDA_FIXUP_FUNC,
2484 .v.func = alc882_fixup_no_primary_hp,
2485 },
2486 [ALC887_FIXUP_ASUS_BASS] = {
2487 .type = HDA_FIXUP_PINS,
2488 .v.pins = (const struct hda_pintbl[]) {
2489 {0x16, 0x99130130}, /* bass speaker */
2490 {}
2491 },
2492 .chained = true,
2493 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2494 },
2495 [ALC887_FIXUP_BASS_CHMAP] = {
2496 .type = HDA_FIXUP_FUNC,
2497 .v.func = alc_fixup_bass_chmap,
2498 },
2499 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2500 .type = HDA_FIXUP_FUNC,
2501 .v.func = alc1220_fixup_gb_dual_codecs,
2502 },
Olivier Deprez157378f2022-04-04 15:47:50 +02002503 [ALC1220_FIXUP_GB_X570] = {
2504 .type = HDA_FIXUP_FUNC,
2505 .v.func = alc1220_fixup_gb_x570,
2506 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002507 [ALC1220_FIXUP_CLEVO_P950] = {
2508 .type = HDA_FIXUP_FUNC,
2509 .v.func = alc1220_fixup_clevo_p950,
2510 },
David Brazdil0f672f62019-12-10 10:32:29 +00002511 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2512 .type = HDA_FIXUP_FUNC,
2513 .v.func = alc1220_fixup_clevo_pb51ed,
2514 },
2515 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2516 .type = HDA_FIXUP_PINS,
2517 .v.pins = (const struct hda_pintbl[]) {
2518 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2519 {}
2520 },
2521 .chained = true,
2522 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2523 },
Olivier Deprez0e641232021-09-23 10:07:05 +02002524 [ALC887_FIXUP_ASUS_AUDIO] = {
2525 .type = HDA_FIXUP_PINS,
2526 .v.pins = (const struct hda_pintbl[]) {
2527 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2528 { 0x19, 0x22219420 },
2529 {}
2530 },
2531 },
2532 [ALC887_FIXUP_ASUS_HMIC] = {
2533 .type = HDA_FIXUP_FUNC,
2534 .v.func = alc887_fixup_asus_jack,
2535 .chained = true,
2536 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2537 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002538};
2539
2540static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2541 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2542 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2543 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2544 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2545 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2546 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2547 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2548 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2549 ALC882_FIXUP_ACER_ASPIRE_4930G),
2550 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2551 ALC882_FIXUP_ACER_ASPIRE_4930G),
2552 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2553 ALC882_FIXUP_ACER_ASPIRE_8930G),
2554 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2555 ALC882_FIXUP_ACER_ASPIRE_8930G),
Olivier Deprez0e641232021-09-23 10:07:05 +02002556 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2557 ALC882_FIXUP_ACER_ASPIRE_4930G),
2558 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002559 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2560 ALC882_FIXUP_ACER_ASPIRE_4930G),
2561 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2562 ALC882_FIXUP_ACER_ASPIRE_4930G),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002563 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2564 ALC882_FIXUP_ACER_ASPIRE_4930G),
2565 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2566 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2567 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2568 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2569 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2570 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Olivier Deprez0e641232021-09-23 10:07:05 +02002571 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002572 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2573 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2574 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Olivier Deprez0e641232021-09-23 10:07:05 +02002575 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2576 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002577 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2578 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2579 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002580
2581 /* All Apple entries are in codec SSIDs */
2582 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2583 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2584 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2585 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2586 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2587 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2588 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2589 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2590 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2591 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2592 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2593 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2594 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2595 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2596 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2597 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2598 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2599 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2600 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2601 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2602 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2603 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2604
2605 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
Olivier Deprez0e641232021-09-23 10:07:05 +02002606 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002607 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2608 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Olivier Deprez157378f2022-04-04 15:47:50 +02002609 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2610 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2611 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
Olivier Deprez0e641232021-09-23 10:07:05 +02002612 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2613 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2614 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2615 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2616 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2617 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002618 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Olivier Deprez0e641232021-09-23 10:07:05 +02002619 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002620 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2621 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2622 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Olivier Deprez0e641232021-09-23 10:07:05 +02002623 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2624 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2625 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2626 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2627 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Olivier Deprez157378f2022-04-04 15:47:50 +02002628 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Olivier Deprez0e641232021-09-23 10:07:05 +02002629 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2630 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2631 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Olivier Deprez157378f2022-04-04 15:47:50 +02002632 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Olivier Deprez0e641232021-09-23 10:07:05 +02002633 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Olivier Deprez157378f2022-04-04 15:47:50 +02002634 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2635 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002636 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
Olivier Deprez0e641232021-09-23 10:07:05 +02002637 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2638 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002639 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2640 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
Olivier Deprez0e641232021-09-23 10:07:05 +02002641 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2642 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2643 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2644 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
David Brazdil0f672f62019-12-10 10:32:29 +00002645 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2646 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
Olivier Deprez0e641232021-09-23 10:07:05 +02002647 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002648 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2649 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2650 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2651 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2652 {}
2653};
2654
2655static const struct hda_model_fixup alc882_fixup_models[] = {
2656 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2657 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2658 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2659 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2660 {.id = ALC889_FIXUP_CD, .name = "cd"},
2661 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2662 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2663 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2664 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2665 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2666 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2667 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2668 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2669 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2670 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2671 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2672 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2673 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2674 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2675 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2676 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2677 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2678 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2679 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2680 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2681 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2682 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2683 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2684 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2685 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Olivier Deprez157378f2022-04-04 15:47:50 +02002686 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002687 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2688 {}
2689};
2690
Olivier Deprez0e641232021-09-23 10:07:05 +02002691static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2692 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2693 {0x14, 0x01014010},
2694 {0x15, 0x01011012},
2695 {0x16, 0x01016011},
2696 {0x18, 0x01a19040},
2697 {0x19, 0x02a19050},
2698 {0x1a, 0x0181304f},
2699 {0x1b, 0x0221401f},
2700 {0x1e, 0x01456130}),
2701 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2702 {0x14, 0x01015010},
2703 {0x15, 0x01011012},
2704 {0x16, 0x01011011},
2705 {0x18, 0x01a11040},
2706 {0x19, 0x02a19050},
2707 {0x1a, 0x0181104f},
2708 {0x1b, 0x0221401f},
2709 {0x1e, 0x01451130}),
2710 {}
2711};
2712
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002713/*
2714 * BIOS auto configuration
2715 */
2716/* almost identical with ALC880 parser... */
2717static int alc882_parse_auto_config(struct hda_codec *codec)
2718{
2719 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2720 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2721 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2722}
2723
2724/*
2725 */
2726static int patch_alc882(struct hda_codec *codec)
2727{
2728 struct alc_spec *spec;
2729 int err;
2730
2731 err = alc_alloc_spec(codec, 0x0b);
2732 if (err < 0)
2733 return err;
2734
2735 spec = codec->spec;
2736
2737 switch (codec->core.vendor_id) {
2738 case 0x10ec0882:
2739 case 0x10ec0885:
2740 case 0x10ec0900:
Olivier Deprez0e641232021-09-23 10:07:05 +02002741 case 0x10ec0b00:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002742 case 0x10ec1220:
2743 break;
2744 default:
2745 /* ALC883 and variants */
2746 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2747 break;
2748 }
2749
David Brazdil0f672f62019-12-10 10:32:29 +00002750 alc_pre_init(codec);
2751
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002752 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2753 alc882_fixups);
Olivier Deprez0e641232021-09-23 10:07:05 +02002754 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002755 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2756
2757 alc_auto_parse_customize_define(codec);
2758
2759 if (has_cdefine_beep(codec))
2760 spec->gen.beep_nid = 0x01;
2761
2762 /* automatic parse from the BIOS config */
2763 err = alc882_parse_auto_config(codec);
2764 if (err < 0)
2765 goto error;
2766
2767 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2768 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2769 if (err < 0)
2770 goto error;
2771 }
2772
2773 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2774
2775 return 0;
2776
2777 error:
2778 alc_free(codec);
2779 return err;
2780}
2781
2782
2783/*
2784 * ALC262 support
2785 */
2786static int alc262_parse_auto_config(struct hda_codec *codec)
2787{
2788 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2789 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2790 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2791}
2792
2793/*
2794 * Pin config fixes
2795 */
2796enum {
2797 ALC262_FIXUP_FSC_H270,
2798 ALC262_FIXUP_FSC_S7110,
2799 ALC262_FIXUP_HP_Z200,
2800 ALC262_FIXUP_TYAN,
2801 ALC262_FIXUP_LENOVO_3000,
2802 ALC262_FIXUP_BENQ,
2803 ALC262_FIXUP_BENQ_T31,
2804 ALC262_FIXUP_INV_DMIC,
2805 ALC262_FIXUP_INTEL_BAYLEYBAY,
2806};
2807
2808static const struct hda_fixup alc262_fixups[] = {
2809 [ALC262_FIXUP_FSC_H270] = {
2810 .type = HDA_FIXUP_PINS,
2811 .v.pins = (const struct hda_pintbl[]) {
2812 { 0x14, 0x99130110 }, /* speaker */
2813 { 0x15, 0x0221142f }, /* front HP */
2814 { 0x1b, 0x0121141f }, /* rear HP */
2815 { }
2816 }
2817 },
2818 [ALC262_FIXUP_FSC_S7110] = {
2819 .type = HDA_FIXUP_PINS,
2820 .v.pins = (const struct hda_pintbl[]) {
2821 { 0x15, 0x90170110 }, /* speaker */
2822 { }
2823 },
2824 .chained = true,
2825 .chain_id = ALC262_FIXUP_BENQ,
2826 },
2827 [ALC262_FIXUP_HP_Z200] = {
2828 .type = HDA_FIXUP_PINS,
2829 .v.pins = (const struct hda_pintbl[]) {
2830 { 0x16, 0x99130120 }, /* internal speaker */
2831 { }
2832 }
2833 },
2834 [ALC262_FIXUP_TYAN] = {
2835 .type = HDA_FIXUP_PINS,
2836 .v.pins = (const struct hda_pintbl[]) {
2837 { 0x14, 0x1993e1f0 }, /* int AUX */
2838 { }
2839 }
2840 },
2841 [ALC262_FIXUP_LENOVO_3000] = {
2842 .type = HDA_FIXUP_PINCTLS,
2843 .v.pins = (const struct hda_pintbl[]) {
2844 { 0x19, PIN_VREF50 },
2845 {}
2846 },
2847 .chained = true,
2848 .chain_id = ALC262_FIXUP_BENQ,
2849 },
2850 [ALC262_FIXUP_BENQ] = {
2851 .type = HDA_FIXUP_VERBS,
2852 .v.verbs = (const struct hda_verb[]) {
2853 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2854 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2855 {}
2856 }
2857 },
2858 [ALC262_FIXUP_BENQ_T31] = {
2859 .type = HDA_FIXUP_VERBS,
2860 .v.verbs = (const struct hda_verb[]) {
2861 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2862 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2863 {}
2864 }
2865 },
2866 [ALC262_FIXUP_INV_DMIC] = {
2867 .type = HDA_FIXUP_FUNC,
2868 .v.func = alc_fixup_inv_dmic,
2869 },
2870 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2871 .type = HDA_FIXUP_FUNC,
2872 .v.func = alc_fixup_no_depop_delay,
2873 },
2874};
2875
2876static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2877 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2878 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2879 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2880 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2881 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2882 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2883 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2884 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2885 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2886 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2887 {}
2888};
2889
2890static const struct hda_model_fixup alc262_fixup_models[] = {
2891 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2892 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2893 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2894 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2895 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2896 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2897 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2898 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2899 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2900 {}
2901};
2902
2903/*
2904 */
2905static int patch_alc262(struct hda_codec *codec)
2906{
2907 struct alc_spec *spec;
2908 int err;
2909
2910 err = alc_alloc_spec(codec, 0x0b);
2911 if (err < 0)
2912 return err;
2913
2914 spec = codec->spec;
2915 spec->gen.shared_mic_vref_pin = 0x18;
2916
2917 spec->shutup = alc_eapd_shutup;
2918
2919#if 0
2920 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2921 * under-run
2922 */
2923 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2924#endif
2925 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2926
David Brazdil0f672f62019-12-10 10:32:29 +00002927 alc_pre_init(codec);
2928
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002929 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2930 alc262_fixups);
2931 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2932
2933 alc_auto_parse_customize_define(codec);
2934
2935 if (has_cdefine_beep(codec))
2936 spec->gen.beep_nid = 0x01;
2937
2938 /* automatic parse from the BIOS config */
2939 err = alc262_parse_auto_config(codec);
2940 if (err < 0)
2941 goto error;
2942
2943 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2944 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2945 if (err < 0)
2946 goto error;
2947 }
2948
2949 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2950
2951 return 0;
2952
2953 error:
2954 alc_free(codec);
2955 return err;
2956}
2957
2958/*
2959 * ALC268
2960 */
2961/* bind Beep switches of both NID 0x0f and 0x10 */
2962static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2963 struct snd_ctl_elem_value *ucontrol)
2964{
2965 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2966 unsigned long pval;
2967 int err;
2968
2969 mutex_lock(&codec->control_mutex);
2970 pval = kcontrol->private_value;
2971 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2972 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2973 if (err >= 0) {
2974 kcontrol->private_value = (pval & ~0xff) | 0x10;
2975 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2976 }
2977 kcontrol->private_value = pval;
2978 mutex_unlock(&codec->control_mutex);
2979 return err;
2980}
2981
2982static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2983 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2984 {
2985 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2986 .name = "Beep Playback Switch",
2987 .subdevice = HDA_SUBDEV_AMP_FLAG,
2988 .info = snd_hda_mixer_amp_switch_info,
2989 .get = snd_hda_mixer_amp_switch_get,
2990 .put = alc268_beep_switch_put,
2991 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2992 },
2993};
2994
2995/* set PCBEEP vol = 0, mute connections */
2996static const struct hda_verb alc268_beep_init_verbs[] = {
2997 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2998 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2999 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3000 { }
3001};
3002
3003enum {
3004 ALC268_FIXUP_INV_DMIC,
3005 ALC268_FIXUP_HP_EAPD,
3006 ALC268_FIXUP_SPDIF,
3007};
3008
3009static const struct hda_fixup alc268_fixups[] = {
3010 [ALC268_FIXUP_INV_DMIC] = {
3011 .type = HDA_FIXUP_FUNC,
3012 .v.func = alc_fixup_inv_dmic,
3013 },
3014 [ALC268_FIXUP_HP_EAPD] = {
3015 .type = HDA_FIXUP_VERBS,
3016 .v.verbs = (const struct hda_verb[]) {
3017 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3018 {}
3019 }
3020 },
3021 [ALC268_FIXUP_SPDIF] = {
3022 .type = HDA_FIXUP_PINS,
3023 .v.pins = (const struct hda_pintbl[]) {
3024 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3025 {}
3026 }
3027 },
3028};
3029
3030static const struct hda_model_fixup alc268_fixup_models[] = {
3031 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3032 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3033 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3034 {}
3035};
3036
3037static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3038 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3039 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3040 /* below is codec SSID since multiple Toshiba laptops have the
3041 * same PCI SSID 1179:ff00
3042 */
3043 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3044 {}
3045};
3046
3047/*
3048 * BIOS auto configuration
3049 */
3050static int alc268_parse_auto_config(struct hda_codec *codec)
3051{
3052 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3053 return alc_parse_auto_config(codec, NULL, alc268_ssids);
3054}
3055
3056/*
3057 */
3058static int patch_alc268(struct hda_codec *codec)
3059{
3060 struct alc_spec *spec;
3061 int i, err;
3062
3063 /* ALC268 has no aa-loopback mixer */
3064 err = alc_alloc_spec(codec, 0);
3065 if (err < 0)
3066 return err;
3067
3068 spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003069 if (has_cdefine_beep(codec))
3070 spec->gen.beep_nid = 0x01;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003071
3072 spec->shutup = alc_eapd_shutup;
3073
David Brazdil0f672f62019-12-10 10:32:29 +00003074 alc_pre_init(codec);
3075
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003076 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3077 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3078
3079 /* automatic parse from the BIOS config */
3080 err = alc268_parse_auto_config(codec);
3081 if (err < 0)
3082 goto error;
3083
3084 if (err > 0 && !spec->gen.no_analog &&
3085 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3086 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3087 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3088 &alc268_beep_mixer[i])) {
3089 err = -ENOMEM;
3090 goto error;
3091 }
3092 }
3093 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3094 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3095 /* override the amp caps for beep generator */
3096 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3097 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3098 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3099 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3100 (0 << AC_AMPCAP_MUTE_SHIFT));
3101 }
3102
3103 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3104
3105 return 0;
3106
3107 error:
3108 alc_free(codec);
3109 return err;
3110}
3111
3112/*
3113 * ALC269
3114 */
3115
3116static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3117 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3118};
3119
3120static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3121 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3122};
3123
3124/* different alc269-variants */
3125enum {
3126 ALC269_TYPE_ALC269VA,
3127 ALC269_TYPE_ALC269VB,
3128 ALC269_TYPE_ALC269VC,
3129 ALC269_TYPE_ALC269VD,
3130 ALC269_TYPE_ALC280,
3131 ALC269_TYPE_ALC282,
3132 ALC269_TYPE_ALC283,
3133 ALC269_TYPE_ALC284,
3134 ALC269_TYPE_ALC293,
3135 ALC269_TYPE_ALC286,
3136 ALC269_TYPE_ALC298,
3137 ALC269_TYPE_ALC255,
3138 ALC269_TYPE_ALC256,
3139 ALC269_TYPE_ALC257,
3140 ALC269_TYPE_ALC215,
3141 ALC269_TYPE_ALC225,
3142 ALC269_TYPE_ALC294,
3143 ALC269_TYPE_ALC300,
David Brazdil0f672f62019-12-10 10:32:29 +00003144 ALC269_TYPE_ALC623,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003145 ALC269_TYPE_ALC700,
3146};
3147
3148/*
3149 * BIOS auto configuration
3150 */
3151static int alc269_parse_auto_config(struct hda_codec *codec)
3152{
3153 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3154 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3155 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3156 struct alc_spec *spec = codec->spec;
3157 const hda_nid_t *ssids;
3158
3159 switch (spec->codec_variant) {
3160 case ALC269_TYPE_ALC269VA:
3161 case ALC269_TYPE_ALC269VC:
3162 case ALC269_TYPE_ALC280:
3163 case ALC269_TYPE_ALC284:
3164 case ALC269_TYPE_ALC293:
3165 ssids = alc269va_ssids;
3166 break;
3167 case ALC269_TYPE_ALC269VB:
3168 case ALC269_TYPE_ALC269VD:
3169 case ALC269_TYPE_ALC282:
3170 case ALC269_TYPE_ALC283:
3171 case ALC269_TYPE_ALC286:
3172 case ALC269_TYPE_ALC298:
3173 case ALC269_TYPE_ALC255:
3174 case ALC269_TYPE_ALC256:
3175 case ALC269_TYPE_ALC257:
3176 case ALC269_TYPE_ALC215:
3177 case ALC269_TYPE_ALC225:
3178 case ALC269_TYPE_ALC294:
3179 case ALC269_TYPE_ALC300:
David Brazdil0f672f62019-12-10 10:32:29 +00003180 case ALC269_TYPE_ALC623:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003181 case ALC269_TYPE_ALC700:
3182 ssids = alc269_ssids;
3183 break;
3184 default:
3185 ssids = alc269_ssids;
3186 break;
3187 }
3188
3189 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3190}
3191
Olivier Deprez0e641232021-09-23 10:07:05 +02003192static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3193 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3194 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3195 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3196 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3197 {}
3198};
3199
3200static void alc_headset_btn_callback(struct hda_codec *codec,
3201 struct hda_jack_callback *jack)
3202{
3203 int report = 0;
3204
3205 if (jack->unsol_res & (7 << 13))
3206 report |= SND_JACK_BTN_0;
3207
3208 if (jack->unsol_res & (1 << 16 | 3 << 8))
3209 report |= SND_JACK_BTN_1;
3210
3211 /* Volume up key */
3212 if (jack->unsol_res & (7 << 23))
3213 report |= SND_JACK_BTN_2;
3214
3215 /* Volume down key */
3216 if (jack->unsol_res & (7 << 10))
3217 report |= SND_JACK_BTN_3;
3218
3219 jack->jack->button_state = report;
3220}
3221
3222static void alc_disable_headset_jack_key(struct hda_codec *codec)
3223{
3224 struct alc_spec *spec = codec->spec;
3225
3226 if (!spec->has_hs_key)
3227 return;
3228
3229 switch (codec->core.vendor_id) {
3230 case 0x10ec0215:
3231 case 0x10ec0225:
3232 case 0x10ec0285:
3233 case 0x10ec0287:
3234 case 0x10ec0295:
3235 case 0x10ec0289:
3236 case 0x10ec0299:
3237 alc_write_coef_idx(codec, 0x48, 0x0);
3238 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3239 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3240 break;
3241 case 0x10ec0230:
3242 case 0x10ec0236:
3243 case 0x10ec0256:
3244 alc_write_coef_idx(codec, 0x48, 0x0);
3245 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3246 break;
3247 }
3248}
3249
3250static void alc_enable_headset_jack_key(struct hda_codec *codec)
3251{
3252 struct alc_spec *spec = codec->spec;
3253
3254 if (!spec->has_hs_key)
3255 return;
3256
3257 switch (codec->core.vendor_id) {
3258 case 0x10ec0215:
3259 case 0x10ec0225:
3260 case 0x10ec0285:
3261 case 0x10ec0287:
3262 case 0x10ec0295:
3263 case 0x10ec0289:
3264 case 0x10ec0299:
3265 alc_write_coef_idx(codec, 0x48, 0xd011);
3266 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3267 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3268 break;
3269 case 0x10ec0230:
3270 case 0x10ec0236:
3271 case 0x10ec0256:
3272 alc_write_coef_idx(codec, 0x48, 0xd011);
3273 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3274 break;
3275 }
3276}
3277
3278static void alc_fixup_headset_jack(struct hda_codec *codec,
3279 const struct hda_fixup *fix, int action)
3280{
3281 struct alc_spec *spec = codec->spec;
3282
3283 switch (action) {
3284 case HDA_FIXUP_ACT_PRE_PROBE:
3285 spec->has_hs_key = 1;
3286 snd_hda_jack_detect_enable_callback(codec, 0x55,
3287 alc_headset_btn_callback);
3288 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3289 SND_JACK_HEADSET, alc_headset_btn_keymap);
3290 break;
3291 case HDA_FIXUP_ACT_INIT:
3292 alc_enable_headset_jack_key(codec);
3293 break;
3294 }
3295}
3296
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003297static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3298{
3299 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3300}
3301
3302static void alc269_shutup(struct hda_codec *codec)
3303{
3304 struct alc_spec *spec = codec->spec;
3305
3306 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3307 alc269vb_toggle_power_output(codec, 0);
3308 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3309 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3310 msleep(150);
3311 }
David Brazdil0f672f62019-12-10 10:32:29 +00003312 alc_shutup_pins(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003313}
3314
Olivier Deprez0e641232021-09-23 10:07:05 +02003315static const struct coef_fw alc282_coefs[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003316 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3317 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3318 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3319 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3320 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3321 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3322 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3323 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3324 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3325 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3326 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3327 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3328 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3329 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3330 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3331 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3332 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3333 WRITE_COEF(0x63, 0x2902), /* PLL */
3334 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3335 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3336 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3337 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3338 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3339 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3340 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3341 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3342 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3343 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3344 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3345 {}
3346};
3347
3348static void alc282_restore_default_value(struct hda_codec *codec)
3349{
3350 alc_process_coef_fw(codec, alc282_coefs);
3351}
3352
3353static void alc282_init(struct hda_codec *codec)
3354{
3355 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003356 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003357 bool hp_pin_sense;
3358 int coef78;
3359
3360 alc282_restore_default_value(codec);
3361
3362 if (!hp_pin)
3363 return;
3364 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3365 coef78 = alc_read_coef_idx(codec, 0x78);
3366
3367 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3368 /* Headphone capless set to high power mode */
3369 alc_write_coef_idx(codec, 0x78, 0x9004);
3370
3371 if (hp_pin_sense)
3372 msleep(2);
3373
3374 snd_hda_codec_write(codec, hp_pin, 0,
3375 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3376
3377 if (hp_pin_sense)
3378 msleep(85);
3379
3380 snd_hda_codec_write(codec, hp_pin, 0,
3381 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3382
3383 if (hp_pin_sense)
3384 msleep(100);
3385
3386 /* Headphone capless set to normal mode */
3387 alc_write_coef_idx(codec, 0x78, coef78);
3388}
3389
3390static void alc282_shutup(struct hda_codec *codec)
3391{
3392 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003393 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003394 bool hp_pin_sense;
3395 int coef78;
3396
3397 if (!hp_pin) {
3398 alc269_shutup(codec);
3399 return;
3400 }
3401
3402 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3403 coef78 = alc_read_coef_idx(codec, 0x78);
3404 alc_write_coef_idx(codec, 0x78, 0x9004);
3405
3406 if (hp_pin_sense)
3407 msleep(2);
3408
3409 snd_hda_codec_write(codec, hp_pin, 0,
3410 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3411
3412 if (hp_pin_sense)
3413 msleep(85);
3414
David Brazdil0f672f62019-12-10 10:32:29 +00003415 if (!spec->no_shutup_pins)
3416 snd_hda_codec_write(codec, hp_pin, 0,
3417 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003418
3419 if (hp_pin_sense)
3420 msleep(100);
3421
3422 alc_auto_setup_eapd(codec, false);
David Brazdil0f672f62019-12-10 10:32:29 +00003423 alc_shutup_pins(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003424 alc_write_coef_idx(codec, 0x78, coef78);
3425}
3426
Olivier Deprez0e641232021-09-23 10:07:05 +02003427static const struct coef_fw alc283_coefs[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003428 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3429 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3430 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3431 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3432 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3433 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3434 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3435 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3436 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3437 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3438 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3439 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3440 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3441 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3442 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3443 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3444 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3445 WRITE_COEF(0x2e, 0x2902), /* PLL */
3446 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3447 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3448 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3449 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3450 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3451 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3452 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3453 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3454 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3455 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3456 WRITE_COEF(0x49, 0x0), /* test mode */
3457 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3458 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3459 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3460 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3461 {}
3462};
3463
3464static void alc283_restore_default_value(struct hda_codec *codec)
3465{
3466 alc_process_coef_fw(codec, alc283_coefs);
3467}
3468
3469static void alc283_init(struct hda_codec *codec)
3470{
3471 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003472 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003473 bool hp_pin_sense;
3474
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003475 alc283_restore_default_value(codec);
3476
3477 if (!hp_pin)
3478 return;
3479
3480 msleep(30);
3481 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3482
3483 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3484 /* Headphone capless set to high power mode */
3485 alc_write_coef_idx(codec, 0x43, 0x9004);
3486
3487 snd_hda_codec_write(codec, hp_pin, 0,
3488 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3489
3490 if (hp_pin_sense)
3491 msleep(85);
3492
3493 snd_hda_codec_write(codec, hp_pin, 0,
3494 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3495
3496 if (hp_pin_sense)
3497 msleep(85);
3498 /* Index 0x46 Combo jack auto switch control 2 */
3499 /* 3k pull low control for Headset jack. */
3500 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3501 /* Headphone capless set to normal mode */
3502 alc_write_coef_idx(codec, 0x43, 0x9614);
3503}
3504
3505static void alc283_shutup(struct hda_codec *codec)
3506{
3507 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003508 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003509 bool hp_pin_sense;
3510
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003511 if (!hp_pin) {
3512 alc269_shutup(codec);
3513 return;
3514 }
3515
3516 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3517
3518 alc_write_coef_idx(codec, 0x43, 0x9004);
3519
3520 /*depop hp during suspend*/
3521 alc_write_coef_idx(codec, 0x06, 0x2100);
3522
3523 snd_hda_codec_write(codec, hp_pin, 0,
3524 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3525
3526 if (hp_pin_sense)
3527 msleep(100);
3528
David Brazdil0f672f62019-12-10 10:32:29 +00003529 if (!spec->no_shutup_pins)
3530 snd_hda_codec_write(codec, hp_pin, 0,
3531 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003532
3533 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3534
3535 if (hp_pin_sense)
3536 msleep(100);
3537 alc_auto_setup_eapd(codec, false);
David Brazdil0f672f62019-12-10 10:32:29 +00003538 alc_shutup_pins(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003539 alc_write_coef_idx(codec, 0x43, 0x9614);
3540}
3541
3542static void alc256_init(struct hda_codec *codec)
3543{
3544 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003545 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003546 bool hp_pin_sense;
3547
3548 if (!hp_pin)
David Brazdil0f672f62019-12-10 10:32:29 +00003549 hp_pin = 0x21;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003550
3551 msleep(30);
3552
3553 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3554
3555 if (hp_pin_sense)
3556 msleep(2);
3557
3558 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
David Brazdil0f672f62019-12-10 10:32:29 +00003559 if (spec->ultra_low_power) {
3560 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3561 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3562 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3563 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3564 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3565 msleep(30);
3566 }
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003567
3568 snd_hda_codec_write(codec, hp_pin, 0,
3569 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3570
David Brazdil0f672f62019-12-10 10:32:29 +00003571 if (hp_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003572 msleep(85);
3573
3574 snd_hda_codec_write(codec, hp_pin, 0,
3575 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3576
David Brazdil0f672f62019-12-10 10:32:29 +00003577 if (hp_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003578 msleep(100);
3579
3580 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3581 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3582 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3583 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Olivier Deprez0e641232021-09-23 10:07:05 +02003584 /*
3585 * Expose headphone mic (or possibly Line In on some machines) instead
3586 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3587 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3588 * this register.
3589 */
3590 alc_write_coef_idx(codec, 0x36, 0x5757);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003591}
3592
3593static void alc256_shutup(struct hda_codec *codec)
3594{
3595 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003596 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003597 bool hp_pin_sense;
3598
David Brazdil0f672f62019-12-10 10:32:29 +00003599 if (!hp_pin)
3600 hp_pin = 0x21;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003601
3602 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3603
3604 if (hp_pin_sense)
3605 msleep(2);
3606
3607 snd_hda_codec_write(codec, hp_pin, 0,
3608 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3609
David Brazdil0f672f62019-12-10 10:32:29 +00003610 if (hp_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003611 msleep(85);
3612
3613 /* 3k pull low control for Headset jack. */
3614 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Olivier Deprez0e641232021-09-23 10:07:05 +02003615 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3616 * when booting with headset plugged. So skip setting it for the codec alc257
3617 */
Olivier Deprez157378f2022-04-04 15:47:50 +02003618 if (spec->codec_variant != ALC269_TYPE_ALC257 &&
3619 spec->codec_variant != ALC269_TYPE_ALC256)
Olivier Deprez0e641232021-09-23 10:07:05 +02003620 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003621
David Brazdil0f672f62019-12-10 10:32:29 +00003622 if (!spec->no_shutup_pins)
3623 snd_hda_codec_write(codec, hp_pin, 0,
3624 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003625
David Brazdil0f672f62019-12-10 10:32:29 +00003626 if (hp_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003627 msleep(100);
3628
3629 alc_auto_setup_eapd(codec, false);
David Brazdil0f672f62019-12-10 10:32:29 +00003630 alc_shutup_pins(codec);
3631 if (spec->ultra_low_power) {
3632 msleep(50);
3633 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3634 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3635 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3636 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3637 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3638 msleep(30);
3639 }
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003640}
3641
3642static void alc225_init(struct hda_codec *codec)
3643{
3644 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003645 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003646 bool hp1_pin_sense, hp2_pin_sense;
3647
3648 if (!hp_pin)
David Brazdil0f672f62019-12-10 10:32:29 +00003649 hp_pin = 0x21;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003650 msleep(30);
3651
3652 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3653 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3654
3655 if (hp1_pin_sense || hp2_pin_sense)
3656 msleep(2);
3657
3658 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
David Brazdil0f672f62019-12-10 10:32:29 +00003659 if (spec->ultra_low_power) {
3660 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3661 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3662 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3663 msleep(30);
3664 }
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003665
David Brazdil0f672f62019-12-10 10:32:29 +00003666 if (hp1_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003667 snd_hda_codec_write(codec, hp_pin, 0,
3668 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3669 if (hp2_pin_sense)
3670 snd_hda_codec_write(codec, 0x16, 0,
3671 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3672
David Brazdil0f672f62019-12-10 10:32:29 +00003673 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003674 msleep(85);
3675
David Brazdil0f672f62019-12-10 10:32:29 +00003676 if (hp1_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003677 snd_hda_codec_write(codec, hp_pin, 0,
3678 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3679 if (hp2_pin_sense)
3680 snd_hda_codec_write(codec, 0x16, 0,
3681 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3682
David Brazdil0f672f62019-12-10 10:32:29 +00003683 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003684 msleep(100);
3685
3686 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3687 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3688}
3689
3690static void alc225_shutup(struct hda_codec *codec)
3691{
3692 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003693 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003694 bool hp1_pin_sense, hp2_pin_sense;
3695
David Brazdil0f672f62019-12-10 10:32:29 +00003696 if (!hp_pin)
3697 hp_pin = 0x21;
Olivier Deprez0e641232021-09-23 10:07:05 +02003698
3699 alc_disable_headset_jack_key(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003700 /* 3k pull low control for Headset jack. */
3701 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3702
3703 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3704 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3705
3706 if (hp1_pin_sense || hp2_pin_sense)
3707 msleep(2);
3708
David Brazdil0f672f62019-12-10 10:32:29 +00003709 if (hp1_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003710 snd_hda_codec_write(codec, hp_pin, 0,
3711 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3712 if (hp2_pin_sense)
3713 snd_hda_codec_write(codec, 0x16, 0,
3714 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3715
David Brazdil0f672f62019-12-10 10:32:29 +00003716 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003717 msleep(85);
3718
David Brazdil0f672f62019-12-10 10:32:29 +00003719 if (hp1_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003720 snd_hda_codec_write(codec, hp_pin, 0,
3721 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3722 if (hp2_pin_sense)
3723 snd_hda_codec_write(codec, 0x16, 0,
3724 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3725
David Brazdil0f672f62019-12-10 10:32:29 +00003726 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003727 msleep(100);
3728
3729 alc_auto_setup_eapd(codec, false);
David Brazdil0f672f62019-12-10 10:32:29 +00003730 alc_shutup_pins(codec);
3731 if (spec->ultra_low_power) {
3732 msleep(50);
3733 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3734 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3735 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3736 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3737 msleep(30);
3738 }
Olivier Deprez0e641232021-09-23 10:07:05 +02003739
3740 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3741 alc_enable_headset_jack_key(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003742}
3743
3744static void alc_default_init(struct hda_codec *codec)
3745{
3746 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003747 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003748 bool hp_pin_sense;
3749
3750 if (!hp_pin)
3751 return;
3752
3753 msleep(30);
3754
3755 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3756
3757 if (hp_pin_sense)
3758 msleep(2);
3759
3760 snd_hda_codec_write(codec, hp_pin, 0,
3761 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3762
3763 if (hp_pin_sense)
3764 msleep(85);
3765
3766 snd_hda_codec_write(codec, hp_pin, 0,
3767 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3768
3769 if (hp_pin_sense)
3770 msleep(100);
3771}
3772
3773static void alc_default_shutup(struct hda_codec *codec)
3774{
3775 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00003776 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003777 bool hp_pin_sense;
3778
3779 if (!hp_pin) {
3780 alc269_shutup(codec);
3781 return;
3782 }
3783
3784 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3785
3786 if (hp_pin_sense)
3787 msleep(2);
3788
3789 snd_hda_codec_write(codec, hp_pin, 0,
3790 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3791
3792 if (hp_pin_sense)
3793 msleep(85);
3794
David Brazdil0f672f62019-12-10 10:32:29 +00003795 if (!spec->no_shutup_pins)
3796 snd_hda_codec_write(codec, hp_pin, 0,
3797 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003798
3799 if (hp_pin_sense)
3800 msleep(100);
3801
3802 alc_auto_setup_eapd(codec, false);
David Brazdil0f672f62019-12-10 10:32:29 +00003803 alc_shutup_pins(codec);
3804}
3805
3806static void alc294_hp_init(struct hda_codec *codec)
3807{
3808 struct alc_spec *spec = codec->spec;
3809 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3810 int i, val;
3811
3812 if (!hp_pin)
3813 return;
3814
3815 snd_hda_codec_write(codec, hp_pin, 0,
3816 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3817
3818 msleep(100);
3819
3820 if (!spec->no_shutup_pins)
3821 snd_hda_codec_write(codec, hp_pin, 0,
3822 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3823
3824 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3825 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3826
3827 /* Wait for depop procedure finish */
3828 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3829 for (i = 0; i < 20 && val & 0x0080; i++) {
3830 msleep(50);
3831 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3832 }
3833 /* Set HP depop to auto mode */
3834 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3835 msleep(50);
3836}
3837
3838static void alc294_init(struct hda_codec *codec)
3839{
3840 struct alc_spec *spec = codec->spec;
3841
3842 /* required only at boot or S4 resume time */
3843 if (!spec->done_hp_init ||
3844 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3845 alc294_hp_init(codec);
3846 spec->done_hp_init = true;
3847 }
3848 alc_default_init(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003849}
3850
3851static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3852 unsigned int val)
3853{
3854 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3855 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3856 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3857}
3858
3859static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3860{
3861 unsigned int val;
3862
3863 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3864 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3865 & 0xffff;
3866 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3867 << 16;
3868 return val;
3869}
3870
3871static void alc5505_dsp_halt(struct hda_codec *codec)
3872{
3873 unsigned int val;
3874
3875 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3876 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3877 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3878 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3879 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3880 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3881 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3882 val = alc5505_coef_get(codec, 0x6220);
3883 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3884}
3885
3886static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3887{
3888 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3889 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3890 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3891 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3892 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3893 alc5505_coef_set(codec, 0x880c, 0x00000004);
3894}
3895
3896static void alc5505_dsp_init(struct hda_codec *codec)
3897{
3898 unsigned int val;
3899
3900 alc5505_dsp_halt(codec);
3901 alc5505_dsp_back_from_halt(codec);
3902 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3903 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3904 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3905 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3906 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3907 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3908 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3909 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3910 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3911 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3912 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3913 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3914 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3915
3916 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3917 if (val <= 3)
3918 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3919 else
3920 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3921
3922 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3923 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3924 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3925 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3926 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3927 alc5505_coef_set(codec, 0x880c, 0x00000003);
3928 alc5505_coef_set(codec, 0x880c, 0x00000010);
3929
3930#ifdef HALT_REALTEK_ALC5505
3931 alc5505_dsp_halt(codec);
3932#endif
3933}
3934
3935#ifdef HALT_REALTEK_ALC5505
Olivier Deprez0e641232021-09-23 10:07:05 +02003936#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3937#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003938#else
3939#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3940#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3941#endif
3942
3943#ifdef CONFIG_PM
3944static int alc269_suspend(struct hda_codec *codec)
3945{
3946 struct alc_spec *spec = codec->spec;
3947
3948 if (spec->has_alc5505_dsp)
3949 alc5505_dsp_suspend(codec);
3950 return alc_suspend(codec);
3951}
3952
3953static int alc269_resume(struct hda_codec *codec)
3954{
3955 struct alc_spec *spec = codec->spec;
3956
3957 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3958 alc269vb_toggle_power_output(codec, 0);
3959 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3960 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3961 msleep(150);
3962 }
3963
3964 codec->patch_ops.init(codec);
3965
3966 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3967 alc269vb_toggle_power_output(codec, 1);
3968 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3969 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3970 msleep(200);
3971 }
3972
Olivier Deprez0e641232021-09-23 10:07:05 +02003973 snd_hda_regmap_sync(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003974 hda_call_check_power_status(codec, 0x01);
3975
3976 /* on some machine, the BIOS will clear the codec gpio data when enter
3977 * suspend, and won't restore the data after resume, so we restore it
3978 * in the driver.
3979 */
3980 if (spec->gpio_data)
3981 alc_write_gpio_data(codec);
3982
3983 if (spec->has_alc5505_dsp)
3984 alc5505_dsp_resume(codec);
3985
3986 return 0;
3987}
3988#endif /* CONFIG_PM */
3989
3990static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3991 const struct hda_fixup *fix, int action)
3992{
3993 struct alc_spec *spec = codec->spec;
3994
3995 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3996 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3997}
3998
3999static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4000 const struct hda_fixup *fix,
4001 int action)
4002{
4003 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4004 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4005
4006 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4007 snd_hda_codec_set_pincfg(codec, 0x19,
4008 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4009 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4010}
4011
4012static void alc269_fixup_hweq(struct hda_codec *codec,
4013 const struct hda_fixup *fix, int action)
4014{
4015 if (action == HDA_FIXUP_ACT_INIT)
4016 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4017}
4018
4019static void alc269_fixup_headset_mic(struct hda_codec *codec,
4020 const struct hda_fixup *fix, int action)
4021{
4022 struct alc_spec *spec = codec->spec;
4023
4024 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4025 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4026}
4027
4028static void alc271_fixup_dmic(struct hda_codec *codec,
4029 const struct hda_fixup *fix, int action)
4030{
4031 static const struct hda_verb verbs[] = {
4032 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4033 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4034 {}
4035 };
4036 unsigned int cfg;
4037
4038 if (strcmp(codec->core.chip_name, "ALC271X") &&
4039 strcmp(codec->core.chip_name, "ALC269VB"))
4040 return;
4041 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4042 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4043 snd_hda_sequence_write(codec, verbs);
4044}
4045
Olivier Deprez0e641232021-09-23 10:07:05 +02004046/* Fix the speaker amp after resume, etc */
4047static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4048 const struct hda_fixup *fix,
4049 int action)
4050{
4051 if (action == HDA_FIXUP_ACT_INIT)
4052 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4053}
4054
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004055static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4056 const struct hda_fixup *fix, int action)
4057{
4058 struct alc_spec *spec = codec->spec;
4059
4060 if (action != HDA_FIXUP_ACT_PROBE)
4061 return;
4062
4063 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4064 * fix the sample rate of analog I/O to 44.1kHz
4065 */
4066 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4067 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4068}
4069
4070static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4071 const struct hda_fixup *fix, int action)
4072{
4073 /* The digital-mic unit sends PDM (differential signal) instead of
4074 * the standard PCM, thus you can't record a valid mono stream as is.
4075 * Below is a workaround specific to ALC269 to control the dmic
4076 * signal source as mono.
4077 */
4078 if (action == HDA_FIXUP_ACT_INIT)
4079 alc_update_coef_idx(codec, 0x07, 0, 0x80);
4080}
4081
4082static void alc269_quanta_automute(struct hda_codec *codec)
4083{
4084 snd_hda_gen_update_outputs(codec);
4085
4086 alc_write_coef_idx(codec, 0x0c, 0x680);
4087 alc_write_coef_idx(codec, 0x0c, 0x480);
4088}
4089
4090static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4091 const struct hda_fixup *fix, int action)
4092{
4093 struct alc_spec *spec = codec->spec;
4094 if (action != HDA_FIXUP_ACT_PROBE)
4095 return;
4096 spec->gen.automute_hook = alc269_quanta_automute;
4097}
4098
4099static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4100 struct hda_jack_callback *jack)
4101{
4102 struct alc_spec *spec = codec->spec;
4103 int vref;
4104 msleep(200);
4105 snd_hda_gen_hp_automute(codec, jack);
4106
4107 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4108 msleep(100);
4109 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4110 vref);
4111 msleep(500);
4112 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4113 vref);
4114}
4115
David Brazdil0f672f62019-12-10 10:32:29 +00004116/*
4117 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4118 */
4119struct hda_alc298_mbxinit {
4120 unsigned char value_0x23;
4121 unsigned char value_0x25;
4122};
4123
4124static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4125 const struct hda_alc298_mbxinit *initval,
4126 bool first)
4127{
4128 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4129 alc_write_coef_idx(codec, 0x26, 0xb000);
4130
4131 if (first)
4132 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4133
4134 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4135 alc_write_coef_idx(codec, 0x26, 0xf000);
4136 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4137
4138 if (initval->value_0x23 != 0x1e)
4139 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4140
4141 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4142 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4143}
4144
4145static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4146 const struct hda_fixup *fix,
4147 int action)
4148{
4149 /* Initialization magic */
4150 static const struct hda_alc298_mbxinit dac_init[] = {
4151 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4152 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4153 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4154 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4155 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4156 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4157 {0x2f, 0x00},
4158 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4159 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4160 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4161 {}
4162 };
4163 const struct hda_alc298_mbxinit *seq;
4164
4165 if (action != HDA_FIXUP_ACT_INIT)
4166 return;
4167
4168 /* Start */
4169 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4170 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4171 alc_write_coef_idx(codec, 0x26, 0xf000);
4172 alc_write_coef_idx(codec, 0x22, 0x31);
4173 alc_write_coef_idx(codec, 0x23, 0x0b);
4174 alc_write_coef_idx(codec, 0x25, 0x00);
4175 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4176 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4177
4178 for (seq = dac_init; seq->value_0x23; seq++)
4179 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4180}
4181
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004182static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4183 const struct hda_fixup *fix, int action)
4184{
4185 struct alc_spec *spec = codec->spec;
4186 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4187 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4188 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4189 }
4190}
4191
Olivier Deprez157378f2022-04-04 15:47:50 +02004192static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4193 bool polarity, bool on)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004194{
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004195 unsigned int pinval;
4196
Olivier Deprez157378f2022-04-04 15:47:50 +02004197 if (!pin)
4198 return;
4199 if (polarity)
4200 on = !on;
4201 pinval = snd_hda_codec_get_pin_target(codec, pin);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004202 pinval &= ~AC_PINCTL_VREFEN;
Olivier Deprez157378f2022-04-04 15:47:50 +02004203 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4204 /* temporarily power up/down for setting VREF */
4205 snd_hda_power_up_pm(codec);
4206 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4207 snd_hda_power_down_pm(codec);
4208}
4209
4210/* update mute-LED according to the speaker mute state via mic VREF pin */
4211static int vref_mute_led_set(struct led_classdev *led_cdev,
4212 enum led_brightness brightness)
4213{
4214 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4215 struct alc_spec *spec = codec->spec;
4216
4217 alc_update_vref_led(codec, spec->mute_led_nid,
4218 spec->mute_led_polarity, brightness);
4219 return 0;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004220}
4221
4222/* Make sure the led works even in runtime suspend */
4223static unsigned int led_power_filter(struct hda_codec *codec,
4224 hda_nid_t nid,
4225 unsigned int power_state)
4226{
4227 struct alc_spec *spec = codec->spec;
4228
4229 if (power_state != AC_PWRST_D3 || nid == 0 ||
4230 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4231 return power_state;
4232
4233 /* Set pin ctl again, it might have just been set to 0 */
4234 snd_hda_set_pin_ctl(codec, nid,
4235 snd_hda_codec_get_pin_target(codec, nid));
4236
4237 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4238}
4239
4240static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4241 const struct hda_fixup *fix, int action)
4242{
4243 struct alc_spec *spec = codec->spec;
4244 const struct dmi_device *dev = NULL;
4245
4246 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4247 return;
4248
4249 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4250 int pol, pin;
4251 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4252 continue;
4253 if (pin < 0x0a || pin >= 0x10)
4254 break;
4255 spec->mute_led_polarity = pol;
4256 spec->mute_led_nid = pin - 0x0a + 0x18;
Olivier Deprez157378f2022-04-04 15:47:50 +02004257 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004258 codec->power_filter = led_power_filter;
4259 codec_dbg(codec,
4260 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4261 spec->mute_led_polarity);
4262 break;
4263 }
4264}
4265
4266static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4267 const struct hda_fixup *fix,
4268 int action, hda_nid_t pin)
4269{
4270 struct alc_spec *spec = codec->spec;
4271
4272 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4273 spec->mute_led_polarity = 0;
4274 spec->mute_led_nid = pin;
Olivier Deprez157378f2022-04-04 15:47:50 +02004275 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004276 codec->power_filter = led_power_filter;
4277 }
4278}
4279
4280static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4281 const struct hda_fixup *fix, int action)
4282{
4283 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4284}
4285
4286static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4287 const struct hda_fixup *fix, int action)
4288{
4289 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4290}
4291
4292static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4293 const struct hda_fixup *fix, int action)
4294{
4295 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4296}
4297
4298/* update LED status via GPIO */
4299static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Olivier Deprez0e641232021-09-23 10:07:05 +02004300 int polarity, bool enabled)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004301{
Olivier Deprez0e641232021-09-23 10:07:05 +02004302 if (polarity)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004303 enabled = !enabled;
4304 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4305}
4306
4307/* turn on/off mute LED via GPIO per vmaster hook */
Olivier Deprez157378f2022-04-04 15:47:50 +02004308static int gpio_mute_led_set(struct led_classdev *led_cdev,
4309 enum led_brightness brightness)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004310{
Olivier Deprez157378f2022-04-04 15:47:50 +02004311 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004312 struct alc_spec *spec = codec->spec;
4313
Olivier Deprez0e641232021-09-23 10:07:05 +02004314 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Olivier Deprez157378f2022-04-04 15:47:50 +02004315 spec->mute_led_polarity, !brightness);
4316 return 0;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004317}
4318
4319/* turn on/off mic-mute LED via GPIO per capture hook */
Olivier Deprez157378f2022-04-04 15:47:50 +02004320static int micmute_led_set(struct led_classdev *led_cdev,
4321 enum led_brightness brightness)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004322{
Olivier Deprez157378f2022-04-04 15:47:50 +02004323 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004324 struct alc_spec *spec = codec->spec;
4325
4326 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Olivier Deprez157378f2022-04-04 15:47:50 +02004327 spec->micmute_led_polarity, !brightness);
4328 return 0;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004329}
4330
4331/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4332static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4333 int action,
4334 unsigned int mute_mask,
4335 unsigned int micmute_mask)
4336{
4337 struct alc_spec *spec = codec->spec;
4338
4339 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4340
4341 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4342 return;
4343 if (mute_mask) {
4344 spec->gpio_mute_led_mask = mute_mask;
Olivier Deprez157378f2022-04-04 15:47:50 +02004345 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004346 }
4347 if (micmute_mask) {
4348 spec->gpio_mic_led_mask = micmute_mask;
Olivier Deprez157378f2022-04-04 15:47:50 +02004349 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004350 }
4351}
4352
Olivier Deprez157378f2022-04-04 15:47:50 +02004353static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4354 const struct hda_fixup *fix, int action)
4355{
4356 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4357}
4358
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004359static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4360 const struct hda_fixup *fix, int action)
4361{
4362 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4363}
4364
Olivier Deprez0e641232021-09-23 10:07:05 +02004365static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4366 const struct hda_fixup *fix, int action)
4367{
Olivier Deprez157378f2022-04-04 15:47:50 +02004368 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Olivier Deprez0e641232021-09-23 10:07:05 +02004369}
4370
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004371static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4372 const struct hda_fixup *fix, int action)
4373{
4374 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4375}
4376
Olivier Deprez157378f2022-04-04 15:47:50 +02004377static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4378 const struct hda_fixup *fix, int action)
4379{
4380 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4381}
4382
4383static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4384 const struct hda_fixup *fix, int action)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004385{
4386 struct alc_spec *spec = codec->spec;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004387
Olivier Deprez157378f2022-04-04 15:47:50 +02004388 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4389 spec->micmute_led_polarity = 1;
4390 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4391}
4392
4393/* turn on/off mic-mute LED per capture hook via VREF change */
4394static int vref_micmute_led_set(struct led_classdev *led_cdev,
4395 enum led_brightness brightness)
4396{
4397 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4398 struct alc_spec *spec = codec->spec;
4399
4400 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4401 spec->micmute_led_polarity, brightness);
4402 return 0;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004403}
4404
4405static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4406 const struct hda_fixup *fix, int action)
4407{
4408 struct alc_spec *spec = codec->spec;
4409
4410 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4411 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4412 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4413 * enable headphone amp
4414 */
4415 spec->gpio_mask |= 0x10;
4416 spec->gpio_dir |= 0x10;
4417 spec->cap_mute_led_nid = 0x18;
Olivier Deprez157378f2022-04-04 15:47:50 +02004418 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004419 codec->power_filter = led_power_filter;
4420 }
4421}
4422
4423static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4424 const struct hda_fixup *fix, int action)
4425{
4426 struct alc_spec *spec = codec->spec;
4427
4428 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4429 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4430 spec->cap_mute_led_nid = 0x18;
Olivier Deprez157378f2022-04-04 15:47:50 +02004431 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004432 codec->power_filter = led_power_filter;
4433 }
4434}
4435
Olivier Deprez157378f2022-04-04 15:47:50 +02004436/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4437 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4438 */
4439static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4440 const struct hda_fixup *fix, int action)
Olivier Deprez0e641232021-09-23 10:07:05 +02004441{
Olivier Deprez0e641232021-09-23 10:07:05 +02004442 struct alc_spec *spec = codec->spec;
4443
Olivier Deprez157378f2022-04-04 15:47:50 +02004444 switch (action) {
4445 case HDA_FIXUP_ACT_PRE_PROBE:
4446 spec->gpio_mask |= 0x01;
4447 spec->gpio_dir |= 0x01;
4448 break;
4449 case HDA_FIXUP_ACT_INIT:
4450 /* need to toggle GPIO to enable the amp */
4451 alc_update_gpio_data(codec, 0x01, true);
4452 msleep(100);
4453 alc_update_gpio_data(codec, 0x01, false);
4454 break;
4455 }
4456}
Olivier Deprez0e641232021-09-23 10:07:05 +02004457
Olivier Deprez157378f2022-04-04 15:47:50 +02004458/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4459static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4460 struct hda_codec *codec,
4461 struct snd_pcm_substream *substream,
4462 int action)
4463{
4464 switch (action) {
4465 case HDA_GEN_PCM_ACT_PREPARE:
4466 alc_update_gpio_data(codec, 0x04, true);
4467 break;
4468 case HDA_GEN_PCM_ACT_CLEANUP:
4469 alc_update_gpio_data(codec, 0x04, false);
4470 break;
4471 }
4472}
4473
4474static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4475 const struct hda_fixup *fix,
4476 int action)
4477{
4478 struct alc_spec *spec = codec->spec;
4479
4480 if (action == HDA_FIXUP_ACT_PROBE) {
4481 spec->gpio_mask |= 0x04;
4482 spec->gpio_dir |= 0x04;
4483 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4484 }
4485}
4486
4487static void alc_update_coef_led(struct hda_codec *codec,
4488 struct alc_coef_led *led,
4489 bool polarity, bool on)
4490{
4491 if (polarity)
4492 on = !on;
Olivier Deprez0e641232021-09-23 10:07:05 +02004493 /* temporarily power up/down for setting COEF bit */
Olivier Deprez157378f2022-04-04 15:47:50 +02004494 alc_update_coef_idx(codec, led->idx, led->mask,
4495 on ? led->on : led->off);
4496}
4497
4498/* update mute-LED according to the speaker mute state via COEF bit */
4499static int coef_mute_led_set(struct led_classdev *led_cdev,
4500 enum led_brightness brightness)
4501{
4502 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4503 struct alc_spec *spec = codec->spec;
4504
4505 alc_update_coef_led(codec, &spec->mute_led_coef,
4506 spec->mute_led_polarity, brightness);
4507 return 0;
Olivier Deprez0e641232021-09-23 10:07:05 +02004508}
4509
4510static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4511 const struct hda_fixup *fix,
4512 int action)
4513{
4514 struct alc_spec *spec = codec->spec;
4515
4516 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4517 spec->mute_led_polarity = 0;
Olivier Deprez157378f2022-04-04 15:47:50 +02004518 spec->mute_led_coef.idx = 0x0b;
4519 spec->mute_led_coef.mask = 1 << 3;
4520 spec->mute_led_coef.on = 1 << 3;
4521 spec->mute_led_coef.off = 0;
4522 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Olivier Deprez0e641232021-09-23 10:07:05 +02004523 }
4524}
4525
4526static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4527 const struct hda_fixup *fix,
4528 int action)
4529{
4530 struct alc_spec *spec = codec->spec;
4531
4532 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4533 spec->mute_led_polarity = 0;
Olivier Deprez157378f2022-04-04 15:47:50 +02004534 spec->mute_led_coef.idx = 0x34;
4535 spec->mute_led_coef.mask = 1 << 5;
4536 spec->mute_led_coef.on = 0;
4537 spec->mute_led_coef.off = 1 << 5;
4538 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Olivier Deprez0e641232021-09-23 10:07:05 +02004539 }
4540}
4541
4542/* turn on/off mic-mute LED per capture hook by coef bit */
Olivier Deprez157378f2022-04-04 15:47:50 +02004543static int coef_micmute_led_set(struct led_classdev *led_cdev,
4544 enum led_brightness brightness)
Olivier Deprez0e641232021-09-23 10:07:05 +02004545{
Olivier Deprez157378f2022-04-04 15:47:50 +02004546 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Olivier Deprez0e641232021-09-23 10:07:05 +02004547 struct alc_spec *spec = codec->spec;
4548
Olivier Deprez157378f2022-04-04 15:47:50 +02004549 alc_update_coef_led(codec, &spec->mic_led_coef,
4550 spec->micmute_led_polarity, brightness);
4551 return 0;
Olivier Deprez0e641232021-09-23 10:07:05 +02004552}
4553
4554static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4555 const struct hda_fixup *fix, int action)
4556{
4557 struct alc_spec *spec = codec->spec;
4558
4559 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Olivier Deprez157378f2022-04-04 15:47:50 +02004560 spec->mic_led_coef.idx = 0x19;
4561 spec->mic_led_coef.mask = 1 << 13;
4562 spec->mic_led_coef.on = 1 << 13;
4563 spec->mic_led_coef.off = 0;
4564 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Olivier Deprez0e641232021-09-23 10:07:05 +02004565 }
4566}
4567
4568static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4569 const struct hda_fixup *fix, int action)
4570{
4571 struct alc_spec *spec = codec->spec;
4572
4573 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Olivier Deprez157378f2022-04-04 15:47:50 +02004574 spec->mic_led_coef.idx = 0x35;
4575 spec->mic_led_coef.mask = 3 << 2;
4576 spec->mic_led_coef.on = 2 << 2;
4577 spec->mic_led_coef.off = 1 << 2;
4578 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Olivier Deprez0e641232021-09-23 10:07:05 +02004579 }
4580}
4581
4582static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4583 const struct hda_fixup *fix, int action)
4584{
4585 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4586 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4587}
4588
4589static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4590 const struct hda_fixup *fix, int action)
4591{
4592 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4593 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4594}
4595
Olivier Deprez157378f2022-04-04 15:47:50 +02004596static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4597 const struct hda_fixup *fix, int action)
4598{
4599 struct alc_spec *spec = codec->spec;
4600
4601 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4602 spec->cap_mute_led_nid = 0x1a;
4603 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4604 codec->power_filter = led_power_filter;
4605 }
4606}
4607
4608static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4609 const struct hda_fixup *fix, int action)
4610{
4611 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4612 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4613}
4614
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004615#if IS_REACHABLE(CONFIG_INPUT)
4616static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4617 struct hda_jack_callback *event)
4618{
4619 struct alc_spec *spec = codec->spec;
4620
4621 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4622 send both key on and key off event for every interrupt. */
4623 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4624 input_sync(spec->kb_dev);
4625 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4626 input_sync(spec->kb_dev);
4627}
4628
4629static int alc_register_micmute_input_device(struct hda_codec *codec)
4630{
4631 struct alc_spec *spec = codec->spec;
4632 int i;
4633
4634 spec->kb_dev = input_allocate_device();
4635 if (!spec->kb_dev) {
4636 codec_err(codec, "Out of memory (input_allocate_device)\n");
4637 return -ENOMEM;
4638 }
4639
4640 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4641
4642 spec->kb_dev->name = "Microphone Mute Button";
4643 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4644 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4645 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4646 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4647 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4648 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4649
4650 if (input_register_device(spec->kb_dev)) {
4651 codec_err(codec, "input_register_device failed\n");
4652 input_free_device(spec->kb_dev);
4653 spec->kb_dev = NULL;
4654 return -ENOMEM;
4655 }
4656
4657 return 0;
4658}
4659
4660/* GPIO1 = set according to SKU external amp
4661 * GPIO2 = mic mute hotkey
4662 * GPIO3 = mute LED
4663 * GPIO4 = mic mute LED
4664 */
4665static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4666 const struct hda_fixup *fix, int action)
4667{
4668 struct alc_spec *spec = codec->spec;
4669
4670 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4671 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4672 spec->init_amp = ALC_INIT_DEFAULT;
4673 if (alc_register_micmute_input_device(codec) != 0)
4674 return;
4675
4676 spec->gpio_mask |= 0x06;
4677 spec->gpio_dir |= 0x02;
4678 spec->gpio_data |= 0x02;
4679 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4680 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4681 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4682 gpio2_mic_hotkey_event);
4683 return;
4684 }
4685
4686 if (!spec->kb_dev)
4687 return;
4688
4689 switch (action) {
4690 case HDA_FIXUP_ACT_FREE:
4691 input_unregister_device(spec->kb_dev);
4692 spec->kb_dev = NULL;
4693 }
4694}
4695
4696/* Line2 = mic mute hotkey
4697 * GPIO2 = mic mute LED
4698 */
4699static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4700 const struct hda_fixup *fix, int action)
4701{
4702 struct alc_spec *spec = codec->spec;
4703
4704 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4705 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4706 spec->init_amp = ALC_INIT_DEFAULT;
4707 if (alc_register_micmute_input_device(codec) != 0)
4708 return;
4709
4710 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4711 gpio2_mic_hotkey_event);
4712 return;
4713 }
4714
4715 if (!spec->kb_dev)
4716 return;
4717
4718 switch (action) {
4719 case HDA_FIXUP_ACT_FREE:
4720 input_unregister_device(spec->kb_dev);
4721 spec->kb_dev = NULL;
4722 }
4723}
4724#else /* INPUT */
4725#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4726#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4727#endif /* INPUT */
4728
4729static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4730 const struct hda_fixup *fix, int action)
4731{
4732 struct alc_spec *spec = codec->spec;
4733
4734 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4735 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4736 spec->cap_mute_led_nid = 0x18;
Olivier Deprez157378f2022-04-04 15:47:50 +02004737 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004738 }
4739}
4740
Olivier Deprez0e641232021-09-23 10:07:05 +02004741static const struct coef_fw alc225_pre_hsmode[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004742 UPDATE_COEF(0x4a, 1<<8, 0),
4743 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4744 UPDATE_COEF(0x63, 3<<14, 3<<14),
4745 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4746 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4747 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4748 UPDATE_COEF(0x4a, 3<<10, 0),
4749 {}
4750};
4751
4752static void alc_headset_mode_unplugged(struct hda_codec *codec)
4753{
Olivier Deprez157378f2022-04-04 15:47:50 +02004754 struct alc_spec *spec = codec->spec;
Olivier Deprez0e641232021-09-23 10:07:05 +02004755 static const struct coef_fw coef0255[] = {
David Brazdil0f672f62019-12-10 10:32:29 +00004756 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004757 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4758 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4759 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4760 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4761 {}
4762 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004763 static const struct coef_fw coef0256[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004764 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
David Brazdil0f672f62019-12-10 10:32:29 +00004765 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4766 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4767 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4768 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004769 {}
4770 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004771 static const struct coef_fw coef0233[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004772 WRITE_COEF(0x1b, 0x0c0b),
4773 WRITE_COEF(0x45, 0xc429),
4774 UPDATE_COEF(0x35, 0x4000, 0),
4775 WRITE_COEF(0x06, 0x2104),
4776 WRITE_COEF(0x1a, 0x0001),
4777 WRITE_COEF(0x26, 0x0004),
4778 WRITE_COEF(0x32, 0x42a3),
4779 {}
4780 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004781 static const struct coef_fw coef0288[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004782 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4783 UPDATE_COEF(0x50, 0x2000, 0x2000),
4784 UPDATE_COEF(0x56, 0x0006, 0x0006),
4785 UPDATE_COEF(0x66, 0x0008, 0),
4786 UPDATE_COEF(0x67, 0x2000, 0),
4787 {}
4788 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004789 static const struct coef_fw coef0298[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004790 UPDATE_COEF(0x19, 0x1300, 0x0300),
4791 {}
4792 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004793 static const struct coef_fw coef0292[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004794 WRITE_COEF(0x76, 0x000e),
4795 WRITE_COEF(0x6c, 0x2400),
4796 WRITE_COEF(0x18, 0x7308),
4797 WRITE_COEF(0x6b, 0xc429),
4798 {}
4799 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004800 static const struct coef_fw coef0293[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004801 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4802 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4803 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4804 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4805 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4806 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4807 {}
4808 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004809 static const struct coef_fw coef0668[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004810 WRITE_COEF(0x15, 0x0d40),
4811 WRITE_COEF(0xb7, 0x802b),
4812 {}
4813 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004814 static const struct coef_fw coef0225[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004815 UPDATE_COEF(0x63, 3<<14, 0),
4816 {}
4817 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004818 static const struct coef_fw coef0274[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004819 UPDATE_COEF(0x4a, 0x0100, 0),
4820 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4821 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4822 UPDATE_COEF(0x4a, 0x0010, 0),
4823 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4824 WRITE_COEF(0x45, 0x5289),
4825 UPDATE_COEF(0x4a, 0x0c00, 0),
4826 {}
4827 };
4828
Olivier Deprez157378f2022-04-04 15:47:50 +02004829 if (spec->no_internal_mic_pin) {
4830 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4831 return;
4832 }
4833
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004834 switch (codec->core.vendor_id) {
4835 case 0x10ec0255:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004836 alc_process_coef_fw(codec, coef0255);
4837 break;
Olivier Deprez0e641232021-09-23 10:07:05 +02004838 case 0x10ec0230:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004839 case 0x10ec0236:
4840 case 0x10ec0256:
4841 alc_process_coef_fw(codec, coef0256);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004842 break;
4843 case 0x10ec0234:
4844 case 0x10ec0274:
4845 case 0x10ec0294:
4846 alc_process_coef_fw(codec, coef0274);
4847 break;
4848 case 0x10ec0233:
4849 case 0x10ec0283:
4850 alc_process_coef_fw(codec, coef0233);
4851 break;
4852 case 0x10ec0286:
4853 case 0x10ec0288:
4854 alc_process_coef_fw(codec, coef0288);
4855 break;
4856 case 0x10ec0298:
4857 alc_process_coef_fw(codec, coef0298);
4858 alc_process_coef_fw(codec, coef0288);
4859 break;
4860 case 0x10ec0292:
4861 alc_process_coef_fw(codec, coef0292);
4862 break;
4863 case 0x10ec0293:
4864 alc_process_coef_fw(codec, coef0293);
4865 break;
4866 case 0x10ec0668:
4867 alc_process_coef_fw(codec, coef0668);
4868 break;
4869 case 0x10ec0215:
4870 case 0x10ec0225:
4871 case 0x10ec0285:
4872 case 0x10ec0295:
4873 case 0x10ec0289:
4874 case 0x10ec0299:
David Brazdil0f672f62019-12-10 10:32:29 +00004875 alc_process_coef_fw(codec, alc225_pre_hsmode);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004876 alc_process_coef_fw(codec, coef0225);
4877 break;
4878 case 0x10ec0867:
4879 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4880 break;
4881 }
4882 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
4883}
4884
4885
4886static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4887 hda_nid_t mic_pin)
4888{
Olivier Deprez0e641232021-09-23 10:07:05 +02004889 static const struct coef_fw coef0255[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004890 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4891 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4892 {}
4893 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004894 static const struct coef_fw coef0256[] = {
David Brazdil0f672f62019-12-10 10:32:29 +00004895 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4896 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4897 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4898 {}
4899 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004900 static const struct coef_fw coef0233[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004901 UPDATE_COEF(0x35, 0, 1<<14),
4902 WRITE_COEF(0x06, 0x2100),
4903 WRITE_COEF(0x1a, 0x0021),
4904 WRITE_COEF(0x26, 0x008c),
4905 {}
4906 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004907 static const struct coef_fw coef0288[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004908 UPDATE_COEF(0x4f, 0x00c0, 0),
4909 UPDATE_COEF(0x50, 0x2000, 0),
4910 UPDATE_COEF(0x56, 0x0006, 0),
4911 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4912 UPDATE_COEF(0x66, 0x0008, 0x0008),
4913 UPDATE_COEF(0x67, 0x2000, 0x2000),
4914 {}
4915 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004916 static const struct coef_fw coef0292[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004917 WRITE_COEF(0x19, 0xa208),
4918 WRITE_COEF(0x2e, 0xacf0),
4919 {}
4920 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004921 static const struct coef_fw coef0293[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004922 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4923 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4924 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4925 {}
4926 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004927 static const struct coef_fw coef0688[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004928 WRITE_COEF(0xb7, 0x802b),
4929 WRITE_COEF(0xb5, 0x1040),
4930 UPDATE_COEF(0xc3, 0, 1<<12),
4931 {}
4932 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004933 static const struct coef_fw coef0225[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004934 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4935 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4936 UPDATE_COEF(0x63, 3<<14, 0),
4937 {}
4938 };
Olivier Deprez0e641232021-09-23 10:07:05 +02004939 static const struct coef_fw coef0274[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004940 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4941 UPDATE_COEF(0x4a, 0x0010, 0),
4942 UPDATE_COEF(0x6b, 0xf000, 0),
4943 {}
4944 };
4945
4946 switch (codec->core.vendor_id) {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004947 case 0x10ec0255:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004948 alc_write_coef_idx(codec, 0x45, 0xc489);
4949 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4950 alc_process_coef_fw(codec, coef0255);
4951 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4952 break;
Olivier Deprez0e641232021-09-23 10:07:05 +02004953 case 0x10ec0230:
David Brazdil0f672f62019-12-10 10:32:29 +00004954 case 0x10ec0236:
4955 case 0x10ec0256:
4956 alc_write_coef_idx(codec, 0x45, 0xc489);
4957 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4958 alc_process_coef_fw(codec, coef0256);
4959 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4960 break;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004961 case 0x10ec0234:
4962 case 0x10ec0274:
4963 case 0x10ec0294:
4964 alc_write_coef_idx(codec, 0x45, 0x4689);
4965 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4966 alc_process_coef_fw(codec, coef0274);
4967 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4968 break;
4969 case 0x10ec0233:
4970 case 0x10ec0283:
4971 alc_write_coef_idx(codec, 0x45, 0xc429);
4972 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4973 alc_process_coef_fw(codec, coef0233);
4974 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4975 break;
4976 case 0x10ec0286:
4977 case 0x10ec0288:
4978 case 0x10ec0298:
4979 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4980 alc_process_coef_fw(codec, coef0288);
4981 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4982 break;
4983 case 0x10ec0292:
4984 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4985 alc_process_coef_fw(codec, coef0292);
4986 break;
4987 case 0x10ec0293:
4988 /* Set to TRS mode */
4989 alc_write_coef_idx(codec, 0x45, 0xc429);
4990 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4991 alc_process_coef_fw(codec, coef0293);
4992 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4993 break;
4994 case 0x10ec0867:
4995 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Olivier Deprez157378f2022-04-04 15:47:50 +02004996 fallthrough;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004997 case 0x10ec0221:
4998 case 0x10ec0662:
4999 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5000 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5001 break;
5002 case 0x10ec0668:
5003 alc_write_coef_idx(codec, 0x11, 0x0001);
5004 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5005 alc_process_coef_fw(codec, coef0688);
5006 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5007 break;
5008 case 0x10ec0215:
5009 case 0x10ec0225:
5010 case 0x10ec0285:
5011 case 0x10ec0295:
5012 case 0x10ec0289:
5013 case 0x10ec0299:
5014 alc_process_coef_fw(codec, alc225_pre_hsmode);
5015 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5016 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5017 alc_process_coef_fw(codec, coef0225);
5018 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5019 break;
5020 }
5021 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5022}
5023
5024static void alc_headset_mode_default(struct hda_codec *codec)
5025{
Olivier Deprez0e641232021-09-23 10:07:05 +02005026 static const struct coef_fw coef0225[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005027 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5028 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5029 UPDATE_COEF(0x49, 3<<8, 0<<8),
5030 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5031 UPDATE_COEF(0x63, 3<<14, 0),
5032 UPDATE_COEF(0x67, 0xf000, 0x3000),
5033 {}
5034 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005035 static const struct coef_fw coef0255[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005036 WRITE_COEF(0x45, 0xc089),
5037 WRITE_COEF(0x45, 0xc489),
5038 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5039 WRITE_COEF(0x49, 0x0049),
5040 {}
5041 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005042 static const struct coef_fw coef0256[] = {
David Brazdil0f672f62019-12-10 10:32:29 +00005043 WRITE_COEF(0x45, 0xc489),
5044 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5045 WRITE_COEF(0x49, 0x0049),
5046 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5047 WRITE_COEF(0x06, 0x6100),
5048 {}
5049 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005050 static const struct coef_fw coef0233[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005051 WRITE_COEF(0x06, 0x2100),
5052 WRITE_COEF(0x32, 0x4ea3),
5053 {}
5054 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005055 static const struct coef_fw coef0288[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005056 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5057 UPDATE_COEF(0x50, 0x2000, 0x2000),
5058 UPDATE_COEF(0x56, 0x0006, 0x0006),
5059 UPDATE_COEF(0x66, 0x0008, 0),
5060 UPDATE_COEF(0x67, 0x2000, 0),
5061 {}
5062 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005063 static const struct coef_fw coef0292[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005064 WRITE_COEF(0x76, 0x000e),
5065 WRITE_COEF(0x6c, 0x2400),
5066 WRITE_COEF(0x6b, 0xc429),
5067 WRITE_COEF(0x18, 0x7308),
5068 {}
5069 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005070 static const struct coef_fw coef0293[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005071 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5072 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5073 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5074 {}
5075 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005076 static const struct coef_fw coef0688[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005077 WRITE_COEF(0x11, 0x0041),
5078 WRITE_COEF(0x15, 0x0d40),
5079 WRITE_COEF(0xb7, 0x802b),
5080 {}
5081 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005082 static const struct coef_fw coef0274[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005083 WRITE_COEF(0x45, 0x4289),
5084 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5085 UPDATE_COEF(0x6b, 0x0f00, 0),
5086 UPDATE_COEF(0x49, 0x0300, 0x0300),
5087 {}
5088 };
5089
5090 switch (codec->core.vendor_id) {
5091 case 0x10ec0215:
5092 case 0x10ec0225:
5093 case 0x10ec0285:
5094 case 0x10ec0295:
5095 case 0x10ec0289:
5096 case 0x10ec0299:
5097 alc_process_coef_fw(codec, alc225_pre_hsmode);
5098 alc_process_coef_fw(codec, coef0225);
5099 break;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005100 case 0x10ec0255:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005101 alc_process_coef_fw(codec, coef0255);
5102 break;
Olivier Deprez0e641232021-09-23 10:07:05 +02005103 case 0x10ec0230:
David Brazdil0f672f62019-12-10 10:32:29 +00005104 case 0x10ec0236:
5105 case 0x10ec0256:
5106 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5107 alc_write_coef_idx(codec, 0x45, 0xc089);
5108 msleep(50);
5109 alc_process_coef_fw(codec, coef0256);
5110 break;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005111 case 0x10ec0234:
5112 case 0x10ec0274:
5113 case 0x10ec0294:
5114 alc_process_coef_fw(codec, coef0274);
5115 break;
5116 case 0x10ec0233:
5117 case 0x10ec0283:
5118 alc_process_coef_fw(codec, coef0233);
5119 break;
5120 case 0x10ec0286:
5121 case 0x10ec0288:
5122 case 0x10ec0298:
5123 alc_process_coef_fw(codec, coef0288);
5124 break;
5125 case 0x10ec0292:
5126 alc_process_coef_fw(codec, coef0292);
5127 break;
5128 case 0x10ec0293:
5129 alc_process_coef_fw(codec, coef0293);
5130 break;
5131 case 0x10ec0668:
5132 alc_process_coef_fw(codec, coef0688);
5133 break;
5134 case 0x10ec0867:
5135 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5136 break;
5137 }
5138 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5139}
5140
5141/* Iphone type */
5142static void alc_headset_mode_ctia(struct hda_codec *codec)
5143{
5144 int val;
5145
Olivier Deprez0e641232021-09-23 10:07:05 +02005146 static const struct coef_fw coef0255[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005147 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5148 WRITE_COEF(0x1b, 0x0c2b),
5149 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5150 {}
5151 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005152 static const struct coef_fw coef0256[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005153 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
David Brazdil0f672f62019-12-10 10:32:29 +00005154 WRITE_COEF(0x1b, 0x0e6b),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005155 {}
5156 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005157 static const struct coef_fw coef0233[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005158 WRITE_COEF(0x45, 0xd429),
5159 WRITE_COEF(0x1b, 0x0c2b),
5160 WRITE_COEF(0x32, 0x4ea3),
5161 {}
5162 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005163 static const struct coef_fw coef0288[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005164 UPDATE_COEF(0x50, 0x2000, 0x2000),
5165 UPDATE_COEF(0x56, 0x0006, 0x0006),
5166 UPDATE_COEF(0x66, 0x0008, 0),
5167 UPDATE_COEF(0x67, 0x2000, 0),
5168 {}
5169 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005170 static const struct coef_fw coef0292[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005171 WRITE_COEF(0x6b, 0xd429),
5172 WRITE_COEF(0x76, 0x0008),
5173 WRITE_COEF(0x18, 0x7388),
5174 {}
5175 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005176 static const struct coef_fw coef0293[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005177 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5178 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5179 {}
5180 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005181 static const struct coef_fw coef0688[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005182 WRITE_COEF(0x11, 0x0001),
5183 WRITE_COEF(0x15, 0x0d60),
5184 WRITE_COEF(0xc3, 0x0000),
5185 {}
5186 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005187 static const struct coef_fw coef0225_1[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005188 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5189 UPDATE_COEF(0x63, 3<<14, 2<<14),
5190 {}
5191 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005192 static const struct coef_fw coef0225_2[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005193 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5194 UPDATE_COEF(0x63, 3<<14, 1<<14),
5195 {}
5196 };
5197
5198 switch (codec->core.vendor_id) {
5199 case 0x10ec0255:
5200 alc_process_coef_fw(codec, coef0255);
5201 break;
Olivier Deprez0e641232021-09-23 10:07:05 +02005202 case 0x10ec0230:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005203 case 0x10ec0236:
5204 case 0x10ec0256:
5205 alc_process_coef_fw(codec, coef0256);
5206 break;
5207 case 0x10ec0234:
5208 case 0x10ec0274:
5209 case 0x10ec0294:
5210 alc_write_coef_idx(codec, 0x45, 0xd689);
5211 break;
5212 case 0x10ec0233:
5213 case 0x10ec0283:
5214 alc_process_coef_fw(codec, coef0233);
5215 break;
5216 case 0x10ec0298:
5217 val = alc_read_coef_idx(codec, 0x50);
5218 if (val & (1 << 12)) {
5219 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5220 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5221 msleep(300);
5222 } else {
5223 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5224 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5225 msleep(300);
5226 }
5227 break;
5228 case 0x10ec0286:
5229 case 0x10ec0288:
5230 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5231 msleep(300);
5232 alc_process_coef_fw(codec, coef0288);
5233 break;
5234 case 0x10ec0292:
5235 alc_process_coef_fw(codec, coef0292);
5236 break;
5237 case 0x10ec0293:
5238 alc_process_coef_fw(codec, coef0293);
5239 break;
5240 case 0x10ec0668:
5241 alc_process_coef_fw(codec, coef0688);
5242 break;
5243 case 0x10ec0215:
5244 case 0x10ec0225:
5245 case 0x10ec0285:
5246 case 0x10ec0295:
5247 case 0x10ec0289:
5248 case 0x10ec0299:
5249 val = alc_read_coef_idx(codec, 0x45);
5250 if (val & (1 << 9))
5251 alc_process_coef_fw(codec, coef0225_2);
5252 else
5253 alc_process_coef_fw(codec, coef0225_1);
5254 break;
5255 case 0x10ec0867:
5256 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5257 break;
5258 }
5259 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5260}
5261
5262/* Nokia type */
5263static void alc_headset_mode_omtp(struct hda_codec *codec)
5264{
Olivier Deprez0e641232021-09-23 10:07:05 +02005265 static const struct coef_fw coef0255[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005266 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5267 WRITE_COEF(0x1b, 0x0c2b),
5268 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5269 {}
5270 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005271 static const struct coef_fw coef0256[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005272 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
David Brazdil0f672f62019-12-10 10:32:29 +00005273 WRITE_COEF(0x1b, 0x0e6b),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005274 {}
5275 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005276 static const struct coef_fw coef0233[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005277 WRITE_COEF(0x45, 0xe429),
5278 WRITE_COEF(0x1b, 0x0c2b),
5279 WRITE_COEF(0x32, 0x4ea3),
5280 {}
5281 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005282 static const struct coef_fw coef0288[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005283 UPDATE_COEF(0x50, 0x2000, 0x2000),
5284 UPDATE_COEF(0x56, 0x0006, 0x0006),
5285 UPDATE_COEF(0x66, 0x0008, 0),
5286 UPDATE_COEF(0x67, 0x2000, 0),
5287 {}
5288 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005289 static const struct coef_fw coef0292[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005290 WRITE_COEF(0x6b, 0xe429),
5291 WRITE_COEF(0x76, 0x0008),
5292 WRITE_COEF(0x18, 0x7388),
5293 {}
5294 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005295 static const struct coef_fw coef0293[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005296 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5297 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5298 {}
5299 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005300 static const struct coef_fw coef0688[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005301 WRITE_COEF(0x11, 0x0001),
5302 WRITE_COEF(0x15, 0x0d50),
5303 WRITE_COEF(0xc3, 0x0000),
5304 {}
5305 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005306 static const struct coef_fw coef0225[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005307 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5308 UPDATE_COEF(0x63, 3<<14, 2<<14),
5309 {}
5310 };
5311
5312 switch (codec->core.vendor_id) {
5313 case 0x10ec0255:
5314 alc_process_coef_fw(codec, coef0255);
5315 break;
Olivier Deprez0e641232021-09-23 10:07:05 +02005316 case 0x10ec0230:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005317 case 0x10ec0236:
5318 case 0x10ec0256:
5319 alc_process_coef_fw(codec, coef0256);
5320 break;
5321 case 0x10ec0234:
5322 case 0x10ec0274:
5323 case 0x10ec0294:
5324 alc_write_coef_idx(codec, 0x45, 0xe689);
5325 break;
5326 case 0x10ec0233:
5327 case 0x10ec0283:
5328 alc_process_coef_fw(codec, coef0233);
5329 break;
5330 case 0x10ec0298:
5331 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5332 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5333 msleep(300);
5334 break;
5335 case 0x10ec0286:
5336 case 0x10ec0288:
5337 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5338 msleep(300);
5339 alc_process_coef_fw(codec, coef0288);
5340 break;
5341 case 0x10ec0292:
5342 alc_process_coef_fw(codec, coef0292);
5343 break;
5344 case 0x10ec0293:
5345 alc_process_coef_fw(codec, coef0293);
5346 break;
5347 case 0x10ec0668:
5348 alc_process_coef_fw(codec, coef0688);
5349 break;
5350 case 0x10ec0215:
5351 case 0x10ec0225:
5352 case 0x10ec0285:
5353 case 0x10ec0295:
5354 case 0x10ec0289:
5355 case 0x10ec0299:
5356 alc_process_coef_fw(codec, coef0225);
5357 break;
5358 }
5359 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5360}
5361
5362static void alc_determine_headset_type(struct hda_codec *codec)
5363{
5364 int val;
5365 bool is_ctia = false;
5366 struct alc_spec *spec = codec->spec;
Olivier Deprez0e641232021-09-23 10:07:05 +02005367 static const struct coef_fw coef0255[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005368 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5369 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5370 conteol) */
5371 {}
5372 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005373 static const struct coef_fw coef0288[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005374 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5375 {}
5376 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005377 static const struct coef_fw coef0298[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005378 UPDATE_COEF(0x50, 0x2000, 0x2000),
5379 UPDATE_COEF(0x56, 0x0006, 0x0006),
5380 UPDATE_COEF(0x66, 0x0008, 0),
5381 UPDATE_COEF(0x67, 0x2000, 0),
5382 UPDATE_COEF(0x19, 0x1300, 0x1300),
5383 {}
5384 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005385 static const struct coef_fw coef0293[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005386 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5387 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5388 {}
5389 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005390 static const struct coef_fw coef0688[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005391 WRITE_COEF(0x11, 0x0001),
5392 WRITE_COEF(0xb7, 0x802b),
5393 WRITE_COEF(0x15, 0x0d60),
5394 WRITE_COEF(0xc3, 0x0c00),
5395 {}
5396 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005397 static const struct coef_fw coef0274[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005398 UPDATE_COEF(0x4a, 0x0010, 0),
5399 UPDATE_COEF(0x4a, 0x8000, 0),
5400 WRITE_COEF(0x45, 0xd289),
5401 UPDATE_COEF(0x49, 0x0300, 0x0300),
5402 {}
5403 };
5404
Olivier Deprez157378f2022-04-04 15:47:50 +02005405 if (spec->no_internal_mic_pin) {
5406 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5407 return;
5408 }
5409
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005410 switch (codec->core.vendor_id) {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005411 case 0x10ec0255:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005412 alc_process_coef_fw(codec, coef0255);
5413 msleep(300);
5414 val = alc_read_coef_idx(codec, 0x46);
5415 is_ctia = (val & 0x0070) == 0x0070;
5416 break;
Olivier Deprez0e641232021-09-23 10:07:05 +02005417 case 0x10ec0230:
David Brazdil0f672f62019-12-10 10:32:29 +00005418 case 0x10ec0236:
5419 case 0x10ec0256:
5420 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5421 alc_write_coef_idx(codec, 0x06, 0x6104);
5422 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5423
5424 snd_hda_codec_write(codec, 0x21, 0,
5425 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5426 msleep(80);
5427 snd_hda_codec_write(codec, 0x21, 0,
5428 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5429
5430 alc_process_coef_fw(codec, coef0255);
5431 msleep(300);
5432 val = alc_read_coef_idx(codec, 0x46);
5433 is_ctia = (val & 0x0070) == 0x0070;
5434
5435 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5436 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5437
5438 snd_hda_codec_write(codec, 0x21, 0,
5439 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5440 msleep(80);
5441 snd_hda_codec_write(codec, 0x21, 0,
5442 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5443 break;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005444 case 0x10ec0234:
5445 case 0x10ec0274:
5446 case 0x10ec0294:
5447 alc_process_coef_fw(codec, coef0274);
Olivier Deprez0e641232021-09-23 10:07:05 +02005448 msleep(850);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005449 val = alc_read_coef_idx(codec, 0x46);
5450 is_ctia = (val & 0x00f0) == 0x00f0;
5451 break;
5452 case 0x10ec0233:
5453 case 0x10ec0283:
5454 alc_write_coef_idx(codec, 0x45, 0xd029);
5455 msleep(300);
5456 val = alc_read_coef_idx(codec, 0x46);
5457 is_ctia = (val & 0x0070) == 0x0070;
5458 break;
5459 case 0x10ec0298:
5460 snd_hda_codec_write(codec, 0x21, 0,
5461 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5462 msleep(100);
5463 snd_hda_codec_write(codec, 0x21, 0,
5464 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5465 msleep(200);
5466
5467 val = alc_read_coef_idx(codec, 0x50);
5468 if (val & (1 << 12)) {
5469 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5470 alc_process_coef_fw(codec, coef0288);
5471 msleep(350);
5472 val = alc_read_coef_idx(codec, 0x50);
5473 is_ctia = (val & 0x0070) == 0x0070;
5474 } else {
5475 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5476 alc_process_coef_fw(codec, coef0288);
5477 msleep(350);
5478 val = alc_read_coef_idx(codec, 0x50);
5479 is_ctia = (val & 0x0070) == 0x0070;
5480 }
5481 alc_process_coef_fw(codec, coef0298);
5482 snd_hda_codec_write(codec, 0x21, 0,
5483 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5484 msleep(75);
5485 snd_hda_codec_write(codec, 0x21, 0,
5486 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5487 break;
5488 case 0x10ec0286:
5489 case 0x10ec0288:
5490 alc_process_coef_fw(codec, coef0288);
5491 msleep(350);
5492 val = alc_read_coef_idx(codec, 0x50);
5493 is_ctia = (val & 0x0070) == 0x0070;
5494 break;
5495 case 0x10ec0292:
5496 alc_write_coef_idx(codec, 0x6b, 0xd429);
5497 msleep(300);
5498 val = alc_read_coef_idx(codec, 0x6c);
5499 is_ctia = (val & 0x001c) == 0x001c;
5500 break;
5501 case 0x10ec0293:
5502 alc_process_coef_fw(codec, coef0293);
5503 msleep(300);
5504 val = alc_read_coef_idx(codec, 0x46);
5505 is_ctia = (val & 0x0070) == 0x0070;
5506 break;
5507 case 0x10ec0668:
5508 alc_process_coef_fw(codec, coef0688);
5509 msleep(300);
5510 val = alc_read_coef_idx(codec, 0xbe);
5511 is_ctia = (val & 0x1c02) == 0x1c02;
5512 break;
5513 case 0x10ec0215:
5514 case 0x10ec0225:
5515 case 0x10ec0285:
5516 case 0x10ec0295:
5517 case 0x10ec0289:
5518 case 0x10ec0299:
5519 snd_hda_codec_write(codec, 0x21, 0,
5520 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5521 msleep(80);
5522 snd_hda_codec_write(codec, 0x21, 0,
5523 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5524
5525 alc_process_coef_fw(codec, alc225_pre_hsmode);
5526 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5527 val = alc_read_coef_idx(codec, 0x45);
5528 if (val & (1 << 9)) {
5529 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5530 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5531 msleep(800);
5532 val = alc_read_coef_idx(codec, 0x46);
5533 is_ctia = (val & 0x00f0) == 0x00f0;
5534 } else {
5535 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5536 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5537 msleep(800);
5538 val = alc_read_coef_idx(codec, 0x46);
5539 is_ctia = (val & 0x00f0) == 0x00f0;
5540 }
5541 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5542 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5543 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5544
5545 snd_hda_codec_write(codec, 0x21, 0,
5546 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5547 msleep(80);
5548 snd_hda_codec_write(codec, 0x21, 0,
5549 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5550 break;
5551 case 0x10ec0867:
5552 is_ctia = true;
5553 break;
5554 }
5555
5556 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5557 is_ctia ? "yes" : "no");
5558 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5559}
5560
5561static void alc_update_headset_mode(struct hda_codec *codec)
5562{
5563 struct alc_spec *spec = codec->spec;
5564
5565 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
David Brazdil0f672f62019-12-10 10:32:29 +00005566 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005567
5568 int new_headset_mode;
5569
5570 if (!snd_hda_jack_detect(codec, hp_pin))
5571 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5572 else if (mux_pin == spec->headset_mic_pin)
5573 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5574 else if (mux_pin == spec->headphone_mic_pin)
5575 new_headset_mode = ALC_HEADSET_MODE_MIC;
5576 else
5577 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5578
5579 if (new_headset_mode == spec->current_headset_mode) {
5580 snd_hda_gen_update_outputs(codec);
5581 return;
5582 }
5583
5584 switch (new_headset_mode) {
5585 case ALC_HEADSET_MODE_UNPLUGGED:
5586 alc_headset_mode_unplugged(codec);
David Brazdil0f672f62019-12-10 10:32:29 +00005587 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5588 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005589 spec->gen.hp_jack_present = false;
5590 break;
5591 case ALC_HEADSET_MODE_HEADSET:
5592 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5593 alc_determine_headset_type(codec);
5594 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5595 alc_headset_mode_ctia(codec);
5596 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5597 alc_headset_mode_omtp(codec);
5598 spec->gen.hp_jack_present = true;
5599 break;
5600 case ALC_HEADSET_MODE_MIC:
5601 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5602 spec->gen.hp_jack_present = false;
5603 break;
5604 case ALC_HEADSET_MODE_HEADPHONE:
5605 alc_headset_mode_default(codec);
5606 spec->gen.hp_jack_present = true;
5607 break;
5608 }
5609 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5610 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5611 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5612 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5613 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5614 PIN_VREFHIZ);
5615 }
5616 spec->current_headset_mode = new_headset_mode;
5617
5618 snd_hda_gen_update_outputs(codec);
5619}
5620
5621static void alc_update_headset_mode_hook(struct hda_codec *codec,
5622 struct snd_kcontrol *kcontrol,
5623 struct snd_ctl_elem_value *ucontrol)
5624{
5625 alc_update_headset_mode(codec);
5626}
5627
5628static void alc_update_headset_jack_cb(struct hda_codec *codec,
5629 struct hda_jack_callback *jack)
5630{
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005631 snd_hda_gen_hp_automute(codec, jack);
Olivier Deprez0e641232021-09-23 10:07:05 +02005632 alc_update_headset_mode(codec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005633}
5634
5635static void alc_probe_headset_mode(struct hda_codec *codec)
5636{
5637 int i;
5638 struct alc_spec *spec = codec->spec;
5639 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5640
5641 /* Find mic pins */
5642 for (i = 0; i < cfg->num_inputs; i++) {
5643 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5644 spec->headset_mic_pin = cfg->inputs[i].pin;
5645 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5646 spec->headphone_mic_pin = cfg->inputs[i].pin;
5647 }
5648
5649 WARN_ON(spec->gen.cap_sync_hook);
5650 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5651 spec->gen.automute_hook = alc_update_headset_mode;
5652 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5653}
5654
5655static void alc_fixup_headset_mode(struct hda_codec *codec,
5656 const struct hda_fixup *fix, int action)
5657{
5658 struct alc_spec *spec = codec->spec;
5659
5660 switch (action) {
5661 case HDA_FIXUP_ACT_PRE_PROBE:
5662 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5663 break;
5664 case HDA_FIXUP_ACT_PROBE:
5665 alc_probe_headset_mode(codec);
5666 break;
5667 case HDA_FIXUP_ACT_INIT:
David Brazdil0f672f62019-12-10 10:32:29 +00005668 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5669 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5670 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5671 }
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005672 alc_update_headset_mode(codec);
5673 break;
5674 }
5675}
5676
5677static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5678 const struct hda_fixup *fix, int action)
5679{
5680 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5681 struct alc_spec *spec = codec->spec;
5682 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5683 }
5684 else
5685 alc_fixup_headset_mode(codec, fix, action);
5686}
5687
5688static void alc255_set_default_jack_type(struct hda_codec *codec)
5689{
5690 /* Set to iphone type */
Olivier Deprez0e641232021-09-23 10:07:05 +02005691 static const struct coef_fw alc255fw[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005692 WRITE_COEF(0x1b, 0x880b),
5693 WRITE_COEF(0x45, 0xd089),
5694 WRITE_COEF(0x1b, 0x080b),
5695 WRITE_COEF(0x46, 0x0004),
5696 WRITE_COEF(0x1b, 0x0c0b),
5697 {}
5698 };
Olivier Deprez0e641232021-09-23 10:07:05 +02005699 static const struct coef_fw alc256fw[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005700 WRITE_COEF(0x1b, 0x884b),
5701 WRITE_COEF(0x45, 0xd089),
5702 WRITE_COEF(0x1b, 0x084b),
5703 WRITE_COEF(0x46, 0x0004),
5704 WRITE_COEF(0x1b, 0x0c4b),
5705 {}
5706 };
5707 switch (codec->core.vendor_id) {
5708 case 0x10ec0255:
5709 alc_process_coef_fw(codec, alc255fw);
5710 break;
Olivier Deprez0e641232021-09-23 10:07:05 +02005711 case 0x10ec0230:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005712 case 0x10ec0236:
5713 case 0x10ec0256:
5714 alc_process_coef_fw(codec, alc256fw);
5715 break;
5716 }
5717 msleep(30);
5718}
5719
5720static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5721 const struct hda_fixup *fix, int action)
5722{
5723 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5724 alc255_set_default_jack_type(codec);
5725 }
5726 alc_fixup_headset_mode(codec, fix, action);
5727}
5728
5729static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5730 const struct hda_fixup *fix, int action)
5731{
5732 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5733 struct alc_spec *spec = codec->spec;
5734 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5735 alc255_set_default_jack_type(codec);
5736 }
5737 else
5738 alc_fixup_headset_mode(codec, fix, action);
5739}
5740
5741static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5742 struct hda_jack_callback *jack)
5743{
5744 struct alc_spec *spec = codec->spec;
5745
5746 alc_update_headset_jack_cb(codec, jack);
5747 /* Headset Mic enable or disable, only for Dell Dino */
5748 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5749}
5750
5751static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5752 const struct hda_fixup *fix, int action)
5753{
5754 alc_fixup_headset_mode(codec, fix, action);
5755 if (action == HDA_FIXUP_ACT_PROBE) {
5756 struct alc_spec *spec = codec->spec;
5757 /* toggled via hp_automute_hook */
5758 spec->gpio_mask |= 0x40;
5759 spec->gpio_dir |= 0x40;
5760 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5761 }
5762}
5763
5764static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5765 const struct hda_fixup *fix, int action)
5766{
5767 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5768 struct alc_spec *spec = codec->spec;
5769 spec->gen.auto_mute_via_amp = 1;
5770 }
5771}
5772
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005773static void alc_fixup_no_shutup(struct hda_codec *codec,
5774 const struct hda_fixup *fix, int action)
5775{
5776 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5777 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00005778 spec->no_shutup_pins = 1;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005779 }
5780}
5781
5782static void alc_fixup_disable_aamix(struct hda_codec *codec,
5783 const struct hda_fixup *fix, int action)
5784{
5785 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5786 struct alc_spec *spec = codec->spec;
5787 /* Disable AA-loopback as it causes white noise */
5788 spec->gen.mixer_nid = 0;
5789 }
5790}
5791
5792/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5793static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5794 const struct hda_fixup *fix, int action)
5795{
5796 static const struct hda_pintbl pincfgs[] = {
5797 { 0x16, 0x21211010 }, /* dock headphone */
5798 { 0x19, 0x21a11010 }, /* dock mic */
5799 { }
5800 };
5801 struct alc_spec *spec = codec->spec;
5802
5803 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Brazdil0f672f62019-12-10 10:32:29 +00005804 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005805 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5806 codec->power_save_node = 0; /* avoid click noises */
5807 snd_hda_apply_pincfgs(codec, pincfgs);
5808 }
5809}
5810
5811static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5812 const struct hda_fixup *fix, int action)
5813{
5814 static const struct hda_pintbl pincfgs[] = {
5815 { 0x17, 0x21211010 }, /* dock headphone */
5816 { 0x19, 0x21a11010 }, /* dock mic */
5817 { }
5818 };
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005819 struct alc_spec *spec = codec->spec;
5820
5821 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005822 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5823 snd_hda_apply_pincfgs(codec, pincfgs);
5824 } else if (action == HDA_FIXUP_ACT_INIT) {
5825 /* Enable DOCK device */
5826 snd_hda_codec_write(codec, 0x17, 0,
5827 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5828 /* Enable DOCK device */
5829 snd_hda_codec_write(codec, 0x19, 0,
5830 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5831 }
5832}
5833
Olivier Deprez0e641232021-09-23 10:07:05 +02005834static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5835 const struct hda_fixup *fix, int action)
5836{
5837 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5838 * the speaker output becomes too low by some reason on Thinkpads with
5839 * ALC298 codec
5840 */
5841 static const hda_nid_t preferred_pairs[] = {
5842 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5843 0
5844 };
5845 struct alc_spec *spec = codec->spec;
5846
5847 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5848 spec->gen.preferred_dacs = preferred_pairs;
5849}
5850
5851static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5852 const struct hda_fixup *fix, int action)
5853{
5854 static const hda_nid_t preferred_pairs[] = {
5855 0x17, 0x02, 0x21, 0x03, 0
5856 };
5857 struct alc_spec *spec = codec->spec;
5858
5859 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5860 spec->gen.preferred_dacs = preferred_pairs;
5861}
5862
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005863static void alc_shutup_dell_xps13(struct hda_codec *codec)
5864{
5865 struct alc_spec *spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00005866 int hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005867
5868 /* Prevent pop noises when headphones are plugged in */
5869 snd_hda_codec_write(codec, hp_pin, 0,
5870 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5871 msleep(20);
5872}
5873
5874static void alc_fixup_dell_xps13(struct hda_codec *codec,
5875 const struct hda_fixup *fix, int action)
5876{
5877 struct alc_spec *spec = codec->spec;
5878 struct hda_input_mux *imux = &spec->gen.input_mux;
5879 int i;
5880
5881 switch (action) {
5882 case HDA_FIXUP_ACT_PRE_PROBE:
5883 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5884 * it causes a click noise at start up
5885 */
5886 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5887 spec->shutup = alc_shutup_dell_xps13;
5888 break;
5889 case HDA_FIXUP_ACT_PROBE:
5890 /* Make the internal mic the default input source. */
5891 for (i = 0; i < imux->num_items; i++) {
5892 if (spec->gen.imux_pins[i] == 0x12) {
5893 spec->gen.cur_mux[0] = i;
5894 break;
5895 }
5896 }
5897 break;
5898 }
5899}
5900
5901static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5902 const struct hda_fixup *fix, int action)
5903{
5904 struct alc_spec *spec = codec->spec;
5905
5906 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5907 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5908 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
5909
5910 /* Disable boost for mic-in permanently. (This code is only called
5911 from quirks that guarantee that the headphone is at NID 0x1b.) */
5912 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5913 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
5914 } else
5915 alc_fixup_headset_mode(codec, fix, action);
5916}
5917
5918static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5919 const struct hda_fixup *fix, int action)
5920{
5921 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5922 alc_write_coef_idx(codec, 0xc4, 0x8000);
5923 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
5924 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5925 }
5926 alc_fixup_headset_mode(codec, fix, action);
5927}
5928
5929/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5930static int find_ext_mic_pin(struct hda_codec *codec)
5931{
5932 struct alc_spec *spec = codec->spec;
5933 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5934 hda_nid_t nid;
5935 unsigned int defcfg;
5936 int i;
5937
5938 for (i = 0; i < cfg->num_inputs; i++) {
5939 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5940 continue;
5941 nid = cfg->inputs[i].pin;
5942 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5943 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5944 continue;
5945 return nid;
5946 }
5947
5948 return 0;
5949}
5950
5951static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
5952 const struct hda_fixup *fix,
5953 int action)
5954{
5955 struct alc_spec *spec = codec->spec;
5956
5957 if (action == HDA_FIXUP_ACT_PROBE) {
5958 int mic_pin = find_ext_mic_pin(codec);
David Brazdil0f672f62019-12-10 10:32:29 +00005959 int hp_pin = alc_get_hp_pin(spec);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00005960
5961 if (snd_BUG_ON(!mic_pin || !hp_pin))
5962 return;
5963 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
5964 }
5965}
5966
5967static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5968 const struct hda_fixup *fix,
5969 int action)
5970{
5971 struct alc_spec *spec = codec->spec;
5972 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5973 int i;
5974
5975 /* The mic boosts on level 2 and 3 are too noisy
5976 on the internal mic input.
5977 Therefore limit the boost to 0 or 1. */
5978
5979 if (action != HDA_FIXUP_ACT_PROBE)
5980 return;
5981
5982 for (i = 0; i < cfg->num_inputs; i++) {
5983 hda_nid_t nid = cfg->inputs[i].pin;
5984 unsigned int defcfg;
5985 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5986 continue;
5987 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5988 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5989 continue;
5990
5991 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5992 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5993 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5994 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5995 (0 << AC_AMPCAP_MUTE_SHIFT));
5996 }
5997}
5998
5999static void alc283_hp_automute_hook(struct hda_codec *codec,
6000 struct hda_jack_callback *jack)
6001{
6002 struct alc_spec *spec = codec->spec;
6003 int vref;
6004
6005 msleep(200);
6006 snd_hda_gen_hp_automute(codec, jack);
6007
6008 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6009
6010 msleep(600);
6011 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6012 vref);
6013}
6014
6015static void alc283_fixup_chromebook(struct hda_codec *codec,
6016 const struct hda_fixup *fix, int action)
6017{
6018 struct alc_spec *spec = codec->spec;
6019
6020 switch (action) {
6021 case HDA_FIXUP_ACT_PRE_PROBE:
6022 snd_hda_override_wcaps(codec, 0x03, 0);
6023 /* Disable AA-loopback as it causes white noise */
6024 spec->gen.mixer_nid = 0;
6025 break;
6026 case HDA_FIXUP_ACT_INIT:
6027 /* MIC2-VREF control */
6028 /* Set to manual mode */
6029 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6030 /* Enable Line1 input control by verb */
6031 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6032 break;
6033 }
6034}
6035
6036static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6037 const struct hda_fixup *fix, int action)
6038{
6039 struct alc_spec *spec = codec->spec;
6040
6041 switch (action) {
6042 case HDA_FIXUP_ACT_PRE_PROBE:
6043 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6044 break;
6045 case HDA_FIXUP_ACT_INIT:
6046 /* MIC2-VREF control */
6047 /* Set to manual mode */
6048 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6049 break;
6050 }
6051}
6052
6053/* mute tablet speaker pin (0x14) via dock plugging in addition */
6054static void asus_tx300_automute(struct hda_codec *codec)
6055{
6056 struct alc_spec *spec = codec->spec;
6057 snd_hda_gen_update_outputs(codec);
6058 if (snd_hda_jack_detect(codec, 0x1b))
6059 spec->gen.mute_bits |= (1ULL << 0x14);
6060}
6061
6062static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6063 const struct hda_fixup *fix, int action)
6064{
6065 struct alc_spec *spec = codec->spec;
6066 static const struct hda_pintbl dock_pins[] = {
6067 { 0x1b, 0x21114000 }, /* dock speaker pin */
6068 {}
6069 };
6070
6071 switch (action) {
6072 case HDA_FIXUP_ACT_PRE_PROBE:
6073 spec->init_amp = ALC_INIT_DEFAULT;
6074 /* TX300 needs to set up GPIO2 for the speaker amp */
6075 alc_setup_gpio(codec, 0x04);
6076 snd_hda_apply_pincfgs(codec, dock_pins);
6077 spec->gen.auto_mute_via_amp = 1;
6078 spec->gen.automute_hook = asus_tx300_automute;
6079 snd_hda_jack_detect_enable_callback(codec, 0x1b,
6080 snd_hda_gen_hp_automute);
6081 break;
6082 case HDA_FIXUP_ACT_PROBE:
6083 spec->init_amp = ALC_INIT_DEFAULT;
6084 break;
6085 case HDA_FIXUP_ACT_BUILD:
6086 /* this is a bit tricky; give more sane names for the main
6087 * (tablet) speaker and the dock speaker, respectively
6088 */
6089 rename_ctl(codec, "Speaker Playback Switch",
6090 "Dock Speaker Playback Switch");
6091 rename_ctl(codec, "Bass Speaker Playback Switch",
6092 "Speaker Playback Switch");
6093 break;
6094 }
6095}
6096
6097static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6098 const struct hda_fixup *fix, int action)
6099{
6100 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6101 /* DAC node 0x03 is giving mono output. We therefore want to
6102 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6103 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Olivier Deprez0e641232021-09-23 10:07:05 +02006104 static const hda_nid_t conn1[] = { 0x0c };
6105 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6106 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006107 }
6108}
6109
6110static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6111 const struct hda_fixup *fix, int action)
6112{
6113 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6114 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6115 we can't adjust the speaker's volume since this node does not has
6116 Amp-out capability. we change the speaker's route to:
6117 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6118 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6119 speaker's volume now. */
6120
Olivier Deprez0e641232021-09-23 10:07:05 +02006121 static const hda_nid_t conn1[] = { 0x0c };
6122 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006123 }
6124}
6125
6126/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6127static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6128 const struct hda_fixup *fix, int action)
6129{
6130 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Olivier Deprez0e641232021-09-23 10:07:05 +02006131 static const hda_nid_t conn[] = { 0x02, 0x03 };
6132 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6133 }
6134}
6135
6136/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6137static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6138 const struct hda_fixup *fix, int action)
6139{
6140 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6141 static const hda_nid_t conn[] = { 0x02 };
6142 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006143 }
6144}
6145
6146/* Hook to update amp GPIO4 for automute */
6147static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6148 struct hda_jack_callback *jack)
6149{
6150 struct alc_spec *spec = codec->spec;
6151
6152 snd_hda_gen_hp_automute(codec, jack);
6153 /* mute_led_polarity is set to 0, so we pass inverted value here */
Olivier Deprez0e641232021-09-23 10:07:05 +02006154 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6155 !spec->gen.hp_jack_present);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006156}
6157
6158/* Manage GPIOs for HP EliteBook Folio 9480m.
6159 *
6160 * GPIO4 is the headphone amplifier power control
6161 * GPIO3 is the audio output mute indicator LED
6162 */
6163
6164static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6165 const struct hda_fixup *fix,
6166 int action)
6167{
6168 struct alc_spec *spec = codec->spec;
6169
6170 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6171 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6172 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6173 spec->gpio_mask |= 0x10;
6174 spec->gpio_dir |= 0x10;
6175 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6176 }
6177}
6178
6179static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6180 const struct hda_fixup *fix,
6181 int action)
6182{
6183 struct alc_spec *spec = codec->spec;
6184
6185 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6186 spec->gpio_mask |= 0x04;
6187 spec->gpio_dir |= 0x04;
6188 /* set data bit low */
6189 }
6190}
6191
Olivier Deprez0e641232021-09-23 10:07:05 +02006192/* Quirk for Thinkpad X1 7th and 8th Gen
6193 * The following fixed routing needed
6194 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6195 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6196 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6197 */
6198static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6199 const struct hda_fixup *fix, int action)
6200{
6201 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6202 static const hda_nid_t preferred_pairs[] = {
6203 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6204 };
6205 struct alc_spec *spec = codec->spec;
6206
6207 switch (action) {
6208 case HDA_FIXUP_ACT_PRE_PROBE:
6209 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6210 spec->gen.preferred_dacs = preferred_pairs;
6211 break;
6212 case HDA_FIXUP_ACT_BUILD:
6213 /* The generic parser creates somewhat unintuitive volume ctls
6214 * with the fixed routing above, and the shared DAC2 may be
6215 * confusing for PA.
6216 * Rename those to unique names so that PA doesn't touch them
6217 * and use only Master volume.
6218 */
6219 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6220 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6221 break;
6222 }
6223}
6224
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006225static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6226 const struct hda_fixup *fix,
6227 int action)
6228{
6229 alc_fixup_dual_codecs(codec, fix, action);
6230 switch (action) {
6231 case HDA_FIXUP_ACT_PRE_PROBE:
6232 /* override card longname to provide a unique UCM profile */
6233 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6234 break;
6235 case HDA_FIXUP_ACT_BUILD:
6236 /* rename Capture controls depending on the codec */
6237 rename_ctl(codec, "Capture Volume",
6238 codec->addr == 0 ?
6239 "Rear-Panel Capture Volume" :
6240 "Front-Panel Capture Volume");
6241 rename_ctl(codec, "Capture Switch",
6242 codec->addr == 0 ?
6243 "Rear-Panel Capture Switch" :
6244 "Front-Panel Capture Switch");
6245 break;
6246 }
6247}
6248
Olivier Deprez0e641232021-09-23 10:07:05 +02006249static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6250 const struct hda_fixup *fix, int action)
6251{
6252 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6253 return;
6254
6255 codec->power_save_node = 1;
6256}
6257
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006258/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6259static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6260 const struct hda_fixup *fix, int action)
6261{
6262 struct alc_spec *spec = codec->spec;
Olivier Deprez0e641232021-09-23 10:07:05 +02006263 static const hda_nid_t preferred_pairs[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006264 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6265 0
6266 };
6267
6268 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6269 return;
6270
6271 spec->gen.preferred_dacs = preferred_pairs;
David Brazdil0f672f62019-12-10 10:32:29 +00006272 spec->gen.auto_mute_via_amp = 1;
6273 codec->power_save_node = 0;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006274}
6275
Olivier Deprez0e641232021-09-23 10:07:05 +02006276/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6277static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6278 const struct hda_fixup *fix, int action)
6279{
6280 static const hda_nid_t preferred_pairs[] = {
6281 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6282 };
6283 struct alc_spec *spec = codec->spec;
6284
6285 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6286 spec->gen.preferred_dacs = preferred_pairs;
6287 spec->gen.obey_preferred_dacs = 1;
6288 }
6289}
6290
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006291/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6292static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6293 const struct hda_fixup *fix, int action)
6294{
6295 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6296 return;
6297
6298 snd_hda_override_wcaps(codec, 0x03, 0);
6299}
6300
Olivier Deprez0e641232021-09-23 10:07:05 +02006301static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
David Brazdil0f672f62019-12-10 10:32:29 +00006302{
Olivier Deprez0e641232021-09-23 10:07:05 +02006303 switch (codec->core.vendor_id) {
6304 case 0x10ec0274:
6305 case 0x10ec0294:
6306 case 0x10ec0225:
6307 case 0x10ec0295:
6308 case 0x10ec0299:
6309 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6310 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
David Brazdil0f672f62019-12-10 10:32:29 +00006311 break;
Olivier Deprez0e641232021-09-23 10:07:05 +02006312 case 0x10ec0230:
6313 case 0x10ec0235:
6314 case 0x10ec0236:
6315 case 0x10ec0255:
6316 case 0x10ec0256:
6317 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6318 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
David Brazdil0f672f62019-12-10 10:32:29 +00006319 break;
6320 }
6321}
6322
6323static void alc295_fixup_chromebook(struct hda_codec *codec,
6324 const struct hda_fixup *fix, int action)
6325{
6326 struct alc_spec *spec = codec->spec;
6327
6328 switch (action) {
6329 case HDA_FIXUP_ACT_PRE_PROBE:
6330 spec->ultra_low_power = true;
6331 break;
6332 case HDA_FIXUP_ACT_INIT:
Olivier Deprez0e641232021-09-23 10:07:05 +02006333 alc_combo_jack_hp_jd_restart(codec);
David Brazdil0f672f62019-12-10 10:32:29 +00006334 break;
6335 }
6336}
6337
6338static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6339 const struct hda_fixup *fix, int action)
6340{
6341 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6342 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6343}
6344
Olivier Deprez0e641232021-09-23 10:07:05 +02006345
6346static void alc294_gx502_toggle_output(struct hda_codec *codec,
6347 struct hda_jack_callback *cb)
6348{
6349 /* The Windows driver sets the codec up in a very different way where
6350 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6351 */
6352 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6353 alc_write_coef_idx(codec, 0x10, 0x8a20);
6354 else
6355 alc_write_coef_idx(codec, 0x10, 0x0a20);
6356}
6357
6358static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6359 const struct hda_fixup *fix, int action)
6360{
6361 /* Pin 0x21: headphones/headset mic */
6362 if (!is_jack_detectable(codec, 0x21))
6363 return;
6364
6365 switch (action) {
6366 case HDA_FIXUP_ACT_PRE_PROBE:
6367 snd_hda_jack_detect_enable_callback(codec, 0x21,
6368 alc294_gx502_toggle_output);
6369 break;
6370 case HDA_FIXUP_ACT_INIT:
6371 /* Make sure to start in a correct state, i.e. if
6372 * headphones have been plugged in before powering up the system
6373 */
6374 alc294_gx502_toggle_output(codec, NULL);
6375 break;
6376 }
6377}
6378
6379static void alc294_gu502_toggle_output(struct hda_codec *codec,
6380 struct hda_jack_callback *cb)
6381{
6382 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6383 * responsible from changes between speakers and headphones
6384 */
6385 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6386 alc_write_coef_idx(codec, 0x10, 0x8420);
6387 else
6388 alc_write_coef_idx(codec, 0x10, 0x0a20);
6389}
6390
6391static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6392 const struct hda_fixup *fix, int action)
6393{
6394 if (!is_jack_detectable(codec, 0x21))
6395 return;
6396
6397 switch (action) {
6398 case HDA_FIXUP_ACT_PRE_PROBE:
6399 snd_hda_jack_detect_enable_callback(codec, 0x21,
6400 alc294_gu502_toggle_output);
6401 break;
6402 case HDA_FIXUP_ACT_INIT:
6403 alc294_gu502_toggle_output(codec, NULL);
6404 break;
6405 }
6406}
6407
6408static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6409 const struct hda_fixup *fix, int action)
6410{
6411 if (action != HDA_FIXUP_ACT_INIT)
6412 return;
6413
6414 msleep(100);
6415 alc_write_coef_idx(codec, 0x65, 0x0);
6416}
6417
6418static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6419 const struct hda_fixup *fix, int action)
6420{
6421 switch (action) {
6422 case HDA_FIXUP_ACT_INIT:
6423 alc_combo_jack_hp_jd_restart(codec);
6424 break;
6425 }
6426}
6427
Olivier Deprez157378f2022-04-04 15:47:50 +02006428static void alc_fixup_no_int_mic(struct hda_codec *codec,
6429 const struct hda_fixup *fix, int action)
6430{
6431 struct alc_spec *spec = codec->spec;
6432
6433 switch (action) {
6434 case HDA_FIXUP_ACT_PRE_PROBE:
6435 /* Mic RING SLEEVE swap for combo jack */
6436 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6437 spec->no_internal_mic_pin = true;
6438 break;
6439 case HDA_FIXUP_ACT_INIT:
6440 alc_combo_jack_hp_jd_restart(codec);
6441 break;
6442 }
6443}
6444
6445/* GPIO1 = amplifier on/off
6446 * GPIO3 = mic mute LED
6447 */
6448static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6449 const struct hda_fixup *fix, int action)
6450{
6451 static const hda_nid_t conn[] = { 0x02 };
6452
6453 struct alc_spec *spec = codec->spec;
6454 static const struct hda_pintbl pincfgs[] = {
6455 { 0x14, 0x90170110 }, /* front/high speakers */
6456 { 0x17, 0x90170130 }, /* back/bass speakers */
6457 { }
6458 };
6459
6460 //enable micmute led
6461 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6462
6463 switch (action) {
6464 case HDA_FIXUP_ACT_PRE_PROBE:
6465 spec->micmute_led_polarity = 1;
6466 /* needed for amp of back speakers */
6467 spec->gpio_mask |= 0x01;
6468 spec->gpio_dir |= 0x01;
6469 snd_hda_apply_pincfgs(codec, pincfgs);
6470 /* share DAC to have unified volume control */
6471 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6472 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6473 break;
6474 case HDA_FIXUP_ACT_INIT:
6475 /* need to toggle GPIO to enable the amp of back speakers */
6476 alc_update_gpio_data(codec, 0x01, true);
6477 msleep(100);
6478 alc_update_gpio_data(codec, 0x01, false);
6479 break;
6480 }
6481}
6482
Olivier Deprez0e641232021-09-23 10:07:05 +02006483static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6484 const struct hda_fixup *fix, int action)
6485{
6486 static const hda_nid_t conn[] = { 0x02 };
6487 static const struct hda_pintbl pincfgs[] = {
6488 { 0x14, 0x90170110 }, /* rear speaker */
6489 { }
6490 };
6491
6492 switch (action) {
6493 case HDA_FIXUP_ACT_PRE_PROBE:
6494 snd_hda_apply_pincfgs(codec, pincfgs);
6495 /* force front speaker to DAC1 */
6496 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6497 break;
6498 }
6499}
6500
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006501/* for hda_fixup_thinkpad_acpi() */
6502#include "thinkpad_helper.c"
6503
6504static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6505 const struct hda_fixup *fix, int action)
6506{
6507 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6508 hda_fixup_thinkpad_acpi(codec, fix, action);
6509}
6510
Olivier Deprez157378f2022-04-04 15:47:50 +02006511/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6512static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6513 const struct hda_fixup *fix,
6514 int action)
6515{
6516 struct alc_spec *spec = codec->spec;
6517
6518 switch (action) {
6519 case HDA_FIXUP_ACT_PRE_PROBE:
6520 spec->gen.suppress_auto_mute = 1;
6521 break;
6522 }
6523}
6524
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006525/* for alc295_fixup_hp_top_speakers */
6526#include "hp_x360_helper.c"
6527
Olivier Deprez157378f2022-04-04 15:47:50 +02006528/* for alc285_fixup_ideapad_s740_coef() */
6529#include "ideapad_s740_helper.c"
6530
6531static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6532 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6533 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6534 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6535 {}
6536};
6537
6538static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6539 const struct hda_fixup *fix,
6540 int action)
6541{
6542 /*
6543 * A certain other OS sets these coeffs to different values. On at least
6544 * one TongFang barebone these settings might survive even a cold
6545 * reboot. So to restore a clean slate the values are explicitly reset
6546 * to default here. Without this, the external microphone is always in a
6547 * plugged-in state, while the internal microphone is always in an
6548 * unplugged state, breaking the ability to use the internal microphone.
6549 */
6550 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
6551}
6552
6553static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6554 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6555 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6556 WRITE_COEF(0x49, 0x0149),
6557 {}
6558};
6559
6560static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6561 const struct hda_fixup *fix,
6562 int action)
6563{
6564 /*
6565 * The audio jack input and output is not detected on the ASRock NUC Box
6566 * 1100 series when cold booting without this fix. Warm rebooting from a
6567 * certain other OS makes the audio functional, as COEF settings are
6568 * preserved in this case. This fix sets these altered COEF values as
6569 * the default.
6570 */
6571 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6572}
6573
6574static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6575 const struct hda_fixup *fix,
6576 int action)
6577{
6578 /*
6579 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6580 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6581 * needs an additional quirk for sound working after suspend and resume.
6582 */
6583 if (codec->core.vendor_id == 0x10ec0256) {
6584 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6585 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6586 } else {
6587 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6588 }
6589}
6590
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006591enum {
Olivier Deprez0e641232021-09-23 10:07:05 +02006592 ALC269_FIXUP_GPIO2,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006593 ALC269_FIXUP_SONY_VAIO,
6594 ALC275_FIXUP_SONY_VAIO_GPIO2,
6595 ALC269_FIXUP_DELL_M101Z,
6596 ALC269_FIXUP_SKU_IGNORE,
6597 ALC269_FIXUP_ASUS_G73JW,
6598 ALC269_FIXUP_LENOVO_EAPD,
6599 ALC275_FIXUP_SONY_HWEQ,
6600 ALC275_FIXUP_SONY_DISABLE_AAMIX,
6601 ALC271_FIXUP_DMIC,
6602 ALC269_FIXUP_PCM_44K,
6603 ALC269_FIXUP_STEREO_DMIC,
6604 ALC269_FIXUP_HEADSET_MIC,
6605 ALC269_FIXUP_QUANTA_MUTE,
6606 ALC269_FIXUP_LIFEBOOK,
6607 ALC269_FIXUP_LIFEBOOK_EXTMIC,
6608 ALC269_FIXUP_LIFEBOOK_HP_PIN,
6609 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
6610 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
6611 ALC269_FIXUP_AMIC,
6612 ALC269_FIXUP_DMIC,
6613 ALC269VB_FIXUP_AMIC,
6614 ALC269VB_FIXUP_DMIC,
6615 ALC269_FIXUP_HP_MUTE_LED,
6616 ALC269_FIXUP_HP_MUTE_LED_MIC1,
6617 ALC269_FIXUP_HP_MUTE_LED_MIC2,
6618 ALC269_FIXUP_HP_MUTE_LED_MIC3,
6619 ALC269_FIXUP_HP_GPIO_LED,
6620 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6621 ALC269_FIXUP_HP_LINE1_MIC1_LED,
6622 ALC269_FIXUP_INV_DMIC,
6623 ALC269_FIXUP_LENOVO_DOCK,
Olivier Deprez0e641232021-09-23 10:07:05 +02006624 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006625 ALC269_FIXUP_NO_SHUTUP,
6626 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
6627 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
6628 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6629 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6630 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6631 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6632 ALC269_FIXUP_HEADSET_MODE,
6633 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
6634 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
6635 ALC269_FIXUP_ASUS_X101_FUNC,
6636 ALC269_FIXUP_ASUS_X101_VERB,
6637 ALC269_FIXUP_ASUS_X101,
6638 ALC271_FIXUP_AMIC_MIC2,
6639 ALC271_FIXUP_HP_GATE_MIC_JACK,
6640 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
6641 ALC269_FIXUP_ACER_AC700,
6642 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
6643 ALC269VB_FIXUP_ASUS_ZENBOOK,
6644 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
6645 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
6646 ALC269VB_FIXUP_ORDISSIMO_EVE2,
6647 ALC283_FIXUP_CHROME_BOOK,
6648 ALC283_FIXUP_SENSE_COMBO_JACK,
6649 ALC282_FIXUP_ASUS_TX300,
6650 ALC283_FIXUP_INT_MIC,
6651 ALC290_FIXUP_MONO_SPEAKERS,
6652 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6653 ALC290_FIXUP_SUBWOOFER,
6654 ALC290_FIXUP_SUBWOOFER_HSJACK,
6655 ALC269_FIXUP_THINKPAD_ACPI,
6656 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
6657 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6658 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6659 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6660 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
6661 ALC255_FIXUP_HEADSET_MODE,
6662 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
6663 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6664 ALC292_FIXUP_TPT440_DOCK,
6665 ALC292_FIXUP_TPT440,
6666 ALC283_FIXUP_HEADSET_MIC,
David Brazdil0f672f62019-12-10 10:32:29 +00006667 ALC255_FIXUP_MIC_MUTE_LED,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006668 ALC282_FIXUP_ASPIRE_V5_PINS,
Olivier Deprez0e641232021-09-23 10:07:05 +02006669 ALC269VB_FIXUP_ASPIRE_E1_COEF,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006670 ALC280_FIXUP_HP_GPIO4,
6671 ALC286_FIXUP_HP_GPIO_LED,
6672 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
6673 ALC280_FIXUP_HP_DOCK_PINS,
6674 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
6675 ALC280_FIXUP_HP_9480M,
Olivier Deprez157378f2022-04-04 15:47:50 +02006676 ALC245_FIXUP_HP_X360_AMP,
6677 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006678 ALC288_FIXUP_DELL_HEADSET_MODE,
6679 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
6680 ALC288_FIXUP_DELL_XPS_13,
6681 ALC288_FIXUP_DISABLE_AAMIX,
Olivier Deprez0e641232021-09-23 10:07:05 +02006682 ALC292_FIXUP_DELL_E7X_AAMIX,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006683 ALC292_FIXUP_DELL_E7X,
6684 ALC292_FIXUP_DISABLE_AAMIX,
6685 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
David Brazdil0f672f62019-12-10 10:32:29 +00006686 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006687 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6688 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6689 ALC275_FIXUP_DELL_XPS,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006690 ALC293_FIXUP_LENOVO_SPK_NOISE,
6691 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6692 ALC255_FIXUP_DELL_SPK_NOISE,
David Brazdil0f672f62019-12-10 10:32:29 +00006693 ALC225_FIXUP_DISABLE_MIC_VREF,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006694 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6695 ALC295_FIXUP_DISABLE_DAC3,
Olivier Deprez0e641232021-09-23 10:07:05 +02006696 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006697 ALC280_FIXUP_HP_HEADSET_MIC,
6698 ALC221_FIXUP_HP_FRONT_MIC,
6699 ALC292_FIXUP_TPT460,
6700 ALC298_FIXUP_SPK_VOLUME,
Olivier Deprez0e641232021-09-23 10:07:05 +02006701 ALC298_FIXUP_LENOVO_SPK_VOLUME,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006702 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
6703 ALC269_FIXUP_ATIV_BOOK_8,
6704 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
6705 ALC256_FIXUP_ASUS_HEADSET_MODE,
6706 ALC256_FIXUP_ASUS_MIC,
6707 ALC256_FIXUP_ASUS_AIO_GPIO2,
6708 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6709 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
6710 ALC233_FIXUP_LENOVO_MULTI_CODECS,
David Brazdil0f672f62019-12-10 10:32:29 +00006711 ALC233_FIXUP_ACER_HEADSET_MIC,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006712 ALC294_FIXUP_LENOVO_MIC_LOCATION,
6713 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Olivier Deprez0e641232021-09-23 10:07:05 +02006714 ALC225_FIXUP_S3_POP_NOISE,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006715 ALC700_FIXUP_INTEL_REFERENCE,
6716 ALC274_FIXUP_DELL_BIND_DACS,
6717 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Olivier Deprez0e641232021-09-23 10:07:05 +02006718 ALC298_FIXUP_TPT470_DOCK_FIX,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006719 ALC298_FIXUP_TPT470_DOCK,
6720 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
6721 ALC255_FIXUP_DELL_HEADSET_MIC,
David Brazdil0f672f62019-12-10 10:32:29 +00006722 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
6723 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006724 ALC295_FIXUP_HP_X360,
6725 ALC221_FIXUP_HP_HEADSET_MIC,
6726 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
6727 ALC295_FIXUP_HP_AUTO_MUTE,
6728 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
6729 ALC294_FIXUP_ASUS_MIC,
6730 ALC294_FIXUP_ASUS_HEADSET_MIC,
6731 ALC294_FIXUP_ASUS_SPK,
David Brazdil0f672f62019-12-10 10:32:29 +00006732 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
6733 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
6734 ALC255_FIXUP_ACER_HEADSET_MIC,
6735 ALC295_FIXUP_CHROME_BOOK,
6736 ALC225_FIXUP_HEADSET_JACK,
6737 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6738 ALC225_FIXUP_WYSE_AUTO_MUTE,
6739 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
6740 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
6741 ALC256_FIXUP_ASUS_HEADSET_MIC,
6742 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
6743 ALC299_FIXUP_PREDATOR_SPK,
David Brazdil0f672f62019-12-10 10:32:29 +00006744 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Olivier Deprez0e641232021-09-23 10:07:05 +02006745 ALC289_FIXUP_DELL_SPK2,
6746 ALC289_FIXUP_DUAL_SPK,
6747 ALC294_FIXUP_SPK2_TO_DAC1,
6748 ALC294_FIXUP_ASUS_DUAL_SPK,
6749 ALC285_FIXUP_THINKPAD_X1_GEN7,
6750 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
6751 ALC294_FIXUP_ASUS_HPE,
6752 ALC294_FIXUP_ASUS_COEF_1B,
6753 ALC294_FIXUP_ASUS_GX502_HP,
6754 ALC294_FIXUP_ASUS_GX502_PINS,
6755 ALC294_FIXUP_ASUS_GX502_VERBS,
6756 ALC294_FIXUP_ASUS_GU502_HP,
6757 ALC294_FIXUP_ASUS_GU502_PINS,
6758 ALC294_FIXUP_ASUS_GU502_VERBS,
6759 ALC285_FIXUP_HP_GPIO_LED,
6760 ALC285_FIXUP_HP_MUTE_LED,
Olivier Deprez157378f2022-04-04 15:47:50 +02006761 ALC236_FIXUP_HP_GPIO_LED,
Olivier Deprez0e641232021-09-23 10:07:05 +02006762 ALC236_FIXUP_HP_MUTE_LED,
Olivier Deprez157378f2022-04-04 15:47:50 +02006763 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
Olivier Deprez0e641232021-09-23 10:07:05 +02006764 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
6765 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
6766 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6767 ALC269VC_FIXUP_ACER_HEADSET_MIC,
6768 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
6769 ALC289_FIXUP_ASUS_GA401,
6770 ALC289_FIXUP_ASUS_GA502,
6771 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
6772 ALC285_FIXUP_HP_GPIO_AMP_INIT,
6773 ALC269_FIXUP_CZC_B20,
6774 ALC269_FIXUP_CZC_TMI,
6775 ALC269_FIXUP_CZC_L101,
6776 ALC269_FIXUP_LEMOTE_A1802,
6777 ALC269_FIXUP_LEMOTE_A190X,
6778 ALC256_FIXUP_INTEL_NUC8_RUGGED,
6779 ALC233_FIXUP_INTEL_NUC8_DMIC,
6780 ALC233_FIXUP_INTEL_NUC8_BOOST,
6781 ALC256_FIXUP_INTEL_NUC10,
6782 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
6783 ALC274_FIXUP_HP_MIC,
6784 ALC274_FIXUP_HP_HEADSET_MIC,
Olivier Deprez157378f2022-04-04 15:47:50 +02006785 ALC274_FIXUP_HP_ENVY_GPIO,
Olivier Deprez0e641232021-09-23 10:07:05 +02006786 ALC256_FIXUP_ASUS_HPE,
6787 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Olivier Deprez157378f2022-04-04 15:47:50 +02006788 ALC287_FIXUP_HP_GPIO_LED,
6789 ALC256_FIXUP_HP_HEADSET_MIC,
6790 ALC245_FIXUP_HP_GPIO_LED,
6791 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
6792 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
6793 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
6794 ALC256_FIXUP_ACER_HEADSET_MIC,
6795 ALC285_FIXUP_IDEAPAD_S740_COEF,
Olivier Deprez0e641232021-09-23 10:07:05 +02006796 ALC295_FIXUP_ASUS_DACS,
6797 ALC295_FIXUP_HP_OMEN,
6798 ALC285_FIXUP_HP_SPECTRE_X360,
Olivier Deprez157378f2022-04-04 15:47:50 +02006799 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
6800 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
6801 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
6802 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
6803 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6804 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6805 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
6806 ALC287_FIXUP_13S_GEN2_SPEAKERS,
6807 ALC256_FIXUP_SET_COEF_DEFAULTS,
6808 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
6809 ALC233_FIXUP_NO_AUDIO_JACK,
6810 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
6811 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6812 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006813};
6814
6815static const struct hda_fixup alc269_fixups[] = {
Olivier Deprez0e641232021-09-23 10:07:05 +02006816 [ALC269_FIXUP_GPIO2] = {
6817 .type = HDA_FIXUP_FUNC,
6818 .v.func = alc_fixup_gpio2,
6819 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006820 [ALC269_FIXUP_SONY_VAIO] = {
6821 .type = HDA_FIXUP_PINCTLS,
6822 .v.pins = (const struct hda_pintbl[]) {
6823 {0x19, PIN_VREFGRD},
6824 {}
6825 }
6826 },
6827 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
6828 .type = HDA_FIXUP_FUNC,
6829 .v.func = alc275_fixup_gpio4_off,
6830 .chained = true,
6831 .chain_id = ALC269_FIXUP_SONY_VAIO
6832 },
6833 [ALC269_FIXUP_DELL_M101Z] = {
6834 .type = HDA_FIXUP_VERBS,
6835 .v.verbs = (const struct hda_verb[]) {
6836 /* Enables internal speaker */
6837 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6838 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6839 {}
6840 }
6841 },
6842 [ALC269_FIXUP_SKU_IGNORE] = {
6843 .type = HDA_FIXUP_FUNC,
6844 .v.func = alc_fixup_sku_ignore,
6845 },
6846 [ALC269_FIXUP_ASUS_G73JW] = {
6847 .type = HDA_FIXUP_PINS,
6848 .v.pins = (const struct hda_pintbl[]) {
6849 { 0x17, 0x99130111 }, /* subwoofer */
6850 { }
6851 }
6852 },
6853 [ALC269_FIXUP_LENOVO_EAPD] = {
6854 .type = HDA_FIXUP_VERBS,
6855 .v.verbs = (const struct hda_verb[]) {
6856 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6857 {}
6858 }
6859 },
6860 [ALC275_FIXUP_SONY_HWEQ] = {
6861 .type = HDA_FIXUP_FUNC,
6862 .v.func = alc269_fixup_hweq,
6863 .chained = true,
6864 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6865 },
6866 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6867 .type = HDA_FIXUP_FUNC,
6868 .v.func = alc_fixup_disable_aamix,
6869 .chained = true,
6870 .chain_id = ALC269_FIXUP_SONY_VAIO
6871 },
6872 [ALC271_FIXUP_DMIC] = {
6873 .type = HDA_FIXUP_FUNC,
6874 .v.func = alc271_fixup_dmic,
6875 },
6876 [ALC269_FIXUP_PCM_44K] = {
6877 .type = HDA_FIXUP_FUNC,
6878 .v.func = alc269_fixup_pcm_44k,
6879 .chained = true,
6880 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6881 },
6882 [ALC269_FIXUP_STEREO_DMIC] = {
6883 .type = HDA_FIXUP_FUNC,
6884 .v.func = alc269_fixup_stereo_dmic,
6885 },
6886 [ALC269_FIXUP_HEADSET_MIC] = {
6887 .type = HDA_FIXUP_FUNC,
6888 .v.func = alc269_fixup_headset_mic,
6889 },
6890 [ALC269_FIXUP_QUANTA_MUTE] = {
6891 .type = HDA_FIXUP_FUNC,
6892 .v.func = alc269_fixup_quanta_mute,
6893 },
6894 [ALC269_FIXUP_LIFEBOOK] = {
6895 .type = HDA_FIXUP_PINS,
6896 .v.pins = (const struct hda_pintbl[]) {
6897 { 0x1a, 0x2101103f }, /* dock line-out */
6898 { 0x1b, 0x23a11040 }, /* dock mic-in */
6899 { }
6900 },
6901 .chained = true,
6902 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6903 },
6904 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6905 .type = HDA_FIXUP_PINS,
6906 .v.pins = (const struct hda_pintbl[]) {
6907 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6908 { }
6909 },
6910 },
6911 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6912 .type = HDA_FIXUP_PINS,
6913 .v.pins = (const struct hda_pintbl[]) {
6914 { 0x21, 0x0221102f }, /* HP out */
6915 { }
6916 },
6917 },
6918 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6919 .type = HDA_FIXUP_FUNC,
6920 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6921 },
6922 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6923 .type = HDA_FIXUP_FUNC,
6924 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6925 },
6926 [ALC269_FIXUP_AMIC] = {
6927 .type = HDA_FIXUP_PINS,
6928 .v.pins = (const struct hda_pintbl[]) {
6929 { 0x14, 0x99130110 }, /* speaker */
6930 { 0x15, 0x0121401f }, /* HP out */
6931 { 0x18, 0x01a19c20 }, /* mic */
6932 { 0x19, 0x99a3092f }, /* int-mic */
6933 { }
6934 },
6935 },
6936 [ALC269_FIXUP_DMIC] = {
6937 .type = HDA_FIXUP_PINS,
6938 .v.pins = (const struct hda_pintbl[]) {
6939 { 0x12, 0x99a3092f }, /* int-mic */
6940 { 0x14, 0x99130110 }, /* speaker */
6941 { 0x15, 0x0121401f }, /* HP out */
6942 { 0x18, 0x01a19c20 }, /* mic */
6943 { }
6944 },
6945 },
6946 [ALC269VB_FIXUP_AMIC] = {
6947 .type = HDA_FIXUP_PINS,
6948 .v.pins = (const struct hda_pintbl[]) {
6949 { 0x14, 0x99130110 }, /* speaker */
6950 { 0x18, 0x01a19c20 }, /* mic */
6951 { 0x19, 0x99a3092f }, /* int-mic */
6952 { 0x21, 0x0121401f }, /* HP out */
6953 { }
6954 },
6955 },
6956 [ALC269VB_FIXUP_DMIC] = {
6957 .type = HDA_FIXUP_PINS,
6958 .v.pins = (const struct hda_pintbl[]) {
6959 { 0x12, 0x99a3092f }, /* int-mic */
6960 { 0x14, 0x99130110 }, /* speaker */
6961 { 0x18, 0x01a19c20 }, /* mic */
6962 { 0x21, 0x0121401f }, /* HP out */
6963 { }
6964 },
6965 },
6966 [ALC269_FIXUP_HP_MUTE_LED] = {
6967 .type = HDA_FIXUP_FUNC,
6968 .v.func = alc269_fixup_hp_mute_led,
6969 },
6970 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6971 .type = HDA_FIXUP_FUNC,
6972 .v.func = alc269_fixup_hp_mute_led_mic1,
6973 },
6974 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
6975 .type = HDA_FIXUP_FUNC,
6976 .v.func = alc269_fixup_hp_mute_led_mic2,
6977 },
6978 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6979 .type = HDA_FIXUP_FUNC,
6980 .v.func = alc269_fixup_hp_mute_led_mic3,
6981 .chained = true,
6982 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
6983 },
6984 [ALC269_FIXUP_HP_GPIO_LED] = {
6985 .type = HDA_FIXUP_FUNC,
6986 .v.func = alc269_fixup_hp_gpio_led,
6987 },
6988 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6989 .type = HDA_FIXUP_FUNC,
6990 .v.func = alc269_fixup_hp_gpio_mic1_led,
6991 },
6992 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6993 .type = HDA_FIXUP_FUNC,
6994 .v.func = alc269_fixup_hp_line1_mic1_led,
6995 },
6996 [ALC269_FIXUP_INV_DMIC] = {
6997 .type = HDA_FIXUP_FUNC,
6998 .v.func = alc_fixup_inv_dmic,
6999 },
7000 [ALC269_FIXUP_NO_SHUTUP] = {
7001 .type = HDA_FIXUP_FUNC,
7002 .v.func = alc_fixup_no_shutup,
7003 },
7004 [ALC269_FIXUP_LENOVO_DOCK] = {
7005 .type = HDA_FIXUP_PINS,
7006 .v.pins = (const struct hda_pintbl[]) {
7007 { 0x19, 0x23a11040 }, /* dock mic */
7008 { 0x1b, 0x2121103f }, /* dock headphone */
7009 { }
7010 },
7011 .chained = true,
7012 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7013 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007014 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7015 .type = HDA_FIXUP_FUNC,
7016 .v.func = alc269_fixup_limit_int_mic_boost,
7017 .chained = true,
7018 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7019 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007020 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7021 .type = HDA_FIXUP_FUNC,
7022 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7023 .chained = true,
7024 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7025 },
7026 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7027 .type = HDA_FIXUP_PINS,
7028 .v.pins = (const struct hda_pintbl[]) {
7029 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7030 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7031 { }
7032 },
7033 .chained = true,
7034 .chain_id = ALC269_FIXUP_HEADSET_MODE
7035 },
7036 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7037 .type = HDA_FIXUP_PINS,
7038 .v.pins = (const struct hda_pintbl[]) {
7039 { 0x16, 0x21014020 }, /* dock line out */
7040 { 0x19, 0x21a19030 }, /* dock mic */
7041 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7042 { }
7043 },
7044 .chained = true,
7045 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7046 },
7047 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7048 .type = HDA_FIXUP_PINS,
7049 .v.pins = (const struct hda_pintbl[]) {
7050 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7051 { }
7052 },
7053 .chained = true,
7054 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7055 },
7056 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7057 .type = HDA_FIXUP_PINS,
7058 .v.pins = (const struct hda_pintbl[]) {
7059 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7060 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7061 { }
7062 },
7063 .chained = true,
7064 .chain_id = ALC269_FIXUP_HEADSET_MODE
7065 },
7066 [ALC269_FIXUP_HEADSET_MODE] = {
7067 .type = HDA_FIXUP_FUNC,
7068 .v.func = alc_fixup_headset_mode,
7069 .chained = true,
David Brazdil0f672f62019-12-10 10:32:29 +00007070 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007071 },
7072 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7073 .type = HDA_FIXUP_FUNC,
7074 .v.func = alc_fixup_headset_mode_no_hp_mic,
7075 },
7076 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7077 .type = HDA_FIXUP_PINS,
7078 .v.pins = (const struct hda_pintbl[]) {
7079 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7080 { }
7081 },
7082 .chained = true,
7083 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7084 },
7085 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7086 .type = HDA_FIXUP_PINS,
7087 .v.pins = (const struct hda_pintbl[]) {
7088 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7089 { }
7090 },
7091 .chained = true,
7092 .chain_id = ALC269_FIXUP_HEADSET_MIC
7093 },
David Brazdil0f672f62019-12-10 10:32:29 +00007094 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7095 .type = HDA_FIXUP_PINS,
7096 .v.pins = (const struct hda_pintbl[]) {
7097 {0x12, 0x90a60130},
7098 {0x13, 0x40000000},
7099 {0x14, 0x90170110},
7100 {0x18, 0x411111f0},
7101 {0x19, 0x04a11040},
7102 {0x1a, 0x411111f0},
7103 {0x1b, 0x90170112},
7104 {0x1d, 0x40759a05},
7105 {0x1e, 0x411111f0},
7106 {0x21, 0x04211020},
7107 { }
7108 },
7109 .chained = true,
7110 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7111 },
7112 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7113 .type = HDA_FIXUP_FUNC,
7114 .v.func = alc298_fixup_huawei_mbx_stereo,
7115 .chained = true,
7116 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7117 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007118 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7119 .type = HDA_FIXUP_FUNC,
7120 .v.func = alc269_fixup_x101_headset_mic,
7121 },
7122 [ALC269_FIXUP_ASUS_X101_VERB] = {
7123 .type = HDA_FIXUP_VERBS,
7124 .v.verbs = (const struct hda_verb[]) {
7125 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7126 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7127 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7128 { }
7129 },
7130 .chained = true,
7131 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7132 },
7133 [ALC269_FIXUP_ASUS_X101] = {
7134 .type = HDA_FIXUP_PINS,
7135 .v.pins = (const struct hda_pintbl[]) {
7136 { 0x18, 0x04a1182c }, /* Headset mic */
7137 { }
7138 },
7139 .chained = true,
7140 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7141 },
7142 [ALC271_FIXUP_AMIC_MIC2] = {
7143 .type = HDA_FIXUP_PINS,
7144 .v.pins = (const struct hda_pintbl[]) {
7145 { 0x14, 0x99130110 }, /* speaker */
7146 { 0x19, 0x01a19c20 }, /* mic */
7147 { 0x1b, 0x99a7012f }, /* int-mic */
7148 { 0x21, 0x0121401f }, /* HP out */
7149 { }
7150 },
7151 },
7152 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7153 .type = HDA_FIXUP_FUNC,
7154 .v.func = alc271_hp_gate_mic_jack,
7155 .chained = true,
7156 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7157 },
7158 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7159 .type = HDA_FIXUP_FUNC,
7160 .v.func = alc269_fixup_limit_int_mic_boost,
7161 .chained = true,
7162 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7163 },
7164 [ALC269_FIXUP_ACER_AC700] = {
7165 .type = HDA_FIXUP_PINS,
7166 .v.pins = (const struct hda_pintbl[]) {
7167 { 0x12, 0x99a3092f }, /* int-mic */
7168 { 0x14, 0x99130110 }, /* speaker */
7169 { 0x18, 0x03a11c20 }, /* mic */
7170 { 0x1e, 0x0346101e }, /* SPDIF1 */
7171 { 0x21, 0x0321101f }, /* HP out */
7172 { }
7173 },
7174 .chained = true,
7175 .chain_id = ALC271_FIXUP_DMIC,
7176 },
7177 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7178 .type = HDA_FIXUP_FUNC,
7179 .v.func = alc269_fixup_limit_int_mic_boost,
7180 .chained = true,
7181 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7182 },
7183 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7184 .type = HDA_FIXUP_FUNC,
7185 .v.func = alc269_fixup_limit_int_mic_boost,
7186 .chained = true,
7187 .chain_id = ALC269VB_FIXUP_DMIC,
7188 },
7189 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7190 .type = HDA_FIXUP_VERBS,
7191 .v.verbs = (const struct hda_verb[]) {
7192 /* class-D output amp +5dB */
7193 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7194 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7195 {}
7196 },
7197 .chained = true,
7198 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7199 },
7200 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7201 .type = HDA_FIXUP_FUNC,
7202 .v.func = alc269_fixup_limit_int_mic_boost,
7203 .chained = true,
7204 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7205 },
7206 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7207 .type = HDA_FIXUP_PINS,
7208 .v.pins = (const struct hda_pintbl[]) {
7209 { 0x12, 0x99a3092f }, /* int-mic */
7210 { 0x18, 0x03a11d20 }, /* mic */
7211 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7212 { }
7213 },
7214 },
7215 [ALC283_FIXUP_CHROME_BOOK] = {
7216 .type = HDA_FIXUP_FUNC,
7217 .v.func = alc283_fixup_chromebook,
7218 },
7219 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7220 .type = HDA_FIXUP_FUNC,
7221 .v.func = alc283_fixup_sense_combo_jack,
7222 .chained = true,
7223 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7224 },
7225 [ALC282_FIXUP_ASUS_TX300] = {
7226 .type = HDA_FIXUP_FUNC,
7227 .v.func = alc282_fixup_asus_tx300,
7228 },
7229 [ALC283_FIXUP_INT_MIC] = {
7230 .type = HDA_FIXUP_VERBS,
7231 .v.verbs = (const struct hda_verb[]) {
7232 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7233 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7234 { }
7235 },
7236 .chained = true,
7237 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7238 },
7239 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7240 .type = HDA_FIXUP_PINS,
7241 .v.pins = (const struct hda_pintbl[]) {
7242 { 0x17, 0x90170112 }, /* subwoofer */
7243 { }
7244 },
7245 .chained = true,
7246 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7247 },
7248 [ALC290_FIXUP_SUBWOOFER] = {
7249 .type = HDA_FIXUP_PINS,
7250 .v.pins = (const struct hda_pintbl[]) {
7251 { 0x17, 0x90170112 }, /* subwoofer */
7252 { }
7253 },
7254 .chained = true,
7255 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7256 },
7257 [ALC290_FIXUP_MONO_SPEAKERS] = {
7258 .type = HDA_FIXUP_FUNC,
7259 .v.func = alc290_fixup_mono_speakers,
7260 },
7261 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7262 .type = HDA_FIXUP_FUNC,
7263 .v.func = alc290_fixup_mono_speakers,
7264 .chained = true,
7265 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7266 },
7267 [ALC269_FIXUP_THINKPAD_ACPI] = {
7268 .type = HDA_FIXUP_FUNC,
7269 .v.func = alc_fixup_thinkpad_acpi,
7270 .chained = true,
7271 .chain_id = ALC269_FIXUP_SKU_IGNORE,
7272 },
7273 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7274 .type = HDA_FIXUP_FUNC,
7275 .v.func = alc_fixup_inv_dmic,
7276 .chained = true,
7277 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7278 },
7279 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
7280 .type = HDA_FIXUP_PINS,
7281 .v.pins = (const struct hda_pintbl[]) {
7282 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7283 { }
7284 },
7285 .chained = true,
7286 .chain_id = ALC255_FIXUP_HEADSET_MODE
7287 },
7288 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7289 .type = HDA_FIXUP_PINS,
7290 .v.pins = (const struct hda_pintbl[]) {
7291 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7292 { }
7293 },
7294 .chained = true,
7295 .chain_id = ALC255_FIXUP_HEADSET_MODE
7296 },
7297 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7298 .type = HDA_FIXUP_PINS,
7299 .v.pins = (const struct hda_pintbl[]) {
7300 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7301 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7302 { }
7303 },
7304 .chained = true,
7305 .chain_id = ALC255_FIXUP_HEADSET_MODE
7306 },
7307 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7308 .type = HDA_FIXUP_PINS,
7309 .v.pins = (const struct hda_pintbl[]) {
7310 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7311 { }
7312 },
7313 .chained = true,
7314 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7315 },
7316 [ALC255_FIXUP_HEADSET_MODE] = {
7317 .type = HDA_FIXUP_FUNC,
7318 .v.func = alc_fixup_headset_mode_alc255,
7319 .chained = true,
David Brazdil0f672f62019-12-10 10:32:29 +00007320 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007321 },
7322 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7323 .type = HDA_FIXUP_FUNC,
7324 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7325 },
7326 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7327 .type = HDA_FIXUP_PINS,
7328 .v.pins = (const struct hda_pintbl[]) {
7329 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7330 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7331 { }
7332 },
7333 .chained = true,
7334 .chain_id = ALC269_FIXUP_HEADSET_MODE
7335 },
7336 [ALC292_FIXUP_TPT440_DOCK] = {
7337 .type = HDA_FIXUP_FUNC,
7338 .v.func = alc_fixup_tpt440_dock,
7339 .chained = true,
7340 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7341 },
7342 [ALC292_FIXUP_TPT440] = {
7343 .type = HDA_FIXUP_FUNC,
7344 .v.func = alc_fixup_disable_aamix,
7345 .chained = true,
7346 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7347 },
7348 [ALC283_FIXUP_HEADSET_MIC] = {
7349 .type = HDA_FIXUP_PINS,
7350 .v.pins = (const struct hda_pintbl[]) {
7351 { 0x19, 0x04a110f0 },
7352 { },
7353 },
7354 },
David Brazdil0f672f62019-12-10 10:32:29 +00007355 [ALC255_FIXUP_MIC_MUTE_LED] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007356 .type = HDA_FIXUP_FUNC,
Olivier Deprez157378f2022-04-04 15:47:50 +02007357 .v.func = alc_fixup_micmute_led,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007358 },
7359 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7360 .type = HDA_FIXUP_PINS,
7361 .v.pins = (const struct hda_pintbl[]) {
7362 { 0x12, 0x90a60130 },
7363 { 0x14, 0x90170110 },
7364 { 0x17, 0x40000008 },
7365 { 0x18, 0x411111f0 },
7366 { 0x19, 0x01a1913c },
7367 { 0x1a, 0x411111f0 },
7368 { 0x1b, 0x411111f0 },
7369 { 0x1d, 0x40f89b2d },
7370 { 0x1e, 0x411111f0 },
7371 { 0x21, 0x0321101f },
7372 { },
7373 },
7374 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007375 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7376 .type = HDA_FIXUP_FUNC,
7377 .v.func = alc269vb_fixup_aspire_e1_coef,
7378 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007379 [ALC280_FIXUP_HP_GPIO4] = {
7380 .type = HDA_FIXUP_FUNC,
7381 .v.func = alc280_fixup_hp_gpio4,
7382 },
7383 [ALC286_FIXUP_HP_GPIO_LED] = {
7384 .type = HDA_FIXUP_FUNC,
7385 .v.func = alc286_fixup_hp_gpio_led,
7386 },
7387 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7388 .type = HDA_FIXUP_FUNC,
7389 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7390 },
7391 [ALC280_FIXUP_HP_DOCK_PINS] = {
7392 .type = HDA_FIXUP_PINS,
7393 .v.pins = (const struct hda_pintbl[]) {
7394 { 0x1b, 0x21011020 }, /* line-out */
7395 { 0x1a, 0x01a1903c }, /* headset mic */
7396 { 0x18, 0x2181103f }, /* line-in */
7397 { },
7398 },
7399 .chained = true,
7400 .chain_id = ALC280_FIXUP_HP_GPIO4
7401 },
7402 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7403 .type = HDA_FIXUP_PINS,
7404 .v.pins = (const struct hda_pintbl[]) {
7405 { 0x1b, 0x21011020 }, /* line-out */
7406 { 0x18, 0x2181103f }, /* line-in */
7407 { },
7408 },
7409 .chained = true,
7410 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7411 },
7412 [ALC280_FIXUP_HP_9480M] = {
7413 .type = HDA_FIXUP_FUNC,
7414 .v.func = alc280_fixup_hp_9480m,
7415 },
Olivier Deprez157378f2022-04-04 15:47:50 +02007416 [ALC245_FIXUP_HP_X360_AMP] = {
7417 .type = HDA_FIXUP_FUNC,
7418 .v.func = alc245_fixup_hp_x360_amp,
7419 .chained = true,
7420 .chain_id = ALC245_FIXUP_HP_GPIO_LED
7421 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007422 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7423 .type = HDA_FIXUP_FUNC,
7424 .v.func = alc_fixup_headset_mode_dell_alc288,
7425 .chained = true,
David Brazdil0f672f62019-12-10 10:32:29 +00007426 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007427 },
7428 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7429 .type = HDA_FIXUP_PINS,
7430 .v.pins = (const struct hda_pintbl[]) {
7431 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7432 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7433 { }
7434 },
7435 .chained = true,
7436 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7437 },
7438 [ALC288_FIXUP_DISABLE_AAMIX] = {
7439 .type = HDA_FIXUP_FUNC,
7440 .v.func = alc_fixup_disable_aamix,
7441 .chained = true,
7442 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
7443 },
7444 [ALC288_FIXUP_DELL_XPS_13] = {
7445 .type = HDA_FIXUP_FUNC,
7446 .v.func = alc_fixup_dell_xps13,
7447 .chained = true,
7448 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7449 },
7450 [ALC292_FIXUP_DISABLE_AAMIX] = {
7451 .type = HDA_FIXUP_FUNC,
7452 .v.func = alc_fixup_disable_aamix,
7453 .chained = true,
7454 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
7455 },
7456 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7457 .type = HDA_FIXUP_FUNC,
7458 .v.func = alc_fixup_disable_aamix,
7459 .chained = true,
7460 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7461 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007462 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007463 .type = HDA_FIXUP_FUNC,
7464 .v.func = alc_fixup_dell_xps13,
7465 .chained = true,
7466 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7467 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007468 [ALC292_FIXUP_DELL_E7X] = {
7469 .type = HDA_FIXUP_FUNC,
Olivier Deprez157378f2022-04-04 15:47:50 +02007470 .v.func = alc_fixup_micmute_led,
Olivier Deprez0e641232021-09-23 10:07:05 +02007471 /* micmute fixup must be applied at last */
7472 .chained_before = true,
7473 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7474 },
David Brazdil0f672f62019-12-10 10:32:29 +00007475 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7476 .type = HDA_FIXUP_PINS,
7477 .v.pins = (const struct hda_pintbl[]) {
7478 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7479 { }
7480 },
7481 .chained_before = true,
7482 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7483 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007484 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7485 .type = HDA_FIXUP_PINS,
7486 .v.pins = (const struct hda_pintbl[]) {
7487 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7488 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7489 { }
7490 },
7491 .chained = true,
7492 .chain_id = ALC269_FIXUP_HEADSET_MODE
7493 },
7494 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7495 .type = HDA_FIXUP_PINS,
7496 .v.pins = (const struct hda_pintbl[]) {
7497 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7498 { }
7499 },
7500 .chained = true,
7501 .chain_id = ALC269_FIXUP_HEADSET_MODE
7502 },
7503 [ALC275_FIXUP_DELL_XPS] = {
7504 .type = HDA_FIXUP_VERBS,
7505 .v.verbs = (const struct hda_verb[]) {
7506 /* Enables internal speaker */
7507 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7508 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7509 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7510 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7511 {}
7512 }
7513 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007514 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7515 .type = HDA_FIXUP_FUNC,
7516 .v.func = alc_fixup_disable_aamix,
7517 .chained = true,
7518 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7519 },
7520 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7521 .type = HDA_FIXUP_FUNC,
7522 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7523 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007524 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7525 .type = HDA_FIXUP_FUNC,
7526 .v.func = alc_fixup_inv_dmic,
7527 .chained = true,
7528 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7529 },
7530 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7531 .type = HDA_FIXUP_FUNC,
7532 .v.func = alc269_fixup_limit_int_mic_boost
7533 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007534 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7535 .type = HDA_FIXUP_FUNC,
7536 .v.func = alc_fixup_disable_aamix,
7537 .chained = true,
7538 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7539 },
David Brazdil0f672f62019-12-10 10:32:29 +00007540 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7541 .type = HDA_FIXUP_FUNC,
7542 .v.func = alc_fixup_disable_mic_vref,
7543 .chained = true,
7544 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7545 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007546 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7547 .type = HDA_FIXUP_VERBS,
7548 .v.verbs = (const struct hda_verb[]) {
7549 /* Disable pass-through path for FRONT 14h */
7550 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7551 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7552 {}
7553 },
7554 .chained = true,
David Brazdil0f672f62019-12-10 10:32:29 +00007555 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007556 },
7557 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7558 .type = HDA_FIXUP_FUNC,
7559 .v.func = alc_fixup_disable_aamix,
7560 .chained = true,
7561 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7562 },
7563 [ALC221_FIXUP_HP_FRONT_MIC] = {
7564 .type = HDA_FIXUP_PINS,
7565 .v.pins = (const struct hda_pintbl[]) {
7566 { 0x19, 0x02a19020 }, /* Front Mic */
7567 { }
7568 },
7569 },
7570 [ALC292_FIXUP_TPT460] = {
7571 .type = HDA_FIXUP_FUNC,
7572 .v.func = alc_fixup_tpt440_dock,
7573 .chained = true,
7574 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7575 },
7576 [ALC298_FIXUP_SPK_VOLUME] = {
7577 .type = HDA_FIXUP_FUNC,
7578 .v.func = alc298_fixup_speaker_volume,
7579 .chained = true,
7580 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7581 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007582 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7583 .type = HDA_FIXUP_FUNC,
7584 .v.func = alc298_fixup_speaker_volume,
7585 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007586 [ALC295_FIXUP_DISABLE_DAC3] = {
7587 .type = HDA_FIXUP_FUNC,
7588 .v.func = alc295_fixup_disable_dac3,
7589 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007590 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7591 .type = HDA_FIXUP_FUNC,
7592 .v.func = alc285_fixup_speaker2_to_dac1,
7593 .chained = true,
7594 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7595 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007596 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7597 .type = HDA_FIXUP_PINS,
7598 .v.pins = (const struct hda_pintbl[]) {
7599 { 0x1b, 0x90170151 },
7600 { }
7601 },
7602 .chained = true,
7603 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7604 },
7605 [ALC269_FIXUP_ATIV_BOOK_8] = {
7606 .type = HDA_FIXUP_FUNC,
7607 .v.func = alc_fixup_auto_mute_via_amp,
7608 .chained = true,
7609 .chain_id = ALC269_FIXUP_NO_SHUTUP
7610 },
7611 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7612 .type = HDA_FIXUP_PINS,
7613 .v.pins = (const struct hda_pintbl[]) {
7614 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7615 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7616 { }
7617 },
7618 .chained = true,
7619 .chain_id = ALC269_FIXUP_HEADSET_MODE
7620 },
7621 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7622 .type = HDA_FIXUP_FUNC,
7623 .v.func = alc_fixup_headset_mode,
7624 },
7625 [ALC256_FIXUP_ASUS_MIC] = {
7626 .type = HDA_FIXUP_PINS,
7627 .v.pins = (const struct hda_pintbl[]) {
7628 { 0x13, 0x90a60160 }, /* use as internal mic */
7629 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7630 { }
7631 },
7632 .chained = true,
7633 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7634 },
7635 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
7636 .type = HDA_FIXUP_FUNC,
7637 /* Set up GPIO2 for the speaker amp */
7638 .v.func = alc_fixup_gpio4,
7639 },
7640 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7641 .type = HDA_FIXUP_PINS,
7642 .v.pins = (const struct hda_pintbl[]) {
7643 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7644 { }
7645 },
7646 .chained = true,
7647 .chain_id = ALC269_FIXUP_HEADSET_MIC
7648 },
7649 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7650 .type = HDA_FIXUP_VERBS,
7651 .v.verbs = (const struct hda_verb[]) {
7652 /* Enables internal speaker */
7653 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7654 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7655 {}
7656 },
7657 .chained = true,
7658 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7659 },
7660 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7661 .type = HDA_FIXUP_FUNC,
7662 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Olivier Deprez0e641232021-09-23 10:07:05 +02007663 .chained = true,
7664 .chain_id = ALC269_FIXUP_GPIO2
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007665 },
David Brazdil0f672f62019-12-10 10:32:29 +00007666 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7667 .type = HDA_FIXUP_VERBS,
7668 .v.verbs = (const struct hda_verb[]) {
7669 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7670 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7671 { }
7672 },
7673 .chained = true,
7674 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7675 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007676 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7677 .type = HDA_FIXUP_PINS,
7678 .v.pins = (const struct hda_pintbl[]) {
7679 /* Change the mic location from front to right, otherwise there are
7680 two front mics with the same name, pulseaudio can't handle them.
7681 This is just a temporary workaround, after applying this fixup,
7682 there will be one "Front Mic" and one "Mic" in this machine.
7683 */
7684 { 0x1a, 0x04a19040 },
7685 { }
7686 },
7687 },
7688 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7689 .type = HDA_FIXUP_PINS,
7690 .v.pins = (const struct hda_pintbl[]) {
7691 { 0x16, 0x0101102f }, /* Rear Headset HP */
7692 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7693 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7694 { 0x1b, 0x02011020 },
7695 { }
7696 },
7697 .chained = true,
Olivier Deprez0e641232021-09-23 10:07:05 +02007698 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7699 },
7700 [ALC225_FIXUP_S3_POP_NOISE] = {
7701 .type = HDA_FIXUP_FUNC,
7702 .v.func = alc225_fixup_s3_pop_noise,
7703 .chained = true,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007704 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7705 },
7706 [ALC700_FIXUP_INTEL_REFERENCE] = {
7707 .type = HDA_FIXUP_VERBS,
7708 .v.verbs = (const struct hda_verb[]) {
7709 /* Enables internal speaker */
7710 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7711 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7712 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7713 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7714 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7715 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7716 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7717 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7718 {}
7719 }
7720 },
7721 [ALC274_FIXUP_DELL_BIND_DACS] = {
7722 .type = HDA_FIXUP_FUNC,
7723 .v.func = alc274_fixup_bind_dacs,
7724 .chained = true,
7725 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7726 },
7727 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7728 .type = HDA_FIXUP_PINS,
7729 .v.pins = (const struct hda_pintbl[]) {
7730 { 0x1b, 0x0401102f },
7731 { }
7732 },
7733 .chained = true,
7734 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7735 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007736 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007737 .type = HDA_FIXUP_FUNC,
7738 .v.func = alc_fixup_tpt470_dock,
7739 .chained = true,
7740 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7741 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007742 [ALC298_FIXUP_TPT470_DOCK] = {
7743 .type = HDA_FIXUP_FUNC,
7744 .v.func = alc_fixup_tpt470_dacs,
7745 .chained = true,
7746 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7747 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007748 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7749 .type = HDA_FIXUP_PINS,
7750 .v.pins = (const struct hda_pintbl[]) {
7751 { 0x14, 0x0201101f },
7752 { }
7753 },
7754 .chained = true,
7755 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7756 },
7757 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7758 .type = HDA_FIXUP_PINS,
7759 .v.pins = (const struct hda_pintbl[]) {
7760 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7761 { }
7762 },
7763 .chained = true,
7764 .chain_id = ALC269_FIXUP_HEADSET_MIC
7765 },
7766 [ALC295_FIXUP_HP_X360] = {
7767 .type = HDA_FIXUP_FUNC,
7768 .v.func = alc295_fixup_hp_top_speakers,
7769 .chained = true,
7770 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
7771 },
7772 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7773 .type = HDA_FIXUP_PINS,
7774 .v.pins = (const struct hda_pintbl[]) {
7775 { 0x19, 0x0181313f},
7776 { }
7777 },
7778 .chained = true,
7779 .chain_id = ALC269_FIXUP_HEADSET_MIC
7780 },
7781 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7782 .type = HDA_FIXUP_FUNC,
7783 .v.func = alc285_fixup_invalidate_dacs,
7784 .chained = true,
7785 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7786 },
7787 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7788 .type = HDA_FIXUP_FUNC,
7789 .v.func = alc_fixup_auto_mute_via_amp,
7790 },
7791 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7792 .type = HDA_FIXUP_PINS,
7793 .v.pins = (const struct hda_pintbl[]) {
7794 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7795 { }
7796 },
7797 .chained = true,
7798 .chain_id = ALC269_FIXUP_HEADSET_MIC
7799 },
7800 [ALC294_FIXUP_ASUS_MIC] = {
7801 .type = HDA_FIXUP_PINS,
7802 .v.pins = (const struct hda_pintbl[]) {
7803 { 0x13, 0x90a60160 }, /* use as internal mic */
7804 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7805 { }
7806 },
7807 .chained = true,
Olivier Deprez0e641232021-09-23 10:07:05 +02007808 .chain_id = ALC269_FIXUP_HEADSET_MIC
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007809 },
7810 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7811 .type = HDA_FIXUP_PINS,
7812 .v.pins = (const struct hda_pintbl[]) {
David Brazdil0f672f62019-12-10 10:32:29 +00007813 { 0x19, 0x01a1103c }, /* use as headset mic */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007814 { }
7815 },
7816 .chained = true,
Olivier Deprez0e641232021-09-23 10:07:05 +02007817 .chain_id = ALC269_FIXUP_HEADSET_MIC
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007818 },
7819 [ALC294_FIXUP_ASUS_SPK] = {
7820 .type = HDA_FIXUP_VERBS,
7821 .v.verbs = (const struct hda_verb[]) {
7822 /* Set EAPD high */
7823 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7824 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007825 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7826 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007827 { }
7828 },
7829 .chained = true,
7830 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7831 },
David Brazdil0f672f62019-12-10 10:32:29 +00007832 [ALC295_FIXUP_CHROME_BOOK] = {
7833 .type = HDA_FIXUP_FUNC,
7834 .v.func = alc295_fixup_chromebook,
7835 .chained = true,
7836 .chain_id = ALC225_FIXUP_HEADSET_JACK
7837 },
7838 [ALC225_FIXUP_HEADSET_JACK] = {
7839 .type = HDA_FIXUP_FUNC,
7840 .v.func = alc_fixup_headset_jack,
7841 },
7842 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7843 .type = HDA_FIXUP_PINS,
7844 .v.pins = (const struct hda_pintbl[]) {
7845 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7846 { }
7847 },
7848 .chained = true,
7849 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7850 },
7851 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7852 .type = HDA_FIXUP_VERBS,
7853 .v.verbs = (const struct hda_verb[]) {
7854 /* Disable PCBEEP-IN passthrough */
7855 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7856 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7857 { }
7858 },
7859 .chained = true,
7860 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7861 },
7862 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7863 .type = HDA_FIXUP_PINS,
7864 .v.pins = (const struct hda_pintbl[]) {
7865 { 0x19, 0x03a11130 },
7866 { 0x1a, 0x90a60140 }, /* use as internal mic */
7867 { }
7868 },
7869 .chained = true,
7870 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7871 },
7872 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7873 .type = HDA_FIXUP_PINS,
7874 .v.pins = (const struct hda_pintbl[]) {
7875 { 0x16, 0x01011020 }, /* Rear Line out */
7876 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7877 { }
7878 },
7879 .chained = true,
7880 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7881 },
7882 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7883 .type = HDA_FIXUP_FUNC,
7884 .v.func = alc_fixup_auto_mute_via_amp,
7885 .chained = true,
7886 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7887 },
7888 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7889 .type = HDA_FIXUP_FUNC,
7890 .v.func = alc_fixup_disable_mic_vref,
7891 .chained = true,
7892 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7893 },
7894 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7895 .type = HDA_FIXUP_VERBS,
7896 .v.verbs = (const struct hda_verb[]) {
7897 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7898 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7899 { }
7900 },
7901 .chained = true,
7902 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7903 },
7904 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7905 .type = HDA_FIXUP_PINS,
7906 .v.pins = (const struct hda_pintbl[]) {
7907 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7908 { }
7909 },
7910 .chained = true,
7911 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7912 },
7913 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7914 .type = HDA_FIXUP_PINS,
7915 .v.pins = (const struct hda_pintbl[]) {
7916 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7917 { }
7918 },
7919 .chained = true,
7920 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7921 },
7922 [ALC299_FIXUP_PREDATOR_SPK] = {
7923 .type = HDA_FIXUP_PINS,
7924 .v.pins = (const struct hda_pintbl[]) {
7925 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7926 { }
7927 }
7928 },
David Brazdil0f672f62019-12-10 10:32:29 +00007929 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7930 .type = HDA_FIXUP_PINS,
7931 .v.pins = (const struct hda_pintbl[]) {
7932 { 0x19, 0x04a11040 },
7933 { 0x21, 0x04211020 },
7934 { }
7935 },
7936 .chained = true,
7937 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7938 },
Olivier Deprez0e641232021-09-23 10:07:05 +02007939 [ALC289_FIXUP_DELL_SPK2] = {
7940 .type = HDA_FIXUP_PINS,
7941 .v.pins = (const struct hda_pintbl[]) {
7942 { 0x17, 0x90170130 }, /* bass spk */
7943 { }
7944 },
7945 .chained = true,
7946 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7947 },
7948 [ALC289_FIXUP_DUAL_SPK] = {
7949 .type = HDA_FIXUP_FUNC,
7950 .v.func = alc285_fixup_speaker2_to_dac1,
7951 .chained = true,
7952 .chain_id = ALC289_FIXUP_DELL_SPK2
7953 },
7954 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7955 .type = HDA_FIXUP_FUNC,
7956 .v.func = alc285_fixup_speaker2_to_dac1,
7957 .chained = true,
7958 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7959 },
7960 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
7961 .type = HDA_FIXUP_FUNC,
7962 /* The GPIO must be pulled to initialize the AMP */
7963 .v.func = alc_fixup_gpio4,
7964 .chained = true,
7965 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
7966 },
7967 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7968 .type = HDA_FIXUP_FUNC,
7969 .v.func = alc285_fixup_thinkpad_x1_gen7,
7970 .chained = true,
7971 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7972 },
7973 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7974 .type = HDA_FIXUP_FUNC,
7975 .v.func = alc_fixup_headset_jack,
7976 .chained = true,
7977 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
7978 },
7979 [ALC294_FIXUP_ASUS_HPE] = {
7980 .type = HDA_FIXUP_VERBS,
7981 .v.verbs = (const struct hda_verb[]) {
7982 /* Set EAPD high */
7983 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7984 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7985 { }
7986 },
7987 .chained = true,
7988 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7989 },
7990 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7991 .type = HDA_FIXUP_PINS,
7992 .v.pins = (const struct hda_pintbl[]) {
7993 { 0x19, 0x03a11050 }, /* front HP mic */
7994 { 0x1a, 0x01a11830 }, /* rear external mic */
7995 { 0x21, 0x03211020 }, /* front HP out */
7996 { }
7997 },
7998 .chained = true,
7999 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8000 },
8001 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8002 .type = HDA_FIXUP_VERBS,
8003 .v.verbs = (const struct hda_verb[]) {
8004 /* set 0x15 to HP-OUT ctrl */
8005 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8006 /* unmute the 0x15 amp */
8007 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8008 { }
8009 },
8010 .chained = true,
8011 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8012 },
8013 [ALC294_FIXUP_ASUS_GX502_HP] = {
8014 .type = HDA_FIXUP_FUNC,
8015 .v.func = alc294_fixup_gx502_hp,
8016 },
8017 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8018 .type = HDA_FIXUP_PINS,
8019 .v.pins = (const struct hda_pintbl[]) {
8020 { 0x19, 0x01a11050 }, /* rear HP mic */
8021 { 0x1a, 0x01a11830 }, /* rear external mic */
8022 { 0x21, 0x012110f0 }, /* rear HP out */
8023 { }
8024 },
8025 .chained = true,
8026 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8027 },
8028 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8029 .type = HDA_FIXUP_VERBS,
8030 .v.verbs = (const struct hda_verb[]) {
8031 /* set 0x15 to HP-OUT ctrl */
8032 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8033 /* unmute the 0x15 amp */
8034 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8035 /* set 0x1b to HP-OUT */
8036 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8037 { }
8038 },
8039 .chained = true,
8040 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8041 },
8042 [ALC294_FIXUP_ASUS_GU502_HP] = {
8043 .type = HDA_FIXUP_FUNC,
8044 .v.func = alc294_fixup_gu502_hp,
8045 },
8046 [ALC294_FIXUP_ASUS_COEF_1B] = {
8047 .type = HDA_FIXUP_VERBS,
8048 .v.verbs = (const struct hda_verb[]) {
8049 /* Set bit 10 to correct noisy output after reboot from
8050 * Windows 10 (due to pop noise reduction?)
8051 */
8052 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8053 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8054 { }
8055 },
8056 .chained = true,
8057 .chain_id = ALC289_FIXUP_ASUS_GA401,
8058 },
8059 [ALC285_FIXUP_HP_GPIO_LED] = {
8060 .type = HDA_FIXUP_FUNC,
8061 .v.func = alc285_fixup_hp_gpio_led,
8062 },
8063 [ALC285_FIXUP_HP_MUTE_LED] = {
8064 .type = HDA_FIXUP_FUNC,
8065 .v.func = alc285_fixup_hp_mute_led,
8066 },
Olivier Deprez157378f2022-04-04 15:47:50 +02008067 [ALC236_FIXUP_HP_GPIO_LED] = {
8068 .type = HDA_FIXUP_FUNC,
8069 .v.func = alc236_fixup_hp_gpio_led,
8070 },
Olivier Deprez0e641232021-09-23 10:07:05 +02008071 [ALC236_FIXUP_HP_MUTE_LED] = {
8072 .type = HDA_FIXUP_FUNC,
8073 .v.func = alc236_fixup_hp_mute_led,
8074 },
Olivier Deprez157378f2022-04-04 15:47:50 +02008075 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8076 .type = HDA_FIXUP_FUNC,
8077 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8078 },
Olivier Deprez0e641232021-09-23 10:07:05 +02008079 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8080 .type = HDA_FIXUP_VERBS,
8081 .v.verbs = (const struct hda_verb[]) {
8082 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8083 { }
8084 },
8085 },
8086 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8087 .type = HDA_FIXUP_PINS,
8088 .v.pins = (const struct hda_pintbl[]) {
8089 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8090 { }
8091 },
8092 .chained = true,
8093 .chain_id = ALC269_FIXUP_HEADSET_MODE
8094 },
8095 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8096 .type = HDA_FIXUP_PINS,
8097 .v.pins = (const struct hda_pintbl[]) {
8098 { 0x14, 0x90100120 }, /* use as internal speaker */
8099 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8100 { 0x1a, 0x01011020 }, /* use as line out */
8101 { },
8102 },
8103 .chained = true,
8104 .chain_id = ALC269_FIXUP_HEADSET_MIC
8105 },
8106 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8107 .type = HDA_FIXUP_PINS,
8108 .v.pins = (const struct hda_pintbl[]) {
8109 { 0x18, 0x02a11030 }, /* use as headset mic */
8110 { }
8111 },
8112 .chained = true,
8113 .chain_id = ALC269_FIXUP_HEADSET_MIC
8114 },
8115 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8116 .type = HDA_FIXUP_PINS,
8117 .v.pins = (const struct hda_pintbl[]) {
8118 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8119 { }
8120 },
8121 .chained = true,
8122 .chain_id = ALC269_FIXUP_HEADSET_MIC
8123 },
8124 [ALC289_FIXUP_ASUS_GA401] = {
8125 .type = HDA_FIXUP_FUNC,
8126 .v.func = alc289_fixup_asus_ga401,
8127 .chained = true,
8128 .chain_id = ALC289_FIXUP_ASUS_GA502,
8129 },
8130 [ALC289_FIXUP_ASUS_GA502] = {
8131 .type = HDA_FIXUP_PINS,
8132 .v.pins = (const struct hda_pintbl[]) {
8133 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8134 { }
8135 },
8136 },
8137 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8138 .type = HDA_FIXUP_PINS,
8139 .v.pins = (const struct hda_pintbl[]) {
8140 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8141 { }
8142 },
8143 .chained = true,
8144 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8145 },
8146 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8147 .type = HDA_FIXUP_FUNC,
8148 .v.func = alc285_fixup_hp_gpio_amp_init,
8149 .chained = true,
8150 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8151 },
8152 [ALC269_FIXUP_CZC_B20] = {
8153 .type = HDA_FIXUP_PINS,
8154 .v.pins = (const struct hda_pintbl[]) {
8155 { 0x12, 0x411111f0 },
8156 { 0x14, 0x90170110 }, /* speaker */
8157 { 0x15, 0x032f1020 }, /* HP out */
8158 { 0x17, 0x411111f0 },
8159 { 0x18, 0x03ab1040 }, /* mic */
8160 { 0x19, 0xb7a7013f },
8161 { 0x1a, 0x0181305f },
8162 { 0x1b, 0x411111f0 },
8163 { 0x1d, 0x411111f0 },
8164 { 0x1e, 0x411111f0 },
8165 { }
8166 },
8167 .chain_id = ALC269_FIXUP_DMIC,
8168 },
8169 [ALC269_FIXUP_CZC_TMI] = {
8170 .type = HDA_FIXUP_PINS,
8171 .v.pins = (const struct hda_pintbl[]) {
8172 { 0x12, 0x4000c000 },
8173 { 0x14, 0x90170110 }, /* speaker */
8174 { 0x15, 0x0421401f }, /* HP out */
8175 { 0x17, 0x411111f0 },
8176 { 0x18, 0x04a19020 }, /* mic */
8177 { 0x19, 0x411111f0 },
8178 { 0x1a, 0x411111f0 },
8179 { 0x1b, 0x411111f0 },
8180 { 0x1d, 0x40448505 },
8181 { 0x1e, 0x411111f0 },
8182 { 0x20, 0x8000ffff },
8183 { }
8184 },
8185 .chain_id = ALC269_FIXUP_DMIC,
8186 },
8187 [ALC269_FIXUP_CZC_L101] = {
8188 .type = HDA_FIXUP_PINS,
8189 .v.pins = (const struct hda_pintbl[]) {
8190 { 0x12, 0x40000000 },
8191 { 0x14, 0x01014010 }, /* speaker */
8192 { 0x15, 0x411111f0 }, /* HP out */
8193 { 0x16, 0x411111f0 },
8194 { 0x18, 0x01a19020 }, /* mic */
8195 { 0x19, 0x02a19021 },
8196 { 0x1a, 0x0181302f },
8197 { 0x1b, 0x0221401f },
8198 { 0x1c, 0x411111f0 },
8199 { 0x1d, 0x4044c601 },
8200 { 0x1e, 0x411111f0 },
8201 { }
8202 },
8203 .chain_id = ALC269_FIXUP_DMIC,
8204 },
8205 [ALC269_FIXUP_LEMOTE_A1802] = {
8206 .type = HDA_FIXUP_PINS,
8207 .v.pins = (const struct hda_pintbl[]) {
8208 { 0x12, 0x40000000 },
8209 { 0x14, 0x90170110 }, /* speaker */
8210 { 0x17, 0x411111f0 },
8211 { 0x18, 0x03a19040 }, /* mic1 */
8212 { 0x19, 0x90a70130 }, /* mic2 */
8213 { 0x1a, 0x411111f0 },
8214 { 0x1b, 0x411111f0 },
8215 { 0x1d, 0x40489d2d },
8216 { 0x1e, 0x411111f0 },
8217 { 0x20, 0x0003ffff },
8218 { 0x21, 0x03214020 },
8219 { }
8220 },
8221 .chain_id = ALC269_FIXUP_DMIC,
8222 },
8223 [ALC269_FIXUP_LEMOTE_A190X] = {
8224 .type = HDA_FIXUP_PINS,
8225 .v.pins = (const struct hda_pintbl[]) {
8226 { 0x14, 0x99130110 }, /* speaker */
8227 { 0x15, 0x0121401f }, /* HP out */
8228 { 0x18, 0x01a19c20 }, /* rear mic */
8229 { 0x19, 0x99a3092f }, /* front mic */
8230 { 0x1b, 0x0201401f }, /* front lineout */
8231 { }
8232 },
8233 .chain_id = ALC269_FIXUP_DMIC,
8234 },
8235 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8236 .type = HDA_FIXUP_PINS,
8237 .v.pins = (const struct hda_pintbl[]) {
8238 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8239 { }
8240 },
8241 .chained = true,
8242 .chain_id = ALC269_FIXUP_HEADSET_MODE
8243 },
8244 [ALC256_FIXUP_INTEL_NUC10] = {
8245 .type = HDA_FIXUP_PINS,
8246 .v.pins = (const struct hda_pintbl[]) {
8247 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8248 { }
8249 },
8250 .chained = true,
8251 .chain_id = ALC269_FIXUP_HEADSET_MODE
8252 },
8253 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8254 .type = HDA_FIXUP_VERBS,
8255 .v.verbs = (const struct hda_verb[]) {
8256 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8257 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8258 { }
8259 },
8260 .chained = true,
8261 .chain_id = ALC289_FIXUP_ASUS_GA502
8262 },
8263 [ALC274_FIXUP_HP_MIC] = {
8264 .type = HDA_FIXUP_VERBS,
8265 .v.verbs = (const struct hda_verb[]) {
8266 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8267 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8268 { }
8269 },
8270 },
8271 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8272 .type = HDA_FIXUP_FUNC,
8273 .v.func = alc274_fixup_hp_headset_mic,
8274 .chained = true,
8275 .chain_id = ALC274_FIXUP_HP_MIC
8276 },
Olivier Deprez157378f2022-04-04 15:47:50 +02008277 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8278 .type = HDA_FIXUP_FUNC,
8279 .v.func = alc274_fixup_hp_envy_gpio,
8280 },
Olivier Deprez0e641232021-09-23 10:07:05 +02008281 [ALC256_FIXUP_ASUS_HPE] = {
8282 .type = HDA_FIXUP_VERBS,
8283 .v.verbs = (const struct hda_verb[]) {
8284 /* Set EAPD high */
8285 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8286 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8287 { }
8288 },
8289 .chained = true,
8290 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8291 },
8292 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8293 .type = HDA_FIXUP_FUNC,
8294 .v.func = alc_fixup_headset_jack,
8295 .chained = true,
8296 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8297 },
Olivier Deprez157378f2022-04-04 15:47:50 +02008298 [ALC287_FIXUP_HP_GPIO_LED] = {
8299 .type = HDA_FIXUP_FUNC,
8300 .v.func = alc287_fixup_hp_gpio_led,
8301 },
8302 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8303 .type = HDA_FIXUP_FUNC,
8304 .v.func = alc274_fixup_hp_headset_mic,
8305 },
8306 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8307 .type = HDA_FIXUP_FUNC,
8308 .v.func = alc_fixup_no_int_mic,
8309 .chained = true,
8310 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8311 },
8312 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8313 .type = HDA_FIXUP_PINS,
8314 .v.pins = (const struct hda_pintbl[]) {
8315 { 0x1b, 0x411111f0 },
8316 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8317 { },
8318 },
8319 .chained = true,
8320 .chain_id = ALC269_FIXUP_HEADSET_MODE
8321 },
8322 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8323 .type = HDA_FIXUP_FUNC,
8324 .v.func = alc269_fixup_limit_int_mic_boost,
8325 .chained = true,
8326 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8327 },
8328 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8329 .type = HDA_FIXUP_PINS,
8330 .v.pins = (const struct hda_pintbl[]) {
8331 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8332 { 0x1a, 0x90a1092f }, /* use as internal mic */
8333 { }
8334 },
8335 .chained = true,
8336 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8337 },
8338 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8339 .type = HDA_FIXUP_FUNC,
8340 .v.func = alc285_fixup_ideapad_s740_coef,
8341 .chained = true,
8342 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8343 },
Olivier Deprez0e641232021-09-23 10:07:05 +02008344 [ALC295_FIXUP_ASUS_DACS] = {
8345 .type = HDA_FIXUP_FUNC,
8346 .v.func = alc295_fixup_asus_dacs,
8347 },
8348 [ALC295_FIXUP_HP_OMEN] = {
8349 .type = HDA_FIXUP_PINS,
8350 .v.pins = (const struct hda_pintbl[]) {
8351 { 0x12, 0xb7a60130 },
8352 { 0x13, 0x40000000 },
8353 { 0x14, 0x411111f0 },
8354 { 0x16, 0x411111f0 },
8355 { 0x17, 0x90170110 },
8356 { 0x18, 0x411111f0 },
8357 { 0x19, 0x02a11030 },
8358 { 0x1a, 0x411111f0 },
8359 { 0x1b, 0x04a19030 },
8360 { 0x1d, 0x40600001 },
8361 { 0x1e, 0x411111f0 },
8362 { 0x21, 0x03211020 },
8363 {}
8364 },
8365 .chained = true,
8366 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8367 },
8368 [ALC285_FIXUP_HP_SPECTRE_X360] = {
8369 .type = HDA_FIXUP_FUNC,
8370 .v.func = alc285_fixup_hp_spectre_x360,
8371 },
Olivier Deprez157378f2022-04-04 15:47:50 +02008372 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8373 .type = HDA_FIXUP_FUNC,
8374 .v.func = alc285_fixup_hp_spectre_x360_eb1
8375 },
8376 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8377 .type = HDA_FIXUP_FUNC,
8378 .v.func = alc285_fixup_ideapad_s740_coef,
8379 .chained = true,
8380 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8381 },
8382 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8383 .type = HDA_FIXUP_FUNC,
8384 .v.func = alc_fixup_no_shutup,
8385 .chained = true,
8386 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8387 },
8388 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8389 .type = HDA_FIXUP_PINS,
8390 .v.pins = (const struct hda_pintbl[]) {
8391 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8392 { }
8393 },
8394 .chained = true,
8395 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8396 },
8397 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8398 .type = HDA_FIXUP_FUNC,
8399 .v.func = alc269_fixup_limit_int_mic_boost,
8400 .chained = true,
8401 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8402 },
8403 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8404 .type = HDA_FIXUP_FUNC,
8405 .v.func = alc285_fixup_ideapad_s740_coef,
8406 .chained = true,
8407 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8408 },
8409 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8410 .type = HDA_FIXUP_FUNC,
8411 .v.func = alc287_fixup_legion_15imhg05_speakers,
8412 .chained = true,
8413 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8414 },
8415 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8416 .type = HDA_FIXUP_VERBS,
8417 //.v.verbs = legion_15imhg05_coefs,
8418 .v.verbs = (const struct hda_verb[]) {
8419 // set left speaker Legion 7i.
8420 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8421 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8422
8423 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8424 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8425 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8426 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8427 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8428
8429 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8430 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8431 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8432 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8433 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8434
8435 // set right speaker Legion 7i.
8436 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8437 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8438
8439 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8440 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8441 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8442 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8443 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8444
8445 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8446 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8447 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8448 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8449 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8450 {}
8451 },
8452 .chained = true,
8453 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8454 },
8455 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8456 .type = HDA_FIXUP_FUNC,
8457 .v.func = alc287_fixup_legion_15imhg05_speakers,
8458 .chained = true,
8459 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8460 },
8461 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8462 .type = HDA_FIXUP_VERBS,
8463 .v.verbs = (const struct hda_verb[]) {
8464 // set left speaker Yoga 7i.
8465 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8466 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8467
8468 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8469 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8470 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8471 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8472 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8473
8474 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8475 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8476 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8477 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8478 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8479
8480 // set right speaker Yoga 7i.
8481 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8482 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8483
8484 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8485 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8486 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8487 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8488 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8489
8490 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8491 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8492 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8493 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8494 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8495 {}
8496 },
8497 .chained = true,
8498 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8499 },
8500 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8501 .type = HDA_FIXUP_VERBS,
8502 .v.verbs = (const struct hda_verb[]) {
8503 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8504 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8505 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8506 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8507 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8508 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8509 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8510 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8511 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8512 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8513 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8514 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8515 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8516 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8517 {}
8518 },
8519 .chained = true,
8520 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8521 },
8522 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
8523 .type = HDA_FIXUP_FUNC,
8524 .v.func = alc256_fixup_set_coef_defaults,
8525 },
8526 [ALC245_FIXUP_HP_GPIO_LED] = {
8527 .type = HDA_FIXUP_FUNC,
8528 .v.func = alc245_fixup_hp_gpio_led,
8529 },
8530 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8531 .type = HDA_FIXUP_PINS,
8532 .v.pins = (const struct hda_pintbl[]) {
8533 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8534 { }
8535 },
8536 .chained = true,
8537 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8538 },
8539 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8540 .type = HDA_FIXUP_FUNC,
8541 .v.func = alc233_fixup_no_audio_jack,
8542 },
8543 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8544 .type = HDA_FIXUP_FUNC,
8545 .v.func = alc256_fixup_mic_no_presence_and_resume,
8546 .chained = true,
8547 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8548 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008549};
8550
8551static const struct snd_pci_quirk alc269_fixup_tbl[] = {
8552 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
8553 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8554 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
8555 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
8556 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008557 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8558 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
8559 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8560 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8561 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Olivier Deprez0e641232021-09-23 10:07:05 +02008562 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8563 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
8564 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008565 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Olivier Deprez0e641232021-09-23 10:07:05 +02008566 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008567 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Olivier Deprez157378f2022-04-04 15:47:50 +02008568 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
David Brazdil0f672f62019-12-10 10:32:29 +00008569 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8570 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Olivier Deprez0e641232021-09-23 10:07:05 +02008571 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8572 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
David Brazdil0f672f62019-12-10 10:32:29 +00008573 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Olivier Deprez0e641232021-09-23 10:07:05 +02008574 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
8575 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Olivier Deprez157378f2022-04-04 15:47:50 +02008576 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
David Brazdil0f672f62019-12-10 10:32:29 +00008577 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8578 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8579 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Olivier Deprez157378f2022-04-04 15:47:50 +02008580 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
8581 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
David Brazdil0f672f62019-12-10 10:32:29 +00008582 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8583 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
8584 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Olivier Deprez157378f2022-04-04 15:47:50 +02008585 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Olivier Deprez0e641232021-09-23 10:07:05 +02008586 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8587 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
Olivier Deprez157378f2022-04-04 15:47:50 +02008588 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008589 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
8590 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
8591 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
8592 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8593 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8594 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
8595 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
8596 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8597 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8598 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8599 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8600 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8601 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
8602 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
8603 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
8604 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8605 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8606 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
8607 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8608 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8609 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8610 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8611 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8612 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8613 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8614 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8615 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8616 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008617 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8618 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
David Brazdil0f672f62019-12-10 10:32:29 +00008619 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008620 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
8621 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008622 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Olivier Deprez0e641232021-09-23 10:07:05 +02008623 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008624 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008625 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8626 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8627 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8628 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8629 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
David Brazdil0f672f62019-12-10 10:32:29 +00008630 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
8631 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
8632 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Olivier Deprez0e641232021-09-23 10:07:05 +02008633 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8634 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8635 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8636 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Olivier Deprez157378f2022-04-04 15:47:50 +02008637 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8638 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8639 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
8640 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
8641 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
8642 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8643 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008644 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8645 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8646 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
8647 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8648 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008649 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8650 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8651 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Olivier Deprez0e641232021-09-23 10:07:05 +02008652 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8653 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8654 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8655 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008656 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8657 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8658 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8659 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8660 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008661 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8662 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8663 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8664 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8665 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8666 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8667 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Olivier Deprez0e641232021-09-23 10:07:05 +02008668 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008669 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8670 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8671 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8672 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Olivier Deprez0e641232021-09-23 10:07:05 +02008673 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8674 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8675 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8676 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8677 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008678 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Olivier Deprez0e641232021-09-23 10:07:05 +02008679 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008680 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Olivier Deprez0e641232021-09-23 10:07:05 +02008681 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008682 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8683 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8684 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8685 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8686 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Olivier Deprez0e641232021-09-23 10:07:05 +02008687 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8688 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8689 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8690 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8691 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008692 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8693 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8694 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Olivier Deprez0e641232021-09-23 10:07:05 +02008695 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8696 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8697 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8698 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008699 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8700 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8701 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8702 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
David Brazdil0f672f62019-12-10 10:32:29 +00008703 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8704 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Olivier Deprez157378f2022-04-04 15:47:50 +02008705 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8706 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008707 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8708 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
8709 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Olivier Deprez0e641232021-09-23 10:07:05 +02008710 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
David Brazdil0f672f62019-12-10 10:32:29 +00008711 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8712 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008713 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Olivier Deprez0e641232021-09-23 10:07:05 +02008714 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
David Brazdil0f672f62019-12-10 10:32:29 +00008715 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Olivier Deprez0e641232021-09-23 10:07:05 +02008716 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
David Brazdil0f672f62019-12-10 10:32:29 +00008717 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Olivier Deprez0e641232021-09-23 10:07:05 +02008718 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
Olivier Deprez157378f2022-04-04 15:47:50 +02008719 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Olivier Deprez0e641232021-09-23 10:07:05 +02008720 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8721 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Olivier Deprez157378f2022-04-04 15:47:50 +02008722 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
8723 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8724 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Olivier Deprez0e641232021-09-23 10:07:05 +02008725 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
Olivier Deprez157378f2022-04-04 15:47:50 +02008726 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
Olivier Deprez0e641232021-09-23 10:07:05 +02008727 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Olivier Deprez157378f2022-04-04 15:47:50 +02008728 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
8729 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Olivier Deprez0e641232021-09-23 10:07:05 +02008730 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8731 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
8732 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
8733 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Olivier Deprez157378f2022-04-04 15:47:50 +02008734 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8735 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8736 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8737 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8738 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
8739 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
8740 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8741 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8742 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8743 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8744 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8745 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
8746 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
8747 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
8748 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8749 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8750 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8751 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8752 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8753 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8754 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8755 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8756 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8757 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8758 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8759 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8760 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8761 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
8762 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008763 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
8764 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
8765 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
David Brazdil0f672f62019-12-10 10:32:29 +00008766 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008767 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
8768 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8769 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8770 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Olivier Deprez0e641232021-09-23 10:07:05 +02008771 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8772 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008773 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8774 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008775 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
Olivier Deprez0e641232021-09-23 10:07:05 +02008776 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008777 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
8778 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008779 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
8780 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Olivier Deprez0e641232021-09-23 10:07:05 +02008781 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
8782 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
8783 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
8784 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
David Brazdil0f672f62019-12-10 10:32:29 +00008785 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Olivier Deprez0e641232021-09-23 10:07:05 +02008786 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
8787 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Olivier Deprez157378f2022-04-04 15:47:50 +02008788 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
Olivier Deprez0e641232021-09-23 10:07:05 +02008789 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8790 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
8791 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008792 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
8793 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Olivier Deprez0e641232021-09-23 10:07:05 +02008794 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008795 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
8796 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8797 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8798 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Olivier Deprez0e641232021-09-23 10:07:05 +02008799 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
8800 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
8801 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
8802 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
8803 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Olivier Deprez157378f2022-04-04 15:47:50 +02008804 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
8805 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008806 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
8807 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8808 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8809 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8810 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8811 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008812 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8813 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8814 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8815 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Olivier Deprez0e641232021-09-23 10:07:05 +02008816 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8817 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008818 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
8819 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
8820 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008821 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
Olivier Deprez0e641232021-09-23 10:07:05 +02008822 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008823 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
8824 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
Olivier Deprez0e641232021-09-23 10:07:05 +02008825 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
8826 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8827 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8828 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008829 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
8830 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Olivier Deprez0e641232021-09-23 10:07:05 +02008831 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8832 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8833 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8834 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008835 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Olivier Deprez0e641232021-09-23 10:07:05 +02008836 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8837 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008838 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8839 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8840 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Olivier Deprez0e641232021-09-23 10:07:05 +02008841 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
8842 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
David Brazdil0f672f62019-12-10 10:32:29 +00008843 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Olivier Deprez0e641232021-09-23 10:07:05 +02008844 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8845 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8846 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8847 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8848 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8849 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8850 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8851 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8852 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8853 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Olivier Deprez157378f2022-04-04 15:47:50 +02008854 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8855 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Olivier Deprez0e641232021-09-23 10:07:05 +02008856 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8857 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8858 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8859 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8860 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Olivier Deprez157378f2022-04-04 15:47:50 +02008861 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8862 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Olivier Deprez0e641232021-09-23 10:07:05 +02008863 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8864 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8865 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8866 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8867 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8868 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8869 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8870 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8871 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8872 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8873 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8874 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8875 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8876 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8877 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8878 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8879 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8880 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8881 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
David Brazdil0f672f62019-12-10 10:32:29 +00008882 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8883 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8884 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
8885 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
Olivier Deprez0e641232021-09-23 10:07:05 +02008886 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
8887 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Olivier Deprez157378f2022-04-04 15:47:50 +02008888 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8889 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Olivier Deprez0e641232021-09-23 10:07:05 +02008890 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Olivier Deprez157378f2022-04-04 15:47:50 +02008891 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
Olivier Deprez0e641232021-09-23 10:07:05 +02008892 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8893 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8894 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8895 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8896 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8897 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8898 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8899 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8900 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL5XNU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8901 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8902 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8903 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8904 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8905 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8906 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008907 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Olivier Deprez157378f2022-04-04 15:47:50 +02008908 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008909 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8910 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8911 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8912 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8913 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008914 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Olivier Deprez0e641232021-09-23 10:07:05 +02008915 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
8916 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008917 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
8918 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
8919 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
8920 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
8921 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
8922 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
8923 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
8924 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
8925 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
8926 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8927 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
8928 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
8929 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
8930 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8931 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8932 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
8933 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
8934 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8935 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8936 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8937 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
8938 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8939 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8940 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8941 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Olivier Deprez0e641232021-09-23 10:07:05 +02008942 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
8943 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
8944 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8945 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008946 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
8947 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
8948 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
David Brazdil0f672f62019-12-10 10:32:29 +00008949 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008950 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8951 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8952 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
David Brazdil0f672f62019-12-10 10:32:29 +00008953 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8954 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8955 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Olivier Deprez157378f2022-04-04 15:47:50 +02008956 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
8957 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
Olivier Deprez0e641232021-09-23 10:07:05 +02008958 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
Olivier Deprez157378f2022-04-04 15:47:50 +02008959 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
8960 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
8961 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
8962 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8963 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
8964 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
8965 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8966 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8967 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008968 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
8969 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
David Brazdil0f672f62019-12-10 10:32:29 +00008970 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Olivier Deprez0e641232021-09-23 10:07:05 +02008971 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008972 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8973 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
8974 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
8975 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8976 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
8977 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
8978 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
8979 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
8980 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
8981 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
8982 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
8983 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
8984 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8985 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8986 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8987 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8988 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8989 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008990 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Olivier Deprez157378f2022-04-04 15:47:50 +02008991 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
David Brazdil0f672f62019-12-10 10:32:29 +00008992 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Olivier Deprez0e641232021-09-23 10:07:05 +02008993 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8994 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8995 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008996 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Olivier Deprez0e641232021-09-23 10:07:05 +02008997 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8998 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Olivier Deprez157378f2022-04-04 15:47:50 +02008999 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
Olivier Deprez0e641232021-09-23 10:07:05 +02009000 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
9001 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
9002 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
9003 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
9004 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
9005 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
9006 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009007
9008#if 0
9009 /* Below is a quirk table taken from the old code.
9010 * Basically the device should work as is without the fixup table.
9011 * If BIOS doesn't give a proper info, enable the corresponding
9012 * fixup entry.
9013 */
9014 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9015 ALC269_FIXUP_AMIC),
9016 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
9017 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9018 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9019 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9020 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9021 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9022 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9023 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9024 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9025 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9026 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9027 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9028 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9029 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9030 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9031 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9032 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9033 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9034 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9035 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9036 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9037 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9038 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9039 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9040 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9041 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9042 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9043 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9044 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9045 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9046 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9047 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9048 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9049 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9050 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9051 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9052 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9053 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9054 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9055#endif
9056 {}
9057};
9058
9059static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9060 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9061 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9062 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9063 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
David Brazdil0f672f62019-12-10 10:32:29 +00009064 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009065 {}
9066};
9067
9068static const struct hda_model_fixup alc269_fixup_models[] = {
9069 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9070 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
9071 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9072 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9073 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
9074 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
9075 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9076 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
9077 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Olivier Deprez0e641232021-09-23 10:07:05 +02009078 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009079 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9080 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
9081 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9082 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
9083 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9084 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
9085 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
9086 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
9087 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9088 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
9089 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Olivier Deprez0e641232021-09-23 10:07:05 +02009090 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009091 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
9092 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
9093 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
9094 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9095 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9096 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9097 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9098 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9099 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9100 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9101 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9102 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9103 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9104 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9105 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9106 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9107 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9108 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9109 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9110 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9111 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9112 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9113 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9114 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9115 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9116 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9117 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9118 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9119 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9120 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9121 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9122 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9123 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9124 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9125 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9126 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9127 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9128 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9129 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9130 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9131 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9132 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9133 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
David Brazdil0f672f62019-12-10 10:32:29 +00009134 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009135 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
Olivier Deprez0e641232021-09-23 10:07:05 +02009136 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009137 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9138 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9139 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9140 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9141 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9142 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9143 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9144 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9145 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9146 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9147 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9148 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9149 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9150 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009151 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9152 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9153 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
David Brazdil0f672f62019-12-10 10:32:29 +00009154 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009155 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Olivier Deprez0e641232021-09-23 10:07:05 +02009156 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009157 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9158 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9159 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9160 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9161 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9162 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9163 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9164 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9165 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9166 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9167 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9168 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9169 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9170 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9171 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9172 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9173 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
David Brazdil0f672f62019-12-10 10:32:29 +00009174 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9175 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
9176 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
9177 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
9178 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Olivier Deprez0e641232021-09-23 10:07:05 +02009179 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
9180 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
9181 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Olivier Deprez157378f2022-04-04 15:47:50 +02009182 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
Olivier Deprez0e641232021-09-23 10:07:05 +02009183 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
9184 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
Olivier Deprez157378f2022-04-04 15:47:50 +02009185 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9186 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
9187 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
9188 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
9189 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009190 {}
9191};
9192#define ALC225_STANDARD_PINS \
9193 {0x21, 0x04211020}
9194
9195#define ALC256_STANDARD_PINS \
9196 {0x12, 0x90a60140}, \
9197 {0x14, 0x90170110}, \
9198 {0x21, 0x02211020}
9199
9200#define ALC282_STANDARD_PINS \
9201 {0x14, 0x90170110}
9202
9203#define ALC290_STANDARD_PINS \
9204 {0x12, 0x99a30130}
9205
9206#define ALC292_STANDARD_PINS \
9207 {0x14, 0x90170110}, \
9208 {0x15, 0x0221401f}
9209
9210#define ALC295_STANDARD_PINS \
9211 {0x12, 0xb7a60130}, \
9212 {0x14, 0x90170110}, \
9213 {0x21, 0x04211020}
9214
9215#define ALC298_STANDARD_PINS \
9216 {0x12, 0x90a60130}, \
9217 {0x21, 0x03211020}
9218
9219static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
9220 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9221 {0x14, 0x01014020},
9222 {0x17, 0x90170110},
9223 {0x18, 0x02a11030},
9224 {0x19, 0x0181303F},
9225 {0x21, 0x0221102f}),
9226 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9227 {0x12, 0x90a601c0},
9228 {0x14, 0x90171120},
9229 {0x21, 0x02211030}),
9230 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9231 {0x14, 0x90170110},
9232 {0x1b, 0x90a70130},
9233 {0x21, 0x03211020}),
9234 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9235 {0x1a, 0x90a70130},
9236 {0x1b, 0x90170110},
9237 {0x21, 0x03211020}),
9238 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9239 ALC225_STANDARD_PINS,
9240 {0x12, 0xb7a60130},
9241 {0x14, 0x901701a0}),
9242 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9243 ALC225_STANDARD_PINS,
9244 {0x12, 0xb7a60130},
9245 {0x14, 0x901701b0}),
9246 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9247 ALC225_STANDARD_PINS,
9248 {0x12, 0xb7a60150},
9249 {0x14, 0x901701a0}),
9250 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9251 ALC225_STANDARD_PINS,
9252 {0x12, 0xb7a60150},
9253 {0x14, 0x901701b0}),
9254 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9255 ALC225_STANDARD_PINS,
9256 {0x12, 0xb7a60130},
9257 {0x1b, 0x90170110}),
9258 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9259 {0x1b, 0x01111010},
9260 {0x1e, 0x01451130},
9261 {0x21, 0x02211020}),
9262 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9263 {0x12, 0x90a60140},
9264 {0x14, 0x90170110},
9265 {0x19, 0x02a11030},
9266 {0x21, 0x02211020}),
9267 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9268 {0x14, 0x90170110},
9269 {0x19, 0x02a11030},
9270 {0x1a, 0x02a11040},
9271 {0x1b, 0x01014020},
9272 {0x21, 0x0221101f}),
9273 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9274 {0x14, 0x90170110},
9275 {0x19, 0x02a11030},
9276 {0x1a, 0x02a11040},
9277 {0x1b, 0x01011020},
9278 {0x21, 0x0221101f}),
9279 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9280 {0x14, 0x90170110},
9281 {0x19, 0x02a11020},
9282 {0x1a, 0x02a11030},
9283 {0x21, 0x0221101f}),
Olivier Deprez157378f2022-04-04 15:47:50 +02009284 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9285 {0x21, 0x02211010}),
9286 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9287 {0x14, 0x90170110},
9288 {0x19, 0x02a11020},
9289 {0x21, 0x02211030}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009290 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9291 {0x14, 0x90170110},
9292 {0x21, 0x02211020}),
9293 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9294 {0x14, 0x90170130},
9295 {0x21, 0x02211040}),
9296 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9297 {0x12, 0x90a60140},
9298 {0x14, 0x90170110},
9299 {0x21, 0x02211020}),
9300 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9301 {0x12, 0x90a60160},
9302 {0x14, 0x90170120},
9303 {0x21, 0x02211030}),
9304 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9305 {0x14, 0x90170110},
9306 {0x1b, 0x02011020},
9307 {0x21, 0x0221101f}),
9308 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9309 {0x14, 0x90170110},
9310 {0x1b, 0x01011020},
9311 {0x21, 0x0221101f}),
9312 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9313 {0x14, 0x90170130},
9314 {0x1b, 0x01014020},
9315 {0x21, 0x0221103f}),
9316 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9317 {0x14, 0x90170130},
9318 {0x1b, 0x01011020},
9319 {0x21, 0x0221103f}),
9320 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9321 {0x14, 0x90170130},
9322 {0x1b, 0x02011020},
9323 {0x21, 0x0221103f}),
9324 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9325 {0x14, 0x90170150},
9326 {0x1b, 0x02011020},
9327 {0x21, 0x0221105f}),
9328 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9329 {0x14, 0x90170110},
9330 {0x1b, 0x01014020},
9331 {0x21, 0x0221101f}),
9332 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9333 {0x12, 0x90a60160},
9334 {0x14, 0x90170120},
9335 {0x17, 0x90170140},
9336 {0x21, 0x0321102f}),
9337 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9338 {0x12, 0x90a60160},
9339 {0x14, 0x90170130},
9340 {0x21, 0x02211040}),
9341 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9342 {0x12, 0x90a60160},
9343 {0x14, 0x90170140},
9344 {0x21, 0x02211050}),
9345 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9346 {0x12, 0x90a60170},
9347 {0x14, 0x90170120},
9348 {0x21, 0x02211030}),
9349 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9350 {0x12, 0x90a60170},
9351 {0x14, 0x90170130},
9352 {0x21, 0x02211040}),
9353 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9354 {0x12, 0x90a60170},
9355 {0x14, 0x90171130},
9356 {0x21, 0x02211040}),
9357 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9358 {0x12, 0x90a60170},
9359 {0x14, 0x90170140},
9360 {0x21, 0x02211050}),
9361 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9362 {0x12, 0x90a60180},
9363 {0x14, 0x90170130},
9364 {0x21, 0x02211040}),
9365 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9366 {0x12, 0x90a60180},
9367 {0x14, 0x90170120},
9368 {0x21, 0x02211030}),
9369 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9370 {0x1b, 0x01011020},
9371 {0x21, 0x02211010}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009372 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9373 {0x14, 0x90170110},
9374 {0x1b, 0x90a70130},
9375 {0x21, 0x04211020}),
9376 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9377 {0x14, 0x90170110},
9378 {0x1b, 0x90a70130},
9379 {0x21, 0x03211020}),
David Brazdil0f672f62019-12-10 10:32:29 +00009380 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9381 {0x12, 0x90a60130},
9382 {0x14, 0x90170110},
9383 {0x21, 0x03211020}),
9384 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9385 {0x12, 0x90a60130},
9386 {0x14, 0x90170110},
9387 {0x21, 0x04211020}),
9388 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9389 {0x1a, 0x90a70130},
9390 {0x1b, 0x90170110},
9391 {0x21, 0x03211020}),
Olivier Deprez157378f2022-04-04 15:47:50 +02009392 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9393 {0x14, 0x90170110},
9394 {0x19, 0x02a11020},
9395 {0x21, 0x0221101f}),
Olivier Deprez0e641232021-09-23 10:07:05 +02009396 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9397 {0x17, 0x90170110},
9398 {0x19, 0x03a11030},
9399 {0x21, 0x03211020}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009400 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9401 {0x12, 0x90a60130},
9402 {0x14, 0x90170110},
9403 {0x15, 0x0421101f},
9404 {0x1a, 0x04a11020}),
9405 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9406 {0x12, 0x90a60140},
9407 {0x14, 0x90170110},
9408 {0x15, 0x0421101f},
9409 {0x18, 0x02811030},
9410 {0x1a, 0x04a1103f},
9411 {0x1b, 0x02011020}),
9412 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9413 ALC282_STANDARD_PINS,
9414 {0x12, 0x99a30130},
9415 {0x19, 0x03a11020},
9416 {0x21, 0x0321101f}),
9417 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9418 ALC282_STANDARD_PINS,
9419 {0x12, 0x99a30130},
9420 {0x19, 0x03a11020},
9421 {0x21, 0x03211040}),
9422 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9423 ALC282_STANDARD_PINS,
9424 {0x12, 0x99a30130},
9425 {0x19, 0x03a11030},
9426 {0x21, 0x03211020}),
9427 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9428 ALC282_STANDARD_PINS,
9429 {0x12, 0x99a30130},
9430 {0x19, 0x04a11020},
9431 {0x21, 0x0421101f}),
9432 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
9433 ALC282_STANDARD_PINS,
9434 {0x12, 0x90a60140},
9435 {0x19, 0x04a11030},
9436 {0x21, 0x04211020}),
Olivier Deprez157378f2022-04-04 15:47:50 +02009437 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9438 ALC282_STANDARD_PINS,
9439 {0x12, 0x90a609c0},
9440 {0x18, 0x03a11830},
9441 {0x19, 0x04a19831},
9442 {0x1a, 0x0481303f},
9443 {0x1b, 0x04211020},
9444 {0x21, 0x0321101f}),
9445 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9446 ALC282_STANDARD_PINS,
9447 {0x12, 0x90a60940},
9448 {0x18, 0x03a11830},
9449 {0x19, 0x04a19831},
9450 {0x1a, 0x0481303f},
9451 {0x1b, 0x04211020},
9452 {0x21, 0x0321101f}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009453 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9454 ALC282_STANDARD_PINS,
9455 {0x12, 0x90a60130},
9456 {0x21, 0x0321101f}),
9457 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9458 {0x12, 0x90a60160},
9459 {0x14, 0x90170120},
9460 {0x21, 0x02211030}),
9461 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9462 ALC282_STANDARD_PINS,
9463 {0x12, 0x90a60130},
9464 {0x19, 0x03a11020},
9465 {0x21, 0x0321101f}),
David Brazdil0f672f62019-12-10 10:32:29 +00009466 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009467 {0x12, 0x90a60130},
9468 {0x14, 0x90170110},
9469 {0x19, 0x04a11040},
9470 {0x21, 0x04211020}),
Olivier Deprez0e641232021-09-23 10:07:05 +02009471 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9472 {0x14, 0x90170110},
9473 {0x19, 0x04a11040},
9474 {0x1d, 0x40600001},
9475 {0x21, 0x04211020}),
9476 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9477 {0x14, 0x90170110},
9478 {0x19, 0x04a11040},
9479 {0x21, 0x04211020}),
9480 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9481 {0x14, 0x90170110},
9482 {0x17, 0x90170111},
9483 {0x19, 0x03a11030},
9484 {0x21, 0x03211020}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009485 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9486 {0x12, 0x90a60130},
9487 {0x17, 0x90170110},
9488 {0x21, 0x02211020}),
9489 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
9490 {0x12, 0x90a60120},
9491 {0x14, 0x90170110},
9492 {0x21, 0x0321101f}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009493 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9494 ALC290_STANDARD_PINS,
9495 {0x15, 0x04211040},
9496 {0x18, 0x90170112},
9497 {0x1a, 0x04a11020}),
9498 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9499 ALC290_STANDARD_PINS,
9500 {0x15, 0x04211040},
9501 {0x18, 0x90170110},
9502 {0x1a, 0x04a11020}),
9503 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9504 ALC290_STANDARD_PINS,
9505 {0x15, 0x0421101f},
9506 {0x1a, 0x04a11020}),
9507 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9508 ALC290_STANDARD_PINS,
9509 {0x15, 0x04211020},
9510 {0x1a, 0x04a11040}),
9511 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9512 ALC290_STANDARD_PINS,
9513 {0x14, 0x90170110},
9514 {0x15, 0x04211020},
9515 {0x1a, 0x04a11040}),
9516 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9517 ALC290_STANDARD_PINS,
9518 {0x14, 0x90170110},
9519 {0x15, 0x04211020},
9520 {0x1a, 0x04a11020}),
9521 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9522 ALC290_STANDARD_PINS,
9523 {0x14, 0x90170110},
9524 {0x15, 0x0421101f},
9525 {0x1a, 0x04a11020}),
9526 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9527 ALC292_STANDARD_PINS,
9528 {0x12, 0x90a60140},
9529 {0x16, 0x01014020},
9530 {0x19, 0x01a19030}),
9531 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9532 ALC292_STANDARD_PINS,
9533 {0x12, 0x90a60140},
9534 {0x16, 0x01014020},
9535 {0x18, 0x02a19031},
9536 {0x19, 0x01a1903e}),
9537 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
9538 ALC292_STANDARD_PINS,
9539 {0x12, 0x90a60140}),
9540 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9541 ALC292_STANDARD_PINS,
9542 {0x13, 0x90a60140},
9543 {0x16, 0x21014020},
9544 {0x19, 0x21a19030}),
9545 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9546 ALC292_STANDARD_PINS,
9547 {0x13, 0x90a60140}),
Olivier Deprez0e641232021-09-23 10:07:05 +02009548 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9549 {0x17, 0x90170110},
9550 {0x21, 0x04211020}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009551 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9552 {0x14, 0x90170110},
9553 {0x1b, 0x90a70130},
9554 {0x21, 0x04211020}),
9555 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9556 {0x12, 0x90a60130},
9557 {0x17, 0x90170110},
David Brazdil0f672f62019-12-10 10:32:29 +00009558 {0x21, 0x03211020}),
9559 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9560 {0x12, 0x90a60130},
9561 {0x17, 0x90170110},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009562 {0x21, 0x04211020}),
David Brazdil0f672f62019-12-10 10:32:29 +00009563 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9564 {0x12, 0x90a60130},
9565 {0x17, 0x90170110},
9566 {0x21, 0x03211020}),
Olivier Deprez0e641232021-09-23 10:07:05 +02009567 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9568 {0x12, 0x90a60120},
9569 {0x17, 0x90170110},
9570 {0x21, 0x04211030}),
9571 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9572 {0x12, 0x90a60130},
9573 {0x17, 0x90170110},
9574 {0x21, 0x03211020}),
9575 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9576 {0x12, 0x90a60130},
9577 {0x17, 0x90170110},
9578 {0x21, 0x03211020}),
David Brazdil0f672f62019-12-10 10:32:29 +00009579 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9580 {0x14, 0x90170110},
9581 {0x21, 0x04211020}),
9582 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9583 {0x14, 0x90170110},
9584 {0x21, 0x04211030}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009585 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9586 ALC295_STANDARD_PINS,
9587 {0x17, 0x21014020},
9588 {0x18, 0x21a19030}),
9589 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9590 ALC295_STANDARD_PINS,
9591 {0x17, 0x21014040},
9592 {0x18, 0x21a19050}),
9593 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9594 ALC295_STANDARD_PINS),
9595 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9596 ALC298_STANDARD_PINS,
9597 {0x17, 0x90170110}),
9598 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9599 ALC298_STANDARD_PINS,
9600 {0x17, 0x90170140}),
9601 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9602 ALC298_STANDARD_PINS,
9603 {0x17, 0x90170150}),
9604 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9605 {0x12, 0xb7a60140},
9606 {0x13, 0xb7a60150},
9607 {0x17, 0x90170110},
9608 {0x1a, 0x03011020},
9609 {0x21, 0x03211030}),
David Brazdil0f672f62019-12-10 10:32:29 +00009610 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9611 {0x12, 0xb7a60140},
9612 {0x17, 0x90170110},
9613 {0x1a, 0x03a11030},
9614 {0x21, 0x03211020}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009615 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9616 ALC225_STANDARD_PINS,
9617 {0x12, 0xb7a60130},
9618 {0x17, 0x90170110}),
Olivier Deprez0e641232021-09-23 10:07:05 +02009619 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9620 {0x14, 0x01014010},
9621 {0x17, 0x90170120},
9622 {0x18, 0x02a11030},
9623 {0x19, 0x02a1103f},
9624 {0x21, 0x0221101f}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009625 {}
9626};
9627
David Brazdil0f672f62019-12-10 10:32:29 +00009628/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9629 * more machines, don't need to match all valid pins, just need to match
9630 * all the pins defined in the tbl. Just because of this reason, it is possible
9631 * that a single machine matches multiple tbls, so there is one limitation:
9632 * at most one tbl is allowed to define for the same vendor and same codec
9633 */
9634static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9635 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9636 {0x19, 0x40000000},
9637 {0x1b, 0x40000000}),
Olivier Deprez157378f2022-04-04 15:47:50 +02009638 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Olivier Deprez0e641232021-09-23 10:07:05 +02009639 {0x19, 0x40000000},
9640 {0x1a, 0x40000000}),
9641 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9642 {0x19, 0x40000000},
9643 {0x1a, 0x40000000}),
Olivier Deprez157378f2022-04-04 15:47:50 +02009644 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9645 {0x19, 0x40000000},
9646 {0x1a, 0x40000000}),
David Brazdil0f672f62019-12-10 10:32:29 +00009647 {}
9648};
9649
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009650static void alc269_fill_coef(struct hda_codec *codec)
9651{
9652 struct alc_spec *spec = codec->spec;
9653 int val;
9654
9655 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
9656 return;
9657
9658 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
9659 alc_write_coef_idx(codec, 0xf, 0x960b);
9660 alc_write_coef_idx(codec, 0xe, 0x8817);
9661 }
9662
9663 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
9664 alc_write_coef_idx(codec, 0xf, 0x960b);
9665 alc_write_coef_idx(codec, 0xe, 0x8814);
9666 }
9667
9668 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
9669 /* Power up output pin */
9670 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
9671 }
9672
9673 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
9674 val = alc_read_coef_idx(codec, 0xd);
9675 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
9676 /* Capless ramp up clock control */
9677 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9678 }
9679 val = alc_read_coef_idx(codec, 0x17);
9680 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
9681 /* Class D power on reset */
9682 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9683 }
9684 }
9685
9686 /* HP */
9687 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
9688}
9689
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009690/*
9691 */
9692static int patch_alc269(struct hda_codec *codec)
9693{
9694 struct alc_spec *spec;
9695 int err;
9696
9697 err = alc_alloc_spec(codec, 0x0b);
9698 if (err < 0)
9699 return err;
9700
9701 spec = codec->spec;
9702 spec->gen.shared_mic_vref_pin = 0x18;
David Brazdil0f672f62019-12-10 10:32:29 +00009703 codec->power_save_node = 0;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009704
9705#ifdef CONFIG_PM
9706 codec->patch_ops.suspend = alc269_suspend;
9707 codec->patch_ops.resume = alc269_resume;
9708#endif
9709 spec->shutup = alc_default_shutup;
9710 spec->init_hook = alc_default_init;
9711
9712 switch (codec->core.vendor_id) {
9713 case 0x10ec0269:
9714 spec->codec_variant = ALC269_TYPE_ALC269VA;
9715 switch (alc_get_coef0(codec) & 0x00f0) {
9716 case 0x0010:
9717 if (codec->bus->pci &&
9718 codec->bus->pci->subsystem_vendor == 0x1025 &&
9719 spec->cdefine.platform_type == 1)
9720 err = alc_codec_rename(codec, "ALC271X");
9721 spec->codec_variant = ALC269_TYPE_ALC269VB;
9722 break;
9723 case 0x0020:
9724 if (codec->bus->pci &&
9725 codec->bus->pci->subsystem_vendor == 0x17aa &&
9726 codec->bus->pci->subsystem_device == 0x21f3)
9727 err = alc_codec_rename(codec, "ALC3202");
9728 spec->codec_variant = ALC269_TYPE_ALC269VC;
9729 break;
9730 case 0x0030:
9731 spec->codec_variant = ALC269_TYPE_ALC269VD;
9732 break;
9733 default:
9734 alc_fix_pll_init(codec, 0x20, 0x04, 15);
9735 }
9736 if (err < 0)
9737 goto error;
9738 spec->shutup = alc269_shutup;
9739 spec->init_hook = alc269_fill_coef;
9740 alc269_fill_coef(codec);
9741 break;
9742
9743 case 0x10ec0280:
9744 case 0x10ec0290:
9745 spec->codec_variant = ALC269_TYPE_ALC280;
9746 break;
9747 case 0x10ec0282:
9748 spec->codec_variant = ALC269_TYPE_ALC282;
9749 spec->shutup = alc282_shutup;
9750 spec->init_hook = alc282_init;
9751 break;
9752 case 0x10ec0233:
9753 case 0x10ec0283:
9754 spec->codec_variant = ALC269_TYPE_ALC283;
9755 spec->shutup = alc283_shutup;
9756 spec->init_hook = alc283_init;
9757 break;
9758 case 0x10ec0284:
9759 case 0x10ec0292:
9760 spec->codec_variant = ALC269_TYPE_ALC284;
9761 break;
9762 case 0x10ec0293:
9763 spec->codec_variant = ALC269_TYPE_ALC293;
9764 break;
9765 case 0x10ec0286:
9766 case 0x10ec0288:
9767 spec->codec_variant = ALC269_TYPE_ALC286;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009768 break;
9769 case 0x10ec0298:
9770 spec->codec_variant = ALC269_TYPE_ALC298;
9771 break;
9772 case 0x10ec0235:
9773 case 0x10ec0255:
9774 spec->codec_variant = ALC269_TYPE_ALC255;
9775 spec->shutup = alc256_shutup;
9776 spec->init_hook = alc256_init;
9777 break;
Olivier Deprez0e641232021-09-23 10:07:05 +02009778 case 0x10ec0230:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009779 case 0x10ec0236:
9780 case 0x10ec0256:
9781 spec->codec_variant = ALC269_TYPE_ALC256;
9782 spec->shutup = alc256_shutup;
9783 spec->init_hook = alc256_init;
9784 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009785 break;
9786 case 0x10ec0257:
9787 spec->codec_variant = ALC269_TYPE_ALC257;
9788 spec->shutup = alc256_shutup;
9789 spec->init_hook = alc256_init;
9790 spec->gen.mixer_nid = 0;
9791 break;
9792 case 0x10ec0215:
Olivier Deprez0e641232021-09-23 10:07:05 +02009793 case 0x10ec0245:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009794 case 0x10ec0285:
Olivier Deprez0e641232021-09-23 10:07:05 +02009795 case 0x10ec0287:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009796 case 0x10ec0289:
9797 spec->codec_variant = ALC269_TYPE_ALC215;
9798 spec->shutup = alc225_shutup;
9799 spec->init_hook = alc225_init;
9800 spec->gen.mixer_nid = 0;
9801 break;
9802 case 0x10ec0225:
9803 case 0x10ec0295:
9804 case 0x10ec0299:
9805 spec->codec_variant = ALC269_TYPE_ALC225;
9806 spec->shutup = alc225_shutup;
9807 spec->init_hook = alc225_init;
9808 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
9809 break;
9810 case 0x10ec0234:
9811 case 0x10ec0274:
9812 case 0x10ec0294:
9813 spec->codec_variant = ALC269_TYPE_ALC294;
9814 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
9815 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
David Brazdil0f672f62019-12-10 10:32:29 +00009816 spec->init_hook = alc294_init;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009817 break;
9818 case 0x10ec0300:
9819 spec->codec_variant = ALC269_TYPE_ALC300;
9820 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
9821 break;
David Brazdil0f672f62019-12-10 10:32:29 +00009822 case 0x10ec0623:
9823 spec->codec_variant = ALC269_TYPE_ALC623;
9824 break;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009825 case 0x10ec0700:
9826 case 0x10ec0701:
9827 case 0x10ec0703:
David Brazdil0f672f62019-12-10 10:32:29 +00009828 case 0x10ec0711:
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009829 spec->codec_variant = ALC269_TYPE_ALC700;
9830 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
9831 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
David Brazdil0f672f62019-12-10 10:32:29 +00009832 spec->init_hook = alc294_init;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009833 break;
9834
9835 }
9836
9837 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
9838 spec->has_alc5505_dsp = 1;
9839 spec->init_hook = alc5505_dsp_init;
9840 }
9841
David Brazdil0f672f62019-12-10 10:32:29 +00009842 alc_pre_init(codec);
9843
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009844 snd_hda_pick_fixup(codec, alc269_fixup_models,
9845 alc269_fixup_tbl, alc269_fixups);
Olivier Deprez0e641232021-09-23 10:07:05 +02009846 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
9847 * the quirk breaks the latter (bko#214101).
9848 * Clear the wrong entry.
9849 */
9850 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
9851 codec->core.vendor_id == 0x10ec0294) {
9852 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
9853 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
9854 }
9855
David Brazdil0f672f62019-12-10 10:32:29 +00009856 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
9857 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009858 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9859 alc269_fixups);
9860 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9861
9862 alc_auto_parse_customize_define(codec);
9863
9864 if (has_cdefine_beep(codec))
9865 spec->gen.beep_nid = 0x01;
9866
9867 /* automatic parse from the BIOS config */
9868 err = alc269_parse_auto_config(codec);
9869 if (err < 0)
9870 goto error;
9871
9872 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9873 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9874 if (err < 0)
9875 goto error;
9876 }
9877
9878 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
9879
9880 return 0;
9881
9882 error:
9883 alc_free(codec);
9884 return err;
9885}
9886
9887/*
9888 * ALC861
9889 */
9890
9891static int alc861_parse_auto_config(struct hda_codec *codec)
9892{
9893 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
9894 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9895 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
9896}
9897
9898/* Pin config fixes */
9899enum {
9900 ALC861_FIXUP_FSC_AMILO_PI1505,
9901 ALC861_FIXUP_AMP_VREF_0F,
9902 ALC861_FIXUP_NO_JACK_DETECT,
9903 ALC861_FIXUP_ASUS_A6RP,
9904 ALC660_FIXUP_ASUS_W7J,
9905};
9906
9907/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9908static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
9909 const struct hda_fixup *fix, int action)
9910{
9911 struct alc_spec *spec = codec->spec;
9912 unsigned int val;
9913
9914 if (action != HDA_FIXUP_ACT_INIT)
9915 return;
9916 val = snd_hda_codec_get_pin_target(codec, 0x0f);
9917 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9918 val |= AC_PINCTL_IN_EN;
9919 val |= AC_PINCTL_VREF_50;
9920 snd_hda_set_pin_ctl(codec, 0x0f, val);
9921 spec->gen.keep_vref_in_automute = 1;
9922}
9923
9924/* suppress the jack-detection */
9925static void alc_fixup_no_jack_detect(struct hda_codec *codec,
9926 const struct hda_fixup *fix, int action)
9927{
9928 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9929 codec->no_jack_detect = 1;
9930}
9931
9932static const struct hda_fixup alc861_fixups[] = {
9933 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
9934 .type = HDA_FIXUP_PINS,
9935 .v.pins = (const struct hda_pintbl[]) {
9936 { 0x0b, 0x0221101f }, /* HP */
9937 { 0x0f, 0x90170310 }, /* speaker */
9938 { }
9939 }
9940 },
9941 [ALC861_FIXUP_AMP_VREF_0F] = {
9942 .type = HDA_FIXUP_FUNC,
9943 .v.func = alc861_fixup_asus_amp_vref_0f,
9944 },
9945 [ALC861_FIXUP_NO_JACK_DETECT] = {
9946 .type = HDA_FIXUP_FUNC,
9947 .v.func = alc_fixup_no_jack_detect,
9948 },
9949 [ALC861_FIXUP_ASUS_A6RP] = {
9950 .type = HDA_FIXUP_FUNC,
9951 .v.func = alc861_fixup_asus_amp_vref_0f,
9952 .chained = true,
9953 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
9954 },
9955 [ALC660_FIXUP_ASUS_W7J] = {
9956 .type = HDA_FIXUP_VERBS,
9957 .v.verbs = (const struct hda_verb[]) {
9958 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9959 * for enabling outputs
9960 */
9961 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9962 { }
9963 },
9964 }
9965};
9966
9967static const struct snd_pci_quirk alc861_fixup_tbl[] = {
9968 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
9969 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
9970 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9971 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9972 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
Olivier Deprez0e641232021-09-23 10:07:05 +02009973 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009974 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
9975 {}
9976};
9977
9978/*
9979 */
9980static int patch_alc861(struct hda_codec *codec)
9981{
9982 struct alc_spec *spec;
9983 int err;
9984
9985 err = alc_alloc_spec(codec, 0x15);
9986 if (err < 0)
9987 return err;
9988
9989 spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +00009990 if (has_cdefine_beep(codec))
9991 spec->gen.beep_nid = 0x23;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009992
9993#ifdef CONFIG_PM
9994 spec->power_hook = alc_power_eapd;
9995#endif
9996
David Brazdil0f672f62019-12-10 10:32:29 +00009997 alc_pre_init(codec);
9998
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009999 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10000 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10001
10002 /* automatic parse from the BIOS config */
10003 err = alc861_parse_auto_config(codec);
10004 if (err < 0)
10005 goto error;
10006
10007 if (!spec->gen.no_analog) {
10008 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10009 if (err < 0)
10010 goto error;
10011 }
10012
10013 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10014
10015 return 0;
10016
10017 error:
10018 alc_free(codec);
10019 return err;
10020}
10021
10022/*
10023 * ALC861-VD support
10024 *
10025 * Based on ALC882
10026 *
10027 * In addition, an independent DAC
10028 */
10029static int alc861vd_parse_auto_config(struct hda_codec *codec)
10030{
10031 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
10032 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10033 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
10034}
10035
10036enum {
10037 ALC660VD_FIX_ASUS_GPIO1,
10038 ALC861VD_FIX_DALLAS,
10039};
10040
10041/* exclude VREF80 */
10042static void alc861vd_fixup_dallas(struct hda_codec *codec,
10043 const struct hda_fixup *fix, int action)
10044{
10045 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10046 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10047 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
10048 }
10049}
10050
10051/* reset GPIO1 */
10052static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10053 const struct hda_fixup *fix, int action)
10054{
10055 struct alc_spec *spec = codec->spec;
10056
10057 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10058 spec->gpio_mask |= 0x02;
10059 alc_fixup_gpio(codec, action, 0x01);
10060}
10061
10062static const struct hda_fixup alc861vd_fixups[] = {
10063 [ALC660VD_FIX_ASUS_GPIO1] = {
10064 .type = HDA_FIXUP_FUNC,
10065 .v.func = alc660vd_fixup_asus_gpio1,
10066 },
10067 [ALC861VD_FIX_DALLAS] = {
10068 .type = HDA_FIXUP_FUNC,
10069 .v.func = alc861vd_fixup_dallas,
10070 },
10071};
10072
10073static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
10074 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
10075 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
10076 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
10077 {}
10078};
10079
10080/*
10081 */
10082static int patch_alc861vd(struct hda_codec *codec)
10083{
10084 struct alc_spec *spec;
10085 int err;
10086
10087 err = alc_alloc_spec(codec, 0x0b);
10088 if (err < 0)
10089 return err;
10090
10091 spec = codec->spec;
David Brazdil0f672f62019-12-10 10:32:29 +000010092 if (has_cdefine_beep(codec))
10093 spec->gen.beep_nid = 0x23;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010094
10095 spec->shutup = alc_eapd_shutup;
10096
David Brazdil0f672f62019-12-10 10:32:29 +000010097 alc_pre_init(codec);
10098
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010099 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10100 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10101
10102 /* automatic parse from the BIOS config */
10103 err = alc861vd_parse_auto_config(codec);
10104 if (err < 0)
10105 goto error;
10106
10107 if (!spec->gen.no_analog) {
10108 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10109 if (err < 0)
10110 goto error;
10111 }
10112
10113 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10114
10115 return 0;
10116
10117 error:
10118 alc_free(codec);
10119 return err;
10120}
10121
10122/*
10123 * ALC662 support
10124 *
10125 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10126 * configuration. Each pin widget can choose any input DACs and a mixer.
10127 * Each ADC is connected from a mixer of all inputs. This makes possible
10128 * 6-channel independent captures.
10129 *
10130 * In addition, an independent DAC for the multi-playback (not used in this
10131 * driver yet).
10132 */
10133
10134/*
10135 * BIOS auto configuration
10136 */
10137
10138static int alc662_parse_auto_config(struct hda_codec *codec)
10139{
10140 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
10141 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10142 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10143 const hda_nid_t *ssids;
10144
10145 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10146 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10147 codec->core.vendor_id == 0x10ec0671)
10148 ssids = alc663_ssids;
10149 else
10150 ssids = alc662_ssids;
10151 return alc_parse_auto_config(codec, alc662_ignore, ssids);
10152}
10153
10154static void alc272_fixup_mario(struct hda_codec *codec,
10155 const struct hda_fixup *fix, int action)
10156{
10157 if (action != HDA_FIXUP_ACT_PRE_PROBE)
10158 return;
10159 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10160 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10161 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10162 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10163 (0 << AC_AMPCAP_MUTE_SHIFT)))
10164 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
10165}
10166
10167static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10168 { .channels = 2,
10169 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10170 { .channels = 4,
10171 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10172 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10173 { }
10174};
10175
10176/* override the 2.1 chmap */
10177static void alc_fixup_bass_chmap(struct hda_codec *codec,
10178 const struct hda_fixup *fix, int action)
10179{
10180 if (action == HDA_FIXUP_ACT_BUILD) {
10181 struct alc_spec *spec = codec->spec;
10182 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
10183 }
10184}
10185
10186/* avoid D3 for keeping GPIO up */
10187static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10188 hda_nid_t nid,
10189 unsigned int power_state)
10190{
10191 struct alc_spec *spec = codec->spec;
10192 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
10193 return AC_PWRST_D0;
10194 return power_state;
10195}
10196
10197static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10198 const struct hda_fixup *fix, int action)
10199{
10200 struct alc_spec *spec = codec->spec;
10201
10202 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
10203 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10204 spec->mute_led_polarity = 1;
10205 codec->power_filter = gpio_led_power_filter;
10206 }
10207}
10208
10209static void alc662_usi_automute_hook(struct hda_codec *codec,
10210 struct hda_jack_callback *jack)
10211{
10212 struct alc_spec *spec = codec->spec;
10213 int vref;
10214 msleep(200);
10215 snd_hda_gen_hp_automute(codec, jack);
10216
10217 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10218 msleep(100);
10219 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10220 vref);
10221}
10222
10223static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10224 const struct hda_fixup *fix, int action)
10225{
10226 struct alc_spec *spec = codec->spec;
10227 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10228 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10229 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10230 }
10231}
10232
David Brazdil0f672f62019-12-10 10:32:29 +000010233static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10234 struct hda_jack_callback *cb)
10235{
10236 /* surround speakers at 0x1b already get muted automatically when
10237 * headphones are plugged in, but we have to mute/unmute the remaining
10238 * channels manually:
10239 * 0x15 - front left/front right
10240 * 0x18 - front center/ LFE
10241 */
10242 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10243 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10244 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10245 } else {
10246 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10247 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10248 }
10249}
10250
10251static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10252 const struct hda_fixup *fix, int action)
10253{
10254 /* Pin 0x1b: shared headphones jack and surround speakers */
10255 if (!is_jack_detectable(codec, 0x1b))
10256 return;
10257
10258 switch (action) {
10259 case HDA_FIXUP_ACT_PRE_PROBE:
10260 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10261 alc662_aspire_ethos_mute_speakers);
Olivier Deprez0e641232021-09-23 10:07:05 +020010262 /* subwoofer needs an extra GPIO setting to become audible */
10263 alc_setup_gpio(codec, 0x02);
David Brazdil0f672f62019-12-10 10:32:29 +000010264 break;
10265 case HDA_FIXUP_ACT_INIT:
10266 /* Make sure to start in a correct state, i.e. if
10267 * headphones have been plugged in before powering up the system
10268 */
10269 alc662_aspire_ethos_mute_speakers(codec, NULL);
10270 break;
10271 }
10272}
10273
Olivier Deprez0e641232021-09-23 10:07:05 +020010274static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10275 const struct hda_fixup *fix, int action)
10276{
10277 struct alc_spec *spec = codec->spec;
10278
10279 static const struct hda_pintbl pincfgs[] = {
10280 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10281 { 0x1b, 0x0181304f },
10282 { }
10283 };
10284
10285 switch (action) {
10286 case HDA_FIXUP_ACT_PRE_PROBE:
10287 spec->gen.mixer_nid = 0;
10288 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10289 snd_hda_apply_pincfgs(codec, pincfgs);
10290 break;
10291 case HDA_FIXUP_ACT_INIT:
10292 alc_write_coef_idx(codec, 0x19, 0xa054);
10293 break;
10294 }
10295}
10296
Olivier Deprez157378f2022-04-04 15:47:50 +020010297static void alc897_hp_automute_hook(struct hda_codec *codec,
10298 struct hda_jack_callback *jack)
10299{
10300 struct alc_spec *spec = codec->spec;
10301 int vref;
10302
10303 snd_hda_gen_hp_automute(codec, jack);
10304 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10305 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10306 vref);
10307}
10308
10309static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10310 const struct hda_fixup *fix, int action)
10311{
10312 struct alc_spec *spec = codec->spec;
10313 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10314 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10315 }
10316}
10317
Olivier Deprez0e641232021-09-23 10:07:05 +020010318static const struct coef_fw alc668_coefs[] = {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010319 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10320 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10321 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10322 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10323 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10324 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10325 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10326 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10327 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10328 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10329 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10330 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10331 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10332 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10333 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10334 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10335 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10336 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10337 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10338 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10339 {}
10340};
10341
10342static void alc668_restore_default_value(struct hda_codec *codec)
10343{
10344 alc_process_coef_fw(codec, alc668_coefs);
10345}
10346
10347enum {
10348 ALC662_FIXUP_ASPIRE,
10349 ALC662_FIXUP_LED_GPIO1,
10350 ALC662_FIXUP_IDEAPAD,
10351 ALC272_FIXUP_MARIO,
Olivier Deprez0e641232021-09-23 10:07:05 +020010352 ALC662_FIXUP_CZC_ET26,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010353 ALC662_FIXUP_CZC_P10T,
10354 ALC662_FIXUP_SKU_IGNORE,
10355 ALC662_FIXUP_HP_RP5800,
10356 ALC662_FIXUP_ASUS_MODE1,
10357 ALC662_FIXUP_ASUS_MODE2,
10358 ALC662_FIXUP_ASUS_MODE3,
10359 ALC662_FIXUP_ASUS_MODE4,
10360 ALC662_FIXUP_ASUS_MODE5,
10361 ALC662_FIXUP_ASUS_MODE6,
10362 ALC662_FIXUP_ASUS_MODE7,
10363 ALC662_FIXUP_ASUS_MODE8,
10364 ALC662_FIXUP_NO_JACK_DETECT,
10365 ALC662_FIXUP_ZOTAC_Z68,
10366 ALC662_FIXUP_INV_DMIC,
10367 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
10368 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
10369 ALC662_FIXUP_HEADSET_MODE,
10370 ALC668_FIXUP_HEADSET_MODE,
10371 ALC662_FIXUP_BASS_MODE4_CHMAP,
10372 ALC662_FIXUP_BASS_16,
10373 ALC662_FIXUP_BASS_1A,
10374 ALC662_FIXUP_BASS_CHMAP,
10375 ALC668_FIXUP_AUTO_MUTE,
10376 ALC668_FIXUP_DELL_DISABLE_AAMIX,
10377 ALC668_FIXUP_DELL_XPS13,
10378 ALC662_FIXUP_ASUS_Nx50,
10379 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
10380 ALC668_FIXUP_ASUS_Nx51,
10381 ALC668_FIXUP_MIC_COEF,
10382 ALC668_FIXUP_ASUS_G751,
10383 ALC891_FIXUP_HEADSET_MODE,
10384 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10385 ALC662_FIXUP_ACER_VERITON,
10386 ALC892_FIXUP_ASROCK_MOBO,
10387 ALC662_FIXUP_USI_FUNC,
10388 ALC662_FIXUP_USI_HEADSET_MODE,
10389 ALC662_FIXUP_LENOVO_MULTI_CODECS,
David Brazdil0f672f62019-12-10 10:32:29 +000010390 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
David Brazdil0f672f62019-12-10 10:32:29 +000010391 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Olivier Deprez0e641232021-09-23 10:07:05 +020010392 ALC671_FIXUP_HP_HEADSET_MIC2,
10393 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
10394 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
Olivier Deprez157378f2022-04-04 15:47:50 +020010395 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10396 ALC668_FIXUP_HEADSET_MIC,
10397 ALC668_FIXUP_MIC_DET_COEF,
10398 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10399 ALC897_FIXUP_HEADSET_MIC_PIN,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010400};
10401
10402static const struct hda_fixup alc662_fixups[] = {
10403 [ALC662_FIXUP_ASPIRE] = {
10404 .type = HDA_FIXUP_PINS,
10405 .v.pins = (const struct hda_pintbl[]) {
10406 { 0x15, 0x99130112 }, /* subwoofer */
10407 { }
10408 }
10409 },
10410 [ALC662_FIXUP_LED_GPIO1] = {
10411 .type = HDA_FIXUP_FUNC,
10412 .v.func = alc662_fixup_led_gpio1,
10413 },
10414 [ALC662_FIXUP_IDEAPAD] = {
10415 .type = HDA_FIXUP_PINS,
10416 .v.pins = (const struct hda_pintbl[]) {
10417 { 0x17, 0x99130112 }, /* subwoofer */
10418 { }
10419 },
10420 .chained = true,
10421 .chain_id = ALC662_FIXUP_LED_GPIO1,
10422 },
10423 [ALC272_FIXUP_MARIO] = {
10424 .type = HDA_FIXUP_FUNC,
10425 .v.func = alc272_fixup_mario,
10426 },
Olivier Deprez0e641232021-09-23 10:07:05 +020010427 [ALC662_FIXUP_CZC_ET26] = {
10428 .type = HDA_FIXUP_PINS,
10429 .v.pins = (const struct hda_pintbl[]) {
10430 {0x12, 0x403cc000},
10431 {0x14, 0x90170110}, /* speaker */
10432 {0x15, 0x411111f0},
10433 {0x16, 0x411111f0},
10434 {0x18, 0x01a19030}, /* mic */
10435 {0x19, 0x90a7013f}, /* int-mic */
10436 {0x1a, 0x01014020},
10437 {0x1b, 0x0121401f},
10438 {0x1c, 0x411111f0},
10439 {0x1d, 0x411111f0},
10440 {0x1e, 0x40478e35},
10441 {}
10442 },
10443 .chained = true,
10444 .chain_id = ALC662_FIXUP_SKU_IGNORE
10445 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010446 [ALC662_FIXUP_CZC_P10T] = {
10447 .type = HDA_FIXUP_VERBS,
10448 .v.verbs = (const struct hda_verb[]) {
10449 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10450 {}
10451 }
10452 },
10453 [ALC662_FIXUP_SKU_IGNORE] = {
10454 .type = HDA_FIXUP_FUNC,
10455 .v.func = alc_fixup_sku_ignore,
10456 },
10457 [ALC662_FIXUP_HP_RP5800] = {
10458 .type = HDA_FIXUP_PINS,
10459 .v.pins = (const struct hda_pintbl[]) {
10460 { 0x14, 0x0221201f }, /* HP out */
10461 { }
10462 },
10463 .chained = true,
10464 .chain_id = ALC662_FIXUP_SKU_IGNORE
10465 },
10466 [ALC662_FIXUP_ASUS_MODE1] = {
10467 .type = HDA_FIXUP_PINS,
10468 .v.pins = (const struct hda_pintbl[]) {
10469 { 0x14, 0x99130110 }, /* speaker */
10470 { 0x18, 0x01a19c20 }, /* mic */
10471 { 0x19, 0x99a3092f }, /* int-mic */
10472 { 0x21, 0x0121401f }, /* HP out */
10473 { }
10474 },
10475 .chained = true,
10476 .chain_id = ALC662_FIXUP_SKU_IGNORE
10477 },
10478 [ALC662_FIXUP_ASUS_MODE2] = {
10479 .type = HDA_FIXUP_PINS,
10480 .v.pins = (const struct hda_pintbl[]) {
10481 { 0x14, 0x99130110 }, /* speaker */
10482 { 0x18, 0x01a19820 }, /* mic */
10483 { 0x19, 0x99a3092f }, /* int-mic */
10484 { 0x1b, 0x0121401f }, /* HP out */
10485 { }
10486 },
10487 .chained = true,
10488 .chain_id = ALC662_FIXUP_SKU_IGNORE
10489 },
10490 [ALC662_FIXUP_ASUS_MODE3] = {
10491 .type = HDA_FIXUP_PINS,
10492 .v.pins = (const struct hda_pintbl[]) {
10493 { 0x14, 0x99130110 }, /* speaker */
10494 { 0x15, 0x0121441f }, /* HP */
10495 { 0x18, 0x01a19840 }, /* mic */
10496 { 0x19, 0x99a3094f }, /* int-mic */
10497 { 0x21, 0x01211420 }, /* HP2 */
10498 { }
10499 },
10500 .chained = true,
10501 .chain_id = ALC662_FIXUP_SKU_IGNORE
10502 },
10503 [ALC662_FIXUP_ASUS_MODE4] = {
10504 .type = HDA_FIXUP_PINS,
10505 .v.pins = (const struct hda_pintbl[]) {
10506 { 0x14, 0x99130110 }, /* speaker */
10507 { 0x16, 0x99130111 }, /* speaker */
10508 { 0x18, 0x01a19840 }, /* mic */
10509 { 0x19, 0x99a3094f }, /* int-mic */
10510 { 0x21, 0x0121441f }, /* HP */
10511 { }
10512 },
10513 .chained = true,
10514 .chain_id = ALC662_FIXUP_SKU_IGNORE
10515 },
10516 [ALC662_FIXUP_ASUS_MODE5] = {
10517 .type = HDA_FIXUP_PINS,
10518 .v.pins = (const struct hda_pintbl[]) {
10519 { 0x14, 0x99130110 }, /* speaker */
10520 { 0x15, 0x0121441f }, /* HP */
10521 { 0x16, 0x99130111 }, /* speaker */
10522 { 0x18, 0x01a19840 }, /* mic */
10523 { 0x19, 0x99a3094f }, /* int-mic */
10524 { }
10525 },
10526 .chained = true,
10527 .chain_id = ALC662_FIXUP_SKU_IGNORE
10528 },
10529 [ALC662_FIXUP_ASUS_MODE6] = {
10530 .type = HDA_FIXUP_PINS,
10531 .v.pins = (const struct hda_pintbl[]) {
10532 { 0x14, 0x99130110 }, /* speaker */
10533 { 0x15, 0x01211420 }, /* HP2 */
10534 { 0x18, 0x01a19840 }, /* mic */
10535 { 0x19, 0x99a3094f }, /* int-mic */
10536 { 0x1b, 0x0121441f }, /* HP */
10537 { }
10538 },
10539 .chained = true,
10540 .chain_id = ALC662_FIXUP_SKU_IGNORE
10541 },
10542 [ALC662_FIXUP_ASUS_MODE7] = {
10543 .type = HDA_FIXUP_PINS,
10544 .v.pins = (const struct hda_pintbl[]) {
10545 { 0x14, 0x99130110 }, /* speaker */
10546 { 0x17, 0x99130111 }, /* speaker */
10547 { 0x18, 0x01a19840 }, /* mic */
10548 { 0x19, 0x99a3094f }, /* int-mic */
10549 { 0x1b, 0x01214020 }, /* HP */
10550 { 0x21, 0x0121401f }, /* HP */
10551 { }
10552 },
10553 .chained = true,
10554 .chain_id = ALC662_FIXUP_SKU_IGNORE
10555 },
10556 [ALC662_FIXUP_ASUS_MODE8] = {
10557 .type = HDA_FIXUP_PINS,
10558 .v.pins = (const struct hda_pintbl[]) {
10559 { 0x14, 0x99130110 }, /* speaker */
10560 { 0x12, 0x99a30970 }, /* int-mic */
10561 { 0x15, 0x01214020 }, /* HP */
10562 { 0x17, 0x99130111 }, /* speaker */
10563 { 0x18, 0x01a19840 }, /* mic */
10564 { 0x21, 0x0121401f }, /* HP */
10565 { }
10566 },
10567 .chained = true,
10568 .chain_id = ALC662_FIXUP_SKU_IGNORE
10569 },
10570 [ALC662_FIXUP_NO_JACK_DETECT] = {
10571 .type = HDA_FIXUP_FUNC,
10572 .v.func = alc_fixup_no_jack_detect,
10573 },
10574 [ALC662_FIXUP_ZOTAC_Z68] = {
10575 .type = HDA_FIXUP_PINS,
10576 .v.pins = (const struct hda_pintbl[]) {
10577 { 0x1b, 0x02214020 }, /* Front HP */
10578 { }
10579 }
10580 },
10581 [ALC662_FIXUP_INV_DMIC] = {
10582 .type = HDA_FIXUP_FUNC,
10583 .v.func = alc_fixup_inv_dmic,
10584 },
10585 [ALC668_FIXUP_DELL_XPS13] = {
10586 .type = HDA_FIXUP_FUNC,
10587 .v.func = alc_fixup_dell_xps13,
10588 .chained = true,
10589 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10590 },
10591 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10592 .type = HDA_FIXUP_FUNC,
10593 .v.func = alc_fixup_disable_aamix,
10594 .chained = true,
10595 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10596 },
10597 [ALC668_FIXUP_AUTO_MUTE] = {
10598 .type = HDA_FIXUP_FUNC,
10599 .v.func = alc_fixup_auto_mute_via_amp,
10600 .chained = true,
10601 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10602 },
10603 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10604 .type = HDA_FIXUP_PINS,
10605 .v.pins = (const struct hda_pintbl[]) {
10606 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10607 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10608 { }
10609 },
10610 .chained = true,
10611 .chain_id = ALC662_FIXUP_HEADSET_MODE
10612 },
10613 [ALC662_FIXUP_HEADSET_MODE] = {
10614 .type = HDA_FIXUP_FUNC,
10615 .v.func = alc_fixup_headset_mode_alc662,
10616 },
10617 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10618 .type = HDA_FIXUP_PINS,
10619 .v.pins = (const struct hda_pintbl[]) {
10620 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10621 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10622 { }
10623 },
10624 .chained = true,
10625 .chain_id = ALC668_FIXUP_HEADSET_MODE
10626 },
10627 [ALC668_FIXUP_HEADSET_MODE] = {
10628 .type = HDA_FIXUP_FUNC,
10629 .v.func = alc_fixup_headset_mode_alc668,
10630 },
10631 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
10632 .type = HDA_FIXUP_FUNC,
10633 .v.func = alc_fixup_bass_chmap,
10634 .chained = true,
10635 .chain_id = ALC662_FIXUP_ASUS_MODE4
10636 },
10637 [ALC662_FIXUP_BASS_16] = {
10638 .type = HDA_FIXUP_PINS,
10639 .v.pins = (const struct hda_pintbl[]) {
10640 {0x16, 0x80106111}, /* bass speaker */
10641 {}
10642 },
10643 .chained = true,
10644 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10645 },
10646 [ALC662_FIXUP_BASS_1A] = {
10647 .type = HDA_FIXUP_PINS,
10648 .v.pins = (const struct hda_pintbl[]) {
10649 {0x1a, 0x80106111}, /* bass speaker */
10650 {}
10651 },
10652 .chained = true,
10653 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10654 },
10655 [ALC662_FIXUP_BASS_CHMAP] = {
10656 .type = HDA_FIXUP_FUNC,
10657 .v.func = alc_fixup_bass_chmap,
10658 },
10659 [ALC662_FIXUP_ASUS_Nx50] = {
10660 .type = HDA_FIXUP_FUNC,
10661 .v.func = alc_fixup_auto_mute_via_amp,
10662 .chained = true,
10663 .chain_id = ALC662_FIXUP_BASS_1A
10664 },
10665 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10666 .type = HDA_FIXUP_FUNC,
10667 .v.func = alc_fixup_headset_mode_alc668,
10668 .chain_id = ALC662_FIXUP_BASS_CHMAP
10669 },
10670 [ALC668_FIXUP_ASUS_Nx51] = {
10671 .type = HDA_FIXUP_PINS,
10672 .v.pins = (const struct hda_pintbl[]) {
10673 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10674 { 0x1a, 0x90170151 }, /* bass speaker */
10675 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10676 {}
10677 },
10678 .chained = true,
10679 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
10680 },
10681 [ALC668_FIXUP_MIC_COEF] = {
10682 .type = HDA_FIXUP_VERBS,
10683 .v.verbs = (const struct hda_verb[]) {
10684 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10685 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10686 {}
10687 },
10688 },
10689 [ALC668_FIXUP_ASUS_G751] = {
10690 .type = HDA_FIXUP_PINS,
10691 .v.pins = (const struct hda_pintbl[]) {
10692 { 0x16, 0x0421101f }, /* HP */
10693 {}
10694 },
10695 .chained = true,
10696 .chain_id = ALC668_FIXUP_MIC_COEF
10697 },
10698 [ALC891_FIXUP_HEADSET_MODE] = {
10699 .type = HDA_FIXUP_FUNC,
10700 .v.func = alc_fixup_headset_mode,
10701 },
10702 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10703 .type = HDA_FIXUP_PINS,
10704 .v.pins = (const struct hda_pintbl[]) {
10705 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10706 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10707 { }
10708 },
10709 .chained = true,
10710 .chain_id = ALC891_FIXUP_HEADSET_MODE
10711 },
10712 [ALC662_FIXUP_ACER_VERITON] = {
10713 .type = HDA_FIXUP_PINS,
10714 .v.pins = (const struct hda_pintbl[]) {
10715 { 0x15, 0x50170120 }, /* no internal speaker */
10716 { }
10717 }
10718 },
10719 [ALC892_FIXUP_ASROCK_MOBO] = {
10720 .type = HDA_FIXUP_PINS,
10721 .v.pins = (const struct hda_pintbl[]) {
10722 { 0x15, 0x40f000f0 }, /* disabled */
10723 { 0x16, 0x40f000f0 }, /* disabled */
10724 { }
10725 }
10726 },
10727 [ALC662_FIXUP_USI_FUNC] = {
10728 .type = HDA_FIXUP_FUNC,
10729 .v.func = alc662_fixup_usi_headset_mic,
10730 },
10731 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10732 .type = HDA_FIXUP_PINS,
10733 .v.pins = (const struct hda_pintbl[]) {
10734 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10735 { 0x18, 0x01a1903d },
10736 { }
10737 },
10738 .chained = true,
10739 .chain_id = ALC662_FIXUP_USI_FUNC
10740 },
10741 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10742 .type = HDA_FIXUP_FUNC,
10743 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10744 },
David Brazdil0f672f62019-12-10 10:32:29 +000010745 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10746 .type = HDA_FIXUP_FUNC,
10747 .v.func = alc662_fixup_aspire_ethos_hp,
10748 },
David Brazdil0f672f62019-12-10 10:32:29 +000010749 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10750 .type = HDA_FIXUP_PINS,
10751 .v.pins = (const struct hda_pintbl[]) {
10752 { 0x15, 0x92130110 }, /* front speakers */
10753 { 0x18, 0x99130111 }, /* center/subwoofer */
10754 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10755 { }
10756 },
10757 .chained = true,
Olivier Deprez0e641232021-09-23 10:07:05 +020010758 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
10759 },
10760 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10761 .type = HDA_FIXUP_FUNC,
10762 .v.func = alc671_fixup_hp_headset_mic2,
10763 },
10764 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10765 .type = HDA_FIXUP_PINS,
10766 .v.pins = (const struct hda_pintbl[]) {
10767 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10768 { }
10769 },
10770 .chained = true,
10771 .chain_id = ALC662_FIXUP_USI_FUNC
10772 },
10773 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10774 .type = HDA_FIXUP_PINS,
10775 .v.pins = (const struct hda_pintbl[]) {
10776 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10777 { 0x1b, 0x0221144f },
10778 { }
10779 },
10780 .chained = true,
10781 .chain_id = ALC662_FIXUP_USI_FUNC
David Brazdil0f672f62019-12-10 10:32:29 +000010782 },
Olivier Deprez157378f2022-04-04 15:47:50 +020010783 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
10784 .type = HDA_FIXUP_PINS,
10785 .v.pins = (const struct hda_pintbl[]) {
10786 { 0x1b, 0x04a1112c },
10787 { }
10788 },
10789 .chained = true,
10790 .chain_id = ALC668_FIXUP_HEADSET_MIC
10791 },
10792 [ALC668_FIXUP_HEADSET_MIC] = {
10793 .type = HDA_FIXUP_FUNC,
10794 .v.func = alc269_fixup_headset_mic,
10795 .chained = true,
10796 .chain_id = ALC668_FIXUP_MIC_DET_COEF
10797 },
10798 [ALC668_FIXUP_MIC_DET_COEF] = {
10799 .type = HDA_FIXUP_VERBS,
10800 .v.verbs = (const struct hda_verb[]) {
10801 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
10802 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
10803 {}
10804 },
10805 },
10806 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
10807 .type = HDA_FIXUP_FUNC,
10808 .v.func = alc897_fixup_lenovo_headset_mic,
10809 },
10810 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
10811 .type = HDA_FIXUP_PINS,
10812 .v.pins = (const struct hda_pintbl[]) {
10813 { 0x1a, 0x03a11050 },
10814 { }
10815 },
10816 .chained = true,
10817 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
10818 },
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010819};
10820
10821static const struct snd_pci_quirk alc662_fixup_tbl[] = {
10822 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
10823 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
10824 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
10825 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
10826 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
10827 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
10828 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
10829 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Olivier Deprez0e641232021-09-23 10:07:05 +020010830 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
10831 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
10832 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010833 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10834 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10835 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
10836 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
10837 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
10838 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10839 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10840 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10841 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10842 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10843 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Olivier Deprez0e641232021-09-23 10:07:05 +020010844 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Olivier Deprez157378f2022-04-04 15:47:50 +020010845 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010846 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
10847 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010848 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
10849 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
Olivier Deprez0e641232021-09-23 10:07:05 +020010850 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010851 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
10852 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
10853 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10854 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Olivier Deprez157378f2022-04-04 15:47:50 +020010855 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010856 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
10857 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
10858 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
10859 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
10860 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
10861 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
10862 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
10863 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Olivier Deprez157378f2022-04-04 15:47:50 +020010864 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
10865 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
10866 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
10867 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010868 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
10869 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
10870 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
10871 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
10872 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Olivier Deprez0e641232021-09-23 10:07:05 +020010873 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010874 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
10875
10876#if 0
10877 /* Below is a quirk table taken from the old code.
10878 * Basically the device should work as is without the fixup table.
10879 * If BIOS doesn't give a proper info, enable the corresponding
10880 * fixup entry.
10881 */
10882 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10883 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10884 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10885 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10886 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10887 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10888 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10889 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10890 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10891 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10892 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10893 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10894 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10895 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10896 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10897 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10898 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10899 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10900 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10901 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10902 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10903 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10904 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10905 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10906 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10907 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10908 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10909 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10910 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10911 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10912 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10913 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10914 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10915 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10916 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10917 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10918 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10919 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10920 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10921 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10922 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10923 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10924 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10925 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10926 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10927 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10928 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10929 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10930 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10931 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10932#endif
10933 {}
10934};
10935
10936static const struct hda_model_fixup alc662_fixup_models[] = {
10937 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10938 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
10939 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
10940 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
10941 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10942 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10943 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10944 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10945 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10946 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10947 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10948 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
10949 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
10950 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
10951 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
10952 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10953 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10954 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10955 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10956 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10957 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10958 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10959 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10960 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
David Brazdil0f672f62019-12-10 10:32:29 +000010961 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010962 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10963 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10964 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10965 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10966 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
10967 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
David Brazdil0f672f62019-12-10 10:32:29 +000010968 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010969 {}
10970};
10971
10972static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
10973 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10974 {0x17, 0x02211010},
10975 {0x18, 0x01a19030},
10976 {0x1a, 0x01813040},
10977 {0x21, 0x01014020}),
David Brazdil0f672f62019-12-10 10:32:29 +000010978 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10979 {0x16, 0x01813030},
10980 {0x17, 0x02211010},
10981 {0x18, 0x01a19040},
10982 {0x21, 0x01014020}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010983 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
10984 {0x14, 0x01014010},
10985 {0x18, 0x01a19020},
10986 {0x1a, 0x0181302f},
10987 {0x1b, 0x0221401f}),
10988 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10989 {0x12, 0x99a30130},
10990 {0x14, 0x90170110},
10991 {0x15, 0x0321101f},
10992 {0x16, 0x03011020}),
10993 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10994 {0x12, 0x99a30140},
10995 {0x14, 0x90170110},
10996 {0x15, 0x0321101f},
10997 {0x16, 0x03011020}),
10998 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10999 {0x12, 0x99a30150},
11000 {0x14, 0x90170110},
11001 {0x15, 0x0321101f},
11002 {0x16, 0x03011020}),
11003 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11004 {0x14, 0x90170110},
11005 {0x15, 0x0321101f},
11006 {0x16, 0x03011020}),
11007 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11008 {0x12, 0x90a60130},
11009 {0x14, 0x90170110},
11010 {0x15, 0x0321101f}),
Olivier Deprez0e641232021-09-23 10:07:05 +020011011 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11012 {0x14, 0x01014010},
11013 {0x17, 0x90170150},
11014 {0x19, 0x02a11060},
11015 {0x1b, 0x01813030},
11016 {0x21, 0x02211020}),
11017 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11018 {0x14, 0x01014010},
11019 {0x18, 0x01a19040},
11020 {0x1b, 0x01813030},
11021 {0x21, 0x02211020}),
11022 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11023 {0x14, 0x01014020},
11024 {0x17, 0x90170110},
11025 {0x18, 0x01a19050},
11026 {0x1b, 0x01813040},
11027 {0x21, 0x02211030}),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011028 {}
11029};
11030
11031/*
11032 */
11033static int patch_alc662(struct hda_codec *codec)
11034{
11035 struct alc_spec *spec;
11036 int err;
11037
11038 err = alc_alloc_spec(codec, 0x0b);
11039 if (err < 0)
11040 return err;
11041
11042 spec = codec->spec;
11043
11044 spec->shutup = alc_eapd_shutup;
11045
11046 /* handle multiple HPs as is */
11047 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11048
11049 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11050
11051 switch (codec->core.vendor_id) {
11052 case 0x10ec0668:
11053 spec->init_hook = alc668_restore_default_value;
11054 break;
11055 }
11056
David Brazdil0f672f62019-12-10 10:32:29 +000011057 alc_pre_init(codec);
11058
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011059 snd_hda_pick_fixup(codec, alc662_fixup_models,
11060 alc662_fixup_tbl, alc662_fixups);
David Brazdil0f672f62019-12-10 10:32:29 +000011061 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011062 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11063
11064 alc_auto_parse_customize_define(codec);
11065
11066 if (has_cdefine_beep(codec))
11067 spec->gen.beep_nid = 0x01;
11068
11069 if ((alc_get_coef0(codec) & (1 << 14)) &&
11070 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
11071 spec->cdefine.platform_type == 1) {
11072 err = alc_codec_rename(codec, "ALC272X");
11073 if (err < 0)
11074 goto error;
11075 }
11076
11077 /* automatic parse from the BIOS config */
11078 err = alc662_parse_auto_config(codec);
11079 if (err < 0)
11080 goto error;
11081
11082 if (!spec->gen.no_analog && spec->gen.beep_nid) {
11083 switch (codec->core.vendor_id) {
11084 case 0x10ec0662:
11085 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11086 break;
11087 case 0x10ec0272:
11088 case 0x10ec0663:
11089 case 0x10ec0665:
11090 case 0x10ec0668:
11091 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
11092 break;
11093 case 0x10ec0273:
11094 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
11095 break;
11096 }
11097 if (err < 0)
11098 goto error;
11099 }
11100
11101 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11102
11103 return 0;
11104
11105 error:
11106 alc_free(codec);
11107 return err;
11108}
11109
11110/*
11111 * ALC680 support
11112 */
11113
11114static int alc680_parse_auto_config(struct hda_codec *codec)
11115{
11116 return alc_parse_auto_config(codec, NULL, NULL);
11117}
11118
11119/*
11120 */
11121static int patch_alc680(struct hda_codec *codec)
11122{
11123 int err;
11124
11125 /* ALC680 has no aa-loopback mixer */
11126 err = alc_alloc_spec(codec, 0);
11127 if (err < 0)
11128 return err;
11129
11130 /* automatic parse from the BIOS config */
11131 err = alc680_parse_auto_config(codec);
11132 if (err < 0) {
11133 alc_free(codec);
11134 return err;
11135 }
11136
11137 return 0;
11138}
11139
11140/*
11141 * patch entries
11142 */
11143static const struct hda_device_id snd_hda_id_realtek[] = {
11144 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
11145 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
David Brazdil0f672f62019-12-10 10:32:29 +000011146 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011147 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Olivier Deprez0e641232021-09-23 10:07:05 +020011148 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011149 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11150 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
11151 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
11152 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
11153 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Olivier Deprez0e641232021-09-23 10:07:05 +020011154 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011155 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11156 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
11157 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
11158 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11159 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11160 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11161 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11162 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11163 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11164 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
11165 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
11166 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11167 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11168 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11169 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11170 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11171 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
11172 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
11173 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Olivier Deprez0e641232021-09-23 10:07:05 +020011174 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011175 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
11176 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
11177 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11178 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11179 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
11180 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
11181 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
11182 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
11183 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
11184 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
David Brazdil0f672f62019-12-10 10:32:29 +000011185 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011186 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11187 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11188 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11189 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11190 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11191 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11192 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11193 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11194 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11195 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11196 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11197 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11198 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11199 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
11200 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11201 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11202 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
David Brazdil0f672f62019-12-10 10:32:29 +000011203 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011204 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
11205 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11206 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11207 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11208 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11209 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11210 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11211 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11212 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11213 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11214 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11215 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
Olivier Deprez0e641232021-09-23 10:07:05 +020011216 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011217 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11218 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Olivier Deprez0e641232021-09-23 10:07:05 +020011219 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011220 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
11221 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
11222 {} /* terminator */
11223};
11224MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
11225
11226MODULE_LICENSE("GPL");
11227MODULE_DESCRIPTION("Realtek HD-audio codec");
11228
11229static struct hda_codec_driver realtek_driver = {
11230 .id = snd_hda_id_realtek,
11231};
11232
11233module_hda_codec_driver(realtek_driver);