blob: e59ff75eea75191c1d189b89dd68871d7f8f72ad [file] [log] [blame]
Thomas Gleixnerd0fa1172019-05-20 19:07:57 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
Takashi Iwai1d045db2011-07-07 18:23:21 +02005 * HD audio interface patch for Realtek ALC codecs
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
Kailang Yangdf694da2005-12-05 19:42:22 +01007 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * Takashi Iwai <tiwai@suse.de>
Jonathan Woithe409a3e92012-03-27 13:01:01 +103010 * Jonathan Woithe <jwoithe@just42.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
Takashi Iwai08fb0d02013-01-10 17:33:58 +010017#include <linux/dmi.h>
Paul Gortmakerda155d52011-07-15 12:38:28 -040018#include <linux/module.h>
David Henningsson33f4acd2015-01-07 15:50:13 +010019#include <linux/input.h>
Kai-Heng Feng87dc3642020-04-30 21:52:07 +080020#include <linux/leds.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <sound/core.h>
Kailang Yang9ad0e492010-09-14 23:22:00 +020022#include <sound/jack.h>
Pierre-Louis Bossartbe57bff2018-08-22 15:24:57 -050023#include <sound/hda_codec.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include "hda_local.h"
Takashi Iwai23d30f22012-05-07 17:17:32 +020025#include "hda_auto_parser.h"
Takashi Iwai1835a0f2011-10-27 22:12:46 +020026#include "hda_jack.h"
Takashi Iwai08c189f2012-12-19 15:22:24 +010027#include "hda_generic.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Takashi Iwaicd63a5f2013-07-05 12:13:59 +020029/* keep halting ALC5505 DSP, for power saving */
30#define HALT_REALTEK_ALC5505
31
Takashi Iwai4a79ba32009-04-22 16:31:35 +020032/* extra amp-initialization sequence types */
33enum {
Takashi Iwai1c76aa52018-06-21 16:37:54 +020034 ALC_INIT_UNDEFINED,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020035 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020037};
38
David Henningsson73bdd592013-04-15 15:44:14 +020039enum {
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
Hui Wangc7b60a82015-12-28 11:35:25 +080053enum {
54 ALC_KEY_MICMUTE_INDEX,
55};
56
Kailang Yangda00c242010-03-19 11:23:45 +010057struct 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;
David Henningsson90622912010-10-14 14:50:18 +020067 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010068};
69
Takashi Iwai766538a2020-06-18 13:08:41 +020070struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75};
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010078 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020079
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 /* codec parameterization */
Kailang Yangda00c242010-03-19 11:23:45 +010081 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010082 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
83
Takashi Iwai5579cd62018-06-19 22:22:41 +020084 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
Takashi Iwai215c8502018-06-19 22:34:26 +020088 bool gpio_write_delay; /* add a delay before writing gpio_data */
Takashi Iwai5579cd62018-06-19 22:22:41 +020089
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +020090 /* mute LED for HP laptops, see vref_mute_led_set() */
Takashi Iwai08fb0d02013-01-10 17:33:58 +010091 int mute_led_polarity;
Kai-Heng Fengdbd13172020-04-30 16:32:51 +080092 int micmute_led_polarity;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010093 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +080094 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010095
Takashi Iwai0f32fd192014-11-19 12:16:14 +010096 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
Takashi Iwai766538a2020-06-18 13:08:41 +020098 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100100
David Henningsson73bdd592013-04-15 15:44:14 +0200101 hda_nid_t headset_mic_pin;
102 hda_nid_t headphone_mic_pin;
103 int current_headset_mode;
104 int current_headset_type;
105
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100106 /* hooks */
107 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200108#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500109 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100110#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200111 void (*shutup)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200112
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200113 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200114 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500115 unsigned int has_alc5505_dsp:1;
116 unsigned int no_depop_delay:1;
Kailang Yang693abe12019-01-29 15:38:21 +0800117 unsigned int done_hp_init:1;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100118 unsigned int no_shutup_pins:1;
Kailang Yangd3ba58b2019-05-06 15:09:42 +0800119 unsigned int ultra_low_power:1;
Hui Wang476c02e2020-03-29 16:20:18 +0800120 unsigned int has_hs_key:1;
Kailang Yang92666d42020-11-19 17:04:21 +0800121 unsigned int no_internal_mic_pin:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100122
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200123 /* for PLL fix */
124 hda_nid_t pll_nid;
125 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200126 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100127 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800128 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100129};
130
Takashi Iwai23f0c042009-02-26 13:03:58 +0100131/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200132 * COEF access helper functions
133 */
134
135static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
136 unsigned int coef_idx)
137{
138 unsigned int val;
139
140 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
141 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
142 return val;
143}
144
145#define alc_read_coef_idx(codec, coef_idx) \
146 alc_read_coefex_idx(codec, 0x20, coef_idx)
147
148static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
149 unsigned int coef_idx, unsigned int coef_val)
150{
151 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
153}
154
155#define alc_write_coef_idx(codec, coef_idx, coef_val) \
156 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
157
Takashi Iwai98b24882014-08-18 13:47:50 +0200158static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
159 unsigned int coef_idx, unsigned int mask,
160 unsigned int bits_set)
161{
162 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
163
164 if (val != -1)
165 alc_write_coefex_idx(codec, nid, coef_idx,
166 (val & ~mask) | bits_set);
167}
168
169#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
170 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
171
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200172/* a special bypass for COEF 0; read the cached value at the second time */
173static unsigned int alc_get_coef0(struct hda_codec *codec)
174{
175 struct alc_spec *spec = codec->spec;
176
177 if (!spec->coef0)
178 spec->coef0 = alc_read_coef_idx(codec, 0);
179 return spec->coef0;
180}
181
Takashi Iwai54db6c32014-08-18 15:11:19 +0200182/* coef writes/updates batch */
183struct coef_fw {
184 unsigned char nid;
185 unsigned char idx;
186 unsigned short mask;
187 unsigned short val;
188};
189
190#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
191 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
192#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
193#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
194#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
195
196static void alc_process_coef_fw(struct hda_codec *codec,
197 const struct coef_fw *fw)
198{
199 for (; fw->nid; fw++) {
200 if (fw->mask == (unsigned short)-1)
201 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
202 else
203 alc_update_coefex_idx(codec, fw->nid, fw->idx,
204 fw->mask, fw->val);
205 }
206}
207
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200208/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200209 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100210 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200211
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200212/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200213static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
214{
215 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200216
Takashi Iwai5579cd62018-06-19 22:22:41 +0200217 spec->gpio_mask |= mask;
218 spec->gpio_dir |= mask;
219 spec->gpio_data |= mask;
220}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200221
Takashi Iwai5579cd62018-06-19 22:22:41 +0200222static void alc_write_gpio_data(struct hda_codec *codec)
223{
224 struct alc_spec *spec = codec->spec;
225
226 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
227 spec->gpio_data);
228}
229
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200230static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
231 bool on)
232{
233 struct alc_spec *spec = codec->spec;
234 unsigned int oldval = spec->gpio_data;
235
236 if (on)
237 spec->gpio_data |= mask;
238 else
239 spec->gpio_data &= ~mask;
240 if (oldval != spec->gpio_data)
241 alc_write_gpio_data(codec);
242}
243
Takashi Iwai5579cd62018-06-19 22:22:41 +0200244static void alc_write_gpio(struct hda_codec *codec)
245{
246 struct alc_spec *spec = codec->spec;
247
248 if (!spec->gpio_mask)
249 return;
250
251 snd_hda_codec_write(codec, codec->core.afg, 0,
252 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
253 snd_hda_codec_write(codec, codec->core.afg, 0,
254 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200255 if (spec->gpio_write_delay)
256 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200257 alc_write_gpio_data(codec);
258}
259
260static void alc_fixup_gpio(struct hda_codec *codec, int action,
261 unsigned int mask)
262{
263 if (action == HDA_FIXUP_ACT_PRE_PROBE)
264 alc_setup_gpio(codec, mask);
265}
266
267static void alc_fixup_gpio1(struct hda_codec *codec,
268 const struct hda_fixup *fix, int action)
269{
270 alc_fixup_gpio(codec, action, 0x01);
271}
272
273static void alc_fixup_gpio2(struct hda_codec *codec,
274 const struct hda_fixup *fix, int action)
275{
276 alc_fixup_gpio(codec, action, 0x02);
277}
278
279static void alc_fixup_gpio3(struct hda_codec *codec,
280 const struct hda_fixup *fix, int action)
281{
282 alc_fixup_gpio(codec, action, 0x03);
283}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200284
Takashi Iwaiae065f12018-06-19 23:00:03 +0200285static void alc_fixup_gpio4(struct hda_codec *codec,
286 const struct hda_fixup *fix, int action)
287{
288 alc_fixup_gpio(codec, action, 0x04);
289}
290
Takashi Iwai8a503552020-06-18 13:08:32 +0200291static void alc_fixup_micmute_led(struct hda_codec *codec,
292 const struct hda_fixup *fix, int action)
293{
Jaroslav Kyselae65bf992021-03-17 18:29:43 +0100294 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai8a503552020-06-18 13:08:32 +0200295 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
296}
297
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200298/*
299 * Fix hardware PLL issue
300 * On some codecs, the analog PLL gating control must be off while
301 * the default value is 1.
302 */
303static void alc_fix_pll(struct hda_codec *codec)
304{
305 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200306
Takashi Iwai98b24882014-08-18 13:47:50 +0200307 if (spec->pll_nid)
308 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
309 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200310}
311
312static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
313 unsigned int coef_idx, unsigned int coef_bit)
314{
315 struct alc_spec *spec = codec->spec;
316 spec->pll_nid = nid;
317 spec->pll_coef_idx = coef_idx;
318 spec->pll_coef_bit = coef_bit;
319 alc_fix_pll(codec);
320}
321
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100322/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200323static void alc_update_knob_master(struct hda_codec *codec,
324 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100325{
326 unsigned int val;
327 struct snd_kcontrol *kctl;
328 struct snd_ctl_elem_value *uctl;
329
330 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
331 if (!kctl)
332 return;
333 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
334 if (!uctl)
335 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100336 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100337 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
338 val &= HDA_AMP_VOLMASK;
339 uctl->value.integer.value[0] = val;
340 uctl->value.integer.value[1] = val;
341 kctl->put(kctl, uctl);
342 kfree(uctl);
343}
344
David Henningsson29adc4b2012-09-25 11:31:00 +0200345static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100346{
David Henningsson29adc4b2012-09-25 11:31:00 +0200347 /* For some reason, the res given from ALC880 is broken.
348 Here we adjust it properly. */
349 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100350}
351
Kailang Yang394c97f2014-11-12 17:38:08 +0800352/* Change EAPD to verb control */
353static void alc_fill_eapd_coef(struct hda_codec *codec)
354{
355 int coef;
356
357 coef = alc_get_coef0(codec);
358
Takashi Iwai7639a062015-03-03 10:07:24 +0100359 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800360 case 0x10ec0262:
361 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
362 break;
363 case 0x10ec0267:
364 case 0x10ec0268:
365 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
366 break;
367 case 0x10ec0269:
368 if ((coef & 0x00f0) == 0x0010)
369 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
370 if ((coef & 0x00f0) == 0x0020)
371 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
372 if ((coef & 0x00f0) == 0x0030)
373 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
374 break;
375 case 0x10ec0280:
376 case 0x10ec0284:
377 case 0x10ec0290:
378 case 0x10ec0292:
379 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
380 break;
Kailang Yang42314302016-02-03 15:03:50 +0800381 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100382 case 0x10ec0295:
383 case 0x10ec0299:
384 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -0500385 fallthrough;
Takashi Iwai44be77c2017-12-27 08:53:59 +0100386 case 0x10ec0215:
Takashi Iwai1948fc02021-06-18 18:17:20 +0200387 case 0x10ec0230:
Kailang Yang394c97f2014-11-12 17:38:08 +0800388 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800389 case 0x10ec0235:
Thomas Hebbc4473742020-03-30 12:09:38 -0400390 case 0x10ec0236:
Kailang Yang7fbdcd82020-04-23 14:18:31 +0800391 case 0x10ec0245:
Kailang Yang394c97f2014-11-12 17:38:08 +0800392 case 0x10ec0255:
Thomas Hebbc4473742020-03-30 12:09:38 -0400393 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800394 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800395 case 0x10ec0282:
396 case 0x10ec0283:
397 case 0x10ec0286:
398 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800399 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800400 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800401 case 0x10ec0289:
Kailang Yang1078bef2018-11-08 16:36:15 +0800402 case 0x10ec0300:
Kailang Yang394c97f2014-11-12 17:38:08 +0800403 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
404 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800405 case 0x10ec0275:
406 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
407 break;
Hui Wang88227022021-05-07 10:44:52 +0800408 case 0x10ec0287:
409 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
410 alc_write_coef_idx(codec, 0x8, 0x4ab7);
411 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800412 case 0x10ec0293:
413 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
414 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800415 case 0x10ec0234:
416 case 0x10ec0274:
417 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800418 case 0x10ec0700:
419 case 0x10ec0701:
420 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +0800421 case 0x10ec0711:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800422 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
423 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800424 case 0x10ec0662:
425 if ((coef & 0x00f0) == 0x0030)
426 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
427 break;
428 case 0x10ec0272:
429 case 0x10ec0273:
430 case 0x10ec0663:
431 case 0x10ec0665:
432 case 0x10ec0670:
433 case 0x10ec0671:
434 case 0x10ec0672:
435 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
436 break;
Kailang Yang9194a1e2020-01-07 17:22:19 +0800437 case 0x10ec0222:
Kailang Yangf0778872019-10-24 15:13:32 +0800438 case 0x10ec0623:
439 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
440 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800441 case 0x10ec0668:
442 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
443 break;
444 case 0x10ec0867:
445 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
446 break;
447 case 0x10ec0888:
448 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
449 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
450 break;
451 case 0x10ec0892:
Kailang Yange5782a52020-11-27 14:39:23 +0800452 case 0x10ec0897:
Kailang Yang394c97f2014-11-12 17:38:08 +0800453 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
454 break;
455 case 0x10ec0899:
456 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +0800457 case 0x10ec0b00:
Kailang Yang65553b12017-07-11 15:15:47 +0800458 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800459 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800460 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
461 break;
462 }
463}
464
Kailang Yangf9423e72008-05-27 12:32:25 +0200465/* additional initialization for ALC888 variants */
466static void alc888_coef_init(struct hda_codec *codec)
467{
Kailang Yang1df88742014-10-29 16:10:13 +0800468 switch (alc_get_coef0(codec) & 0x00f0) {
469 /* alc888-VA */
470 case 0x00:
471 /* alc888-VB */
472 case 0x10:
473 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
474 break;
475 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200476}
477
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100478/* turn on/off EAPD control (only if available) */
479static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
480{
481 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
482 return;
483 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
484 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
485 on ? 2 : 0);
486}
487
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200488/* turn on/off EAPD controls of the codec */
489static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
490{
491 /* We currently only handle front, HP */
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100492 static const hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800493 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200494 };
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100495 const hda_nid_t *p;
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200496 for (p = pins; *p; p++)
497 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200498}
499
Kailang Yangdad31972019-05-10 16:28:57 +0800500static int find_ext_mic_pin(struct hda_codec *codec);
501
502static void alc_headset_mic_no_shutup(struct hda_codec *codec)
503{
504 const struct hda_pincfg *pin;
505 int mic_pin = find_ext_mic_pin(codec);
506 int i;
507
508 /* don't shut up pins when unloading the driver; otherwise it breaks
509 * the default pin setup at the next load of the driver
510 */
511 if (codec->bus->shutdown)
512 return;
513
514 snd_array_for_each(&codec->init_pins, i, pin) {
515 /* use read here for syncing after issuing each verb */
516 if (pin->nid != mic_pin)
517 snd_hda_codec_read(codec, pin->nid, 0,
518 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
519 }
520
521 codec->pins_shutup = 1;
522}
523
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100524static void alc_shutup_pins(struct hda_codec *codec)
525{
526 struct alc_spec *spec = codec->spec;
527
Kailang Yangdad31972019-05-10 16:28:57 +0800528 switch (codec->core.vendor_id) {
Kailang Yang5aec9892021-10-05 14:35:14 +0800529 case 0x10ec0236:
530 case 0x10ec0256:
Kailang Yang66c5d712019-12-09 15:56:15 +0800531 case 0x10ec0283:
Kailang Yangdad31972019-05-10 16:28:57 +0800532 case 0x10ec0286:
533 case 0x10ec0288:
534 case 0x10ec0298:
535 alc_headset_mic_no_shutup(codec);
536 break;
537 default:
538 if (!spec->no_shutup_pins)
539 snd_hda_shutup_pins(codec);
540 break;
541 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100542}
543
Takashi Iwai1c7161532011-04-07 10:37:16 +0200544/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100545 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200546 */
547static void alc_eapd_shutup(struct hda_codec *codec)
548{
Kailang Yang97a26572013-11-29 00:35:26 -0500549 struct alc_spec *spec = codec->spec;
550
Takashi Iwai1c7161532011-04-07 10:37:16 +0200551 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500552 if (!spec->no_depop_delay)
553 msleep(200);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100554 alc_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200555}
556
Takashi Iwai1d045db2011-07-07 18:23:21 +0200557/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200558static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200559{
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200560 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200561 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200562 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200563 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100564 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200565 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200566 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200567 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200568 case 0x10ec0880:
569 case 0x10ec0882:
570 case 0x10ec0883:
571 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800572 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200573 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200574 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200575 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200576 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200577 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200578 break;
579 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200580}
Kailang Yangea1fb292008-08-26 12:58:38 +0200581
Takashi Iwai35a39f92019-02-01 11:19:50 +0100582/* get a primary headphone pin if available */
583static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
584{
585 if (spec->gen.autocfg.hp_pins[0])
586 return spec->gen.autocfg.hp_pins[0];
587 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
588 return spec->gen.autocfg.line_out_pins[0];
589 return 0;
590}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200591
592/*
593 * Realtek SSID verification
594 */
595
David Henningsson90622912010-10-14 14:50:18 +0200596/* Could be any non-zero and even value. When used as fixup, tells
597 * the driver to ignore any present sku defines.
598 */
599#define ALC_FIXUP_SKU_IGNORE (2)
600
Takashi Iwai23d30f22012-05-07 17:17:32 +0200601static void alc_fixup_sku_ignore(struct hda_codec *codec,
602 const struct hda_fixup *fix, int action)
603{
604 struct alc_spec *spec = codec->spec;
605 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
606 spec->cdefine.fixup = 1;
607 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
608 }
609}
610
Mengdong Linb5c66112013-11-29 00:35:35 -0500611static void alc_fixup_no_depop_delay(struct hda_codec *codec,
612 const struct hda_fixup *fix, int action)
613{
614 struct alc_spec *spec = codec->spec;
615
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500616 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500617 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500618 codec->depop_delay = 0;
619 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500620}
621
Kailang Yangda00c242010-03-19 11:23:45 +0100622static int alc_auto_parse_customize_define(struct hda_codec *codec)
623{
624 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100625 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100626 struct alc_spec *spec = codec->spec;
627
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200628 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
629
David Henningsson90622912010-10-14 14:50:18 +0200630 if (spec->cdefine.fixup) {
631 ass = spec->cdefine.sku_cfg;
632 if (ass == ALC_FIXUP_SKU_IGNORE)
633 return -1;
634 goto do_sku;
635 }
636
Takashi Iwai5100cd02014-02-15 10:03:19 +0100637 if (!codec->bus->pci)
638 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100639 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200640 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100641 goto do_sku;
642
643 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100644 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100645 nid = 0x17;
646 ass = snd_hda_codec_get_pincfg(codec, nid);
647
648 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100649 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100650 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100651 return -1;
652 }
653
654 /* check sum */
655 tmp = 0;
656 for (i = 1; i < 16; i++) {
657 if ((ass >> i) & 1)
658 tmp++;
659 }
660 if (((ass >> 16) & 0xf) != tmp)
661 return -1;
662
663 spec->cdefine.port_connectivity = ass >> 30;
664 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
665 spec->cdefine.check_sum = (ass >> 16) & 0xf;
666 spec->cdefine.customization = ass >> 8;
667do_sku:
668 spec->cdefine.sku_cfg = ass;
669 spec->cdefine.external_amp = (ass & 0x38) >> 3;
670 spec->cdefine.platform_type = (ass & 0x4) >> 2;
671 spec->cdefine.swap = (ass & 0x2) >> 1;
672 spec->cdefine.override = ass & 0x1;
673
Takashi Iwai4e76a882014-02-25 12:21:03 +0100674 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100675 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100676 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100677 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100678 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
679 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
680 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
681 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
682 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
683 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
684 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100685
686 return 0;
687}
688
Takashi Iwai08c189f2012-12-19 15:22:24 +0100689/* return the position of NID in the list, or -1 if not found */
690static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
691{
692 int i;
693 for (i = 0; i < nums; i++)
694 if (list[i] == nid)
695 return i;
696 return -1;
697}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200698/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200699static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
700{
Takashi Iwai21268962011-07-07 15:01:13 +0200701 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200702}
703
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200704/* check subsystem ID and set up device-specific initialization;
705 * return 1 if initialized, 0 if invalid SSID
706 */
707/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
708 * 31 ~ 16 : Manufacture ID
709 * 15 ~ 8 : SKU ID
710 * 7 ~ 0 : Assembly ID
711 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
712 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100713static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200714{
715 unsigned int ass, tmp, i;
716 unsigned nid;
717 struct alc_spec *spec = codec->spec;
718
David Henningsson90622912010-10-14 14:50:18 +0200719 if (spec->cdefine.fixup) {
720 ass = spec->cdefine.sku_cfg;
721 if (ass == ALC_FIXUP_SKU_IGNORE)
722 return 0;
723 goto do_sku;
724 }
725
Takashi Iwai7639a062015-03-03 10:07:24 +0100726 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100727 if (codec->bus->pci &&
728 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200729 goto do_sku;
730
731 /* invalid SSID, check the special NID pin defcfg instead */
732 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400733 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200734 * 29~21 : reserve
735 * 20 : PCBEEP input
736 * 19~16 : Check sum (15:1)
737 * 15~1 : Custom
738 * 0 : override
739 */
740 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100741 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200742 nid = 0x17;
743 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100744 codec_dbg(codec,
745 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200746 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100747 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200748 return 0;
749 if ((ass >> 30) != 1) /* no physical connection */
750 return 0;
751
752 /* check sum */
753 tmp = 0;
754 for (i = 1; i < 16; i++) {
755 if ((ass >> i) & 1)
756 tmp++;
757 }
758 if (((ass >> 16) & 0xf) != tmp)
759 return 0;
760do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100761 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100762 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200763 /*
764 * 0 : override
765 * 1 : Swap Jack
766 * 2 : 0 --> Desktop, 1 --> Laptop
767 * 3~5 : External Amplifier control
768 * 7~6 : Reserved
769 */
770 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200771 if (spec->init_amp == ALC_INIT_UNDEFINED) {
772 switch (tmp) {
773 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200774 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200775 break;
776 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200777 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200778 break;
779 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200780 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200781 break;
782 case 5:
783 default:
784 spec->init_amp = ALC_INIT_DEFAULT;
785 break;
786 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200787 }
788
789 /* is laptop or Desktop and enable the function "Mute internal speaker
790 * when the external headphone out jack is plugged"
791 */
792 if (!(ass & 0x8000))
793 return 1;
794 /*
795 * 10~8 : Jack location
796 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
797 * 14~13: Resvered
798 * 15 : 1 --> enable the function "Mute internal speaker
799 * when the external headphone out jack is plugged"
800 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100801 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200802 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200803 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100804 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100805 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
806 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200807 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100808 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200809 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200810 return 1;
811}
Kailang Yangea1fb292008-08-26 12:58:38 +0200812
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200813/* Check the validity of ALC subsystem-id
814 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
815static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200816{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100817 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200818 struct alc_spec *spec = codec->spec;
Takashi Iwai67791202020-04-18 21:06:39 +0200819 if (spec->init_amp == ALC_INIT_UNDEFINED) {
820 codec_dbg(codec,
821 "realtek: Enable default setup for auto mode as fallback\n");
822 spec->init_amp = ALC_INIT_DEFAULT;
823 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200824 }
Takashi Iwai21268962011-07-07 15:01:13 +0200825}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200826
Takashi Iwai41e41f12005-06-08 14:48:49 +0200827/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200828 */
829
David Henningsson9d36a7d2014-10-07 10:18:42 +0200830static void alc_fixup_inv_dmic(struct hda_codec *codec,
831 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200832{
833 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100834
David Henningsson9d36a7d2014-10-07 10:18:42 +0200835 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200836}
837
Takashi Iwai603c4012008-07-30 15:01:44 +0200838
Takashi Iwai2eab6942012-12-18 15:30:41 +0100839static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200841 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842
Takashi Iwai08c189f2012-12-19 15:22:24 +0100843 err = snd_hda_gen_build_controls(codec);
844 if (err < 0)
845 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846
Takashi Iwai1727a772013-01-10 09:52:52 +0100847 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100848 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849}
850
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200851
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100853 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200854 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200855
Takashi Iwaic9af7532019-05-10 11:01:43 +0200856static void alc_pre_init(struct hda_codec *codec)
857{
858 alc_fill_eapd_coef(codec);
859}
860
Kailang Yangaeac1a02019-05-16 16:10:44 +0800861#define is_s3_resume(codec) \
862 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
Takashi Iwaic9af7532019-05-10 11:01:43 +0200863#define is_s4_resume(codec) \
864 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
865
Linus Torvalds1da177e2005-04-16 15:20:36 -0700866static int alc_init(struct hda_codec *codec)
867{
868 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200869
Takashi Iwaic9af7532019-05-10 11:01:43 +0200870 /* hibernation resume needs the full chip initialization */
871 if (is_s4_resume(codec))
872 alc_pre_init(codec);
873
Takashi Iwai546bb672012-03-07 08:37:19 +0100874 if (spec->init_hook)
875 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100876
Takashi Iwai89781d02019-08-30 12:03:38 +0200877 spec->gen.skip_verbs = 1; /* applied in below */
Kailang Yang607ca3b2019-04-26 16:35:41 +0800878 snd_hda_gen_init(codec);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200879 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200880 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai89781d02019-08-30 12:03:38 +0200881 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200882
Takashi Iwai1727a772013-01-10 09:52:52 +0100883 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200884
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885 return 0;
886}
887
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100888static inline void alc_shutup(struct hda_codec *codec)
889{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200890 struct alc_spec *spec = codec->spec;
891
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200892 if (!snd_hda_get_bool_hint(codec, "shutup"))
893 return; /* disabled explicitly by hints */
894
Takashi Iwai1c7161532011-04-07 10:37:16 +0200895 if (spec && spec->shutup)
896 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200897 else
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100898 alc_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100899}
900
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100901#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700902
Takashi Iwai83012a72012-08-24 18:38:08 +0200903#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500904static void alc_power_eapd(struct hda_codec *codec)
905{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200906 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500907}
908
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200909static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100910{
911 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100912 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100913 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500914 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100915 return 0;
916}
917#endif
918
Takashi Iwai2a439522011-07-26 09:52:50 +0200919#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100920static int alc_resume(struct hda_codec *codec)
921{
Kailang Yang97a26572013-11-29 00:35:26 -0500922 struct alc_spec *spec = codec->spec;
923
924 if (!spec->no_depop_delay)
925 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100926 codec->patch_ops.init(codec);
Takashi Iwai1a462be2020-01-09 10:01:04 +0100927 snd_hda_regmap_sync(codec);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200928 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100929 return 0;
930}
Takashi Iwaie044c392008-10-27 16:56:24 +0100931#endif
932
Linus Torvalds1da177e2005-04-16 15:20:36 -0700933/*
934 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200935static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700936 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100937 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700938 .init = alc_init,
939 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200940 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200941#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100942 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100943 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100944 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200945#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700946};
947
David Henningsson29adc4b2012-09-25 11:31:00 +0200948
Takashi Iwaided255b2015-10-01 17:59:43 +0200949#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100950
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200951/*
Kailang Yang4b016932013-11-28 11:55:09 +0100952 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200953 */
954struct alc_codec_rename_table {
955 unsigned int vendor_id;
956 unsigned short coef_mask;
957 unsigned short coef_bits;
958 const char *name;
959};
960
Kailang Yang4b016932013-11-28 11:55:09 +0100961struct alc_codec_rename_pci_table {
962 unsigned int codec_vendor_id;
963 unsigned short pci_subvendor;
964 unsigned short pci_subdevice;
965 const char *name;
966};
967
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100968static const struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800969 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200970 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
971 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
972 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
973 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
974 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
975 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
976 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200977 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800978 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200979 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
980 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
981 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
982 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
983 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
984 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
985 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
986 { } /* terminator */
987};
988
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100989static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
Kailang Yang4b016932013-11-28 11:55:09 +0100990 { 0x10ec0280, 0x1028, 0, "ALC3220" },
991 { 0x10ec0282, 0x1028, 0, "ALC3221" },
992 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800993 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +0100994 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +0800995 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +0100996 { 0x10ec0255, 0x1028, 0, "ALC3234" },
997 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800998 { 0x10ec0275, 0x1028, 0, "ALC3260" },
999 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +08001000 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +08001001 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +08001002 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +08001003 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +08001004 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +08001005 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001006 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1007 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1008 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1009 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1010 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1011 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1012 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1013 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1014 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1015 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1016 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +01001017 { } /* terminator */
1018};
1019
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001020static int alc_codec_rename_from_preset(struct hda_codec *codec)
1021{
1022 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +01001023 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001024
1025 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001026 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001027 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02001028 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001029 return alc_codec_rename(codec, p->name);
1030 }
Kailang Yang4b016932013-11-28 11:55:09 +01001031
Takashi Iwai5100cd02014-02-15 10:03:19 +01001032 if (!codec->bus->pci)
1033 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +01001034 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001035 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +01001036 continue;
1037 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1038 continue;
1039 if (!q->pci_subdevice ||
1040 q->pci_subdevice == codec->bus->pci->subsystem_device)
1041 return alc_codec_rename(codec, q->name);
1042 }
1043
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001044 return 0;
1045}
1046
Takashi Iwaie4770622011-07-08 11:11:35 +02001047
1048/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001049 * Digital-beep handlers
1050 */
1051#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001052
1053/* additional beep mixers; private_value will be overwritten */
1054static const struct snd_kcontrol_new alc_beep_mixer[] = {
1055 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1056 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1057};
1058
1059/* set up and create beep controls */
1060static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1061 int idx, int dir)
1062{
1063 struct snd_kcontrol_new *knew;
1064 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1065 int i;
1066
1067 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1068 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1069 &alc_beep_mixer[i]);
1070 if (!knew)
1071 return -ENOMEM;
1072 knew->private_value = beep_amp;
1073 }
1074 return 0;
1075}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001076
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001077static const struct snd_pci_quirk beep_allow_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001078 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001079 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001080 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001081 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001082 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1083 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1084 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001085 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001086 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001087 /* denylist -- no beep available */
Takashi Iwai051c78a2019-08-22 09:58:07 +02001088 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1089 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001090 {}
1091};
1092
1093static inline int has_cdefine_beep(struct hda_codec *codec)
1094{
1095 struct alc_spec *spec = codec->spec;
1096 const struct snd_pci_quirk *q;
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001097 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001098 if (q)
1099 return q->value;
1100 return spec->cdefine.enable_pcbeep;
1101}
1102#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001103#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001104#define has_cdefine_beep(codec) 0
1105#endif
1106
1107/* parse the BIOS configuration and set up the alc_spec */
1108/* return 1 if successful, 0 if the proper config is not found,
1109 * or a negative error code
1110 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001111static int alc_parse_auto_config(struct hda_codec *codec,
1112 const hda_nid_t *ignore_nids,
1113 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001114{
1115 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001116 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001117 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001118
Takashi Iwai53c334a2011-08-23 18:27:14 +02001119 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1120 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001121 if (err < 0)
1122 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001123
1124 if (ssid_nids)
1125 alc_ssid_check(codec, ssid_nids);
1126
Takashi Iwai08c189f2012-12-19 15:22:24 +01001127 err = snd_hda_gen_parse_auto_config(codec, cfg);
1128 if (err < 0)
1129 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001130
Takashi Iwai1d045db2011-07-07 18:23:21 +02001131 return 1;
1132}
1133
Takashi Iwai3de95172012-05-07 18:03:15 +02001134/* common preparation job for alc_spec */
1135static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1136{
1137 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1138 int err;
1139
1140 if (!spec)
1141 return -ENOMEM;
1142 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001143 snd_hda_gen_spec_init(&spec->gen);
1144 spec->gen.mixer_nid = mixer_nid;
1145 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001146 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001147 /* FIXME: do we need this for all Realtek codec models? */
1148 codec->spdif_status_reset = 1;
Kai Vehmanena6e7d0a2020-10-12 13:27:04 +03001149 codec->forced_resume = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001150 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001151
1152 err = alc_codec_rename_from_preset(codec);
1153 if (err < 0) {
1154 kfree(spec);
1155 return err;
1156 }
1157 return 0;
1158}
1159
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001160static int alc880_parse_auto_config(struct hda_codec *codec)
1161{
1162 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001163 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001164 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1165}
1166
Takashi Iwai1d045db2011-07-07 18:23:21 +02001167/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001168 * ALC880 fix-ups
1169 */
1170enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001171 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001172 ALC880_FIXUP_GPIO2,
1173 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001174 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001175 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001176 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001177 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001178 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001179 ALC880_FIXUP_VOL_KNOB,
1180 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001181 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001182 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001183 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001184 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001185 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001186 ALC880_FIXUP_3ST_BASE,
1187 ALC880_FIXUP_3ST,
1188 ALC880_FIXUP_3ST_DIG,
1189 ALC880_FIXUP_5ST_BASE,
1190 ALC880_FIXUP_5ST,
1191 ALC880_FIXUP_5ST_DIG,
1192 ALC880_FIXUP_6ST_BASE,
1193 ALC880_FIXUP_6ST,
1194 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001195 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001196};
1197
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001198/* enable the volume-knob widget support on NID 0x21 */
1199static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001200 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001201{
Takashi Iwai1727a772013-01-10 09:52:52 +01001202 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001203 snd_hda_jack_detect_enable_callback(codec, 0x21,
1204 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001205}
1206
Takashi Iwai1727a772013-01-10 09:52:52 +01001207static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001208 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001209 .type = HDA_FIXUP_FUNC,
1210 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001211 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001212 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001213 .type = HDA_FIXUP_FUNC,
1214 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001215 },
1216 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001217 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001218 .v.verbs = (const struct hda_verb[]) {
1219 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1220 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1221 { }
1222 },
1223 .chained = true,
1224 .chain_id = ALC880_FIXUP_GPIO2,
1225 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001226 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001227 .type = HDA_FIXUP_PINS,
1228 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001229 /* disable bogus unused pins */
1230 { 0x16, 0x411111f0 },
1231 { 0x18, 0x411111f0 },
1232 { 0x1a, 0x411111f0 },
1233 { }
1234 }
1235 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001236 [ALC880_FIXUP_LG_LW25] = {
1237 .type = HDA_FIXUP_PINS,
1238 .v.pins = (const struct hda_pintbl[]) {
1239 { 0x1a, 0x0181344f }, /* line-in */
1240 { 0x1b, 0x0321403f }, /* headphone */
1241 { }
1242 }
1243 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001244 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001245 .type = HDA_FIXUP_PINS,
1246 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001247 /* disable bogus unused pins */
1248 { 0x17, 0x411111f0 },
1249 { }
1250 },
1251 .chained = true,
1252 .chain_id = ALC880_FIXUP_GPIO2,
1253 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001254 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001255 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001256 .v.verbs = (const struct hda_verb[]) {
1257 /* change to EAPD mode */
1258 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1259 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1260 {}
1261 },
1262 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001263 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001264 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001265 .v.verbs = (const struct hda_verb[]) {
1266 /* change to EAPD mode */
1267 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1268 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1269 {}
1270 },
1271 .chained = true,
1272 .chain_id = ALC880_FIXUP_GPIO2,
1273 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001274 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001275 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001276 .v.func = alc880_fixup_vol_knob,
1277 },
1278 [ALC880_FIXUP_FUJITSU] = {
1279 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001280 .type = HDA_FIXUP_PINS,
1281 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001282 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001283 { 0x15, 0x99030120 }, /* speaker */
1284 { 0x16, 0x99030130 }, /* bass speaker */
1285 { 0x17, 0x411111f0 }, /* N/A */
1286 { 0x18, 0x411111f0 }, /* N/A */
1287 { 0x19, 0x01a19950 }, /* mic-in */
1288 { 0x1a, 0x411111f0 }, /* N/A */
1289 { 0x1b, 0x411111f0 }, /* N/A */
1290 { 0x1c, 0x411111f0 }, /* N/A */
1291 { 0x1d, 0x411111f0 }, /* N/A */
1292 { 0x1e, 0x01454140 }, /* SPDIF out */
1293 { }
1294 },
1295 .chained = true,
1296 .chain_id = ALC880_FIXUP_VOL_KNOB,
1297 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001298 [ALC880_FIXUP_F1734] = {
1299 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001300 .type = HDA_FIXUP_PINS,
1301 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001302 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001303 { 0x15, 0x99030120 }, /* speaker */
1304 { 0x16, 0x411111f0 }, /* N/A */
1305 { 0x17, 0x411111f0 }, /* N/A */
1306 { 0x18, 0x411111f0 }, /* N/A */
1307 { 0x19, 0x01a19950 }, /* mic-in */
1308 { 0x1a, 0x411111f0 }, /* N/A */
1309 { 0x1b, 0x411111f0 }, /* N/A */
1310 { 0x1c, 0x411111f0 }, /* N/A */
1311 { 0x1d, 0x411111f0 }, /* N/A */
1312 { 0x1e, 0x411111f0 }, /* N/A */
1313 { }
1314 },
1315 .chained = true,
1316 .chain_id = ALC880_FIXUP_VOL_KNOB,
1317 },
Takashi Iwai817de922012-02-20 17:20:48 +01001318 [ALC880_FIXUP_UNIWILL] = {
1319 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001320 .type = HDA_FIXUP_PINS,
1321 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001322 { 0x14, 0x0121411f }, /* HP */
1323 { 0x15, 0x99030120 }, /* speaker */
1324 { 0x16, 0x99030130 }, /* bass speaker */
1325 { }
1326 },
1327 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001328 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001329 .type = HDA_FIXUP_PINS,
1330 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001331 /* disable bogus unused pins */
1332 { 0x17, 0x411111f0 },
1333 { 0x19, 0x411111f0 },
1334 { 0x1b, 0x411111f0 },
1335 { 0x1f, 0x411111f0 },
1336 { }
1337 }
1338 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001339 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001340 .type = HDA_FIXUP_PINS,
1341 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001342 /* set up the whole pins as BIOS is utterly broken */
1343 { 0x14, 0x99030120 }, /* speaker */
1344 { 0x15, 0x0121411f }, /* HP */
1345 { 0x16, 0x411111f0 }, /* N/A */
1346 { 0x17, 0x411111f0 }, /* N/A */
1347 { 0x18, 0x01a19950 }, /* mic-in */
1348 { 0x19, 0x411111f0 }, /* N/A */
1349 { 0x1a, 0x01813031 }, /* line-in */
1350 { 0x1b, 0x411111f0 }, /* N/A */
1351 { 0x1c, 0x411111f0 }, /* N/A */
1352 { 0x1d, 0x411111f0 }, /* N/A */
1353 { 0x1e, 0x0144111e }, /* SPDIF */
1354 { }
1355 }
1356 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001357 [ALC880_FIXUP_ASUS_W5A] = {
1358 .type = HDA_FIXUP_PINS,
1359 .v.pins = (const struct hda_pintbl[]) {
1360 /* set up the whole pins as BIOS is utterly broken */
1361 { 0x14, 0x0121411f }, /* HP */
1362 { 0x15, 0x411111f0 }, /* N/A */
1363 { 0x16, 0x411111f0 }, /* N/A */
1364 { 0x17, 0x411111f0 }, /* N/A */
1365 { 0x18, 0x90a60160 }, /* mic */
1366 { 0x19, 0x411111f0 }, /* N/A */
1367 { 0x1a, 0x411111f0 }, /* N/A */
1368 { 0x1b, 0x411111f0 }, /* N/A */
1369 { 0x1c, 0x411111f0 }, /* N/A */
1370 { 0x1d, 0x411111f0 }, /* N/A */
1371 { 0x1e, 0xb743111e }, /* SPDIF out */
1372 { }
1373 },
1374 .chained = true,
1375 .chain_id = ALC880_FIXUP_GPIO1,
1376 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001377 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001378 .type = HDA_FIXUP_PINS,
1379 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001380 { 0x14, 0x01014010 }, /* line-out */
1381 { 0x15, 0x411111f0 }, /* N/A */
1382 { 0x16, 0x411111f0 }, /* N/A */
1383 { 0x17, 0x411111f0 }, /* N/A */
1384 { 0x18, 0x01a19c30 }, /* mic-in */
1385 { 0x19, 0x0121411f }, /* HP */
1386 { 0x1a, 0x01813031 }, /* line-in */
1387 { 0x1b, 0x02a19c40 }, /* front-mic */
1388 { 0x1c, 0x411111f0 }, /* N/A */
1389 { 0x1d, 0x411111f0 }, /* N/A */
1390 /* 0x1e is filled in below */
1391 { 0x1f, 0x411111f0 }, /* N/A */
1392 { }
1393 }
1394 },
1395 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001396 .type = HDA_FIXUP_PINS,
1397 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001398 { 0x1e, 0x411111f0 }, /* N/A */
1399 { }
1400 },
1401 .chained = true,
1402 .chain_id = ALC880_FIXUP_3ST_BASE,
1403 },
1404 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001405 .type = HDA_FIXUP_PINS,
1406 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001407 { 0x1e, 0x0144111e }, /* SPDIF */
1408 { }
1409 },
1410 .chained = true,
1411 .chain_id = ALC880_FIXUP_3ST_BASE,
1412 },
1413 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001414 .type = HDA_FIXUP_PINS,
1415 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001416 { 0x14, 0x01014010 }, /* front */
1417 { 0x15, 0x411111f0 }, /* N/A */
1418 { 0x16, 0x01011411 }, /* CLFE */
1419 { 0x17, 0x01016412 }, /* surr */
1420 { 0x18, 0x01a19c30 }, /* mic-in */
1421 { 0x19, 0x0121411f }, /* HP */
1422 { 0x1a, 0x01813031 }, /* line-in */
1423 { 0x1b, 0x02a19c40 }, /* front-mic */
1424 { 0x1c, 0x411111f0 }, /* N/A */
1425 { 0x1d, 0x411111f0 }, /* N/A */
1426 /* 0x1e is filled in below */
1427 { 0x1f, 0x411111f0 }, /* N/A */
1428 { }
1429 }
1430 },
1431 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001432 .type = HDA_FIXUP_PINS,
1433 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001434 { 0x1e, 0x411111f0 }, /* N/A */
1435 { }
1436 },
1437 .chained = true,
1438 .chain_id = ALC880_FIXUP_5ST_BASE,
1439 },
1440 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001441 .type = HDA_FIXUP_PINS,
1442 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001443 { 0x1e, 0x0144111e }, /* SPDIF */
1444 { }
1445 },
1446 .chained = true,
1447 .chain_id = ALC880_FIXUP_5ST_BASE,
1448 },
1449 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001450 .type = HDA_FIXUP_PINS,
1451 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001452 { 0x14, 0x01014010 }, /* front */
1453 { 0x15, 0x01016412 }, /* surr */
1454 { 0x16, 0x01011411 }, /* CLFE */
1455 { 0x17, 0x01012414 }, /* side */
1456 { 0x18, 0x01a19c30 }, /* mic-in */
1457 { 0x19, 0x02a19c40 }, /* front-mic */
1458 { 0x1a, 0x01813031 }, /* line-in */
1459 { 0x1b, 0x0121411f }, /* HP */
1460 { 0x1c, 0x411111f0 }, /* N/A */
1461 { 0x1d, 0x411111f0 }, /* N/A */
1462 /* 0x1e is filled in below */
1463 { 0x1f, 0x411111f0 }, /* N/A */
1464 { }
1465 }
1466 },
1467 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001468 .type = HDA_FIXUP_PINS,
1469 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001470 { 0x1e, 0x411111f0 }, /* N/A */
1471 { }
1472 },
1473 .chained = true,
1474 .chain_id = ALC880_FIXUP_6ST_BASE,
1475 },
1476 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001477 .type = HDA_FIXUP_PINS,
1478 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001479 { 0x1e, 0x0144111e }, /* SPDIF */
1480 { }
1481 },
1482 .chained = true,
1483 .chain_id = ALC880_FIXUP_6ST_BASE,
1484 },
Takashi Iwai53971452013-01-23 18:21:37 +01001485 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1486 .type = HDA_FIXUP_PINS,
1487 .v.pins = (const struct hda_pintbl[]) {
1488 { 0x1b, 0x0121401f }, /* HP with jack detect */
1489 { }
1490 },
1491 .chained_before = true,
1492 .chain_id = ALC880_FIXUP_6ST_BASE,
1493 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001494};
1495
1496static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001497 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001498 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001499 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001500 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001501 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001502 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001503 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001504 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001505 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001506 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001507 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001508 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001509 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001510 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001511 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001512 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001513 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001514 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001515 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1516 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1517 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001518 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001519 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001520
1521 /* Below is the copied entries from alc880_quirks.c.
1522 * It's not quite sure whether BIOS sets the correct pin-config table
1523 * on these machines, thus they are kept to be compatible with
1524 * the old static quirks. Once when it's confirmed to work without
1525 * these overrides, it'd be better to remove.
1526 */
1527 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1528 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1529 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1530 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1531 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1532 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1533 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1534 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1535 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1536 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1537 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1538 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1539 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1540 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1541 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1542 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1543 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1544 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1545 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1546 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1547 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1548 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1549 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1550 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1551 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1552 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1553 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1554 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1555 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1556 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1557 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1558 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1560 /* default Intel */
1561 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1562 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1563 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1564 {}
1565};
1566
Takashi Iwai1727a772013-01-10 09:52:52 +01001567static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001568 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1569 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1570 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1571 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1572 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1573 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001574 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001575 {}
1576};
1577
1578
1579/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001580 * OK, here we have finally the patch for ALC880
1581 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001582static int patch_alc880(struct hda_codec *codec)
1583{
1584 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001585 int err;
1586
Takashi Iwai3de95172012-05-07 18:03:15 +02001587 err = alc_alloc_spec(codec, 0x0b);
1588 if (err < 0)
1589 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001590
Takashi Iwai3de95172012-05-07 18:03:15 +02001591 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001592 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001593 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001594
Takashi Iwai225068a2015-05-29 10:42:14 +02001595 codec->patch_ops.unsol_event = alc880_unsol_event;
1596
Takashi Iwaic9af7532019-05-10 11:01:43 +02001597 alc_pre_init(codec);
1598
Takashi Iwai1727a772013-01-10 09:52:52 +01001599 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001600 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001601 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001602
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001603 /* automatic parse from the BIOS config */
1604 err = alc880_parse_auto_config(codec);
1605 if (err < 0)
1606 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001607
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001608 if (!spec->gen.no_analog) {
1609 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1610 if (err < 0)
1611 goto error;
1612 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001613
Takashi Iwai1727a772013-01-10 09:52:52 +01001614 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001615
Takashi Iwai1d045db2011-07-07 18:23:21 +02001616 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001617
1618 error:
1619 alc_free(codec);
1620 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001621}
1622
1623
1624/*
1625 * ALC260 support
1626 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001627static int alc260_parse_auto_config(struct hda_codec *codec)
1628{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001629 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001630 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1631 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001632}
1633
Takashi Iwai1d045db2011-07-07 18:23:21 +02001634/*
1635 * Pin config fixes
1636 */
1637enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001638 ALC260_FIXUP_HP_DC5750,
1639 ALC260_FIXUP_HP_PIN_0F,
1640 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001641 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001642 ALC260_FIXUP_GPIO1_TOGGLE,
1643 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001644 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001645 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001646 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001647 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001648 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001649};
1650
Takashi Iwai20f7d922012-02-16 12:35:16 +01001651static void alc260_gpio1_automute(struct hda_codec *codec)
1652{
1653 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001654
1655 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001656}
1657
1658static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001659 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001660{
1661 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001662 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001663 /* although the machine has only one output pin, we need to
1664 * toggle GPIO1 according to the jack state
1665 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001666 spec->gen.automute_hook = alc260_gpio1_automute;
1667 spec->gen.detect_hp = 1;
1668 spec->gen.automute_speaker = 1;
1669 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001670 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001671 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001672 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001673 }
1674}
1675
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001676static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001677 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001678{
1679 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001680 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001681 { 0x0f, 0x02214000 }, /* HP/speaker */
1682 { 0x12, 0x90a60160 }, /* int mic */
1683 { 0x13, 0x02a19000 }, /* ext mic */
1684 { 0x18, 0x01446000 }, /* SPDIF out */
1685 /* disable bogus I/O pins */
1686 { 0x10, 0x411111f0 },
1687 { 0x11, 0x411111f0 },
1688 { 0x14, 0x411111f0 },
1689 { 0x15, 0x411111f0 },
1690 { 0x16, 0x411111f0 },
1691 { 0x17, 0x411111f0 },
1692 { 0x19, 0x411111f0 },
1693 { }
1694 };
1695
1696 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001697 case HDA_FIXUP_ACT_PRE_PROBE:
1698 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001699 spec->init_amp = ALC_INIT_NONE;
1700 break;
1701 }
1702}
1703
Takashi Iwai39aedee2013-01-10 17:10:40 +01001704static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1705 const struct hda_fixup *fix, int action)
1706{
1707 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001708 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001709 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001710}
1711
1712static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1713 const struct hda_fixup *fix, int action)
1714{
1715 struct alc_spec *spec = codec->spec;
1716 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001717 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001718 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001719 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001720}
1721
Takashi Iwai1727a772013-01-10 09:52:52 +01001722static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001723 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001724 .type = HDA_FIXUP_PINS,
1725 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001726 { 0x11, 0x90130110 }, /* speaker */
1727 { }
1728 }
1729 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001730 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001731 .type = HDA_FIXUP_PINS,
1732 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001733 { 0x0f, 0x01214000 }, /* HP */
1734 { }
1735 }
1736 },
1737 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001738 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001739 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001740 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1741 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001742 { }
1743 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001744 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001745 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001746 .type = HDA_FIXUP_FUNC,
1747 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001748 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001749 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001750 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001751 .v.func = alc260_fixup_gpio1_toggle,
1752 .chained = true,
1753 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1754 },
1755 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001756 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001757 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001758 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1759 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001760 { }
1761 },
1762 .chained = true,
1763 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1764 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001765 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001766 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001767 .v.func = alc260_fixup_gpio1_toggle,
1768 .chained = true,
1769 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001770 },
1771 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001772 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001773 .v.func = alc260_fixup_kn1,
1774 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001775 [ALC260_FIXUP_FSC_S7020] = {
1776 .type = HDA_FIXUP_FUNC,
1777 .v.func = alc260_fixup_fsc_s7020,
1778 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001779 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1780 .type = HDA_FIXUP_FUNC,
1781 .v.func = alc260_fixup_fsc_s7020_jwse,
1782 .chained = true,
1783 .chain_id = ALC260_FIXUP_FSC_S7020,
1784 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001785 [ALC260_FIXUP_VAIO_PINS] = {
1786 .type = HDA_FIXUP_PINS,
1787 .v.pins = (const struct hda_pintbl[]) {
1788 /* Pin configs are missing completely on some VAIOs */
1789 { 0x0f, 0x01211020 },
1790 { 0x10, 0x0001003f },
1791 { 0x11, 0x411111f0 },
1792 { 0x12, 0x01a15930 },
1793 { 0x13, 0x411111f0 },
1794 { 0x14, 0x411111f0 },
1795 { 0x15, 0x411111f0 },
1796 { 0x16, 0x411111f0 },
1797 { 0x17, 0x411111f0 },
1798 { 0x18, 0x411111f0 },
1799 { 0x19, 0x411111f0 },
1800 { }
1801 }
1802 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001803};
1804
1805static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001806 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001807 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001808 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001809 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001810 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001811 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001812 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001813 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001814 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001815 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001816 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001817 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001818 {}
1819};
1820
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001821static const struct hda_model_fixup alc260_fixup_models[] = {
1822 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1823 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1824 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1825 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1826 {}
1827};
1828
Takashi Iwai1d045db2011-07-07 18:23:21 +02001829/*
1830 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001831static int patch_alc260(struct hda_codec *codec)
1832{
1833 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001834 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001835
Takashi Iwai3de95172012-05-07 18:03:15 +02001836 err = alc_alloc_spec(codec, 0x07);
1837 if (err < 0)
1838 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001839
Takashi Iwai3de95172012-05-07 18:03:15 +02001840 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001841 /* as quite a few machines require HP amp for speaker outputs,
1842 * it's easier to enable it unconditionally; even if it's unneeded,
1843 * it's almost harmless.
1844 */
1845 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001846 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001847
Takashi Iwai225068a2015-05-29 10:42:14 +02001848 spec->shutup = alc_eapd_shutup;
1849
Takashi Iwaic9af7532019-05-10 11:01:43 +02001850 alc_pre_init(codec);
1851
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001852 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1853 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001854 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001855
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001856 /* automatic parse from the BIOS config */
1857 err = alc260_parse_auto_config(codec);
1858 if (err < 0)
1859 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001860
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001861 if (!spec->gen.no_analog) {
1862 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1863 if (err < 0)
1864 goto error;
1865 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001866
Takashi Iwai1727a772013-01-10 09:52:52 +01001867 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001868
Takashi Iwai1d045db2011-07-07 18:23:21 +02001869 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001870
1871 error:
1872 alc_free(codec);
1873 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001874}
1875
1876
1877/*
1878 * ALC882/883/885/888/889 support
1879 *
1880 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1881 * configuration. Each pin widget can choose any input DACs and a mixer.
1882 * Each ADC is connected from a mixer of all inputs. This makes possible
1883 * 6-channel independent captures.
1884 *
1885 * In addition, an independent DAC for the multi-playback (not used in this
1886 * driver yet).
1887 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001888
1889/*
1890 * Pin config fixes
1891 */
1892enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001893 ALC882_FIXUP_ABIT_AW9D_MAX,
1894 ALC882_FIXUP_LENOVO_Y530,
1895 ALC882_FIXUP_PB_M5210,
1896 ALC882_FIXUP_ACER_ASPIRE_7736,
1897 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001898 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001899 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001900 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001901 ALC888_FIXUP_EEE1601,
PeiSen Hou4841b8e2021-02-02 10:30:22 +01001902 ALC886_FIXUP_EAPD,
Takashi Iwai177943a32011-11-09 12:55:18 +01001903 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001904 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001905 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001906 ALC882_FIXUP_GPIO1,
1907 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001908 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001909 ALC889_FIXUP_COEF,
1910 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001911 ALC882_FIXUP_ACER_ASPIRE_4930G,
1912 ALC882_FIXUP_ACER_ASPIRE_8930G,
1913 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001914 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001915 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001916 ALC889_FIXUP_MBP_VREF,
1917 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001918 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001919 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001920 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001921 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001922 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001923 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001924 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001925 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001926 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001927 ALC1220_FIXUP_CLEVO_P950,
Richard Sailer80690a22019-04-02 15:52:04 +02001928 ALC1220_FIXUP_CLEVO_PB51ED,
1929 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Jian-Hong Panca184352020-10-07 13:22:25 +08001930 ALC887_FIXUP_ASUS_AUDIO,
1931 ALC887_FIXUP_ASUS_HMIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001932};
1933
Takashi Iwai68ef0562011-11-09 18:24:44 +01001934static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001935 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001936{
Takashi Iwai1727a772013-01-10 09:52:52 +01001937 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001938 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001939 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001940}
1941
Takashi Iwai56710872011-11-14 17:42:11 +01001942/* set up GPIO at initialization */
1943static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001944 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001945{
Takashi Iwai215c8502018-06-19 22:34:26 +02001946 struct alc_spec *spec = codec->spec;
1947
1948 spec->gpio_write_delay = true;
1949 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001950}
1951
Takashi Iwai02a237b2012-02-13 15:25:07 +01001952/* Fix the connection of some pins for ALC889:
1953 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1954 * work correctly (bko#42740)
1955 */
1956static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001957 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001958{
Takashi Iwai1727a772013-01-10 09:52:52 +01001959 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001960 /* fake the connections during parsing the tree */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001961 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1962 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1963 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1964 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1965 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1966 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001967 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001968 /* restore the connections */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001969 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1970 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1971 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1972 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1973 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001974 }
1975}
1976
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001977/* Set VREF on HP pin */
1978static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001979 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001980{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001981 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001982 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001983 int i;
1984
Takashi Iwai1727a772013-01-10 09:52:52 +01001985 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001986 return;
1987 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1988 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1989 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1990 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001991 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001992 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001993 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001994 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001995 break;
1996 }
1997}
1998
Takashi Iwai0756f092013-12-04 13:59:45 +01001999static void alc889_fixup_mac_pins(struct hda_codec *codec,
2000 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002001{
2002 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002003 int i;
2004
Takashi Iwai0756f092013-12-04 13:59:45 +01002005 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002006 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002007 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002008 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002009 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002010 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01002011 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002012}
2013
Takashi Iwai0756f092013-12-04 13:59:45 +01002014/* Set VREF on speaker pins on imac91 */
2015static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2016 const struct hda_fixup *fix, int action)
2017{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002018 static const hda_nid_t nids[] = { 0x18, 0x1a };
Takashi Iwai0756f092013-12-04 13:59:45 +01002019
2020 if (action == HDA_FIXUP_ACT_INIT)
2021 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2022}
2023
Adrien Vergée7729a42014-01-24 14:56:14 -05002024/* Set VREF on speaker pins on mba11 */
2025static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2026 const struct hda_fixup *fix, int action)
2027{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002028 static const hda_nid_t nids[] = { 0x18 };
Adrien Vergée7729a42014-01-24 14:56:14 -05002029
2030 if (action == HDA_FIXUP_ACT_INIT)
2031 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2032}
2033
Takashi Iwai0756f092013-12-04 13:59:45 +01002034/* Set VREF on speaker pins on mba21 */
2035static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2036 const struct hda_fixup *fix, int action)
2037{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002038 static const hda_nid_t nids[] = { 0x18, 0x19 };
Takashi Iwai0756f092013-12-04 13:59:45 +01002039
2040 if (action == HDA_FIXUP_ACT_INIT)
2041 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2042}
2043
Takashi Iwaie427c232012-07-29 10:04:08 +02002044/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09002045 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2046 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02002047 */
2048static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002049 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02002050{
2051 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002052 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002053 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002054 spec->gen.no_multi_io = 1;
2055 }
Takashi Iwaie427c232012-07-29 10:04:08 +02002056}
2057
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002058static void alc_fixup_bass_chmap(struct hda_codec *codec,
2059 const struct hda_fixup *fix, int action);
2060
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002061/* For dual-codec configuration, we need to disable some features to avoid
2062 * conflicts of kctls and PCM streams
2063 */
2064static void alc_fixup_dual_codecs(struct hda_codec *codec,
2065 const struct hda_fixup *fix, int action)
2066{
2067 struct alc_spec *spec = codec->spec;
2068
2069 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2070 return;
2071 /* disable vmaster */
2072 spec->gen.suppress_vmaster = 1;
2073 /* auto-mute and auto-mic switch don't work with multiple codecs */
2074 spec->gen.suppress_auto_mute = 1;
2075 spec->gen.suppress_auto_mic = 1;
2076 /* disable aamix as well */
2077 spec->gen.mixer_nid = 0;
2078 /* add location prefix to avoid conflicts */
2079 codec->force_pin_prefix = 1;
2080}
2081
2082static void rename_ctl(struct hda_codec *codec, const char *oldname,
2083 const char *newname)
2084{
2085 struct snd_kcontrol *kctl;
2086
2087 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2088 if (kctl)
2089 strcpy(kctl->id.name, newname);
2090}
2091
2092static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2093 const struct hda_fixup *fix,
2094 int action)
2095{
2096 alc_fixup_dual_codecs(codec, fix, action);
2097 switch (action) {
2098 case HDA_FIXUP_ACT_PRE_PROBE:
2099 /* override card longname to provide a unique UCM profile */
2100 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2101 break;
2102 case HDA_FIXUP_ACT_BUILD:
2103 /* rename Capture controls depending on the codec */
2104 rename_ctl(codec, "Capture Volume",
2105 codec->addr == 0 ?
2106 "Rear-Panel Capture Volume" :
2107 "Front-Panel Capture Volume");
2108 rename_ctl(codec, "Capture Switch",
2109 codec->addr == 0 ?
2110 "Rear-Panel Capture Switch" :
2111 "Front-Panel Capture Switch");
2112 break;
2113 }
2114}
2115
Peisen0202f5c2017-10-26 10:35:36 +08002116static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2117 const struct hda_fixup *fix,
2118 int action)
2119{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002120 static const hda_nid_t conn1[] = { 0x0c };
Peisen0202f5c2017-10-26 10:35:36 +08002121
2122 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2123 return;
2124
2125 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2126 /* We therefore want to make sure 0x14 (front headphone) and
2127 * 0x1b (speakers) use the stereo DAC 0x02
2128 */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002129 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2130 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Peisen0202f5c2017-10-26 10:35:36 +08002131}
2132
Jeremy Soller7f665b12019-02-13 10:56:19 -07002133static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2134 const struct hda_fixup *fix, int action);
2135
Richard Sailer80690a22019-04-02 15:52:04 +02002136static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002137 const struct hda_fixup *fix,
2138 int action)
2139{
2140 alc1220_fixup_clevo_p950(codec, fix, action);
2141 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2142}
2143
Jian-Hong Panca184352020-10-07 13:22:25 +08002144static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2145 struct hda_jack_callback *jack)
2146{
2147 struct alc_spec *spec = codec->spec;
2148 unsigned int vref;
2149
2150 snd_hda_gen_hp_automute(codec, jack);
2151
2152 if (spec->gen.hp_jack_present)
2153 vref = AC_PINCTL_VREF_80;
2154 else
2155 vref = AC_PINCTL_VREF_HIZ;
2156 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2157}
2158
2159static void alc887_fixup_asus_jack(struct hda_codec *codec,
2160 const struct hda_fixup *fix, int action)
2161{
2162 struct alc_spec *spec = codec->spec;
2163 if (action != HDA_FIXUP_ACT_PROBE)
2164 return;
2165 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2166 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2167}
2168
Takashi Iwai1727a772013-01-10 09:52:52 +01002169static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002170 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002171 .type = HDA_FIXUP_PINS,
2172 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002173 { 0x15, 0x01080104 }, /* side */
2174 { 0x16, 0x01011012 }, /* rear */
2175 { 0x17, 0x01016011 }, /* clfe */
2176 { }
2177 }
2178 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002179 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002180 .type = HDA_FIXUP_PINS,
2181 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002182 { 0x15, 0x99130112 }, /* rear int speakers */
2183 { 0x16, 0x99130111 }, /* subwoofer */
2184 { }
2185 }
2186 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002187 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002188 .type = HDA_FIXUP_PINCTLS,
2189 .v.pins = (const struct hda_pintbl[]) {
2190 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002191 {}
2192 }
2193 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002194 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002195 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002196 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002197 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002198 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002199 .type = HDA_FIXUP_PINS,
2200 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002201 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2202 { }
2203 }
2204 },
Marton Balint8f239212012-03-05 21:33:23 +01002205 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002206 .type = HDA_FIXUP_PINS,
2207 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002208 { 0x1c, 0x993301f0 }, /* CD */
2209 { }
2210 }
2211 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002212 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2213 .type = HDA_FIXUP_PINS,
2214 .v.pins = (const struct hda_pintbl[]) {
2215 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2216 { }
2217 },
2218 .chained = true,
2219 .chain_id = ALC889_FIXUP_CD,
2220 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002221 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002222 .type = HDA_FIXUP_PINS,
2223 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002224 { 0x17, 0x90170111 }, /* hidden surround speaker */
2225 { }
2226 }
2227 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002228 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002229 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002230 .v.verbs = (const struct hda_verb[]) {
2231 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2232 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2233 { }
2234 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002235 },
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002236 [ALC886_FIXUP_EAPD] = {
2237 .type = HDA_FIXUP_VERBS,
2238 .v.verbs = (const struct hda_verb[]) {
2239 /* change to EAPD mode */
2240 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2241 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2242 { }
2243 }
2244 },
Takashi Iwai177943a32011-11-09 12:55:18 +01002245 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002246 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002247 .v.verbs = (const struct hda_verb[]) {
2248 /* change to EAPD mode */
2249 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2250 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2251 { }
2252 }
2253 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002254 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002255 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002256 .v.verbs = (const struct hda_verb[]) {
2257 /* change to EAPD mode */
2258 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2259 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2260 { }
2261 }
2262 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002263 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002264 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002265 .v.verbs = (const struct hda_verb[]) {
2266 /* eanable EAPD on Acer laptops */
2267 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2268 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2269 { }
2270 }
2271 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002272 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002273 .type = HDA_FIXUP_FUNC,
2274 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002275 },
2276 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002277 .type = HDA_FIXUP_FUNC,
2278 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002279 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002280 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002281 .type = HDA_FIXUP_FUNC,
2282 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002283 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002284 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002285 .type = HDA_FIXUP_FUNC,
2286 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002287 .chained = true,
2288 .chain_id = ALC882_FIXUP_EAPD,
2289 },
2290 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002291 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002292 .v.func = alc889_fixup_coef,
2293 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002294 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002295 .type = HDA_FIXUP_PINS,
2296 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002297 { 0x16, 0x99130111 }, /* CLFE speaker */
2298 { 0x17, 0x99130112 }, /* surround speaker */
2299 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002300 },
2301 .chained = true,
2302 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002303 },
2304 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002305 .type = HDA_FIXUP_PINS,
2306 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002307 { 0x16, 0x99130111 }, /* CLFE speaker */
2308 { 0x1b, 0x99130112 }, /* surround speaker */
2309 { }
2310 },
2311 .chained = true,
2312 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2313 },
2314 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2315 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002316 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002317 .v.verbs = (const struct hda_verb[]) {
2318 /* Enable all DACs */
2319 /* DAC DISABLE/MUTE 1? */
2320 /* setting bits 1-5 disables DAC nids 0x02-0x06
2321 * apparently. Init=0x38 */
2322 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2323 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2324 /* DAC DISABLE/MUTE 2? */
2325 /* some bit here disables the other DACs.
2326 * Init=0x4900 */
2327 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2328 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2329 /* DMIC fix
2330 * This laptop has a stereo digital microphone.
2331 * The mics are only 1cm apart which makes the stereo
2332 * useless. However, either the mic or the ALC889
2333 * makes the signal become a difference/sum signal
2334 * instead of standard stereo, which is annoying.
2335 * So instead we flip this bit which makes the
2336 * codec replicate the sum signal to both channels,
2337 * turning it into a normal mono mic.
2338 */
2339 /* DMIC_CONTROL? Init value = 0x0001 */
2340 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2341 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2342 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2343 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2344 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002345 },
2346 .chained = true,
2347 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002348 },
Takashi Iwai56710872011-11-14 17:42:11 +01002349 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002350 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002351 .v.func = alc885_fixup_macpro_gpio,
2352 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002353 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002354 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002355 .v.func = alc889_fixup_dac_route,
2356 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002357 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002358 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002359 .v.func = alc889_fixup_mbp_vref,
2360 .chained = true,
2361 .chain_id = ALC882_FIXUP_GPIO1,
2362 },
2363 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002364 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002365 .v.func = alc889_fixup_imac91_vref,
2366 .chained = true,
2367 .chain_id = ALC882_FIXUP_GPIO1,
2368 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002369 [ALC889_FIXUP_MBA11_VREF] = {
2370 .type = HDA_FIXUP_FUNC,
2371 .v.func = alc889_fixup_mba11_vref,
2372 .chained = true,
2373 .chain_id = ALC889_FIXUP_MBP_VREF,
2374 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002375 [ALC889_FIXUP_MBA21_VREF] = {
2376 .type = HDA_FIXUP_FUNC,
2377 .v.func = alc889_fixup_mba21_vref,
2378 .chained = true,
2379 .chain_id = ALC889_FIXUP_MBP_VREF,
2380 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002381 [ALC889_FIXUP_MP11_VREF] = {
2382 .type = HDA_FIXUP_FUNC,
2383 .v.func = alc889_fixup_mba11_vref,
2384 .chained = true,
2385 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2386 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002387 [ALC889_FIXUP_MP41_VREF] = {
2388 .type = HDA_FIXUP_FUNC,
2389 .v.func = alc889_fixup_mbp_vref,
2390 .chained = true,
2391 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2392 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002393 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002394 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002395 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002396 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002397 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002398 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002399 .v.func = alc882_fixup_no_primary_hp,
2400 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002401 [ALC887_FIXUP_ASUS_BASS] = {
2402 .type = HDA_FIXUP_PINS,
2403 .v.pins = (const struct hda_pintbl[]) {
2404 {0x16, 0x99130130}, /* bass speaker */
2405 {}
2406 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002407 .chained = true,
2408 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2409 },
2410 [ALC887_FIXUP_BASS_CHMAP] = {
2411 .type = HDA_FIXUP_FUNC,
2412 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002413 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002414 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2415 .type = HDA_FIXUP_FUNC,
2416 .v.func = alc1220_fixup_gb_dual_codecs,
2417 },
Peisen0202f5c2017-10-26 10:35:36 +08002418 [ALC1220_FIXUP_CLEVO_P950] = {
2419 .type = HDA_FIXUP_FUNC,
2420 .v.func = alc1220_fixup_clevo_p950,
2421 },
Richard Sailer80690a22019-04-02 15:52:04 +02002422 [ALC1220_FIXUP_CLEVO_PB51ED] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002423 .type = HDA_FIXUP_FUNC,
Richard Sailer80690a22019-04-02 15:52:04 +02002424 .v.func = alc1220_fixup_clevo_pb51ed,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002425 },
Richard Sailer80690a22019-04-02 15:52:04 +02002426 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002427 .type = HDA_FIXUP_PINS,
2428 .v.pins = (const struct hda_pintbl[]) {
2429 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2430 {}
2431 },
2432 .chained = true,
Richard Sailer80690a22019-04-02 15:52:04 +02002433 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002434 },
Jian-Hong Panca184352020-10-07 13:22:25 +08002435 [ALC887_FIXUP_ASUS_AUDIO] = {
2436 .type = HDA_FIXUP_PINS,
2437 .v.pins = (const struct hda_pintbl[]) {
2438 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2439 { 0x19, 0x22219420 },
2440 {}
2441 },
2442 },
2443 [ALC887_FIXUP_ASUS_HMIC] = {
2444 .type = HDA_FIXUP_FUNC,
2445 .v.func = alc887_fixup_asus_jack,
2446 .chained = true,
2447 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2448 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002449};
2450
2451static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002452 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2453 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002454 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002455 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2456 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2457 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2458 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002459 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2460 ALC882_FIXUP_ACER_ASPIRE_4930G),
2461 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2462 ALC882_FIXUP_ACER_ASPIRE_4930G),
2463 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2464 ALC882_FIXUP_ACER_ASPIRE_8930G),
2465 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2466 ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaib2650472021-04-28 13:26:52 +02002467 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2468 ALC882_FIXUP_ACER_ASPIRE_4930G),
2469 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002470 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2471 ALC882_FIXUP_ACER_ASPIRE_4930G),
2472 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2473 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002474 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2475 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002476 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002477 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002478 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002479 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002480 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002481 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Jian-Hong Panca184352020-10-07 13:22:25 +08002482 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002483 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002484 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002485 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaib7529c12021-04-28 13:26:53 +02002486 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2487 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002488 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002489 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002490 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002491
2492 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002493 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2494 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2495 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002496 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002497 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2498 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002499 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2500 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002501 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002502 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002503 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002504 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2505 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002506 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002507 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2508 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2509 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002510 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002511 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002512 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2513 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002514 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002515
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002516 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002517 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002518 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002519 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Christian Lachner0d45e862020-02-23 10:24:16 +01002520 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
Christian Lachnerd9e8fe02020-05-18 07:38:44 +02002521 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia0b03952020-06-16 15:21:50 +02002522 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia655e2b2020-02-17 16:19:47 +01002523 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai09926202020-12-20 09:09:43 +01002524 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai1d3aa4a2020-04-08 15:56:45 +02002525 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7dafba32020-02-12 09:10:47 +01002526 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaicc5049a2020-02-18 09:09:15 +01002527 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002528 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai26af1772021-03-03 15:23:46 +01002529 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwai63691582017-05-22 16:32:46 +02002530 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002531 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002532 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
PeiSen Hou259eb822020-05-19 08:50:12 +02002533 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002534 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2535 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2536 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002537 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Steven Clarksonaef454b2021-10-14 06:35:54 -07002538 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002539 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2540 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002541 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Tim Crawforddbfe83502021-11-01 10:21:34 -06002542 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002543 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Werner Sembach1f8d3982021-10-01 15:31:10 +02002544 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Werner Sembachcc030692021-10-01 15:31:11 +02002545 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
Takashi Iwai13e1a4c2021-04-28 13:26:54 +02002546 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2547 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2548 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2549 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2550 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2551 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2552 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2553 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2554 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2555 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2556 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2557 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002558 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2559 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002560 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002561 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002562 {}
2563};
2564
Takashi Iwai1727a772013-01-10 09:52:52 +01002565static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002566 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2567 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2568 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2569 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2570 {.id = ALC889_FIXUP_CD, .name = "cd"},
2571 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2572 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2573 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2574 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2575 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2576 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2577 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2578 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2579 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2580 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002581 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2582 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2583 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002584 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2585 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2586 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2587 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2588 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2589 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2590 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2591 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002592 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002593 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002594 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002595 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002596 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002597 {}
2598};
2599
Hui Wang119b75c2021-05-22 11:47:41 +08002600static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2601 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2602 {0x14, 0x01014010},
2603 {0x15, 0x01011012},
2604 {0x16, 0x01016011},
2605 {0x18, 0x01a19040},
2606 {0x19, 0x02a19050},
2607 {0x1a, 0x0181304f},
2608 {0x1b, 0x0221401f},
2609 {0x1e, 0x01456130}),
2610 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2611 {0x14, 0x01015010},
2612 {0x15, 0x01011012},
2613 {0x16, 0x01011011},
2614 {0x18, 0x01a11040},
2615 {0x19, 0x02a19050},
2616 {0x1a, 0x0181104f},
2617 {0x1b, 0x0221401f},
2618 {0x1e, 0x01451130}),
2619 {}
2620};
2621
Takashi Iwai1d045db2011-07-07 18:23:21 +02002622/*
2623 * BIOS auto configuration
2624 */
2625/* almost identical with ALC880 parser... */
2626static int alc882_parse_auto_config(struct hda_codec *codec)
2627{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002628 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002629 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2630 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002631}
2632
Takashi Iwai1d045db2011-07-07 18:23:21 +02002633/*
2634 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002635static int patch_alc882(struct hda_codec *codec)
2636{
2637 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002638 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002639
Takashi Iwai3de95172012-05-07 18:03:15 +02002640 err = alc_alloc_spec(codec, 0x0b);
2641 if (err < 0)
2642 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002643
Takashi Iwai3de95172012-05-07 18:03:15 +02002644 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002645
Takashi Iwai7639a062015-03-03 10:07:24 +01002646 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002647 case 0x10ec0882:
2648 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002649 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002650 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002651 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002652 break;
2653 default:
2654 /* ALC883 and variants */
2655 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2656 break;
2657 }
2658
Takashi Iwaic9af7532019-05-10 11:01:43 +02002659 alc_pre_init(codec);
2660
Takashi Iwai1727a772013-01-10 09:52:52 +01002661 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002662 alc882_fixups);
Hui Wang119b75c2021-05-22 11:47:41 +08002663 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +01002664 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002665
2666 alc_auto_parse_customize_define(codec);
2667
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002668 if (has_cdefine_beep(codec))
2669 spec->gen.beep_nid = 0x01;
2670
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002671 /* automatic parse from the BIOS config */
2672 err = alc882_parse_auto_config(codec);
2673 if (err < 0)
2674 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002675
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002676 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2677 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2678 if (err < 0)
2679 goto error;
2680 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002681
Takashi Iwai1727a772013-01-10 09:52:52 +01002682 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002683
Takashi Iwai1d045db2011-07-07 18:23:21 +02002684 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002685
2686 error:
2687 alc_free(codec);
2688 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002689}
2690
2691
2692/*
2693 * ALC262 support
2694 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002695static int alc262_parse_auto_config(struct hda_codec *codec)
2696{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002697 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002698 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2699 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002700}
2701
2702/*
2703 * Pin config fixes
2704 */
2705enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002706 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002707 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002708 ALC262_FIXUP_HP_Z200,
2709 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002710 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002711 ALC262_FIXUP_BENQ,
2712 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002713 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002714 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002715};
2716
Takashi Iwai1727a772013-01-10 09:52:52 +01002717static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002718 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002719 .type = HDA_FIXUP_PINS,
2720 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002721 { 0x14, 0x99130110 }, /* speaker */
2722 { 0x15, 0x0221142f }, /* front HP */
2723 { 0x1b, 0x0121141f }, /* rear HP */
2724 { }
2725 }
2726 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002727 [ALC262_FIXUP_FSC_S7110] = {
2728 .type = HDA_FIXUP_PINS,
2729 .v.pins = (const struct hda_pintbl[]) {
2730 { 0x15, 0x90170110 }, /* speaker */
2731 { }
2732 },
2733 .chained = true,
2734 .chain_id = ALC262_FIXUP_BENQ,
2735 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002736 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002737 .type = HDA_FIXUP_PINS,
2738 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002739 { 0x16, 0x99130120 }, /* internal speaker */
2740 { }
2741 }
2742 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002743 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002744 .type = HDA_FIXUP_PINS,
2745 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002746 { 0x14, 0x1993e1f0 }, /* int AUX */
2747 { }
2748 }
2749 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002750 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002751 .type = HDA_FIXUP_PINCTLS,
2752 .v.pins = (const struct hda_pintbl[]) {
2753 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002754 {}
2755 },
2756 .chained = true,
2757 .chain_id = ALC262_FIXUP_BENQ,
2758 },
2759 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002760 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002761 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002762 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2763 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2764 {}
2765 }
2766 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002767 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002768 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002769 .v.verbs = (const struct hda_verb[]) {
2770 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2771 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2772 {}
2773 }
2774 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002775 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002776 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002777 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002778 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002779 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2780 .type = HDA_FIXUP_FUNC,
2781 .v.func = alc_fixup_no_depop_delay,
2782 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002783};
2784
2785static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002786 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002787 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002788 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002789 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002790 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002791 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002792 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002793 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2794 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002795 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002796 {}
2797};
2798
Takashi Iwai1727a772013-01-10 09:52:52 +01002799static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002800 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002801 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2802 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2803 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2804 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2805 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2806 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2807 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2808 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002809 {}
2810};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002811
Takashi Iwai1d045db2011-07-07 18:23:21 +02002812/*
2813 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002814static int patch_alc262(struct hda_codec *codec)
2815{
2816 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002817 int err;
2818
Takashi Iwai3de95172012-05-07 18:03:15 +02002819 err = alc_alloc_spec(codec, 0x0b);
2820 if (err < 0)
2821 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002822
Takashi Iwai3de95172012-05-07 18:03:15 +02002823 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002824 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002825
Takashi Iwai225068a2015-05-29 10:42:14 +02002826 spec->shutup = alc_eapd_shutup;
2827
Takashi Iwai1d045db2011-07-07 18:23:21 +02002828#if 0
2829 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2830 * under-run
2831 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002832 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002833#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002834 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2835
Takashi Iwaic9af7532019-05-10 11:01:43 +02002836 alc_pre_init(codec);
2837
Takashi Iwai1727a772013-01-10 09:52:52 +01002838 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002839 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002840 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002841
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002842 alc_auto_parse_customize_define(codec);
2843
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002844 if (has_cdefine_beep(codec))
2845 spec->gen.beep_nid = 0x01;
2846
Takashi Iwai42399f72011-11-07 17:18:44 +01002847 /* automatic parse from the BIOS config */
2848 err = alc262_parse_auto_config(codec);
2849 if (err < 0)
2850 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002851
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002852 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2853 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2854 if (err < 0)
2855 goto error;
2856 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002857
Takashi Iwai1727a772013-01-10 09:52:52 +01002858 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002859
Takashi Iwai1d045db2011-07-07 18:23:21 +02002860 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002861
2862 error:
2863 alc_free(codec);
2864 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002865}
2866
2867/*
2868 * ALC268
2869 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002870/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002871static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2872 struct snd_ctl_elem_value *ucontrol)
2873{
2874 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2875 unsigned long pval;
2876 int err;
2877
2878 mutex_lock(&codec->control_mutex);
2879 pval = kcontrol->private_value;
2880 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2881 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2882 if (err >= 0) {
2883 kcontrol->private_value = (pval & ~0xff) | 0x10;
2884 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2885 }
2886 kcontrol->private_value = pval;
2887 mutex_unlock(&codec->control_mutex);
2888 return err;
2889}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002890
2891static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2892 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002893 {
2894 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2895 .name = "Beep Playback Switch",
2896 .subdevice = HDA_SUBDEV_AMP_FLAG,
2897 .info = snd_hda_mixer_amp_switch_info,
2898 .get = snd_hda_mixer_amp_switch_get,
2899 .put = alc268_beep_switch_put,
2900 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2901 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002902};
2903
2904/* set PCBEEP vol = 0, mute connections */
2905static const struct hda_verb alc268_beep_init_verbs[] = {
2906 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2907 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2908 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2909 { }
2910};
2911
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002912enum {
2913 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002914 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002915 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002916};
2917
Takashi Iwai1727a772013-01-10 09:52:52 +01002918static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002919 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002920 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002921 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002922 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002923 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002924 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002925 .v.verbs = (const struct hda_verb[]) {
2926 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2927 {}
2928 }
2929 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002930 [ALC268_FIXUP_SPDIF] = {
2931 .type = HDA_FIXUP_PINS,
2932 .v.pins = (const struct hda_pintbl[]) {
2933 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2934 {}
2935 }
2936 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002937};
2938
Takashi Iwai1727a772013-01-10 09:52:52 +01002939static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002940 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002941 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002942 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002943 {}
2944};
2945
2946static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002947 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002948 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002949 /* below is codec SSID since multiple Toshiba laptops have the
2950 * same PCI SSID 1179:ff00
2951 */
2952 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002953 {}
2954};
2955
Takashi Iwai1d045db2011-07-07 18:23:21 +02002956/*
2957 * BIOS auto configuration
2958 */
2959static int alc268_parse_auto_config(struct hda_codec *codec)
2960{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002961 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002962 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002963}
2964
Takashi Iwai1d045db2011-07-07 18:23:21 +02002965/*
2966 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002967static int patch_alc268(struct hda_codec *codec)
2968{
2969 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002970 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002971
Takashi Iwai1d045db2011-07-07 18:23:21 +02002972 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002973 err = alc_alloc_spec(codec, 0);
2974 if (err < 0)
2975 return err;
2976
2977 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02002978 if (has_cdefine_beep(codec))
2979 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002980
Takashi Iwai225068a2015-05-29 10:42:14 +02002981 spec->shutup = alc_eapd_shutup;
2982
Takashi Iwaic9af7532019-05-10 11:01:43 +02002983 alc_pre_init(codec);
2984
Takashi Iwai1727a772013-01-10 09:52:52 +01002985 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2986 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002987
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002988 /* automatic parse from the BIOS config */
2989 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002990 if (err < 0)
2991 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002992
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002993 if (err > 0 && !spec->gen.no_analog &&
2994 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002995 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2996 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2997 &alc268_beep_mixer[i])) {
2998 err = -ENOMEM;
2999 goto error;
3000 }
3001 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003002 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003003 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3004 /* override the amp caps for beep generator */
3005 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3006 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3007 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3008 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3009 (0 << AC_AMPCAP_MUTE_SHIFT));
3010 }
3011
Takashi Iwai1727a772013-01-10 09:52:52 +01003012 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003013
Takashi Iwai1d045db2011-07-07 18:23:21 +02003014 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02003015
3016 error:
3017 alc_free(codec);
3018 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003019}
3020
3021/*
3022 * ALC269
3023 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003024
Takashi Iwai1d045db2011-07-07 18:23:21 +02003025static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003026 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003027};
3028
3029static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003030 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003031};
3032
Takashi Iwai1d045db2011-07-07 18:23:21 +02003033/* different alc269-variants */
3034enum {
3035 ALC269_TYPE_ALC269VA,
3036 ALC269_TYPE_ALC269VB,
3037 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02003038 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01003039 ALC269_TYPE_ALC280,
3040 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02003041 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01003042 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08003043 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02003044 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08003045 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003046 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08003047 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003048 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003049 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003050 ALC269_TYPE_ALC225,
Kailang Yang99cee0342021-07-01 09:09:37 +08003051 ALC269_TYPE_ALC287,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003052 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003053 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003054 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003055 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003056};
3057
3058/*
3059 * BIOS auto configuration
3060 */
3061static int alc269_parse_auto_config(struct hda_codec *codec)
3062{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003063 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003064 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3065 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3066 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003067 const hda_nid_t *ssids;
3068
3069 switch (spec->codec_variant) {
3070 case ALC269_TYPE_ALC269VA:
3071 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003072 case ALC269_TYPE_ALC280:
3073 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003074 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003075 ssids = alc269va_ssids;
3076 break;
3077 case ALC269_TYPE_ALC269VB:
3078 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003079 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003080 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003081 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003082 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003083 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003084 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003085 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003086 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003087 case ALC269_TYPE_ALC225:
Kailang Yang99cee0342021-07-01 09:09:37 +08003088 case ALC269_TYPE_ALC287:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003089 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003090 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003091 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003092 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003093 ssids = alc269_ssids;
3094 break;
3095 default:
3096 ssids = alc269_ssids;
3097 break;
3098 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003099
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003100 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003101}
3102
Hui Wang476c02e2020-03-29 16:20:18 +08003103static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3104 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3105 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3106 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3107 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3108 {}
3109};
3110
3111static void alc_headset_btn_callback(struct hda_codec *codec,
3112 struct hda_jack_callback *jack)
3113{
3114 int report = 0;
3115
3116 if (jack->unsol_res & (7 << 13))
3117 report |= SND_JACK_BTN_0;
3118
3119 if (jack->unsol_res & (1 << 16 | 3 << 8))
3120 report |= SND_JACK_BTN_1;
3121
3122 /* Volume up key */
3123 if (jack->unsol_res & (7 << 23))
3124 report |= SND_JACK_BTN_2;
3125
3126 /* Volume down key */
3127 if (jack->unsol_res & (7 << 10))
3128 report |= SND_JACK_BTN_3;
3129
Hui Wang04f77912021-03-05 17:26:08 +08003130 snd_hda_jack_set_button_state(codec, jack->nid, report);
Hui Wang476c02e2020-03-29 16:20:18 +08003131}
3132
3133static void alc_disable_headset_jack_key(struct hda_codec *codec)
3134{
3135 struct alc_spec *spec = codec->spec;
3136
3137 if (!spec->has_hs_key)
3138 return;
3139
3140 switch (codec->core.vendor_id) {
3141 case 0x10ec0215:
3142 case 0x10ec0225:
3143 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003144 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003145 case 0x10ec0295:
3146 case 0x10ec0289:
3147 case 0x10ec0299:
3148 alc_write_coef_idx(codec, 0x48, 0x0);
3149 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3150 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3151 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02003152 case 0x10ec0230:
Hui Wang476c02e2020-03-29 16:20:18 +08003153 case 0x10ec0236:
3154 case 0x10ec0256:
3155 alc_write_coef_idx(codec, 0x48, 0x0);
3156 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3157 break;
3158 }
3159}
3160
3161static void alc_enable_headset_jack_key(struct hda_codec *codec)
3162{
3163 struct alc_spec *spec = codec->spec;
3164
3165 if (!spec->has_hs_key)
3166 return;
3167
3168 switch (codec->core.vendor_id) {
3169 case 0x10ec0215:
3170 case 0x10ec0225:
3171 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003172 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003173 case 0x10ec0295:
3174 case 0x10ec0289:
3175 case 0x10ec0299:
3176 alc_write_coef_idx(codec, 0x48, 0xd011);
3177 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3178 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3179 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02003180 case 0x10ec0230:
Hui Wang476c02e2020-03-29 16:20:18 +08003181 case 0x10ec0236:
3182 case 0x10ec0256:
3183 alc_write_coef_idx(codec, 0x48, 0xd011);
3184 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3185 break;
3186 }
3187}
3188
3189static void alc_fixup_headset_jack(struct hda_codec *codec,
3190 const struct hda_fixup *fix, int action)
3191{
3192 struct alc_spec *spec = codec->spec;
Hui Wang04f77912021-03-05 17:26:08 +08003193 hda_nid_t hp_pin;
Hui Wang476c02e2020-03-29 16:20:18 +08003194
3195 switch (action) {
3196 case HDA_FIXUP_ACT_PRE_PROBE:
3197 spec->has_hs_key = 1;
3198 snd_hda_jack_detect_enable_callback(codec, 0x55,
3199 alc_headset_btn_callback);
Hui Wang476c02e2020-03-29 16:20:18 +08003200 break;
Hui Wang04f77912021-03-05 17:26:08 +08003201 case HDA_FIXUP_ACT_BUILD:
3202 hp_pin = alc_get_hp_pin(spec);
3203 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3204 alc_headset_btn_keymap,
3205 hp_pin))
3206 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3207 false, SND_JACK_HEADSET,
3208 alc_headset_btn_keymap);
3209
Hui Wang476c02e2020-03-29 16:20:18 +08003210 alc_enable_headset_jack_key(codec);
3211 break;
3212 }
3213}
3214
Kailang Yang1387e2d2012-11-08 10:23:18 +01003215static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003216{
Takashi Iwai98b24882014-08-18 13:47:50 +02003217 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003218}
3219
3220static void alc269_shutup(struct hda_codec *codec)
3221{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003222 struct alc_spec *spec = codec->spec;
3223
Kailang Yang1387e2d2012-11-08 10:23:18 +01003224 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3225 alc269vb_toggle_power_output(codec, 0);
3226 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3227 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003228 msleep(150);
3229 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003230 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003231}
3232
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003233static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003234 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003235 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003236 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3237 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3238 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3239 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3240 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3241 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3242 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3243 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3244 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3245 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3246 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3247 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3248 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3249 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3250 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3251 WRITE_COEF(0x63, 0x2902), /* PLL */
3252 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3253 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3254 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3255 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3256 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3257 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3258 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3259 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3260 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3261 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3262 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3263 {}
3264};
3265
Kailang Yangcb149cb2014-03-18 16:45:32 +08003266static void alc282_restore_default_value(struct hda_codec *codec)
3267{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003268 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003269}
3270
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003271static void alc282_init(struct hda_codec *codec)
3272{
3273 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003274 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003275 bool hp_pin_sense;
3276 int coef78;
3277
Kailang Yangcb149cb2014-03-18 16:45:32 +08003278 alc282_restore_default_value(codec);
3279
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003280 if (!hp_pin)
3281 return;
3282 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3283 coef78 = alc_read_coef_idx(codec, 0x78);
3284
3285 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3286 /* Headphone capless set to high power mode */
3287 alc_write_coef_idx(codec, 0x78, 0x9004);
3288
3289 if (hp_pin_sense)
3290 msleep(2);
3291
3292 snd_hda_codec_write(codec, hp_pin, 0,
3293 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3294
3295 if (hp_pin_sense)
3296 msleep(85);
3297
3298 snd_hda_codec_write(codec, hp_pin, 0,
3299 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3300
3301 if (hp_pin_sense)
3302 msleep(100);
3303
3304 /* Headphone capless set to normal mode */
3305 alc_write_coef_idx(codec, 0x78, coef78);
3306}
3307
3308static void alc282_shutup(struct hda_codec *codec)
3309{
3310 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003311 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003312 bool hp_pin_sense;
3313 int coef78;
3314
3315 if (!hp_pin) {
3316 alc269_shutup(codec);
3317 return;
3318 }
3319
3320 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3321 coef78 = alc_read_coef_idx(codec, 0x78);
3322 alc_write_coef_idx(codec, 0x78, 0x9004);
3323
3324 if (hp_pin_sense)
3325 msleep(2);
3326
3327 snd_hda_codec_write(codec, hp_pin, 0,
3328 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3329
3330 if (hp_pin_sense)
3331 msleep(85);
3332
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003333 if (!spec->no_shutup_pins)
3334 snd_hda_codec_write(codec, hp_pin, 0,
3335 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003336
3337 if (hp_pin_sense)
3338 msleep(100);
3339
3340 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003341 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003342 alc_write_coef_idx(codec, 0x78, coef78);
3343}
3344
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003345static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003346 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003347 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003348 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3349 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3350 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3351 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3352 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3353 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3354 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3355 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3356 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3357 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3358 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3359 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3360 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3361 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3362 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3363 WRITE_COEF(0x2e, 0x2902), /* PLL */
3364 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3365 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3366 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3367 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3368 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3369 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3370 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3371 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3372 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3373 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3374 WRITE_COEF(0x49, 0x0), /* test mode */
3375 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3376 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3377 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003378 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003379 {}
3380};
3381
Kailang Yang6bd55b02014-03-17 13:51:27 +08003382static void alc283_restore_default_value(struct hda_codec *codec)
3383{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003384 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003385}
3386
Kailang Yang2af02be2013-08-22 10:03:50 +02003387static void alc283_init(struct hda_codec *codec)
3388{
3389 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003390 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003391 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003392
Kailang Yang6bd55b02014-03-17 13:51:27 +08003393 alc283_restore_default_value(codec);
3394
Kailang Yang2af02be2013-08-22 10:03:50 +02003395 if (!hp_pin)
3396 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003397
3398 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003399 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3400
3401 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3402 /* Headphone capless set to high power mode */
3403 alc_write_coef_idx(codec, 0x43, 0x9004);
3404
3405 snd_hda_codec_write(codec, hp_pin, 0,
3406 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3407
3408 if (hp_pin_sense)
3409 msleep(85);
3410
3411 snd_hda_codec_write(codec, hp_pin, 0,
3412 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3413
3414 if (hp_pin_sense)
3415 msleep(85);
3416 /* Index 0x46 Combo jack auto switch control 2 */
3417 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003418 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003419 /* Headphone capless set to normal mode */
3420 alc_write_coef_idx(codec, 0x43, 0x9614);
3421}
3422
3423static void alc283_shutup(struct hda_codec *codec)
3424{
3425 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003426 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003427 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003428
3429 if (!hp_pin) {
3430 alc269_shutup(codec);
3431 return;
3432 }
3433
3434 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3435
3436 alc_write_coef_idx(codec, 0x43, 0x9004);
3437
Harsha Priyab450b172014-10-09 11:04:56 +00003438 /*depop hp during suspend*/
3439 alc_write_coef_idx(codec, 0x06, 0x2100);
3440
Kailang Yang2af02be2013-08-22 10:03:50 +02003441 snd_hda_codec_write(codec, hp_pin, 0,
3442 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3443
3444 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003445 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003446
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003447 if (!spec->no_shutup_pins)
3448 snd_hda_codec_write(codec, hp_pin, 0,
3449 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003450
Takashi Iwai98b24882014-08-18 13:47:50 +02003451 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003452
3453 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003454 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003455 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003456 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003457 alc_write_coef_idx(codec, 0x43, 0x9614);
3458}
3459
Kailang Yang4a219ef2017-06-16 16:54:35 +08003460static void alc256_init(struct hda_codec *codec)
3461{
3462 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003463 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003464 bool hp_pin_sense;
3465
3466 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003467 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003468
3469 msleep(30);
3470
3471 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3472
3473 if (hp_pin_sense)
3474 msleep(2);
3475
3476 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003477 if (spec->ultra_low_power) {
3478 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3479 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3480 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3481 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3482 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3483 msleep(30);
3484 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003485
3486 snd_hda_codec_write(codec, hp_pin, 0,
3487 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3488
Kailang Yang6447c962019-05-08 16:27:03 +08003489 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003490 msleep(85);
3491
3492 snd_hda_codec_write(codec, hp_pin, 0,
3493 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3494
Kailang Yang6447c962019-05-08 16:27:03 +08003495 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003496 msleep(100);
3497
3498 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3499 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003500 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3501 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003502 /*
3503 * Expose headphone mic (or possibly Line In on some machines) instead
3504 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3505 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3506 * this register.
3507 */
3508 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003509}
3510
3511static void alc256_shutup(struct hda_codec *codec)
3512{
3513 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003514 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003515 bool hp_pin_sense;
3516
Kailang Yang6447c962019-05-08 16:27:03 +08003517 if (!hp_pin)
3518 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003519
3520 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3521
3522 if (hp_pin_sense)
3523 msleep(2);
3524
3525 snd_hda_codec_write(codec, hp_pin, 0,
3526 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3527
Kailang Yang6447c962019-05-08 16:27:03 +08003528 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003529 msleep(85);
3530
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003531 /* 3k pull low control for Headset jack. */
3532 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003533 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3534 * when booting with headset plugged. So skip setting it for the codec alc257
3535 */
Kailang Yang5aec9892021-10-05 14:35:14 +08003536 if (spec->codec_variant != ALC269_TYPE_ALC257 &&
3537 spec->codec_variant != ALC269_TYPE_ALC256)
Hui Wang3f742492020-09-14 14:51:18 +08003538 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003539
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003540 if (!spec->no_shutup_pins)
3541 snd_hda_codec_write(codec, hp_pin, 0,
3542 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003543
Kailang Yang6447c962019-05-08 16:27:03 +08003544 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003545 msleep(100);
3546
3547 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003548 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003549 if (spec->ultra_low_power) {
3550 msleep(50);
3551 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3552 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3553 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3554 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3555 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3556 msleep(30);
3557 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003558}
3559
Kailang Yang3c24e482021-07-01 09:33:33 +08003560static void alc285_hp_init(struct hda_codec *codec)
3561{
3562 struct alc_spec *spec = codec->spec;
3563 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3564 int i, val;
3565 int coef38, coef0d, coef36;
3566
3567 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3568 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3569 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3570 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3571 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3572 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3573
3574 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3575
3576 if (hp_pin)
3577 snd_hda_codec_write(codec, hp_pin, 0,
3578 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3579
3580 msleep(130);
3581 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3582 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3583
3584 if (hp_pin)
3585 snd_hda_codec_write(codec, hp_pin, 0,
3586 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3587 msleep(10);
3588 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3589 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3590 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3591 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3592
3593 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3594 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3595 for (i = 0; i < 20 && val & 0x8000; i++) {
3596 msleep(50);
3597 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3598 } /* Wait for depop procedure finish */
3599
3600 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3601 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3602 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3603 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3604
3605 msleep(50);
3606 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3607}
3608
Kailang Yangda911b12018-01-05 16:50:08 +08003609static void alc225_init(struct hda_codec *codec)
3610{
3611 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003612 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003613 bool hp1_pin_sense, hp2_pin_sense;
3614
Kailang Yang3c24e482021-07-01 09:33:33 +08003615 if (spec->codec_variant != ALC269_TYPE_ALC287)
3616 /* required only at boot or S3 and S4 resume time */
3617 if (!spec->done_hp_init ||
3618 is_s3_resume(codec) ||
3619 is_s4_resume(codec)) {
3620 alc285_hp_init(codec);
3621 spec->done_hp_init = true;
3622 }
3623
Kailang Yangda911b12018-01-05 16:50:08 +08003624 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003625 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003626 msleep(30);
3627
3628 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3629 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3630
3631 if (hp1_pin_sense || hp2_pin_sense)
3632 msleep(2);
3633
3634 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003635 if (spec->ultra_low_power) {
3636 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3637 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3638 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3639 msleep(30);
3640 }
Kailang Yangda911b12018-01-05 16:50:08 +08003641
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003642 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003643 snd_hda_codec_write(codec, hp_pin, 0,
3644 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3645 if (hp2_pin_sense)
3646 snd_hda_codec_write(codec, 0x16, 0,
3647 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3648
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003649 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003650 msleep(85);
3651
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003652 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003653 snd_hda_codec_write(codec, hp_pin, 0,
3654 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3655 if (hp2_pin_sense)
3656 snd_hda_codec_write(codec, 0x16, 0,
3657 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3658
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003659 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003660 msleep(100);
3661
3662 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3663 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3664}
3665
3666static void alc225_shutup(struct hda_codec *codec)
3667{
3668 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003669 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003670 bool hp1_pin_sense, hp2_pin_sense;
3671
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003672 if (!hp_pin)
3673 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003674
3675 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003676 /* 3k pull low control for Headset jack. */
3677 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3678
3679 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3680 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3681
3682 if (hp1_pin_sense || hp2_pin_sense)
3683 msleep(2);
3684
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003685 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003686 snd_hda_codec_write(codec, hp_pin, 0,
3687 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3688 if (hp2_pin_sense)
3689 snd_hda_codec_write(codec, 0x16, 0,
3690 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3691
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003692 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003693 msleep(85);
3694
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003695 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003696 snd_hda_codec_write(codec, hp_pin, 0,
3697 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3698 if (hp2_pin_sense)
3699 snd_hda_codec_write(codec, 0x16, 0,
3700 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3701
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003702 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003703 msleep(100);
3704
3705 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003706 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003707 if (spec->ultra_low_power) {
3708 msleep(50);
3709 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3710 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3711 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3712 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3713 msleep(30);
3714 }
Hui Wang476c02e2020-03-29 16:20:18 +08003715
3716 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3717 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003718}
3719
Kailang Yangc2d6af52017-06-21 14:50:54 +08003720static void alc_default_init(struct hda_codec *codec)
3721{
3722 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003723 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003724 bool hp_pin_sense;
3725
3726 if (!hp_pin)
3727 return;
3728
3729 msleep(30);
3730
3731 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3732
3733 if (hp_pin_sense)
3734 msleep(2);
3735
3736 snd_hda_codec_write(codec, hp_pin, 0,
3737 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3738
3739 if (hp_pin_sense)
3740 msleep(85);
3741
3742 snd_hda_codec_write(codec, hp_pin, 0,
3743 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3744
3745 if (hp_pin_sense)
3746 msleep(100);
3747}
3748
3749static void alc_default_shutup(struct hda_codec *codec)
3750{
3751 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003752 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003753 bool hp_pin_sense;
3754
3755 if (!hp_pin) {
3756 alc269_shutup(codec);
3757 return;
3758 }
3759
3760 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3761
3762 if (hp_pin_sense)
3763 msleep(2);
3764
3765 snd_hda_codec_write(codec, hp_pin, 0,
3766 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3767
3768 if (hp_pin_sense)
3769 msleep(85);
3770
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003771 if (!spec->no_shutup_pins)
3772 snd_hda_codec_write(codec, hp_pin, 0,
3773 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003774
3775 if (hp_pin_sense)
3776 msleep(100);
3777
3778 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003779 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003780}
3781
Kailang Yang693abe12019-01-29 15:38:21 +08003782static void alc294_hp_init(struct hda_codec *codec)
3783{
3784 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003785 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003786 int i, val;
3787
3788 if (!hp_pin)
3789 return;
3790
3791 snd_hda_codec_write(codec, hp_pin, 0,
3792 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3793
3794 msleep(100);
3795
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003796 if (!spec->no_shutup_pins)
3797 snd_hda_codec_write(codec, hp_pin, 0,
3798 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003799
3800 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3801 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3802
3803 /* Wait for depop procedure finish */
3804 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3805 for (i = 0; i < 20 && val & 0x0080; i++) {
3806 msleep(50);
3807 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3808 }
3809 /* Set HP depop to auto mode */
3810 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3811 msleep(50);
3812}
3813
3814static void alc294_init(struct hda_codec *codec)
3815{
3816 struct alc_spec *spec = codec->spec;
3817
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003818 /* required only at boot or S4 resume time */
3819 if (!spec->done_hp_init ||
3820 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003821 alc294_hp_init(codec);
3822 spec->done_hp_init = true;
3823 }
3824 alc_default_init(codec);
3825}
3826
Kailang Yangad60d502013-06-28 12:03:01 +02003827static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3828 unsigned int val)
3829{
3830 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3831 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3832 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3833}
3834
3835static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3836{
3837 unsigned int val;
3838
3839 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3840 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3841 & 0xffff;
3842 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3843 << 16;
3844 return val;
3845}
3846
3847static void alc5505_dsp_halt(struct hda_codec *codec)
3848{
3849 unsigned int val;
3850
3851 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3852 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3853 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3854 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3855 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3856 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3857 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3858 val = alc5505_coef_get(codec, 0x6220);
3859 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3860}
3861
3862static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3863{
3864 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3865 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3866 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3867 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3868 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3869 alc5505_coef_set(codec, 0x880c, 0x00000004);
3870}
3871
3872static void alc5505_dsp_init(struct hda_codec *codec)
3873{
3874 unsigned int val;
3875
3876 alc5505_dsp_halt(codec);
3877 alc5505_dsp_back_from_halt(codec);
3878 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3879 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3880 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3881 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3882 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3883 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3884 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3885 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3886 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3887 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3888 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3889 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3890 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3891
3892 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3893 if (val <= 3)
3894 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3895 else
3896 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3897
3898 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3899 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3900 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3901 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3902 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3903 alc5505_coef_set(codec, 0x880c, 0x00000003);
3904 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003905
3906#ifdef HALT_REALTEK_ALC5505
3907 alc5505_dsp_halt(codec);
3908#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003909}
3910
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003911#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003912#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3913#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003914#else
3915#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3916#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3917#endif
3918
Takashi Iwai2a439522011-07-26 09:52:50 +02003919#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003920static int alc269_suspend(struct hda_codec *codec)
3921{
3922 struct alc_spec *spec = codec->spec;
3923
3924 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003925 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003926 return alc_suspend(codec);
3927}
3928
Takashi Iwai1d045db2011-07-07 18:23:21 +02003929static int alc269_resume(struct hda_codec *codec)
3930{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003931 struct alc_spec *spec = codec->spec;
3932
Kailang Yang1387e2d2012-11-08 10:23:18 +01003933 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3934 alc269vb_toggle_power_output(codec, 0);
3935 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003936 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003937 msleep(150);
3938 }
3939
3940 codec->patch_ops.init(codec);
3941
Kailang Yang1387e2d2012-11-08 10:23:18 +01003942 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3943 alc269vb_toggle_power_output(codec, 1);
3944 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003945 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003946 msleep(200);
3947 }
3948
Takashi Iwai1a462be2020-01-09 10:01:04 +01003949 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003950 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003951
3952 /* on some machine, the BIOS will clear the codec gpio data when enter
3953 * suspend, and won't restore the data after resume, so we restore it
3954 * in the driver.
3955 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003956 if (spec->gpio_data)
3957 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003958
Kailang Yangad60d502013-06-28 12:03:01 +02003959 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003960 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003961
Takashi Iwai1d045db2011-07-07 18:23:21 +02003962 return 0;
3963}
Takashi Iwai2a439522011-07-26 09:52:50 +02003964#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003965
David Henningsson108cc102012-07-20 10:37:25 +02003966static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003967 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003968{
3969 struct alc_spec *spec = codec->spec;
3970
Takashi Iwai1727a772013-01-10 09:52:52 +01003971 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003972 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3973}
3974
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003975static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3976 const struct hda_fixup *fix,
3977 int action)
3978{
3979 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3980 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3981
3982 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3983 snd_hda_codec_set_pincfg(codec, 0x19,
3984 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3985 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3986}
3987
Takashi Iwai1d045db2011-07-07 18:23:21 +02003988static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003989 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003990{
Takashi Iwai98b24882014-08-18 13:47:50 +02003991 if (action == HDA_FIXUP_ACT_INIT)
3992 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003993}
3994
David Henningsson7c478f02013-10-11 10:18:46 +02003995static void alc269_fixup_headset_mic(struct hda_codec *codec,
3996 const struct hda_fixup *fix, int action)
3997{
3998 struct alc_spec *spec = codec->spec;
3999
4000 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4001 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4002}
4003
Takashi Iwai1d045db2011-07-07 18:23:21 +02004004static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004005 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02004006{
4007 static const struct hda_verb verbs[] = {
4008 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4009 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4010 {}
4011 };
4012 unsigned int cfg;
4013
Takashi Iwai7639a062015-03-03 10:07:24 +01004014 if (strcmp(codec->core.chip_name, "ALC271X") &&
4015 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02004016 return;
4017 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4018 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4019 snd_hda_sequence_write(codec, verbs);
4020}
4021
Takashi Iwaic8426b22021-04-07 11:57:30 +02004022/* Fix the speaker amp after resume, etc */
4023static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4024 const struct hda_fixup *fix,
4025 int action)
4026{
4027 if (action == HDA_FIXUP_ACT_INIT)
4028 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4029}
4030
Takashi Iwai017f2a12011-07-09 14:42:25 +02004031static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004032 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02004033{
4034 struct alc_spec *spec = codec->spec;
4035
Takashi Iwai1727a772013-01-10 09:52:52 +01004036 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02004037 return;
4038
4039 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4040 * fix the sample rate of analog I/O to 44.1kHz
4041 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01004042 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4043 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02004044}
4045
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004046static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004047 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004048{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004049 /* The digital-mic unit sends PDM (differential signal) instead of
4050 * the standard PCM, thus you can't record a valid mono stream as is.
4051 * Below is a workaround specific to ALC269 to control the dmic
4052 * signal source as mono.
4053 */
Takashi Iwai98b24882014-08-18 13:47:50 +02004054 if (action == HDA_FIXUP_ACT_INIT)
4055 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004056}
4057
Takashi Iwai24519912011-08-16 15:08:49 +02004058static void alc269_quanta_automute(struct hda_codec *codec)
4059{
Takashi Iwai08c189f2012-12-19 15:22:24 +01004060 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02004061
Takashi Iwai1687ccc2014-08-18 13:49:35 +02004062 alc_write_coef_idx(codec, 0x0c, 0x680);
4063 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02004064}
4065
4066static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004067 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02004068{
4069 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01004070 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02004071 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01004072 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02004073}
4074
David Henningssond240d1d2013-04-15 12:50:02 +02004075static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004076 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02004077{
4078 struct alc_spec *spec = codec->spec;
4079 int vref;
4080 msleep(200);
4081 snd_hda_gen_hp_automute(codec, jack);
4082
4083 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4084 msleep(100);
4085 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4086 vref);
4087 msleep(500);
4088 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4089 vref);
4090}
4091
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02004092/*
4093 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4094 */
4095struct hda_alc298_mbxinit {
4096 unsigned char value_0x23;
4097 unsigned char value_0x25;
4098};
4099
4100static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4101 const struct hda_alc298_mbxinit *initval,
4102 bool first)
4103{
4104 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4105 alc_write_coef_idx(codec, 0x26, 0xb000);
4106
4107 if (first)
4108 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4109
4110 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4111 alc_write_coef_idx(codec, 0x26, 0xf000);
4112 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4113
4114 if (initval->value_0x23 != 0x1e)
4115 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4116
4117 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4118 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4119}
4120
4121static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4122 const struct hda_fixup *fix,
4123 int action)
4124{
4125 /* Initialization magic */
4126 static const struct hda_alc298_mbxinit dac_init[] = {
4127 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4128 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4129 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4130 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4131 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4132 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4133 {0x2f, 0x00},
4134 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4135 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4136 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4137 {}
4138 };
4139 const struct hda_alc298_mbxinit *seq;
4140
4141 if (action != HDA_FIXUP_ACT_INIT)
4142 return;
4143
4144 /* Start */
4145 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4146 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4147 alc_write_coef_idx(codec, 0x26, 0xf000);
4148 alc_write_coef_idx(codec, 0x22, 0x31);
4149 alc_write_coef_idx(codec, 0x23, 0x0b);
4150 alc_write_coef_idx(codec, 0x25, 0x00);
4151 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4152 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4153
4154 for (seq = dac_init; seq->value_0x23; seq++)
4155 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4156}
4157
David Henningssond240d1d2013-04-15 12:50:02 +02004158static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4159 const struct hda_fixup *fix, int action)
4160{
4161 struct alc_spec *spec = codec->spec;
4162 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4163 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4164 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4165 }
4166}
4167
Takashi Iwai766538a2020-06-18 13:08:41 +02004168static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4169 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004170{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004171 unsigned int pinval;
4172
Takashi Iwai766538a2020-06-18 13:08:41 +02004173 if (!pin)
4174 return;
4175 if (polarity)
4176 on = !on;
4177 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004178 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004179 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4180 /* temporarily power up/down for setting VREF */
4181 snd_hda_power_up_pm(codec);
4182 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4183 snd_hda_power_down_pm(codec);
4184}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004185
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004186/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004187static int vref_mute_led_set(struct led_classdev *led_cdev,
4188 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004189{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004190 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004191 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004192
Takashi Iwai766538a2020-06-18 13:08:41 +02004193 alc_update_vref_led(codec, spec->mute_led_nid,
4194 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004195 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004196}
4197
David Henningssond5b6b652013-11-06 10:50:44 +01004198/* Make sure the led works even in runtime suspend */
4199static unsigned int led_power_filter(struct hda_codec *codec,
4200 hda_nid_t nid,
4201 unsigned int power_state)
4202{
4203 struct alc_spec *spec = codec->spec;
4204
Hui Wang50dd9052014-07-08 17:56:15 +08004205 if (power_state != AC_PWRST_D3 || nid == 0 ||
4206 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004207 return power_state;
4208
4209 /* Set pin ctl again, it might have just been set to 0 */
4210 snd_hda_set_pin_ctl(codec, nid,
4211 snd_hda_codec_get_pin_target(codec, nid));
4212
Takashi Iwaicffd3962015-04-09 10:30:25 +02004213 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004214}
4215
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004216static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4217 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004218{
4219 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004220 const struct dmi_device *dev = NULL;
4221
4222 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4223 return;
4224
4225 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4226 int pol, pin;
4227 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4228 continue;
4229 if (pin < 0x0a || pin >= 0x10)
4230 break;
4231 spec->mute_led_polarity = pol;
4232 spec->mute_led_nid = pin - 0x0a + 0x18;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004233 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004234 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004235 codec_dbg(codec,
4236 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004237 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004238 break;
4239 }
4240}
4241
Takashi Iwai85c467d2018-05-29 11:38:38 +02004242static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4243 const struct hda_fixup *fix,
4244 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004245{
4246 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004247
David Henningssond06ac142013-02-18 11:41:55 +01004248 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4249 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004250 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004251 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004252 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004253 }
4254}
4255
Takashi Iwai85c467d2018-05-29 11:38:38 +02004256static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4257 const struct hda_fixup *fix, int action)
4258{
4259 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4260}
4261
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004262static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4263 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004264{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004265 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004266}
4267
Tom Briden7f783bd2017-03-25 10:12:01 +00004268static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4269 const struct hda_fixup *fix, int action)
4270{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004271 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004272}
4273
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004274/* update LED status via GPIO */
4275static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004276 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004277{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004278 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004279 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004280 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004281}
4282
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004283/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004284static int gpio_mute_led_set(struct led_classdev *led_cdev,
4285 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004286{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004287 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004288 struct alc_spec *spec = codec->spec;
4289
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004290 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004291 spec->mute_led_polarity, !brightness);
4292 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004293}
4294
4295/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004296static int micmute_led_set(struct led_classdev *led_cdev,
4297 enum led_brightness brightness)
4298{
4299 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4300 struct alc_spec *spec = codec->spec;
4301
4302 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004303 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004304 return 0;
4305}
4306
Takashi Iwai01e4a272018-06-19 22:47:30 +02004307/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4308static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4309 int action,
4310 unsigned int mute_mask,
4311 unsigned int micmute_mask)
4312{
4313 struct alc_spec *spec = codec->spec;
4314
4315 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4316
4317 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4318 return;
4319 if (mute_mask) {
4320 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004321 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004322 }
4323 if (micmute_mask) {
4324 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004325 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004326 }
4327}
4328
Jeremy Szue7d66cf2021-03-16 15:46:24 +08004329static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4330 const struct hda_fixup *fix, int action)
4331{
4332 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4333}
4334
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004335static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4336 const struct hda_fixup *fix, int action)
4337{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004338 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004339}
4340
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004341static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4342 const struct hda_fixup *fix, int action)
4343{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004344 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004345}
4346
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004347static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4348 const struct hda_fixup *fix, int action)
4349{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004350 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004351}
4352
Kailang Yanga0ccbc52020-11-06 15:20:38 +08004353static void alc287_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, 0x10, 0);
4357}
4358
Johnathon Clark5fc462c2021-10-20 14:12:51 +01004359static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4360 const struct hda_fixup *fix, int action)
4361{
4362 struct alc_spec *spec = codec->spec;
4363
4364 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4365 spec->micmute_led_polarity = 1;
4366 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4367}
4368
Takashi Iwai8a503552020-06-18 13:08:32 +02004369/* turn on/off mic-mute LED per capture hook via VREF change */
4370static int vref_micmute_led_set(struct led_classdev *led_cdev,
4371 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004372{
Takashi Iwai8a503552020-06-18 13:08:32 +02004373 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004374 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004375
Takashi Iwai766538a2020-06-18 13:08:41 +02004376 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4377 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004378 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004379}
4380
4381static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4382 const struct hda_fixup *fix, int action)
4383{
4384 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004385
Takashi Iwai01e4a272018-06-19 22:47:30 +02004386 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004387 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004388 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4389 * enable headphone amp
4390 */
4391 spec->gpio_mask |= 0x10;
4392 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004393 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004394 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004395 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004396 }
4397}
4398
David Henningsson7a5255f2014-10-30 08:26:01 +01004399static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4400 const struct hda_fixup *fix, int action)
4401{
David Henningsson7a5255f2014-10-30 08:26:01 +01004402 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004403
Takashi Iwai01e4a272018-06-19 22:47:30 +02004404 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004405 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004406 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004407 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004408 codec->power_filter = led_power_filter;
4409 }
4410}
4411
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01004412/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4413 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4414 */
4415static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4416 const struct hda_fixup *fix, int action)
4417{
4418 struct alc_spec *spec = codec->spec;
4419
4420 switch (action) {
4421 case HDA_FIXUP_ACT_PRE_PROBE:
4422 spec->gpio_mask |= 0x01;
4423 spec->gpio_dir |= 0x01;
4424 break;
4425 case HDA_FIXUP_ACT_INIT:
4426 /* need to toggle GPIO to enable the amp */
4427 alc_update_gpio_data(codec, 0x01, true);
4428 msleep(100);
4429 alc_update_gpio_data(codec, 0x01, false);
4430 break;
4431 }
4432}
4433
Takashi Iwai622464c2021-05-04 11:18:02 +02004434/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4435static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4436 struct hda_codec *codec,
4437 struct snd_pcm_substream *substream,
4438 int action)
4439{
4440 switch (action) {
4441 case HDA_GEN_PCM_ACT_PREPARE:
4442 alc_update_gpio_data(codec, 0x04, true);
4443 break;
4444 case HDA_GEN_PCM_ACT_CLEANUP:
4445 alc_update_gpio_data(codec, 0x04, false);
4446 break;
4447 }
4448}
4449
4450static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4451 const struct hda_fixup *fix,
4452 int action)
4453{
4454 struct alc_spec *spec = codec->spec;
4455
4456 if (action == HDA_FIXUP_ACT_PROBE) {
4457 spec->gpio_mask |= 0x04;
4458 spec->gpio_dir |= 0x04;
4459 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4460 }
4461}
4462
Takashi Iwai766538a2020-06-18 13:08:41 +02004463static void alc_update_coef_led(struct hda_codec *codec,
4464 struct alc_coef_led *led,
4465 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004466{
Takashi Iwai766538a2020-06-18 13:08:41 +02004467 if (polarity)
4468 on = !on;
4469 /* temporarily power up/down for setting COEF bit */
4470 alc_update_coef_idx(codec, led->idx, led->mask,
4471 on ? led->on : led->off);
4472}
4473
Kailang Yang431e76c2020-04-07 14:40:20 +08004474/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004475static int coef_mute_led_set(struct led_classdev *led_cdev,
4476 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004477{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004478 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004479 struct alc_spec *spec = codec->spec;
4480
Takashi Iwai766538a2020-06-18 13:08:41 +02004481 alc_update_coef_led(codec, &spec->mute_led_coef,
4482 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004483 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004484}
4485
4486static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4487 const struct hda_fixup *fix,
4488 int action)
4489{
4490 struct alc_spec *spec = codec->spec;
4491
4492 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4493 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004494 spec->mute_led_coef.idx = 0x0b;
4495 spec->mute_led_coef.mask = 1 << 3;
4496 spec->mute_led_coef.on = 1 << 3;
4497 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004498 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004499 }
4500}
4501
Kailang Yang24164f42020-04-07 14:52:42 +08004502static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4503 const struct hda_fixup *fix,
4504 int action)
4505{
4506 struct alc_spec *spec = codec->spec;
4507
4508 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4509 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004510 spec->mute_led_coef.idx = 0x34;
4511 spec->mute_led_coef.mask = 1 << 5;
4512 spec->mute_led_coef.on = 0;
4513 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004514 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004515 }
4516}
4517
Kailang Yang431e76c2020-04-07 14:40:20 +08004518/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004519static int coef_micmute_led_set(struct led_classdev *led_cdev,
4520 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004521{
Takashi Iwai8a503552020-06-18 13:08:32 +02004522 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004523 struct alc_spec *spec = codec->spec;
4524
Takashi Iwai766538a2020-06-18 13:08:41 +02004525 alc_update_coef_led(codec, &spec->mic_led_coef,
4526 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004527 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004528}
4529
4530static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4531 const struct hda_fixup *fix, int action)
4532{
4533 struct alc_spec *spec = codec->spec;
4534
4535 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004536 spec->mic_led_coef.idx = 0x19;
4537 spec->mic_led_coef.mask = 1 << 13;
4538 spec->mic_led_coef.on = 1 << 13;
4539 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004540 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004541 }
4542}
4543
Kailang Yang24164f42020-04-07 14:52:42 +08004544static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4545 const struct hda_fixup *fix, int action)
4546{
4547 struct alc_spec *spec = codec->spec;
4548
4549 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004550 spec->mic_led_coef.idx = 0x35;
4551 spec->mic_led_coef.mask = 3 << 2;
4552 spec->mic_led_coef.on = 2 << 2;
4553 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004554 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004555 }
4556}
4557
Kailang Yang431e76c2020-04-07 14:40:20 +08004558static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4559 const struct hda_fixup *fix, int action)
4560{
4561 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4562 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4563}
4564
Kailang Yang24164f42020-04-07 14:52:42 +08004565static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4566 const struct hda_fixup *fix, int action)
4567{
4568 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4569 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4570}
4571
Jonas Witschel75b62ab2021-04-16 12:58:54 +02004572static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4573 const struct hda_fixup *fix, int action)
4574{
4575 struct alc_spec *spec = codec->spec;
4576
4577 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4578 spec->cap_mute_led_nid = 0x1a;
4579 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4580 codec->power_filter = led_power_filter;
4581 }
4582}
4583
4584static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4585 const struct hda_fixup *fix, int action)
4586{
4587 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4588 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4589}
4590
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004591#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004592static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4593 struct hda_jack_callback *event)
4594{
4595 struct alc_spec *spec = codec->spec;
4596
4597 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4598 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004599 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004600 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004601 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004602 input_sync(spec->kb_dev);
4603}
David Henningsson33f4acd2015-01-07 15:50:13 +01004604
Kailang3694cb22015-12-28 11:35:24 +08004605static int alc_register_micmute_input_device(struct hda_codec *codec)
4606{
4607 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004608 int i;
Kailang3694cb22015-12-28 11:35:24 +08004609
4610 spec->kb_dev = input_allocate_device();
4611 if (!spec->kb_dev) {
4612 codec_err(codec, "Out of memory (input_allocate_device)\n");
4613 return -ENOMEM;
4614 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004615
4616 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4617
Kailang3694cb22015-12-28 11:35:24 +08004618 spec->kb_dev->name = "Microphone Mute Button";
4619 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004620 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4621 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4622 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4623 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4624 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004625
4626 if (input_register_device(spec->kb_dev)) {
4627 codec_err(codec, "input_register_device failed\n");
4628 input_free_device(spec->kb_dev);
4629 spec->kb_dev = NULL;
4630 return -ENOMEM;
4631 }
4632
4633 return 0;
4634}
4635
Takashi Iwai01e4a272018-06-19 22:47:30 +02004636/* GPIO1 = set according to SKU external amp
4637 * GPIO2 = mic mute hotkey
4638 * GPIO3 = mute LED
4639 * GPIO4 = mic mute LED
4640 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004641static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4642 const struct hda_fixup *fix, int action)
4643{
David Henningsson33f4acd2015-01-07 15:50:13 +01004644 struct alc_spec *spec = codec->spec;
4645
Takashi Iwai01e4a272018-06-19 22:47:30 +02004646 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004647 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004648 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004649 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004650 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004651
Takashi Iwai01e4a272018-06-19 22:47:30 +02004652 spec->gpio_mask |= 0x06;
4653 spec->gpio_dir |= 0x02;
4654 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004655 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004656 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004657 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004658 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004659 return;
4660 }
4661
4662 if (!spec->kb_dev)
4663 return;
4664
4665 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004666 case HDA_FIXUP_ACT_FREE:
4667 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004668 spec->kb_dev = NULL;
4669 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004670}
4671
Takashi Iwai01e4a272018-06-19 22:47:30 +02004672/* Line2 = mic mute hotkey
4673 * GPIO2 = mic mute LED
4674 */
Kailang3694cb22015-12-28 11:35:24 +08004675static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4676 const struct hda_fixup *fix, int action)
4677{
Kailang3694cb22015-12-28 11:35:24 +08004678 struct alc_spec *spec = codec->spec;
4679
Takashi Iwai01e4a272018-06-19 22:47:30 +02004680 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004681 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004682 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004683 if (alc_register_micmute_input_device(codec) != 0)
4684 return;
4685
Kailang3694cb22015-12-28 11:35:24 +08004686 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4687 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004688 return;
4689 }
4690
4691 if (!spec->kb_dev)
4692 return;
4693
4694 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004695 case HDA_FIXUP_ACT_FREE:
4696 input_unregister_device(spec->kb_dev);
4697 spec->kb_dev = NULL;
4698 }
4699}
Takashi Iwaic4696522018-01-15 10:44:35 +01004700#else /* INPUT */
4701#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4702#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4703#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004704
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004705static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4706 const struct hda_fixup *fix, int action)
4707{
4708 struct alc_spec *spec = codec->spec;
4709
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004710 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004711 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004712 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004713 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004714 }
4715}
4716
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004717static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004718 UPDATE_COEF(0x4a, 1<<8, 0),
4719 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4720 UPDATE_COEF(0x63, 3<<14, 3<<14),
4721 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4722 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4723 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4724 UPDATE_COEF(0x4a, 3<<10, 0),
4725 {}
4726};
4727
David Henningsson73bdd592013-04-15 15:44:14 +02004728static void alc_headset_mode_unplugged(struct hda_codec *codec)
4729{
Kailang Yang92666d42020-11-19 17:04:21 +08004730 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004731 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004732 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004733 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4734 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4735 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4736 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4737 {}
4738 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004739 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004740 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004741 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4742 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4743 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4744 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004745 {}
4746 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004747 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004748 WRITE_COEF(0x1b, 0x0c0b),
4749 WRITE_COEF(0x45, 0xc429),
4750 UPDATE_COEF(0x35, 0x4000, 0),
4751 WRITE_COEF(0x06, 0x2104),
4752 WRITE_COEF(0x1a, 0x0001),
4753 WRITE_COEF(0x26, 0x0004),
4754 WRITE_COEF(0x32, 0x42a3),
4755 {}
4756 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004757 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004758 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4759 UPDATE_COEF(0x50, 0x2000, 0x2000),
4760 UPDATE_COEF(0x56, 0x0006, 0x0006),
4761 UPDATE_COEF(0x66, 0x0008, 0),
4762 UPDATE_COEF(0x67, 0x2000, 0),
4763 {}
4764 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004765 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004766 UPDATE_COEF(0x19, 0x1300, 0x0300),
4767 {}
4768 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004769 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004770 WRITE_COEF(0x76, 0x000e),
4771 WRITE_COEF(0x6c, 0x2400),
4772 WRITE_COEF(0x18, 0x7308),
4773 WRITE_COEF(0x6b, 0xc429),
4774 {}
4775 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004776 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004777 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4778 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4779 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4780 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4781 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4782 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4783 {}
4784 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004785 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004786 WRITE_COEF(0x15, 0x0d40),
4787 WRITE_COEF(0xb7, 0x802b),
4788 {}
4789 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004790 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004791 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004792 {}
4793 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004794 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004795 UPDATE_COEF(0x4a, 0x0100, 0),
4796 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4797 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4798 UPDATE_COEF(0x4a, 0x0010, 0),
4799 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4800 WRITE_COEF(0x45, 0x5289),
4801 UPDATE_COEF(0x4a, 0x0c00, 0),
4802 {}
4803 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004804
Kailang Yang92666d42020-11-19 17:04:21 +08004805 if (spec->no_internal_mic_pin) {
4806 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4807 return;
4808 }
4809
Takashi Iwai7639a062015-03-03 10:07:24 +01004810 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004811 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004812 alc_process_coef_fw(codec, coef0255);
4813 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02004814 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08004815 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004816 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004817 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004818 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004819 case 0x10ec0234:
4820 case 0x10ec0274:
4821 case 0x10ec0294:
4822 alc_process_coef_fw(codec, coef0274);
4823 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004824 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004825 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004826 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004827 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004828 case 0x10ec0286:
4829 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004830 alc_process_coef_fw(codec, coef0288);
4831 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004832 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004833 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004834 alc_process_coef_fw(codec, coef0288);
4835 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004836 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004837 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004838 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004839 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004840 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004841 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004842 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004843 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004844 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004845 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004846 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004847 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004848 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004849 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004850 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004851 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004852 alc_process_coef_fw(codec, coef0225);
4853 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004854 case 0x10ec0867:
4855 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4856 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004857 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004858 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004859}
4860
4861
4862static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4863 hda_nid_t mic_pin)
4864{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004865 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004866 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4867 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4868 {}
4869 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004870 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004871 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4872 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4873 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4874 {}
4875 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004876 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004877 UPDATE_COEF(0x35, 0, 1<<14),
4878 WRITE_COEF(0x06, 0x2100),
4879 WRITE_COEF(0x1a, 0x0021),
4880 WRITE_COEF(0x26, 0x008c),
4881 {}
4882 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004883 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004884 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004885 UPDATE_COEF(0x50, 0x2000, 0),
4886 UPDATE_COEF(0x56, 0x0006, 0),
4887 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4888 UPDATE_COEF(0x66, 0x0008, 0x0008),
4889 UPDATE_COEF(0x67, 0x2000, 0x2000),
4890 {}
4891 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004892 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004893 WRITE_COEF(0x19, 0xa208),
4894 WRITE_COEF(0x2e, 0xacf0),
4895 {}
4896 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004897 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004898 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4899 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4900 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4901 {}
4902 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004903 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004904 WRITE_COEF(0xb7, 0x802b),
4905 WRITE_COEF(0xb5, 0x1040),
4906 UPDATE_COEF(0xc3, 0, 1<<12),
4907 {}
4908 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004909 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004910 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4911 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4912 UPDATE_COEF(0x63, 3<<14, 0),
4913 {}
4914 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004915 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004916 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4917 UPDATE_COEF(0x4a, 0x0010, 0),
4918 UPDATE_COEF(0x6b, 0xf000, 0),
4919 {}
4920 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004921
Takashi Iwai7639a062015-03-03 10:07:24 +01004922 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004923 case 0x10ec0255:
4924 alc_write_coef_idx(codec, 0x45, 0xc489);
4925 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004926 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004927 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4928 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02004929 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08004930 case 0x10ec0236:
4931 case 0x10ec0256:
4932 alc_write_coef_idx(codec, 0x45, 0xc489);
4933 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4934 alc_process_coef_fw(codec, coef0256);
4935 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4936 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004937 case 0x10ec0234:
4938 case 0x10ec0274:
4939 case 0x10ec0294:
4940 alc_write_coef_idx(codec, 0x45, 0x4689);
4941 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4942 alc_process_coef_fw(codec, coef0274);
4943 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4944 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004945 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004946 case 0x10ec0283:
4947 alc_write_coef_idx(codec, 0x45, 0xc429);
4948 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004949 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004950 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4951 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004952 case 0x10ec0286:
4953 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004954 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004955 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4956 alc_process_coef_fw(codec, coef0288);
4957 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4958 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004959 case 0x10ec0292:
4960 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004961 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004962 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004963 case 0x10ec0293:
4964 /* Set to TRS mode */
4965 alc_write_coef_idx(codec, 0x45, 0xc429);
4966 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004967 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004968 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4969 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004970 case 0x10ec0867:
4971 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05004972 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004973 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004974 case 0x10ec0662:
4975 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4976 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4977 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004978 case 0x10ec0668:
4979 alc_write_coef_idx(codec, 0x11, 0x0001);
4980 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004981 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004982 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4983 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004984 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004985 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004986 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004987 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004988 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004989 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004990 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004991 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4992 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4993 alc_process_coef_fw(codec, coef0225);
4994 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4995 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004996 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004997 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004998}
4999
5000static void alc_headset_mode_default(struct hda_codec *codec)
5001{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005002 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005003 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5004 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5005 UPDATE_COEF(0x49, 3<<8, 0<<8),
5006 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5007 UPDATE_COEF(0x63, 3<<14, 0),
5008 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01005009 {}
5010 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005011 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005012 WRITE_COEF(0x45, 0xc089),
5013 WRITE_COEF(0x45, 0xc489),
5014 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5015 WRITE_COEF(0x49, 0x0049),
5016 {}
5017 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005018 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08005019 WRITE_COEF(0x45, 0xc489),
5020 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5021 WRITE_COEF(0x49, 0x0049),
5022 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5023 WRITE_COEF(0x06, 0x6100),
5024 {}
5025 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005026 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005027 WRITE_COEF(0x06, 0x2100),
5028 WRITE_COEF(0x32, 0x4ea3),
5029 {}
5030 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005031 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005032 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5033 UPDATE_COEF(0x50, 0x2000, 0x2000),
5034 UPDATE_COEF(0x56, 0x0006, 0x0006),
5035 UPDATE_COEF(0x66, 0x0008, 0),
5036 UPDATE_COEF(0x67, 0x2000, 0),
5037 {}
5038 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005039 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005040 WRITE_COEF(0x76, 0x000e),
5041 WRITE_COEF(0x6c, 0x2400),
5042 WRITE_COEF(0x6b, 0xc429),
5043 WRITE_COEF(0x18, 0x7308),
5044 {}
5045 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005046 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005047 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5048 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5049 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5050 {}
5051 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005052 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005053 WRITE_COEF(0x11, 0x0041),
5054 WRITE_COEF(0x15, 0x0d40),
5055 WRITE_COEF(0xb7, 0x802b),
5056 {}
5057 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005058 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005059 WRITE_COEF(0x45, 0x4289),
5060 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5061 UPDATE_COEF(0x6b, 0x0f00, 0),
5062 UPDATE_COEF(0x49, 0x0300, 0x0300),
5063 {}
5064 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005065
Takashi Iwai7639a062015-03-03 10:07:24 +01005066 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08005067 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01005068 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005069 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005070 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005071 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005072 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005073 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01005074 alc_process_coef_fw(codec, coef0225);
5075 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005076 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005077 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005078 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005079 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005080 case 0x10ec0236:
5081 case 0x10ec0256:
5082 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5083 alc_write_coef_idx(codec, 0x45, 0xc089);
5084 msleep(50);
5085 alc_process_coef_fw(codec, coef0256);
5086 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005087 case 0x10ec0234:
5088 case 0x10ec0274:
5089 case 0x10ec0294:
5090 alc_process_coef_fw(codec, coef0274);
5091 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005092 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005093 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005094 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005095 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005096 case 0x10ec0286:
5097 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005098 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08005099 alc_process_coef_fw(codec, coef0288);
5100 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005101 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005102 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005103 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005104 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005105 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005106 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005107 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005108 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005109 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005110 case 0x10ec0867:
5111 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5112 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005113 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005114 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005115}
5116
5117/* Iphone type */
5118static void alc_headset_mode_ctia(struct hda_codec *codec)
5119{
Kailang Yang89542932017-07-17 15:03:43 +08005120 int val;
5121
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005122 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005123 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5124 WRITE_COEF(0x1b, 0x0c2b),
5125 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5126 {}
5127 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005128 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005129 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005130 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005131 {}
5132 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005133 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005134 WRITE_COEF(0x45, 0xd429),
5135 WRITE_COEF(0x1b, 0x0c2b),
5136 WRITE_COEF(0x32, 0x4ea3),
5137 {}
5138 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005139 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005140 UPDATE_COEF(0x50, 0x2000, 0x2000),
5141 UPDATE_COEF(0x56, 0x0006, 0x0006),
5142 UPDATE_COEF(0x66, 0x0008, 0),
5143 UPDATE_COEF(0x67, 0x2000, 0),
5144 {}
5145 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005146 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005147 WRITE_COEF(0x6b, 0xd429),
5148 WRITE_COEF(0x76, 0x0008),
5149 WRITE_COEF(0x18, 0x7388),
5150 {}
5151 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005152 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005153 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5154 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5155 {}
5156 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005157 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005158 WRITE_COEF(0x11, 0x0001),
5159 WRITE_COEF(0x15, 0x0d60),
5160 WRITE_COEF(0xc3, 0x0000),
5161 {}
5162 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005163 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005164 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005165 UPDATE_COEF(0x63, 3<<14, 2<<14),
5166 {}
5167 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005168 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005169 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5170 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005171 {}
5172 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005173
Takashi Iwai7639a062015-03-03 10:07:24 +01005174 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005175 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005176 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005177 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005178 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005179 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005180 case 0x10ec0256:
5181 alc_process_coef_fw(codec, coef0256);
5182 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005183 case 0x10ec0234:
5184 case 0x10ec0274:
5185 case 0x10ec0294:
5186 alc_write_coef_idx(codec, 0x45, 0xd689);
5187 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005188 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005189 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005190 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005191 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005192 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005193 val = alc_read_coef_idx(codec, 0x50);
5194 if (val & (1 << 12)) {
5195 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5196 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5197 msleep(300);
5198 } else {
5199 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5200 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5201 msleep(300);
5202 }
5203 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005204 case 0x10ec0286:
5205 case 0x10ec0288:
5206 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5207 msleep(300);
5208 alc_process_coef_fw(codec, coef0288);
5209 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005210 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005211 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005212 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005213 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005214 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005215 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005216 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005217 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005218 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005219 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005220 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005221 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005222 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005223 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005224 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005225 val = alc_read_coef_idx(codec, 0x45);
5226 if (val & (1 << 9))
5227 alc_process_coef_fw(codec, coef0225_2);
5228 else
5229 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005230 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005231 case 0x10ec0867:
5232 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5233 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005234 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005235 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005236}
5237
5238/* Nokia type */
5239static void alc_headset_mode_omtp(struct hda_codec *codec)
5240{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005241 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005242 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5243 WRITE_COEF(0x1b, 0x0c2b),
5244 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5245 {}
5246 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005247 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005248 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005249 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005250 {}
5251 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005252 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005253 WRITE_COEF(0x45, 0xe429),
5254 WRITE_COEF(0x1b, 0x0c2b),
5255 WRITE_COEF(0x32, 0x4ea3),
5256 {}
5257 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005258 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005259 UPDATE_COEF(0x50, 0x2000, 0x2000),
5260 UPDATE_COEF(0x56, 0x0006, 0x0006),
5261 UPDATE_COEF(0x66, 0x0008, 0),
5262 UPDATE_COEF(0x67, 0x2000, 0),
5263 {}
5264 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005265 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005266 WRITE_COEF(0x6b, 0xe429),
5267 WRITE_COEF(0x76, 0x0008),
5268 WRITE_COEF(0x18, 0x7388),
5269 {}
5270 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005271 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005272 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5273 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5274 {}
5275 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005276 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005277 WRITE_COEF(0x11, 0x0001),
5278 WRITE_COEF(0x15, 0x0d50),
5279 WRITE_COEF(0xc3, 0x0000),
5280 {}
5281 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005282 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005283 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005284 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005285 {}
5286 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005287
Takashi Iwai7639a062015-03-03 10:07:24 +01005288 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005289 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005290 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005291 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005292 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005293 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005294 case 0x10ec0256:
5295 alc_process_coef_fw(codec, coef0256);
5296 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005297 case 0x10ec0234:
5298 case 0x10ec0274:
5299 case 0x10ec0294:
5300 alc_write_coef_idx(codec, 0x45, 0xe689);
5301 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005302 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005303 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005304 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005305 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005306 case 0x10ec0298:
5307 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005308 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5309 msleep(300);
5310 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005311 case 0x10ec0286:
5312 case 0x10ec0288:
5313 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5314 msleep(300);
5315 alc_process_coef_fw(codec, coef0288);
5316 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005317 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005318 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005319 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005320 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005321 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005322 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005323 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005324 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005325 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005326 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005327 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005328 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005329 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005330 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005331 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005332 alc_process_coef_fw(codec, coef0225);
5333 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005334 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005335 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005336}
5337
5338static void alc_determine_headset_type(struct hda_codec *codec)
5339{
5340 int val;
5341 bool is_ctia = false;
5342 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005343 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005344 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5345 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5346 conteol) */
5347 {}
5348 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005349 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005350 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5351 {}
5352 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005353 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005354 UPDATE_COEF(0x50, 0x2000, 0x2000),
5355 UPDATE_COEF(0x56, 0x0006, 0x0006),
5356 UPDATE_COEF(0x66, 0x0008, 0),
5357 UPDATE_COEF(0x67, 0x2000, 0),
5358 UPDATE_COEF(0x19, 0x1300, 0x1300),
5359 {}
5360 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005361 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005362 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5363 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5364 {}
5365 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005366 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005367 WRITE_COEF(0x11, 0x0001),
5368 WRITE_COEF(0xb7, 0x802b),
5369 WRITE_COEF(0x15, 0x0d60),
5370 WRITE_COEF(0xc3, 0x0c00),
5371 {}
5372 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005373 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005374 UPDATE_COEF(0x4a, 0x0010, 0),
5375 UPDATE_COEF(0x4a, 0x8000, 0),
5376 WRITE_COEF(0x45, 0xd289),
5377 UPDATE_COEF(0x49, 0x0300, 0x0300),
5378 {}
5379 };
David Henningsson73bdd592013-04-15 15:44:14 +02005380
Kailang Yang92666d42020-11-19 17:04:21 +08005381 if (spec->no_internal_mic_pin) {
5382 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5383 return;
5384 }
5385
Takashi Iwai7639a062015-03-03 10:07:24 +01005386 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005387 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005388 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005389 msleep(300);
5390 val = alc_read_coef_idx(codec, 0x46);
5391 is_ctia = (val & 0x0070) == 0x0070;
5392 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005393 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005394 case 0x10ec0236:
5395 case 0x10ec0256:
5396 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5397 alc_write_coef_idx(codec, 0x06, 0x6104);
5398 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5399
5400 snd_hda_codec_write(codec, 0x21, 0,
5401 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5402 msleep(80);
5403 snd_hda_codec_write(codec, 0x21, 0,
5404 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5405
5406 alc_process_coef_fw(codec, coef0255);
5407 msleep(300);
5408 val = alc_read_coef_idx(codec, 0x46);
5409 is_ctia = (val & 0x0070) == 0x0070;
5410
5411 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5412 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5413
5414 snd_hda_codec_write(codec, 0x21, 0,
5415 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5416 msleep(80);
5417 snd_hda_codec_write(codec, 0x21, 0,
5418 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5419 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005420 case 0x10ec0234:
5421 case 0x10ec0274:
5422 case 0x10ec0294:
5423 alc_process_coef_fw(codec, coef0274);
Hui Wangfebf22562021-03-20 17:15:41 +08005424 msleep(850);
Kailang Yang71683c32017-06-20 16:33:50 +08005425 val = alc_read_coef_idx(codec, 0x46);
5426 is_ctia = (val & 0x00f0) == 0x00f0;
5427 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005428 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005429 case 0x10ec0283:
5430 alc_write_coef_idx(codec, 0x45, 0xd029);
5431 msleep(300);
5432 val = alc_read_coef_idx(codec, 0x46);
5433 is_ctia = (val & 0x0070) == 0x0070;
5434 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005435 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005436 snd_hda_codec_write(codec, 0x21, 0,
5437 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5438 msleep(100);
5439 snd_hda_codec_write(codec, 0x21, 0,
5440 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5441 msleep(200);
5442
5443 val = alc_read_coef_idx(codec, 0x50);
5444 if (val & (1 << 12)) {
5445 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5446 alc_process_coef_fw(codec, coef0288);
5447 msleep(350);
5448 val = alc_read_coef_idx(codec, 0x50);
5449 is_ctia = (val & 0x0070) == 0x0070;
5450 } else {
5451 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5452 alc_process_coef_fw(codec, coef0288);
5453 msleep(350);
5454 val = alc_read_coef_idx(codec, 0x50);
5455 is_ctia = (val & 0x0070) == 0x0070;
5456 }
5457 alc_process_coef_fw(codec, coef0298);
5458 snd_hda_codec_write(codec, 0x21, 0,
5459 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5460 msleep(75);
5461 snd_hda_codec_write(codec, 0x21, 0,
5462 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5463 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005464 case 0x10ec0286:
5465 case 0x10ec0288:
5466 alc_process_coef_fw(codec, coef0288);
5467 msleep(350);
5468 val = alc_read_coef_idx(codec, 0x50);
5469 is_ctia = (val & 0x0070) == 0x0070;
5470 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005471 case 0x10ec0292:
5472 alc_write_coef_idx(codec, 0x6b, 0xd429);
5473 msleep(300);
5474 val = alc_read_coef_idx(codec, 0x6c);
5475 is_ctia = (val & 0x001c) == 0x001c;
5476 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005477 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005478 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005479 msleep(300);
5480 val = alc_read_coef_idx(codec, 0x46);
5481 is_ctia = (val & 0x0070) == 0x0070;
5482 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005483 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005484 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005485 msleep(300);
5486 val = alc_read_coef_idx(codec, 0xbe);
5487 is_ctia = (val & 0x1c02) == 0x1c02;
5488 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005489 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005490 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005491 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005492 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005493 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005494 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005495 snd_hda_codec_write(codec, 0x21, 0,
5496 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5497 msleep(80);
5498 snd_hda_codec_write(codec, 0x21, 0,
5499 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5500
Kailang Yang5a367672017-07-21 15:23:53 +08005501 alc_process_coef_fw(codec, alc225_pre_hsmode);
5502 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5503 val = alc_read_coef_idx(codec, 0x45);
5504 if (val & (1 << 9)) {
5505 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5506 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5507 msleep(800);
5508 val = alc_read_coef_idx(codec, 0x46);
5509 is_ctia = (val & 0x00f0) == 0x00f0;
5510 } else {
5511 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5512 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5513 msleep(800);
5514 val = alc_read_coef_idx(codec, 0x46);
5515 is_ctia = (val & 0x00f0) == 0x00f0;
5516 }
5517 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5518 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5519 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005520
5521 snd_hda_codec_write(codec, 0x21, 0,
5522 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5523 msleep(80);
5524 snd_hda_codec_write(codec, 0x21, 0,
5525 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005526 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005527 case 0x10ec0867:
5528 is_ctia = true;
5529 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005530 }
5531
Takashi Iwai4e76a882014-02-25 12:21:03 +01005532 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005533 is_ctia ? "yes" : "no");
5534 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5535}
5536
5537static void alc_update_headset_mode(struct hda_codec *codec)
5538{
5539 struct alc_spec *spec = codec->spec;
5540
5541 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005542 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005543
5544 int new_headset_mode;
5545
5546 if (!snd_hda_jack_detect(codec, hp_pin))
5547 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5548 else if (mux_pin == spec->headset_mic_pin)
5549 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5550 else if (mux_pin == spec->headphone_mic_pin)
5551 new_headset_mode = ALC_HEADSET_MODE_MIC;
5552 else
5553 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5554
David Henningsson5959a6b2013-11-12 11:10:57 +01005555 if (new_headset_mode == spec->current_headset_mode) {
5556 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005557 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005558 }
David Henningsson73bdd592013-04-15 15:44:14 +02005559
5560 switch (new_headset_mode) {
5561 case ALC_HEADSET_MODE_UNPLUGGED:
5562 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005563 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5564 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005565 spec->gen.hp_jack_present = false;
5566 break;
5567 case ALC_HEADSET_MODE_HEADSET:
5568 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5569 alc_determine_headset_type(codec);
5570 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5571 alc_headset_mode_ctia(codec);
5572 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5573 alc_headset_mode_omtp(codec);
5574 spec->gen.hp_jack_present = true;
5575 break;
5576 case ALC_HEADSET_MODE_MIC:
5577 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5578 spec->gen.hp_jack_present = false;
5579 break;
5580 case ALC_HEADSET_MODE_HEADPHONE:
5581 alc_headset_mode_default(codec);
5582 spec->gen.hp_jack_present = true;
5583 break;
5584 }
5585 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5586 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5587 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005588 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005589 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5590 PIN_VREFHIZ);
5591 }
5592 spec->current_headset_mode = new_headset_mode;
5593
5594 snd_hda_gen_update_outputs(codec);
5595}
5596
5597static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005598 struct snd_kcontrol *kcontrol,
5599 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005600{
5601 alc_update_headset_mode(codec);
5602}
5603
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005604static void alc_update_headset_jack_cb(struct hda_codec *codec,
5605 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005606{
David Henningsson73bdd592013-04-15 15:44:14 +02005607 snd_hda_gen_hp_automute(codec, jack);
Hui Wange54f30b2021-03-20 17:15:42 +08005608 alc_update_headset_mode(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005609}
5610
5611static void alc_probe_headset_mode(struct hda_codec *codec)
5612{
5613 int i;
5614 struct alc_spec *spec = codec->spec;
5615 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5616
5617 /* Find mic pins */
5618 for (i = 0; i < cfg->num_inputs; i++) {
5619 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5620 spec->headset_mic_pin = cfg->inputs[i].pin;
5621 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5622 spec->headphone_mic_pin = cfg->inputs[i].pin;
5623 }
5624
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005625 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005626 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5627 spec->gen.automute_hook = alc_update_headset_mode;
5628 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5629}
5630
5631static void alc_fixup_headset_mode(struct hda_codec *codec,
5632 const struct hda_fixup *fix, int action)
5633{
5634 struct alc_spec *spec = codec->spec;
5635
5636 switch (action) {
5637 case HDA_FIXUP_ACT_PRE_PROBE:
5638 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5639 break;
5640 case HDA_FIXUP_ACT_PROBE:
5641 alc_probe_headset_mode(codec);
5642 break;
5643 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005644 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5645 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5646 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5647 }
David Henningsson73bdd592013-04-15 15:44:14 +02005648 alc_update_headset_mode(codec);
5649 break;
5650 }
5651}
5652
5653static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5654 const struct hda_fixup *fix, int action)
5655{
5656 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5657 struct alc_spec *spec = codec->spec;
5658 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5659 }
5660 else
5661 alc_fixup_headset_mode(codec, fix, action);
5662}
5663
Kailang Yang31278992014-03-03 15:27:22 +08005664static void alc255_set_default_jack_type(struct hda_codec *codec)
5665{
5666 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005667 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005668 WRITE_COEF(0x1b, 0x880b),
5669 WRITE_COEF(0x45, 0xd089),
5670 WRITE_COEF(0x1b, 0x080b),
5671 WRITE_COEF(0x46, 0x0004),
5672 WRITE_COEF(0x1b, 0x0c0b),
5673 {}
5674 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005675 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005676 WRITE_COEF(0x1b, 0x884b),
5677 WRITE_COEF(0x45, 0xd089),
5678 WRITE_COEF(0x1b, 0x084b),
5679 WRITE_COEF(0x46, 0x0004),
5680 WRITE_COEF(0x1b, 0x0c4b),
5681 {}
5682 };
5683 switch (codec->core.vendor_id) {
5684 case 0x10ec0255:
5685 alc_process_coef_fw(codec, alc255fw);
5686 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005687 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005688 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005689 case 0x10ec0256:
5690 alc_process_coef_fw(codec, alc256fw);
5691 break;
5692 }
Kailang Yang31278992014-03-03 15:27:22 +08005693 msleep(30);
5694}
5695
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005696static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5697 const struct hda_fixup *fix, int action)
5698{
5699 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005700 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005701 }
5702 alc_fixup_headset_mode(codec, fix, action);
5703}
5704
Kailang Yang31278992014-03-03 15:27:22 +08005705static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5706 const struct hda_fixup *fix, int action)
5707{
5708 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5709 struct alc_spec *spec = codec->spec;
5710 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5711 alc255_set_default_jack_type(codec);
5712 }
5713 else
5714 alc_fixup_headset_mode(codec, fix, action);
5715}
5716
Kailang Yange1e62b92015-04-08 16:01:22 +08005717static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5718 struct hda_jack_callback *jack)
5719{
5720 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005721
5722 alc_update_headset_jack_cb(codec, jack);
5723 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005724 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005725}
5726
5727static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5728 const struct hda_fixup *fix, int action)
5729{
5730 alc_fixup_headset_mode(codec, fix, action);
5731 if (action == HDA_FIXUP_ACT_PROBE) {
5732 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005733 /* toggled via hp_automute_hook */
5734 spec->gpio_mask |= 0x40;
5735 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005736 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5737 }
5738}
5739
Hui Wang493a52a2014-01-14 14:07:36 +08005740static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5741 const struct hda_fixup *fix, int action)
5742{
5743 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5744 struct alc_spec *spec = codec->spec;
5745 spec->gen.auto_mute_via_amp = 1;
5746 }
5747}
5748
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005749static void alc_fixup_no_shutup(struct hda_codec *codec,
5750 const struct hda_fixup *fix, int action)
5751{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005752 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005753 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005754 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005755 }
5756}
5757
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005758static void alc_fixup_disable_aamix(struct hda_codec *codec,
5759 const struct hda_fixup *fix, int action)
5760{
5761 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5762 struct alc_spec *spec = codec->spec;
5763 /* Disable AA-loopback as it causes white noise */
5764 spec->gen.mixer_nid = 0;
5765 }
5766}
5767
Takashi Iwai7f57d802015-09-24 17:36:51 +02005768/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5769static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5770 const struct hda_fixup *fix, int action)
5771{
5772 static const struct hda_pintbl pincfgs[] = {
5773 { 0x16, 0x21211010 }, /* dock headphone */
5774 { 0x19, 0x21a11010 }, /* dock mic */
5775 { }
5776 };
5777 struct alc_spec *spec = codec->spec;
5778
5779 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5780 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5781 codec->power_save_node = 0; /* avoid click noises */
5782 snd_hda_apply_pincfgs(codec, pincfgs);
5783 }
5784}
5785
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005786static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5787 const struct hda_fixup *fix, int action)
5788{
5789 static const struct hda_pintbl pincfgs[] = {
5790 { 0x17, 0x21211010 }, /* dock headphone */
5791 { 0x19, 0x21a11010 }, /* dock mic */
5792 { }
5793 };
5794 struct alc_spec *spec = codec->spec;
5795
5796 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5797 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005798 snd_hda_apply_pincfgs(codec, pincfgs);
5799 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005800 /* Enable DOCK device */
5801 snd_hda_codec_write(codec, 0x17, 0,
5802 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5803 /* Enable DOCK device */
5804 snd_hda_codec_write(codec, 0x19, 0,
5805 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005806 }
5807}
5808
Takashi Iwai399c01a2020-05-26 08:24:06 +02005809static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5810 const struct hda_fixup *fix, int action)
5811{
5812 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5813 * the speaker output becomes too low by some reason on Thinkpads with
5814 * ALC298 codec
5815 */
5816 static const hda_nid_t preferred_pairs[] = {
5817 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5818 0
5819 };
5820 struct alc_spec *spec = codec->spec;
5821
5822 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5823 spec->gen.preferred_dacs = preferred_pairs;
5824}
5825
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02005826static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5827 const struct hda_fixup *fix, int action)
5828{
5829 static const hda_nid_t preferred_pairs[] = {
5830 0x17, 0x02, 0x21, 0x03, 0
5831 };
5832 struct alc_spec *spec = codec->spec;
5833
5834 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5835 spec->gen.preferred_dacs = preferred_pairs;
5836}
5837
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005838static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005839{
5840 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005841 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005842
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005843 /* Prevent pop noises when headphones are plugged in */
5844 snd_hda_codec_write(codec, hp_pin, 0,
5845 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5846 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005847}
5848
5849static void alc_fixup_dell_xps13(struct hda_codec *codec,
5850 const struct hda_fixup *fix, int action)
5851{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005852 struct alc_spec *spec = codec->spec;
5853 struct hda_input_mux *imux = &spec->gen.input_mux;
5854 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005855
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005856 switch (action) {
5857 case HDA_FIXUP_ACT_PRE_PROBE:
5858 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5859 * it causes a click noise at start up
5860 */
5861 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005862 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005863 break;
5864 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005865 /* Make the internal mic the default input source. */
5866 for (i = 0; i < imux->num_items; i++) {
5867 if (spec->gen.imux_pins[i] == 0x12) {
5868 spec->gen.cur_mux[0] = i;
5869 break;
5870 }
5871 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005872 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005873 }
5874}
5875
David Henningsson1f8b46c2015-05-12 14:38:15 +02005876static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5877 const struct hda_fixup *fix, int action)
5878{
5879 struct alc_spec *spec = codec->spec;
5880
5881 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5882 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5883 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005884
5885 /* Disable boost for mic-in permanently. (This code is only called
5886 from quirks that guarantee that the headphone is at NID 0x1b.) */
5887 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5888 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005889 } else
5890 alc_fixup_headset_mode(codec, fix, action);
5891}
5892
David Henningsson73bdd592013-04-15 15:44:14 +02005893static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5894 const struct hda_fixup *fix, int action)
5895{
5896 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005897 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005898 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005899 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5900 }
5901 alc_fixup_headset_mode(codec, fix, action);
5902}
5903
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005904/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5905static int find_ext_mic_pin(struct hda_codec *codec)
5906{
5907 struct alc_spec *spec = codec->spec;
5908 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5909 hda_nid_t nid;
5910 unsigned int defcfg;
5911 int i;
5912
5913 for (i = 0; i < cfg->num_inputs; i++) {
5914 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5915 continue;
5916 nid = cfg->inputs[i].pin;
5917 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5918 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5919 continue;
5920 return nid;
5921 }
5922
5923 return 0;
5924}
5925
Dylan Reid08a978d2012-11-18 22:56:40 -08005926static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005927 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005928 int action)
5929{
5930 struct alc_spec *spec = codec->spec;
5931
Takashi Iwai0db75792013-01-23 13:57:20 +01005932 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005933 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005934 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005935
5936 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005937 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005938 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005939 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005940}
David Henningsson693b6132012-06-22 19:12:10 +02005941
David Henningsson3e0d6112013-04-22 14:30:14 +02005942static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5943 const struct hda_fixup *fix,
5944 int action)
5945{
5946 struct alc_spec *spec = codec->spec;
5947 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5948 int i;
5949
5950 /* The mic boosts on level 2 and 3 are too noisy
5951 on the internal mic input.
5952 Therefore limit the boost to 0 or 1. */
5953
5954 if (action != HDA_FIXUP_ACT_PROBE)
5955 return;
5956
5957 for (i = 0; i < cfg->num_inputs; i++) {
5958 hda_nid_t nid = cfg->inputs[i].pin;
5959 unsigned int defcfg;
5960 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5961 continue;
5962 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5963 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5964 continue;
5965
5966 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5967 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5968 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5969 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5970 (0 << AC_AMPCAP_MUTE_SHIFT));
5971 }
5972}
5973
Kailang Yangcd217a62013-08-22 10:15:24 +02005974static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005975 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005976{
5977 struct alc_spec *spec = codec->spec;
5978 int vref;
5979
5980 msleep(200);
5981 snd_hda_gen_hp_automute(codec, jack);
5982
5983 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5984
5985 msleep(600);
5986 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5987 vref);
5988}
5989
Kailang Yangcd217a62013-08-22 10:15:24 +02005990static void alc283_fixup_chromebook(struct hda_codec *codec,
5991 const struct hda_fixup *fix, int action)
5992{
5993 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005994
5995 switch (action) {
5996 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005997 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005998 /* Disable AA-loopback as it causes white noise */
5999 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08006000 break;
6001 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08006002 /* MIC2-VREF control */
6003 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02006004 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08006005 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02006006 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08006007 break;
6008 }
6009}
6010
6011static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6012 const struct hda_fixup *fix, int action)
6013{
6014 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08006015
6016 switch (action) {
6017 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02006018 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6019 break;
6020 case HDA_FIXUP_ACT_INIT:
6021 /* MIC2-VREF control */
6022 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02006023 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02006024 break;
6025 }
6026}
6027
Takashi Iwai7bba2152013-09-06 15:45:38 +02006028/* mute tablet speaker pin (0x14) via dock plugging in addition */
6029static void asus_tx300_automute(struct hda_codec *codec)
6030{
6031 struct alc_spec *spec = codec->spec;
6032 snd_hda_gen_update_outputs(codec);
6033 if (snd_hda_jack_detect(codec, 0x1b))
6034 spec->gen.mute_bits |= (1ULL << 0x14);
6035}
6036
6037static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6038 const struct hda_fixup *fix, int action)
6039{
6040 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02006041 static const struct hda_pintbl dock_pins[] = {
6042 { 0x1b, 0x21114000 }, /* dock speaker pin */
6043 {}
6044 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02006045
6046 switch (action) {
6047 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02006048 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02006049 /* TX300 needs to set up GPIO2 for the speaker amp */
6050 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02006051 snd_hda_apply_pincfgs(codec, dock_pins);
6052 spec->gen.auto_mute_via_amp = 1;
6053 spec->gen.automute_hook = asus_tx300_automute;
6054 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006055 snd_hda_gen_hp_automute);
6056 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02006057 case HDA_FIXUP_ACT_PROBE:
6058 spec->init_amp = ALC_INIT_DEFAULT;
6059 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02006060 case HDA_FIXUP_ACT_BUILD:
6061 /* this is a bit tricky; give more sane names for the main
6062 * (tablet) speaker and the dock speaker, respectively
6063 */
Takashi Iwai56798e62017-04-11 08:10:52 +02006064 rename_ctl(codec, "Speaker Playback Switch",
6065 "Dock Speaker Playback Switch");
6066 rename_ctl(codec, "Bass Speaker Playback Switch",
6067 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02006068 break;
6069 }
6070}
6071
David Henningsson338cae52013-10-07 10:39:59 +02006072static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6073 const struct hda_fixup *fix, int action)
6074{
David Henningsson0f4881d2013-12-20 16:08:13 +01006075 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6076 /* DAC node 0x03 is giving mono output. We therefore want to
6077 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6078 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006079 static const hda_nid_t conn1[] = { 0x0c };
6080 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6081 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01006082 }
David Henningsson338cae52013-10-07 10:39:59 +02006083}
6084
Hui Wangdd9aa332016-08-01 10:20:32 +08006085static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6086 const struct hda_fixup *fix, int action)
6087{
6088 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6089 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6090 we can't adjust the speaker's volume since this node does not has
6091 Amp-out capability. we change the speaker's route to:
6092 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6093 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6094 speaker's volume now. */
6095
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006096 static const hda_nid_t conn1[] = { 0x0c };
6097 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08006098 }
6099}
6100
Takashi Iwaie312a862018-03-06 12:14:17 +01006101/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6102static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6103 const struct hda_fixup *fix, int action)
6104{
6105 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006106 static const hda_nid_t conn[] = { 0x02, 0x03 };
6107 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01006108 }
6109}
6110
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006111/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6112static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6113 const struct hda_fixup *fix, int action)
6114{
6115 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006116 static const hda_nid_t conn[] = { 0x02 };
6117 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006118 }
6119}
6120
Keith Packard98973f22015-07-15 12:14:39 -07006121/* Hook to update amp GPIO4 for automute */
6122static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6123 struct hda_jack_callback *jack)
6124{
6125 struct alc_spec *spec = codec->spec;
6126
6127 snd_hda_gen_hp_automute(codec, jack);
6128 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08006129 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6130 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07006131}
6132
6133/* Manage GPIOs for HP EliteBook Folio 9480m.
6134 *
6135 * GPIO4 is the headphone amplifier power control
6136 * GPIO3 is the audio output mute indicator LED
6137 */
6138
6139static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6140 const struct hda_fixup *fix,
6141 int action)
6142{
6143 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07006144
Takashi Iwai01e4a272018-06-19 22:47:30 +02006145 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07006146 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02006147 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6148 spec->gpio_mask |= 0x10;
6149 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07006150 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07006151 }
6152}
6153
Takashi Iwaiae065f12018-06-19 23:00:03 +02006154static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6155 const struct hda_fixup *fix,
6156 int action)
6157{
6158 struct alc_spec *spec = codec->spec;
6159
6160 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6161 spec->gpio_mask |= 0x04;
6162 spec->gpio_dir |= 0x04;
6163 /* set data bit low */
6164 }
6165}
6166
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006167/* Quirk for Thinkpad X1 7th and 8th Gen
6168 * The following fixed routing needed
6169 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6170 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6171 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6172 */
6173static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6174 const struct hda_fixup *fix, int action)
6175{
6176 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6177 static const hda_nid_t preferred_pairs[] = {
6178 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6179 };
6180 struct alc_spec *spec = codec->spec;
6181
6182 switch (action) {
6183 case HDA_FIXUP_ACT_PRE_PROBE:
6184 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6185 spec->gen.preferred_dacs = preferred_pairs;
6186 break;
6187 case HDA_FIXUP_ACT_BUILD:
6188 /* The generic parser creates somewhat unintuitive volume ctls
6189 * with the fixed routing above, and the shared DAC2 may be
6190 * confusing for PA.
6191 * Rename those to unique names so that PA doesn't touch them
6192 * and use only Master volume.
6193 */
6194 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6195 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6196 break;
6197 }
6198}
6199
Kailang Yangca169cc2017-04-25 16:17:40 +08006200static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6201 const struct hda_fixup *fix,
6202 int action)
6203{
6204 alc_fixup_dual_codecs(codec, fix, action);
6205 switch (action) {
6206 case HDA_FIXUP_ACT_PRE_PROBE:
6207 /* override card longname to provide a unique UCM profile */
6208 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6209 break;
6210 case HDA_FIXUP_ACT_BUILD:
6211 /* rename Capture controls depending on the codec */
6212 rename_ctl(codec, "Capture Volume",
6213 codec->addr == 0 ?
6214 "Rear-Panel Capture Volume" :
6215 "Front-Panel Capture Volume");
6216 rename_ctl(codec, "Capture Switch",
6217 codec->addr == 0 ?
6218 "Rear-Panel Capture Switch" :
6219 "Front-Panel Capture Switch");
6220 break;
6221 }
6222}
6223
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006224static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6225 const struct hda_fixup *fix, int action)
6226{
6227 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6228 return;
6229
6230 codec->power_save_node = 1;
6231}
6232
Kailang Yang92266652017-12-14 15:28:58 +08006233/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6234static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6235 const struct hda_fixup *fix, int action)
6236{
6237 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006238 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08006239 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6240 0
6241 };
6242
6243 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6244 return;
6245
6246 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08006247 spec->gen.auto_mute_via_amp = 1;
6248 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08006249}
6250
Takashi Iwaic84bfed2020-11-27 15:11:04 +01006251/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6252static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6253 const struct hda_fixup *fix, int action)
6254{
6255 static const hda_nid_t preferred_pairs[] = {
6256 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6257 };
6258 struct alc_spec *spec = codec->spec;
6259
6260 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6261 spec->gen.preferred_dacs = preferred_pairs;
6262 spec->gen.obey_preferred_dacs = 1;
6263 }
6264}
6265
Hui Wangc4cfcf62018-11-26 14:17:16 +08006266/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6267static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6268 const struct hda_fixup *fix, int action)
6269{
6270 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6271 return;
6272
6273 snd_hda_override_wcaps(codec, 0x03, 0);
6274}
6275
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006276static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6277{
6278 switch (codec->core.vendor_id) {
6279 case 0x10ec0274:
6280 case 0x10ec0294:
6281 case 0x10ec0225:
6282 case 0x10ec0295:
6283 case 0x10ec0299:
6284 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6285 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6286 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02006287 case 0x10ec0230:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006288 case 0x10ec0235:
6289 case 0x10ec0236:
6290 case 0x10ec0255:
6291 case 0x10ec0256:
6292 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6293 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6294 break;
6295 }
6296}
6297
Kailang Yang8983eb62019-04-03 15:31:49 +08006298static void alc295_fixup_chromebook(struct hda_codec *codec,
6299 const struct hda_fixup *fix, int action)
6300{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006301 struct alc_spec *spec = codec->spec;
6302
Kailang Yang8983eb62019-04-03 15:31:49 +08006303 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006304 case HDA_FIXUP_ACT_PRE_PROBE:
6305 spec->ultra_low_power = true;
6306 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006307 case HDA_FIXUP_ACT_INIT:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006308 alc_combo_jack_hp_jd_restart(codec);
Kailang Yang8983eb62019-04-03 15:31:49 +08006309 break;
6310 }
6311}
6312
Kailang Yangd1dd4212019-01-09 17:05:24 +08006313static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6314 const struct hda_fixup *fix, int action)
6315{
6316 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6317 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6318}
6319
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006320
6321static void alc294_gx502_toggle_output(struct hda_codec *codec,
6322 struct hda_jack_callback *cb)
6323{
6324 /* The Windows driver sets the codec up in a very different way where
6325 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6326 */
6327 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6328 alc_write_coef_idx(codec, 0x10, 0x8a20);
6329 else
6330 alc_write_coef_idx(codec, 0x10, 0x0a20);
6331}
6332
6333static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6334 const struct hda_fixup *fix, int action)
6335{
6336 /* Pin 0x21: headphones/headset mic */
6337 if (!is_jack_detectable(codec, 0x21))
6338 return;
6339
6340 switch (action) {
6341 case HDA_FIXUP_ACT_PRE_PROBE:
6342 snd_hda_jack_detect_enable_callback(codec, 0x21,
6343 alc294_gx502_toggle_output);
6344 break;
6345 case HDA_FIXUP_ACT_INIT:
6346 /* Make sure to start in a correct state, i.e. if
6347 * headphones have been plugged in before powering up the system
6348 */
6349 alc294_gx502_toggle_output(codec, NULL);
6350 break;
6351 }
6352}
6353
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006354static void alc294_gu502_toggle_output(struct hda_codec *codec,
6355 struct hda_jack_callback *cb)
6356{
6357 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6358 * responsible from changes between speakers and headphones
6359 */
6360 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6361 alc_write_coef_idx(codec, 0x10, 0x8420);
6362 else
6363 alc_write_coef_idx(codec, 0x10, 0x0a20);
6364}
6365
6366static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6367 const struct hda_fixup *fix, int action)
6368{
6369 if (!is_jack_detectable(codec, 0x21))
6370 return;
6371
6372 switch (action) {
6373 case HDA_FIXUP_ACT_PRE_PROBE:
6374 snd_hda_jack_detect_enable_callback(codec, 0x21,
6375 alc294_gu502_toggle_output);
6376 break;
6377 case HDA_FIXUP_ACT_INIT:
6378 alc294_gu502_toggle_output(codec, NULL);
6379 break;
6380 }
6381}
6382
Kailang Yang56496252020-07-29 15:09:27 +08006383static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6384 const struct hda_fixup *fix, int action)
6385{
6386 if (action != HDA_FIXUP_ACT_INIT)
6387 return;
6388
6389 msleep(100);
6390 alc_write_coef_idx(codec, 0x65, 0x0);
6391}
6392
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006393static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6394 const struct hda_fixup *fix, int action)
6395{
6396 switch (action) {
6397 case HDA_FIXUP_ACT_INIT:
6398 alc_combo_jack_hp_jd_restart(codec);
6399 break;
6400 }
6401}
6402
Kailang Yang92666d42020-11-19 17:04:21 +08006403static void alc_fixup_no_int_mic(struct hda_codec *codec,
6404 const struct hda_fixup *fix, int action)
6405{
6406 struct alc_spec *spec = codec->spec;
6407
6408 switch (action) {
6409 case HDA_FIXUP_ACT_PRE_PROBE:
6410 /* Mic RING SLEEVE swap for combo jack */
6411 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6412 spec->no_internal_mic_pin = true;
6413 break;
6414 case HDA_FIXUP_ACT_INIT:
6415 alc_combo_jack_hp_jd_restart(codec);
6416 break;
6417 }
6418}
6419
Davide Baldod94befb2021-10-15 09:21:22 +02006420/* GPIO1 = amplifier on/off
6421 * GPIO3 = mic mute LED
6422 */
6423static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6424 const struct hda_fixup *fix, int action)
6425{
6426 static const hda_nid_t conn[] = { 0x02 };
6427
6428 struct alc_spec *spec = codec->spec;
6429 static const struct hda_pintbl pincfgs[] = {
6430 { 0x14, 0x90170110 }, /* front/high speakers */
6431 { 0x17, 0x90170130 }, /* back/bass speakers */
6432 { }
6433 };
6434
6435 //enable micmute led
6436 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6437
6438 switch (action) {
6439 case HDA_FIXUP_ACT_PRE_PROBE:
6440 spec->micmute_led_polarity = 1;
6441 /* needed for amp of back speakers */
6442 spec->gpio_mask |= 0x01;
6443 spec->gpio_dir |= 0x01;
6444 snd_hda_apply_pincfgs(codec, pincfgs);
6445 /* share DAC to have unified volume control */
6446 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6447 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6448 break;
6449 case HDA_FIXUP_ACT_INIT:
6450 /* need to toggle GPIO to enable the amp of back speakers */
6451 alc_update_gpio_data(codec, 0x01, true);
6452 msleep(100);
6453 alc_update_gpio_data(codec, 0x01, false);
6454 break;
6455 }
6456}
6457
Elia Devito434591b2021-06-19 22:41:04 +02006458static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6459 const struct hda_fixup *fix, int action)
6460{
6461 static const hda_nid_t conn[] = { 0x02 };
6462 static const struct hda_pintbl pincfgs[] = {
6463 { 0x14, 0x90170110 }, /* rear speaker */
6464 { }
6465 };
6466
6467 switch (action) {
6468 case HDA_FIXUP_ACT_PRE_PROBE:
6469 snd_hda_apply_pincfgs(codec, pincfgs);
6470 /* force front speaker to DAC1 */
6471 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6472 break;
6473 }
6474}
6475
Takashi Iwaib317b032014-01-08 11:44:21 +01006476/* for hda_fixup_thinkpad_acpi() */
6477#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006478
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006479static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6480 const struct hda_fixup *fix, int action)
6481{
6482 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6483 hda_fixup_thinkpad_acpi(codec, fix, action);
6484}
6485
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07006486/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6487static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6488 const struct hda_fixup *fix,
6489 int action)
6490{
6491 struct alc_spec *spec = codec->spec;
6492
6493 switch (action) {
6494 case HDA_FIXUP_ACT_PRE_PROBE:
6495 spec->gen.suppress_auto_mute = 1;
6496 break;
6497 }
6498}
6499
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006500/* for alc295_fixup_hp_top_speakers */
6501#include "hp_x360_helper.c"
6502
Takashi Iwai26928ca2021-04-16 10:12:11 +02006503/* for alc285_fixup_ideapad_s740_coef() */
6504#include "ideapad_s740_helper.c"
6505
Werner Sembach619764c2021-12-02 17:50:10 +01006506static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6507 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6508 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6509 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6510 {}
6511};
6512
6513static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6514 const struct hda_fixup *fix,
6515 int action)
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006516{
6517 /*
Werner Sembach619764c2021-12-02 17:50:10 +01006518 * A certain other OS sets these coeffs to different values. On at least
6519 * one TongFang barebone these settings might survive even a cold
6520 * reboot. So to restore a clean slate the values are explicitly reset
6521 * to default here. Without this, the external microphone is always in a
6522 * plugged-in state, while the internal microphone is always in an
6523 * unplugged state, breaking the ability to use the internal microphone.
6524 */
6525 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006526}
6527
Werner Sembach174a7fb2021-11-12 12:07:04 +01006528static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6529 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6530 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6531 WRITE_COEF(0x49, 0x0149),
6532 {}
6533};
6534
6535static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6536 const struct hda_fixup *fix,
6537 int action)
6538{
6539 /*
6540 * The audio jack input and output is not detected on the ASRock NUC Box
6541 * 1100 series when cold booting without this fix. Warm rebooting from a
6542 * certain other OS makes the audio functional, as COEF settings are
6543 * preserved in this case. This fix sets these altered COEF values as
6544 * the default.
6545 */
6546 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6547}
6548
Takashi Iwai1d045db2011-07-07 18:23:21 +02006549enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006550 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006551 ALC269_FIXUP_SONY_VAIO,
6552 ALC275_FIXUP_SONY_VAIO_GPIO2,
6553 ALC269_FIXUP_DELL_M101Z,
6554 ALC269_FIXUP_SKU_IGNORE,
6555 ALC269_FIXUP_ASUS_G73JW,
6556 ALC269_FIXUP_LENOVO_EAPD,
6557 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006558 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006559 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006560 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006561 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006562 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006563 ALC269_FIXUP_QUANTA_MUTE,
6564 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006565 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006566 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006567 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006568 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006569 ALC269_FIXUP_AMIC,
6570 ALC269_FIXUP_DMIC,
6571 ALC269VB_FIXUP_AMIC,
6572 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006573 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006574 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006575 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006576 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006577 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006578 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6579 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006580 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006581 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006582 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006583 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006584 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006585 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006586 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6587 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006588 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006589 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006590 ALC269_FIXUP_HEADSET_MODE,
6591 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006592 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006593 ALC269_FIXUP_ASUS_X101_FUNC,
6594 ALC269_FIXUP_ASUS_X101_VERB,
6595 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006596 ALC271_FIXUP_AMIC_MIC2,
6597 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006598 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006599 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006600 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006601 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006602 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006603 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006604 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006605 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006606 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006607 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006608 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006609 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006610 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6611 ALC290_FIXUP_SUBWOOFER,
6612 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006613 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006614 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006615 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006616 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006617 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006618 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006619 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006620 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006621 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006622 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006623 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006624 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006625 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006626 ALC282_FIXUP_ASPIRE_V5_PINS,
Takashi Iwaic8426b22021-04-07 11:57:30 +02006627 ALC269VB_FIXUP_ASPIRE_E1_COEF,
David Henningsson7a5255f2014-10-30 08:26:01 +01006628 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006629 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006630 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006631 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006632 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006633 ALC280_FIXUP_HP_9480M,
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01006634 ALC245_FIXUP_HP_X360_AMP,
Davide Baldod94befb2021-10-15 09:21:22 +02006635 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
Kailang Yange1e62b92015-04-08 16:01:22 +08006636 ALC288_FIXUP_DELL_HEADSET_MODE,
6637 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006638 ALC288_FIXUP_DELL_XPS_13,
6639 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006640 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006641 ALC292_FIXUP_DELL_E7X,
6642 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006643 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006644 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006645 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006646 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006647 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006648 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006649 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006650 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006651 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006652 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006653 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006654 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006655 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006656 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006657 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006658 ALC298_FIXUP_SPK_VOLUME,
Kailang Yangf86de9b2020-10-23 14:46:47 +08006659 ALC298_FIXUP_LENOVO_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006660 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006661 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006662 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006663 ALC256_FIXUP_ASUS_HEADSET_MODE,
6664 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006665 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006666 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6667 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006668 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006669 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006670 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006671 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006672 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006673 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006674 ALC274_FIXUP_DELL_BIND_DACS,
6675 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006676 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006677 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006678 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006679 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006680 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006681 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006682 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006683 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006684 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006685 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006686 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006687 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006688 ALC294_FIXUP_ASUS_HEADSET_MIC,
6689 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006690 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006691 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006692 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006693 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006694 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006695 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6696 ALC225_FIXUP_WYSE_AUTO_MUTE,
6697 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006698 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006699 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006700 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006701 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006702 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006703 ALC289_FIXUP_DELL_SPK2,
6704 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006705 ALC294_FIXUP_SPK2_TO_DAC1,
6706 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006707 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006708 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006709 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006710 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006711 ALC294_FIXUP_ASUS_GX502_HP,
6712 ALC294_FIXUP_ASUS_GX502_PINS,
6713 ALC294_FIXUP_ASUS_GX502_VERBS,
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006714 ALC294_FIXUP_ASUS_GU502_HP,
6715 ALC294_FIXUP_ASUS_GU502_PINS,
6716 ALC294_FIXUP_ASUS_GU502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006717 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006718 ALC285_FIXUP_HP_MUTE_LED,
Jeremy Szue7d66cf2021-03-16 15:46:24 +08006719 ALC236_FIXUP_HP_GPIO_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006720 ALC236_FIXUP_HP_MUTE_LED,
Jonas Witschel75b62ab2021-04-16 12:58:54 +02006721 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
Mike Pozulp14425f12020-05-09 20:28:37 -07006722 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006723 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006724 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006725 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006726 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006727 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006728 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006729 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006730 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006731 ALC269_FIXUP_CZC_B20,
6732 ALC269_FIXUP_CZC_TMI,
6733 ALC269_FIXUP_CZC_L101,
6734 ALC269_FIXUP_LEMOTE_A1802,
6735 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006736 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Phil Calvind1ee66c2021-04-15 18:01:29 -04006737 ALC233_FIXUP_INTEL_NUC8_DMIC,
6738 ALC233_FIXUP_INTEL_NUC8_BOOST,
Werner Sembach73e71612021-03-02 19:04:14 +01006739 ALC256_FIXUP_INTEL_NUC10,
Hui Wangfc19d552020-09-09 10:00:41 +08006740 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006741 ALC274_FIXUP_HP_MIC,
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006742 ALC274_FIXUP_HP_HEADSET_MIC,
Takashi Iwai622464c2021-05-04 11:18:02 +02006743 ALC274_FIXUP_HP_ENVY_GPIO,
Kailang Yangef9ce662020-11-03 15:40:35 +08006744 ALC256_FIXUP_ASUS_HPE,
Kailang Yang446b8182020-11-02 15:00:12 +08006745 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Kailang Yanga0ccbc52020-11-06 15:20:38 +08006746 ALC287_FIXUP_HP_GPIO_LED,
Kailang Yang9e885772020-11-03 15:30:51 +08006747 ALC256_FIXUP_HP_HEADSET_MIC,
Johnathon Clark5fc462c2021-10-20 14:12:51 +01006748 ALC245_FIXUP_HP_GPIO_LED,
Kailang Yang92666d42020-11-19 17:04:21 +08006749 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
Chris Chiu34cdf402020-12-16 20:52:00 +08006750 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
Chris Chiu495dc762021-01-14 16:27:28 +08006751 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
Chris Chiud0e18562021-02-26 09:04:40 +08006752 ALC256_FIXUP_ACER_HEADSET_MIC,
Takashi Iwai26928ca2021-04-16 10:12:11 +02006753 ALC285_FIXUP_IDEAPAD_S740_COEF,
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08006754 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02006755 ALC295_FIXUP_ASUS_DACS,
Takashi Iwai5d84b532021-05-04 14:18:32 +02006756 ALC295_FIXUP_HP_OMEN,
Elia Devitof2be77f2021-05-11 14:46:49 +02006757 ALC285_FIXUP_HP_SPECTRE_X360,
Hui Wang9ebaef02021-05-22 12:26:45 +08006758 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03006759 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
Hui Wang57c9e212021-06-08 10:46:00 +08006760 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08006761 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07006762 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6763 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6764 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006765 ALC287_FIXUP_13S_GEN2_SPEAKERS,
Werner Sembach619764c2021-12-02 17:50:10 +01006766 ALC256_FIXUP_SET_COEF_DEFAULTS,
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06006767 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Werner Sembach174a7fb2021-11-12 12:07:04 +01006768 ALC233_FIXUP_NO_AUDIO_JACK,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006769};
6770
Takashi Iwai1727a772013-01-10 09:52:52 +01006771static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006772 [ALC269_FIXUP_GPIO2] = {
6773 .type = HDA_FIXUP_FUNC,
6774 .v.func = alc_fixup_gpio2,
6775 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006776 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01006777 .type = HDA_FIXUP_PINCTLS,
6778 .v.pins = (const struct hda_pintbl[]) {
6779 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006780 {}
6781 }
6782 },
6783 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006784 .type = HDA_FIXUP_FUNC,
6785 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006786 .chained = true,
6787 .chain_id = ALC269_FIXUP_SONY_VAIO
6788 },
6789 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006790 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006791 .v.verbs = (const struct hda_verb[]) {
6792 /* Enables internal speaker */
6793 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6794 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6795 {}
6796 }
6797 },
6798 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006799 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02006800 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006801 },
6802 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006803 .type = HDA_FIXUP_PINS,
6804 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02006805 { 0x17, 0x99130111 }, /* subwoofer */
6806 { }
6807 }
6808 },
6809 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006810 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006811 .v.verbs = (const struct hda_verb[]) {
6812 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6813 {}
6814 }
6815 },
6816 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006817 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006818 .v.func = alc269_fixup_hweq,
6819 .chained = true,
6820 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6821 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006822 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6823 .type = HDA_FIXUP_FUNC,
6824 .v.func = alc_fixup_disable_aamix,
6825 .chained = true,
6826 .chain_id = ALC269_FIXUP_SONY_VAIO
6827 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006828 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006829 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006830 .v.func = alc271_fixup_dmic,
6831 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02006832 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006833 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006834 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02006835 .chained = true,
6836 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02006837 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006838 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006839 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006840 .v.func = alc269_fixup_stereo_dmic,
6841 },
David Henningsson7c478f02013-10-11 10:18:46 +02006842 [ALC269_FIXUP_HEADSET_MIC] = {
6843 .type = HDA_FIXUP_FUNC,
6844 .v.func = alc269_fixup_headset_mic,
6845 },
Takashi Iwai24519912011-08-16 15:08:49 +02006846 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006847 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02006848 .v.func = alc269_fixup_quanta_mute,
6849 },
6850 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006851 .type = HDA_FIXUP_PINS,
6852 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02006853 { 0x1a, 0x2101103f }, /* dock line-out */
6854 { 0x1b, 0x23a11040 }, /* dock mic-in */
6855 { }
6856 },
6857 .chained = true,
6858 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6859 },
David Henningsson2041d562014-06-13 11:15:44 +02006860 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6861 .type = HDA_FIXUP_PINS,
6862 .v.pins = (const struct hda_pintbl[]) {
6863 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6864 { }
6865 },
6866 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006867 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6868 .type = HDA_FIXUP_PINS,
6869 .v.pins = (const struct hda_pintbl[]) {
6870 { 0x21, 0x0221102f }, /* HP out */
6871 { }
6872 },
6873 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006874 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6875 .type = HDA_FIXUP_FUNC,
6876 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6877 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006878 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6879 .type = HDA_FIXUP_FUNC,
6880 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6881 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02006882 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006883 .type = HDA_FIXUP_PINS,
6884 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006885 { 0x14, 0x99130110 }, /* speaker */
6886 { 0x15, 0x0121401f }, /* HP out */
6887 { 0x18, 0x01a19c20 }, /* mic */
6888 { 0x19, 0x99a3092f }, /* int-mic */
6889 { }
6890 },
6891 },
6892 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006893 .type = HDA_FIXUP_PINS,
6894 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006895 { 0x12, 0x99a3092f }, /* int-mic */
6896 { 0x14, 0x99130110 }, /* speaker */
6897 { 0x15, 0x0121401f }, /* HP out */
6898 { 0x18, 0x01a19c20 }, /* mic */
6899 { }
6900 },
6901 },
6902 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006903 .type = HDA_FIXUP_PINS,
6904 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006905 { 0x14, 0x99130110 }, /* speaker */
6906 { 0x18, 0x01a19c20 }, /* mic */
6907 { 0x19, 0x99a3092f }, /* int-mic */
6908 { 0x21, 0x0121401f }, /* HP out */
6909 { }
6910 },
6911 },
David Henningsson2267ea92012-01-03 08:45:56 +01006912 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006913 .type = HDA_FIXUP_PINS,
6914 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006915 { 0x12, 0x99a3092f }, /* int-mic */
6916 { 0x14, 0x99130110 }, /* speaker */
6917 { 0x18, 0x01a19c20 }, /* mic */
6918 { 0x21, 0x0121401f }, /* HP out */
6919 { }
6920 },
6921 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006922 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006923 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006924 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01006925 },
David Henningssond06ac142013-02-18 11:41:55 +01006926 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6927 .type = HDA_FIXUP_FUNC,
6928 .v.func = alc269_fixup_hp_mute_led_mic1,
6929 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006930 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006931 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006932 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01006933 },
Tom Briden7f783bd2017-03-25 10:12:01 +00006934 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6935 .type = HDA_FIXUP_FUNC,
6936 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006937 .chained = true,
6938 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00006939 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006940 [ALC269_FIXUP_HP_GPIO_LED] = {
6941 .type = HDA_FIXUP_FUNC,
6942 .v.func = alc269_fixup_hp_gpio_led,
6943 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006944 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6945 .type = HDA_FIXUP_FUNC,
6946 .v.func = alc269_fixup_hp_gpio_mic1_led,
6947 },
6948 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6949 .type = HDA_FIXUP_FUNC,
6950 .v.func = alc269_fixup_hp_line1_mic1_led,
6951 },
David Henningsson693b6132012-06-22 19:12:10 +02006952 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006953 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02006954 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02006955 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006956 [ALC269_FIXUP_NO_SHUTUP] = {
6957 .type = HDA_FIXUP_FUNC,
6958 .v.func = alc_fixup_no_shutup,
6959 },
David Henningsson108cc102012-07-20 10:37:25 +02006960 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006961 .type = HDA_FIXUP_PINS,
6962 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02006963 { 0x19, 0x23a11040 }, /* dock mic */
6964 { 0x1b, 0x2121103f }, /* dock headphone */
6965 { }
6966 },
6967 .chained = true,
6968 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6969 },
Takashi Iwaib590b382020-05-14 18:05:33 +02006970 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6971 .type = HDA_FIXUP_FUNC,
6972 .v.func = alc269_fixup_limit_int_mic_boost,
6973 .chained = true,
6974 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6975 },
David Henningsson108cc102012-07-20 10:37:25 +02006976 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006977 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02006978 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01006979 .chained = true,
6980 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02006981 },
David Henningsson73bdd592013-04-15 15:44:14 +02006982 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6983 .type = HDA_FIXUP_PINS,
6984 .v.pins = (const struct hda_pintbl[]) {
6985 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6986 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6987 { }
6988 },
6989 .chained = true,
6990 .chain_id = ALC269_FIXUP_HEADSET_MODE
6991 },
6992 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6993 .type = HDA_FIXUP_PINS,
6994 .v.pins = (const struct hda_pintbl[]) {
6995 { 0x16, 0x21014020 }, /* dock line out */
6996 { 0x19, 0x21a19030 }, /* dock mic */
6997 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6998 { }
6999 },
7000 .chained = true,
7001 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7002 },
David Henningsson338cae52013-10-07 10:39:59 +02007003 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7004 .type = HDA_FIXUP_PINS,
7005 .v.pins = (const struct hda_pintbl[]) {
7006 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7007 { }
7008 },
7009 .chained = true,
7010 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7011 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08007012 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7013 .type = HDA_FIXUP_PINS,
7014 .v.pins = (const struct hda_pintbl[]) {
7015 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7016 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7017 { }
7018 },
7019 .chained = true,
7020 .chain_id = ALC269_FIXUP_HEADSET_MODE
7021 },
David Henningsson73bdd592013-04-15 15:44:14 +02007022 [ALC269_FIXUP_HEADSET_MODE] = {
7023 .type = HDA_FIXUP_FUNC,
7024 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08007025 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007026 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02007027 },
7028 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7029 .type = HDA_FIXUP_FUNC,
7030 .v.func = alc_fixup_headset_mode_no_hp_mic,
7031 },
Takashi Iwai78197172015-06-27 10:21:13 +02007032 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7033 .type = HDA_FIXUP_PINS,
7034 .v.pins = (const struct hda_pintbl[]) {
7035 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7036 { }
7037 },
7038 .chained = true,
7039 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7040 },
David Henningsson88cfcf82013-10-11 10:18:45 +02007041 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7042 .type = HDA_FIXUP_PINS,
7043 .v.pins = (const struct hda_pintbl[]) {
7044 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7045 { }
7046 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02007047 .chained = true,
7048 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02007049 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04007050 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05007051 .type = HDA_FIXUP_PINS,
7052 .v.pins = (const struct hda_pintbl[]) {
7053 {0x12, 0x90a60130},
7054 {0x13, 0x40000000},
7055 {0x14, 0x90170110},
7056 {0x18, 0x411111f0},
7057 {0x19, 0x04a11040},
7058 {0x1a, 0x411111f0},
7059 {0x1b, 0x90170112},
7060 {0x1d, 0x40759a05},
7061 {0x1e, 0x411111f0},
7062 {0x21, 0x04211020},
7063 { }
7064 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05007065 .chained = true,
7066 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05007067 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02007068 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7069 .type = HDA_FIXUP_FUNC,
7070 .v.func = alc298_fixup_huawei_mbx_stereo,
7071 .chained = true,
7072 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7073 },
David Henningssond240d1d2013-04-15 12:50:02 +02007074 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7075 .type = HDA_FIXUP_FUNC,
7076 .v.func = alc269_fixup_x101_headset_mic,
7077 },
7078 [ALC269_FIXUP_ASUS_X101_VERB] = {
7079 .type = HDA_FIXUP_VERBS,
7080 .v.verbs = (const struct hda_verb[]) {
7081 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7082 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7083 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7084 { }
7085 },
7086 .chained = true,
7087 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7088 },
7089 [ALC269_FIXUP_ASUS_X101] = {
7090 .type = HDA_FIXUP_PINS,
7091 .v.pins = (const struct hda_pintbl[]) {
7092 { 0x18, 0x04a1182c }, /* Headset mic */
7093 { }
7094 },
7095 .chained = true,
7096 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7097 },
Dylan Reid08a978d2012-11-18 22:56:40 -08007098 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007099 .type = HDA_FIXUP_PINS,
7100 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08007101 { 0x14, 0x99130110 }, /* speaker */
7102 { 0x19, 0x01a19c20 }, /* mic */
7103 { 0x1b, 0x99a7012f }, /* int-mic */
7104 { 0x21, 0x0121401f }, /* HP out */
7105 { }
7106 },
7107 },
7108 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007109 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08007110 .v.func = alc271_hp_gate_mic_jack,
7111 .chained = true,
7112 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7113 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01007114 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7115 .type = HDA_FIXUP_FUNC,
7116 .v.func = alc269_fixup_limit_int_mic_boost,
7117 .chained = true,
7118 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7119 },
Dylan Reid42397002013-04-05 14:58:22 -07007120 [ALC269_FIXUP_ACER_AC700] = {
7121 .type = HDA_FIXUP_PINS,
7122 .v.pins = (const struct hda_pintbl[]) {
7123 { 0x12, 0x99a3092f }, /* int-mic */
7124 { 0x14, 0x99130110 }, /* speaker */
7125 { 0x18, 0x03a11c20 }, /* mic */
7126 { 0x1e, 0x0346101e }, /* SPDIF1 */
7127 { 0x21, 0x0321101f }, /* HP out */
7128 { }
7129 },
7130 .chained = true,
7131 .chain_id = ALC271_FIXUP_DMIC,
7132 },
David Henningsson3e0d6112013-04-22 14:30:14 +02007133 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7134 .type = HDA_FIXUP_FUNC,
7135 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01007136 .chained = true,
7137 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02007138 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01007139 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7140 .type = HDA_FIXUP_FUNC,
7141 .v.func = alc269_fixup_limit_int_mic_boost,
7142 .chained = true,
7143 .chain_id = ALC269VB_FIXUP_DMIC,
7144 },
Takashi Iwai23870832013-11-29 14:13:12 +01007145 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7146 .type = HDA_FIXUP_VERBS,
7147 .v.verbs = (const struct hda_verb[]) {
7148 /* class-D output amp +5dB */
7149 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7150 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7151 {}
7152 },
7153 .chained = true,
7154 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7155 },
David Henningsson8e35cd42013-11-06 11:20:01 +01007156 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7157 .type = HDA_FIXUP_FUNC,
7158 .v.func = alc269_fixup_limit_int_mic_boost,
7159 .chained = true,
7160 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7161 },
Anisse Astier02b504d2013-06-03 11:53:10 +02007162 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7163 .type = HDA_FIXUP_PINS,
7164 .v.pins = (const struct hda_pintbl[]) {
7165 { 0x12, 0x99a3092f }, /* int-mic */
7166 { 0x18, 0x03a11d20 }, /* mic */
7167 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7168 { }
7169 },
7170 },
Kailang Yangcd217a62013-08-22 10:15:24 +02007171 [ALC283_FIXUP_CHROME_BOOK] = {
7172 .type = HDA_FIXUP_FUNC,
7173 .v.func = alc283_fixup_chromebook,
7174 },
Kailang Yang0202e992013-12-02 15:20:15 +08007175 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7176 .type = HDA_FIXUP_FUNC,
7177 .v.func = alc283_fixup_sense_combo_jack,
7178 .chained = true,
7179 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7180 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02007181 [ALC282_FIXUP_ASUS_TX300] = {
7182 .type = HDA_FIXUP_FUNC,
7183 .v.func = alc282_fixup_asus_tx300,
7184 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02007185 [ALC283_FIXUP_INT_MIC] = {
7186 .type = HDA_FIXUP_VERBS,
7187 .v.verbs = (const struct hda_verb[]) {
7188 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7189 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7190 { }
7191 },
7192 .chained = true,
7193 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7194 },
David Henningsson0f4881d2013-12-20 16:08:13 +01007195 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7196 .type = HDA_FIXUP_PINS,
7197 .v.pins = (const struct hda_pintbl[]) {
7198 { 0x17, 0x90170112 }, /* subwoofer */
7199 { }
7200 },
7201 .chained = true,
7202 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7203 },
7204 [ALC290_FIXUP_SUBWOOFER] = {
7205 .type = HDA_FIXUP_PINS,
7206 .v.pins = (const struct hda_pintbl[]) {
7207 { 0x17, 0x90170112 }, /* subwoofer */
7208 { }
7209 },
7210 .chained = true,
7211 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7212 },
David Henningsson338cae52013-10-07 10:39:59 +02007213 [ALC290_FIXUP_MONO_SPEAKERS] = {
7214 .type = HDA_FIXUP_FUNC,
7215 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01007216 },
7217 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7218 .type = HDA_FIXUP_FUNC,
7219 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02007220 .chained = true,
7221 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7222 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01007223 [ALC269_FIXUP_THINKPAD_ACPI] = {
7224 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02007225 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02007226 .chained = true,
7227 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01007228 },
David Henningsson56f27012016-01-11 09:33:14 +01007229 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7230 .type = HDA_FIXUP_FUNC,
7231 .v.func = alc_fixup_inv_dmic,
7232 .chained = true,
7233 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7234 },
Chris Chiu5824ce82017-02-28 14:17:11 -06007235 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08007236 .type = HDA_FIXUP_PINS,
7237 .v.pins = (const struct hda_pintbl[]) {
7238 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7239 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06007240 },
7241 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08007242 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06007243 },
Chris Chiu615966a2017-02-28 14:17:12 -06007244 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7245 .type = HDA_FIXUP_PINS,
7246 .v.pins = (const struct hda_pintbl[]) {
7247 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7248 { }
7249 },
7250 .chained = true,
7251 .chain_id = ALC255_FIXUP_HEADSET_MODE
7252 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007253 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7254 .type = HDA_FIXUP_PINS,
7255 .v.pins = (const struct hda_pintbl[]) {
7256 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7257 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7258 { }
7259 },
7260 .chained = true,
7261 .chain_id = ALC255_FIXUP_HEADSET_MODE
7262 },
Kailang Yang31278992014-03-03 15:27:22 +08007263 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7264 .type = HDA_FIXUP_PINS,
7265 .v.pins = (const struct hda_pintbl[]) {
7266 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7267 { }
7268 },
7269 .chained = true,
7270 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7271 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007272 [ALC255_FIXUP_HEADSET_MODE] = {
7273 .type = HDA_FIXUP_FUNC,
7274 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08007275 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007276 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007277 },
Kailang Yang31278992014-03-03 15:27:22 +08007278 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7279 .type = HDA_FIXUP_FUNC,
7280 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7281 },
Kailang Yanga22aa262014-04-23 17:34:28 +08007282 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7283 .type = HDA_FIXUP_PINS,
7284 .v.pins = (const struct hda_pintbl[]) {
7285 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7286 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7287 { }
7288 },
7289 .chained = true,
7290 .chain_id = ALC269_FIXUP_HEADSET_MODE
7291 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02007292 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02007293 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02007294 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02007295 .chained = true,
7296 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7297 },
Takashi Iwai9a811232015-12-09 15:17:43 +01007298 [ALC292_FIXUP_TPT440] = {
7299 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01007300 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01007301 .chained = true,
7302 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7303 },
Anisse Astierabaa22742016-08-24 09:14:13 +02007304 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01007305 .type = HDA_FIXUP_PINS,
7306 .v.pins = (const struct hda_pintbl[]) {
7307 { 0x19, 0x04a110f0 },
7308 { },
7309 },
7310 },
Takashi Iwaib3802782018-11-26 17:47:46 +01007311 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08007312 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007313 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08007314 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007315 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7316 .type = HDA_FIXUP_PINS,
7317 .v.pins = (const struct hda_pintbl[]) {
7318 { 0x12, 0x90a60130 },
7319 { 0x14, 0x90170110 },
7320 { 0x17, 0x40000008 },
7321 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02007322 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007323 { 0x1a, 0x411111f0 },
7324 { 0x1b, 0x411111f0 },
7325 { 0x1d, 0x40f89b2d },
7326 { 0x1e, 0x411111f0 },
7327 { 0x21, 0x0321101f },
7328 { },
7329 },
7330 },
Takashi Iwaic8426b22021-04-07 11:57:30 +02007331 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7332 .type = HDA_FIXUP_FUNC,
7333 .v.func = alc269vb_fixup_aspire_e1_coef,
7334 },
David Henningsson7a5255f2014-10-30 08:26:01 +01007335 [ALC280_FIXUP_HP_GPIO4] = {
7336 .type = HDA_FIXUP_FUNC,
7337 .v.func = alc280_fixup_hp_gpio4,
7338 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007339 [ALC286_FIXUP_HP_GPIO_LED] = {
7340 .type = HDA_FIXUP_FUNC,
7341 .v.func = alc286_fixup_hp_gpio_led,
7342 },
David Henningsson33f4acd2015-01-07 15:50:13 +01007343 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7344 .type = HDA_FIXUP_FUNC,
7345 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7346 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01007347 [ALC280_FIXUP_HP_DOCK_PINS] = {
7348 .type = HDA_FIXUP_PINS,
7349 .v.pins = (const struct hda_pintbl[]) {
7350 { 0x1b, 0x21011020 }, /* line-out */
7351 { 0x1a, 0x01a1903c }, /* headset mic */
7352 { 0x18, 0x2181103f }, /* line-in */
7353 { },
7354 },
7355 .chained = true,
7356 .chain_id = ALC280_FIXUP_HP_GPIO4
7357 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007358 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7359 .type = HDA_FIXUP_PINS,
7360 .v.pins = (const struct hda_pintbl[]) {
7361 { 0x1b, 0x21011020 }, /* line-out */
7362 { 0x18, 0x2181103f }, /* line-in */
7363 { },
7364 },
7365 .chained = true,
7366 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7367 },
Keith Packard98973f22015-07-15 12:14:39 -07007368 [ALC280_FIXUP_HP_9480M] = {
7369 .type = HDA_FIXUP_FUNC,
7370 .v.func = alc280_fixup_hp_9480m,
7371 },
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007372 [ALC245_FIXUP_HP_X360_AMP] = {
7373 .type = HDA_FIXUP_FUNC,
7374 .v.func = alc245_fixup_hp_x360_amp,
Johnathon Clark5fc462c2021-10-20 14:12:51 +01007375 .chained = true,
7376 .chain_id = ALC245_FIXUP_HP_GPIO_LED
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007377 },
Kailang Yange1e62b92015-04-08 16:01:22 +08007378 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7379 .type = HDA_FIXUP_FUNC,
7380 .v.func = alc_fixup_headset_mode_dell_alc288,
7381 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007382 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08007383 },
7384 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7385 .type = HDA_FIXUP_PINS,
7386 .v.pins = (const struct hda_pintbl[]) {
7387 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7388 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7389 { }
7390 },
7391 .chained = true,
7392 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7393 },
Hui Wang831bfdf92015-06-26 12:35:17 +08007394 [ALC288_FIXUP_DISABLE_AAMIX] = {
7395 .type = HDA_FIXUP_FUNC,
7396 .v.func = alc_fixup_disable_aamix,
7397 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02007398 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08007399 },
7400 [ALC288_FIXUP_DELL_XPS_13] = {
7401 .type = HDA_FIXUP_FUNC,
7402 .v.func = alc_fixup_dell_xps13,
7403 .chained = true,
7404 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7405 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007406 [ALC292_FIXUP_DISABLE_AAMIX] = {
7407 .type = HDA_FIXUP_FUNC,
7408 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08007409 .chained = true,
7410 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007411 },
David Henningssonc04017e2015-12-15 14:44:03 +01007412 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7413 .type = HDA_FIXUP_FUNC,
7414 .v.func = alc_fixup_disable_aamix,
7415 .chained = true,
7416 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7417 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007418 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007419 .type = HDA_FIXUP_FUNC,
7420 .v.func = alc_fixup_dell_xps13,
7421 .chained = true,
7422 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7423 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007424 [ALC292_FIXUP_DELL_E7X] = {
7425 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007426 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01007427 /* micmute fixup must be applied at last */
7428 .chained_before = true,
7429 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7430 },
James McDonnell54324222019-09-16 14:53:38 +00007431 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7432 .type = HDA_FIXUP_PINS,
7433 .v.pins = (const struct hda_pintbl[]) {
7434 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7435 { }
7436 },
7437 .chained_before = true,
7438 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7439 },
Kailang Yang977e6272015-05-18 15:31:20 +08007440 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7441 .type = HDA_FIXUP_PINS,
7442 .v.pins = (const struct hda_pintbl[]) {
7443 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7444 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7445 { }
7446 },
7447 .chained = true,
7448 .chain_id = ALC269_FIXUP_HEADSET_MODE
7449 },
Hui Wang2f726ae2017-03-31 10:31:40 +08007450 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7451 .type = HDA_FIXUP_PINS,
7452 .v.pins = (const struct hda_pintbl[]) {
7453 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7454 { }
7455 },
7456 .chained = true,
7457 .chain_id = ALC269_FIXUP_HEADSET_MODE
7458 },
Kailang Yang6ed11312015-10-26 15:37:39 +08007459 [ALC275_FIXUP_DELL_XPS] = {
7460 .type = HDA_FIXUP_VERBS,
7461 .v.verbs = (const struct hda_verb[]) {
7462 /* Enables internal speaker */
7463 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7464 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7465 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7466 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7467 {}
7468 }
7469 },
Hui Wang23adc192015-12-08 12:27:18 +08007470 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7471 .type = HDA_FIXUP_FUNC,
7472 .v.func = alc_fixup_disable_aamix,
7473 .chained = true,
7474 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7475 },
Kailang3694cb22015-12-28 11:35:24 +08007476 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7477 .type = HDA_FIXUP_FUNC,
7478 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7479 },
Phil Calvind1ee66c2021-04-15 18:01:29 -04007480 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7481 .type = HDA_FIXUP_FUNC,
7482 .v.func = alc_fixup_inv_dmic,
7483 .chained = true,
7484 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7485 },
7486 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7487 .type = HDA_FIXUP_FUNC,
7488 .v.func = alc269_fixup_limit_int_mic_boost
7489 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007490 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7491 .type = HDA_FIXUP_FUNC,
7492 .v.func = alc_fixup_disable_aamix,
7493 .chained = true,
7494 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7495 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08007496 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7497 .type = HDA_FIXUP_FUNC,
7498 .v.func = alc_fixup_disable_mic_vref,
7499 .chained = true,
7500 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7501 },
David Henningsson2ae95572016-02-25 09:37:05 +01007502 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7503 .type = HDA_FIXUP_VERBS,
7504 .v.verbs = (const struct hda_verb[]) {
7505 /* Disable pass-through path for FRONT 14h */
7506 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7507 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7508 {}
7509 },
7510 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007511 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007512 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007513 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7514 .type = HDA_FIXUP_FUNC,
7515 .v.func = alc_fixup_disable_aamix,
7516 .chained = true,
7517 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7518 },
Hui Wange549d192016-04-01 11:00:15 +08007519 [ALC221_FIXUP_HP_FRONT_MIC] = {
7520 .type = HDA_FIXUP_PINS,
7521 .v.pins = (const struct hda_pintbl[]) {
7522 { 0x19, 0x02a19020 }, /* Front Mic */
7523 { }
7524 },
7525 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007526 [ALC292_FIXUP_TPT460] = {
7527 .type = HDA_FIXUP_FUNC,
7528 .v.func = alc_fixup_tpt440_dock,
7529 .chained = true,
7530 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7531 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007532 [ALC298_FIXUP_SPK_VOLUME] = {
7533 .type = HDA_FIXUP_FUNC,
7534 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007535 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007536 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007537 },
Kailang Yangf86de9b2020-10-23 14:46:47 +08007538 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7539 .type = HDA_FIXUP_FUNC,
7540 .v.func = alc298_fixup_speaker_volume,
7541 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007542 [ALC295_FIXUP_DISABLE_DAC3] = {
7543 .type = HDA_FIXUP_FUNC,
7544 .v.func = alc295_fixup_disable_dac3,
7545 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007546 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7547 .type = HDA_FIXUP_FUNC,
7548 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007549 .chained = true,
7550 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007551 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007552 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7553 .type = HDA_FIXUP_PINS,
7554 .v.pins = (const struct hda_pintbl[]) {
7555 { 0x1b, 0x90170151 },
7556 { }
7557 },
7558 .chained = true,
7559 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7560 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007561 [ALC269_FIXUP_ATIV_BOOK_8] = {
7562 .type = HDA_FIXUP_FUNC,
7563 .v.func = alc_fixup_auto_mute_via_amp,
7564 .chained = true,
7565 .chain_id = ALC269_FIXUP_NO_SHUTUP
7566 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007567 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7568 .type = HDA_FIXUP_PINS,
7569 .v.pins = (const struct hda_pintbl[]) {
7570 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7571 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7572 { }
7573 },
7574 .chained = true,
7575 .chain_id = ALC269_FIXUP_HEADSET_MODE
7576 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007577 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7578 .type = HDA_FIXUP_FUNC,
7579 .v.func = alc_fixup_headset_mode,
7580 },
7581 [ALC256_FIXUP_ASUS_MIC] = {
7582 .type = HDA_FIXUP_PINS,
7583 .v.pins = (const struct hda_pintbl[]) {
7584 { 0x13, 0x90a60160 }, /* use as internal mic */
7585 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7586 { }
7587 },
7588 .chained = true,
7589 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7590 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007591 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007592 .type = HDA_FIXUP_FUNC,
7593 /* Set up GPIO2 for the speaker amp */
7594 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007595 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007596 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7597 .type = HDA_FIXUP_PINS,
7598 .v.pins = (const struct hda_pintbl[]) {
7599 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7600 { }
7601 },
7602 .chained = true,
7603 .chain_id = ALC269_FIXUP_HEADSET_MIC
7604 },
7605 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7606 .type = HDA_FIXUP_VERBS,
7607 .v.verbs = (const struct hda_verb[]) {
7608 /* Enables internal speaker */
7609 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7610 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7611 {}
7612 },
7613 .chained = true,
7614 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7615 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007616 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7617 .type = HDA_FIXUP_FUNC,
7618 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007619 .chained = true,
7620 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007621 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007622 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7623 .type = HDA_FIXUP_VERBS,
7624 .v.verbs = (const struct hda_verb[]) {
7625 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7626 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7627 { }
7628 },
7629 .chained = true,
7630 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7631 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007632 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7633 .type = HDA_FIXUP_PINS,
7634 .v.pins = (const struct hda_pintbl[]) {
7635 /* Change the mic location from front to right, otherwise there are
7636 two front mics with the same name, pulseaudio can't handle them.
7637 This is just a temporary workaround, after applying this fixup,
7638 there will be one "Front Mic" and one "Mic" in this machine.
7639 */
7640 { 0x1a, 0x04a19040 },
7641 { }
7642 },
7643 },
Kailang Yang5f364132017-07-25 16:28:16 +08007644 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7645 .type = HDA_FIXUP_PINS,
7646 .v.pins = (const struct hda_pintbl[]) {
7647 { 0x16, 0x0101102f }, /* Rear Headset HP */
7648 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7649 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7650 { 0x1b, 0x02011020 },
7651 { }
7652 },
7653 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007654 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7655 },
7656 [ALC225_FIXUP_S3_POP_NOISE] = {
7657 .type = HDA_FIXUP_FUNC,
7658 .v.func = alc225_fixup_s3_pop_noise,
7659 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007660 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7661 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007662 [ALC700_FIXUP_INTEL_REFERENCE] = {
7663 .type = HDA_FIXUP_VERBS,
7664 .v.verbs = (const struct hda_verb[]) {
7665 /* Enables internal speaker */
7666 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7667 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7668 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7669 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7670 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7671 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7672 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7673 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7674 {}
7675 }
7676 },
Kailang Yang92266652017-12-14 15:28:58 +08007677 [ALC274_FIXUP_DELL_BIND_DACS] = {
7678 .type = HDA_FIXUP_FUNC,
7679 .v.func = alc274_fixup_bind_dacs,
7680 .chained = true,
7681 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7682 },
7683 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7684 .type = HDA_FIXUP_PINS,
7685 .v.pins = (const struct hda_pintbl[]) {
7686 { 0x1b, 0x0401102f },
7687 { }
7688 },
7689 .chained = true,
7690 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7691 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007692 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007693 .type = HDA_FIXUP_FUNC,
7694 .v.func = alc_fixup_tpt470_dock,
7695 .chained = true,
7696 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7697 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007698 [ALC298_FIXUP_TPT470_DOCK] = {
7699 .type = HDA_FIXUP_FUNC,
7700 .v.func = alc_fixup_tpt470_dacs,
7701 .chained = true,
7702 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7703 },
Kailang Yangae104a22018-02-05 16:07:20 +08007704 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7705 .type = HDA_FIXUP_PINS,
7706 .v.pins = (const struct hda_pintbl[]) {
7707 { 0x14, 0x0201101f },
7708 { }
7709 },
7710 .chained = true,
7711 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7712 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007713 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7714 .type = HDA_FIXUP_PINS,
7715 .v.pins = (const struct hda_pintbl[]) {
7716 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7717 { }
7718 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007719 .chained = true,
7720 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007721 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007722 [ALC295_FIXUP_HP_X360] = {
7723 .type = HDA_FIXUP_FUNC,
7724 .v.func = alc295_fixup_hp_top_speakers,
7725 .chained = true,
7726 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007727 },
7728 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7729 .type = HDA_FIXUP_PINS,
7730 .v.pins = (const struct hda_pintbl[]) {
7731 { 0x19, 0x0181313f},
7732 { }
7733 },
7734 .chained = true,
7735 .chain_id = ALC269_FIXUP_HEADSET_MIC
7736 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007737 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7738 .type = HDA_FIXUP_FUNC,
7739 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007740 .chained = true,
7741 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007742 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007743 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7744 .type = HDA_FIXUP_FUNC,
7745 .v.func = alc_fixup_auto_mute_via_amp,
7746 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007747 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7748 .type = HDA_FIXUP_PINS,
7749 .v.pins = (const struct hda_pintbl[]) {
7750 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7751 { }
7752 },
7753 .chained = true,
7754 .chain_id = ALC269_FIXUP_HEADSET_MIC
7755 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007756 [ALC294_FIXUP_ASUS_MIC] = {
7757 .type = HDA_FIXUP_PINS,
7758 .v.pins = (const struct hda_pintbl[]) {
7759 { 0x13, 0x90a60160 }, /* use as internal mic */
7760 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7761 { }
7762 },
7763 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007764 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007765 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007766 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7767 .type = HDA_FIXUP_PINS,
7768 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007769 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007770 { }
7771 },
7772 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007773 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007774 },
7775 [ALC294_FIXUP_ASUS_SPK] = {
7776 .type = HDA_FIXUP_VERBS,
7777 .v.verbs = (const struct hda_verb[]) {
7778 /* Set EAPD high */
7779 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7780 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08007781 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7782 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007783 { }
7784 },
7785 .chained = true,
7786 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7787 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007788 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08007789 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007790 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08007791 .chained = true,
7792 .chain_id = ALC225_FIXUP_HEADSET_JACK
7793 },
7794 [ALC225_FIXUP_HEADSET_JACK] = {
7795 .type = HDA_FIXUP_FUNC,
7796 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08007797 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07007798 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7799 .type = HDA_FIXUP_PINS,
7800 .v.pins = (const struct hda_pintbl[]) {
7801 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7802 { }
7803 },
7804 .chained = true,
7805 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7806 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08007807 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7808 .type = HDA_FIXUP_VERBS,
7809 .v.verbs = (const struct hda_verb[]) {
7810 /* Disable PCBEEP-IN passthrough */
7811 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7812 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7813 { }
7814 },
7815 .chained = true,
7816 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7817 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007818 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7819 .type = HDA_FIXUP_PINS,
7820 .v.pins = (const struct hda_pintbl[]) {
7821 { 0x19, 0x03a11130 },
7822 { 0x1a, 0x90a60140 }, /* use as internal mic */
7823 { }
7824 },
7825 .chained = true,
7826 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7827 },
Kailang Yang136824e2019-03-14 16:22:45 +08007828 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7829 .type = HDA_FIXUP_PINS,
7830 .v.pins = (const struct hda_pintbl[]) {
7831 { 0x16, 0x01011020 }, /* Rear Line out */
7832 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7833 { }
7834 },
7835 .chained = true,
7836 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7837 },
7838 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7839 .type = HDA_FIXUP_FUNC,
7840 .v.func = alc_fixup_auto_mute_via_amp,
7841 .chained = true,
7842 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7843 },
7844 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7845 .type = HDA_FIXUP_FUNC,
7846 .v.func = alc_fixup_disable_mic_vref,
7847 .chained = true,
7848 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7849 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007850 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7851 .type = HDA_FIXUP_VERBS,
7852 .v.verbs = (const struct hda_verb[]) {
7853 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7854 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7855 { }
7856 },
7857 .chained = true,
7858 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7859 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08007860 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7861 .type = HDA_FIXUP_PINS,
7862 .v.pins = (const struct hda_pintbl[]) {
7863 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7864 { }
7865 },
7866 .chained = true,
7867 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7868 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08007869 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7870 .type = HDA_FIXUP_PINS,
7871 .v.pins = (const struct hda_pintbl[]) {
7872 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7873 { }
7874 },
7875 .chained = true,
7876 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7877 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007878 [ALC299_FIXUP_PREDATOR_SPK] = {
7879 .type = HDA_FIXUP_PINS,
7880 .v.pins = (const struct hda_pintbl[]) {
7881 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7882 { }
7883 }
7884 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02007885 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7886 .type = HDA_FIXUP_PINS,
7887 .v.pins = (const struct hda_pintbl[]) {
7888 { 0x19, 0x04a11040 },
7889 { 0x21, 0x04211020 },
7890 { }
7891 },
7892 .chained = true,
7893 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7894 },
Kailang Yange79c2262019-12-19 14:12:15 +08007895 [ALC289_FIXUP_DELL_SPK2] = {
7896 .type = HDA_FIXUP_PINS,
7897 .v.pins = (const struct hda_pintbl[]) {
7898 { 0x17, 0x90170130 }, /* bass spk */
7899 { }
7900 },
7901 .chained = true,
7902 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7903 },
7904 [ALC289_FIXUP_DUAL_SPK] = {
7905 .type = HDA_FIXUP_FUNC,
7906 .v.func = alc285_fixup_speaker2_to_dac1,
7907 .chained = true,
7908 .chain_id = ALC289_FIXUP_DELL_SPK2
7909 },
Chris Chiu48e01502019-12-30 11:11:18 +08007910 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7911 .type = HDA_FIXUP_FUNC,
7912 .v.func = alc285_fixup_speaker2_to_dac1,
7913 .chained = true,
7914 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7915 },
7916 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007917 .type = HDA_FIXUP_FUNC,
7918 /* The GPIO must be pulled to initialize the AMP */
7919 .v.func = alc_fixup_gpio4,
7920 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08007921 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007922 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007923 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7924 .type = HDA_FIXUP_FUNC,
7925 .v.func = alc285_fixup_thinkpad_x1_gen7,
7926 .chained = true,
7927 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7928 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08007929 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7930 .type = HDA_FIXUP_FUNC,
7931 .v.func = alc_fixup_headset_jack,
7932 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007933 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08007934 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007935 [ALC294_FIXUP_ASUS_HPE] = {
7936 .type = HDA_FIXUP_VERBS,
7937 .v.verbs = (const struct hda_verb[]) {
7938 /* Set EAPD high */
7939 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7940 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7941 { }
7942 },
7943 .chained = true,
7944 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7945 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007946 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7947 .type = HDA_FIXUP_PINS,
7948 .v.pins = (const struct hda_pintbl[]) {
7949 { 0x19, 0x03a11050 }, /* front HP mic */
7950 { 0x1a, 0x01a11830 }, /* rear external mic */
7951 { 0x21, 0x03211020 }, /* front HP out */
7952 { }
7953 },
7954 .chained = true,
7955 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7956 },
7957 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7958 .type = HDA_FIXUP_VERBS,
7959 .v.verbs = (const struct hda_verb[]) {
7960 /* set 0x15 to HP-OUT ctrl */
7961 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7962 /* unmute the 0x15 amp */
7963 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7964 { }
7965 },
7966 .chained = true,
7967 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7968 },
7969 [ALC294_FIXUP_ASUS_GX502_HP] = {
7970 .type = HDA_FIXUP_FUNC,
7971 .v.func = alc294_fixup_gx502_hp,
7972 },
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05007973 [ALC294_FIXUP_ASUS_GU502_PINS] = {
7974 .type = HDA_FIXUP_PINS,
7975 .v.pins = (const struct hda_pintbl[]) {
7976 { 0x19, 0x01a11050 }, /* rear HP mic */
7977 { 0x1a, 0x01a11830 }, /* rear external mic */
7978 { 0x21, 0x012110f0 }, /* rear HP out */
7979 { }
7980 },
7981 .chained = true,
7982 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
7983 },
7984 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
7985 .type = HDA_FIXUP_VERBS,
7986 .v.verbs = (const struct hda_verb[]) {
7987 /* set 0x15 to HP-OUT ctrl */
7988 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7989 /* unmute the 0x15 amp */
7990 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7991 /* set 0x1b to HP-OUT */
7992 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
7993 { }
7994 },
7995 .chained = true,
7996 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
7997 },
7998 [ALC294_FIXUP_ASUS_GU502_HP] = {
7999 .type = HDA_FIXUP_FUNC,
8000 .v.func = alc294_fixup_gu502_hp,
8001 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02008002 [ALC294_FIXUP_ASUS_COEF_1B] = {
8003 .type = HDA_FIXUP_VERBS,
8004 .v.verbs = (const struct hda_verb[]) {
8005 /* Set bit 10 to correct noisy output after reboot from
8006 * Windows 10 (due to pop noise reduction?)
8007 */
8008 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8009 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8010 { }
8011 },
Takashi Iwaif8fbcdf2021-06-20 08:59:52 +02008012 .chained = true,
8013 .chain_id = ALC289_FIXUP_ASUS_GA401,
Takashi Iwai1b94e592020-05-12 09:32:03 +02008014 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08008015 [ALC285_FIXUP_HP_GPIO_LED] = {
8016 .type = HDA_FIXUP_FUNC,
8017 .v.func = alc285_fixup_hp_gpio_led,
8018 },
Kailang Yang431e76c2020-04-07 14:40:20 +08008019 [ALC285_FIXUP_HP_MUTE_LED] = {
8020 .type = HDA_FIXUP_FUNC,
8021 .v.func = alc285_fixup_hp_mute_led,
8022 },
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008023 [ALC236_FIXUP_HP_GPIO_LED] = {
8024 .type = HDA_FIXUP_FUNC,
8025 .v.func = alc236_fixup_hp_gpio_led,
8026 },
Kailang Yang24164f42020-04-07 14:52:42 +08008027 [ALC236_FIXUP_HP_MUTE_LED] = {
8028 .type = HDA_FIXUP_FUNC,
8029 .v.func = alc236_fixup_hp_mute_led,
8030 },
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008031 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8032 .type = HDA_FIXUP_FUNC,
8033 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8034 },
Mike Pozulp14425f12020-05-09 20:28:37 -07008035 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8036 .type = HDA_FIXUP_VERBS,
8037 .v.verbs = (const struct hda_verb[]) {
8038 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8039 { }
8040 },
8041 },
Chris Chiu9e433422020-05-12 14:15:24 +08008042 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8043 .type = HDA_FIXUP_PINS,
8044 .v.pins = (const struct hda_pintbl[]) {
8045 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8046 { }
8047 },
8048 .chained = true,
8049 .chain_id = ALC269_FIXUP_HEADSET_MODE
8050 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008051 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8052 .type = HDA_FIXUP_PINS,
8053 .v.pins = (const struct hda_pintbl[]) {
8054 { 0x14, 0x90100120 }, /* use as internal speaker */
8055 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8056 { 0x1a, 0x01011020 }, /* use as line out */
8057 { },
8058 },
8059 .chained = true,
8060 .chain_id = ALC269_FIXUP_HEADSET_MIC
8061 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008062 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8063 .type = HDA_FIXUP_PINS,
8064 .v.pins = (const struct hda_pintbl[]) {
8065 { 0x18, 0x02a11030 }, /* use as headset mic */
8066 { }
8067 },
8068 .chained = true,
8069 .chain_id = ALC269_FIXUP_HEADSET_MIC
8070 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008071 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8072 .type = HDA_FIXUP_PINS,
8073 .v.pins = (const struct hda_pintbl[]) {
8074 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8075 { }
8076 },
8077 .chained = true,
8078 .chain_id = ALC269_FIXUP_HEADSET_MIC
8079 },
Armas Spann293a92c2020-07-24 16:08:37 +02008080 [ALC289_FIXUP_ASUS_GA401] = {
Takashi Iwaic84bfed2020-11-27 15:11:04 +01008081 .type = HDA_FIXUP_FUNC,
8082 .v.func = alc289_fixup_asus_ga401,
8083 .chained = true,
8084 .chain_id = ALC289_FIXUP_ASUS_GA502,
Armas Spannff536642020-07-11 13:05:57 +02008085 },
Armas Spann4b43d052020-07-24 16:06:16 +02008086 [ALC289_FIXUP_ASUS_GA502] = {
8087 .type = HDA_FIXUP_PINS,
8088 .v.pins = (const struct hda_pintbl[]) {
8089 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8090 { }
8091 },
8092 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008093 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8094 .type = HDA_FIXUP_PINS,
8095 .v.pins = (const struct hda_pintbl[]) {
8096 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8097 { }
8098 },
8099 .chained = true,
8100 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8101 },
Kailang Yang56496252020-07-29 15:09:27 +08008102 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8103 .type = HDA_FIXUP_FUNC,
8104 .v.func = alc285_fixup_hp_gpio_amp_init,
8105 .chained = true,
8106 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8107 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008108 [ALC269_FIXUP_CZC_B20] = {
8109 .type = HDA_FIXUP_PINS,
8110 .v.pins = (const struct hda_pintbl[]) {
8111 { 0x12, 0x411111f0 },
8112 { 0x14, 0x90170110 }, /* speaker */
8113 { 0x15, 0x032f1020 }, /* HP out */
8114 { 0x17, 0x411111f0 },
8115 { 0x18, 0x03ab1040 }, /* mic */
8116 { 0x19, 0xb7a7013f },
8117 { 0x1a, 0x0181305f },
8118 { 0x1b, 0x411111f0 },
8119 { 0x1d, 0x411111f0 },
8120 { 0x1e, 0x411111f0 },
8121 { }
8122 },
8123 .chain_id = ALC269_FIXUP_DMIC,
8124 },
8125 [ALC269_FIXUP_CZC_TMI] = {
8126 .type = HDA_FIXUP_PINS,
8127 .v.pins = (const struct hda_pintbl[]) {
8128 { 0x12, 0x4000c000 },
8129 { 0x14, 0x90170110 }, /* speaker */
8130 { 0x15, 0x0421401f }, /* HP out */
8131 { 0x17, 0x411111f0 },
8132 { 0x18, 0x04a19020 }, /* mic */
8133 { 0x19, 0x411111f0 },
8134 { 0x1a, 0x411111f0 },
8135 { 0x1b, 0x411111f0 },
8136 { 0x1d, 0x40448505 },
8137 { 0x1e, 0x411111f0 },
8138 { 0x20, 0x8000ffff },
8139 { }
8140 },
8141 .chain_id = ALC269_FIXUP_DMIC,
8142 },
8143 [ALC269_FIXUP_CZC_L101] = {
8144 .type = HDA_FIXUP_PINS,
8145 .v.pins = (const struct hda_pintbl[]) {
8146 { 0x12, 0x40000000 },
8147 { 0x14, 0x01014010 }, /* speaker */
8148 { 0x15, 0x411111f0 }, /* HP out */
8149 { 0x16, 0x411111f0 },
8150 { 0x18, 0x01a19020 }, /* mic */
8151 { 0x19, 0x02a19021 },
8152 { 0x1a, 0x0181302f },
8153 { 0x1b, 0x0221401f },
8154 { 0x1c, 0x411111f0 },
8155 { 0x1d, 0x4044c601 },
8156 { 0x1e, 0x411111f0 },
8157 { }
8158 },
8159 .chain_id = ALC269_FIXUP_DMIC,
8160 },
8161 [ALC269_FIXUP_LEMOTE_A1802] = {
8162 .type = HDA_FIXUP_PINS,
8163 .v.pins = (const struct hda_pintbl[]) {
8164 { 0x12, 0x40000000 },
8165 { 0x14, 0x90170110 }, /* speaker */
8166 { 0x17, 0x411111f0 },
8167 { 0x18, 0x03a19040 }, /* mic1 */
8168 { 0x19, 0x90a70130 }, /* mic2 */
8169 { 0x1a, 0x411111f0 },
8170 { 0x1b, 0x411111f0 },
8171 { 0x1d, 0x40489d2d },
8172 { 0x1e, 0x411111f0 },
8173 { 0x20, 0x0003ffff },
8174 { 0x21, 0x03214020 },
8175 { }
8176 },
8177 .chain_id = ALC269_FIXUP_DMIC,
8178 },
8179 [ALC269_FIXUP_LEMOTE_A190X] = {
8180 .type = HDA_FIXUP_PINS,
8181 .v.pins = (const struct hda_pintbl[]) {
8182 { 0x14, 0x99130110 }, /* speaker */
8183 { 0x15, 0x0121401f }, /* HP out */
8184 { 0x18, 0x01a19c20 }, /* rear mic */
8185 { 0x19, 0x99a3092f }, /* front mic */
8186 { 0x1b, 0x0201401f }, /* front lineout */
8187 { }
8188 },
8189 .chain_id = ALC269_FIXUP_DMIC,
8190 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008191 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8192 .type = HDA_FIXUP_PINS,
8193 .v.pins = (const struct hda_pintbl[]) {
8194 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8195 { }
8196 },
8197 .chained = true,
8198 .chain_id = ALC269_FIXUP_HEADSET_MODE
8199 },
Werner Sembach73e71612021-03-02 19:04:14 +01008200 [ALC256_FIXUP_INTEL_NUC10] = {
8201 .type = HDA_FIXUP_PINS,
8202 .v.pins = (const struct hda_pintbl[]) {
8203 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8204 { }
8205 },
8206 .chained = true,
8207 .chain_id = ALC269_FIXUP_HEADSET_MODE
8208 },
Hui Wangfc19d552020-09-09 10:00:41 +08008209 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8210 .type = HDA_FIXUP_VERBS,
8211 .v.verbs = (const struct hda_verb[]) {
8212 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8213 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8214 { }
8215 },
8216 .chained = true,
Takashi Iwaic84bfed2020-11-27 15:11:04 +01008217 .chain_id = ALC289_FIXUP_ASUS_GA502
Hui Wangfc19d552020-09-09 10:00:41 +08008218 },
Hui Wang13468bf2020-09-28 16:01:17 +08008219 [ALC274_FIXUP_HP_MIC] = {
8220 .type = HDA_FIXUP_VERBS,
8221 .v.verbs = (const struct hda_verb[]) {
8222 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8223 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8224 { }
8225 },
8226 },
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008227 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8228 .type = HDA_FIXUP_FUNC,
8229 .v.func = alc274_fixup_hp_headset_mic,
8230 .chained = true,
8231 .chain_id = ALC274_FIXUP_HP_MIC
8232 },
Takashi Iwai622464c2021-05-04 11:18:02 +02008233 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8234 .type = HDA_FIXUP_FUNC,
8235 .v.func = alc274_fixup_hp_envy_gpio,
8236 },
Kailang Yangef9ce662020-11-03 15:40:35 +08008237 [ALC256_FIXUP_ASUS_HPE] = {
8238 .type = HDA_FIXUP_VERBS,
8239 .v.verbs = (const struct hda_verb[]) {
8240 /* Set EAPD high */
8241 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8242 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8243 { }
8244 },
8245 .chained = true,
8246 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8247 },
Kailang Yang446b8182020-11-02 15:00:12 +08008248 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8249 .type = HDA_FIXUP_FUNC,
8250 .v.func = alc_fixup_headset_jack,
8251 .chained = true,
8252 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8253 },
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008254 [ALC287_FIXUP_HP_GPIO_LED] = {
8255 .type = HDA_FIXUP_FUNC,
8256 .v.func = alc287_fixup_hp_gpio_led,
8257 },
Kailang Yang9e885772020-11-03 15:30:51 +08008258 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8259 .type = HDA_FIXUP_FUNC,
8260 .v.func = alc274_fixup_hp_headset_mic,
8261 },
Kailang Yang92666d42020-11-19 17:04:21 +08008262 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8263 .type = HDA_FIXUP_FUNC,
8264 .v.func = alc_fixup_no_int_mic,
8265 .chained = true,
8266 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8267 },
Chris Chiu34cdf402020-12-16 20:52:00 +08008268 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8269 .type = HDA_FIXUP_PINS,
8270 .v.pins = (const struct hda_pintbl[]) {
8271 { 0x1b, 0x411111f0 },
8272 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8273 { },
8274 },
8275 .chained = true,
8276 .chain_id = ALC269_FIXUP_HEADSET_MODE
8277 },
Chris Chiu495dc762021-01-14 16:27:28 +08008278 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8279 .type = HDA_FIXUP_FUNC,
8280 .v.func = alc269_fixup_limit_int_mic_boost,
8281 .chained = true,
8282 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8283 },
Chris Chiud0e18562021-02-26 09:04:40 +08008284 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8285 .type = HDA_FIXUP_PINS,
8286 .v.pins = (const struct hda_pintbl[]) {
8287 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8288 { 0x1a, 0x90a1092f }, /* use as internal mic */
8289 { }
8290 },
8291 .chained = true,
8292 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8293 },
Takashi Iwai26928ca2021-04-16 10:12:11 +02008294 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8295 .type = HDA_FIXUP_FUNC,
8296 .v.func = alc285_fixup_ideapad_s740_coef,
8297 .chained = true,
8298 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8299 },
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008300 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8301 .type = HDA_FIXUP_FUNC,
8302 .v.func = alc269_fixup_limit_int_mic_boost,
8303 .chained = true,
8304 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8305 },
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008306 [ALC295_FIXUP_ASUS_DACS] = {
8307 .type = HDA_FIXUP_FUNC,
8308 .v.func = alc295_fixup_asus_dacs,
8309 },
Takashi Iwai5d84b532021-05-04 14:18:32 +02008310 [ALC295_FIXUP_HP_OMEN] = {
8311 .type = HDA_FIXUP_PINS,
8312 .v.pins = (const struct hda_pintbl[]) {
8313 { 0x12, 0xb7a60130 },
8314 { 0x13, 0x40000000 },
8315 { 0x14, 0x411111f0 },
8316 { 0x16, 0x411111f0 },
8317 { 0x17, 0x90170110 },
8318 { 0x18, 0x411111f0 },
8319 { 0x19, 0x02a11030 },
8320 { 0x1a, 0x411111f0 },
8321 { 0x1b, 0x04a19030 },
8322 { 0x1d, 0x40600001 },
8323 { 0x1e, 0x411111f0 },
8324 { 0x21, 0x03211020 },
8325 {}
8326 },
8327 .chained = true,
8328 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8329 },
Elia Devitof2be77f2021-05-11 14:46:49 +02008330 [ALC285_FIXUP_HP_SPECTRE_X360] = {
Elia Devito434591b2021-06-19 22:41:04 +02008331 .type = HDA_FIXUP_FUNC,
8332 .v.func = alc285_fixup_hp_spectre_x360,
Elia Devitof2be77f2021-05-11 14:46:49 +02008333 },
Davide Baldod94befb2021-10-15 09:21:22 +02008334 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8335 .type = HDA_FIXUP_FUNC,
8336 .v.func = alc285_fixup_hp_spectre_x360_eb1
8337 },
Hui Wang9ebaef02021-05-22 12:26:45 +08008338 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8339 .type = HDA_FIXUP_FUNC,
8340 .v.func = alc285_fixup_ideapad_s740_coef,
8341 .chained = true,
8342 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8343 },
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008344 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8345 .type = HDA_FIXUP_FUNC,
8346 .v.func = alc_fixup_no_shutup,
8347 .chained = true,
8348 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8349 },
Hui Wang57c9e212021-06-08 10:46:00 +08008350 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8351 .type = HDA_FIXUP_PINS,
8352 .v.pins = (const struct hda_pintbl[]) {
8353 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8354 { }
8355 },
8356 .chained = true,
8357 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8358 },
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08008359 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8360 .type = HDA_FIXUP_FUNC,
8361 .v.func = alc269_fixup_limit_int_mic_boost,
8362 .chained = true,
8363 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8364 },
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07008365 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8366 .type = HDA_FIXUP_VERBS,
8367 //.v.verbs = legion_15imhg05_coefs,
8368 .v.verbs = (const struct hda_verb[]) {
8369 // set left speaker Legion 7i.
8370 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8371 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8372
8373 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8374 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8375 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8376 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8377 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8378
8379 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8380 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8381 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8382 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8383 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8384
8385 // set right speaker Legion 7i.
8386 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8387 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8388
8389 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8390 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8391 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8392 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8393 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8394
8395 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8396 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8397 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8398 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8399 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8400 {}
8401 },
8402 .chained = true,
8403 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8404 },
8405 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8406 .type = HDA_FIXUP_FUNC,
8407 .v.func = alc287_fixup_legion_15imhg05_speakers,
8408 .chained = true,
8409 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8410 },
8411 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8412 .type = HDA_FIXUP_VERBS,
8413 .v.verbs = (const struct hda_verb[]) {
8414 // set left speaker Yoga 7i.
8415 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8416 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8417
8418 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8419 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8420 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8421 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8422 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8423
8424 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8425 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8426 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8427 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8428 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8429
8430 // set right speaker Yoga 7i.
8431 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8432 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8433
8434 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8435 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8436 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8437 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8438 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8439
8440 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8441 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8442 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8443 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8444 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8445 {}
8446 },
8447 .chained = true,
8448 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8449 },
8450 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8451 .type = HDA_FIXUP_VERBS,
8452 .v.verbs = (const struct hda_verb[]) {
8453 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8454 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
Cameron Berkenpas023a0622021-10-10 15:54:11 -07008455 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07008456 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8457 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8458 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8459 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8460 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8461 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8462 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8463 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8464 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8465 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8466 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8467 {}
8468 },
8469 .chained = true,
8470 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8471 },
Werner Sembach619764c2021-12-02 17:50:10 +01008472 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02008473 .type = HDA_FIXUP_FUNC,
Werner Sembach619764c2021-12-02 17:50:10 +01008474 .v.func = alc256_fixup_set_coef_defaults,
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02008475 },
Johnathon Clark5fc462c2021-10-20 14:12:51 +01008476 [ALC245_FIXUP_HP_GPIO_LED] = {
8477 .type = HDA_FIXUP_FUNC,
8478 .v.func = alc245_fixup_hp_gpio_led,
8479 },
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06008480 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8481 .type = HDA_FIXUP_PINS,
8482 .v.pins = (const struct hda_pintbl[]) {
8483 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8484 { }
8485 },
8486 .chained = true,
8487 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8488 },
Werner Sembach174a7fb2021-11-12 12:07:04 +01008489 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8490 .type = HDA_FIXUP_FUNC,
8491 .v.func = alc233_fixup_no_audio_jack,
8492 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02008493};
8494
8495static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01008496 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02008497 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8498 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008499 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02008500 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008501 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8502 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05008503 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01008504 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02008505 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Takashi Iwai433f8942021-04-28 13:26:56 +02008506 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
Takashi Iwaic8426b22021-04-07 11:57:30 +02008507 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
Chris Chiu13be30f2020-12-22 23:04:59 +08008508 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
Chris Chiu705b65f2018-12-05 14:48:54 +08008509 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008510 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01008511 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiu495dc762021-01-14 16:27:28 +08008512 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
Chris Chiuc7531e32019-03-21 17:17:31 +08008513 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8514 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiu13be30f2020-12-22 23:04:59 +08008515 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8516 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008517 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008518 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008519 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiud0e18562021-02-26 09:04:40 +08008520 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08008521 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8522 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8523 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Chris Chiud0e18562021-02-26 09:04:40 +08008524 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
Nikos Liolios35171fb2021-07-27 06:05:10 +03008525 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08008526 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08008527 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08008528 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jaroslav Kysela2a5bb692021-11-04 16:57:26 +01008529 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Alexander Monakov0d4867a2021-07-21 20:01:41 +03008530 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008531 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
Hui Wang57c9e212021-06-08 10:46:00 +08008532 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008533 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08008534 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01008535 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01008536 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02008537 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8538 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008539 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02008540 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8541 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8542 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01008543 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8544 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01008545 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02008546 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008547 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08008548 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8549 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08008550 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02008551 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02008552 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08008553 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08008554 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8555 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01008556 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8557 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8558 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8559 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8560 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08008561 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08008562 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01008563 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08008564 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08008565 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwai493de342017-02-28 17:27:57 +01008566 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008567 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Kailang Yang5f364132017-07-25 16:28:16 +08008568 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08008569 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8570 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08008571 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8572 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08008573 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08008574 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08008575 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08008576 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08008577 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008578 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08008579 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8580 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yang92666d42020-11-19 17:04:21 +08008581 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8582 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
Kailang Yangc1e89522020-12-23 15:34:57 +08008583 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
Kristin Pagetda946922021-08-14 15:46:05 -07008584 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
John Liueb676622021-09-30 13:53:16 +02008585 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
Chris Chiu2b987fe2021-10-01 14:28:56 +08008586 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8587 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
Kailang Yanga22aa262014-04-23 17:34:28 +08008588 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8589 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01008590 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008591 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01008592 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
Hui Wang7976eb42015-02-13 11:14:41 +08008593 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008594 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008595 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008596 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8597 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8598 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8599 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008600 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8601 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8602 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8603 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008604 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008605 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8606 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8607 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8608 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8609 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008610 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008611 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008612 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08008613 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008614 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8615 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8616 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008617 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8618 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8619 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8620 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8621 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008622 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008623 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008624 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008625 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008626 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08008627 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008628 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008629 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008630 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008631 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8632 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8633 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8634 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8635 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008636 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008637 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8638 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008639 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8640 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8641 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8642 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang8a02b162014-06-13 17:16:31 +08008643 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8644 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8645 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8646 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008647 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8648 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Kailang Yang1c9d9df2021-04-20 14:17:34 +08008649 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8650 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
Takashi Iwai563785e2018-11-12 09:43:12 +01008651 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08008652 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01008653 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Takashi Iwaiaeedad22020-11-28 10:00:15 +01008654 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008655 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8656 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05008657 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Carlos M901be142021-05-31 22:20:26 +02008658 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02008659 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai5d84b532021-05-04 14:18:32 +02008660 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
Sam Bazleyd33cd422019-09-01 03:31:30 +01008661 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Elia Devitof2be77f2021-05-11 14:46:49 +02008662 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
Bradley Scottd296a742021-12-13 10:49:39 -05008663 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Takashi Iwai0ac05b22021-06-23 14:20:22 +02008664 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008665 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Takashi Iwai622464c2021-05-04 11:18:02 +02008666 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
Jeremy Szu15d295b2021-06-05 16:25:36 +08008667 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szu61d3e872021-06-05 16:25:37 +08008668 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Kai-Heng Fenga5980982020-12-30 20:56:35 +08008669 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengc0584932021-11-10 22:40:32 +08008670 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008671 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008672 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Takashi Iwai05ec7162021-11-18 08:16:36 +01008673 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Kailang Yang56496252020-07-29 15:09:27 +08008674 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Qiu Wenbo08befca2020-10-02 20:44:54 +08008675 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08008676 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08008677 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Jeremy Szu91bc1562021-01-06 21:05:46 +08008678 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8679 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8680 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8681 ALC285_FIXUP_HP_GPIO_AMP_INIT),
Takashi Iwai375f8422021-10-28 09:09:11 +02008682 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
Manuel Jiménez48422952020-12-29 15:38:56 +01008683 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008684 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Andy Chi2b70b262021-07-01 17:14:13 +08008685 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Andy Chifb3acdb2021-07-01 17:14:15 +08008686 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szu417eadf2021-03-30 19:44:27 +08008687 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008688 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8689 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
Johnathon Clark93ab3ea2021-08-23 17:21:10 +01008690 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008691 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Jeremy Szud07149a2021-08-10 18:08:45 +08008692 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szudfc2e8a2021-06-25 21:34:13 +08008693 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Davide Baldod94befb2021-10-15 09:21:22 +02008694 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8695 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
Jeremy Szu53b861b2021-03-16 17:42:35 +08008696 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuc3d2c882021-06-18 01:14:20 +08008697 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szudfb06402021-06-05 16:25:38 +08008698 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuca688332021-03-16 14:54:50 +08008699 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08008700 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8701 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
Jeremy Szu50dbfae2021-05-20 01:03:56 +08008702 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szue650c1a2021-05-20 01:03:55 +08008703 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szubbe183e2021-05-20 01:03:54 +08008704 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szu600dd2a2021-06-08 19:47:48 +08008705 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szu0e68c4b2021-05-20 01:03:53 +08008706 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008707 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
Frank Schäfer42334fb2021-07-03 15:54:16 +02008708 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
Jeremy Szuf7ac5702021-12-15 00:41:54 +08008709 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008710 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02008711 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02008712 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01008713 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008714 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008715 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02008716 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008717 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008718 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiu5cfca592020-12-07 15:27:55 +08008719 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008720 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8721 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008722 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008723 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008724 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01008725 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01008726 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02008727 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008728 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
Chris Chiu48e01502019-12-30 11:11:18 +08008729 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Luke D Jones739d0952021-08-07 14:58:05 +12008730 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008731 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Daniel Drake8c8967a2019-10-17 16:15:01 +08008732 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08008733 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08008734 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Takashi Iwai4fad4fb2021-11-07 09:33:39 +01008735 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
Jian-Hong Pan5de3b942021-01-22 13:47:06 +08008736 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08008737 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08008738 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02008739 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06008740 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02008741 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02008742 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06008743 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008744 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008745 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Kailang Yangef9ce662020-11-03 15:40:35 +08008746 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
Armas Spann4b43d052020-07-24 16:06:16 +02008747 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05008748 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
Luke D Jones76fae612021-04-19 15:04:11 +12008749 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
Armas Spann293a92c2020-07-24 16:08:37 +02008750 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Chris Chiueeed4cd2017-02-28 14:17:15 -06008751 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02008752 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8753 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8754 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8755 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02008756 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008757 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8758 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8759 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02008760 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwaicab561f2021-04-28 13:26:59 +02008761 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8762 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai24519912011-08-16 15:08:49 +02008763 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02008764 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02008765 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01008766 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
Takashi Iwaic656f742021-04-28 13:27:01 +02008767 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
David Henningsson2041d562014-06-13 11:15:44 +02008768 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08008769 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
Takashi Iwaic656f742021-04-28 13:27:01 +02008770 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02008771 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
PeiSen Houce2e79b2020-12-31 11:57:28 +01008772 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8773 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09008774 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02008775 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07008776 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8777 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07008778 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09008779 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01008780 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09008781 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Takashi Iwaic656f742021-04-28 13:27:01 +02008782 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02008783 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8784 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01008785 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Chris Chiu6ca653e2020-12-22 23:04:58 +08008786 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008787 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02008788 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008789 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8790 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8791 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8792 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8793 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8794 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8795 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8796 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8797 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8798 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06008799 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8800 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008801 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8802 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8803 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8804 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8805 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06008806 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8807 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008808 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008809 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008810 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008811 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8812 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008813 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8814 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8815 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8816 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8817 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008818 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8819 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8820 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8821 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008822 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8823 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8824 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8825 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8826 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02008827 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8828 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8829 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8830 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8831 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008832 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8833 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8834 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8835 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8836 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8837 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8838 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008839 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008840 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8841 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02008842 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8843 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008844 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8845 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8846 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8847 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8848 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8849 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008850 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008851 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008852 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8853 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8854 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8855 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8856 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaif552ff52021-04-28 13:27:00 +02008857 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwaib590b382020-05-14 18:05:33 +02008858 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02008859 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02008860 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02008861 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02008862 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01008863 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02008864 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02008865 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05008866 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02008867 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01008868 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02008869 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01008870 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07008871 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02008872 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008873 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8874 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02008875 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02008876 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008877 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8878 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8879 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01008880 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008881 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8882 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8883 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01008884 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09008885 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02008886 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang Yang446b8182020-11-02 15:00:12 +08008887 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8888 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Kailang3694cb22015-12-28 11:35:24 +08008889 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08008890 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08008891 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02008892 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08008893 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08008894 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08008895 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08008896 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08008897 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8898 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Hui Wange4efa822021-07-19 11:02:31 +08008899 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Kailang Yangf86de9b2020-10-23 14:46:47 +08008900 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
Takashi Iwai26928ca2021-04-16 10:12:11 +02008901 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
Hui Wang9ebaef02021-05-22 12:26:45 +08008902 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07008903 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
8904 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8905 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8906 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
David Henningsson56f27012016-01-11 09:33:14 +01008907 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01008908 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02008909 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaif552ff52021-04-28 13:27:00 +02008910 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
David Henningssona4a9e082013-08-16 14:09:01 +02008911 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02008912 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02008913 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008914 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02008915 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01008916 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02008917 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02008918 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08008919 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008920 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02008921 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008922 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008923 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8924 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8925 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008926 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008927 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8928 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008929 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Werner Sembach174a7fb2021-11-12 12:07:04 +01008930 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008931 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008932 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8933 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8934 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02008935 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaic656f742021-04-28 13:27:01 +02008936 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8937 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Werner Sembach619764c2021-12-02 17:50:10 +01008938 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
Hui Wangfc19d552020-09-09 10:00:41 +08008939 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Xiaoliang Yub95bc122021-03-16 00:49:00 +08008940 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang695d1ec2019-11-21 10:54:27 +08008941 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Xiaoliang Yue1c86212021-03-13 07:54:53 +08008942 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Phil Calvind1ee66c2021-04-15 18:01:29 -04008943 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008944 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Werner Sembach73e71612021-03-02 19:04:14 +01008945 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008946
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01008947#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02008948 /* Below is a quirk table taken from the old code.
8949 * Basically the device should work as is without the fixup table.
8950 * If BIOS doesn't give a proper info, enable the corresponding
8951 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008952 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02008953 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8954 ALC269_FIXUP_AMIC),
8955 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008956 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8957 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8958 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8959 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8960 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8961 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8962 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8963 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8964 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8965 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8966 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8967 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8968 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8969 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8970 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8971 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8972 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8973 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8974 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8975 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8976 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8977 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8978 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8979 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8980 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8981 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8982 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8983 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8984 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8985 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8986 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8987 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8988 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8989 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8990 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8991 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8992 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8993 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8994#endif
8995 {}
8996};
8997
David Henningsson214eef72014-07-22 14:09:35 +02008998static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8999 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9000 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9001 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9002 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04009003 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02009004 {}
9005};
9006
Takashi Iwai1727a772013-01-10 09:52:52 +01009007static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02009008 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9009 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02009010 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9011 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9012 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02009013 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02009014 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9015 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02009016 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02009017 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01009018 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01009019 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02009020 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9021 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009022 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9023 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08009024 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08009025 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02009026 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01009027 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02009028 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02009029 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009030 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02009031 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02009032 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009033 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9034 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9035 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9036 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9037 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9038 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9039 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9040 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9041 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9042 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9043 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9044 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9045 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9046 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9047 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9048 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9049 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9050 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9051 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9052 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9053 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9054 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9055 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9056 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9057 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9058 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9059 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9060 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9061 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9062 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9063 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9064 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9065 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9066 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9067 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9068 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9069 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9070 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9071 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9072 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01009073 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009074 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
Takashi Iwaic8426b22021-04-07 11:57:30 +02009075 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009076 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9077 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9078 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9079 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9080 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9081 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9082 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9083 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9084 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9085 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9086 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9087 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9088 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9089 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009090 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9091 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9092 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08009093 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009094 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01009095 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009096 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9097 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9098 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9099 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9100 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9101 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9102 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9103 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9104 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9105 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9106 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9107 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9108 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9109 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9110 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9111 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9112 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08009113 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9114 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01009115 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02009116 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02009117 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07009118 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08009119 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08009120 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01009121 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
Takashi Iwai5d84b532021-05-04 14:18:32 +02009122 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
Elia Devitof2be77f2021-05-11 14:46:49 +02009123 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
Davide Baldod94befb2021-10-15 09:21:22 +02009124 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
Hui Wang9ebaef02021-05-22 12:26:45 +08009125 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03009126 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
Hui Wang57c9e212021-06-08 10:46:00 +08009127 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
Bradley Scottaa723942021-12-13 11:22:47 -05009128 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02009129 {}
9130};
Kailang Yangcfc5a842016-02-03 15:20:39 +08009131#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08009132 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02009133
Hui Wange8191a82015-04-24 13:39:59 +08009134#define ALC256_STANDARD_PINS \
9135 {0x12, 0x90a60140}, \
9136 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08009137 {0x21, 0x02211020}
9138
David Henningssonfea185e2014-09-03 10:23:04 +02009139#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08009140 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08009141
David Henningssonfea185e2014-09-03 10:23:04 +02009142#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08009143 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02009144
9145#define ALC292_STANDARD_PINS \
9146 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08009147 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08009148
Hui Wang3f6409702016-09-11 11:26:16 +08009149#define ALC295_STANDARD_PINS \
9150 {0x12, 0xb7a60130}, \
9151 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08009152 {0x21, 0x04211020}
9153
Woodrow Shen703867e2015-08-05 12:34:12 +08009154#define ALC298_STANDARD_PINS \
9155 {0x12, 0x90a60130}, \
9156 {0x21, 0x03211020}
9157
Hui Wange1918932014-05-26 16:22:44 +08009158static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08009159 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9160 {0x14, 0x01014020},
9161 {0x17, 0x90170110},
9162 {0x18, 0x02a11030},
9163 {0x19, 0x0181303F},
9164 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06009165 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9166 {0x12, 0x90a601c0},
9167 {0x14, 0x90171120},
9168 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06009169 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9170 {0x14, 0x90170110},
9171 {0x1b, 0x90a70130},
9172 {0x21, 0x03211020}),
9173 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9174 {0x1a, 0x90a70130},
9175 {0x1b, 0x90170110},
9176 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01009177 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08009178 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08009179 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08009180 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01009181 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08009182 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08009183 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08009184 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08009185 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9186 ALC225_STANDARD_PINS,
9187 {0x12, 0xb7a60150},
9188 {0x14, 0x901701a0}),
9189 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9190 ALC225_STANDARD_PINS,
9191 {0x12, 0xb7a60150},
9192 {0x14, 0x901701b0}),
9193 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9194 ALC225_STANDARD_PINS,
9195 {0x12, 0xb7a60130},
9196 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05009197 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9198 {0x1b, 0x01111010},
9199 {0x1e, 0x01451130},
9200 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08009201 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9202 {0x12, 0x90a60140},
9203 {0x14, 0x90170110},
9204 {0x19, 0x02a11030},
9205 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08009206 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9207 {0x14, 0x90170110},
9208 {0x19, 0x02a11030},
9209 {0x1a, 0x02a11040},
9210 {0x1b, 0x01014020},
9211 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08009212 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9213 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08009214 {0x19, 0x02a11030},
9215 {0x1a, 0x02a11040},
9216 {0x1b, 0x01011020},
9217 {0x21, 0x0221101f}),
9218 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9219 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08009220 {0x19, 0x02a11020},
9221 {0x1a, 0x02a11030},
9222 {0x21, 0x0221101f}),
Kailang Yang92666d42020-11-19 17:04:21 +08009223 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9224 {0x21, 0x02211010}),
Kailang Yang9e885772020-11-03 15:30:51 +08009225 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9226 {0x14, 0x90170110},
9227 {0x19, 0x02a11020},
9228 {0x21, 0x02211030}),
Hui Wangc77900e2014-09-03 11:31:07 +08009229 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08009230 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08009231 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02009232 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08009233 {0x14, 0x90170130},
9234 {0x21, 0x02211040}),
9235 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02009236 {0x12, 0x90a60140},
9237 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02009238 {0x21, 0x02211020}),
9239 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9240 {0x12, 0x90a60160},
9241 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009242 {0x21, 0x02211030}),
9243 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08009244 {0x14, 0x90170110},
9245 {0x1b, 0x02011020},
9246 {0x21, 0x0221101f}),
9247 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08009248 {0x14, 0x90170110},
9249 {0x1b, 0x01011020},
9250 {0x21, 0x0221101f}),
9251 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02009252 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02009253 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02009254 {0x21, 0x0221103f}),
9255 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08009256 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08009257 {0x1b, 0x01011020},
9258 {0x21, 0x0221103f}),
9259 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9260 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08009261 {0x1b, 0x02011020},
9262 {0x21, 0x0221103f}),
9263 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08009264 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009265 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009266 {0x21, 0x0221105f}),
9267 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08009268 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009269 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009270 {0x21, 0x0221101f}),
9271 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02009272 {0x12, 0x90a60160},
9273 {0x14, 0x90170120},
9274 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02009275 {0x21, 0x0321102f}),
9276 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9277 {0x12, 0x90a60160},
9278 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02009279 {0x21, 0x02211040}),
9280 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9281 {0x12, 0x90a60160},
9282 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02009283 {0x21, 0x02211050}),
9284 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9285 {0x12, 0x90a60170},
9286 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009287 {0x21, 0x02211030}),
9288 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9289 {0x12, 0x90a60170},
9290 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02009291 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08009292 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08009293 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08009294 {0x14, 0x90171130},
9295 {0x21, 0x02211040}),
9296 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9297 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08009298 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08009299 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02009300 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02009301 {0x12, 0x90a60180},
9302 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02009303 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08009304 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9305 {0x12, 0x90a60180},
9306 {0x14, 0x90170120},
9307 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08009308 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9309 {0x1b, 0x01011020},
9310 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06009311 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9312 {0x14, 0x90170110},
9313 {0x1b, 0x90a70130},
9314 {0x21, 0x04211020}),
9315 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9316 {0x14, 0x90170110},
9317 {0x1b, 0x90a70130},
9318 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08009319 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08009320 {0x12, 0x90a60130},
9321 {0x14, 0x90170110},
9322 {0x21, 0x03211020}),
9323 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08009324 {0x12, 0x90a60130},
9325 {0x14, 0x90170110},
9326 {0x21, 0x04211020}),
9327 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08009328 {0x1a, 0x90a70130},
9329 {0x1b, 0x90170110},
9330 {0x21, 0x03211020}),
Kailang Yang9e885772020-11-03 15:30:51 +08009331 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9332 {0x14, 0x90170110},
9333 {0x19, 0x02a11020},
9334 {0x21, 0x0221101f}),
Kailang Yang8a8de09c2020-10-27 16:46:38 +08009335 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9336 {0x17, 0x90170110},
9337 {0x19, 0x03a11030},
9338 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01009339 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9340 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01009341 {0x14, 0x90170110},
9342 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009343 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08009344 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9345 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08009346 {0x14, 0x90170110},
9347 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08009348 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08009349 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08009350 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02009351 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009352 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02009353 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02009354 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02009355 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08009356 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009357 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009358 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009359 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08009360 {0x21, 0x03211040}),
9361 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009362 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009363 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009364 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08009365 {0x21, 0x03211020}),
9366 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009367 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009368 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009369 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08009370 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08009371 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02009372 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08009373 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08009374 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08009375 {0x21, 0x04211020}),
Chris Chiu34cdf402020-12-16 20:52:00 +08009376 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9377 ALC282_STANDARD_PINS,
9378 {0x12, 0x90a609c0},
9379 {0x18, 0x03a11830},
9380 {0x19, 0x04a19831},
9381 {0x1a, 0x0481303f},
9382 {0x1b, 0x04211020},
9383 {0x21, 0x0321101f}),
9384 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9385 ALC282_STANDARD_PINS,
9386 {0x12, 0x90a60940},
9387 {0x18, 0x03a11830},
9388 {0x19, 0x04a19831},
9389 {0x1a, 0x0481303f},
9390 {0x1b, 0x04211020},
9391 {0x21, 0x0321101f}),
David Henningsson76c21322014-06-24 14:46:54 +02009392 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009393 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009394 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02009395 {0x21, 0x0321101f}),
9396 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9397 {0x12, 0x90a60160},
9398 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009399 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08009400 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009401 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08009402 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08009403 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08009404 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08009405 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Sami Loone266fd992021-05-01 12:07:53 +02009406 {0x12, 0x90a60130},
9407 {0x14, 0x90170110},
9408 {0x19, 0x04a11040},
9409 {0x21, 0x04211020}),
9410 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9411 {0x14, 0x90170110},
9412 {0x19, 0x04a11040},
9413 {0x1d, 0x40600001},
9414 {0x21, 0x04211020}),
9415 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Hui Wangc4cfcf62018-11-26 14:17:16 +08009416 {0x14, 0x90170110},
9417 {0x19, 0x04a11040},
9418 {0x21, 0x04211020}),
Hui Wangc72b9bf2020-12-05 13:11:30 +08009419 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9420 {0x14, 0x90170110},
9421 {0x17, 0x90170111},
9422 {0x19, 0x03a11030},
9423 {0x21, 0x03211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08009424 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9425 {0x12, 0x90a60130},
9426 {0x17, 0x90170110},
9427 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02009428 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08009429 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08009430 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08009431 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08009432 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009433 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009434 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009435 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08009436 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009437 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009438 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009439 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009440 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08009441 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009442 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009443 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009444 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009445 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009446 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009447 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009448 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009449 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009450 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009451 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009452 {0x14, 0x90170110},
9453 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009454 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009455 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009456 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009457 {0x14, 0x90170110},
9458 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009459 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009460 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009461 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009462 {0x14, 0x90170110},
9463 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009464 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08009465 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009466 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009467 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009468 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08009469 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08009470 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009471 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009472 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009473 {0x16, 0x01014020},
9474 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08009475 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02009476 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009477 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009478 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02009479 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009480 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009481 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02009482 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08009483 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02009484 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009485 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009486 {0x13, 0x90a60140}),
Jian-Hong Paneeacd802020-11-24 17:20:25 +08009487 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9488 {0x17, 0x90170110},
9489 {0x21, 0x04211020}),
Chris Chiud8ae4582018-12-07 17:17:11 +08009490 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9491 {0x14, 0x90170110},
9492 {0x1b, 0x90a70130},
9493 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009494 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9495 {0x12, 0x90a60130},
9496 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08009497 {0x21, 0x03211020}),
9498 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9499 {0x12, 0x90a60130},
9500 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009501 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02009502 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9503 {0x12, 0x90a60130},
9504 {0x17, 0x90170110},
9505 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08009506 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08009507 {0x12, 0x90a60120},
9508 {0x17, 0x90170110},
9509 {0x21, 0x04211030}),
9510 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08009511 {0x12, 0x90a60130},
9512 {0x17, 0x90170110},
9513 {0x21, 0x03211020}),
9514 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9515 {0x12, 0x90a60130},
9516 {0x17, 0x90170110},
9517 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009518 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08009519 {0x14, 0x90170110},
9520 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009521 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9522 {0x14, 0x90170110},
9523 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08009524 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08009525 ALC295_STANDARD_PINS,
9526 {0x17, 0x21014020},
9527 {0x18, 0x21a19030}),
9528 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9529 ALC295_STANDARD_PINS,
9530 {0x17, 0x21014040},
9531 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08009532 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9533 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08009534 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08009535 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009536 {0x17, 0x90170110}),
9537 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9538 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08009539 {0x17, 0x90170140}),
9540 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9541 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009542 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08009543 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9544 {0x12, 0xb7a60140},
9545 {0x13, 0xb7a60150},
9546 {0x17, 0x90170110},
9547 {0x1a, 0x03011020},
9548 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00009549 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9550 {0x12, 0xb7a60140},
9551 {0x17, 0x90170110},
9552 {0x1a, 0x03a11030},
9553 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08009554 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9555 ALC225_STANDARD_PINS,
9556 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08009557 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08009558 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9559 {0x14, 0x01014010},
9560 {0x17, 0x90170120},
9561 {0x18, 0x02a11030},
9562 {0x19, 0x02a1103f},
9563 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08009564 {}
9565};
Takashi Iwai1d045db2011-07-07 18:23:21 +02009566
Hui Wang7c0a6932019-08-16 14:27:40 +08009567/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9568 * more machines, don't need to match all valid pins, just need to match
9569 * all the pins defined in the tbl. Just because of this reason, it is possible
9570 * that a single machine matches multiple tbls, so there is one limitation:
9571 * at most one tbl is allowed to define for the same vendor and same codec
9572 */
9573static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9574 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9575 {0x19, 0x40000000},
9576 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08009577 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9578 {0x19, 0x40000000},
9579 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08009580 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9581 {0x19, 0x40000000},
9582 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08009583 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9584 {0x19, 0x40000000},
9585 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08009586 {}
9587};
9588
Takashi Iwai546bb672012-03-07 08:37:19 +01009589static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02009590{
Kailang Yang526af6e2012-03-07 08:25:20 +01009591 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009592 int val;
9593
Kailang Yang526af6e2012-03-07 08:25:20 +01009594 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01009595 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01009596
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009597 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009598 alc_write_coef_idx(codec, 0xf, 0x960b);
9599 alc_write_coef_idx(codec, 0xe, 0x8817);
9600 }
9601
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009602 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009603 alc_write_coef_idx(codec, 0xf, 0x960b);
9604 alc_write_coef_idx(codec, 0xe, 0x8814);
9605 }
9606
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009607 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009608 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02009609 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009610 }
9611
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009612 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009613 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009614 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009615 /* Capless ramp up clock control */
9616 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9617 }
9618 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009619 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009620 /* Class D power on reset */
9621 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9622 }
9623 }
9624
Takashi Iwai98b24882014-08-18 13:47:50 +02009625 /* HP */
9626 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009627}
9628
9629/*
9630 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009631static int patch_alc269(struct hda_codec *codec)
9632{
9633 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02009634 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009635
Takashi Iwai3de95172012-05-07 18:03:15 +02009636 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009637 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02009638 return err;
9639
9640 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01009641 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08009642 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009643
Takashi Iwai225068a2015-05-29 10:42:14 +02009644#ifdef CONFIG_PM
9645 codec->patch_ops.suspend = alc269_suspend;
9646 codec->patch_ops.resume = alc269_resume;
9647#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08009648 spec->shutup = alc_default_shutup;
9649 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02009650
Takashi Iwai7639a062015-03-03 10:07:24 +01009651 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01009652 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009653 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009654 switch (alc_get_coef0(codec) & 0x00f0) {
9655 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009656 if (codec->bus->pci &&
9657 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009658 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009659 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009660 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009661 break;
9662 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009663 if (codec->bus->pci &&
9664 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009665 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009666 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009667 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009668 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02009669 case 0x0030:
9670 spec->codec_variant = ALC269_TYPE_ALC269VD;
9671 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009672 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009673 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009674 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009675 if (err < 0)
9676 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08009677 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01009678 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009679 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01009680 break;
9681
9682 case 0x10ec0280:
9683 case 0x10ec0290:
9684 spec->codec_variant = ALC269_TYPE_ALC280;
9685 break;
9686 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01009687 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08009688 spec->shutup = alc282_shutup;
9689 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01009690 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02009691 case 0x10ec0233:
9692 case 0x10ec0283:
9693 spec->codec_variant = ALC269_TYPE_ALC283;
9694 spec->shutup = alc283_shutup;
9695 spec->init_hook = alc283_init;
9696 break;
Kailang Yang065380f2013-01-10 10:25:48 +01009697 case 0x10ec0284:
9698 case 0x10ec0292:
9699 spec->codec_variant = ALC269_TYPE_ALC284;
9700 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02009701 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08009702 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02009703 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02009704 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08009705 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02009706 spec->codec_variant = ALC269_TYPE_ALC286;
9707 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08009708 case 0x10ec0298:
9709 spec->codec_variant = ALC269_TYPE_ALC298;
9710 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08009711 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009712 case 0x10ec0255:
9713 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08009714 spec->shutup = alc256_shutup;
9715 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009716 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02009717 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08009718 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08009719 case 0x10ec0256:
9720 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08009721 spec->shutup = alc256_shutup;
9722 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02009723 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08009724 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009725 case 0x10ec0257:
9726 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08009727 spec->shutup = alc256_shutup;
9728 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009729 spec->gen.mixer_nid = 0;
9730 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009731 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +08009732 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009733 case 0x10ec0285:
9734 case 0x10ec0289:
9735 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08009736 spec->shutup = alc225_shutup;
9737 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009738 spec->gen.mixer_nid = 0;
9739 break;
Kailang Yang42314302016-02-03 15:03:50 +08009740 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08009741 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08009742 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08009743 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08009744 spec->shutup = alc225_shutup;
9745 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01009746 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08009747 break;
Kailang Yang99cee0342021-07-01 09:09:37 +08009748 case 0x10ec0287:
9749 spec->codec_variant = ALC269_TYPE_ALC287;
9750 spec->shutup = alc225_shutup;
9751 spec->init_hook = alc225_init;
9752 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
9753 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009754 case 0x10ec0234:
9755 case 0x10ec0274:
9756 case 0x10ec0294:
9757 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08009758 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08009759 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08009760 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009761 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08009762 case 0x10ec0300:
9763 spec->codec_variant = ALC269_TYPE_ALC300;
9764 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009765 break;
Kailang Yangf0778872019-10-24 15:13:32 +08009766 case 0x10ec0623:
9767 spec->codec_variant = ALC269_TYPE_ALC623;
9768 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08009769 case 0x10ec0700:
9770 case 0x10ec0701:
9771 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +08009772 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +08009773 spec->codec_variant = ALC269_TYPE_ALC700;
9774 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08009775 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08009776 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08009777 break;
9778
Takashi Iwai1d045db2011-07-07 18:23:21 +02009779 }
9780
Kailang Yangad60d502013-06-28 12:03:01 +02009781 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05009782 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02009783 spec->init_hook = alc5505_dsp_init;
9784 }
9785
Takashi Iwaic9af7532019-05-10 11:01:43 +02009786 alc_pre_init(codec);
9787
Takashi Iwaiefe55732018-06-15 11:55:02 +02009788 snd_hda_pick_fixup(codec, alc269_fixup_models,
9789 alc269_fixup_tbl, alc269_fixups);
Takashi Iwai13d9c6b2021-08-20 16:32:14 +02009790 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
9791 * the quirk breaks the latter (bko#214101).
9792 * Clear the wrong entry.
9793 */
9794 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
9795 codec->core.vendor_id == 0x10ec0294) {
9796 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
9797 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
9798 }
9799
Hui Wang0fc1e442019-08-16 14:27:39 +08009800 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +08009801 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +02009802 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9803 alc269_fixups);
9804 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9805
9806 alc_auto_parse_customize_define(codec);
9807
9808 if (has_cdefine_beep(codec))
9809 spec->gen.beep_nid = 0x01;
9810
Takashi Iwaia4297b52011-08-23 18:40:12 +02009811 /* automatic parse from the BIOS config */
9812 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009813 if (err < 0)
9814 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009815
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009816 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9817 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9818 if (err < 0)
9819 goto error;
9820 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009821
Takashi Iwai1727a772013-01-10 09:52:52 +01009822 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009823
Takashi Iwai1d045db2011-07-07 18:23:21 +02009824 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009825
9826 error:
9827 alc_free(codec);
9828 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009829}
9830
9831/*
9832 * ALC861
9833 */
9834
Takashi Iwai1d045db2011-07-07 18:23:21 +02009835static int alc861_parse_auto_config(struct hda_codec *codec)
9836{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009837 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009838 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9839 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009840}
9841
Takashi Iwai1d045db2011-07-07 18:23:21 +02009842/* Pin config fixes */
9843enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009844 ALC861_FIXUP_FSC_AMILO_PI1505,
9845 ALC861_FIXUP_AMP_VREF_0F,
9846 ALC861_FIXUP_NO_JACK_DETECT,
9847 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009848 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009849};
9850
Takashi Iwai31150f22012-01-30 10:54:08 +01009851/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9852static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009853 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01009854{
9855 struct alc_spec *spec = codec->spec;
9856 unsigned int val;
9857
Takashi Iwai1727a772013-01-10 09:52:52 +01009858 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01009859 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01009860 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01009861 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9862 val |= AC_PINCTL_IN_EN;
9863 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02009864 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01009865 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01009866}
9867
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009868/* suppress the jack-detection */
9869static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009870 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009871{
Takashi Iwai1727a772013-01-10 09:52:52 +01009872 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009873 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009874}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009875
Takashi Iwai1727a772013-01-10 09:52:52 +01009876static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009877 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009878 .type = HDA_FIXUP_PINS,
9879 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009880 { 0x0b, 0x0221101f }, /* HP */
9881 { 0x0f, 0x90170310 }, /* speaker */
9882 { }
9883 }
9884 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009885 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009886 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01009887 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01009888 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009889 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009890 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009891 .v.func = alc_fixup_no_jack_detect,
9892 },
9893 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009894 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009895 .v.func = alc861_fixup_asus_amp_vref_0f,
9896 .chained = true,
9897 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009898 },
9899 [ALC660_FIXUP_ASUS_W7J] = {
9900 .type = HDA_FIXUP_VERBS,
9901 .v.verbs = (const struct hda_verb[]) {
9902 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9903 * for enabling outputs
9904 */
9905 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9906 { }
9907 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009908 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009909};
9910
9911static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009912 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01009913 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009914 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9915 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9916 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
Takashi Iwaidefce242021-04-28 13:27:03 +02009917 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009918 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009919 {}
9920};
9921
9922/*
9923 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009924static int patch_alc861(struct hda_codec *codec)
9925{
9926 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009927 int err;
9928
Takashi Iwai3de95172012-05-07 18:03:15 +02009929 err = alc_alloc_spec(codec, 0x15);
9930 if (err < 0)
9931 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009932
Takashi Iwai3de95172012-05-07 18:03:15 +02009933 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009934 if (has_cdefine_beep(codec))
9935 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009936
Takashi Iwai225068a2015-05-29 10:42:14 +02009937#ifdef CONFIG_PM
9938 spec->power_hook = alc_power_eapd;
9939#endif
9940
Takashi Iwaic9af7532019-05-10 11:01:43 +02009941 alc_pre_init(codec);
9942
Takashi Iwai1727a772013-01-10 09:52:52 +01009943 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9944 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009945
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009946 /* automatic parse from the BIOS config */
9947 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009948 if (err < 0)
9949 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009950
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009951 if (!spec->gen.no_analog) {
9952 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9953 if (err < 0)
9954 goto error;
9955 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009956
Takashi Iwai1727a772013-01-10 09:52:52 +01009957 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009958
Takashi Iwai1d045db2011-07-07 18:23:21 +02009959 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009960
9961 error:
9962 alc_free(codec);
9963 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009964}
9965
9966/*
9967 * ALC861-VD support
9968 *
9969 * Based on ALC882
9970 *
9971 * In addition, an independent DAC
9972 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009973static int alc861vd_parse_auto_config(struct hda_codec *codec)
9974{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009975 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009976 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9977 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009978}
9979
Takashi Iwai1d045db2011-07-07 18:23:21 +02009980enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009981 ALC660VD_FIX_ASUS_GPIO1,
9982 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009983};
9984
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009985/* exclude VREF80 */
9986static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009987 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009988{
Takashi Iwai1727a772013-01-10 09:52:52 +01009989 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01009990 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9991 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009992 }
9993}
9994
Takashi Iwaidf73d832018-06-19 23:05:47 +02009995/* reset GPIO1 */
9996static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9997 const struct hda_fixup *fix, int action)
9998{
9999 struct alc_spec *spec = codec->spec;
10000
10001 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10002 spec->gpio_mask |= 0x02;
10003 alc_fixup_gpio(codec, action, 0x01);
10004}
10005
Takashi Iwai1727a772013-01-10 09:52:52 +010010006static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +020010007 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +020010008 .type = HDA_FIXUP_FUNC,
10009 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +020010010 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010011 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010012 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010013 .v.func = alc861vd_fixup_dallas,
10014 },
Takashi Iwai1d045db2011-07-07 18:23:21 +020010015};
10016
10017static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010018 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +020010019 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010020 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +020010021 {}
10022};
10023
Takashi Iwai1d045db2011-07-07 18:23:21 +020010024/*
10025 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010026static int patch_alc861vd(struct hda_codec *codec)
10027{
10028 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +020010029 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010030
Takashi Iwai3de95172012-05-07 18:03:15 +020010031 err = alc_alloc_spec(codec, 0x0b);
10032 if (err < 0)
10033 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010034
Takashi Iwai3de95172012-05-07 18:03:15 +020010035 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +020010036 if (has_cdefine_beep(codec))
10037 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010038
Takashi Iwai225068a2015-05-29 10:42:14 +020010039 spec->shutup = alc_eapd_shutup;
10040
Takashi Iwaic9af7532019-05-10 11:01:43 +020010041 alc_pre_init(codec);
10042
Takashi Iwai1727a772013-01-10 09:52:52 +010010043 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10044 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +020010045
Takashi Iwaicb4e4822011-08-23 17:34:25 +020010046 /* automatic parse from the BIOS config */
10047 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010048 if (err < 0)
10049 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010050
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010051 if (!spec->gen.no_analog) {
10052 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10053 if (err < 0)
10054 goto error;
10055 }
Takashi Iwai1d045db2011-07-07 18:23:21 +020010056
Takashi Iwai1727a772013-01-10 09:52:52 +010010057 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010058
Takashi Iwai1d045db2011-07-07 18:23:21 +020010059 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010060
10061 error:
10062 alc_free(codec);
10063 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010064}
10065
10066/*
10067 * ALC662 support
10068 *
10069 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10070 * configuration. Each pin widget can choose any input DACs and a mixer.
10071 * Each ADC is connected from a mixer of all inputs. This makes possible
10072 * 6-channel independent captures.
10073 *
10074 * In addition, an independent DAC for the multi-playback (not used in this
10075 * driver yet).
10076 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010077
10078/*
10079 * BIOS auto configuration
10080 */
10081
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010082static int alc662_parse_auto_config(struct hda_codec *codec)
10083{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +020010084 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010085 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10086 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10087 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +020010088
Takashi Iwai7639a062015-03-03 10:07:24 +010010089 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10090 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10091 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010092 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +010010093 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010094 ssids = alc662_ssids;
10095 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010096}
10097
Todd Broch6be79482010-12-07 16:51:05 -080010098static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +010010099 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +010010100{
Takashi Iwai9bb1f062013-01-10 17:14:29 +010010101 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +010010102 return;
Todd Broch6be79482010-12-07 16:51:05 -080010103 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10104 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10105 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10106 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10107 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +010010108 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -080010109}
10110
Takashi Iwai8e383952013-10-30 17:41:12 +010010111static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10112 { .channels = 2,
10113 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10114 { .channels = 4,
10115 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10116 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10117 { }
10118};
10119
10120/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010121static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +010010122 const struct hda_fixup *fix, int action)
10123{
10124 if (action == HDA_FIXUP_ACT_BUILD) {
10125 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +010010126 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +010010127 }
10128}
10129
Takashi Iwaibf686652014-01-13 16:18:25 +010010130/* avoid D3 for keeping GPIO up */
10131static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10132 hda_nid_t nid,
10133 unsigned int power_state)
10134{
10135 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +020010136 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +010010137 return AC_PWRST_D0;
10138 return power_state;
10139}
10140
Takashi Iwai3e887f32014-01-10 17:50:58 +010010141static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10142 const struct hda_fixup *fix, int action)
10143{
10144 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +010010145
Takashi Iwai01e4a272018-06-19 22:47:30 +020010146 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +010010147 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +010010148 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +010010149 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +010010150 }
10151}
10152
Kailang Yangc6790c82016-11-25 16:15:17 +080010153static void alc662_usi_automute_hook(struct hda_codec *codec,
10154 struct hda_jack_callback *jack)
10155{
10156 struct alc_spec *spec = codec->spec;
10157 int vref;
10158 msleep(200);
10159 snd_hda_gen_hp_automute(codec, jack);
10160
10161 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10162 msleep(100);
10163 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10164 vref);
10165}
10166
10167static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10168 const struct hda_fixup *fix, int action)
10169{
10170 struct alc_spec *spec = codec->spec;
10171 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10172 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10173 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10174 }
10175}
10176
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010177static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10178 struct hda_jack_callback *cb)
10179{
10180 /* surround speakers at 0x1b already get muted automatically when
10181 * headphones are plugged in, but we have to mute/unmute the remaining
10182 * channels manually:
10183 * 0x15 - front left/front right
10184 * 0x18 - front center/ LFE
10185 */
10186 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10187 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10188 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10189 } else {
10190 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10191 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10192 }
10193}
10194
10195static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10196 const struct hda_fixup *fix, int action)
10197{
10198 /* Pin 0x1b: shared headphones jack and surround speakers */
10199 if (!is_jack_detectable(codec, 0x1b))
10200 return;
10201
10202 switch (action) {
10203 case HDA_FIXUP_ACT_PRE_PROBE:
10204 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10205 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +010010206 /* subwoofer needs an extra GPIO setting to become audible */
10207 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010208 break;
10209 case HDA_FIXUP_ACT_INIT:
10210 /* Make sure to start in a correct state, i.e. if
10211 * headphones have been plugged in before powering up the system
10212 */
10213 alc662_aspire_ethos_mute_speakers(codec, NULL);
10214 break;
10215 }
10216}
10217
Kailang Yang5af290282020-01-17 14:04:01 +080010218static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10219 const struct hda_fixup *fix, int action)
10220{
10221 struct alc_spec *spec = codec->spec;
10222
10223 static const struct hda_pintbl pincfgs[] = {
10224 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10225 { 0x1b, 0x0181304f },
10226 { }
10227 };
10228
10229 switch (action) {
10230 case HDA_FIXUP_ACT_PRE_PROBE:
10231 spec->gen.mixer_nid = 0;
10232 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10233 snd_hda_apply_pincfgs(codec, pincfgs);
10234 break;
10235 case HDA_FIXUP_ACT_INIT:
10236 alc_write_coef_idx(codec, 0x19, 0xa054);
10237 break;
10238 }
10239}
10240
Kailang Yangd7f327912021-11-23 16:32:44 +080010241static void alc897_hp_automute_hook(struct hda_codec *codec,
10242 struct hda_jack_callback *jack)
10243{
10244 struct alc_spec *spec = codec->spec;
10245 int vref;
10246
10247 snd_hda_gen_hp_automute(codec, jack);
10248 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10249 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10250 vref);
10251}
10252
10253static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10254 const struct hda_fixup *fix, int action)
10255{
10256 struct alc_spec *spec = codec->spec;
10257 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10258 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10259 }
10260}
10261
Takashi Iwai6b0f95c2020-01-05 15:47:18 +010010262static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +080010263 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10264 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10265 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10266 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10267 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10268 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10269 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10270 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10271 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10272 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10273 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10274 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10275 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10276 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10277 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10278 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10279 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10280 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10281 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10282 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10283 {}
10284};
10285
10286static void alc668_restore_default_value(struct hda_codec *codec)
10287{
10288 alc_process_coef_fw(codec, alc668_coefs);
10289}
10290
David Henningsson6cb3b702010-09-09 08:51:44 +020010291enum {
Daniel T Chen2df03512010-10-10 22:39:28 -040010292 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +010010293 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +020010294 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -080010295 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010296 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010297 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +020010298 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010299 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +020010300 ALC662_FIXUP_ASUS_MODE1,
10301 ALC662_FIXUP_ASUS_MODE2,
10302 ALC662_FIXUP_ASUS_MODE3,
10303 ALC662_FIXUP_ASUS_MODE4,
10304 ALC662_FIXUP_ASUS_MODE5,
10305 ALC662_FIXUP_ASUS_MODE6,
10306 ALC662_FIXUP_ASUS_MODE7,
10307 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +010010308 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +020010309 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +020010310 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010311 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +020010312 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010313 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +020010314 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +010010315 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +010010316 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010317 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +010010318 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +080010319 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +020010320 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010321 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010322 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010323 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010324 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010325 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +020010326 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010327 ALC891_FIXUP_HEADSET_MODE,
10328 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010329 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010330 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +080010331 ALC662_FIXUP_USI_FUNC,
10332 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +080010333 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010334 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010335 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +080010336 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +080010337 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +080010338 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
Hui Wanga3fd1a92021-10-12 19:47:48 +080010339 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10340 ALC668_FIXUP_HEADSET_MIC,
10341 ALC668_FIXUP_MIC_DET_COEF,
Kailang Yangd7f327912021-11-23 16:32:44 +080010342 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10343 ALC897_FIXUP_HEADSET_MIC_PIN,
David Henningsson6cb3b702010-09-09 08:51:44 +020010344};
10345
Takashi Iwai1727a772013-01-10 09:52:52 +010010346static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -040010347 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010348 .type = HDA_FIXUP_PINS,
10349 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -040010350 { 0x15, 0x99130112 }, /* subwoofer */
10351 { }
10352 }
10353 },
Takashi Iwai3e887f32014-01-10 17:50:58 +010010354 [ALC662_FIXUP_LED_GPIO1] = {
10355 .type = HDA_FIXUP_FUNC,
10356 .v.func = alc662_fixup_led_gpio1,
10357 },
David Henningsson6cb3b702010-09-09 08:51:44 +020010358 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010359 .type = HDA_FIXUP_PINS,
10360 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +020010361 { 0x17, 0x99130112 }, /* subwoofer */
10362 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +010010363 },
10364 .chained = true,
10365 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +020010366 },
Todd Broch6be79482010-12-07 16:51:05 -080010367 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010368 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +010010369 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010370 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010371 [ALC662_FIXUP_CZC_ET26] = {
10372 .type = HDA_FIXUP_PINS,
10373 .v.pins = (const struct hda_pintbl[]) {
10374 {0x12, 0x403cc000},
10375 {0x14, 0x90170110}, /* speaker */
10376 {0x15, 0x411111f0},
10377 {0x16, 0x411111f0},
10378 {0x18, 0x01a19030}, /* mic */
10379 {0x19, 0x90a7013f}, /* int-mic */
10380 {0x1a, 0x01014020},
10381 {0x1b, 0x0121401f},
10382 {0x1c, 0x411111f0},
10383 {0x1d, 0x411111f0},
10384 {0x1e, 0x40478e35},
10385 {}
10386 },
10387 .chained = true,
10388 .chain_id = ALC662_FIXUP_SKU_IGNORE
10389 },
Anisse Astierd2ebd472011-01-20 12:36:21 +010010390 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010391 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010392 .v.verbs = (const struct hda_verb[]) {
10393 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10394 {}
10395 }
10396 },
David Henningsson94024cd2011-04-29 14:10:55 +020010397 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010398 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +020010399 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +020010400 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010401 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010402 .type = HDA_FIXUP_PINS,
10403 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010404 { 0x14, 0x0221201f }, /* HP out */
10405 { }
10406 },
10407 .chained = true,
10408 .chain_id = ALC662_FIXUP_SKU_IGNORE
10409 },
Takashi Iwai53c334a2011-08-23 18:27:14 +020010410 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010411 .type = HDA_FIXUP_PINS,
10412 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010413 { 0x14, 0x99130110 }, /* speaker */
10414 { 0x18, 0x01a19c20 }, /* mic */
10415 { 0x19, 0x99a3092f }, /* int-mic */
10416 { 0x21, 0x0121401f }, /* HP out */
10417 { }
10418 },
10419 .chained = true,
10420 .chain_id = ALC662_FIXUP_SKU_IGNORE
10421 },
10422 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010423 .type = HDA_FIXUP_PINS,
10424 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010425 { 0x14, 0x99130110 }, /* speaker */
10426 { 0x18, 0x01a19820 }, /* mic */
10427 { 0x19, 0x99a3092f }, /* int-mic */
10428 { 0x1b, 0x0121401f }, /* HP out */
10429 { }
10430 },
Takashi Iwai53c334a2011-08-23 18:27:14 +020010431 .chained = true,
10432 .chain_id = ALC662_FIXUP_SKU_IGNORE
10433 },
10434 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010435 .type = HDA_FIXUP_PINS,
10436 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010437 { 0x14, 0x99130110 }, /* speaker */
10438 { 0x15, 0x0121441f }, /* HP */
10439 { 0x18, 0x01a19840 }, /* mic */
10440 { 0x19, 0x99a3094f }, /* int-mic */
10441 { 0x21, 0x01211420 }, /* HP2 */
10442 { }
10443 },
10444 .chained = true,
10445 .chain_id = ALC662_FIXUP_SKU_IGNORE
10446 },
10447 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010448 .type = HDA_FIXUP_PINS,
10449 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010450 { 0x14, 0x99130110 }, /* speaker */
10451 { 0x16, 0x99130111 }, /* speaker */
10452 { 0x18, 0x01a19840 }, /* mic */
10453 { 0x19, 0x99a3094f }, /* int-mic */
10454 { 0x21, 0x0121441f }, /* HP */
10455 { }
10456 },
10457 .chained = true,
10458 .chain_id = ALC662_FIXUP_SKU_IGNORE
10459 },
10460 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010461 .type = HDA_FIXUP_PINS,
10462 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010463 { 0x14, 0x99130110 }, /* speaker */
10464 { 0x15, 0x0121441f }, /* HP */
10465 { 0x16, 0x99130111 }, /* speaker */
10466 { 0x18, 0x01a19840 }, /* mic */
10467 { 0x19, 0x99a3094f }, /* int-mic */
10468 { }
10469 },
10470 .chained = true,
10471 .chain_id = ALC662_FIXUP_SKU_IGNORE
10472 },
10473 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010474 .type = HDA_FIXUP_PINS,
10475 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010476 { 0x14, 0x99130110 }, /* speaker */
10477 { 0x15, 0x01211420 }, /* HP2 */
10478 { 0x18, 0x01a19840 }, /* mic */
10479 { 0x19, 0x99a3094f }, /* int-mic */
10480 { 0x1b, 0x0121441f }, /* HP */
10481 { }
10482 },
10483 .chained = true,
10484 .chain_id = ALC662_FIXUP_SKU_IGNORE
10485 },
10486 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010487 .type = HDA_FIXUP_PINS,
10488 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010489 { 0x14, 0x99130110 }, /* speaker */
10490 { 0x17, 0x99130111 }, /* speaker */
10491 { 0x18, 0x01a19840 }, /* mic */
10492 { 0x19, 0x99a3094f }, /* int-mic */
10493 { 0x1b, 0x01214020 }, /* HP */
10494 { 0x21, 0x0121401f }, /* HP */
10495 { }
10496 },
10497 .chained = true,
10498 .chain_id = ALC662_FIXUP_SKU_IGNORE
10499 },
10500 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010501 .type = HDA_FIXUP_PINS,
10502 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010503 { 0x14, 0x99130110 }, /* speaker */
10504 { 0x12, 0x99a30970 }, /* int-mic */
10505 { 0x15, 0x01214020 }, /* HP */
10506 { 0x17, 0x99130111 }, /* speaker */
10507 { 0x18, 0x01a19840 }, /* mic */
10508 { 0x21, 0x0121401f }, /* HP */
10509 { }
10510 },
10511 .chained = true,
10512 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010513 },
Takashi Iwai1565cc32012-02-13 12:03:25 +010010514 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010515 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +010010516 .v.func = alc_fixup_no_jack_detect,
10517 },
David Henningssonedfe3bf2012-06-12 13:15:12 +020010518 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010519 .type = HDA_FIXUP_PINS,
10520 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +020010521 { 0x1b, 0x02214020 }, /* Front HP */
10522 { }
10523 }
10524 },
Takashi Iwai125821a2012-06-22 14:30:29 +020010525 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010526 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +020010527 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +020010528 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010529 [ALC668_FIXUP_DELL_XPS13] = {
10530 .type = HDA_FIXUP_FUNC,
10531 .v.func = alc_fixup_dell_xps13,
10532 .chained = true,
10533 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10534 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +020010535 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10536 .type = HDA_FIXUP_FUNC,
10537 .v.func = alc_fixup_disable_aamix,
10538 .chained = true,
10539 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10540 },
Hui Wang493a52a2014-01-14 14:07:36 +080010541 [ALC668_FIXUP_AUTO_MUTE] = {
10542 .type = HDA_FIXUP_FUNC,
10543 .v.func = alc_fixup_auto_mute_via_amp,
10544 .chained = true,
10545 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10546 },
David Henningsson1f8b46c2015-05-12 14:38:15 +020010547 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10548 .type = HDA_FIXUP_PINS,
10549 .v.pins = (const struct hda_pintbl[]) {
10550 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10551 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10552 { }
10553 },
10554 .chained = true,
10555 .chain_id = ALC662_FIXUP_HEADSET_MODE
10556 },
10557 [ALC662_FIXUP_HEADSET_MODE] = {
10558 .type = HDA_FIXUP_FUNC,
10559 .v.func = alc_fixup_headset_mode_alc662,
10560 },
David Henningsson73bdd592013-04-15 15:44:14 +020010561 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10562 .type = HDA_FIXUP_PINS,
10563 .v.pins = (const struct hda_pintbl[]) {
10564 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10565 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10566 { }
10567 },
10568 .chained = true,
10569 .chain_id = ALC668_FIXUP_HEADSET_MODE
10570 },
10571 [ALC668_FIXUP_HEADSET_MODE] = {
10572 .type = HDA_FIXUP_FUNC,
10573 .v.func = alc_fixup_headset_mode_alc668,
10574 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010575 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +010010576 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010577 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +010010578 .chained = true,
10579 .chain_id = ALC662_FIXUP_ASUS_MODE4
10580 },
David Henningsson61a75f12014-02-07 09:31:08 +010010581 [ALC662_FIXUP_BASS_16] = {
10582 .type = HDA_FIXUP_PINS,
10583 .v.pins = (const struct hda_pintbl[]) {
10584 {0x16, 0x80106111}, /* bass speaker */
10585 {}
10586 },
10587 .chained = true,
10588 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10589 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010590 [ALC662_FIXUP_BASS_1A] = {
10591 .type = HDA_FIXUP_PINS,
10592 .v.pins = (const struct hda_pintbl[]) {
10593 {0x1a, 0x80106111}, /* bass speaker */
10594 {}
10595 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010596 .chained = true,
10597 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010598 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010599 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010600 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010601 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010602 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010603 [ALC662_FIXUP_ASUS_Nx50] = {
10604 .type = HDA_FIXUP_FUNC,
10605 .v.func = alc_fixup_auto_mute_via_amp,
10606 .chained = true,
10607 .chain_id = ALC662_FIXUP_BASS_1A
10608 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010609 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10610 .type = HDA_FIXUP_FUNC,
10611 .v.func = alc_fixup_headset_mode_alc668,
10612 .chain_id = ALC662_FIXUP_BASS_CHMAP
10613 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010614 [ALC668_FIXUP_ASUS_Nx51] = {
10615 .type = HDA_FIXUP_PINS,
10616 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010617 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10618 { 0x1a, 0x90170151 }, /* bass speaker */
10619 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010620 {}
10621 },
10622 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010623 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010624 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010625 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +020010626 .type = HDA_FIXUP_VERBS,
10627 .v.verbs = (const struct hda_verb[]) {
10628 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10629 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10630 {}
10631 },
10632 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010633 [ALC668_FIXUP_ASUS_G751] = {
10634 .type = HDA_FIXUP_PINS,
10635 .v.pins = (const struct hda_pintbl[]) {
10636 { 0x16, 0x0421101f }, /* HP */
10637 {}
10638 },
10639 .chained = true,
10640 .chain_id = ALC668_FIXUP_MIC_COEF
10641 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010642 [ALC891_FIXUP_HEADSET_MODE] = {
10643 .type = HDA_FIXUP_FUNC,
10644 .v.func = alc_fixup_headset_mode,
10645 },
10646 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10647 .type = HDA_FIXUP_PINS,
10648 .v.pins = (const struct hda_pintbl[]) {
10649 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10650 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10651 { }
10652 },
10653 .chained = true,
10654 .chain_id = ALC891_FIXUP_HEADSET_MODE
10655 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010656 [ALC662_FIXUP_ACER_VERITON] = {
10657 .type = HDA_FIXUP_PINS,
10658 .v.pins = (const struct hda_pintbl[]) {
10659 { 0x15, 0x50170120 }, /* no internal speaker */
10660 { }
10661 }
10662 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010663 [ALC892_FIXUP_ASROCK_MOBO] = {
10664 .type = HDA_FIXUP_PINS,
10665 .v.pins = (const struct hda_pintbl[]) {
10666 { 0x15, 0x40f000f0 }, /* disabled */
10667 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010668 { }
10669 }
10670 },
Kailang Yangc6790c82016-11-25 16:15:17 +080010671 [ALC662_FIXUP_USI_FUNC] = {
10672 .type = HDA_FIXUP_FUNC,
10673 .v.func = alc662_fixup_usi_headset_mic,
10674 },
10675 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10676 .type = HDA_FIXUP_PINS,
10677 .v.pins = (const struct hda_pintbl[]) {
10678 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10679 { 0x18, 0x01a1903d },
10680 { }
10681 },
10682 .chained = true,
10683 .chain_id = ALC662_FIXUP_USI_FUNC
10684 },
Kailang Yangca169cc2017-04-25 16:17:40 +080010685 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10686 .type = HDA_FIXUP_FUNC,
10687 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10688 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010689 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10690 .type = HDA_FIXUP_FUNC,
10691 .v.func = alc662_fixup_aspire_ethos_hp,
10692 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010693 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10694 .type = HDA_FIXUP_PINS,
10695 .v.pins = (const struct hda_pintbl[]) {
10696 { 0x15, 0x92130110 }, /* front speakers */
10697 { 0x18, 0x99130111 }, /* center/subwoofer */
10698 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10699 { }
10700 },
10701 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +010010702 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010703 },
Kailang Yang5af290282020-01-17 14:04:01 +080010704 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10705 .type = HDA_FIXUP_FUNC,
10706 .v.func = alc671_fixup_hp_headset_mic2,
10707 },
Jian-Hong Pand858c702020-03-17 16:28:07 +080010708 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10709 .type = HDA_FIXUP_PINS,
10710 .v.pins = (const struct hda_pintbl[]) {
10711 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10712 { }
10713 },
10714 .chained = true,
10715 .chain_id = ALC662_FIXUP_USI_FUNC
10716 },
Jian-Hong Pana1244582020-03-17 16:28:09 +080010717 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10718 .type = HDA_FIXUP_PINS,
10719 .v.pins = (const struct hda_pintbl[]) {
10720 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10721 { 0x1b, 0x0221144f },
10722 { }
10723 },
10724 .chained = true,
10725 .chain_id = ALC662_FIXUP_USI_FUNC
10726 },
Hui Wanga3fd1a92021-10-12 19:47:48 +080010727 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
10728 .type = HDA_FIXUP_PINS,
10729 .v.pins = (const struct hda_pintbl[]) {
10730 { 0x1b, 0x04a1112c },
10731 { }
10732 },
10733 .chained = true,
10734 .chain_id = ALC668_FIXUP_HEADSET_MIC
10735 },
10736 [ALC668_FIXUP_HEADSET_MIC] = {
10737 .type = HDA_FIXUP_FUNC,
10738 .v.func = alc269_fixup_headset_mic,
10739 .chained = true,
10740 .chain_id = ALC668_FIXUP_MIC_DET_COEF
10741 },
10742 [ALC668_FIXUP_MIC_DET_COEF] = {
10743 .type = HDA_FIXUP_VERBS,
10744 .v.verbs = (const struct hda_verb[]) {
10745 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
10746 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
10747 {}
10748 },
10749 },
Kailang Yangd7f327912021-11-23 16:32:44 +080010750 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
10751 .type = HDA_FIXUP_FUNC,
10752 .v.func = alc897_fixup_lenovo_headset_mic,
10753 },
10754 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
10755 .type = HDA_FIXUP_PINS,
10756 .v.pins = (const struct hda_pintbl[]) {
10757 { 0x1a, 0x03a11050 },
10758 { }
10759 },
10760 .chained = true,
10761 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
10762 },
David Henningsson6cb3b702010-09-09 08:51:44 +020010763};
10764
Takashi Iwaia9111322011-05-02 11:30:18 +020010765static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010766 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +020010767 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +010010768 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +010010769 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +020010770 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +020010771 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +020010772 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -040010773 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Takashi Iwai9edeb112021-04-28 13:27:02 +020010774 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Jian-Hong Pana1244582020-03-17 16:28:09 +080010775 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +080010776 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +020010777 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10778 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +020010779 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010780 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +020010781 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +010010782 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +010010783 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +080010784 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10785 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +080010786 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010787 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Jeremy Szu148ebf542020-10-08 18:56:44 +080010788 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Kaho Ng2da2dc92016-05-09 00:27:49 +080010789 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +020010790 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010791 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +020010792 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
Takashi Iwai9edeb112021-04-28 13:27:02 +020010793 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010794 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +010010795 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010796 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10797 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Hui Wanga3fd1a92021-10-12 19:47:48 +080010798 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
Takashi Iwaic7efff92017-01-04 21:38:16 +010010799 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +010010800 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010801 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +010010802 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010803 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -050010804 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +080010805 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +080010806 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Kailang Yangd7f327912021-11-23 16:32:44 +080010807 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
10808 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
10809 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
10810 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
Valentine Sinitsynd4118582010-10-01 22:24:08 +060010811 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +020010812 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010813 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +020010814 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010815 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010816 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +010010817 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010818
10819#if 0
10820 /* Below is a quirk table taken from the old code.
10821 * Basically the device should work as is without the fixup table.
10822 * If BIOS doesn't give a proper info, enable the corresponding
10823 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +020010824 */
Takashi Iwai53c334a2011-08-23 18:27:14 +020010825 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10826 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10827 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10828 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10829 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10830 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10831 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10832 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10833 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10834 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10835 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10836 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10837 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10838 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10839 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10840 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10841 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10842 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10843 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10844 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10845 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10846 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10847 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10848 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10849 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10850 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10851 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10852 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10853 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10854 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10855 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10856 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10857 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10858 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10859 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10860 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10861 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10862 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10863 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10864 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10865 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10866 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10867 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10868 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10869 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10870 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10871 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10872 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10873 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10874 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10875#endif
David Henningsson6cb3b702010-09-09 08:51:44 +020010876 {}
10877};
10878
Takashi Iwai1727a772013-01-10 09:52:52 +010010879static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010880 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10881 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -080010882 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010883 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +020010884 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10885 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10886 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10887 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10888 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10889 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10890 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10891 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010892 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +020010893 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010894 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +020010895 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010896 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10897 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10898 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10899 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10900 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10901 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10902 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10903 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +020010904 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010905 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10906 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10907 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10908 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10909 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +020010910 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010911 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -080010912 {}
10913};
David Henningsson6cb3b702010-09-09 08:51:44 +020010914
Hui Wang532895c2014-05-29 15:59:19 +080010915static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010916 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10917 {0x17, 0x02211010},
10918 {0x18, 0x01a19030},
10919 {0x1a, 0x01813040},
10920 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +080010921 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10922 {0x16, 0x01813030},
10923 {0x17, 0x02211010},
10924 {0x18, 0x01a19040},
10925 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +020010926 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010927 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010928 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010929 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +080010930 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +020010931 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10932 {0x12, 0x99a30130},
10933 {0x14, 0x90170110},
10934 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010935 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010936 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10937 {0x12, 0x99a30140},
10938 {0x14, 0x90170110},
10939 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010940 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010941 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10942 {0x12, 0x99a30150},
10943 {0x14, 0x90170110},
10944 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010945 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010946 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +020010947 {0x14, 0x90170110},
10948 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010949 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010950 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10951 {0x12, 0x90a60130},
10952 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +080010953 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +080010954 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10955 {0x14, 0x01014010},
10956 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +080010957 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +080010958 {0x1b, 0x01813030},
10959 {0x21, 0x02211020}),
10960 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10961 {0x14, 0x01014010},
10962 {0x18, 0x01a19040},
10963 {0x1b, 0x01813030},
10964 {0x21, 0x02211020}),
10965 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10966 {0x14, 0x01014020},
10967 {0x17, 0x90170110},
10968 {0x18, 0x01a19050},
10969 {0x1b, 0x01813040},
10970 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +080010971 {}
10972};
10973
Takashi Iwai1d045db2011-07-07 18:23:21 +020010974/*
10975 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010976static int patch_alc662(struct hda_codec *codec)
10977{
10978 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +020010979 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010980
Takashi Iwai3de95172012-05-07 18:03:15 +020010981 err = alc_alloc_spec(codec, 0x0b);
10982 if (err < 0)
10983 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010984
Takashi Iwai3de95172012-05-07 18:03:15 +020010985 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010986
Takashi Iwai225068a2015-05-29 10:42:14 +020010987 spec->shutup = alc_eapd_shutup;
10988
Takashi Iwai53c334a2011-08-23 18:27:14 +020010989 /* handle multiple HPs as is */
10990 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10991
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +020010992 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10993
Takashi Iwai7639a062015-03-03 10:07:24 +010010994 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +080010995 case 0x10ec0668:
10996 spec->init_hook = alc668_restore_default_value;
10997 break;
Kailang Yangf3f91852014-10-24 15:43:46 +080010998 }
Kailang Yang8663ff72012-06-29 09:35:52 +020010999
Takashi Iwaic9af7532019-05-10 11:01:43 +020011000 alc_pre_init(codec);
11001
Takashi Iwai1727a772013-01-10 09:52:52 +010011002 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +020011003 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +080011004 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +010011005 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +020011006
11007 alc_auto_parse_customize_define(codec);
11008
Takashi Iwai7504b6c2013-03-18 11:25:51 +010011009 if (has_cdefine_beep(codec))
11010 spec->gen.beep_nid = 0x01;
11011
Takashi Iwai1bb7e432011-10-17 16:50:59 +020011012 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +010011013 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011014 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +080011015 err = alc_codec_rename(codec, "ALC272X");
11016 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011017 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +020011018 }
Kailang Yang274693f2009-12-03 10:07:50 +010011019
Takashi Iwaib9c51062011-08-24 18:08:07 +020011020 /* automatic parse from the BIOS config */
11021 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011022 if (err < 0)
11023 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011024
Takashi Iwai7504b6c2013-03-18 11:25:51 +010011025 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +010011026 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +010011027 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011028 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010011029 break;
11030 case 0x10ec0272:
11031 case 0x10ec0663:
11032 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +080011033 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011034 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010011035 break;
11036 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011037 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010011038 break;
11039 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011040 if (err < 0)
11041 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +010011042 }
Takashi Iwai2134ea42008-01-10 16:53:55 +010011043
Takashi Iwai1727a772013-01-10 09:52:52 +010011044 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010011045
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011046 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011047
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011048 error:
11049 alc_free(codec);
11050 return err;
Kailang Yangb478b992011-05-18 11:51:15 +020011051}
11052
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011053/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011054 * ALC680 support
11055 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011056
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011057static int alc680_parse_auto_config(struct hda_codec *codec)
11058{
Takashi Iwai3e6179b2011-07-08 16:55:13 +020011059 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011060}
11061
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011062/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011063 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011064static int patch_alc680(struct hda_codec *codec)
11065{
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011066 int err;
11067
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020011068 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +020011069 err = alc_alloc_spec(codec, 0);
11070 if (err < 0)
11071 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020011072
Takashi Iwai1ebec5f2011-08-15 13:21:48 +020011073 /* automatic parse from the BIOS config */
11074 err = alc680_parse_auto_config(codec);
11075 if (err < 0) {
11076 alc_free(codec);
11077 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011078 }
11079
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011080 return 0;
11081}
11082
11083/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070011084 * patch entries
11085 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011086static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +080011087 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011088 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +080011089 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +080011090 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwai1948fc02021-06-18 18:17:20 +020011091 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011092 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11093 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011094 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011095 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +080011096 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +080011097 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011098 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11099 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +080011100 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011101 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11102 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11103 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11104 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11105 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11106 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11107 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011108 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011109 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11110 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11111 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11112 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11113 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11114 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080011115 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011116 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080011117 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011118 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080011119 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011120 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11121 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11122 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011123 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080011124 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011125 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080011126 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080011127 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080011128 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011129 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11130 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11131 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11132 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11133 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11134 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11135 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11136 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11137 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11138 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11139 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11140 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11141 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11142 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080011143 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11144 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11145 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080011146 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080011147 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011148 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11149 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11150 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11151 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11152 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11153 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11154 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11155 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11156 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11157 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11158 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
Kailang Yange5782a52020-11-27 14:39:23 +080011159 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011160 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11161 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080011162 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080011163 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080011164 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070011165 {} /* terminator */
11166};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011167MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010011168
11169MODULE_LICENSE("GPL");
11170MODULE_DESCRIPTION("Realtek HD-audio codec");
11171
Takashi Iwaid8a766a2015-02-17 15:25:37 +010011172static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011173 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010011174};
11175
Takashi Iwaid8a766a2015-02-17 15:25:37 +010011176module_hda_codec_driver(realtek_driver);