blob: 2eea70605fd324e3f3765d67cc7d4eb7e968eb0d [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,
Christian Lachnerc1933002022-01-03 15:05:17 +01001927 ALC1220_FIXUP_GB_X570,
Peisen0202f5c2017-10-26 10:35:36 +08001928 ALC1220_FIXUP_CLEVO_P950,
Richard Sailer80690a22019-04-02 15:52:04 +02001929 ALC1220_FIXUP_CLEVO_PB51ED,
1930 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Jian-Hong Panca184352020-10-07 13:22:25 +08001931 ALC887_FIXUP_ASUS_AUDIO,
1932 ALC887_FIXUP_ASUS_HMIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001933};
1934
Takashi Iwai68ef0562011-11-09 18:24:44 +01001935static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001936 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001937{
Takashi Iwai1727a772013-01-10 09:52:52 +01001938 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001939 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001940 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001941}
1942
Takashi Iwai56710872011-11-14 17:42:11 +01001943/* set up GPIO at initialization */
1944static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001945 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001946{
Takashi Iwai215c8502018-06-19 22:34:26 +02001947 struct alc_spec *spec = codec->spec;
1948
1949 spec->gpio_write_delay = true;
1950 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001951}
1952
Takashi Iwai02a237b2012-02-13 15:25:07 +01001953/* Fix the connection of some pins for ALC889:
1954 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1955 * work correctly (bko#42740)
1956 */
1957static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001958 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001959{
Takashi Iwai1727a772013-01-10 09:52:52 +01001960 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001961 /* fake the connections during parsing the tree */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001962 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1963 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1964 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1965 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1966 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1967 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001968 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001969 /* restore the connections */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001970 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1971 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1972 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1973 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1974 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001975 }
1976}
1977
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001978/* Set VREF on HP pin */
1979static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001980 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001981{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001982 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001983 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001984 int i;
1985
Takashi Iwai1727a772013-01-10 09:52:52 +01001986 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001987 return;
1988 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1989 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1990 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1991 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001992 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001993 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001994 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001995 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001996 break;
1997 }
1998}
1999
Takashi Iwai0756f092013-12-04 13:59:45 +01002000static void alc889_fixup_mac_pins(struct hda_codec *codec,
2001 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002002{
2003 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002004 int i;
2005
Takashi Iwai0756f092013-12-04 13:59:45 +01002006 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002007 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002008 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002009 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002010 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002011 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01002012 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002013}
2014
Takashi Iwai0756f092013-12-04 13:59:45 +01002015/* Set VREF on speaker pins on imac91 */
2016static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2017 const struct hda_fixup *fix, int action)
2018{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002019 static const hda_nid_t nids[] = { 0x18, 0x1a };
Takashi Iwai0756f092013-12-04 13:59:45 +01002020
2021 if (action == HDA_FIXUP_ACT_INIT)
2022 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2023}
2024
Adrien Vergée7729a42014-01-24 14:56:14 -05002025/* Set VREF on speaker pins on mba11 */
2026static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2027 const struct hda_fixup *fix, int action)
2028{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002029 static const hda_nid_t nids[] = { 0x18 };
Adrien Vergée7729a42014-01-24 14:56:14 -05002030
2031 if (action == HDA_FIXUP_ACT_INIT)
2032 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2033}
2034
Takashi Iwai0756f092013-12-04 13:59:45 +01002035/* Set VREF on speaker pins on mba21 */
2036static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2037 const struct hda_fixup *fix, int action)
2038{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002039 static const hda_nid_t nids[] = { 0x18, 0x19 };
Takashi Iwai0756f092013-12-04 13:59:45 +01002040
2041 if (action == HDA_FIXUP_ACT_INIT)
2042 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2043}
2044
Takashi Iwaie427c232012-07-29 10:04:08 +02002045/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09002046 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2047 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02002048 */
2049static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002050 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02002051{
2052 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002053 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002054 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002055 spec->gen.no_multi_io = 1;
2056 }
Takashi Iwaie427c232012-07-29 10:04:08 +02002057}
2058
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002059static void alc_fixup_bass_chmap(struct hda_codec *codec,
2060 const struct hda_fixup *fix, int action);
2061
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002062/* For dual-codec configuration, we need to disable some features to avoid
2063 * conflicts of kctls and PCM streams
2064 */
2065static void alc_fixup_dual_codecs(struct hda_codec *codec,
2066 const struct hda_fixup *fix, int action)
2067{
2068 struct alc_spec *spec = codec->spec;
2069
2070 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2071 return;
2072 /* disable vmaster */
2073 spec->gen.suppress_vmaster = 1;
2074 /* auto-mute and auto-mic switch don't work with multiple codecs */
2075 spec->gen.suppress_auto_mute = 1;
2076 spec->gen.suppress_auto_mic = 1;
2077 /* disable aamix as well */
2078 spec->gen.mixer_nid = 0;
2079 /* add location prefix to avoid conflicts */
2080 codec->force_pin_prefix = 1;
2081}
2082
2083static void rename_ctl(struct hda_codec *codec, const char *oldname,
2084 const char *newname)
2085{
2086 struct snd_kcontrol *kctl;
2087
2088 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2089 if (kctl)
2090 strcpy(kctl->id.name, newname);
2091}
2092
2093static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2094 const struct hda_fixup *fix,
2095 int action)
2096{
2097 alc_fixup_dual_codecs(codec, fix, action);
2098 switch (action) {
2099 case HDA_FIXUP_ACT_PRE_PROBE:
2100 /* override card longname to provide a unique UCM profile */
2101 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2102 break;
2103 case HDA_FIXUP_ACT_BUILD:
2104 /* rename Capture controls depending on the codec */
2105 rename_ctl(codec, "Capture Volume",
2106 codec->addr == 0 ?
2107 "Rear-Panel Capture Volume" :
2108 "Front-Panel Capture Volume");
2109 rename_ctl(codec, "Capture Switch",
2110 codec->addr == 0 ?
2111 "Rear-Panel Capture Switch" :
2112 "Front-Panel Capture Switch");
2113 break;
2114 }
2115}
2116
Christian Lachnerc1933002022-01-03 15:05:17 +01002117static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2118 const struct hda_fixup *fix,
2119 int action)
2120{
2121 static const hda_nid_t conn1[] = { 0x0c };
2122 static const struct coef_fw gb_x570_coefs[] = {
2123 WRITE_COEF(0x1a, 0x01c1),
2124 WRITE_COEF(0x1b, 0x0202),
2125 WRITE_COEF(0x43, 0x3005),
2126 {}
2127 };
2128
2129 switch (action) {
2130 case HDA_FIXUP_ACT_PRE_PROBE:
2131 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2132 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2133 break;
2134 case HDA_FIXUP_ACT_INIT:
2135 alc_process_coef_fw(codec, gb_x570_coefs);
2136 break;
2137 }
2138}
2139
Peisen0202f5c2017-10-26 10:35:36 +08002140static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2141 const struct hda_fixup *fix,
2142 int action)
2143{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002144 static const hda_nid_t conn1[] = { 0x0c };
Peisen0202f5c2017-10-26 10:35:36 +08002145
2146 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2147 return;
2148
2149 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2150 /* We therefore want to make sure 0x14 (front headphone) and
2151 * 0x1b (speakers) use the stereo DAC 0x02
2152 */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002153 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2154 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Peisen0202f5c2017-10-26 10:35:36 +08002155}
2156
Jeremy Soller7f665b12019-02-13 10:56:19 -07002157static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2158 const struct hda_fixup *fix, int action);
2159
Richard Sailer80690a22019-04-02 15:52:04 +02002160static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002161 const struct hda_fixup *fix,
2162 int action)
2163{
2164 alc1220_fixup_clevo_p950(codec, fix, action);
2165 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2166}
2167
Jian-Hong Panca184352020-10-07 13:22:25 +08002168static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2169 struct hda_jack_callback *jack)
2170{
2171 struct alc_spec *spec = codec->spec;
2172 unsigned int vref;
2173
2174 snd_hda_gen_hp_automute(codec, jack);
2175
2176 if (spec->gen.hp_jack_present)
2177 vref = AC_PINCTL_VREF_80;
2178 else
2179 vref = AC_PINCTL_VREF_HIZ;
2180 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2181}
2182
2183static void alc887_fixup_asus_jack(struct hda_codec *codec,
2184 const struct hda_fixup *fix, int action)
2185{
2186 struct alc_spec *spec = codec->spec;
2187 if (action != HDA_FIXUP_ACT_PROBE)
2188 return;
2189 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2190 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2191}
2192
Takashi Iwai1727a772013-01-10 09:52:52 +01002193static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002194 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002195 .type = HDA_FIXUP_PINS,
2196 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002197 { 0x15, 0x01080104 }, /* side */
2198 { 0x16, 0x01011012 }, /* rear */
2199 { 0x17, 0x01016011 }, /* clfe */
2200 { }
2201 }
2202 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002203 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002204 .type = HDA_FIXUP_PINS,
2205 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002206 { 0x15, 0x99130112 }, /* rear int speakers */
2207 { 0x16, 0x99130111 }, /* subwoofer */
2208 { }
2209 }
2210 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002211 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002212 .type = HDA_FIXUP_PINCTLS,
2213 .v.pins = (const struct hda_pintbl[]) {
2214 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002215 {}
2216 }
2217 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002218 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002219 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002220 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002221 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002222 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002223 .type = HDA_FIXUP_PINS,
2224 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002225 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2226 { }
2227 }
2228 },
Marton Balint8f239212012-03-05 21:33:23 +01002229 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002230 .type = HDA_FIXUP_PINS,
2231 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002232 { 0x1c, 0x993301f0 }, /* CD */
2233 { }
2234 }
2235 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002236 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2237 .type = HDA_FIXUP_PINS,
2238 .v.pins = (const struct hda_pintbl[]) {
2239 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2240 { }
2241 },
2242 .chained = true,
2243 .chain_id = ALC889_FIXUP_CD,
2244 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002245 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002246 .type = HDA_FIXUP_PINS,
2247 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002248 { 0x17, 0x90170111 }, /* hidden surround speaker */
2249 { }
2250 }
2251 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002252 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002253 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002254 .v.verbs = (const struct hda_verb[]) {
2255 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2256 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2257 { }
2258 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002259 },
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002260 [ALC886_FIXUP_EAPD] = {
2261 .type = HDA_FIXUP_VERBS,
2262 .v.verbs = (const struct hda_verb[]) {
2263 /* change to EAPD mode */
2264 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2265 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2266 { }
2267 }
2268 },
Takashi Iwai177943a32011-11-09 12:55:18 +01002269 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002270 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002271 .v.verbs = (const struct hda_verb[]) {
2272 /* change to EAPD mode */
2273 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2274 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2275 { }
2276 }
2277 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002278 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002279 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002280 .v.verbs = (const struct hda_verb[]) {
2281 /* change to EAPD mode */
2282 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2283 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2284 { }
2285 }
2286 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002287 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002288 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002289 .v.verbs = (const struct hda_verb[]) {
2290 /* eanable EAPD on Acer laptops */
2291 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2292 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2293 { }
2294 }
2295 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002296 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002297 .type = HDA_FIXUP_FUNC,
2298 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002299 },
2300 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002301 .type = HDA_FIXUP_FUNC,
2302 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002303 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002304 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002305 .type = HDA_FIXUP_FUNC,
2306 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002307 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002308 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002309 .type = HDA_FIXUP_FUNC,
2310 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002311 .chained = true,
2312 .chain_id = ALC882_FIXUP_EAPD,
2313 },
2314 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002315 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002316 .v.func = alc889_fixup_coef,
2317 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002318 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002319 .type = HDA_FIXUP_PINS,
2320 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002321 { 0x16, 0x99130111 }, /* CLFE speaker */
2322 { 0x17, 0x99130112 }, /* surround speaker */
2323 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002324 },
2325 .chained = true,
2326 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002327 },
2328 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002329 .type = HDA_FIXUP_PINS,
2330 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002331 { 0x16, 0x99130111 }, /* CLFE speaker */
2332 { 0x1b, 0x99130112 }, /* surround speaker */
2333 { }
2334 },
2335 .chained = true,
2336 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2337 },
2338 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2339 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002340 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002341 .v.verbs = (const struct hda_verb[]) {
2342 /* Enable all DACs */
2343 /* DAC DISABLE/MUTE 1? */
2344 /* setting bits 1-5 disables DAC nids 0x02-0x06
2345 * apparently. Init=0x38 */
2346 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2347 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2348 /* DAC DISABLE/MUTE 2? */
2349 /* some bit here disables the other DACs.
2350 * Init=0x4900 */
2351 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2352 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2353 /* DMIC fix
2354 * This laptop has a stereo digital microphone.
2355 * The mics are only 1cm apart which makes the stereo
2356 * useless. However, either the mic or the ALC889
2357 * makes the signal become a difference/sum signal
2358 * instead of standard stereo, which is annoying.
2359 * So instead we flip this bit which makes the
2360 * codec replicate the sum signal to both channels,
2361 * turning it into a normal mono mic.
2362 */
2363 /* DMIC_CONTROL? Init value = 0x0001 */
2364 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2365 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2366 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2367 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2368 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002369 },
2370 .chained = true,
2371 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002372 },
Takashi Iwai56710872011-11-14 17:42:11 +01002373 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002374 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002375 .v.func = alc885_fixup_macpro_gpio,
2376 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002377 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002378 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002379 .v.func = alc889_fixup_dac_route,
2380 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002381 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002382 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002383 .v.func = alc889_fixup_mbp_vref,
2384 .chained = true,
2385 .chain_id = ALC882_FIXUP_GPIO1,
2386 },
2387 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002388 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002389 .v.func = alc889_fixup_imac91_vref,
2390 .chained = true,
2391 .chain_id = ALC882_FIXUP_GPIO1,
2392 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002393 [ALC889_FIXUP_MBA11_VREF] = {
2394 .type = HDA_FIXUP_FUNC,
2395 .v.func = alc889_fixup_mba11_vref,
2396 .chained = true,
2397 .chain_id = ALC889_FIXUP_MBP_VREF,
2398 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002399 [ALC889_FIXUP_MBA21_VREF] = {
2400 .type = HDA_FIXUP_FUNC,
2401 .v.func = alc889_fixup_mba21_vref,
2402 .chained = true,
2403 .chain_id = ALC889_FIXUP_MBP_VREF,
2404 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002405 [ALC889_FIXUP_MP11_VREF] = {
2406 .type = HDA_FIXUP_FUNC,
2407 .v.func = alc889_fixup_mba11_vref,
2408 .chained = true,
2409 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2410 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002411 [ALC889_FIXUP_MP41_VREF] = {
2412 .type = HDA_FIXUP_FUNC,
2413 .v.func = alc889_fixup_mbp_vref,
2414 .chained = true,
2415 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2416 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002417 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002418 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002419 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002420 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002421 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002422 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002423 .v.func = alc882_fixup_no_primary_hp,
2424 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002425 [ALC887_FIXUP_ASUS_BASS] = {
2426 .type = HDA_FIXUP_PINS,
2427 .v.pins = (const struct hda_pintbl[]) {
2428 {0x16, 0x99130130}, /* bass speaker */
2429 {}
2430 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002431 .chained = true,
2432 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2433 },
2434 [ALC887_FIXUP_BASS_CHMAP] = {
2435 .type = HDA_FIXUP_FUNC,
2436 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002437 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002438 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2439 .type = HDA_FIXUP_FUNC,
2440 .v.func = alc1220_fixup_gb_dual_codecs,
2441 },
Christian Lachnerc1933002022-01-03 15:05:17 +01002442 [ALC1220_FIXUP_GB_X570] = {
2443 .type = HDA_FIXUP_FUNC,
2444 .v.func = alc1220_fixup_gb_x570,
2445 },
Peisen0202f5c2017-10-26 10:35:36 +08002446 [ALC1220_FIXUP_CLEVO_P950] = {
2447 .type = HDA_FIXUP_FUNC,
2448 .v.func = alc1220_fixup_clevo_p950,
2449 },
Richard Sailer80690a22019-04-02 15:52:04 +02002450 [ALC1220_FIXUP_CLEVO_PB51ED] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002451 .type = HDA_FIXUP_FUNC,
Richard Sailer80690a22019-04-02 15:52:04 +02002452 .v.func = alc1220_fixup_clevo_pb51ed,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002453 },
Richard Sailer80690a22019-04-02 15:52:04 +02002454 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002455 .type = HDA_FIXUP_PINS,
2456 .v.pins = (const struct hda_pintbl[]) {
2457 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2458 {}
2459 },
2460 .chained = true,
Richard Sailer80690a22019-04-02 15:52:04 +02002461 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002462 },
Jian-Hong Panca184352020-10-07 13:22:25 +08002463 [ALC887_FIXUP_ASUS_AUDIO] = {
2464 .type = HDA_FIXUP_PINS,
2465 .v.pins = (const struct hda_pintbl[]) {
2466 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2467 { 0x19, 0x22219420 },
2468 {}
2469 },
2470 },
2471 [ALC887_FIXUP_ASUS_HMIC] = {
2472 .type = HDA_FIXUP_FUNC,
2473 .v.func = alc887_fixup_asus_jack,
2474 .chained = true,
2475 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2476 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002477};
2478
2479static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002480 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2481 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002482 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002483 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2484 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2485 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2486 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002487 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2488 ALC882_FIXUP_ACER_ASPIRE_4930G),
2489 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2490 ALC882_FIXUP_ACER_ASPIRE_4930G),
2491 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2492 ALC882_FIXUP_ACER_ASPIRE_8930G),
2493 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2494 ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaib2650472021-04-28 13:26:52 +02002495 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2496 ALC882_FIXUP_ACER_ASPIRE_4930G),
2497 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002498 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2499 ALC882_FIXUP_ACER_ASPIRE_4930G),
2500 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2501 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002502 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2503 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002504 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002505 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002506 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002507 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002508 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002509 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Jian-Hong Panca184352020-10-07 13:22:25 +08002510 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002511 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002512 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002513 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaib7529c12021-04-28 13:26:53 +02002514 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2515 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002516 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002517 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002518 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002519
2520 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002521 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2522 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2523 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002524 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002525 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2526 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002527 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2528 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002529 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002530 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002531 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002532 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2533 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002534 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002535 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2536 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2537 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002538 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002539 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002540 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2541 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002542 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002543
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002544 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002545 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002546 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002547 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Christian Lachnerc1933002022-01-03 15:05:17 +01002548 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
Christian Lachnerd9e8fe02020-05-18 07:38:44 +02002549 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia0b03952020-06-16 15:21:50 +02002550 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia655e2b2020-02-17 16:19:47 +01002551 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai09926202020-12-20 09:09:43 +01002552 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai1d3aa4a2020-04-08 15:56:45 +02002553 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7dafba32020-02-12 09:10:47 +01002554 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaicc5049a2020-02-18 09:09:15 +01002555 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002556 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai26af1772021-03-03 15:23:46 +01002557 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwai63691582017-05-22 16:32:46 +02002558 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002559 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002560 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
PeiSen Hou259eb822020-05-19 08:50:12 +02002561 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002562 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2563 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2564 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002565 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Steven Clarksonaef454b2021-10-14 06:35:54 -07002566 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002567 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2568 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002569 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Tim Crawforddbfe83502021-11-01 10:21:34 -06002570 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002571 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Werner Sembach1f8d3982021-10-01 15:31:10 +02002572 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Werner Sembachcc030692021-10-01 15:31:11 +02002573 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
Takashi Iwai13e1a4c2021-04-28 13:26:54 +02002574 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2575 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2576 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2577 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2578 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2579 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2580 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2581 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2582 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2583 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2584 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2585 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002586 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2587 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002588 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002589 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002590 {}
2591};
2592
Takashi Iwai1727a772013-01-10 09:52:52 +01002593static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002594 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2595 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2596 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2597 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2598 {.id = ALC889_FIXUP_CD, .name = "cd"},
2599 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2600 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2601 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2602 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2603 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2604 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2605 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2606 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2607 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2608 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002609 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2610 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2611 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002612 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2613 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2614 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2615 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2616 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2617 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2618 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2619 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002620 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002621 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002622 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002623 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002624 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002625 {}
2626};
2627
Hui Wang119b75c2021-05-22 11:47:41 +08002628static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2629 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2630 {0x14, 0x01014010},
2631 {0x15, 0x01011012},
2632 {0x16, 0x01016011},
2633 {0x18, 0x01a19040},
2634 {0x19, 0x02a19050},
2635 {0x1a, 0x0181304f},
2636 {0x1b, 0x0221401f},
2637 {0x1e, 0x01456130}),
2638 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2639 {0x14, 0x01015010},
2640 {0x15, 0x01011012},
2641 {0x16, 0x01011011},
2642 {0x18, 0x01a11040},
2643 {0x19, 0x02a19050},
2644 {0x1a, 0x0181104f},
2645 {0x1b, 0x0221401f},
2646 {0x1e, 0x01451130}),
2647 {}
2648};
2649
Takashi Iwai1d045db2011-07-07 18:23:21 +02002650/*
2651 * BIOS auto configuration
2652 */
2653/* almost identical with ALC880 parser... */
2654static int alc882_parse_auto_config(struct hda_codec *codec)
2655{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002656 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002657 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2658 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002659}
2660
Takashi Iwai1d045db2011-07-07 18:23:21 +02002661/*
2662 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002663static int patch_alc882(struct hda_codec *codec)
2664{
2665 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002666 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002667
Takashi Iwai3de95172012-05-07 18:03:15 +02002668 err = alc_alloc_spec(codec, 0x0b);
2669 if (err < 0)
2670 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002671
Takashi Iwai3de95172012-05-07 18:03:15 +02002672 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002673
Takashi Iwai7639a062015-03-03 10:07:24 +01002674 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002675 case 0x10ec0882:
2676 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002677 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002678 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002679 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002680 break;
2681 default:
2682 /* ALC883 and variants */
2683 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2684 break;
2685 }
2686
Takashi Iwaic9af7532019-05-10 11:01:43 +02002687 alc_pre_init(codec);
2688
Takashi Iwai1727a772013-01-10 09:52:52 +01002689 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002690 alc882_fixups);
Hui Wang119b75c2021-05-22 11:47:41 +08002691 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +01002692 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002693
2694 alc_auto_parse_customize_define(codec);
2695
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002696 if (has_cdefine_beep(codec))
2697 spec->gen.beep_nid = 0x01;
2698
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002699 /* automatic parse from the BIOS config */
2700 err = alc882_parse_auto_config(codec);
2701 if (err < 0)
2702 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002703
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002704 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2705 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2706 if (err < 0)
2707 goto error;
2708 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002709
Takashi Iwai1727a772013-01-10 09:52:52 +01002710 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002711
Takashi Iwai1d045db2011-07-07 18:23:21 +02002712 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002713
2714 error:
2715 alc_free(codec);
2716 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002717}
2718
2719
2720/*
2721 * ALC262 support
2722 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002723static int alc262_parse_auto_config(struct hda_codec *codec)
2724{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002725 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002726 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2727 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002728}
2729
2730/*
2731 * Pin config fixes
2732 */
2733enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002734 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002735 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002736 ALC262_FIXUP_HP_Z200,
2737 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002738 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002739 ALC262_FIXUP_BENQ,
2740 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002741 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002742 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002743};
2744
Takashi Iwai1727a772013-01-10 09:52:52 +01002745static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002746 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002747 .type = HDA_FIXUP_PINS,
2748 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002749 { 0x14, 0x99130110 }, /* speaker */
2750 { 0x15, 0x0221142f }, /* front HP */
2751 { 0x1b, 0x0121141f }, /* rear HP */
2752 { }
2753 }
2754 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002755 [ALC262_FIXUP_FSC_S7110] = {
2756 .type = HDA_FIXUP_PINS,
2757 .v.pins = (const struct hda_pintbl[]) {
2758 { 0x15, 0x90170110 }, /* speaker */
2759 { }
2760 },
2761 .chained = true,
2762 .chain_id = ALC262_FIXUP_BENQ,
2763 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002764 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002765 .type = HDA_FIXUP_PINS,
2766 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002767 { 0x16, 0x99130120 }, /* internal speaker */
2768 { }
2769 }
2770 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002771 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002772 .type = HDA_FIXUP_PINS,
2773 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002774 { 0x14, 0x1993e1f0 }, /* int AUX */
2775 { }
2776 }
2777 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002778 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002779 .type = HDA_FIXUP_PINCTLS,
2780 .v.pins = (const struct hda_pintbl[]) {
2781 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002782 {}
2783 },
2784 .chained = true,
2785 .chain_id = ALC262_FIXUP_BENQ,
2786 },
2787 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002788 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002789 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002790 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2791 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2792 {}
2793 }
2794 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002795 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002796 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002797 .v.verbs = (const struct hda_verb[]) {
2798 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2799 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2800 {}
2801 }
2802 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002803 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002804 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002805 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002806 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002807 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2808 .type = HDA_FIXUP_FUNC,
2809 .v.func = alc_fixup_no_depop_delay,
2810 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002811};
2812
2813static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002814 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002815 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002816 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002817 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002818 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002819 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002820 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002821 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2822 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002823 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002824 {}
2825};
2826
Takashi Iwai1727a772013-01-10 09:52:52 +01002827static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002828 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002829 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2830 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2831 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2832 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2833 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2834 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2835 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2836 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002837 {}
2838};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002839
Takashi Iwai1d045db2011-07-07 18:23:21 +02002840/*
2841 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002842static int patch_alc262(struct hda_codec *codec)
2843{
2844 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002845 int err;
2846
Takashi Iwai3de95172012-05-07 18:03:15 +02002847 err = alc_alloc_spec(codec, 0x0b);
2848 if (err < 0)
2849 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002850
Takashi Iwai3de95172012-05-07 18:03:15 +02002851 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002852 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002853
Takashi Iwai225068a2015-05-29 10:42:14 +02002854 spec->shutup = alc_eapd_shutup;
2855
Takashi Iwai1d045db2011-07-07 18:23:21 +02002856#if 0
2857 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2858 * under-run
2859 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002860 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002861#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002862 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2863
Takashi Iwaic9af7532019-05-10 11:01:43 +02002864 alc_pre_init(codec);
2865
Takashi Iwai1727a772013-01-10 09:52:52 +01002866 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002867 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002868 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002869
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002870 alc_auto_parse_customize_define(codec);
2871
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002872 if (has_cdefine_beep(codec))
2873 spec->gen.beep_nid = 0x01;
2874
Takashi Iwai42399f72011-11-07 17:18:44 +01002875 /* automatic parse from the BIOS config */
2876 err = alc262_parse_auto_config(codec);
2877 if (err < 0)
2878 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002879
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002880 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2881 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2882 if (err < 0)
2883 goto error;
2884 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002885
Takashi Iwai1727a772013-01-10 09:52:52 +01002886 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002887
Takashi Iwai1d045db2011-07-07 18:23:21 +02002888 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002889
2890 error:
2891 alc_free(codec);
2892 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002893}
2894
2895/*
2896 * ALC268
2897 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002898/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002899static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2900 struct snd_ctl_elem_value *ucontrol)
2901{
2902 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2903 unsigned long pval;
2904 int err;
2905
2906 mutex_lock(&codec->control_mutex);
2907 pval = kcontrol->private_value;
2908 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2909 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2910 if (err >= 0) {
2911 kcontrol->private_value = (pval & ~0xff) | 0x10;
2912 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2913 }
2914 kcontrol->private_value = pval;
2915 mutex_unlock(&codec->control_mutex);
2916 return err;
2917}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002918
2919static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2920 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002921 {
2922 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2923 .name = "Beep Playback Switch",
2924 .subdevice = HDA_SUBDEV_AMP_FLAG,
2925 .info = snd_hda_mixer_amp_switch_info,
2926 .get = snd_hda_mixer_amp_switch_get,
2927 .put = alc268_beep_switch_put,
2928 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2929 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002930};
2931
2932/* set PCBEEP vol = 0, mute connections */
2933static const struct hda_verb alc268_beep_init_verbs[] = {
2934 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2935 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2936 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2937 { }
2938};
2939
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002940enum {
2941 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002942 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002943 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002944};
2945
Takashi Iwai1727a772013-01-10 09:52:52 +01002946static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002947 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002948 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002949 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002950 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002951 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002952 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002953 .v.verbs = (const struct hda_verb[]) {
2954 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2955 {}
2956 }
2957 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002958 [ALC268_FIXUP_SPDIF] = {
2959 .type = HDA_FIXUP_PINS,
2960 .v.pins = (const struct hda_pintbl[]) {
2961 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2962 {}
2963 }
2964 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002965};
2966
Takashi Iwai1727a772013-01-10 09:52:52 +01002967static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002968 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002969 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002970 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002971 {}
2972};
2973
2974static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002975 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002976 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002977 /* below is codec SSID since multiple Toshiba laptops have the
2978 * same PCI SSID 1179:ff00
2979 */
2980 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002981 {}
2982};
2983
Takashi Iwai1d045db2011-07-07 18:23:21 +02002984/*
2985 * BIOS auto configuration
2986 */
2987static int alc268_parse_auto_config(struct hda_codec *codec)
2988{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002989 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002990 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002991}
2992
Takashi Iwai1d045db2011-07-07 18:23:21 +02002993/*
2994 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002995static int patch_alc268(struct hda_codec *codec)
2996{
2997 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002998 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002999
Takashi Iwai1d045db2011-07-07 18:23:21 +02003000 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02003001 err = alc_alloc_spec(codec, 0);
3002 if (err < 0)
3003 return err;
3004
3005 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02003006 if (has_cdefine_beep(codec))
3007 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003008
Takashi Iwai225068a2015-05-29 10:42:14 +02003009 spec->shutup = alc_eapd_shutup;
3010
Takashi Iwaic9af7532019-05-10 11:01:43 +02003011 alc_pre_init(codec);
3012
Takashi Iwai1727a772013-01-10 09:52:52 +01003013 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3014 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003015
Takashi Iwai6ebb8052011-08-16 15:15:40 +02003016 /* automatic parse from the BIOS config */
3017 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02003018 if (err < 0)
3019 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003020
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003021 if (err > 0 && !spec->gen.no_analog &&
3022 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02003023 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3024 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3025 &alc268_beep_mixer[i])) {
3026 err = -ENOMEM;
3027 goto error;
3028 }
3029 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003030 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003031 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3032 /* override the amp caps for beep generator */
3033 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3034 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3035 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3036 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3037 (0 << AC_AMPCAP_MUTE_SHIFT));
3038 }
3039
Takashi Iwai1727a772013-01-10 09:52:52 +01003040 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003041
Takashi Iwai1d045db2011-07-07 18:23:21 +02003042 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02003043
3044 error:
3045 alc_free(codec);
3046 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003047}
3048
3049/*
3050 * ALC269
3051 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003052
Takashi Iwai1d045db2011-07-07 18:23:21 +02003053static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003054 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003055};
3056
3057static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003058 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003059};
3060
Takashi Iwai1d045db2011-07-07 18:23:21 +02003061/* different alc269-variants */
3062enum {
3063 ALC269_TYPE_ALC269VA,
3064 ALC269_TYPE_ALC269VB,
3065 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02003066 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01003067 ALC269_TYPE_ALC280,
3068 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02003069 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01003070 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08003071 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02003072 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08003073 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003074 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08003075 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003076 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003077 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003078 ALC269_TYPE_ALC225,
Kailang Yang99cee0342021-07-01 09:09:37 +08003079 ALC269_TYPE_ALC287,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003080 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003081 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003082 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003083 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003084};
3085
3086/*
3087 * BIOS auto configuration
3088 */
3089static int alc269_parse_auto_config(struct hda_codec *codec)
3090{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003091 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003092 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3093 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3094 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003095 const hda_nid_t *ssids;
3096
3097 switch (spec->codec_variant) {
3098 case ALC269_TYPE_ALC269VA:
3099 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003100 case ALC269_TYPE_ALC280:
3101 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003102 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003103 ssids = alc269va_ssids;
3104 break;
3105 case ALC269_TYPE_ALC269VB:
3106 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003107 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003108 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003109 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003110 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003111 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003112 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003113 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003114 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003115 case ALC269_TYPE_ALC225:
Kailang Yang99cee0342021-07-01 09:09:37 +08003116 case ALC269_TYPE_ALC287:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003117 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003118 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003119 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003120 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003121 ssids = alc269_ssids;
3122 break;
3123 default:
3124 ssids = alc269_ssids;
3125 break;
3126 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003127
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003128 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003129}
3130
Hui Wang476c02e2020-03-29 16:20:18 +08003131static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3132 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3133 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3134 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3135 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3136 {}
3137};
3138
3139static void alc_headset_btn_callback(struct hda_codec *codec,
3140 struct hda_jack_callback *jack)
3141{
3142 int report = 0;
3143
3144 if (jack->unsol_res & (7 << 13))
3145 report |= SND_JACK_BTN_0;
3146
3147 if (jack->unsol_res & (1 << 16 | 3 << 8))
3148 report |= SND_JACK_BTN_1;
3149
3150 /* Volume up key */
3151 if (jack->unsol_res & (7 << 23))
3152 report |= SND_JACK_BTN_2;
3153
3154 /* Volume down key */
3155 if (jack->unsol_res & (7 << 10))
3156 report |= SND_JACK_BTN_3;
3157
Hui Wang04f77912021-03-05 17:26:08 +08003158 snd_hda_jack_set_button_state(codec, jack->nid, report);
Hui Wang476c02e2020-03-29 16:20:18 +08003159}
3160
3161static void alc_disable_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, 0x0);
3177 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3178 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
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, 0x0);
3184 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3185 break;
3186 }
3187}
3188
3189static void alc_enable_headset_jack_key(struct hda_codec *codec)
3190{
3191 struct alc_spec *spec = codec->spec;
3192
3193 if (!spec->has_hs_key)
3194 return;
3195
3196 switch (codec->core.vendor_id) {
3197 case 0x10ec0215:
3198 case 0x10ec0225:
3199 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003200 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003201 case 0x10ec0295:
3202 case 0x10ec0289:
3203 case 0x10ec0299:
3204 alc_write_coef_idx(codec, 0x48, 0xd011);
3205 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3206 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3207 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02003208 case 0x10ec0230:
Hui Wang476c02e2020-03-29 16:20:18 +08003209 case 0x10ec0236:
3210 case 0x10ec0256:
3211 alc_write_coef_idx(codec, 0x48, 0xd011);
3212 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3213 break;
3214 }
3215}
3216
3217static void alc_fixup_headset_jack(struct hda_codec *codec,
3218 const struct hda_fixup *fix, int action)
3219{
3220 struct alc_spec *spec = codec->spec;
Hui Wang04f77912021-03-05 17:26:08 +08003221 hda_nid_t hp_pin;
Hui Wang476c02e2020-03-29 16:20:18 +08003222
3223 switch (action) {
3224 case HDA_FIXUP_ACT_PRE_PROBE:
3225 spec->has_hs_key = 1;
3226 snd_hda_jack_detect_enable_callback(codec, 0x55,
3227 alc_headset_btn_callback);
Hui Wang476c02e2020-03-29 16:20:18 +08003228 break;
Hui Wang04f77912021-03-05 17:26:08 +08003229 case HDA_FIXUP_ACT_BUILD:
3230 hp_pin = alc_get_hp_pin(spec);
3231 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3232 alc_headset_btn_keymap,
3233 hp_pin))
3234 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3235 false, SND_JACK_HEADSET,
3236 alc_headset_btn_keymap);
3237
Hui Wang476c02e2020-03-29 16:20:18 +08003238 alc_enable_headset_jack_key(codec);
3239 break;
3240 }
3241}
3242
Kailang Yang1387e2d2012-11-08 10:23:18 +01003243static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003244{
Takashi Iwai98b24882014-08-18 13:47:50 +02003245 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003246}
3247
3248static void alc269_shutup(struct hda_codec *codec)
3249{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003250 struct alc_spec *spec = codec->spec;
3251
Kailang Yang1387e2d2012-11-08 10:23:18 +01003252 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3253 alc269vb_toggle_power_output(codec, 0);
3254 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3255 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003256 msleep(150);
3257 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003258 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003259}
3260
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003261static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003262 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003263 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003264 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3265 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3266 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3267 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3268 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3269 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3270 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3271 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3272 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3273 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3274 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3275 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3276 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3277 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3278 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3279 WRITE_COEF(0x63, 0x2902), /* PLL */
3280 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3281 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3282 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3283 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3284 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3285 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3286 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3287 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3288 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3289 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3290 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3291 {}
3292};
3293
Kailang Yangcb149cb2014-03-18 16:45:32 +08003294static void alc282_restore_default_value(struct hda_codec *codec)
3295{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003296 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003297}
3298
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003299static void alc282_init(struct hda_codec *codec)
3300{
3301 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003302 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003303 bool hp_pin_sense;
3304 int coef78;
3305
Kailang Yangcb149cb2014-03-18 16:45:32 +08003306 alc282_restore_default_value(codec);
3307
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003308 if (!hp_pin)
3309 return;
3310 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3311 coef78 = alc_read_coef_idx(codec, 0x78);
3312
3313 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3314 /* Headphone capless set to high power mode */
3315 alc_write_coef_idx(codec, 0x78, 0x9004);
3316
3317 if (hp_pin_sense)
3318 msleep(2);
3319
3320 snd_hda_codec_write(codec, hp_pin, 0,
3321 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3322
3323 if (hp_pin_sense)
3324 msleep(85);
3325
3326 snd_hda_codec_write(codec, hp_pin, 0,
3327 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3328
3329 if (hp_pin_sense)
3330 msleep(100);
3331
3332 /* Headphone capless set to normal mode */
3333 alc_write_coef_idx(codec, 0x78, coef78);
3334}
3335
3336static void alc282_shutup(struct hda_codec *codec)
3337{
3338 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003339 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003340 bool hp_pin_sense;
3341 int coef78;
3342
3343 if (!hp_pin) {
3344 alc269_shutup(codec);
3345 return;
3346 }
3347
3348 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3349 coef78 = alc_read_coef_idx(codec, 0x78);
3350 alc_write_coef_idx(codec, 0x78, 0x9004);
3351
3352 if (hp_pin_sense)
3353 msleep(2);
3354
3355 snd_hda_codec_write(codec, hp_pin, 0,
3356 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3357
3358 if (hp_pin_sense)
3359 msleep(85);
3360
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003361 if (!spec->no_shutup_pins)
3362 snd_hda_codec_write(codec, hp_pin, 0,
3363 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003364
3365 if (hp_pin_sense)
3366 msleep(100);
3367
3368 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003369 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003370 alc_write_coef_idx(codec, 0x78, coef78);
3371}
3372
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003373static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003374 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003375 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003376 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3377 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3378 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3379 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3380 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3381 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3382 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3383 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3384 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3385 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3386 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3387 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3388 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3389 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3390 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3391 WRITE_COEF(0x2e, 0x2902), /* PLL */
3392 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3393 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3394 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3395 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3396 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3397 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3398 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3399 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3400 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3401 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3402 WRITE_COEF(0x49, 0x0), /* test mode */
3403 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3404 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3405 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003406 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003407 {}
3408};
3409
Kailang Yang6bd55b02014-03-17 13:51:27 +08003410static void alc283_restore_default_value(struct hda_codec *codec)
3411{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003412 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003413}
3414
Kailang Yang2af02be2013-08-22 10:03:50 +02003415static void alc283_init(struct hda_codec *codec)
3416{
3417 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003418 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003419 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003420
Kailang Yang6bd55b02014-03-17 13:51:27 +08003421 alc283_restore_default_value(codec);
3422
Kailang Yang2af02be2013-08-22 10:03:50 +02003423 if (!hp_pin)
3424 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003425
3426 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003427 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3428
3429 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3430 /* Headphone capless set to high power mode */
3431 alc_write_coef_idx(codec, 0x43, 0x9004);
3432
3433 snd_hda_codec_write(codec, hp_pin, 0,
3434 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3435
3436 if (hp_pin_sense)
3437 msleep(85);
3438
3439 snd_hda_codec_write(codec, hp_pin, 0,
3440 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3441
3442 if (hp_pin_sense)
3443 msleep(85);
3444 /* Index 0x46 Combo jack auto switch control 2 */
3445 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003446 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003447 /* Headphone capless set to normal mode */
3448 alc_write_coef_idx(codec, 0x43, 0x9614);
3449}
3450
3451static void alc283_shutup(struct hda_codec *codec)
3452{
3453 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003454 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003455 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003456
3457 if (!hp_pin) {
3458 alc269_shutup(codec);
3459 return;
3460 }
3461
3462 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3463
3464 alc_write_coef_idx(codec, 0x43, 0x9004);
3465
Harsha Priyab450b172014-10-09 11:04:56 +00003466 /*depop hp during suspend*/
3467 alc_write_coef_idx(codec, 0x06, 0x2100);
3468
Kailang Yang2af02be2013-08-22 10:03:50 +02003469 snd_hda_codec_write(codec, hp_pin, 0,
3470 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3471
3472 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003473 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003474
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003475 if (!spec->no_shutup_pins)
3476 snd_hda_codec_write(codec, hp_pin, 0,
3477 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003478
Takashi Iwai98b24882014-08-18 13:47:50 +02003479 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003480
3481 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003482 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003483 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003484 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003485 alc_write_coef_idx(codec, 0x43, 0x9614);
3486}
3487
Kailang Yang4a219ef2017-06-16 16:54:35 +08003488static void alc256_init(struct hda_codec *codec)
3489{
3490 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003491 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003492 bool hp_pin_sense;
3493
3494 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003495 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003496
3497 msleep(30);
3498
3499 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3500
3501 if (hp_pin_sense)
3502 msleep(2);
3503
3504 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003505 if (spec->ultra_low_power) {
3506 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3507 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3508 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3509 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3510 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3511 msleep(30);
3512 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003513
3514 snd_hda_codec_write(codec, hp_pin, 0,
3515 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3516
Kailang Yang6447c962019-05-08 16:27:03 +08003517 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003518 msleep(85);
3519
3520 snd_hda_codec_write(codec, hp_pin, 0,
3521 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3522
Kailang Yang6447c962019-05-08 16:27:03 +08003523 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003524 msleep(100);
3525
3526 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3527 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003528 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3529 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003530 /*
3531 * Expose headphone mic (or possibly Line In on some machines) instead
3532 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3533 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3534 * this register.
3535 */
3536 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003537}
3538
3539static void alc256_shutup(struct hda_codec *codec)
3540{
3541 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003542 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003543 bool hp_pin_sense;
3544
Kailang Yang6447c962019-05-08 16:27:03 +08003545 if (!hp_pin)
3546 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003547
3548 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3549
3550 if (hp_pin_sense)
3551 msleep(2);
3552
3553 snd_hda_codec_write(codec, hp_pin, 0,
3554 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3555
Kailang Yang6447c962019-05-08 16:27:03 +08003556 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003557 msleep(85);
3558
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003559 /* 3k pull low control for Headset jack. */
3560 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003561 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3562 * when booting with headset plugged. So skip setting it for the codec alc257
3563 */
Kailang Yang5aec9892021-10-05 14:35:14 +08003564 if (spec->codec_variant != ALC269_TYPE_ALC257 &&
3565 spec->codec_variant != ALC269_TYPE_ALC256)
Hui Wang3f742492020-09-14 14:51:18 +08003566 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003567
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003568 if (!spec->no_shutup_pins)
3569 snd_hda_codec_write(codec, hp_pin, 0,
3570 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003571
Kailang Yang6447c962019-05-08 16:27:03 +08003572 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003573 msleep(100);
3574
3575 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003576 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003577 if (spec->ultra_low_power) {
3578 msleep(50);
3579 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3580 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3581 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3582 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3583 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3584 msleep(30);
3585 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003586}
3587
Kailang Yang3c24e482021-07-01 09:33:33 +08003588static void alc285_hp_init(struct hda_codec *codec)
3589{
3590 struct alc_spec *spec = codec->spec;
3591 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3592 int i, val;
3593 int coef38, coef0d, coef36;
3594
3595 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3596 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3597 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3598 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3599 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3600 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3601
3602 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3603
3604 if (hp_pin)
3605 snd_hda_codec_write(codec, hp_pin, 0,
3606 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3607
3608 msleep(130);
3609 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3610 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3611
3612 if (hp_pin)
3613 snd_hda_codec_write(codec, hp_pin, 0,
3614 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3615 msleep(10);
3616 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3617 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3618 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3619 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3620
3621 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3622 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3623 for (i = 0; i < 20 && val & 0x8000; i++) {
3624 msleep(50);
3625 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3626 } /* Wait for depop procedure finish */
3627
3628 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3629 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3630 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3631 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3632
3633 msleep(50);
3634 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3635}
3636
Kailang Yangda911b12018-01-05 16:50:08 +08003637static void alc225_init(struct hda_codec *codec)
3638{
3639 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003640 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003641 bool hp1_pin_sense, hp2_pin_sense;
3642
Kailang Yang3c24e482021-07-01 09:33:33 +08003643 if (spec->codec_variant != ALC269_TYPE_ALC287)
3644 /* required only at boot or S3 and S4 resume time */
3645 if (!spec->done_hp_init ||
3646 is_s3_resume(codec) ||
3647 is_s4_resume(codec)) {
3648 alc285_hp_init(codec);
3649 spec->done_hp_init = true;
3650 }
3651
Kailang Yangda911b12018-01-05 16:50:08 +08003652 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003653 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003654 msleep(30);
3655
3656 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3657 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3658
3659 if (hp1_pin_sense || hp2_pin_sense)
3660 msleep(2);
3661
3662 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003663 if (spec->ultra_low_power) {
3664 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3665 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3666 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3667 msleep(30);
3668 }
Kailang Yangda911b12018-01-05 16:50:08 +08003669
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003670 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003671 snd_hda_codec_write(codec, hp_pin, 0,
3672 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3673 if (hp2_pin_sense)
3674 snd_hda_codec_write(codec, 0x16, 0,
3675 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3676
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003677 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003678 msleep(85);
3679
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003680 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003681 snd_hda_codec_write(codec, hp_pin, 0,
3682 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3683 if (hp2_pin_sense)
3684 snd_hda_codec_write(codec, 0x16, 0,
3685 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3686
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003687 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003688 msleep(100);
3689
3690 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3691 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3692}
3693
3694static void alc225_shutup(struct hda_codec *codec)
3695{
3696 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003697 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003698 bool hp1_pin_sense, hp2_pin_sense;
3699
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003700 if (!hp_pin)
3701 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003702
3703 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003704 /* 3k pull low control for Headset jack. */
3705 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3706
3707 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3708 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3709
3710 if (hp1_pin_sense || hp2_pin_sense)
3711 msleep(2);
3712
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003713 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003714 snd_hda_codec_write(codec, hp_pin, 0,
3715 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3716 if (hp2_pin_sense)
3717 snd_hda_codec_write(codec, 0x16, 0,
3718 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3719
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003720 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003721 msleep(85);
3722
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003723 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003724 snd_hda_codec_write(codec, hp_pin, 0,
3725 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3726 if (hp2_pin_sense)
3727 snd_hda_codec_write(codec, 0x16, 0,
3728 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3729
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003730 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003731 msleep(100);
3732
3733 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003734 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003735 if (spec->ultra_low_power) {
3736 msleep(50);
3737 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3738 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3739 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3740 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3741 msleep(30);
3742 }
Hui Wang476c02e2020-03-29 16:20:18 +08003743
3744 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3745 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003746}
3747
Kailang Yangc2d6af52017-06-21 14:50:54 +08003748static void alc_default_init(struct hda_codec *codec)
3749{
3750 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003751 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003752 bool hp_pin_sense;
3753
3754 if (!hp_pin)
3755 return;
3756
3757 msleep(30);
3758
3759 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3760
3761 if (hp_pin_sense)
3762 msleep(2);
3763
3764 snd_hda_codec_write(codec, hp_pin, 0,
3765 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3766
3767 if (hp_pin_sense)
3768 msleep(85);
3769
3770 snd_hda_codec_write(codec, hp_pin, 0,
3771 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3772
3773 if (hp_pin_sense)
3774 msleep(100);
3775}
3776
3777static void alc_default_shutup(struct hda_codec *codec)
3778{
3779 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003780 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003781 bool hp_pin_sense;
3782
3783 if (!hp_pin) {
3784 alc269_shutup(codec);
3785 return;
3786 }
3787
3788 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3789
3790 if (hp_pin_sense)
3791 msleep(2);
3792
3793 snd_hda_codec_write(codec, hp_pin, 0,
3794 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3795
3796 if (hp_pin_sense)
3797 msleep(85);
3798
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003799 if (!spec->no_shutup_pins)
3800 snd_hda_codec_write(codec, hp_pin, 0,
3801 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003802
3803 if (hp_pin_sense)
3804 msleep(100);
3805
3806 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003807 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003808}
3809
Kailang Yang693abe12019-01-29 15:38:21 +08003810static void alc294_hp_init(struct hda_codec *codec)
3811{
3812 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003813 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003814 int i, val;
3815
3816 if (!hp_pin)
3817 return;
3818
3819 snd_hda_codec_write(codec, hp_pin, 0,
3820 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3821
3822 msleep(100);
3823
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003824 if (!spec->no_shutup_pins)
3825 snd_hda_codec_write(codec, hp_pin, 0,
3826 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003827
3828 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3829 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3830
3831 /* Wait for depop procedure finish */
3832 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3833 for (i = 0; i < 20 && val & 0x0080; i++) {
3834 msleep(50);
3835 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3836 }
3837 /* Set HP depop to auto mode */
3838 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3839 msleep(50);
3840}
3841
3842static void alc294_init(struct hda_codec *codec)
3843{
3844 struct alc_spec *spec = codec->spec;
3845
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003846 /* required only at boot or S4 resume time */
3847 if (!spec->done_hp_init ||
3848 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003849 alc294_hp_init(codec);
3850 spec->done_hp_init = true;
3851 }
3852 alc_default_init(codec);
3853}
3854
Kailang Yangad60d502013-06-28 12:03:01 +02003855static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3856 unsigned int val)
3857{
3858 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3859 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3860 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3861}
3862
3863static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3864{
3865 unsigned int val;
3866
3867 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3868 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3869 & 0xffff;
3870 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3871 << 16;
3872 return val;
3873}
3874
3875static void alc5505_dsp_halt(struct hda_codec *codec)
3876{
3877 unsigned int val;
3878
3879 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3880 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3881 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3882 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3883 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3884 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3885 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3886 val = alc5505_coef_get(codec, 0x6220);
3887 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3888}
3889
3890static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3891{
3892 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3893 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3894 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3895 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3896 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3897 alc5505_coef_set(codec, 0x880c, 0x00000004);
3898}
3899
3900static void alc5505_dsp_init(struct hda_codec *codec)
3901{
3902 unsigned int val;
3903
3904 alc5505_dsp_halt(codec);
3905 alc5505_dsp_back_from_halt(codec);
3906 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3907 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3908 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3909 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3910 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3911 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3912 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3913 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3914 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3915 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3916 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3917 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3918 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3919
3920 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3921 if (val <= 3)
3922 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3923 else
3924 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3925
3926 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3927 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3928 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3929 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3930 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3931 alc5505_coef_set(codec, 0x880c, 0x00000003);
3932 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003933
3934#ifdef HALT_REALTEK_ALC5505
3935 alc5505_dsp_halt(codec);
3936#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003937}
3938
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003939#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003940#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3941#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003942#else
3943#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3944#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3945#endif
3946
Takashi Iwai2a439522011-07-26 09:52:50 +02003947#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003948static int alc269_suspend(struct hda_codec *codec)
3949{
3950 struct alc_spec *spec = codec->spec;
3951
3952 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003953 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003954 return alc_suspend(codec);
3955}
3956
Takashi Iwai1d045db2011-07-07 18:23:21 +02003957static int alc269_resume(struct hda_codec *codec)
3958{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003959 struct alc_spec *spec = codec->spec;
3960
Kailang Yang1387e2d2012-11-08 10:23:18 +01003961 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3962 alc269vb_toggle_power_output(codec, 0);
3963 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003964 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003965 msleep(150);
3966 }
3967
3968 codec->patch_ops.init(codec);
3969
Kailang Yang1387e2d2012-11-08 10:23:18 +01003970 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3971 alc269vb_toggle_power_output(codec, 1);
3972 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003973 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003974 msleep(200);
3975 }
3976
Takashi Iwai1a462be2020-01-09 10:01:04 +01003977 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003978 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003979
3980 /* on some machine, the BIOS will clear the codec gpio data when enter
3981 * suspend, and won't restore the data after resume, so we restore it
3982 * in the driver.
3983 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003984 if (spec->gpio_data)
3985 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003986
Kailang Yangad60d502013-06-28 12:03:01 +02003987 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003988 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003989
Takashi Iwai1d045db2011-07-07 18:23:21 +02003990 return 0;
3991}
Takashi Iwai2a439522011-07-26 09:52:50 +02003992#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003993
David Henningsson108cc102012-07-20 10:37:25 +02003994static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003995 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003996{
3997 struct alc_spec *spec = codec->spec;
3998
Takashi Iwai1727a772013-01-10 09:52:52 +01003999 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02004000 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4001}
4002
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01004003static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4004 const struct hda_fixup *fix,
4005 int action)
4006{
4007 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4008 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4009
4010 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4011 snd_hda_codec_set_pincfg(codec, 0x19,
4012 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4013 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4014}
4015
Takashi Iwai1d045db2011-07-07 18:23:21 +02004016static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004017 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02004018{
Takashi Iwai98b24882014-08-18 13:47:50 +02004019 if (action == HDA_FIXUP_ACT_INIT)
4020 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004021}
4022
David Henningsson7c478f02013-10-11 10:18:46 +02004023static void alc269_fixup_headset_mic(struct hda_codec *codec,
4024 const struct hda_fixup *fix, int action)
4025{
4026 struct alc_spec *spec = codec->spec;
4027
4028 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4029 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4030}
4031
Takashi Iwai1d045db2011-07-07 18:23:21 +02004032static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004033 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02004034{
4035 static const struct hda_verb verbs[] = {
4036 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4037 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4038 {}
4039 };
4040 unsigned int cfg;
4041
Takashi Iwai7639a062015-03-03 10:07:24 +01004042 if (strcmp(codec->core.chip_name, "ALC271X") &&
4043 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02004044 return;
4045 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4046 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4047 snd_hda_sequence_write(codec, verbs);
4048}
4049
Takashi Iwaic8426b22021-04-07 11:57:30 +02004050/* Fix the speaker amp after resume, etc */
4051static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4052 const struct hda_fixup *fix,
4053 int action)
4054{
4055 if (action == HDA_FIXUP_ACT_INIT)
4056 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4057}
4058
Takashi Iwai017f2a12011-07-09 14:42:25 +02004059static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004060 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02004061{
4062 struct alc_spec *spec = codec->spec;
4063
Takashi Iwai1727a772013-01-10 09:52:52 +01004064 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02004065 return;
4066
4067 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4068 * fix the sample rate of analog I/O to 44.1kHz
4069 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01004070 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4071 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02004072}
4073
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004074static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004075 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004076{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004077 /* The digital-mic unit sends PDM (differential signal) instead of
4078 * the standard PCM, thus you can't record a valid mono stream as is.
4079 * Below is a workaround specific to ALC269 to control the dmic
4080 * signal source as mono.
4081 */
Takashi Iwai98b24882014-08-18 13:47:50 +02004082 if (action == HDA_FIXUP_ACT_INIT)
4083 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004084}
4085
Takashi Iwai24519912011-08-16 15:08:49 +02004086static void alc269_quanta_automute(struct hda_codec *codec)
4087{
Takashi Iwai08c189f2012-12-19 15:22:24 +01004088 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02004089
Takashi Iwai1687ccc2014-08-18 13:49:35 +02004090 alc_write_coef_idx(codec, 0x0c, 0x680);
4091 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02004092}
4093
4094static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004095 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02004096{
4097 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01004098 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02004099 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01004100 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02004101}
4102
David Henningssond240d1d2013-04-15 12:50:02 +02004103static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004104 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02004105{
4106 struct alc_spec *spec = codec->spec;
4107 int vref;
4108 msleep(200);
4109 snd_hda_gen_hp_automute(codec, jack);
4110
4111 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4112 msleep(100);
4113 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4114 vref);
4115 msleep(500);
4116 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4117 vref);
4118}
4119
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02004120/*
4121 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4122 */
4123struct hda_alc298_mbxinit {
4124 unsigned char value_0x23;
4125 unsigned char value_0x25;
4126};
4127
4128static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4129 const struct hda_alc298_mbxinit *initval,
4130 bool first)
4131{
4132 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4133 alc_write_coef_idx(codec, 0x26, 0xb000);
4134
4135 if (first)
4136 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4137
4138 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4139 alc_write_coef_idx(codec, 0x26, 0xf000);
4140 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4141
4142 if (initval->value_0x23 != 0x1e)
4143 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4144
4145 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4146 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4147}
4148
4149static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4150 const struct hda_fixup *fix,
4151 int action)
4152{
4153 /* Initialization magic */
4154 static const struct hda_alc298_mbxinit dac_init[] = {
4155 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4156 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4157 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4158 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4159 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4160 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4161 {0x2f, 0x00},
4162 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4163 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4164 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4165 {}
4166 };
4167 const struct hda_alc298_mbxinit *seq;
4168
4169 if (action != HDA_FIXUP_ACT_INIT)
4170 return;
4171
4172 /* Start */
4173 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4174 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4175 alc_write_coef_idx(codec, 0x26, 0xf000);
4176 alc_write_coef_idx(codec, 0x22, 0x31);
4177 alc_write_coef_idx(codec, 0x23, 0x0b);
4178 alc_write_coef_idx(codec, 0x25, 0x00);
4179 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4180 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4181
4182 for (seq = dac_init; seq->value_0x23; seq++)
4183 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4184}
4185
David Henningssond240d1d2013-04-15 12:50:02 +02004186static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4187 const struct hda_fixup *fix, int action)
4188{
4189 struct alc_spec *spec = codec->spec;
4190 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4191 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4192 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4193 }
4194}
4195
Takashi Iwai766538a2020-06-18 13:08:41 +02004196static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4197 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004198{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004199 unsigned int pinval;
4200
Takashi Iwai766538a2020-06-18 13:08:41 +02004201 if (!pin)
4202 return;
4203 if (polarity)
4204 on = !on;
4205 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004206 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004207 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4208 /* temporarily power up/down for setting VREF */
4209 snd_hda_power_up_pm(codec);
4210 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4211 snd_hda_power_down_pm(codec);
4212}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004213
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004214/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004215static int vref_mute_led_set(struct led_classdev *led_cdev,
4216 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004217{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004218 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004219 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004220
Takashi Iwai766538a2020-06-18 13:08:41 +02004221 alc_update_vref_led(codec, spec->mute_led_nid,
4222 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004223 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004224}
4225
David Henningssond5b6b652013-11-06 10:50:44 +01004226/* Make sure the led works even in runtime suspend */
4227static unsigned int led_power_filter(struct hda_codec *codec,
4228 hda_nid_t nid,
4229 unsigned int power_state)
4230{
4231 struct alc_spec *spec = codec->spec;
4232
Hui Wang50dd9052014-07-08 17:56:15 +08004233 if (power_state != AC_PWRST_D3 || nid == 0 ||
4234 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004235 return power_state;
4236
4237 /* Set pin ctl again, it might have just been set to 0 */
4238 snd_hda_set_pin_ctl(codec, nid,
4239 snd_hda_codec_get_pin_target(codec, nid));
4240
Takashi Iwaicffd3962015-04-09 10:30:25 +02004241 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004242}
4243
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004244static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4245 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004246{
4247 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004248 const struct dmi_device *dev = NULL;
4249
4250 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4251 return;
4252
4253 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4254 int pol, pin;
4255 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4256 continue;
4257 if (pin < 0x0a || pin >= 0x10)
4258 break;
4259 spec->mute_led_polarity = pol;
4260 spec->mute_led_nid = pin - 0x0a + 0x18;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004261 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004262 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004263 codec_dbg(codec,
4264 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004265 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004266 break;
4267 }
4268}
4269
Takashi Iwai85c467d2018-05-29 11:38:38 +02004270static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4271 const struct hda_fixup *fix,
4272 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004273{
4274 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004275
David Henningssond06ac142013-02-18 11:41:55 +01004276 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4277 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004278 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004279 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004280 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004281 }
4282}
4283
Takashi Iwai85c467d2018-05-29 11:38:38 +02004284static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4285 const struct hda_fixup *fix, int action)
4286{
4287 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4288}
4289
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004290static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4291 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004292{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004293 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004294}
4295
Tom Briden7f783bd2017-03-25 10:12:01 +00004296static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4297 const struct hda_fixup *fix, int action)
4298{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004299 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004300}
4301
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004302/* update LED status via GPIO */
4303static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004304 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004305{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004306 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004307 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004308 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004309}
4310
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004311/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004312static int gpio_mute_led_set(struct led_classdev *led_cdev,
4313 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004314{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004315 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004316 struct alc_spec *spec = codec->spec;
4317
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004318 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004319 spec->mute_led_polarity, !brightness);
4320 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004321}
4322
4323/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004324static int micmute_led_set(struct led_classdev *led_cdev,
4325 enum led_brightness brightness)
4326{
4327 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4328 struct alc_spec *spec = codec->spec;
4329
4330 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004331 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004332 return 0;
4333}
4334
Takashi Iwai01e4a272018-06-19 22:47:30 +02004335/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4336static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4337 int action,
4338 unsigned int mute_mask,
4339 unsigned int micmute_mask)
4340{
4341 struct alc_spec *spec = codec->spec;
4342
4343 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4344
4345 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4346 return;
4347 if (mute_mask) {
4348 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004349 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004350 }
4351 if (micmute_mask) {
4352 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004353 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004354 }
4355}
4356
Jeremy Szue7d66cf2021-03-16 15:46:24 +08004357static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4358 const struct hda_fixup *fix, int action)
4359{
4360 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4361}
4362
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004363static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4364 const struct hda_fixup *fix, int action)
4365{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004366 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004367}
4368
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004369static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4370 const struct hda_fixup *fix, int action)
4371{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004372 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004373}
4374
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004375static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4376 const struct hda_fixup *fix, int action)
4377{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004378 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004379}
4380
Kailang Yanga0ccbc52020-11-06 15:20:38 +08004381static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4382 const struct hda_fixup *fix, int action)
4383{
4384 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4385}
4386
Johnathon Clark5fc462c2021-10-20 14:12:51 +01004387static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4388 const struct hda_fixup *fix, int action)
4389{
4390 struct alc_spec *spec = codec->spec;
4391
4392 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4393 spec->micmute_led_polarity = 1;
4394 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4395}
4396
Takashi Iwai8a503552020-06-18 13:08:32 +02004397/* turn on/off mic-mute LED per capture hook via VREF change */
4398static int vref_micmute_led_set(struct led_classdev *led_cdev,
4399 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004400{
Takashi Iwai8a503552020-06-18 13:08:32 +02004401 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004402 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004403
Takashi Iwai766538a2020-06-18 13:08:41 +02004404 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4405 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004406 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004407}
4408
4409static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4410 const struct hda_fixup *fix, int action)
4411{
4412 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004413
Takashi Iwai01e4a272018-06-19 22:47:30 +02004414 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004415 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004416 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4417 * enable headphone amp
4418 */
4419 spec->gpio_mask |= 0x10;
4420 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004421 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004422 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004423 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004424 }
4425}
4426
David Henningsson7a5255f2014-10-30 08:26:01 +01004427static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4428 const struct hda_fixup *fix, int action)
4429{
David Henningsson7a5255f2014-10-30 08:26:01 +01004430 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004431
Takashi Iwai01e4a272018-06-19 22:47:30 +02004432 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004433 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004434 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004435 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004436 codec->power_filter = led_power_filter;
4437 }
4438}
4439
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01004440/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4441 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4442 */
4443static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4444 const struct hda_fixup *fix, int action)
4445{
4446 struct alc_spec *spec = codec->spec;
4447
4448 switch (action) {
4449 case HDA_FIXUP_ACT_PRE_PROBE:
4450 spec->gpio_mask |= 0x01;
4451 spec->gpio_dir |= 0x01;
4452 break;
4453 case HDA_FIXUP_ACT_INIT:
4454 /* need to toggle GPIO to enable the amp */
4455 alc_update_gpio_data(codec, 0x01, true);
4456 msleep(100);
4457 alc_update_gpio_data(codec, 0x01, false);
4458 break;
4459 }
4460}
4461
Takashi Iwai622464c2021-05-04 11:18:02 +02004462/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4463static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4464 struct hda_codec *codec,
4465 struct snd_pcm_substream *substream,
4466 int action)
4467{
4468 switch (action) {
4469 case HDA_GEN_PCM_ACT_PREPARE:
4470 alc_update_gpio_data(codec, 0x04, true);
4471 break;
4472 case HDA_GEN_PCM_ACT_CLEANUP:
4473 alc_update_gpio_data(codec, 0x04, false);
4474 break;
4475 }
4476}
4477
4478static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4479 const struct hda_fixup *fix,
4480 int action)
4481{
4482 struct alc_spec *spec = codec->spec;
4483
4484 if (action == HDA_FIXUP_ACT_PROBE) {
4485 spec->gpio_mask |= 0x04;
4486 spec->gpio_dir |= 0x04;
4487 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4488 }
4489}
4490
Takashi Iwai766538a2020-06-18 13:08:41 +02004491static void alc_update_coef_led(struct hda_codec *codec,
4492 struct alc_coef_led *led,
4493 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004494{
Takashi Iwai766538a2020-06-18 13:08:41 +02004495 if (polarity)
4496 on = !on;
4497 /* temporarily power up/down for setting COEF bit */
4498 alc_update_coef_idx(codec, led->idx, led->mask,
4499 on ? led->on : led->off);
4500}
4501
Kailang Yang431e76c2020-04-07 14:40:20 +08004502/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004503static int coef_mute_led_set(struct led_classdev *led_cdev,
4504 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004505{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004506 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004507 struct alc_spec *spec = codec->spec;
4508
Takashi Iwai766538a2020-06-18 13:08:41 +02004509 alc_update_coef_led(codec, &spec->mute_led_coef,
4510 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004511 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004512}
4513
4514static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4515 const struct hda_fixup *fix,
4516 int action)
4517{
4518 struct alc_spec *spec = codec->spec;
4519
4520 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4521 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004522 spec->mute_led_coef.idx = 0x0b;
4523 spec->mute_led_coef.mask = 1 << 3;
4524 spec->mute_led_coef.on = 1 << 3;
4525 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004526 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004527 }
4528}
4529
Kailang Yang24164f42020-04-07 14:52:42 +08004530static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4531 const struct hda_fixup *fix,
4532 int action)
4533{
4534 struct alc_spec *spec = codec->spec;
4535
4536 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4537 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004538 spec->mute_led_coef.idx = 0x34;
4539 spec->mute_led_coef.mask = 1 << 5;
4540 spec->mute_led_coef.on = 0;
4541 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004542 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004543 }
4544}
4545
Kailang Yang431e76c2020-04-07 14:40:20 +08004546/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004547static int coef_micmute_led_set(struct led_classdev *led_cdev,
4548 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004549{
Takashi Iwai8a503552020-06-18 13:08:32 +02004550 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004551 struct alc_spec *spec = codec->spec;
4552
Takashi Iwai766538a2020-06-18 13:08:41 +02004553 alc_update_coef_led(codec, &spec->mic_led_coef,
4554 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004555 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004556}
4557
4558static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4559 const struct hda_fixup *fix, int action)
4560{
4561 struct alc_spec *spec = codec->spec;
4562
4563 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004564 spec->mic_led_coef.idx = 0x19;
4565 spec->mic_led_coef.mask = 1 << 13;
4566 spec->mic_led_coef.on = 1 << 13;
4567 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004568 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004569 }
4570}
4571
Kailang Yang24164f42020-04-07 14:52:42 +08004572static void alc236_fixup_hp_coef_micmute_led(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) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004578 spec->mic_led_coef.idx = 0x35;
4579 spec->mic_led_coef.mask = 3 << 2;
4580 spec->mic_led_coef.on = 2 << 2;
4581 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004582 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004583 }
4584}
4585
Kailang Yang431e76c2020-04-07 14:40:20 +08004586static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4587 const struct hda_fixup *fix, int action)
4588{
4589 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4590 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4591}
4592
Kailang Yang24164f42020-04-07 14:52:42 +08004593static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4594 const struct hda_fixup *fix, int action)
4595{
4596 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4597 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4598}
4599
Jonas Witschel75b62ab2021-04-16 12:58:54 +02004600static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4601 const struct hda_fixup *fix, int action)
4602{
4603 struct alc_spec *spec = codec->spec;
4604
4605 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4606 spec->cap_mute_led_nid = 0x1a;
4607 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4608 codec->power_filter = led_power_filter;
4609 }
4610}
4611
4612static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4613 const struct hda_fixup *fix, int action)
4614{
4615 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4616 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4617}
4618
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004619#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004620static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4621 struct hda_jack_callback *event)
4622{
4623 struct alc_spec *spec = codec->spec;
4624
4625 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4626 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004627 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004628 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004629 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004630 input_sync(spec->kb_dev);
4631}
David Henningsson33f4acd2015-01-07 15:50:13 +01004632
Kailang3694cb22015-12-28 11:35:24 +08004633static int alc_register_micmute_input_device(struct hda_codec *codec)
4634{
4635 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004636 int i;
Kailang3694cb22015-12-28 11:35:24 +08004637
4638 spec->kb_dev = input_allocate_device();
4639 if (!spec->kb_dev) {
4640 codec_err(codec, "Out of memory (input_allocate_device)\n");
4641 return -ENOMEM;
4642 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004643
4644 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4645
Kailang3694cb22015-12-28 11:35:24 +08004646 spec->kb_dev->name = "Microphone Mute Button";
4647 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004648 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4649 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4650 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4651 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4652 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004653
4654 if (input_register_device(spec->kb_dev)) {
4655 codec_err(codec, "input_register_device failed\n");
4656 input_free_device(spec->kb_dev);
4657 spec->kb_dev = NULL;
4658 return -ENOMEM;
4659 }
4660
4661 return 0;
4662}
4663
Takashi Iwai01e4a272018-06-19 22:47:30 +02004664/* GPIO1 = set according to SKU external amp
4665 * GPIO2 = mic mute hotkey
4666 * GPIO3 = mute LED
4667 * GPIO4 = mic mute LED
4668 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004669static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4670 const struct hda_fixup *fix, int action)
4671{
David Henningsson33f4acd2015-01-07 15:50:13 +01004672 struct alc_spec *spec = codec->spec;
4673
Takashi Iwai01e4a272018-06-19 22:47:30 +02004674 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004675 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004676 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004677 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004678 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004679
Takashi Iwai01e4a272018-06-19 22:47:30 +02004680 spec->gpio_mask |= 0x06;
4681 spec->gpio_dir |= 0x02;
4682 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004683 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004684 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004685 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004686 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004687 return;
4688 }
4689
4690 if (!spec->kb_dev)
4691 return;
4692
4693 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004694 case HDA_FIXUP_ACT_FREE:
4695 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004696 spec->kb_dev = NULL;
4697 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004698}
4699
Takashi Iwai01e4a272018-06-19 22:47:30 +02004700/* Line2 = mic mute hotkey
4701 * GPIO2 = mic mute LED
4702 */
Kailang3694cb22015-12-28 11:35:24 +08004703static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4704 const struct hda_fixup *fix, int action)
4705{
Kailang3694cb22015-12-28 11:35:24 +08004706 struct alc_spec *spec = codec->spec;
4707
Takashi Iwai01e4a272018-06-19 22:47:30 +02004708 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004709 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004710 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004711 if (alc_register_micmute_input_device(codec) != 0)
4712 return;
4713
Kailang3694cb22015-12-28 11:35:24 +08004714 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4715 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004716 return;
4717 }
4718
4719 if (!spec->kb_dev)
4720 return;
4721
4722 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004723 case HDA_FIXUP_ACT_FREE:
4724 input_unregister_device(spec->kb_dev);
4725 spec->kb_dev = NULL;
4726 }
4727}
Takashi Iwaic4696522018-01-15 10:44:35 +01004728#else /* INPUT */
4729#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4730#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4731#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004732
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004733static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4734 const struct hda_fixup *fix, int action)
4735{
4736 struct alc_spec *spec = codec->spec;
4737
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004738 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004739 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004740 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004741 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004742 }
4743}
4744
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004745static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004746 UPDATE_COEF(0x4a, 1<<8, 0),
4747 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4748 UPDATE_COEF(0x63, 3<<14, 3<<14),
4749 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4750 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4751 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4752 UPDATE_COEF(0x4a, 3<<10, 0),
4753 {}
4754};
4755
David Henningsson73bdd592013-04-15 15:44:14 +02004756static void alc_headset_mode_unplugged(struct hda_codec *codec)
4757{
Kailang Yang92666d42020-11-19 17:04:21 +08004758 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004759 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004760 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004761 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4762 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4763 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4764 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4765 {}
4766 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004767 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004768 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004769 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4770 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4771 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4772 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004773 {}
4774 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004775 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004776 WRITE_COEF(0x1b, 0x0c0b),
4777 WRITE_COEF(0x45, 0xc429),
4778 UPDATE_COEF(0x35, 0x4000, 0),
4779 WRITE_COEF(0x06, 0x2104),
4780 WRITE_COEF(0x1a, 0x0001),
4781 WRITE_COEF(0x26, 0x0004),
4782 WRITE_COEF(0x32, 0x42a3),
4783 {}
4784 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004785 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004786 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4787 UPDATE_COEF(0x50, 0x2000, 0x2000),
4788 UPDATE_COEF(0x56, 0x0006, 0x0006),
4789 UPDATE_COEF(0x66, 0x0008, 0),
4790 UPDATE_COEF(0x67, 0x2000, 0),
4791 {}
4792 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004793 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004794 UPDATE_COEF(0x19, 0x1300, 0x0300),
4795 {}
4796 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004797 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004798 WRITE_COEF(0x76, 0x000e),
4799 WRITE_COEF(0x6c, 0x2400),
4800 WRITE_COEF(0x18, 0x7308),
4801 WRITE_COEF(0x6b, 0xc429),
4802 {}
4803 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004804 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004805 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4806 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4807 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4808 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4809 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4810 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4811 {}
4812 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004813 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004814 WRITE_COEF(0x15, 0x0d40),
4815 WRITE_COEF(0xb7, 0x802b),
4816 {}
4817 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004818 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004819 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004820 {}
4821 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004822 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004823 UPDATE_COEF(0x4a, 0x0100, 0),
4824 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4825 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4826 UPDATE_COEF(0x4a, 0x0010, 0),
4827 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4828 WRITE_COEF(0x45, 0x5289),
4829 UPDATE_COEF(0x4a, 0x0c00, 0),
4830 {}
4831 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004832
Kailang Yang92666d42020-11-19 17:04:21 +08004833 if (spec->no_internal_mic_pin) {
4834 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4835 return;
4836 }
4837
Takashi Iwai7639a062015-03-03 10:07:24 +01004838 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004839 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004840 alc_process_coef_fw(codec, coef0255);
4841 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02004842 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08004843 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004844 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004845 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004846 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004847 case 0x10ec0234:
4848 case 0x10ec0274:
4849 case 0x10ec0294:
4850 alc_process_coef_fw(codec, coef0274);
4851 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004852 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004853 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004854 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004855 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004856 case 0x10ec0286:
4857 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004858 alc_process_coef_fw(codec, coef0288);
4859 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004860 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004861 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004862 alc_process_coef_fw(codec, coef0288);
4863 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004864 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004865 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004866 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004867 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004868 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004869 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004870 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004871 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004872 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004873 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004874 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004875 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004876 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004877 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004878 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004879 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004880 alc_process_coef_fw(codec, coef0225);
4881 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004882 case 0x10ec0867:
4883 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4884 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004885 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004886 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004887}
4888
4889
4890static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4891 hda_nid_t mic_pin)
4892{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004893 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004894 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4895 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4896 {}
4897 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004898 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004899 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4900 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4901 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4902 {}
4903 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004904 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004905 UPDATE_COEF(0x35, 0, 1<<14),
4906 WRITE_COEF(0x06, 0x2100),
4907 WRITE_COEF(0x1a, 0x0021),
4908 WRITE_COEF(0x26, 0x008c),
4909 {}
4910 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004911 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004912 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004913 UPDATE_COEF(0x50, 0x2000, 0),
4914 UPDATE_COEF(0x56, 0x0006, 0),
4915 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4916 UPDATE_COEF(0x66, 0x0008, 0x0008),
4917 UPDATE_COEF(0x67, 0x2000, 0x2000),
4918 {}
4919 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004920 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004921 WRITE_COEF(0x19, 0xa208),
4922 WRITE_COEF(0x2e, 0xacf0),
4923 {}
4924 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004925 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004926 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4927 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4928 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4929 {}
4930 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004931 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004932 WRITE_COEF(0xb7, 0x802b),
4933 WRITE_COEF(0xb5, 0x1040),
4934 UPDATE_COEF(0xc3, 0, 1<<12),
4935 {}
4936 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004937 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004938 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4939 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4940 UPDATE_COEF(0x63, 3<<14, 0),
4941 {}
4942 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004943 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004944 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4945 UPDATE_COEF(0x4a, 0x0010, 0),
4946 UPDATE_COEF(0x6b, 0xf000, 0),
4947 {}
4948 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004949
Takashi Iwai7639a062015-03-03 10:07:24 +01004950 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004951 case 0x10ec0255:
4952 alc_write_coef_idx(codec, 0x45, 0xc489);
4953 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004954 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004955 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4956 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02004957 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08004958 case 0x10ec0236:
4959 case 0x10ec0256:
4960 alc_write_coef_idx(codec, 0x45, 0xc489);
4961 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4962 alc_process_coef_fw(codec, coef0256);
4963 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4964 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004965 case 0x10ec0234:
4966 case 0x10ec0274:
4967 case 0x10ec0294:
4968 alc_write_coef_idx(codec, 0x45, 0x4689);
4969 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4970 alc_process_coef_fw(codec, coef0274);
4971 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4972 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004973 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004974 case 0x10ec0283:
4975 alc_write_coef_idx(codec, 0x45, 0xc429);
4976 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004977 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004978 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4979 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004980 case 0x10ec0286:
4981 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004982 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004983 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4984 alc_process_coef_fw(codec, coef0288);
4985 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4986 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004987 case 0x10ec0292:
4988 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004989 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004990 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004991 case 0x10ec0293:
4992 /* Set to TRS mode */
4993 alc_write_coef_idx(codec, 0x45, 0xc429);
4994 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004995 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004996 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4997 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004998 case 0x10ec0867:
4999 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05005000 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08005001 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02005002 case 0x10ec0662:
5003 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5004 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5005 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005006 case 0x10ec0668:
5007 alc_write_coef_idx(codec, 0x11, 0x0001);
5008 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02005009 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005010 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5011 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005012 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005013 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005014 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005015 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005016 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005017 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005018 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005019 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5020 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5021 alc_process_coef_fw(codec, coef0225);
5022 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5023 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005024 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005025 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005026}
5027
5028static void alc_headset_mode_default(struct hda_codec *codec)
5029{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005030 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005031 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5032 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5033 UPDATE_COEF(0x49, 3<<8, 0<<8),
5034 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5035 UPDATE_COEF(0x63, 3<<14, 0),
5036 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01005037 {}
5038 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005039 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005040 WRITE_COEF(0x45, 0xc089),
5041 WRITE_COEF(0x45, 0xc489),
5042 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5043 WRITE_COEF(0x49, 0x0049),
5044 {}
5045 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005046 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08005047 WRITE_COEF(0x45, 0xc489),
5048 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5049 WRITE_COEF(0x49, 0x0049),
5050 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5051 WRITE_COEF(0x06, 0x6100),
5052 {}
5053 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005054 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005055 WRITE_COEF(0x06, 0x2100),
5056 WRITE_COEF(0x32, 0x4ea3),
5057 {}
5058 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005059 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005060 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5061 UPDATE_COEF(0x50, 0x2000, 0x2000),
5062 UPDATE_COEF(0x56, 0x0006, 0x0006),
5063 UPDATE_COEF(0x66, 0x0008, 0),
5064 UPDATE_COEF(0x67, 0x2000, 0),
5065 {}
5066 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005067 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005068 WRITE_COEF(0x76, 0x000e),
5069 WRITE_COEF(0x6c, 0x2400),
5070 WRITE_COEF(0x6b, 0xc429),
5071 WRITE_COEF(0x18, 0x7308),
5072 {}
5073 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005074 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005075 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5076 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5077 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5078 {}
5079 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005080 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005081 WRITE_COEF(0x11, 0x0041),
5082 WRITE_COEF(0x15, 0x0d40),
5083 WRITE_COEF(0xb7, 0x802b),
5084 {}
5085 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005086 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005087 WRITE_COEF(0x45, 0x4289),
5088 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5089 UPDATE_COEF(0x6b, 0x0f00, 0),
5090 UPDATE_COEF(0x49, 0x0300, 0x0300),
5091 {}
5092 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005093
Takashi Iwai7639a062015-03-03 10:07:24 +01005094 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08005095 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01005096 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005097 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005098 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005099 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005100 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005101 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01005102 alc_process_coef_fw(codec, coef0225);
5103 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005104 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005105 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005106 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005107 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005108 case 0x10ec0236:
5109 case 0x10ec0256:
5110 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5111 alc_write_coef_idx(codec, 0x45, 0xc089);
5112 msleep(50);
5113 alc_process_coef_fw(codec, coef0256);
5114 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005115 case 0x10ec0234:
5116 case 0x10ec0274:
5117 case 0x10ec0294:
5118 alc_process_coef_fw(codec, coef0274);
5119 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005120 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005121 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005122 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005123 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005124 case 0x10ec0286:
5125 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005126 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08005127 alc_process_coef_fw(codec, coef0288);
5128 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005129 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005130 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005131 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005132 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005133 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005134 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005135 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005136 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005137 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005138 case 0x10ec0867:
5139 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5140 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005141 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005142 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005143}
5144
5145/* Iphone type */
5146static void alc_headset_mode_ctia(struct hda_codec *codec)
5147{
Kailang Yang89542932017-07-17 15:03:43 +08005148 int val;
5149
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005150 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005151 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5152 WRITE_COEF(0x1b, 0x0c2b),
5153 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5154 {}
5155 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005156 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005157 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005158 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005159 {}
5160 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005161 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005162 WRITE_COEF(0x45, 0xd429),
5163 WRITE_COEF(0x1b, 0x0c2b),
5164 WRITE_COEF(0x32, 0x4ea3),
5165 {}
5166 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005167 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005168 UPDATE_COEF(0x50, 0x2000, 0x2000),
5169 UPDATE_COEF(0x56, 0x0006, 0x0006),
5170 UPDATE_COEF(0x66, 0x0008, 0),
5171 UPDATE_COEF(0x67, 0x2000, 0),
5172 {}
5173 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005174 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005175 WRITE_COEF(0x6b, 0xd429),
5176 WRITE_COEF(0x76, 0x0008),
5177 WRITE_COEF(0x18, 0x7388),
5178 {}
5179 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005180 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005181 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5182 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5183 {}
5184 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005185 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005186 WRITE_COEF(0x11, 0x0001),
5187 WRITE_COEF(0x15, 0x0d60),
5188 WRITE_COEF(0xc3, 0x0000),
5189 {}
5190 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005191 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005192 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005193 UPDATE_COEF(0x63, 3<<14, 2<<14),
5194 {}
5195 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005196 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005197 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5198 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005199 {}
5200 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005201
Takashi Iwai7639a062015-03-03 10:07:24 +01005202 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005203 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005204 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005205 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005206 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005207 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005208 case 0x10ec0256:
5209 alc_process_coef_fw(codec, coef0256);
5210 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005211 case 0x10ec0234:
5212 case 0x10ec0274:
5213 case 0x10ec0294:
5214 alc_write_coef_idx(codec, 0x45, 0xd689);
5215 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005216 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005217 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005218 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005219 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005220 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005221 val = alc_read_coef_idx(codec, 0x50);
5222 if (val & (1 << 12)) {
5223 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5224 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5225 msleep(300);
5226 } else {
5227 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5228 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5229 msleep(300);
5230 }
5231 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005232 case 0x10ec0286:
5233 case 0x10ec0288:
5234 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5235 msleep(300);
5236 alc_process_coef_fw(codec, coef0288);
5237 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005238 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005239 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005240 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005241 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005242 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005243 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005244 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005245 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005246 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005247 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005248 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005249 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005250 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005251 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005252 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005253 val = alc_read_coef_idx(codec, 0x45);
5254 if (val & (1 << 9))
5255 alc_process_coef_fw(codec, coef0225_2);
5256 else
5257 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005258 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005259 case 0x10ec0867:
5260 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5261 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005262 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005263 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005264}
5265
5266/* Nokia type */
5267static void alc_headset_mode_omtp(struct hda_codec *codec)
5268{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005269 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005270 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5271 WRITE_COEF(0x1b, 0x0c2b),
5272 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5273 {}
5274 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005275 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005276 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005277 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005278 {}
5279 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005280 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005281 WRITE_COEF(0x45, 0xe429),
5282 WRITE_COEF(0x1b, 0x0c2b),
5283 WRITE_COEF(0x32, 0x4ea3),
5284 {}
5285 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005286 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005287 UPDATE_COEF(0x50, 0x2000, 0x2000),
5288 UPDATE_COEF(0x56, 0x0006, 0x0006),
5289 UPDATE_COEF(0x66, 0x0008, 0),
5290 UPDATE_COEF(0x67, 0x2000, 0),
5291 {}
5292 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005293 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005294 WRITE_COEF(0x6b, 0xe429),
5295 WRITE_COEF(0x76, 0x0008),
5296 WRITE_COEF(0x18, 0x7388),
5297 {}
5298 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005299 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005300 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5301 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5302 {}
5303 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005304 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005305 WRITE_COEF(0x11, 0x0001),
5306 WRITE_COEF(0x15, 0x0d50),
5307 WRITE_COEF(0xc3, 0x0000),
5308 {}
5309 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005310 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005311 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005312 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005313 {}
5314 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005315
Takashi Iwai7639a062015-03-03 10:07:24 +01005316 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005317 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005318 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005319 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005320 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005321 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005322 case 0x10ec0256:
5323 alc_process_coef_fw(codec, coef0256);
5324 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005325 case 0x10ec0234:
5326 case 0x10ec0274:
5327 case 0x10ec0294:
5328 alc_write_coef_idx(codec, 0x45, 0xe689);
5329 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005330 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005331 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005332 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005333 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005334 case 0x10ec0298:
5335 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005336 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5337 msleep(300);
5338 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005339 case 0x10ec0286:
5340 case 0x10ec0288:
5341 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5342 msleep(300);
5343 alc_process_coef_fw(codec, coef0288);
5344 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005345 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005346 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005347 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005348 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005349 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005350 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005351 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005352 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005353 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005354 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005355 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005356 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005357 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005358 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005359 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005360 alc_process_coef_fw(codec, coef0225);
5361 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005362 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005363 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005364}
5365
5366static void alc_determine_headset_type(struct hda_codec *codec)
5367{
5368 int val;
5369 bool is_ctia = false;
5370 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005371 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005372 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5373 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5374 conteol) */
5375 {}
5376 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005377 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005378 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5379 {}
5380 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005381 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005382 UPDATE_COEF(0x50, 0x2000, 0x2000),
5383 UPDATE_COEF(0x56, 0x0006, 0x0006),
5384 UPDATE_COEF(0x66, 0x0008, 0),
5385 UPDATE_COEF(0x67, 0x2000, 0),
5386 UPDATE_COEF(0x19, 0x1300, 0x1300),
5387 {}
5388 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005389 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005390 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5391 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5392 {}
5393 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005394 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005395 WRITE_COEF(0x11, 0x0001),
5396 WRITE_COEF(0xb7, 0x802b),
5397 WRITE_COEF(0x15, 0x0d60),
5398 WRITE_COEF(0xc3, 0x0c00),
5399 {}
5400 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005401 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005402 UPDATE_COEF(0x4a, 0x0010, 0),
5403 UPDATE_COEF(0x4a, 0x8000, 0),
5404 WRITE_COEF(0x45, 0xd289),
5405 UPDATE_COEF(0x49, 0x0300, 0x0300),
5406 {}
5407 };
David Henningsson73bdd592013-04-15 15:44:14 +02005408
Kailang Yang92666d42020-11-19 17:04:21 +08005409 if (spec->no_internal_mic_pin) {
5410 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5411 return;
5412 }
5413
Takashi Iwai7639a062015-03-03 10:07:24 +01005414 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005415 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005416 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005417 msleep(300);
5418 val = alc_read_coef_idx(codec, 0x46);
5419 is_ctia = (val & 0x0070) == 0x0070;
5420 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005421 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005422 case 0x10ec0236:
5423 case 0x10ec0256:
5424 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5425 alc_write_coef_idx(codec, 0x06, 0x6104);
5426 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5427
5428 snd_hda_codec_write(codec, 0x21, 0,
5429 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5430 msleep(80);
5431 snd_hda_codec_write(codec, 0x21, 0,
5432 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5433
5434 alc_process_coef_fw(codec, coef0255);
5435 msleep(300);
5436 val = alc_read_coef_idx(codec, 0x46);
5437 is_ctia = (val & 0x0070) == 0x0070;
5438
5439 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5440 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5441
5442 snd_hda_codec_write(codec, 0x21, 0,
5443 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5444 msleep(80);
5445 snd_hda_codec_write(codec, 0x21, 0,
5446 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5447 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005448 case 0x10ec0234:
5449 case 0x10ec0274:
5450 case 0x10ec0294:
5451 alc_process_coef_fw(codec, coef0274);
Hui Wangfebf22562021-03-20 17:15:41 +08005452 msleep(850);
Kailang Yang71683c32017-06-20 16:33:50 +08005453 val = alc_read_coef_idx(codec, 0x46);
5454 is_ctia = (val & 0x00f0) == 0x00f0;
5455 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005456 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005457 case 0x10ec0283:
5458 alc_write_coef_idx(codec, 0x45, 0xd029);
5459 msleep(300);
5460 val = alc_read_coef_idx(codec, 0x46);
5461 is_ctia = (val & 0x0070) == 0x0070;
5462 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005463 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005464 snd_hda_codec_write(codec, 0x21, 0,
5465 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5466 msleep(100);
5467 snd_hda_codec_write(codec, 0x21, 0,
5468 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5469 msleep(200);
5470
5471 val = alc_read_coef_idx(codec, 0x50);
5472 if (val & (1 << 12)) {
5473 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5474 alc_process_coef_fw(codec, coef0288);
5475 msleep(350);
5476 val = alc_read_coef_idx(codec, 0x50);
5477 is_ctia = (val & 0x0070) == 0x0070;
5478 } else {
5479 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5480 alc_process_coef_fw(codec, coef0288);
5481 msleep(350);
5482 val = alc_read_coef_idx(codec, 0x50);
5483 is_ctia = (val & 0x0070) == 0x0070;
5484 }
5485 alc_process_coef_fw(codec, coef0298);
5486 snd_hda_codec_write(codec, 0x21, 0,
5487 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5488 msleep(75);
5489 snd_hda_codec_write(codec, 0x21, 0,
5490 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5491 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005492 case 0x10ec0286:
5493 case 0x10ec0288:
5494 alc_process_coef_fw(codec, coef0288);
5495 msleep(350);
5496 val = alc_read_coef_idx(codec, 0x50);
5497 is_ctia = (val & 0x0070) == 0x0070;
5498 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005499 case 0x10ec0292:
5500 alc_write_coef_idx(codec, 0x6b, 0xd429);
5501 msleep(300);
5502 val = alc_read_coef_idx(codec, 0x6c);
5503 is_ctia = (val & 0x001c) == 0x001c;
5504 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005505 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005506 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005507 msleep(300);
5508 val = alc_read_coef_idx(codec, 0x46);
5509 is_ctia = (val & 0x0070) == 0x0070;
5510 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005511 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005512 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005513 msleep(300);
5514 val = alc_read_coef_idx(codec, 0xbe);
5515 is_ctia = (val & 0x1c02) == 0x1c02;
5516 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005517 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005518 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005519 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005520 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005521 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005522 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005523 snd_hda_codec_write(codec, 0x21, 0,
5524 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5525 msleep(80);
5526 snd_hda_codec_write(codec, 0x21, 0,
5527 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5528
Kailang Yang5a367672017-07-21 15:23:53 +08005529 alc_process_coef_fw(codec, alc225_pre_hsmode);
5530 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5531 val = alc_read_coef_idx(codec, 0x45);
5532 if (val & (1 << 9)) {
5533 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5534 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5535 msleep(800);
5536 val = alc_read_coef_idx(codec, 0x46);
5537 is_ctia = (val & 0x00f0) == 0x00f0;
5538 } else {
5539 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5540 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5541 msleep(800);
5542 val = alc_read_coef_idx(codec, 0x46);
5543 is_ctia = (val & 0x00f0) == 0x00f0;
5544 }
5545 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5546 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5547 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005548
5549 snd_hda_codec_write(codec, 0x21, 0,
5550 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5551 msleep(80);
5552 snd_hda_codec_write(codec, 0x21, 0,
5553 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005554 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005555 case 0x10ec0867:
5556 is_ctia = true;
5557 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005558 }
5559
Takashi Iwai4e76a882014-02-25 12:21:03 +01005560 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005561 is_ctia ? "yes" : "no");
5562 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5563}
5564
5565static void alc_update_headset_mode(struct hda_codec *codec)
5566{
5567 struct alc_spec *spec = codec->spec;
5568
5569 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005570 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005571
5572 int new_headset_mode;
5573
5574 if (!snd_hda_jack_detect(codec, hp_pin))
5575 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5576 else if (mux_pin == spec->headset_mic_pin)
5577 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5578 else if (mux_pin == spec->headphone_mic_pin)
5579 new_headset_mode = ALC_HEADSET_MODE_MIC;
5580 else
5581 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5582
David Henningsson5959a6b2013-11-12 11:10:57 +01005583 if (new_headset_mode == spec->current_headset_mode) {
5584 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005585 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005586 }
David Henningsson73bdd592013-04-15 15:44:14 +02005587
5588 switch (new_headset_mode) {
5589 case ALC_HEADSET_MODE_UNPLUGGED:
5590 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005591 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5592 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005593 spec->gen.hp_jack_present = false;
5594 break;
5595 case ALC_HEADSET_MODE_HEADSET:
5596 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5597 alc_determine_headset_type(codec);
5598 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5599 alc_headset_mode_ctia(codec);
5600 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5601 alc_headset_mode_omtp(codec);
5602 spec->gen.hp_jack_present = true;
5603 break;
5604 case ALC_HEADSET_MODE_MIC:
5605 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5606 spec->gen.hp_jack_present = false;
5607 break;
5608 case ALC_HEADSET_MODE_HEADPHONE:
5609 alc_headset_mode_default(codec);
5610 spec->gen.hp_jack_present = true;
5611 break;
5612 }
5613 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5614 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5615 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005616 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005617 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5618 PIN_VREFHIZ);
5619 }
5620 spec->current_headset_mode = new_headset_mode;
5621
5622 snd_hda_gen_update_outputs(codec);
5623}
5624
5625static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005626 struct snd_kcontrol *kcontrol,
5627 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005628{
5629 alc_update_headset_mode(codec);
5630}
5631
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005632static void alc_update_headset_jack_cb(struct hda_codec *codec,
5633 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005634{
David Henningsson73bdd592013-04-15 15:44:14 +02005635 snd_hda_gen_hp_automute(codec, jack);
Hui Wange54f30b2021-03-20 17:15:42 +08005636 alc_update_headset_mode(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005637}
5638
5639static void alc_probe_headset_mode(struct hda_codec *codec)
5640{
5641 int i;
5642 struct alc_spec *spec = codec->spec;
5643 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5644
5645 /* Find mic pins */
5646 for (i = 0; i < cfg->num_inputs; i++) {
5647 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5648 spec->headset_mic_pin = cfg->inputs[i].pin;
5649 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5650 spec->headphone_mic_pin = cfg->inputs[i].pin;
5651 }
5652
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005653 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005654 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5655 spec->gen.automute_hook = alc_update_headset_mode;
5656 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5657}
5658
5659static void alc_fixup_headset_mode(struct hda_codec *codec,
5660 const struct hda_fixup *fix, int action)
5661{
5662 struct alc_spec *spec = codec->spec;
5663
5664 switch (action) {
5665 case HDA_FIXUP_ACT_PRE_PROBE:
5666 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5667 break;
5668 case HDA_FIXUP_ACT_PROBE:
5669 alc_probe_headset_mode(codec);
5670 break;
5671 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005672 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5673 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5674 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5675 }
David Henningsson73bdd592013-04-15 15:44:14 +02005676 alc_update_headset_mode(codec);
5677 break;
5678 }
5679}
5680
5681static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5682 const struct hda_fixup *fix, int action)
5683{
5684 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5685 struct alc_spec *spec = codec->spec;
5686 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5687 }
5688 else
5689 alc_fixup_headset_mode(codec, fix, action);
5690}
5691
Kailang Yang31278992014-03-03 15:27:22 +08005692static void alc255_set_default_jack_type(struct hda_codec *codec)
5693{
5694 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005695 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005696 WRITE_COEF(0x1b, 0x880b),
5697 WRITE_COEF(0x45, 0xd089),
5698 WRITE_COEF(0x1b, 0x080b),
5699 WRITE_COEF(0x46, 0x0004),
5700 WRITE_COEF(0x1b, 0x0c0b),
5701 {}
5702 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005703 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005704 WRITE_COEF(0x1b, 0x884b),
5705 WRITE_COEF(0x45, 0xd089),
5706 WRITE_COEF(0x1b, 0x084b),
5707 WRITE_COEF(0x46, 0x0004),
5708 WRITE_COEF(0x1b, 0x0c4b),
5709 {}
5710 };
5711 switch (codec->core.vendor_id) {
5712 case 0x10ec0255:
5713 alc_process_coef_fw(codec, alc255fw);
5714 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005715 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005716 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005717 case 0x10ec0256:
5718 alc_process_coef_fw(codec, alc256fw);
5719 break;
5720 }
Kailang Yang31278992014-03-03 15:27:22 +08005721 msleep(30);
5722}
5723
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005724static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5725 const struct hda_fixup *fix, int action)
5726{
5727 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005728 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005729 }
5730 alc_fixup_headset_mode(codec, fix, action);
5731}
5732
Kailang Yang31278992014-03-03 15:27:22 +08005733static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5734 const struct hda_fixup *fix, int action)
5735{
5736 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5737 struct alc_spec *spec = codec->spec;
5738 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5739 alc255_set_default_jack_type(codec);
5740 }
5741 else
5742 alc_fixup_headset_mode(codec, fix, action);
5743}
5744
Kailang Yange1e62b92015-04-08 16:01:22 +08005745static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5746 struct hda_jack_callback *jack)
5747{
5748 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005749
5750 alc_update_headset_jack_cb(codec, jack);
5751 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005752 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005753}
5754
5755static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5756 const struct hda_fixup *fix, int action)
5757{
5758 alc_fixup_headset_mode(codec, fix, action);
5759 if (action == HDA_FIXUP_ACT_PROBE) {
5760 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005761 /* toggled via hp_automute_hook */
5762 spec->gpio_mask |= 0x40;
5763 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005764 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5765 }
5766}
5767
Hui Wang493a52a2014-01-14 14:07:36 +08005768static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5769 const struct hda_fixup *fix, int action)
5770{
5771 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5772 struct alc_spec *spec = codec->spec;
5773 spec->gen.auto_mute_via_amp = 1;
5774 }
5775}
5776
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005777static void alc_fixup_no_shutup(struct hda_codec *codec,
5778 const struct hda_fixup *fix, int action)
5779{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005780 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005781 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005782 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005783 }
5784}
5785
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005786static void alc_fixup_disable_aamix(struct hda_codec *codec,
5787 const struct hda_fixup *fix, int action)
5788{
5789 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5790 struct alc_spec *spec = codec->spec;
5791 /* Disable AA-loopback as it causes white noise */
5792 spec->gen.mixer_nid = 0;
5793 }
5794}
5795
Takashi Iwai7f57d802015-09-24 17:36:51 +02005796/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5797static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5798 const struct hda_fixup *fix, int action)
5799{
5800 static const struct hda_pintbl pincfgs[] = {
5801 { 0x16, 0x21211010 }, /* dock headphone */
5802 { 0x19, 0x21a11010 }, /* dock mic */
5803 { }
5804 };
5805 struct alc_spec *spec = codec->spec;
5806
5807 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5808 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5809 codec->power_save_node = 0; /* avoid click noises */
5810 snd_hda_apply_pincfgs(codec, pincfgs);
5811 }
5812}
5813
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005814static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5815 const struct hda_fixup *fix, int action)
5816{
5817 static const struct hda_pintbl pincfgs[] = {
5818 { 0x17, 0x21211010 }, /* dock headphone */
5819 { 0x19, 0x21a11010 }, /* dock mic */
5820 { }
5821 };
5822 struct alc_spec *spec = codec->spec;
5823
5824 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5825 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005826 snd_hda_apply_pincfgs(codec, pincfgs);
5827 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005828 /* Enable DOCK device */
5829 snd_hda_codec_write(codec, 0x17, 0,
5830 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5831 /* Enable DOCK device */
5832 snd_hda_codec_write(codec, 0x19, 0,
5833 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005834 }
5835}
5836
Takashi Iwai399c01a2020-05-26 08:24:06 +02005837static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5838 const struct hda_fixup *fix, int action)
5839{
5840 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5841 * the speaker output becomes too low by some reason on Thinkpads with
5842 * ALC298 codec
5843 */
5844 static const hda_nid_t preferred_pairs[] = {
5845 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5846 0
5847 };
5848 struct alc_spec *spec = codec->spec;
5849
5850 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5851 spec->gen.preferred_dacs = preferred_pairs;
5852}
5853
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02005854static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5855 const struct hda_fixup *fix, int action)
5856{
5857 static const hda_nid_t preferred_pairs[] = {
5858 0x17, 0x02, 0x21, 0x03, 0
5859 };
5860 struct alc_spec *spec = codec->spec;
5861
5862 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5863 spec->gen.preferred_dacs = preferred_pairs;
5864}
5865
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005866static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005867{
5868 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005869 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005870
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005871 /* Prevent pop noises when headphones are plugged in */
5872 snd_hda_codec_write(codec, hp_pin, 0,
5873 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5874 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005875}
5876
5877static void alc_fixup_dell_xps13(struct hda_codec *codec,
5878 const struct hda_fixup *fix, int action)
5879{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005880 struct alc_spec *spec = codec->spec;
5881 struct hda_input_mux *imux = &spec->gen.input_mux;
5882 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005883
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005884 switch (action) {
5885 case HDA_FIXUP_ACT_PRE_PROBE:
5886 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5887 * it causes a click noise at start up
5888 */
5889 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005890 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005891 break;
5892 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005893 /* Make the internal mic the default input source. */
5894 for (i = 0; i < imux->num_items; i++) {
5895 if (spec->gen.imux_pins[i] == 0x12) {
5896 spec->gen.cur_mux[0] = i;
5897 break;
5898 }
5899 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005900 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005901 }
5902}
5903
David Henningsson1f8b46c2015-05-12 14:38:15 +02005904static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5905 const struct hda_fixup *fix, int action)
5906{
5907 struct alc_spec *spec = codec->spec;
5908
5909 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5910 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5911 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005912
5913 /* Disable boost for mic-in permanently. (This code is only called
5914 from quirks that guarantee that the headphone is at NID 0x1b.) */
5915 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5916 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005917 } else
5918 alc_fixup_headset_mode(codec, fix, action);
5919}
5920
David Henningsson73bdd592013-04-15 15:44:14 +02005921static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5922 const struct hda_fixup *fix, int action)
5923{
5924 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005925 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005926 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005927 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5928 }
5929 alc_fixup_headset_mode(codec, fix, action);
5930}
5931
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005932/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5933static int find_ext_mic_pin(struct hda_codec *codec)
5934{
5935 struct alc_spec *spec = codec->spec;
5936 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5937 hda_nid_t nid;
5938 unsigned int defcfg;
5939 int i;
5940
5941 for (i = 0; i < cfg->num_inputs; i++) {
5942 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5943 continue;
5944 nid = cfg->inputs[i].pin;
5945 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5946 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5947 continue;
5948 return nid;
5949 }
5950
5951 return 0;
5952}
5953
Dylan Reid08a978d2012-11-18 22:56:40 -08005954static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005955 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005956 int action)
5957{
5958 struct alc_spec *spec = codec->spec;
5959
Takashi Iwai0db75792013-01-23 13:57:20 +01005960 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005961 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005962 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005963
5964 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005965 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005966 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005967 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005968}
David Henningsson693b6132012-06-22 19:12:10 +02005969
David Henningsson3e0d6112013-04-22 14:30:14 +02005970static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5971 const struct hda_fixup *fix,
5972 int action)
5973{
5974 struct alc_spec *spec = codec->spec;
5975 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5976 int i;
5977
5978 /* The mic boosts on level 2 and 3 are too noisy
5979 on the internal mic input.
5980 Therefore limit the boost to 0 or 1. */
5981
5982 if (action != HDA_FIXUP_ACT_PROBE)
5983 return;
5984
5985 for (i = 0; i < cfg->num_inputs; i++) {
5986 hda_nid_t nid = cfg->inputs[i].pin;
5987 unsigned int defcfg;
5988 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5989 continue;
5990 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5991 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5992 continue;
5993
5994 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5995 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5996 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5997 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5998 (0 << AC_AMPCAP_MUTE_SHIFT));
5999 }
6000}
6001
Kailang Yangcd217a62013-08-22 10:15:24 +02006002static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02006003 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02006004{
6005 struct alc_spec *spec = codec->spec;
6006 int vref;
6007
6008 msleep(200);
6009 snd_hda_gen_hp_automute(codec, jack);
6010
6011 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6012
6013 msleep(600);
6014 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6015 vref);
6016}
6017
Kailang Yangcd217a62013-08-22 10:15:24 +02006018static void alc283_fixup_chromebook(struct hda_codec *codec,
6019 const struct hda_fixup *fix, int action)
6020{
6021 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02006022
6023 switch (action) {
6024 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08006025 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01006026 /* Disable AA-loopback as it causes white noise */
6027 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08006028 break;
6029 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08006030 /* MIC2-VREF control */
6031 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02006032 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08006033 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02006034 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08006035 break;
6036 }
6037}
6038
6039static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6040 const struct hda_fixup *fix, int action)
6041{
6042 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08006043
6044 switch (action) {
6045 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02006046 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6047 break;
6048 case HDA_FIXUP_ACT_INIT:
6049 /* MIC2-VREF control */
6050 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02006051 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02006052 break;
6053 }
6054}
6055
Takashi Iwai7bba2152013-09-06 15:45:38 +02006056/* mute tablet speaker pin (0x14) via dock plugging in addition */
6057static void asus_tx300_automute(struct hda_codec *codec)
6058{
6059 struct alc_spec *spec = codec->spec;
6060 snd_hda_gen_update_outputs(codec);
6061 if (snd_hda_jack_detect(codec, 0x1b))
6062 spec->gen.mute_bits |= (1ULL << 0x14);
6063}
6064
6065static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6066 const struct hda_fixup *fix, int action)
6067{
6068 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02006069 static const struct hda_pintbl dock_pins[] = {
6070 { 0x1b, 0x21114000 }, /* dock speaker pin */
6071 {}
6072 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02006073
6074 switch (action) {
6075 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02006076 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02006077 /* TX300 needs to set up GPIO2 for the speaker amp */
6078 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02006079 snd_hda_apply_pincfgs(codec, dock_pins);
6080 spec->gen.auto_mute_via_amp = 1;
6081 spec->gen.automute_hook = asus_tx300_automute;
6082 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006083 snd_hda_gen_hp_automute);
6084 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02006085 case HDA_FIXUP_ACT_PROBE:
6086 spec->init_amp = ALC_INIT_DEFAULT;
6087 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02006088 case HDA_FIXUP_ACT_BUILD:
6089 /* this is a bit tricky; give more sane names for the main
6090 * (tablet) speaker and the dock speaker, respectively
6091 */
Takashi Iwai56798e62017-04-11 08:10:52 +02006092 rename_ctl(codec, "Speaker Playback Switch",
6093 "Dock Speaker Playback Switch");
6094 rename_ctl(codec, "Bass Speaker Playback Switch",
6095 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02006096 break;
6097 }
6098}
6099
David Henningsson338cae52013-10-07 10:39:59 +02006100static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6101 const struct hda_fixup *fix, int action)
6102{
David Henningsson0f4881d2013-12-20 16:08:13 +01006103 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6104 /* DAC node 0x03 is giving mono output. We therefore want to
6105 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6106 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006107 static const hda_nid_t conn1[] = { 0x0c };
6108 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6109 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01006110 }
David Henningsson338cae52013-10-07 10:39:59 +02006111}
6112
Hui Wangdd9aa332016-08-01 10:20:32 +08006113static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6114 const struct hda_fixup *fix, int action)
6115{
6116 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6117 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6118 we can't adjust the speaker's volume since this node does not has
6119 Amp-out capability. we change the speaker's route to:
6120 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6121 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6122 speaker's volume now. */
6123
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006124 static const hda_nid_t conn1[] = { 0x0c };
6125 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08006126 }
6127}
6128
Takashi Iwaie312a862018-03-06 12:14:17 +01006129/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6130static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6131 const struct hda_fixup *fix, int action)
6132{
6133 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006134 static const hda_nid_t conn[] = { 0x02, 0x03 };
6135 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01006136 }
6137}
6138
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006139/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6140static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6141 const struct hda_fixup *fix, int action)
6142{
6143 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006144 static const hda_nid_t conn[] = { 0x02 };
6145 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006146 }
6147}
6148
Keith Packard98973f22015-07-15 12:14:39 -07006149/* Hook to update amp GPIO4 for automute */
6150static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6151 struct hda_jack_callback *jack)
6152{
6153 struct alc_spec *spec = codec->spec;
6154
6155 snd_hda_gen_hp_automute(codec, jack);
6156 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08006157 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6158 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07006159}
6160
6161/* Manage GPIOs for HP EliteBook Folio 9480m.
6162 *
6163 * GPIO4 is the headphone amplifier power control
6164 * GPIO3 is the audio output mute indicator LED
6165 */
6166
6167static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6168 const struct hda_fixup *fix,
6169 int action)
6170{
6171 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07006172
Takashi Iwai01e4a272018-06-19 22:47:30 +02006173 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07006174 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02006175 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6176 spec->gpio_mask |= 0x10;
6177 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07006178 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07006179 }
6180}
6181
Takashi Iwaiae065f12018-06-19 23:00:03 +02006182static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6183 const struct hda_fixup *fix,
6184 int action)
6185{
6186 struct alc_spec *spec = codec->spec;
6187
6188 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6189 spec->gpio_mask |= 0x04;
6190 spec->gpio_dir |= 0x04;
6191 /* set data bit low */
6192 }
6193}
6194
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006195/* Quirk for Thinkpad X1 7th and 8th Gen
6196 * The following fixed routing needed
6197 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6198 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6199 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6200 */
6201static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6202 const struct hda_fixup *fix, int action)
6203{
6204 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6205 static const hda_nid_t preferred_pairs[] = {
6206 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6207 };
6208 struct alc_spec *spec = codec->spec;
6209
6210 switch (action) {
6211 case HDA_FIXUP_ACT_PRE_PROBE:
6212 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6213 spec->gen.preferred_dacs = preferred_pairs;
6214 break;
6215 case HDA_FIXUP_ACT_BUILD:
6216 /* The generic parser creates somewhat unintuitive volume ctls
6217 * with the fixed routing above, and the shared DAC2 may be
6218 * confusing for PA.
6219 * Rename those to unique names so that PA doesn't touch them
6220 * and use only Master volume.
6221 */
6222 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6223 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6224 break;
6225 }
6226}
6227
Kailang Yangca169cc2017-04-25 16:17:40 +08006228static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6229 const struct hda_fixup *fix,
6230 int action)
6231{
6232 alc_fixup_dual_codecs(codec, fix, action);
6233 switch (action) {
6234 case HDA_FIXUP_ACT_PRE_PROBE:
6235 /* override card longname to provide a unique UCM profile */
6236 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6237 break;
6238 case HDA_FIXUP_ACT_BUILD:
6239 /* rename Capture controls depending on the codec */
6240 rename_ctl(codec, "Capture Volume",
6241 codec->addr == 0 ?
6242 "Rear-Panel Capture Volume" :
6243 "Front-Panel Capture Volume");
6244 rename_ctl(codec, "Capture Switch",
6245 codec->addr == 0 ?
6246 "Rear-Panel Capture Switch" :
6247 "Front-Panel Capture Switch");
6248 break;
6249 }
6250}
6251
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006252static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6253 const struct hda_fixup *fix, int action)
6254{
6255 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6256 return;
6257
6258 codec->power_save_node = 1;
6259}
6260
Kailang Yang92266652017-12-14 15:28:58 +08006261/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6262static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6263 const struct hda_fixup *fix, int action)
6264{
6265 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006266 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08006267 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6268 0
6269 };
6270
6271 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6272 return;
6273
6274 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08006275 spec->gen.auto_mute_via_amp = 1;
6276 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08006277}
6278
Takashi Iwaic84bfed2020-11-27 15:11:04 +01006279/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6280static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6281 const struct hda_fixup *fix, int action)
6282{
6283 static const hda_nid_t preferred_pairs[] = {
6284 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6285 };
6286 struct alc_spec *spec = codec->spec;
6287
6288 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6289 spec->gen.preferred_dacs = preferred_pairs;
6290 spec->gen.obey_preferred_dacs = 1;
6291 }
6292}
6293
Hui Wangc4cfcf62018-11-26 14:17:16 +08006294/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6295static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6296 const struct hda_fixup *fix, int action)
6297{
6298 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6299 return;
6300
6301 snd_hda_override_wcaps(codec, 0x03, 0);
6302}
6303
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006304static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6305{
6306 switch (codec->core.vendor_id) {
6307 case 0x10ec0274:
6308 case 0x10ec0294:
6309 case 0x10ec0225:
6310 case 0x10ec0295:
6311 case 0x10ec0299:
6312 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6313 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6314 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02006315 case 0x10ec0230:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006316 case 0x10ec0235:
6317 case 0x10ec0236:
6318 case 0x10ec0255:
6319 case 0x10ec0256:
6320 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6321 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6322 break;
6323 }
6324}
6325
Kailang Yang8983eb62019-04-03 15:31:49 +08006326static void alc295_fixup_chromebook(struct hda_codec *codec,
6327 const struct hda_fixup *fix, int action)
6328{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006329 struct alc_spec *spec = codec->spec;
6330
Kailang Yang8983eb62019-04-03 15:31:49 +08006331 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006332 case HDA_FIXUP_ACT_PRE_PROBE:
6333 spec->ultra_low_power = true;
6334 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006335 case HDA_FIXUP_ACT_INIT:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006336 alc_combo_jack_hp_jd_restart(codec);
Kailang Yang8983eb62019-04-03 15:31:49 +08006337 break;
6338 }
6339}
6340
Kailang Yangd1dd4212019-01-09 17:05:24 +08006341static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6342 const struct hda_fixup *fix, int action)
6343{
6344 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6345 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6346}
6347
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006348
6349static void alc294_gx502_toggle_output(struct hda_codec *codec,
6350 struct hda_jack_callback *cb)
6351{
6352 /* The Windows driver sets the codec up in a very different way where
6353 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6354 */
6355 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6356 alc_write_coef_idx(codec, 0x10, 0x8a20);
6357 else
6358 alc_write_coef_idx(codec, 0x10, 0x0a20);
6359}
6360
6361static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6362 const struct hda_fixup *fix, int action)
6363{
6364 /* Pin 0x21: headphones/headset mic */
6365 if (!is_jack_detectable(codec, 0x21))
6366 return;
6367
6368 switch (action) {
6369 case HDA_FIXUP_ACT_PRE_PROBE:
6370 snd_hda_jack_detect_enable_callback(codec, 0x21,
6371 alc294_gx502_toggle_output);
6372 break;
6373 case HDA_FIXUP_ACT_INIT:
6374 /* Make sure to start in a correct state, i.e. if
6375 * headphones have been plugged in before powering up the system
6376 */
6377 alc294_gx502_toggle_output(codec, NULL);
6378 break;
6379 }
6380}
6381
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006382static void alc294_gu502_toggle_output(struct hda_codec *codec,
6383 struct hda_jack_callback *cb)
6384{
6385 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6386 * responsible from changes between speakers and headphones
6387 */
6388 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6389 alc_write_coef_idx(codec, 0x10, 0x8420);
6390 else
6391 alc_write_coef_idx(codec, 0x10, 0x0a20);
6392}
6393
6394static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6395 const struct hda_fixup *fix, int action)
6396{
6397 if (!is_jack_detectable(codec, 0x21))
6398 return;
6399
6400 switch (action) {
6401 case HDA_FIXUP_ACT_PRE_PROBE:
6402 snd_hda_jack_detect_enable_callback(codec, 0x21,
6403 alc294_gu502_toggle_output);
6404 break;
6405 case HDA_FIXUP_ACT_INIT:
6406 alc294_gu502_toggle_output(codec, NULL);
6407 break;
6408 }
6409}
6410
Kailang Yang56496252020-07-29 15:09:27 +08006411static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6412 const struct hda_fixup *fix, int action)
6413{
6414 if (action != HDA_FIXUP_ACT_INIT)
6415 return;
6416
6417 msleep(100);
6418 alc_write_coef_idx(codec, 0x65, 0x0);
6419}
6420
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006421static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6422 const struct hda_fixup *fix, int action)
6423{
6424 switch (action) {
6425 case HDA_FIXUP_ACT_INIT:
6426 alc_combo_jack_hp_jd_restart(codec);
6427 break;
6428 }
6429}
6430
Kailang Yang92666d42020-11-19 17:04:21 +08006431static void alc_fixup_no_int_mic(struct hda_codec *codec,
6432 const struct hda_fixup *fix, int action)
6433{
6434 struct alc_spec *spec = codec->spec;
6435
6436 switch (action) {
6437 case HDA_FIXUP_ACT_PRE_PROBE:
6438 /* Mic RING SLEEVE swap for combo jack */
6439 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6440 spec->no_internal_mic_pin = true;
6441 break;
6442 case HDA_FIXUP_ACT_INIT:
6443 alc_combo_jack_hp_jd_restart(codec);
6444 break;
6445 }
6446}
6447
Davide Baldod94befb2021-10-15 09:21:22 +02006448/* GPIO1 = amplifier on/off
6449 * GPIO3 = mic mute LED
6450 */
6451static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6452 const struct hda_fixup *fix, int action)
6453{
6454 static const hda_nid_t conn[] = { 0x02 };
6455
6456 struct alc_spec *spec = codec->spec;
6457 static const struct hda_pintbl pincfgs[] = {
6458 { 0x14, 0x90170110 }, /* front/high speakers */
6459 { 0x17, 0x90170130 }, /* back/bass speakers */
6460 { }
6461 };
6462
6463 //enable micmute led
6464 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6465
6466 switch (action) {
6467 case HDA_FIXUP_ACT_PRE_PROBE:
6468 spec->micmute_led_polarity = 1;
6469 /* needed for amp of back speakers */
6470 spec->gpio_mask |= 0x01;
6471 spec->gpio_dir |= 0x01;
6472 snd_hda_apply_pincfgs(codec, pincfgs);
6473 /* share DAC to have unified volume control */
6474 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6475 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6476 break;
6477 case HDA_FIXUP_ACT_INIT:
6478 /* need to toggle GPIO to enable the amp of back speakers */
6479 alc_update_gpio_data(codec, 0x01, true);
6480 msleep(100);
6481 alc_update_gpio_data(codec, 0x01, false);
6482 break;
6483 }
6484}
6485
Elia Devito434591b2021-06-19 22:41:04 +02006486static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6487 const struct hda_fixup *fix, int action)
6488{
6489 static const hda_nid_t conn[] = { 0x02 };
6490 static const struct hda_pintbl pincfgs[] = {
6491 { 0x14, 0x90170110 }, /* rear speaker */
6492 { }
6493 };
6494
6495 switch (action) {
6496 case HDA_FIXUP_ACT_PRE_PROBE:
6497 snd_hda_apply_pincfgs(codec, pincfgs);
6498 /* force front speaker to DAC1 */
6499 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6500 break;
6501 }
6502}
6503
Takashi Iwaib317b032014-01-08 11:44:21 +01006504/* for hda_fixup_thinkpad_acpi() */
6505#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006506
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006507static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6508 const struct hda_fixup *fix, int action)
6509{
6510 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6511 hda_fixup_thinkpad_acpi(codec, fix, action);
6512}
6513
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07006514/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6515static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6516 const struct hda_fixup *fix,
6517 int action)
6518{
6519 struct alc_spec *spec = codec->spec;
6520
6521 switch (action) {
6522 case HDA_FIXUP_ACT_PRE_PROBE:
6523 spec->gen.suppress_auto_mute = 1;
6524 break;
6525 }
6526}
6527
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006528/* for alc295_fixup_hp_top_speakers */
6529#include "hp_x360_helper.c"
6530
Takashi Iwai26928ca2021-04-16 10:12:11 +02006531/* for alc285_fixup_ideapad_s740_coef() */
6532#include "ideapad_s740_helper.c"
6533
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006534static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec,
6535 const struct hda_fixup *fix,
6536 int action)
6537{
6538 /*
6539 * A certain other OS sets these coeffs to different values. On at least one TongFang
6540 * barebone these settings might survive even a cold reboot. So to restore a clean slate the
6541 * values are explicitly reset to default here. Without this, the external microphone is
6542 * always in a plugged-in state, while the internal microphone is always in an unplugged
6543 * state, breaking the ability to use the internal microphone.
6544 */
6545 alc_write_coef_idx(codec, 0x24, 0x0000);
6546 alc_write_coef_idx(codec, 0x26, 0x0000);
6547 alc_write_coef_idx(codec, 0x29, 0x3000);
6548 alc_write_coef_idx(codec, 0x37, 0xfe05);
6549 alc_write_coef_idx(codec, 0x45, 0x5089);
6550}
6551
Takashi Iwai1d045db2011-07-07 18:23:21 +02006552enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006553 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006554 ALC269_FIXUP_SONY_VAIO,
6555 ALC275_FIXUP_SONY_VAIO_GPIO2,
6556 ALC269_FIXUP_DELL_M101Z,
6557 ALC269_FIXUP_SKU_IGNORE,
6558 ALC269_FIXUP_ASUS_G73JW,
6559 ALC269_FIXUP_LENOVO_EAPD,
6560 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006561 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006562 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006563 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006564 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006565 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006566 ALC269_FIXUP_QUANTA_MUTE,
6567 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006568 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006569 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006570 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006571 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006572 ALC269_FIXUP_AMIC,
6573 ALC269_FIXUP_DMIC,
6574 ALC269VB_FIXUP_AMIC,
6575 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006576 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006577 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006578 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006579 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006580 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006581 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6582 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006583 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006584 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006585 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006586 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006587 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006588 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006589 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6590 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006591 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006592 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006593 ALC269_FIXUP_HEADSET_MODE,
6594 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006595 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006596 ALC269_FIXUP_ASUS_X101_FUNC,
6597 ALC269_FIXUP_ASUS_X101_VERB,
6598 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006599 ALC271_FIXUP_AMIC_MIC2,
6600 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006601 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006602 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006603 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006604 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006605 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006606 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006607 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006608 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006609 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006610 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006611 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006612 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006613 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6614 ALC290_FIXUP_SUBWOOFER,
6615 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006616 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006617 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006618 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006619 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006620 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006621 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006622 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006623 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006624 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006625 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006626 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006627 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006628 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006629 ALC282_FIXUP_ASPIRE_V5_PINS,
Takashi Iwaic8426b22021-04-07 11:57:30 +02006630 ALC269VB_FIXUP_ASPIRE_E1_COEF,
David Henningsson7a5255f2014-10-30 08:26:01 +01006631 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006632 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006633 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006634 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006635 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006636 ALC280_FIXUP_HP_9480M,
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01006637 ALC245_FIXUP_HP_X360_AMP,
Davide Baldod94befb2021-10-15 09:21:22 +02006638 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
Kailang Yange1e62b92015-04-08 16:01:22 +08006639 ALC288_FIXUP_DELL_HEADSET_MODE,
6640 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006641 ALC288_FIXUP_DELL_XPS_13,
6642 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006643 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006644 ALC292_FIXUP_DELL_E7X,
6645 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006646 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006647 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006648 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006649 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006650 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006651 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006652 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006653 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006654 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006655 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006656 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006657 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006658 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006659 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006660 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006661 ALC298_FIXUP_SPK_VOLUME,
Kailang Yangf86de9b2020-10-23 14:46:47 +08006662 ALC298_FIXUP_LENOVO_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006663 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006664 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006665 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006666 ALC256_FIXUP_ASUS_HEADSET_MODE,
6667 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006668 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006669 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6670 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006671 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006672 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006673 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006674 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006675 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006676 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006677 ALC274_FIXUP_DELL_BIND_DACS,
6678 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006679 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006680 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006681 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006682 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006683 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006684 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006685 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006686 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006687 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006688 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006689 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006690 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006691 ALC294_FIXUP_ASUS_HEADSET_MIC,
6692 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006693 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006694 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006695 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006696 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006697 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006698 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6699 ALC225_FIXUP_WYSE_AUTO_MUTE,
6700 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006701 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006702 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006703 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006704 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006705 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006706 ALC289_FIXUP_DELL_SPK2,
6707 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006708 ALC294_FIXUP_SPK2_TO_DAC1,
6709 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006710 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006711 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006712 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006713 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006714 ALC294_FIXUP_ASUS_GX502_HP,
6715 ALC294_FIXUP_ASUS_GX502_PINS,
6716 ALC294_FIXUP_ASUS_GX502_VERBS,
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006717 ALC294_FIXUP_ASUS_GU502_HP,
6718 ALC294_FIXUP_ASUS_GU502_PINS,
6719 ALC294_FIXUP_ASUS_GU502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006720 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006721 ALC285_FIXUP_HP_MUTE_LED,
Jeremy Szue7d66cf2021-03-16 15:46:24 +08006722 ALC236_FIXUP_HP_GPIO_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006723 ALC236_FIXUP_HP_MUTE_LED,
Jonas Witschel75b62ab2021-04-16 12:58:54 +02006724 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
Mike Pozulp14425f12020-05-09 20:28:37 -07006725 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006726 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006727 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006728 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006729 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006730 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006731 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006732 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006733 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006734 ALC269_FIXUP_CZC_B20,
6735 ALC269_FIXUP_CZC_TMI,
6736 ALC269_FIXUP_CZC_L101,
6737 ALC269_FIXUP_LEMOTE_A1802,
6738 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006739 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Phil Calvind1ee66c2021-04-15 18:01:29 -04006740 ALC233_FIXUP_INTEL_NUC8_DMIC,
6741 ALC233_FIXUP_INTEL_NUC8_BOOST,
Werner Sembach73e71612021-03-02 19:04:14 +01006742 ALC256_FIXUP_INTEL_NUC10,
Hui Wangfc19d552020-09-09 10:00:41 +08006743 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006744 ALC274_FIXUP_HP_MIC,
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006745 ALC274_FIXUP_HP_HEADSET_MIC,
Takashi Iwai622464c2021-05-04 11:18:02 +02006746 ALC274_FIXUP_HP_ENVY_GPIO,
Kailang Yangef9ce662020-11-03 15:40:35 +08006747 ALC256_FIXUP_ASUS_HPE,
Kailang Yang446b8182020-11-02 15:00:12 +08006748 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Kailang Yanga0ccbc52020-11-06 15:20:38 +08006749 ALC287_FIXUP_HP_GPIO_LED,
Kailang Yang9e885772020-11-03 15:30:51 +08006750 ALC256_FIXUP_HP_HEADSET_MIC,
Johnathon Clark5fc462c2021-10-20 14:12:51 +01006751 ALC245_FIXUP_HP_GPIO_LED,
Kailang Yang92666d42020-11-19 17:04:21 +08006752 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
Chris Chiu34cdf402020-12-16 20:52:00 +08006753 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
Chris Chiu495dc762021-01-14 16:27:28 +08006754 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
Chris Chiud0e18562021-02-26 09:04:40 +08006755 ALC256_FIXUP_ACER_HEADSET_MIC,
Takashi Iwai26928ca2021-04-16 10:12:11 +02006756 ALC285_FIXUP_IDEAPAD_S740_COEF,
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08006757 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02006758 ALC295_FIXUP_ASUS_DACS,
Takashi Iwai5d84b532021-05-04 14:18:32 +02006759 ALC295_FIXUP_HP_OMEN,
Elia Devitof2be77f2021-05-11 14:46:49 +02006760 ALC285_FIXUP_HP_SPECTRE_X360,
Hui Wang9ebaef02021-05-22 12:26:45 +08006761 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03006762 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
Hui Wang57c9e212021-06-08 10:46:00 +08006763 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08006764 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07006765 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6766 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6767 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006768 ALC287_FIXUP_13S_GEN2_SPEAKERS,
6769 ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS,
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06006770 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006771};
6772
Takashi Iwai1727a772013-01-10 09:52:52 +01006773static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006774 [ALC269_FIXUP_GPIO2] = {
6775 .type = HDA_FIXUP_FUNC,
6776 .v.func = alc_fixup_gpio2,
6777 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006778 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01006779 .type = HDA_FIXUP_PINCTLS,
6780 .v.pins = (const struct hda_pintbl[]) {
6781 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006782 {}
6783 }
6784 },
6785 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006786 .type = HDA_FIXUP_FUNC,
6787 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006788 .chained = true,
6789 .chain_id = ALC269_FIXUP_SONY_VAIO
6790 },
6791 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006792 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006793 .v.verbs = (const struct hda_verb[]) {
6794 /* Enables internal speaker */
6795 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6796 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6797 {}
6798 }
6799 },
6800 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006801 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02006802 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006803 },
6804 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006805 .type = HDA_FIXUP_PINS,
6806 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02006807 { 0x17, 0x99130111 }, /* subwoofer */
6808 { }
6809 }
6810 },
6811 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006812 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006813 .v.verbs = (const struct hda_verb[]) {
6814 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6815 {}
6816 }
6817 },
6818 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006819 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006820 .v.func = alc269_fixup_hweq,
6821 .chained = true,
6822 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6823 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006824 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6825 .type = HDA_FIXUP_FUNC,
6826 .v.func = alc_fixup_disable_aamix,
6827 .chained = true,
6828 .chain_id = ALC269_FIXUP_SONY_VAIO
6829 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006830 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006831 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006832 .v.func = alc271_fixup_dmic,
6833 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02006834 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006835 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006836 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02006837 .chained = true,
6838 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02006839 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006840 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006841 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006842 .v.func = alc269_fixup_stereo_dmic,
6843 },
David Henningsson7c478f02013-10-11 10:18:46 +02006844 [ALC269_FIXUP_HEADSET_MIC] = {
6845 .type = HDA_FIXUP_FUNC,
6846 .v.func = alc269_fixup_headset_mic,
6847 },
Takashi Iwai24519912011-08-16 15:08:49 +02006848 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006849 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02006850 .v.func = alc269_fixup_quanta_mute,
6851 },
6852 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006853 .type = HDA_FIXUP_PINS,
6854 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02006855 { 0x1a, 0x2101103f }, /* dock line-out */
6856 { 0x1b, 0x23a11040 }, /* dock mic-in */
6857 { }
6858 },
6859 .chained = true,
6860 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6861 },
David Henningsson2041d562014-06-13 11:15:44 +02006862 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6863 .type = HDA_FIXUP_PINS,
6864 .v.pins = (const struct hda_pintbl[]) {
6865 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6866 { }
6867 },
6868 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006869 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6870 .type = HDA_FIXUP_PINS,
6871 .v.pins = (const struct hda_pintbl[]) {
6872 { 0x21, 0x0221102f }, /* HP out */
6873 { }
6874 },
6875 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006876 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6877 .type = HDA_FIXUP_FUNC,
6878 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6879 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006880 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6881 .type = HDA_FIXUP_FUNC,
6882 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6883 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02006884 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006885 .type = HDA_FIXUP_PINS,
6886 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006887 { 0x14, 0x99130110 }, /* speaker */
6888 { 0x15, 0x0121401f }, /* HP out */
6889 { 0x18, 0x01a19c20 }, /* mic */
6890 { 0x19, 0x99a3092f }, /* int-mic */
6891 { }
6892 },
6893 },
6894 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006895 .type = HDA_FIXUP_PINS,
6896 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006897 { 0x12, 0x99a3092f }, /* int-mic */
6898 { 0x14, 0x99130110 }, /* speaker */
6899 { 0x15, 0x0121401f }, /* HP out */
6900 { 0x18, 0x01a19c20 }, /* mic */
6901 { }
6902 },
6903 },
6904 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006905 .type = HDA_FIXUP_PINS,
6906 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006907 { 0x14, 0x99130110 }, /* speaker */
6908 { 0x18, 0x01a19c20 }, /* mic */
6909 { 0x19, 0x99a3092f }, /* int-mic */
6910 { 0x21, 0x0121401f }, /* HP out */
6911 { }
6912 },
6913 },
David Henningsson2267ea92012-01-03 08:45:56 +01006914 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006915 .type = HDA_FIXUP_PINS,
6916 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006917 { 0x12, 0x99a3092f }, /* int-mic */
6918 { 0x14, 0x99130110 }, /* speaker */
6919 { 0x18, 0x01a19c20 }, /* mic */
6920 { 0x21, 0x0121401f }, /* HP out */
6921 { }
6922 },
6923 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006924 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006925 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006926 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01006927 },
David Henningssond06ac142013-02-18 11:41:55 +01006928 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6929 .type = HDA_FIXUP_FUNC,
6930 .v.func = alc269_fixup_hp_mute_led_mic1,
6931 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006932 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006933 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006934 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01006935 },
Tom Briden7f783bd2017-03-25 10:12:01 +00006936 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6937 .type = HDA_FIXUP_FUNC,
6938 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006939 .chained = true,
6940 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00006941 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006942 [ALC269_FIXUP_HP_GPIO_LED] = {
6943 .type = HDA_FIXUP_FUNC,
6944 .v.func = alc269_fixup_hp_gpio_led,
6945 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006946 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6947 .type = HDA_FIXUP_FUNC,
6948 .v.func = alc269_fixup_hp_gpio_mic1_led,
6949 },
6950 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6951 .type = HDA_FIXUP_FUNC,
6952 .v.func = alc269_fixup_hp_line1_mic1_led,
6953 },
David Henningsson693b6132012-06-22 19:12:10 +02006954 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006955 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02006956 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02006957 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006958 [ALC269_FIXUP_NO_SHUTUP] = {
6959 .type = HDA_FIXUP_FUNC,
6960 .v.func = alc_fixup_no_shutup,
6961 },
David Henningsson108cc102012-07-20 10:37:25 +02006962 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006963 .type = HDA_FIXUP_PINS,
6964 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02006965 { 0x19, 0x23a11040 }, /* dock mic */
6966 { 0x1b, 0x2121103f }, /* dock headphone */
6967 { }
6968 },
6969 .chained = true,
6970 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6971 },
Takashi Iwaib590b382020-05-14 18:05:33 +02006972 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6973 .type = HDA_FIXUP_FUNC,
6974 .v.func = alc269_fixup_limit_int_mic_boost,
6975 .chained = true,
6976 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6977 },
David Henningsson108cc102012-07-20 10:37:25 +02006978 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006979 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02006980 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01006981 .chained = true,
6982 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02006983 },
David Henningsson73bdd592013-04-15 15:44:14 +02006984 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6985 .type = HDA_FIXUP_PINS,
6986 .v.pins = (const struct hda_pintbl[]) {
6987 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6988 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6989 { }
6990 },
6991 .chained = true,
6992 .chain_id = ALC269_FIXUP_HEADSET_MODE
6993 },
6994 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6995 .type = HDA_FIXUP_PINS,
6996 .v.pins = (const struct hda_pintbl[]) {
6997 { 0x16, 0x21014020 }, /* dock line out */
6998 { 0x19, 0x21a19030 }, /* dock mic */
6999 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7000 { }
7001 },
7002 .chained = true,
7003 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7004 },
David Henningsson338cae52013-10-07 10:39:59 +02007005 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7006 .type = HDA_FIXUP_PINS,
7007 .v.pins = (const struct hda_pintbl[]) {
7008 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7009 { }
7010 },
7011 .chained = true,
7012 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7013 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08007014 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7015 .type = HDA_FIXUP_PINS,
7016 .v.pins = (const struct hda_pintbl[]) {
7017 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7018 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7019 { }
7020 },
7021 .chained = true,
7022 .chain_id = ALC269_FIXUP_HEADSET_MODE
7023 },
David Henningsson73bdd592013-04-15 15:44:14 +02007024 [ALC269_FIXUP_HEADSET_MODE] = {
7025 .type = HDA_FIXUP_FUNC,
7026 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08007027 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007028 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02007029 },
7030 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7031 .type = HDA_FIXUP_FUNC,
7032 .v.func = alc_fixup_headset_mode_no_hp_mic,
7033 },
Takashi Iwai78197172015-06-27 10:21:13 +02007034 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7035 .type = HDA_FIXUP_PINS,
7036 .v.pins = (const struct hda_pintbl[]) {
7037 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7038 { }
7039 },
7040 .chained = true,
7041 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7042 },
David Henningsson88cfcf82013-10-11 10:18:45 +02007043 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7044 .type = HDA_FIXUP_PINS,
7045 .v.pins = (const struct hda_pintbl[]) {
7046 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7047 { }
7048 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02007049 .chained = true,
7050 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02007051 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04007052 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05007053 .type = HDA_FIXUP_PINS,
7054 .v.pins = (const struct hda_pintbl[]) {
7055 {0x12, 0x90a60130},
7056 {0x13, 0x40000000},
7057 {0x14, 0x90170110},
7058 {0x18, 0x411111f0},
7059 {0x19, 0x04a11040},
7060 {0x1a, 0x411111f0},
7061 {0x1b, 0x90170112},
7062 {0x1d, 0x40759a05},
7063 {0x1e, 0x411111f0},
7064 {0x21, 0x04211020},
7065 { }
7066 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05007067 .chained = true,
7068 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05007069 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02007070 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7071 .type = HDA_FIXUP_FUNC,
7072 .v.func = alc298_fixup_huawei_mbx_stereo,
7073 .chained = true,
7074 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7075 },
David Henningssond240d1d2013-04-15 12:50:02 +02007076 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7077 .type = HDA_FIXUP_FUNC,
7078 .v.func = alc269_fixup_x101_headset_mic,
7079 },
7080 [ALC269_FIXUP_ASUS_X101_VERB] = {
7081 .type = HDA_FIXUP_VERBS,
7082 .v.verbs = (const struct hda_verb[]) {
7083 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7084 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7085 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7086 { }
7087 },
7088 .chained = true,
7089 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7090 },
7091 [ALC269_FIXUP_ASUS_X101] = {
7092 .type = HDA_FIXUP_PINS,
7093 .v.pins = (const struct hda_pintbl[]) {
7094 { 0x18, 0x04a1182c }, /* Headset mic */
7095 { }
7096 },
7097 .chained = true,
7098 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7099 },
Dylan Reid08a978d2012-11-18 22:56:40 -08007100 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007101 .type = HDA_FIXUP_PINS,
7102 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08007103 { 0x14, 0x99130110 }, /* speaker */
7104 { 0x19, 0x01a19c20 }, /* mic */
7105 { 0x1b, 0x99a7012f }, /* int-mic */
7106 { 0x21, 0x0121401f }, /* HP out */
7107 { }
7108 },
7109 },
7110 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007111 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08007112 .v.func = alc271_hp_gate_mic_jack,
7113 .chained = true,
7114 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7115 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01007116 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7117 .type = HDA_FIXUP_FUNC,
7118 .v.func = alc269_fixup_limit_int_mic_boost,
7119 .chained = true,
7120 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7121 },
Dylan Reid42397002013-04-05 14:58:22 -07007122 [ALC269_FIXUP_ACER_AC700] = {
7123 .type = HDA_FIXUP_PINS,
7124 .v.pins = (const struct hda_pintbl[]) {
7125 { 0x12, 0x99a3092f }, /* int-mic */
7126 { 0x14, 0x99130110 }, /* speaker */
7127 { 0x18, 0x03a11c20 }, /* mic */
7128 { 0x1e, 0x0346101e }, /* SPDIF1 */
7129 { 0x21, 0x0321101f }, /* HP out */
7130 { }
7131 },
7132 .chained = true,
7133 .chain_id = ALC271_FIXUP_DMIC,
7134 },
David Henningsson3e0d6112013-04-22 14:30:14 +02007135 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7136 .type = HDA_FIXUP_FUNC,
7137 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01007138 .chained = true,
7139 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02007140 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01007141 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7142 .type = HDA_FIXUP_FUNC,
7143 .v.func = alc269_fixup_limit_int_mic_boost,
7144 .chained = true,
7145 .chain_id = ALC269VB_FIXUP_DMIC,
7146 },
Takashi Iwai23870832013-11-29 14:13:12 +01007147 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7148 .type = HDA_FIXUP_VERBS,
7149 .v.verbs = (const struct hda_verb[]) {
7150 /* class-D output amp +5dB */
7151 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7152 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7153 {}
7154 },
7155 .chained = true,
7156 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7157 },
David Henningsson8e35cd42013-11-06 11:20:01 +01007158 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7159 .type = HDA_FIXUP_FUNC,
7160 .v.func = alc269_fixup_limit_int_mic_boost,
7161 .chained = true,
7162 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7163 },
Anisse Astier02b504d2013-06-03 11:53:10 +02007164 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7165 .type = HDA_FIXUP_PINS,
7166 .v.pins = (const struct hda_pintbl[]) {
7167 { 0x12, 0x99a3092f }, /* int-mic */
7168 { 0x18, 0x03a11d20 }, /* mic */
7169 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7170 { }
7171 },
7172 },
Kailang Yangcd217a62013-08-22 10:15:24 +02007173 [ALC283_FIXUP_CHROME_BOOK] = {
7174 .type = HDA_FIXUP_FUNC,
7175 .v.func = alc283_fixup_chromebook,
7176 },
Kailang Yang0202e992013-12-02 15:20:15 +08007177 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7178 .type = HDA_FIXUP_FUNC,
7179 .v.func = alc283_fixup_sense_combo_jack,
7180 .chained = true,
7181 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7182 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02007183 [ALC282_FIXUP_ASUS_TX300] = {
7184 .type = HDA_FIXUP_FUNC,
7185 .v.func = alc282_fixup_asus_tx300,
7186 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02007187 [ALC283_FIXUP_INT_MIC] = {
7188 .type = HDA_FIXUP_VERBS,
7189 .v.verbs = (const struct hda_verb[]) {
7190 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7191 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7192 { }
7193 },
7194 .chained = true,
7195 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7196 },
David Henningsson0f4881d2013-12-20 16:08:13 +01007197 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7198 .type = HDA_FIXUP_PINS,
7199 .v.pins = (const struct hda_pintbl[]) {
7200 { 0x17, 0x90170112 }, /* subwoofer */
7201 { }
7202 },
7203 .chained = true,
7204 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7205 },
7206 [ALC290_FIXUP_SUBWOOFER] = {
7207 .type = HDA_FIXUP_PINS,
7208 .v.pins = (const struct hda_pintbl[]) {
7209 { 0x17, 0x90170112 }, /* subwoofer */
7210 { }
7211 },
7212 .chained = true,
7213 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7214 },
David Henningsson338cae52013-10-07 10:39:59 +02007215 [ALC290_FIXUP_MONO_SPEAKERS] = {
7216 .type = HDA_FIXUP_FUNC,
7217 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01007218 },
7219 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7220 .type = HDA_FIXUP_FUNC,
7221 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02007222 .chained = true,
7223 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7224 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01007225 [ALC269_FIXUP_THINKPAD_ACPI] = {
7226 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02007227 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02007228 .chained = true,
7229 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01007230 },
David Henningsson56f27012016-01-11 09:33:14 +01007231 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7232 .type = HDA_FIXUP_FUNC,
7233 .v.func = alc_fixup_inv_dmic,
7234 .chained = true,
7235 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7236 },
Chris Chiu5824ce82017-02-28 14:17:11 -06007237 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08007238 .type = HDA_FIXUP_PINS,
7239 .v.pins = (const struct hda_pintbl[]) {
7240 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7241 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06007242 },
7243 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08007244 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06007245 },
Chris Chiu615966a2017-02-28 14:17:12 -06007246 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7247 .type = HDA_FIXUP_PINS,
7248 .v.pins = (const struct hda_pintbl[]) {
7249 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7250 { }
7251 },
7252 .chained = true,
7253 .chain_id = ALC255_FIXUP_HEADSET_MODE
7254 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007255 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7256 .type = HDA_FIXUP_PINS,
7257 .v.pins = (const struct hda_pintbl[]) {
7258 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7259 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7260 { }
7261 },
7262 .chained = true,
7263 .chain_id = ALC255_FIXUP_HEADSET_MODE
7264 },
Kailang Yang31278992014-03-03 15:27:22 +08007265 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7266 .type = HDA_FIXUP_PINS,
7267 .v.pins = (const struct hda_pintbl[]) {
7268 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7269 { }
7270 },
7271 .chained = true,
7272 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7273 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007274 [ALC255_FIXUP_HEADSET_MODE] = {
7275 .type = HDA_FIXUP_FUNC,
7276 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08007277 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007278 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007279 },
Kailang Yang31278992014-03-03 15:27:22 +08007280 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7281 .type = HDA_FIXUP_FUNC,
7282 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7283 },
Kailang Yanga22aa262014-04-23 17:34:28 +08007284 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7285 .type = HDA_FIXUP_PINS,
7286 .v.pins = (const struct hda_pintbl[]) {
7287 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7288 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7289 { }
7290 },
7291 .chained = true,
7292 .chain_id = ALC269_FIXUP_HEADSET_MODE
7293 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02007294 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02007295 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02007296 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02007297 .chained = true,
7298 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7299 },
Takashi Iwai9a811232015-12-09 15:17:43 +01007300 [ALC292_FIXUP_TPT440] = {
7301 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01007302 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01007303 .chained = true,
7304 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7305 },
Anisse Astierabaa22742016-08-24 09:14:13 +02007306 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01007307 .type = HDA_FIXUP_PINS,
7308 .v.pins = (const struct hda_pintbl[]) {
7309 { 0x19, 0x04a110f0 },
7310 { },
7311 },
7312 },
Takashi Iwaib3802782018-11-26 17:47:46 +01007313 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08007314 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007315 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08007316 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007317 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7318 .type = HDA_FIXUP_PINS,
7319 .v.pins = (const struct hda_pintbl[]) {
7320 { 0x12, 0x90a60130 },
7321 { 0x14, 0x90170110 },
7322 { 0x17, 0x40000008 },
7323 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02007324 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007325 { 0x1a, 0x411111f0 },
7326 { 0x1b, 0x411111f0 },
7327 { 0x1d, 0x40f89b2d },
7328 { 0x1e, 0x411111f0 },
7329 { 0x21, 0x0321101f },
7330 { },
7331 },
7332 },
Takashi Iwaic8426b22021-04-07 11:57:30 +02007333 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7334 .type = HDA_FIXUP_FUNC,
7335 .v.func = alc269vb_fixup_aspire_e1_coef,
7336 },
David Henningsson7a5255f2014-10-30 08:26:01 +01007337 [ALC280_FIXUP_HP_GPIO4] = {
7338 .type = HDA_FIXUP_FUNC,
7339 .v.func = alc280_fixup_hp_gpio4,
7340 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007341 [ALC286_FIXUP_HP_GPIO_LED] = {
7342 .type = HDA_FIXUP_FUNC,
7343 .v.func = alc286_fixup_hp_gpio_led,
7344 },
David Henningsson33f4acd2015-01-07 15:50:13 +01007345 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7346 .type = HDA_FIXUP_FUNC,
7347 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7348 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01007349 [ALC280_FIXUP_HP_DOCK_PINS] = {
7350 .type = HDA_FIXUP_PINS,
7351 .v.pins = (const struct hda_pintbl[]) {
7352 { 0x1b, 0x21011020 }, /* line-out */
7353 { 0x1a, 0x01a1903c }, /* headset mic */
7354 { 0x18, 0x2181103f }, /* line-in */
7355 { },
7356 },
7357 .chained = true,
7358 .chain_id = ALC280_FIXUP_HP_GPIO4
7359 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007360 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7361 .type = HDA_FIXUP_PINS,
7362 .v.pins = (const struct hda_pintbl[]) {
7363 { 0x1b, 0x21011020 }, /* line-out */
7364 { 0x18, 0x2181103f }, /* line-in */
7365 { },
7366 },
7367 .chained = true,
7368 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7369 },
Keith Packard98973f22015-07-15 12:14:39 -07007370 [ALC280_FIXUP_HP_9480M] = {
7371 .type = HDA_FIXUP_FUNC,
7372 .v.func = alc280_fixup_hp_9480m,
7373 },
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007374 [ALC245_FIXUP_HP_X360_AMP] = {
7375 .type = HDA_FIXUP_FUNC,
7376 .v.func = alc245_fixup_hp_x360_amp,
Johnathon Clark5fc462c2021-10-20 14:12:51 +01007377 .chained = true,
7378 .chain_id = ALC245_FIXUP_HP_GPIO_LED
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007379 },
Kailang Yange1e62b92015-04-08 16:01:22 +08007380 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7381 .type = HDA_FIXUP_FUNC,
7382 .v.func = alc_fixup_headset_mode_dell_alc288,
7383 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007384 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08007385 },
7386 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7387 .type = HDA_FIXUP_PINS,
7388 .v.pins = (const struct hda_pintbl[]) {
7389 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7390 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7391 { }
7392 },
7393 .chained = true,
7394 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7395 },
Hui Wang831bfdf92015-06-26 12:35:17 +08007396 [ALC288_FIXUP_DISABLE_AAMIX] = {
7397 .type = HDA_FIXUP_FUNC,
7398 .v.func = alc_fixup_disable_aamix,
7399 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02007400 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08007401 },
7402 [ALC288_FIXUP_DELL_XPS_13] = {
7403 .type = HDA_FIXUP_FUNC,
7404 .v.func = alc_fixup_dell_xps13,
7405 .chained = true,
7406 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7407 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007408 [ALC292_FIXUP_DISABLE_AAMIX] = {
7409 .type = HDA_FIXUP_FUNC,
7410 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08007411 .chained = true,
7412 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007413 },
David Henningssonc04017e2015-12-15 14:44:03 +01007414 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7415 .type = HDA_FIXUP_FUNC,
7416 .v.func = alc_fixup_disable_aamix,
7417 .chained = true,
7418 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7419 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007420 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007421 .type = HDA_FIXUP_FUNC,
7422 .v.func = alc_fixup_dell_xps13,
7423 .chained = true,
7424 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7425 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007426 [ALC292_FIXUP_DELL_E7X] = {
7427 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007428 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01007429 /* micmute fixup must be applied at last */
7430 .chained_before = true,
7431 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7432 },
James McDonnell54324222019-09-16 14:53:38 +00007433 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7434 .type = HDA_FIXUP_PINS,
7435 .v.pins = (const struct hda_pintbl[]) {
7436 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7437 { }
7438 },
7439 .chained_before = true,
7440 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7441 },
Kailang Yang977e6272015-05-18 15:31:20 +08007442 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7443 .type = HDA_FIXUP_PINS,
7444 .v.pins = (const struct hda_pintbl[]) {
7445 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7446 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7447 { }
7448 },
7449 .chained = true,
7450 .chain_id = ALC269_FIXUP_HEADSET_MODE
7451 },
Hui Wang2f726ae2017-03-31 10:31:40 +08007452 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7453 .type = HDA_FIXUP_PINS,
7454 .v.pins = (const struct hda_pintbl[]) {
7455 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7456 { }
7457 },
7458 .chained = true,
7459 .chain_id = ALC269_FIXUP_HEADSET_MODE
7460 },
Kailang Yang6ed11312015-10-26 15:37:39 +08007461 [ALC275_FIXUP_DELL_XPS] = {
7462 .type = HDA_FIXUP_VERBS,
7463 .v.verbs = (const struct hda_verb[]) {
7464 /* Enables internal speaker */
7465 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7466 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7467 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7468 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7469 {}
7470 }
7471 },
Hui Wang23adc192015-12-08 12:27:18 +08007472 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7473 .type = HDA_FIXUP_FUNC,
7474 .v.func = alc_fixup_disable_aamix,
7475 .chained = true,
7476 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7477 },
Kailang3694cb22015-12-28 11:35:24 +08007478 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7479 .type = HDA_FIXUP_FUNC,
7480 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7481 },
Phil Calvind1ee66c2021-04-15 18:01:29 -04007482 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7483 .type = HDA_FIXUP_FUNC,
7484 .v.func = alc_fixup_inv_dmic,
7485 .chained = true,
7486 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7487 },
7488 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7489 .type = HDA_FIXUP_FUNC,
7490 .v.func = alc269_fixup_limit_int_mic_boost
7491 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007492 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7493 .type = HDA_FIXUP_FUNC,
7494 .v.func = alc_fixup_disable_aamix,
7495 .chained = true,
7496 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7497 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08007498 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7499 .type = HDA_FIXUP_FUNC,
7500 .v.func = alc_fixup_disable_mic_vref,
7501 .chained = true,
7502 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7503 },
David Henningsson2ae95572016-02-25 09:37:05 +01007504 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7505 .type = HDA_FIXUP_VERBS,
7506 .v.verbs = (const struct hda_verb[]) {
7507 /* Disable pass-through path for FRONT 14h */
7508 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7509 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7510 {}
7511 },
7512 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007513 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007514 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007515 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7516 .type = HDA_FIXUP_FUNC,
7517 .v.func = alc_fixup_disable_aamix,
7518 .chained = true,
7519 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7520 },
Hui Wange549d192016-04-01 11:00:15 +08007521 [ALC221_FIXUP_HP_FRONT_MIC] = {
7522 .type = HDA_FIXUP_PINS,
7523 .v.pins = (const struct hda_pintbl[]) {
7524 { 0x19, 0x02a19020 }, /* Front Mic */
7525 { }
7526 },
7527 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007528 [ALC292_FIXUP_TPT460] = {
7529 .type = HDA_FIXUP_FUNC,
7530 .v.func = alc_fixup_tpt440_dock,
7531 .chained = true,
7532 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7533 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007534 [ALC298_FIXUP_SPK_VOLUME] = {
7535 .type = HDA_FIXUP_FUNC,
7536 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007537 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007538 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007539 },
Kailang Yangf86de9b2020-10-23 14:46:47 +08007540 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7541 .type = HDA_FIXUP_FUNC,
7542 .v.func = alc298_fixup_speaker_volume,
7543 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007544 [ALC295_FIXUP_DISABLE_DAC3] = {
7545 .type = HDA_FIXUP_FUNC,
7546 .v.func = alc295_fixup_disable_dac3,
7547 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007548 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7549 .type = HDA_FIXUP_FUNC,
7550 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007551 .chained = true,
7552 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007553 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007554 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7555 .type = HDA_FIXUP_PINS,
7556 .v.pins = (const struct hda_pintbl[]) {
7557 { 0x1b, 0x90170151 },
7558 { }
7559 },
7560 .chained = true,
7561 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7562 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007563 [ALC269_FIXUP_ATIV_BOOK_8] = {
7564 .type = HDA_FIXUP_FUNC,
7565 .v.func = alc_fixup_auto_mute_via_amp,
7566 .chained = true,
7567 .chain_id = ALC269_FIXUP_NO_SHUTUP
7568 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007569 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7570 .type = HDA_FIXUP_PINS,
7571 .v.pins = (const struct hda_pintbl[]) {
7572 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7573 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7574 { }
7575 },
7576 .chained = true,
7577 .chain_id = ALC269_FIXUP_HEADSET_MODE
7578 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007579 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7580 .type = HDA_FIXUP_FUNC,
7581 .v.func = alc_fixup_headset_mode,
7582 },
7583 [ALC256_FIXUP_ASUS_MIC] = {
7584 .type = HDA_FIXUP_PINS,
7585 .v.pins = (const struct hda_pintbl[]) {
7586 { 0x13, 0x90a60160 }, /* use as internal mic */
7587 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7588 { }
7589 },
7590 .chained = true,
7591 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7592 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007593 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007594 .type = HDA_FIXUP_FUNC,
7595 /* Set up GPIO2 for the speaker amp */
7596 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007597 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007598 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7599 .type = HDA_FIXUP_PINS,
7600 .v.pins = (const struct hda_pintbl[]) {
7601 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7602 { }
7603 },
7604 .chained = true,
7605 .chain_id = ALC269_FIXUP_HEADSET_MIC
7606 },
7607 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7608 .type = HDA_FIXUP_VERBS,
7609 .v.verbs = (const struct hda_verb[]) {
7610 /* Enables internal speaker */
7611 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7612 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7613 {}
7614 },
7615 .chained = true,
7616 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7617 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007618 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7619 .type = HDA_FIXUP_FUNC,
7620 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007621 .chained = true,
7622 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007623 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007624 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7625 .type = HDA_FIXUP_VERBS,
7626 .v.verbs = (const struct hda_verb[]) {
7627 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7628 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7629 { }
7630 },
7631 .chained = true,
7632 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7633 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007634 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7635 .type = HDA_FIXUP_PINS,
7636 .v.pins = (const struct hda_pintbl[]) {
7637 /* Change the mic location from front to right, otherwise there are
7638 two front mics with the same name, pulseaudio can't handle them.
7639 This is just a temporary workaround, after applying this fixup,
7640 there will be one "Front Mic" and one "Mic" in this machine.
7641 */
7642 { 0x1a, 0x04a19040 },
7643 { }
7644 },
7645 },
Kailang Yang5f364132017-07-25 16:28:16 +08007646 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7647 .type = HDA_FIXUP_PINS,
7648 .v.pins = (const struct hda_pintbl[]) {
7649 { 0x16, 0x0101102f }, /* Rear Headset HP */
7650 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7651 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7652 { 0x1b, 0x02011020 },
7653 { }
7654 },
7655 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007656 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7657 },
7658 [ALC225_FIXUP_S3_POP_NOISE] = {
7659 .type = HDA_FIXUP_FUNC,
7660 .v.func = alc225_fixup_s3_pop_noise,
7661 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007662 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7663 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007664 [ALC700_FIXUP_INTEL_REFERENCE] = {
7665 .type = HDA_FIXUP_VERBS,
7666 .v.verbs = (const struct hda_verb[]) {
7667 /* Enables internal speaker */
7668 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7669 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7670 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7671 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7672 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7673 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7674 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7675 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7676 {}
7677 }
7678 },
Kailang Yang92266652017-12-14 15:28:58 +08007679 [ALC274_FIXUP_DELL_BIND_DACS] = {
7680 .type = HDA_FIXUP_FUNC,
7681 .v.func = alc274_fixup_bind_dacs,
7682 .chained = true,
7683 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7684 },
7685 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7686 .type = HDA_FIXUP_PINS,
7687 .v.pins = (const struct hda_pintbl[]) {
7688 { 0x1b, 0x0401102f },
7689 { }
7690 },
7691 .chained = true,
7692 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7693 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007694 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007695 .type = HDA_FIXUP_FUNC,
7696 .v.func = alc_fixup_tpt470_dock,
7697 .chained = true,
7698 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7699 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007700 [ALC298_FIXUP_TPT470_DOCK] = {
7701 .type = HDA_FIXUP_FUNC,
7702 .v.func = alc_fixup_tpt470_dacs,
7703 .chained = true,
7704 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7705 },
Kailang Yangae104a22018-02-05 16:07:20 +08007706 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7707 .type = HDA_FIXUP_PINS,
7708 .v.pins = (const struct hda_pintbl[]) {
7709 { 0x14, 0x0201101f },
7710 { }
7711 },
7712 .chained = true,
7713 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7714 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007715 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7716 .type = HDA_FIXUP_PINS,
7717 .v.pins = (const struct hda_pintbl[]) {
7718 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7719 { }
7720 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007721 .chained = true,
7722 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007723 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007724 [ALC295_FIXUP_HP_X360] = {
7725 .type = HDA_FIXUP_FUNC,
7726 .v.func = alc295_fixup_hp_top_speakers,
7727 .chained = true,
7728 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007729 },
7730 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7731 .type = HDA_FIXUP_PINS,
7732 .v.pins = (const struct hda_pintbl[]) {
7733 { 0x19, 0x0181313f},
7734 { }
7735 },
7736 .chained = true,
7737 .chain_id = ALC269_FIXUP_HEADSET_MIC
7738 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007739 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7740 .type = HDA_FIXUP_FUNC,
7741 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007742 .chained = true,
7743 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007744 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007745 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7746 .type = HDA_FIXUP_FUNC,
7747 .v.func = alc_fixup_auto_mute_via_amp,
7748 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007749 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7750 .type = HDA_FIXUP_PINS,
7751 .v.pins = (const struct hda_pintbl[]) {
7752 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7753 { }
7754 },
7755 .chained = true,
7756 .chain_id = ALC269_FIXUP_HEADSET_MIC
7757 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007758 [ALC294_FIXUP_ASUS_MIC] = {
7759 .type = HDA_FIXUP_PINS,
7760 .v.pins = (const struct hda_pintbl[]) {
7761 { 0x13, 0x90a60160 }, /* use as internal mic */
7762 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7763 { }
7764 },
7765 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007766 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007767 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007768 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7769 .type = HDA_FIXUP_PINS,
7770 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007771 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007772 { }
7773 },
7774 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007775 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007776 },
7777 [ALC294_FIXUP_ASUS_SPK] = {
7778 .type = HDA_FIXUP_VERBS,
7779 .v.verbs = (const struct hda_verb[]) {
7780 /* Set EAPD high */
7781 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7782 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08007783 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7784 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007785 { }
7786 },
7787 .chained = true,
7788 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7789 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007790 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08007791 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007792 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08007793 .chained = true,
7794 .chain_id = ALC225_FIXUP_HEADSET_JACK
7795 },
7796 [ALC225_FIXUP_HEADSET_JACK] = {
7797 .type = HDA_FIXUP_FUNC,
7798 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08007799 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07007800 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7801 .type = HDA_FIXUP_PINS,
7802 .v.pins = (const struct hda_pintbl[]) {
7803 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7804 { }
7805 },
7806 .chained = true,
7807 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7808 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08007809 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7810 .type = HDA_FIXUP_VERBS,
7811 .v.verbs = (const struct hda_verb[]) {
7812 /* Disable PCBEEP-IN passthrough */
7813 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7814 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7815 { }
7816 },
7817 .chained = true,
7818 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7819 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007820 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7821 .type = HDA_FIXUP_PINS,
7822 .v.pins = (const struct hda_pintbl[]) {
7823 { 0x19, 0x03a11130 },
7824 { 0x1a, 0x90a60140 }, /* use as internal mic */
7825 { }
7826 },
7827 .chained = true,
7828 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7829 },
Kailang Yang136824e2019-03-14 16:22:45 +08007830 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7831 .type = HDA_FIXUP_PINS,
7832 .v.pins = (const struct hda_pintbl[]) {
7833 { 0x16, 0x01011020 }, /* Rear Line out */
7834 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7835 { }
7836 },
7837 .chained = true,
7838 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7839 },
7840 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7841 .type = HDA_FIXUP_FUNC,
7842 .v.func = alc_fixup_auto_mute_via_amp,
7843 .chained = true,
7844 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7845 },
7846 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7847 .type = HDA_FIXUP_FUNC,
7848 .v.func = alc_fixup_disable_mic_vref,
7849 .chained = true,
7850 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7851 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007852 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7853 .type = HDA_FIXUP_VERBS,
7854 .v.verbs = (const struct hda_verb[]) {
7855 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7856 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7857 { }
7858 },
7859 .chained = true,
7860 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7861 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08007862 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7863 .type = HDA_FIXUP_PINS,
7864 .v.pins = (const struct hda_pintbl[]) {
7865 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7866 { }
7867 },
7868 .chained = true,
7869 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7870 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08007871 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7872 .type = HDA_FIXUP_PINS,
7873 .v.pins = (const struct hda_pintbl[]) {
7874 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7875 { }
7876 },
7877 .chained = true,
7878 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7879 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007880 [ALC299_FIXUP_PREDATOR_SPK] = {
7881 .type = HDA_FIXUP_PINS,
7882 .v.pins = (const struct hda_pintbl[]) {
7883 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7884 { }
7885 }
7886 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02007887 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7888 .type = HDA_FIXUP_PINS,
7889 .v.pins = (const struct hda_pintbl[]) {
7890 { 0x19, 0x04a11040 },
7891 { 0x21, 0x04211020 },
7892 { }
7893 },
7894 .chained = true,
7895 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7896 },
Kailang Yange79c2262019-12-19 14:12:15 +08007897 [ALC289_FIXUP_DELL_SPK2] = {
7898 .type = HDA_FIXUP_PINS,
7899 .v.pins = (const struct hda_pintbl[]) {
7900 { 0x17, 0x90170130 }, /* bass spk */
7901 { }
7902 },
7903 .chained = true,
7904 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7905 },
7906 [ALC289_FIXUP_DUAL_SPK] = {
7907 .type = HDA_FIXUP_FUNC,
7908 .v.func = alc285_fixup_speaker2_to_dac1,
7909 .chained = true,
7910 .chain_id = ALC289_FIXUP_DELL_SPK2
7911 },
Chris Chiu48e01502019-12-30 11:11:18 +08007912 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7913 .type = HDA_FIXUP_FUNC,
7914 .v.func = alc285_fixup_speaker2_to_dac1,
7915 .chained = true,
7916 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7917 },
7918 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007919 .type = HDA_FIXUP_FUNC,
7920 /* The GPIO must be pulled to initialize the AMP */
7921 .v.func = alc_fixup_gpio4,
7922 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08007923 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007924 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007925 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7926 .type = HDA_FIXUP_FUNC,
7927 .v.func = alc285_fixup_thinkpad_x1_gen7,
7928 .chained = true,
7929 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7930 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08007931 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7932 .type = HDA_FIXUP_FUNC,
7933 .v.func = alc_fixup_headset_jack,
7934 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007935 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08007936 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007937 [ALC294_FIXUP_ASUS_HPE] = {
7938 .type = HDA_FIXUP_VERBS,
7939 .v.verbs = (const struct hda_verb[]) {
7940 /* Set EAPD high */
7941 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7942 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7943 { }
7944 },
7945 .chained = true,
7946 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7947 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007948 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7949 .type = HDA_FIXUP_PINS,
7950 .v.pins = (const struct hda_pintbl[]) {
7951 { 0x19, 0x03a11050 }, /* front HP mic */
7952 { 0x1a, 0x01a11830 }, /* rear external mic */
7953 { 0x21, 0x03211020 }, /* front HP out */
7954 { }
7955 },
7956 .chained = true,
7957 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7958 },
7959 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7960 .type = HDA_FIXUP_VERBS,
7961 .v.verbs = (const struct hda_verb[]) {
7962 /* set 0x15 to HP-OUT ctrl */
7963 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7964 /* unmute the 0x15 amp */
7965 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7966 { }
7967 },
7968 .chained = true,
7969 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7970 },
7971 [ALC294_FIXUP_ASUS_GX502_HP] = {
7972 .type = HDA_FIXUP_FUNC,
7973 .v.func = alc294_fixup_gx502_hp,
7974 },
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05007975 [ALC294_FIXUP_ASUS_GU502_PINS] = {
7976 .type = HDA_FIXUP_PINS,
7977 .v.pins = (const struct hda_pintbl[]) {
7978 { 0x19, 0x01a11050 }, /* rear HP mic */
7979 { 0x1a, 0x01a11830 }, /* rear external mic */
7980 { 0x21, 0x012110f0 }, /* rear HP out */
7981 { }
7982 },
7983 .chained = true,
7984 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
7985 },
7986 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
7987 .type = HDA_FIXUP_VERBS,
7988 .v.verbs = (const struct hda_verb[]) {
7989 /* set 0x15 to HP-OUT ctrl */
7990 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7991 /* unmute the 0x15 amp */
7992 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7993 /* set 0x1b to HP-OUT */
7994 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
7995 { }
7996 },
7997 .chained = true,
7998 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
7999 },
8000 [ALC294_FIXUP_ASUS_GU502_HP] = {
8001 .type = HDA_FIXUP_FUNC,
8002 .v.func = alc294_fixup_gu502_hp,
8003 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02008004 [ALC294_FIXUP_ASUS_COEF_1B] = {
8005 .type = HDA_FIXUP_VERBS,
8006 .v.verbs = (const struct hda_verb[]) {
8007 /* Set bit 10 to correct noisy output after reboot from
8008 * Windows 10 (due to pop noise reduction?)
8009 */
8010 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8011 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8012 { }
8013 },
Takashi Iwaif8fbcdf2021-06-20 08:59:52 +02008014 .chained = true,
8015 .chain_id = ALC289_FIXUP_ASUS_GA401,
Takashi Iwai1b94e592020-05-12 09:32:03 +02008016 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08008017 [ALC285_FIXUP_HP_GPIO_LED] = {
8018 .type = HDA_FIXUP_FUNC,
8019 .v.func = alc285_fixup_hp_gpio_led,
8020 },
Kailang Yang431e76c2020-04-07 14:40:20 +08008021 [ALC285_FIXUP_HP_MUTE_LED] = {
8022 .type = HDA_FIXUP_FUNC,
8023 .v.func = alc285_fixup_hp_mute_led,
8024 },
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008025 [ALC236_FIXUP_HP_GPIO_LED] = {
8026 .type = HDA_FIXUP_FUNC,
8027 .v.func = alc236_fixup_hp_gpio_led,
8028 },
Kailang Yang24164f42020-04-07 14:52:42 +08008029 [ALC236_FIXUP_HP_MUTE_LED] = {
8030 .type = HDA_FIXUP_FUNC,
8031 .v.func = alc236_fixup_hp_mute_led,
8032 },
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008033 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8034 .type = HDA_FIXUP_FUNC,
8035 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8036 },
Mike Pozulp14425f12020-05-09 20:28:37 -07008037 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8038 .type = HDA_FIXUP_VERBS,
8039 .v.verbs = (const struct hda_verb[]) {
8040 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8041 { }
8042 },
8043 },
Chris Chiu9e433422020-05-12 14:15:24 +08008044 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8045 .type = HDA_FIXUP_PINS,
8046 .v.pins = (const struct hda_pintbl[]) {
8047 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8048 { }
8049 },
8050 .chained = true,
8051 .chain_id = ALC269_FIXUP_HEADSET_MODE
8052 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008053 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8054 .type = HDA_FIXUP_PINS,
8055 .v.pins = (const struct hda_pintbl[]) {
8056 { 0x14, 0x90100120 }, /* use as internal speaker */
8057 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8058 { 0x1a, 0x01011020 }, /* use as line out */
8059 { },
8060 },
8061 .chained = true,
8062 .chain_id = ALC269_FIXUP_HEADSET_MIC
8063 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008064 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8065 .type = HDA_FIXUP_PINS,
8066 .v.pins = (const struct hda_pintbl[]) {
8067 { 0x18, 0x02a11030 }, /* use as headset mic */
8068 { }
8069 },
8070 .chained = true,
8071 .chain_id = ALC269_FIXUP_HEADSET_MIC
8072 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008073 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8074 .type = HDA_FIXUP_PINS,
8075 .v.pins = (const struct hda_pintbl[]) {
8076 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8077 { }
8078 },
8079 .chained = true,
8080 .chain_id = ALC269_FIXUP_HEADSET_MIC
8081 },
Armas Spann293a92c2020-07-24 16:08:37 +02008082 [ALC289_FIXUP_ASUS_GA401] = {
Takashi Iwaic84bfed2020-11-27 15:11:04 +01008083 .type = HDA_FIXUP_FUNC,
8084 .v.func = alc289_fixup_asus_ga401,
8085 .chained = true,
8086 .chain_id = ALC289_FIXUP_ASUS_GA502,
Armas Spannff536642020-07-11 13:05:57 +02008087 },
Armas Spann4b43d052020-07-24 16:06:16 +02008088 [ALC289_FIXUP_ASUS_GA502] = {
8089 .type = HDA_FIXUP_PINS,
8090 .v.pins = (const struct hda_pintbl[]) {
8091 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8092 { }
8093 },
8094 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008095 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8096 .type = HDA_FIXUP_PINS,
8097 .v.pins = (const struct hda_pintbl[]) {
8098 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8099 { }
8100 },
8101 .chained = true,
8102 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8103 },
Kailang Yang56496252020-07-29 15:09:27 +08008104 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8105 .type = HDA_FIXUP_FUNC,
8106 .v.func = alc285_fixup_hp_gpio_amp_init,
8107 .chained = true,
8108 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8109 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008110 [ALC269_FIXUP_CZC_B20] = {
8111 .type = HDA_FIXUP_PINS,
8112 .v.pins = (const struct hda_pintbl[]) {
8113 { 0x12, 0x411111f0 },
8114 { 0x14, 0x90170110 }, /* speaker */
8115 { 0x15, 0x032f1020 }, /* HP out */
8116 { 0x17, 0x411111f0 },
8117 { 0x18, 0x03ab1040 }, /* mic */
8118 { 0x19, 0xb7a7013f },
8119 { 0x1a, 0x0181305f },
8120 { 0x1b, 0x411111f0 },
8121 { 0x1d, 0x411111f0 },
8122 { 0x1e, 0x411111f0 },
8123 { }
8124 },
8125 .chain_id = ALC269_FIXUP_DMIC,
8126 },
8127 [ALC269_FIXUP_CZC_TMI] = {
8128 .type = HDA_FIXUP_PINS,
8129 .v.pins = (const struct hda_pintbl[]) {
8130 { 0x12, 0x4000c000 },
8131 { 0x14, 0x90170110 }, /* speaker */
8132 { 0x15, 0x0421401f }, /* HP out */
8133 { 0x17, 0x411111f0 },
8134 { 0x18, 0x04a19020 }, /* mic */
8135 { 0x19, 0x411111f0 },
8136 { 0x1a, 0x411111f0 },
8137 { 0x1b, 0x411111f0 },
8138 { 0x1d, 0x40448505 },
8139 { 0x1e, 0x411111f0 },
8140 { 0x20, 0x8000ffff },
8141 { }
8142 },
8143 .chain_id = ALC269_FIXUP_DMIC,
8144 },
8145 [ALC269_FIXUP_CZC_L101] = {
8146 .type = HDA_FIXUP_PINS,
8147 .v.pins = (const struct hda_pintbl[]) {
8148 { 0x12, 0x40000000 },
8149 { 0x14, 0x01014010 }, /* speaker */
8150 { 0x15, 0x411111f0 }, /* HP out */
8151 { 0x16, 0x411111f0 },
8152 { 0x18, 0x01a19020 }, /* mic */
8153 { 0x19, 0x02a19021 },
8154 { 0x1a, 0x0181302f },
8155 { 0x1b, 0x0221401f },
8156 { 0x1c, 0x411111f0 },
8157 { 0x1d, 0x4044c601 },
8158 { 0x1e, 0x411111f0 },
8159 { }
8160 },
8161 .chain_id = ALC269_FIXUP_DMIC,
8162 },
8163 [ALC269_FIXUP_LEMOTE_A1802] = {
8164 .type = HDA_FIXUP_PINS,
8165 .v.pins = (const struct hda_pintbl[]) {
8166 { 0x12, 0x40000000 },
8167 { 0x14, 0x90170110 }, /* speaker */
8168 { 0x17, 0x411111f0 },
8169 { 0x18, 0x03a19040 }, /* mic1 */
8170 { 0x19, 0x90a70130 }, /* mic2 */
8171 { 0x1a, 0x411111f0 },
8172 { 0x1b, 0x411111f0 },
8173 { 0x1d, 0x40489d2d },
8174 { 0x1e, 0x411111f0 },
8175 { 0x20, 0x0003ffff },
8176 { 0x21, 0x03214020 },
8177 { }
8178 },
8179 .chain_id = ALC269_FIXUP_DMIC,
8180 },
8181 [ALC269_FIXUP_LEMOTE_A190X] = {
8182 .type = HDA_FIXUP_PINS,
8183 .v.pins = (const struct hda_pintbl[]) {
8184 { 0x14, 0x99130110 }, /* speaker */
8185 { 0x15, 0x0121401f }, /* HP out */
8186 { 0x18, 0x01a19c20 }, /* rear mic */
8187 { 0x19, 0x99a3092f }, /* front mic */
8188 { 0x1b, 0x0201401f }, /* front lineout */
8189 { }
8190 },
8191 .chain_id = ALC269_FIXUP_DMIC,
8192 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008193 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8194 .type = HDA_FIXUP_PINS,
8195 .v.pins = (const struct hda_pintbl[]) {
8196 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8197 { }
8198 },
8199 .chained = true,
8200 .chain_id = ALC269_FIXUP_HEADSET_MODE
8201 },
Werner Sembach73e71612021-03-02 19:04:14 +01008202 [ALC256_FIXUP_INTEL_NUC10] = {
8203 .type = HDA_FIXUP_PINS,
8204 .v.pins = (const struct hda_pintbl[]) {
8205 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8206 { }
8207 },
8208 .chained = true,
8209 .chain_id = ALC269_FIXUP_HEADSET_MODE
8210 },
Hui Wangfc19d552020-09-09 10:00:41 +08008211 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8212 .type = HDA_FIXUP_VERBS,
8213 .v.verbs = (const struct hda_verb[]) {
8214 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8215 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8216 { }
8217 },
8218 .chained = true,
Takashi Iwaic84bfed2020-11-27 15:11:04 +01008219 .chain_id = ALC289_FIXUP_ASUS_GA502
Hui Wangfc19d552020-09-09 10:00:41 +08008220 },
Hui Wang13468bf2020-09-28 16:01:17 +08008221 [ALC274_FIXUP_HP_MIC] = {
8222 .type = HDA_FIXUP_VERBS,
8223 .v.verbs = (const struct hda_verb[]) {
8224 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8225 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8226 { }
8227 },
8228 },
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008229 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8230 .type = HDA_FIXUP_FUNC,
8231 .v.func = alc274_fixup_hp_headset_mic,
8232 .chained = true,
8233 .chain_id = ALC274_FIXUP_HP_MIC
8234 },
Takashi Iwai622464c2021-05-04 11:18:02 +02008235 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8236 .type = HDA_FIXUP_FUNC,
8237 .v.func = alc274_fixup_hp_envy_gpio,
8238 },
Kailang Yangef9ce662020-11-03 15:40:35 +08008239 [ALC256_FIXUP_ASUS_HPE] = {
8240 .type = HDA_FIXUP_VERBS,
8241 .v.verbs = (const struct hda_verb[]) {
8242 /* Set EAPD high */
8243 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8244 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8245 { }
8246 },
8247 .chained = true,
8248 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8249 },
Kailang Yang446b8182020-11-02 15:00:12 +08008250 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8251 .type = HDA_FIXUP_FUNC,
8252 .v.func = alc_fixup_headset_jack,
8253 .chained = true,
8254 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8255 },
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008256 [ALC287_FIXUP_HP_GPIO_LED] = {
8257 .type = HDA_FIXUP_FUNC,
8258 .v.func = alc287_fixup_hp_gpio_led,
8259 },
Kailang Yang9e885772020-11-03 15:30:51 +08008260 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8261 .type = HDA_FIXUP_FUNC,
8262 .v.func = alc274_fixup_hp_headset_mic,
8263 },
Kailang Yang92666d42020-11-19 17:04:21 +08008264 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8265 .type = HDA_FIXUP_FUNC,
8266 .v.func = alc_fixup_no_int_mic,
8267 .chained = true,
8268 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8269 },
Chris Chiu34cdf402020-12-16 20:52:00 +08008270 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8271 .type = HDA_FIXUP_PINS,
8272 .v.pins = (const struct hda_pintbl[]) {
8273 { 0x1b, 0x411111f0 },
8274 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8275 { },
8276 },
8277 .chained = true,
8278 .chain_id = ALC269_FIXUP_HEADSET_MODE
8279 },
Chris Chiu495dc762021-01-14 16:27:28 +08008280 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8281 .type = HDA_FIXUP_FUNC,
8282 .v.func = alc269_fixup_limit_int_mic_boost,
8283 .chained = true,
8284 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8285 },
Chris Chiud0e18562021-02-26 09:04:40 +08008286 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8287 .type = HDA_FIXUP_PINS,
8288 .v.pins = (const struct hda_pintbl[]) {
8289 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8290 { 0x1a, 0x90a1092f }, /* use as internal mic */
8291 { }
8292 },
8293 .chained = true,
8294 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8295 },
Takashi Iwai26928ca2021-04-16 10:12:11 +02008296 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8297 .type = HDA_FIXUP_FUNC,
8298 .v.func = alc285_fixup_ideapad_s740_coef,
8299 .chained = true,
8300 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8301 },
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008302 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8303 .type = HDA_FIXUP_FUNC,
8304 .v.func = alc269_fixup_limit_int_mic_boost,
8305 .chained = true,
8306 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8307 },
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008308 [ALC295_FIXUP_ASUS_DACS] = {
8309 .type = HDA_FIXUP_FUNC,
8310 .v.func = alc295_fixup_asus_dacs,
8311 },
Takashi Iwai5d84b532021-05-04 14:18:32 +02008312 [ALC295_FIXUP_HP_OMEN] = {
8313 .type = HDA_FIXUP_PINS,
8314 .v.pins = (const struct hda_pintbl[]) {
8315 { 0x12, 0xb7a60130 },
8316 { 0x13, 0x40000000 },
8317 { 0x14, 0x411111f0 },
8318 { 0x16, 0x411111f0 },
8319 { 0x17, 0x90170110 },
8320 { 0x18, 0x411111f0 },
8321 { 0x19, 0x02a11030 },
8322 { 0x1a, 0x411111f0 },
8323 { 0x1b, 0x04a19030 },
8324 { 0x1d, 0x40600001 },
8325 { 0x1e, 0x411111f0 },
8326 { 0x21, 0x03211020 },
8327 {}
8328 },
8329 .chained = true,
8330 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8331 },
Elia Devitof2be77f2021-05-11 14:46:49 +02008332 [ALC285_FIXUP_HP_SPECTRE_X360] = {
Elia Devito434591b2021-06-19 22:41:04 +02008333 .type = HDA_FIXUP_FUNC,
8334 .v.func = alc285_fixup_hp_spectre_x360,
Elia Devitof2be77f2021-05-11 14:46:49 +02008335 },
Davide Baldod94befb2021-10-15 09:21:22 +02008336 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8337 .type = HDA_FIXUP_FUNC,
8338 .v.func = alc285_fixup_hp_spectre_x360_eb1
8339 },
Hui Wang9ebaef02021-05-22 12:26:45 +08008340 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8341 .type = HDA_FIXUP_FUNC,
8342 .v.func = alc285_fixup_ideapad_s740_coef,
8343 .chained = true,
8344 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8345 },
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008346 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8347 .type = HDA_FIXUP_FUNC,
8348 .v.func = alc_fixup_no_shutup,
8349 .chained = true,
8350 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8351 },
Hui Wang57c9e212021-06-08 10:46:00 +08008352 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8353 .type = HDA_FIXUP_PINS,
8354 .v.pins = (const struct hda_pintbl[]) {
8355 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8356 { }
8357 },
8358 .chained = true,
8359 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8360 },
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08008361 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8362 .type = HDA_FIXUP_FUNC,
8363 .v.func = alc269_fixup_limit_int_mic_boost,
8364 .chained = true,
8365 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8366 },
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07008367 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8368 .type = HDA_FIXUP_VERBS,
8369 //.v.verbs = legion_15imhg05_coefs,
8370 .v.verbs = (const struct hda_verb[]) {
8371 // set left speaker Legion 7i.
8372 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8373 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8374
8375 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8376 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8377 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8378 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8379 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8380
8381 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8382 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8383 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8384 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8385 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8386
8387 // set right speaker Legion 7i.
8388 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8389 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8390
8391 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8392 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8393 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8394 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8395 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8396
8397 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8398 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8399 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8400 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8401 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8402 {}
8403 },
8404 .chained = true,
8405 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8406 },
8407 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8408 .type = HDA_FIXUP_FUNC,
8409 .v.func = alc287_fixup_legion_15imhg05_speakers,
8410 .chained = true,
8411 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8412 },
8413 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8414 .type = HDA_FIXUP_VERBS,
8415 .v.verbs = (const struct hda_verb[]) {
8416 // set left speaker Yoga 7i.
8417 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8418 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8419
8420 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8421 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8422 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8423 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8424 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8425
8426 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8427 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8428 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8429 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8430 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8431
8432 // set right speaker Yoga 7i.
8433 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8434 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8435
8436 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8437 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8438 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8439 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8440 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8441
8442 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8443 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8444 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8445 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8446 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8447 {}
8448 },
8449 .chained = true,
8450 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8451 },
8452 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8453 .type = HDA_FIXUP_VERBS,
8454 .v.verbs = (const struct hda_verb[]) {
8455 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8456 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
Cameron Berkenpas023a0622021-10-10 15:54:11 -07008457 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07008458 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8459 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8460 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8461 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8462 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8463 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8464 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8465 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8466 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8467 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8468 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8469 {}
8470 },
8471 .chained = true,
8472 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8473 },
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02008474 [ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS] = {
8475 .type = HDA_FIXUP_FUNC,
8476 .v.func = alc256_fixup_tongfang_reset_persistent_settings,
8477 },
Johnathon Clark5fc462c2021-10-20 14:12:51 +01008478 [ALC245_FIXUP_HP_GPIO_LED] = {
8479 .type = HDA_FIXUP_FUNC,
8480 .v.func = alc245_fixup_hp_gpio_led,
8481 },
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06008482 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8483 .type = HDA_FIXUP_PINS,
8484 .v.pins = (const struct hda_pintbl[]) {
8485 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8486 { }
8487 },
8488 .chained = true,
8489 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8490 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02008491};
8492
8493static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01008494 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02008495 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8496 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008497 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02008498 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008499 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8500 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05008501 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01008502 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02008503 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Takashi Iwai433f8942021-04-28 13:26:56 +02008504 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
Takashi Iwaic8426b22021-04-07 11:57:30 +02008505 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
Chris Chiu13be30f2020-12-22 23:04:59 +08008506 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
Chris Chiu705b65f2018-12-05 14:48:54 +08008507 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008508 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01008509 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiu495dc762021-01-14 16:27:28 +08008510 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
Chris Chiuc7531e32019-03-21 17:17:31 +08008511 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8512 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiu13be30f2020-12-22 23:04:59 +08008513 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8514 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008515 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008516 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008517 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiud0e18562021-02-26 09:04:40 +08008518 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08008519 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8520 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8521 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Chris Chiud0e18562021-02-26 09:04:40 +08008522 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
Nikos Liolios35171fb2021-07-27 06:05:10 +03008523 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08008524 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08008525 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08008526 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jaroslav Kysela2a5bb692021-11-04 16:57:26 +01008527 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Alexander Monakov0d4867a2021-07-21 20:01:41 +03008528 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008529 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
Hui Wang57c9e212021-06-08 10:46:00 +08008530 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008531 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08008532 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01008533 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01008534 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02008535 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8536 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008537 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02008538 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8539 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8540 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01008541 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8542 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01008543 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02008544 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008545 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08008546 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8547 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08008548 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02008549 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02008550 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08008551 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08008552 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8553 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01008554 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8555 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8556 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8557 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8558 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08008559 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08008560 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01008561 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08008562 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08008563 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwai493de342017-02-28 17:27:57 +01008564 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008565 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Kailang Yang5f364132017-07-25 16:28:16 +08008566 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08008567 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8568 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08008569 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8570 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08008571 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08008572 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08008573 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08008574 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08008575 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008576 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08008577 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8578 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yang92666d42020-11-19 17:04:21 +08008579 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8580 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
Kailang Yangc1e89522020-12-23 15:34:57 +08008581 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
Kristin Pagetda946922021-08-14 15:46:05 -07008582 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
John Liueb676622021-09-30 13:53:16 +02008583 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
Chris Chiu2b987fe2021-10-01 14:28:56 +08008584 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8585 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
Kailang Yanga22aa262014-04-23 17:34:28 +08008586 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8587 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01008588 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008589 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01008590 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
Hui Wang7976eb42015-02-13 11:14:41 +08008591 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008592 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008593 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008594 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8595 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8596 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8597 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008598 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8599 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8600 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8601 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008602 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008603 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8604 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8605 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8606 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8607 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008608 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008609 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008610 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08008611 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008612 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8613 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8614 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008615 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8616 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8617 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8618 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8619 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008620 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008621 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008622 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008623 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008624 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08008625 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008626 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008627 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008628 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008629 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8630 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8631 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8632 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8633 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008634 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008635 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8636 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008637 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8638 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8639 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8640 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang8a02b162014-06-13 17:16:31 +08008641 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8642 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8643 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8644 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008645 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8646 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Kailang Yang1c9d9df2021-04-20 14:17:34 +08008647 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8648 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
Takashi Iwai563785e2018-11-12 09:43:12 +01008649 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08008650 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01008651 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Takashi Iwaiaeedad22020-11-28 10:00:15 +01008652 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008653 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8654 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05008655 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Carlos M901be142021-05-31 22:20:26 +02008656 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02008657 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai5d84b532021-05-04 14:18:32 +02008658 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
Sam Bazleyd33cd422019-09-01 03:31:30 +01008659 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Elia Devitof2be77f2021-05-11 14:46:49 +02008660 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
Takashi Iwai0ac05b22021-06-23 14:20:22 +02008661 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008662 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Takashi Iwai622464c2021-05-04 11:18:02 +02008663 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
Jeremy Szu15d295b2021-06-05 16:25:36 +08008664 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szu61d3e872021-06-05 16:25:37 +08008665 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 +08008666 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengc0584932021-11-10 22:40:32 +08008667 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008668 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008669 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Kailang Yang56496252020-07-29 15:09:27 +08008670 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Qiu Wenbo08befca2020-10-02 20:44:54 +08008671 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08008672 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08008673 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Jeremy Szu91bc1562021-01-06 21:05:46 +08008674 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8675 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8676 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8677 ALC285_FIXUP_HP_GPIO_AMP_INIT),
Takashi Iwai375f8422021-10-28 09:09:11 +02008678 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
Manuel Jiménez48422952020-12-29 15:38:56 +01008679 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008680 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Andy Chi2b70b262021-07-01 17:14:13 +08008681 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Andy Chifb3acdb2021-07-01 17:14:15 +08008682 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szu417eadf2021-03-30 19:44:27 +08008683 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008684 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8685 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
Johnathon Clark93ab3ea2021-08-23 17:21:10 +01008686 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008687 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Jeremy Szud07149a2021-08-10 18:08:45 +08008688 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szudfc2e8a2021-06-25 21:34:13 +08008689 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Davide Baldod94befb2021-10-15 09:21:22 +02008690 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8691 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
Jeremy Szu53b861b2021-03-16 17:42:35 +08008692 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuc3d2c882021-06-18 01:14:20 +08008693 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szudfb06402021-06-05 16:25:38 +08008694 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuca688332021-03-16 14:54:50 +08008695 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08008696 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8697 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 +08008698 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 +08008699 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 +08008700 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 +08008701 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 +08008702 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008703 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 +02008704 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008705 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02008706 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02008707 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01008708 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008709 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008710 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02008711 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008712 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008713 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiu5cfca592020-12-07 15:27:55 +08008714 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008715 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8716 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008717 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008718 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008719 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01008720 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01008721 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02008722 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008723 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
Chris Chiu48e01502019-12-30 11:11:18 +08008724 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Luke D Jones739d0952021-08-07 14:58:05 +12008725 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008726 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Daniel Drake8c8967a2019-10-17 16:15:01 +08008727 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08008728 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08008729 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Takashi Iwai4fad4fb2021-11-07 09:33:39 +01008730 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
Jian-Hong Pan5de3b942021-01-22 13:47:06 +08008731 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08008732 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08008733 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02008734 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06008735 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02008736 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02008737 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06008738 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008739 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008740 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Kailang Yangef9ce662020-11-03 15:40:35 +08008741 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
Armas Spann4b43d052020-07-24 16:06:16 +02008742 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05008743 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
Luke D Jones76fae612021-04-19 15:04:11 +12008744 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
Armas Spann293a92c2020-07-24 16:08:37 +02008745 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Chris Chiueeed4cd2017-02-28 14:17:15 -06008746 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02008747 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8748 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8749 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8750 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02008751 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008752 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8753 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8754 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02008755 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwaicab561f2021-04-28 13:26:59 +02008756 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8757 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai24519912011-08-16 15:08:49 +02008758 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02008759 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02008760 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01008761 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
Takashi Iwaic656f742021-04-28 13:27:01 +02008762 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
David Henningsson2041d562014-06-13 11:15:44 +02008763 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08008764 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
Takashi Iwaic656f742021-04-28 13:27:01 +02008765 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02008766 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
PeiSen Houce2e79b2020-12-31 11:57:28 +01008767 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8768 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09008769 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02008770 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07008771 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8772 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07008773 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09008774 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01008775 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09008776 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Takashi Iwaic656f742021-04-28 13:27:01 +02008777 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02008778 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8779 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01008780 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Chris Chiu6ca653e2020-12-22 23:04:58 +08008781 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008782 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02008783 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008784 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8785 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8786 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8787 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8788 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8789 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8790 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8791 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8792 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8793 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06008794 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8795 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008796 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8797 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8798 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8799 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8800 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06008801 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8802 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008803 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008804 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008805 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008806 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8807 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008808 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8809 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8810 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8811 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8812 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008813 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8814 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8815 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8816 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008817 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8818 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8819 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8820 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8821 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02008822 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8823 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8824 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8825 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8826 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008827 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8828 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8829 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8830 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8831 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8832 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8833 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008834 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008835 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8836 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02008837 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8838 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008839 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8840 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8841 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8842 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8843 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8844 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008845 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008846 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008847 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8848 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8849 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8850 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8851 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaif552ff52021-04-28 13:27:00 +02008852 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwaib590b382020-05-14 18:05:33 +02008853 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02008854 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02008855 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02008856 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02008857 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01008858 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02008859 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02008860 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05008861 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02008862 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01008863 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02008864 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01008865 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07008866 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02008867 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008868 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8869 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02008870 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02008871 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008872 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8873 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8874 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01008875 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008876 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8877 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8878 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01008879 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09008880 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02008881 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang Yang446b8182020-11-02 15:00:12 +08008882 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8883 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Kailang3694cb22015-12-28 11:35:24 +08008884 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08008885 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08008886 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02008887 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08008888 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08008889 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08008890 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08008891 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08008892 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8893 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Hui Wange4efa822021-07-19 11:02:31 +08008894 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Kailang Yangf86de9b2020-10-23 14:46:47 +08008895 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
Takashi Iwai26928ca2021-04-16 10:12:11 +02008896 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
Hui Wang9ebaef02021-05-22 12:26:45 +08008897 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07008898 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
8899 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8900 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
8901 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
David Henningsson56f27012016-01-11 09:33:14 +01008902 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01008903 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02008904 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaif552ff52021-04-28 13:27:00 +02008905 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
David Henningssona4a9e082013-08-16 14:09:01 +02008906 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02008907 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02008908 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008909 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02008910 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01008911 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02008912 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02008913 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08008914 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008915 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02008916 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008917 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008918 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8919 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8920 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008921 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008922 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8923 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008924 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008925 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008926 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8927 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8928 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02008929 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaic656f742021-04-28 13:27:01 +02008930 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8931 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02008932 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS),
Hui Wangfc19d552020-09-09 10:00:41 +08008933 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Xiaoliang Yub95bc122021-03-16 00:49:00 +08008934 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang695d1ec2019-11-21 10:54:27 +08008935 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Xiaoliang Yue1c86212021-03-13 07:54:53 +08008936 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Phil Calvind1ee66c2021-04-15 18:01:29 -04008937 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008938 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Werner Sembach73e71612021-03-02 19:04:14 +01008939 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008940
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01008941#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02008942 /* Below is a quirk table taken from the old code.
8943 * Basically the device should work as is without the fixup table.
8944 * If BIOS doesn't give a proper info, enable the corresponding
8945 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008946 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02008947 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8948 ALC269_FIXUP_AMIC),
8949 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008950 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8951 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8952 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8953 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8954 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8955 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8956 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8957 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8958 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8959 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8960 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8961 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8962 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8963 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8964 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8965 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8966 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8967 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8968 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8969 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8970 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8971 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8972 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8973 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8974 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8975 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8976 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8977 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8978 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8979 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8980 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8981 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8982 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8983 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8984 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8985 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8986 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8987 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8988#endif
8989 {}
8990};
8991
David Henningsson214eef72014-07-22 14:09:35 +02008992static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8993 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8994 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8995 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8996 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008997 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02008998 {}
8999};
9000
Takashi Iwai1727a772013-01-10 09:52:52 +01009001static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02009002 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9003 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02009004 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9005 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9006 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02009007 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02009008 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9009 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02009010 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02009011 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01009012 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01009013 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02009014 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9015 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009016 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9017 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08009018 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08009019 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02009020 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01009021 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02009022 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02009023 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009024 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02009025 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02009026 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009027 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9028 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9029 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9030 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9031 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9032 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9033 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9034 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9035 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9036 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9037 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9038 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9039 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9040 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9041 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9042 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9043 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9044 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9045 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9046 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9047 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9048 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9049 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9050 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9051 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9052 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9053 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9054 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9055 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9056 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9057 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9058 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9059 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9060 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9061 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9062 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9063 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9064 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9065 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9066 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01009067 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009068 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
Takashi Iwaic8426b22021-04-07 11:57:30 +02009069 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009070 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9071 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9072 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9073 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9074 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9075 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9076 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9077 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9078 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9079 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9080 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9081 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9082 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9083 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009084 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9085 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9086 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08009087 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009088 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01009089 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009090 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9091 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9092 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9093 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9094 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9095 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9096 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9097 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9098 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9099 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9100 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9101 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9102 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9103 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9104 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9105 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9106 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08009107 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9108 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01009109 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02009110 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02009111 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07009112 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08009113 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08009114 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01009115 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
Takashi Iwai5d84b532021-05-04 14:18:32 +02009116 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
Elia Devitof2be77f2021-05-11 14:46:49 +02009117 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
Davide Baldod94befb2021-10-15 09:21:22 +02009118 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
Hui Wang9ebaef02021-05-22 12:26:45 +08009119 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03009120 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
Hui Wang57c9e212021-06-08 10:46:00 +08009121 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02009122 {}
9123};
Kailang Yangcfc5a842016-02-03 15:20:39 +08009124#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08009125 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02009126
Hui Wange8191a82015-04-24 13:39:59 +08009127#define ALC256_STANDARD_PINS \
9128 {0x12, 0x90a60140}, \
9129 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08009130 {0x21, 0x02211020}
9131
David Henningssonfea185e2014-09-03 10:23:04 +02009132#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08009133 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08009134
David Henningssonfea185e2014-09-03 10:23:04 +02009135#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08009136 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02009137
9138#define ALC292_STANDARD_PINS \
9139 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08009140 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08009141
Hui Wang3f6409702016-09-11 11:26:16 +08009142#define ALC295_STANDARD_PINS \
9143 {0x12, 0xb7a60130}, \
9144 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08009145 {0x21, 0x04211020}
9146
Woodrow Shen703867e2015-08-05 12:34:12 +08009147#define ALC298_STANDARD_PINS \
9148 {0x12, 0x90a60130}, \
9149 {0x21, 0x03211020}
9150
Hui Wange1918932014-05-26 16:22:44 +08009151static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08009152 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9153 {0x14, 0x01014020},
9154 {0x17, 0x90170110},
9155 {0x18, 0x02a11030},
9156 {0x19, 0x0181303F},
9157 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06009158 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9159 {0x12, 0x90a601c0},
9160 {0x14, 0x90171120},
9161 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06009162 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9163 {0x14, 0x90170110},
9164 {0x1b, 0x90a70130},
9165 {0x21, 0x03211020}),
9166 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9167 {0x1a, 0x90a70130},
9168 {0x1b, 0x90170110},
9169 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01009170 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08009171 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08009172 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08009173 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01009174 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08009175 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08009176 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08009177 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08009178 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9179 ALC225_STANDARD_PINS,
9180 {0x12, 0xb7a60150},
9181 {0x14, 0x901701a0}),
9182 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9183 ALC225_STANDARD_PINS,
9184 {0x12, 0xb7a60150},
9185 {0x14, 0x901701b0}),
9186 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9187 ALC225_STANDARD_PINS,
9188 {0x12, 0xb7a60130},
9189 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05009190 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9191 {0x1b, 0x01111010},
9192 {0x1e, 0x01451130},
9193 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08009194 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9195 {0x12, 0x90a60140},
9196 {0x14, 0x90170110},
9197 {0x19, 0x02a11030},
9198 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08009199 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9200 {0x14, 0x90170110},
9201 {0x19, 0x02a11030},
9202 {0x1a, 0x02a11040},
9203 {0x1b, 0x01014020},
9204 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08009205 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9206 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08009207 {0x19, 0x02a11030},
9208 {0x1a, 0x02a11040},
9209 {0x1b, 0x01011020},
9210 {0x21, 0x0221101f}),
9211 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9212 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08009213 {0x19, 0x02a11020},
9214 {0x1a, 0x02a11030},
9215 {0x21, 0x0221101f}),
Kailang Yang92666d42020-11-19 17:04:21 +08009216 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9217 {0x21, 0x02211010}),
Kailang Yang9e885772020-11-03 15:30:51 +08009218 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9219 {0x14, 0x90170110},
9220 {0x19, 0x02a11020},
9221 {0x21, 0x02211030}),
Hui Wangc77900e2014-09-03 11:31:07 +08009222 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08009223 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08009224 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02009225 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08009226 {0x14, 0x90170130},
9227 {0x21, 0x02211040}),
9228 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02009229 {0x12, 0x90a60140},
9230 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02009231 {0x21, 0x02211020}),
9232 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9233 {0x12, 0x90a60160},
9234 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009235 {0x21, 0x02211030}),
9236 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08009237 {0x14, 0x90170110},
9238 {0x1b, 0x02011020},
9239 {0x21, 0x0221101f}),
9240 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08009241 {0x14, 0x90170110},
9242 {0x1b, 0x01011020},
9243 {0x21, 0x0221101f}),
9244 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02009245 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02009246 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02009247 {0x21, 0x0221103f}),
9248 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08009249 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08009250 {0x1b, 0x01011020},
9251 {0x21, 0x0221103f}),
9252 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9253 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08009254 {0x1b, 0x02011020},
9255 {0x21, 0x0221103f}),
9256 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08009257 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009258 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009259 {0x21, 0x0221105f}),
9260 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08009261 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009262 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009263 {0x21, 0x0221101f}),
9264 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02009265 {0x12, 0x90a60160},
9266 {0x14, 0x90170120},
9267 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02009268 {0x21, 0x0321102f}),
9269 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9270 {0x12, 0x90a60160},
9271 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02009272 {0x21, 0x02211040}),
9273 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9274 {0x12, 0x90a60160},
9275 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02009276 {0x21, 0x02211050}),
9277 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9278 {0x12, 0x90a60170},
9279 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009280 {0x21, 0x02211030}),
9281 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9282 {0x12, 0x90a60170},
9283 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02009284 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08009285 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08009286 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08009287 {0x14, 0x90171130},
9288 {0x21, 0x02211040}),
9289 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9290 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08009291 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08009292 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02009293 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02009294 {0x12, 0x90a60180},
9295 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02009296 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08009297 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9298 {0x12, 0x90a60180},
9299 {0x14, 0x90170120},
9300 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08009301 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9302 {0x1b, 0x01011020},
9303 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06009304 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9305 {0x14, 0x90170110},
9306 {0x1b, 0x90a70130},
9307 {0x21, 0x04211020}),
9308 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9309 {0x14, 0x90170110},
9310 {0x1b, 0x90a70130},
9311 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08009312 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08009313 {0x12, 0x90a60130},
9314 {0x14, 0x90170110},
9315 {0x21, 0x03211020}),
9316 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08009317 {0x12, 0x90a60130},
9318 {0x14, 0x90170110},
9319 {0x21, 0x04211020}),
9320 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08009321 {0x1a, 0x90a70130},
9322 {0x1b, 0x90170110},
9323 {0x21, 0x03211020}),
Kailang Yang9e885772020-11-03 15:30:51 +08009324 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9325 {0x14, 0x90170110},
9326 {0x19, 0x02a11020},
9327 {0x21, 0x0221101f}),
Kailang Yang8a8de09c2020-10-27 16:46:38 +08009328 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9329 {0x17, 0x90170110},
9330 {0x19, 0x03a11030},
9331 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01009332 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9333 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01009334 {0x14, 0x90170110},
9335 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009336 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08009337 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9338 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08009339 {0x14, 0x90170110},
9340 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08009341 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08009342 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08009343 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02009344 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009345 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02009346 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02009347 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02009348 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08009349 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009350 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009351 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009352 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08009353 {0x21, 0x03211040}),
9354 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009355 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009356 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009357 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08009358 {0x21, 0x03211020}),
9359 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009360 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009361 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009362 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08009363 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08009364 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02009365 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08009366 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08009367 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08009368 {0x21, 0x04211020}),
Chris Chiu34cdf402020-12-16 20:52:00 +08009369 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9370 ALC282_STANDARD_PINS,
9371 {0x12, 0x90a609c0},
9372 {0x18, 0x03a11830},
9373 {0x19, 0x04a19831},
9374 {0x1a, 0x0481303f},
9375 {0x1b, 0x04211020},
9376 {0x21, 0x0321101f}),
9377 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9378 ALC282_STANDARD_PINS,
9379 {0x12, 0x90a60940},
9380 {0x18, 0x03a11830},
9381 {0x19, 0x04a19831},
9382 {0x1a, 0x0481303f},
9383 {0x1b, 0x04211020},
9384 {0x21, 0x0321101f}),
David Henningsson76c21322014-06-24 14:46:54 +02009385 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009386 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009387 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02009388 {0x21, 0x0321101f}),
9389 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9390 {0x12, 0x90a60160},
9391 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009392 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08009393 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009394 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08009395 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08009396 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08009397 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08009398 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Sami Loone266fd992021-05-01 12:07:53 +02009399 {0x12, 0x90a60130},
9400 {0x14, 0x90170110},
9401 {0x19, 0x04a11040},
9402 {0x21, 0x04211020}),
9403 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9404 {0x14, 0x90170110},
9405 {0x19, 0x04a11040},
9406 {0x1d, 0x40600001},
9407 {0x21, 0x04211020}),
9408 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Hui Wangc4cfcf62018-11-26 14:17:16 +08009409 {0x14, 0x90170110},
9410 {0x19, 0x04a11040},
9411 {0x21, 0x04211020}),
Hui Wangc72b9bf2020-12-05 13:11:30 +08009412 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9413 {0x14, 0x90170110},
9414 {0x17, 0x90170111},
9415 {0x19, 0x03a11030},
9416 {0x21, 0x03211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08009417 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9418 {0x12, 0x90a60130},
9419 {0x17, 0x90170110},
9420 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02009421 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08009422 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08009423 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08009424 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08009425 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009426 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009427 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009428 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08009429 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009430 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009431 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009432 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009433 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08009434 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009435 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009436 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009437 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009438 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009439 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009440 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009441 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009442 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009443 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009444 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009445 {0x14, 0x90170110},
9446 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009447 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009448 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009449 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009450 {0x14, 0x90170110},
9451 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009452 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009453 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009454 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009455 {0x14, 0x90170110},
9456 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009457 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08009458 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009459 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009460 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009461 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08009462 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08009463 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009464 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009465 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009466 {0x16, 0x01014020},
9467 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08009468 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02009469 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009470 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009471 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02009472 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009473 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009474 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02009475 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08009476 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02009477 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009478 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009479 {0x13, 0x90a60140}),
Jian-Hong Paneeacd802020-11-24 17:20:25 +08009480 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9481 {0x17, 0x90170110},
9482 {0x21, 0x04211020}),
Chris Chiud8ae4582018-12-07 17:17:11 +08009483 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9484 {0x14, 0x90170110},
9485 {0x1b, 0x90a70130},
9486 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009487 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9488 {0x12, 0x90a60130},
9489 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08009490 {0x21, 0x03211020}),
9491 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9492 {0x12, 0x90a60130},
9493 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009494 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02009495 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9496 {0x12, 0x90a60130},
9497 {0x17, 0x90170110},
9498 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08009499 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08009500 {0x12, 0x90a60120},
9501 {0x17, 0x90170110},
9502 {0x21, 0x04211030}),
9503 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08009504 {0x12, 0x90a60130},
9505 {0x17, 0x90170110},
9506 {0x21, 0x03211020}),
9507 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9508 {0x12, 0x90a60130},
9509 {0x17, 0x90170110},
9510 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009511 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08009512 {0x14, 0x90170110},
9513 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009514 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9515 {0x14, 0x90170110},
9516 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08009517 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08009518 ALC295_STANDARD_PINS,
9519 {0x17, 0x21014020},
9520 {0x18, 0x21a19030}),
9521 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9522 ALC295_STANDARD_PINS,
9523 {0x17, 0x21014040},
9524 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08009525 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9526 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08009527 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08009528 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009529 {0x17, 0x90170110}),
9530 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9531 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08009532 {0x17, 0x90170140}),
9533 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9534 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009535 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08009536 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9537 {0x12, 0xb7a60140},
9538 {0x13, 0xb7a60150},
9539 {0x17, 0x90170110},
9540 {0x1a, 0x03011020},
9541 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00009542 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9543 {0x12, 0xb7a60140},
9544 {0x17, 0x90170110},
9545 {0x1a, 0x03a11030},
9546 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08009547 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9548 ALC225_STANDARD_PINS,
9549 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08009550 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08009551 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9552 {0x14, 0x01014010},
9553 {0x17, 0x90170120},
9554 {0x18, 0x02a11030},
9555 {0x19, 0x02a1103f},
9556 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08009557 {}
9558};
Takashi Iwai1d045db2011-07-07 18:23:21 +02009559
Hui Wang7c0a6932019-08-16 14:27:40 +08009560/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9561 * more machines, don't need to match all valid pins, just need to match
9562 * all the pins defined in the tbl. Just because of this reason, it is possible
9563 * that a single machine matches multiple tbls, so there is one limitation:
9564 * at most one tbl is allowed to define for the same vendor and same codec
9565 */
9566static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9567 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9568 {0x19, 0x40000000},
9569 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08009570 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9571 {0x19, 0x40000000},
9572 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08009573 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9574 {0x19, 0x40000000},
9575 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08009576 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9577 {0x19, 0x40000000},
9578 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08009579 {}
9580};
9581
Takashi Iwai546bb672012-03-07 08:37:19 +01009582static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02009583{
Kailang Yang526af6e2012-03-07 08:25:20 +01009584 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009585 int val;
9586
Kailang Yang526af6e2012-03-07 08:25:20 +01009587 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01009588 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01009589
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009590 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009591 alc_write_coef_idx(codec, 0xf, 0x960b);
9592 alc_write_coef_idx(codec, 0xe, 0x8817);
9593 }
9594
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009595 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009596 alc_write_coef_idx(codec, 0xf, 0x960b);
9597 alc_write_coef_idx(codec, 0xe, 0x8814);
9598 }
9599
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009600 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009601 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02009602 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009603 }
9604
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009605 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009606 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009607 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009608 /* Capless ramp up clock control */
9609 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9610 }
9611 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009612 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009613 /* Class D power on reset */
9614 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9615 }
9616 }
9617
Takashi Iwai98b24882014-08-18 13:47:50 +02009618 /* HP */
9619 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009620}
9621
9622/*
9623 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009624static int patch_alc269(struct hda_codec *codec)
9625{
9626 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02009627 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009628
Takashi Iwai3de95172012-05-07 18:03:15 +02009629 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009630 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02009631 return err;
9632
9633 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01009634 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08009635 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009636
Takashi Iwai225068a2015-05-29 10:42:14 +02009637#ifdef CONFIG_PM
9638 codec->patch_ops.suspend = alc269_suspend;
9639 codec->patch_ops.resume = alc269_resume;
9640#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08009641 spec->shutup = alc_default_shutup;
9642 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02009643
Takashi Iwai7639a062015-03-03 10:07:24 +01009644 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01009645 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009646 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009647 switch (alc_get_coef0(codec) & 0x00f0) {
9648 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009649 if (codec->bus->pci &&
9650 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009651 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009652 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009653 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009654 break;
9655 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009656 if (codec->bus->pci &&
9657 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009658 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009659 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009660 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009661 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02009662 case 0x0030:
9663 spec->codec_variant = ALC269_TYPE_ALC269VD;
9664 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009665 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009666 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009667 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009668 if (err < 0)
9669 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08009670 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01009671 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009672 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01009673 break;
9674
9675 case 0x10ec0280:
9676 case 0x10ec0290:
9677 spec->codec_variant = ALC269_TYPE_ALC280;
9678 break;
9679 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01009680 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08009681 spec->shutup = alc282_shutup;
9682 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01009683 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02009684 case 0x10ec0233:
9685 case 0x10ec0283:
9686 spec->codec_variant = ALC269_TYPE_ALC283;
9687 spec->shutup = alc283_shutup;
9688 spec->init_hook = alc283_init;
9689 break;
Kailang Yang065380f2013-01-10 10:25:48 +01009690 case 0x10ec0284:
9691 case 0x10ec0292:
9692 spec->codec_variant = ALC269_TYPE_ALC284;
9693 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02009694 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08009695 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02009696 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02009697 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08009698 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02009699 spec->codec_variant = ALC269_TYPE_ALC286;
9700 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08009701 case 0x10ec0298:
9702 spec->codec_variant = ALC269_TYPE_ALC298;
9703 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08009704 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009705 case 0x10ec0255:
9706 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08009707 spec->shutup = alc256_shutup;
9708 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009709 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02009710 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08009711 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08009712 case 0x10ec0256:
9713 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08009714 spec->shutup = alc256_shutup;
9715 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02009716 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08009717 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009718 case 0x10ec0257:
9719 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08009720 spec->shutup = alc256_shutup;
9721 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009722 spec->gen.mixer_nid = 0;
9723 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009724 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +08009725 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009726 case 0x10ec0285:
9727 case 0x10ec0289:
9728 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08009729 spec->shutup = alc225_shutup;
9730 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009731 spec->gen.mixer_nid = 0;
9732 break;
Kailang Yang42314302016-02-03 15:03:50 +08009733 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08009734 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08009735 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08009736 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08009737 spec->shutup = alc225_shutup;
9738 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01009739 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08009740 break;
Kailang Yang99cee0342021-07-01 09:09:37 +08009741 case 0x10ec0287:
9742 spec->codec_variant = ALC269_TYPE_ALC287;
9743 spec->shutup = alc225_shutup;
9744 spec->init_hook = alc225_init;
9745 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
9746 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009747 case 0x10ec0234:
9748 case 0x10ec0274:
9749 case 0x10ec0294:
9750 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08009751 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08009752 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08009753 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009754 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08009755 case 0x10ec0300:
9756 spec->codec_variant = ALC269_TYPE_ALC300;
9757 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009758 break;
Kailang Yangf0778872019-10-24 15:13:32 +08009759 case 0x10ec0623:
9760 spec->codec_variant = ALC269_TYPE_ALC623;
9761 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08009762 case 0x10ec0700:
9763 case 0x10ec0701:
9764 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +08009765 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +08009766 spec->codec_variant = ALC269_TYPE_ALC700;
9767 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08009768 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08009769 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08009770 break;
9771
Takashi Iwai1d045db2011-07-07 18:23:21 +02009772 }
9773
Kailang Yangad60d502013-06-28 12:03:01 +02009774 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05009775 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02009776 spec->init_hook = alc5505_dsp_init;
9777 }
9778
Takashi Iwaic9af7532019-05-10 11:01:43 +02009779 alc_pre_init(codec);
9780
Takashi Iwaiefe55732018-06-15 11:55:02 +02009781 snd_hda_pick_fixup(codec, alc269_fixup_models,
9782 alc269_fixup_tbl, alc269_fixups);
Takashi Iwai13d9c6b2021-08-20 16:32:14 +02009783 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
9784 * the quirk breaks the latter (bko#214101).
9785 * Clear the wrong entry.
9786 */
9787 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
9788 codec->core.vendor_id == 0x10ec0294) {
9789 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
9790 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
9791 }
9792
Hui Wang0fc1e442019-08-16 14:27:39 +08009793 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +08009794 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +02009795 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9796 alc269_fixups);
9797 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9798
9799 alc_auto_parse_customize_define(codec);
9800
9801 if (has_cdefine_beep(codec))
9802 spec->gen.beep_nid = 0x01;
9803
Takashi Iwaia4297b52011-08-23 18:40:12 +02009804 /* automatic parse from the BIOS config */
9805 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009806 if (err < 0)
9807 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009808
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009809 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9810 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9811 if (err < 0)
9812 goto error;
9813 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009814
Takashi Iwai1727a772013-01-10 09:52:52 +01009815 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009816
Takashi Iwai1d045db2011-07-07 18:23:21 +02009817 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009818
9819 error:
9820 alc_free(codec);
9821 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009822}
9823
9824/*
9825 * ALC861
9826 */
9827
Takashi Iwai1d045db2011-07-07 18:23:21 +02009828static int alc861_parse_auto_config(struct hda_codec *codec)
9829{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009830 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009831 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9832 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009833}
9834
Takashi Iwai1d045db2011-07-07 18:23:21 +02009835/* Pin config fixes */
9836enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009837 ALC861_FIXUP_FSC_AMILO_PI1505,
9838 ALC861_FIXUP_AMP_VREF_0F,
9839 ALC861_FIXUP_NO_JACK_DETECT,
9840 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009841 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009842};
9843
Takashi Iwai31150f22012-01-30 10:54:08 +01009844/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9845static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009846 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01009847{
9848 struct alc_spec *spec = codec->spec;
9849 unsigned int val;
9850
Takashi Iwai1727a772013-01-10 09:52:52 +01009851 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01009852 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01009853 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01009854 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9855 val |= AC_PINCTL_IN_EN;
9856 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02009857 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01009858 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01009859}
9860
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009861/* suppress the jack-detection */
9862static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009863 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009864{
Takashi Iwai1727a772013-01-10 09:52:52 +01009865 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009866 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009867}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009868
Takashi Iwai1727a772013-01-10 09:52:52 +01009869static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009870 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009871 .type = HDA_FIXUP_PINS,
9872 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009873 { 0x0b, 0x0221101f }, /* HP */
9874 { 0x0f, 0x90170310 }, /* speaker */
9875 { }
9876 }
9877 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009878 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009879 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01009880 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01009881 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009882 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009883 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009884 .v.func = alc_fixup_no_jack_detect,
9885 },
9886 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009887 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009888 .v.func = alc861_fixup_asus_amp_vref_0f,
9889 .chained = true,
9890 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009891 },
9892 [ALC660_FIXUP_ASUS_W7J] = {
9893 .type = HDA_FIXUP_VERBS,
9894 .v.verbs = (const struct hda_verb[]) {
9895 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9896 * for enabling outputs
9897 */
9898 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9899 { }
9900 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009901 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009902};
9903
9904static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009905 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01009906 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009907 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9908 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9909 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
Takashi Iwaidefce242021-04-28 13:27:03 +02009910 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009911 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009912 {}
9913};
9914
9915/*
9916 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009917static int patch_alc861(struct hda_codec *codec)
9918{
9919 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009920 int err;
9921
Takashi Iwai3de95172012-05-07 18:03:15 +02009922 err = alc_alloc_spec(codec, 0x15);
9923 if (err < 0)
9924 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009925
Takashi Iwai3de95172012-05-07 18:03:15 +02009926 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009927 if (has_cdefine_beep(codec))
9928 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009929
Takashi Iwai225068a2015-05-29 10:42:14 +02009930#ifdef CONFIG_PM
9931 spec->power_hook = alc_power_eapd;
9932#endif
9933
Takashi Iwaic9af7532019-05-10 11:01:43 +02009934 alc_pre_init(codec);
9935
Takashi Iwai1727a772013-01-10 09:52:52 +01009936 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9937 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009938
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009939 /* automatic parse from the BIOS config */
9940 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009941 if (err < 0)
9942 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009943
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009944 if (!spec->gen.no_analog) {
9945 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9946 if (err < 0)
9947 goto error;
9948 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009949
Takashi Iwai1727a772013-01-10 09:52:52 +01009950 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009951
Takashi Iwai1d045db2011-07-07 18:23:21 +02009952 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009953
9954 error:
9955 alc_free(codec);
9956 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009957}
9958
9959/*
9960 * ALC861-VD support
9961 *
9962 * Based on ALC882
9963 *
9964 * In addition, an independent DAC
9965 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009966static int alc861vd_parse_auto_config(struct hda_codec *codec)
9967{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009968 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009969 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9970 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009971}
9972
Takashi Iwai1d045db2011-07-07 18:23:21 +02009973enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009974 ALC660VD_FIX_ASUS_GPIO1,
9975 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009976};
9977
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009978/* exclude VREF80 */
9979static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009980 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009981{
Takashi Iwai1727a772013-01-10 09:52:52 +01009982 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01009983 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9984 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009985 }
9986}
9987
Takashi Iwaidf73d832018-06-19 23:05:47 +02009988/* reset GPIO1 */
9989static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9990 const struct hda_fixup *fix, int action)
9991{
9992 struct alc_spec *spec = codec->spec;
9993
9994 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9995 spec->gpio_mask |= 0x02;
9996 alc_fixup_gpio(codec, action, 0x01);
9997}
9998
Takashi Iwai1727a772013-01-10 09:52:52 +01009999static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +020010000 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +020010001 .type = HDA_FIXUP_FUNC,
10002 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +020010003 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010004 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010005 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010006 .v.func = alc861vd_fixup_dallas,
10007 },
Takashi Iwai1d045db2011-07-07 18:23:21 +020010008};
10009
10010static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010011 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +020010012 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010013 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +020010014 {}
10015};
10016
Takashi Iwai1d045db2011-07-07 18:23:21 +020010017/*
10018 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010019static int patch_alc861vd(struct hda_codec *codec)
10020{
10021 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +020010022 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010023
Takashi Iwai3de95172012-05-07 18:03:15 +020010024 err = alc_alloc_spec(codec, 0x0b);
10025 if (err < 0)
10026 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010027
Takashi Iwai3de95172012-05-07 18:03:15 +020010028 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +020010029 if (has_cdefine_beep(codec))
10030 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010031
Takashi Iwai225068a2015-05-29 10:42:14 +020010032 spec->shutup = alc_eapd_shutup;
10033
Takashi Iwaic9af7532019-05-10 11:01:43 +020010034 alc_pre_init(codec);
10035
Takashi Iwai1727a772013-01-10 09:52:52 +010010036 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10037 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +020010038
Takashi Iwaicb4e4822011-08-23 17:34:25 +020010039 /* automatic parse from the BIOS config */
10040 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010041 if (err < 0)
10042 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010043
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010044 if (!spec->gen.no_analog) {
10045 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10046 if (err < 0)
10047 goto error;
10048 }
Takashi Iwai1d045db2011-07-07 18:23:21 +020010049
Takashi Iwai1727a772013-01-10 09:52:52 +010010050 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010051
Takashi Iwai1d045db2011-07-07 18:23:21 +020010052 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010053
10054 error:
10055 alc_free(codec);
10056 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010057}
10058
10059/*
10060 * ALC662 support
10061 *
10062 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10063 * configuration. Each pin widget can choose any input DACs and a mixer.
10064 * Each ADC is connected from a mixer of all inputs. This makes possible
10065 * 6-channel independent captures.
10066 *
10067 * In addition, an independent DAC for the multi-playback (not used in this
10068 * driver yet).
10069 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010070
10071/*
10072 * BIOS auto configuration
10073 */
10074
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010075static int alc662_parse_auto_config(struct hda_codec *codec)
10076{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +020010077 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010078 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10079 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10080 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +020010081
Takashi Iwai7639a062015-03-03 10:07:24 +010010082 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10083 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10084 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010085 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +010010086 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010087 ssids = alc662_ssids;
10088 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010089}
10090
Todd Broch6be79482010-12-07 16:51:05 -080010091static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +010010092 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +010010093{
Takashi Iwai9bb1f062013-01-10 17:14:29 +010010094 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +010010095 return;
Todd Broch6be79482010-12-07 16:51:05 -080010096 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10097 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10098 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10099 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10100 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +010010101 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -080010102}
10103
Takashi Iwai8e383952013-10-30 17:41:12 +010010104static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10105 { .channels = 2,
10106 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10107 { .channels = 4,
10108 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10109 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10110 { }
10111};
10112
10113/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010114static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +010010115 const struct hda_fixup *fix, int action)
10116{
10117 if (action == HDA_FIXUP_ACT_BUILD) {
10118 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +010010119 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +010010120 }
10121}
10122
Takashi Iwaibf686652014-01-13 16:18:25 +010010123/* avoid D3 for keeping GPIO up */
10124static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10125 hda_nid_t nid,
10126 unsigned int power_state)
10127{
10128 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +020010129 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +010010130 return AC_PWRST_D0;
10131 return power_state;
10132}
10133
Takashi Iwai3e887f32014-01-10 17:50:58 +010010134static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10135 const struct hda_fixup *fix, int action)
10136{
10137 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +010010138
Takashi Iwai01e4a272018-06-19 22:47:30 +020010139 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +010010140 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +010010141 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +010010142 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +010010143 }
10144}
10145
Kailang Yangc6790c82016-11-25 16:15:17 +080010146static void alc662_usi_automute_hook(struct hda_codec *codec,
10147 struct hda_jack_callback *jack)
10148{
10149 struct alc_spec *spec = codec->spec;
10150 int vref;
10151 msleep(200);
10152 snd_hda_gen_hp_automute(codec, jack);
10153
10154 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10155 msleep(100);
10156 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10157 vref);
10158}
10159
10160static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10161 const struct hda_fixup *fix, int action)
10162{
10163 struct alc_spec *spec = codec->spec;
10164 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10165 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10166 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10167 }
10168}
10169
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010170static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10171 struct hda_jack_callback *cb)
10172{
10173 /* surround speakers at 0x1b already get muted automatically when
10174 * headphones are plugged in, but we have to mute/unmute the remaining
10175 * channels manually:
10176 * 0x15 - front left/front right
10177 * 0x18 - front center/ LFE
10178 */
10179 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10180 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10181 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10182 } else {
10183 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10184 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10185 }
10186}
10187
10188static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10189 const struct hda_fixup *fix, int action)
10190{
10191 /* Pin 0x1b: shared headphones jack and surround speakers */
10192 if (!is_jack_detectable(codec, 0x1b))
10193 return;
10194
10195 switch (action) {
10196 case HDA_FIXUP_ACT_PRE_PROBE:
10197 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10198 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +010010199 /* subwoofer needs an extra GPIO setting to become audible */
10200 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010201 break;
10202 case HDA_FIXUP_ACT_INIT:
10203 /* Make sure to start in a correct state, i.e. if
10204 * headphones have been plugged in before powering up the system
10205 */
10206 alc662_aspire_ethos_mute_speakers(codec, NULL);
10207 break;
10208 }
10209}
10210
Kailang Yang5af290282020-01-17 14:04:01 +080010211static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10212 const struct hda_fixup *fix, int action)
10213{
10214 struct alc_spec *spec = codec->spec;
10215
10216 static const struct hda_pintbl pincfgs[] = {
10217 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10218 { 0x1b, 0x0181304f },
10219 { }
10220 };
10221
10222 switch (action) {
10223 case HDA_FIXUP_ACT_PRE_PROBE:
10224 spec->gen.mixer_nid = 0;
10225 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10226 snd_hda_apply_pincfgs(codec, pincfgs);
10227 break;
10228 case HDA_FIXUP_ACT_INIT:
10229 alc_write_coef_idx(codec, 0x19, 0xa054);
10230 break;
10231 }
10232}
10233
Takashi Iwai6b0f95c2020-01-05 15:47:18 +010010234static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +080010235 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10236 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10237 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10238 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10239 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10240 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10241 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10242 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10243 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10244 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10245 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10246 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10247 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10248 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10249 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10250 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10251 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10252 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10253 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10254 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10255 {}
10256};
10257
10258static void alc668_restore_default_value(struct hda_codec *codec)
10259{
10260 alc_process_coef_fw(codec, alc668_coefs);
10261}
10262
David Henningsson6cb3b702010-09-09 08:51:44 +020010263enum {
Daniel T Chen2df03512010-10-10 22:39:28 -040010264 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +010010265 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +020010266 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -080010267 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010268 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010269 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +020010270 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010271 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +020010272 ALC662_FIXUP_ASUS_MODE1,
10273 ALC662_FIXUP_ASUS_MODE2,
10274 ALC662_FIXUP_ASUS_MODE3,
10275 ALC662_FIXUP_ASUS_MODE4,
10276 ALC662_FIXUP_ASUS_MODE5,
10277 ALC662_FIXUP_ASUS_MODE6,
10278 ALC662_FIXUP_ASUS_MODE7,
10279 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +010010280 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +020010281 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +020010282 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010283 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +020010284 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010285 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +020010286 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +010010287 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +010010288 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010289 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +010010290 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +080010291 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +020010292 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010293 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010294 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010295 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010296 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010297 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +020010298 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010299 ALC891_FIXUP_HEADSET_MODE,
10300 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010301 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010302 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +080010303 ALC662_FIXUP_USI_FUNC,
10304 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +080010305 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010306 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010307 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +080010308 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +080010309 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +080010310 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
Hui Wanga3fd1a92021-10-12 19:47:48 +080010311 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10312 ALC668_FIXUP_HEADSET_MIC,
10313 ALC668_FIXUP_MIC_DET_COEF,
David Henningsson6cb3b702010-09-09 08:51:44 +020010314};
10315
Takashi Iwai1727a772013-01-10 09:52:52 +010010316static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -040010317 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010318 .type = HDA_FIXUP_PINS,
10319 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -040010320 { 0x15, 0x99130112 }, /* subwoofer */
10321 { }
10322 }
10323 },
Takashi Iwai3e887f32014-01-10 17:50:58 +010010324 [ALC662_FIXUP_LED_GPIO1] = {
10325 .type = HDA_FIXUP_FUNC,
10326 .v.func = alc662_fixup_led_gpio1,
10327 },
David Henningsson6cb3b702010-09-09 08:51:44 +020010328 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010329 .type = HDA_FIXUP_PINS,
10330 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +020010331 { 0x17, 0x99130112 }, /* subwoofer */
10332 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +010010333 },
10334 .chained = true,
10335 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +020010336 },
Todd Broch6be79482010-12-07 16:51:05 -080010337 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010338 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +010010339 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010340 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010341 [ALC662_FIXUP_CZC_ET26] = {
10342 .type = HDA_FIXUP_PINS,
10343 .v.pins = (const struct hda_pintbl[]) {
10344 {0x12, 0x403cc000},
10345 {0x14, 0x90170110}, /* speaker */
10346 {0x15, 0x411111f0},
10347 {0x16, 0x411111f0},
10348 {0x18, 0x01a19030}, /* mic */
10349 {0x19, 0x90a7013f}, /* int-mic */
10350 {0x1a, 0x01014020},
10351 {0x1b, 0x0121401f},
10352 {0x1c, 0x411111f0},
10353 {0x1d, 0x411111f0},
10354 {0x1e, 0x40478e35},
10355 {}
10356 },
10357 .chained = true,
10358 .chain_id = ALC662_FIXUP_SKU_IGNORE
10359 },
Anisse Astierd2ebd472011-01-20 12:36:21 +010010360 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010361 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010362 .v.verbs = (const struct hda_verb[]) {
10363 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10364 {}
10365 }
10366 },
David Henningsson94024cd2011-04-29 14:10:55 +020010367 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010368 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +020010369 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +020010370 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010371 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010372 .type = HDA_FIXUP_PINS,
10373 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010374 { 0x14, 0x0221201f }, /* HP out */
10375 { }
10376 },
10377 .chained = true,
10378 .chain_id = ALC662_FIXUP_SKU_IGNORE
10379 },
Takashi Iwai53c334a2011-08-23 18:27:14 +020010380 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010381 .type = HDA_FIXUP_PINS,
10382 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010383 { 0x14, 0x99130110 }, /* speaker */
10384 { 0x18, 0x01a19c20 }, /* mic */
10385 { 0x19, 0x99a3092f }, /* int-mic */
10386 { 0x21, 0x0121401f }, /* HP out */
10387 { }
10388 },
10389 .chained = true,
10390 .chain_id = ALC662_FIXUP_SKU_IGNORE
10391 },
10392 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010393 .type = HDA_FIXUP_PINS,
10394 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010395 { 0x14, 0x99130110 }, /* speaker */
10396 { 0x18, 0x01a19820 }, /* mic */
10397 { 0x19, 0x99a3092f }, /* int-mic */
10398 { 0x1b, 0x0121401f }, /* HP out */
10399 { }
10400 },
Takashi Iwai53c334a2011-08-23 18:27:14 +020010401 .chained = true,
10402 .chain_id = ALC662_FIXUP_SKU_IGNORE
10403 },
10404 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010405 .type = HDA_FIXUP_PINS,
10406 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010407 { 0x14, 0x99130110 }, /* speaker */
10408 { 0x15, 0x0121441f }, /* HP */
10409 { 0x18, 0x01a19840 }, /* mic */
10410 { 0x19, 0x99a3094f }, /* int-mic */
10411 { 0x21, 0x01211420 }, /* HP2 */
10412 { }
10413 },
10414 .chained = true,
10415 .chain_id = ALC662_FIXUP_SKU_IGNORE
10416 },
10417 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010418 .type = HDA_FIXUP_PINS,
10419 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010420 { 0x14, 0x99130110 }, /* speaker */
10421 { 0x16, 0x99130111 }, /* speaker */
10422 { 0x18, 0x01a19840 }, /* mic */
10423 { 0x19, 0x99a3094f }, /* int-mic */
10424 { 0x21, 0x0121441f }, /* HP */
10425 { }
10426 },
10427 .chained = true,
10428 .chain_id = ALC662_FIXUP_SKU_IGNORE
10429 },
10430 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010431 .type = HDA_FIXUP_PINS,
10432 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010433 { 0x14, 0x99130110 }, /* speaker */
10434 { 0x15, 0x0121441f }, /* HP */
10435 { 0x16, 0x99130111 }, /* speaker */
10436 { 0x18, 0x01a19840 }, /* mic */
10437 { 0x19, 0x99a3094f }, /* int-mic */
10438 { }
10439 },
10440 .chained = true,
10441 .chain_id = ALC662_FIXUP_SKU_IGNORE
10442 },
10443 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010444 .type = HDA_FIXUP_PINS,
10445 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010446 { 0x14, 0x99130110 }, /* speaker */
10447 { 0x15, 0x01211420 }, /* HP2 */
10448 { 0x18, 0x01a19840 }, /* mic */
10449 { 0x19, 0x99a3094f }, /* int-mic */
10450 { 0x1b, 0x0121441f }, /* HP */
10451 { }
10452 },
10453 .chained = true,
10454 .chain_id = ALC662_FIXUP_SKU_IGNORE
10455 },
10456 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010457 .type = HDA_FIXUP_PINS,
10458 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010459 { 0x14, 0x99130110 }, /* speaker */
10460 { 0x17, 0x99130111 }, /* speaker */
10461 { 0x18, 0x01a19840 }, /* mic */
10462 { 0x19, 0x99a3094f }, /* int-mic */
10463 { 0x1b, 0x01214020 }, /* HP */
10464 { 0x21, 0x0121401f }, /* HP */
10465 { }
10466 },
10467 .chained = true,
10468 .chain_id = ALC662_FIXUP_SKU_IGNORE
10469 },
10470 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010471 .type = HDA_FIXUP_PINS,
10472 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010473 { 0x14, 0x99130110 }, /* speaker */
10474 { 0x12, 0x99a30970 }, /* int-mic */
10475 { 0x15, 0x01214020 }, /* HP */
10476 { 0x17, 0x99130111 }, /* speaker */
10477 { 0x18, 0x01a19840 }, /* mic */
10478 { 0x21, 0x0121401f }, /* HP */
10479 { }
10480 },
10481 .chained = true,
10482 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010483 },
Takashi Iwai1565cc32012-02-13 12:03:25 +010010484 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010485 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +010010486 .v.func = alc_fixup_no_jack_detect,
10487 },
David Henningssonedfe3bf2012-06-12 13:15:12 +020010488 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010489 .type = HDA_FIXUP_PINS,
10490 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +020010491 { 0x1b, 0x02214020 }, /* Front HP */
10492 { }
10493 }
10494 },
Takashi Iwai125821a2012-06-22 14:30:29 +020010495 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010496 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +020010497 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +020010498 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010499 [ALC668_FIXUP_DELL_XPS13] = {
10500 .type = HDA_FIXUP_FUNC,
10501 .v.func = alc_fixup_dell_xps13,
10502 .chained = true,
10503 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10504 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +020010505 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10506 .type = HDA_FIXUP_FUNC,
10507 .v.func = alc_fixup_disable_aamix,
10508 .chained = true,
10509 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10510 },
Hui Wang493a52a2014-01-14 14:07:36 +080010511 [ALC668_FIXUP_AUTO_MUTE] = {
10512 .type = HDA_FIXUP_FUNC,
10513 .v.func = alc_fixup_auto_mute_via_amp,
10514 .chained = true,
10515 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10516 },
David Henningsson1f8b46c2015-05-12 14:38:15 +020010517 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10518 .type = HDA_FIXUP_PINS,
10519 .v.pins = (const struct hda_pintbl[]) {
10520 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10521 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10522 { }
10523 },
10524 .chained = true,
10525 .chain_id = ALC662_FIXUP_HEADSET_MODE
10526 },
10527 [ALC662_FIXUP_HEADSET_MODE] = {
10528 .type = HDA_FIXUP_FUNC,
10529 .v.func = alc_fixup_headset_mode_alc662,
10530 },
David Henningsson73bdd592013-04-15 15:44:14 +020010531 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10532 .type = HDA_FIXUP_PINS,
10533 .v.pins = (const struct hda_pintbl[]) {
10534 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10535 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10536 { }
10537 },
10538 .chained = true,
10539 .chain_id = ALC668_FIXUP_HEADSET_MODE
10540 },
10541 [ALC668_FIXUP_HEADSET_MODE] = {
10542 .type = HDA_FIXUP_FUNC,
10543 .v.func = alc_fixup_headset_mode_alc668,
10544 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010545 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +010010546 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010547 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +010010548 .chained = true,
10549 .chain_id = ALC662_FIXUP_ASUS_MODE4
10550 },
David Henningsson61a75f12014-02-07 09:31:08 +010010551 [ALC662_FIXUP_BASS_16] = {
10552 .type = HDA_FIXUP_PINS,
10553 .v.pins = (const struct hda_pintbl[]) {
10554 {0x16, 0x80106111}, /* bass speaker */
10555 {}
10556 },
10557 .chained = true,
10558 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10559 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010560 [ALC662_FIXUP_BASS_1A] = {
10561 .type = HDA_FIXUP_PINS,
10562 .v.pins = (const struct hda_pintbl[]) {
10563 {0x1a, 0x80106111}, /* bass speaker */
10564 {}
10565 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010566 .chained = true,
10567 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010568 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010569 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010570 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010571 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010572 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010573 [ALC662_FIXUP_ASUS_Nx50] = {
10574 .type = HDA_FIXUP_FUNC,
10575 .v.func = alc_fixup_auto_mute_via_amp,
10576 .chained = true,
10577 .chain_id = ALC662_FIXUP_BASS_1A
10578 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010579 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10580 .type = HDA_FIXUP_FUNC,
10581 .v.func = alc_fixup_headset_mode_alc668,
10582 .chain_id = ALC662_FIXUP_BASS_CHMAP
10583 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010584 [ALC668_FIXUP_ASUS_Nx51] = {
10585 .type = HDA_FIXUP_PINS,
10586 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010587 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10588 { 0x1a, 0x90170151 }, /* bass speaker */
10589 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010590 {}
10591 },
10592 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010593 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010594 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010595 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +020010596 .type = HDA_FIXUP_VERBS,
10597 .v.verbs = (const struct hda_verb[]) {
10598 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10599 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10600 {}
10601 },
10602 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010603 [ALC668_FIXUP_ASUS_G751] = {
10604 .type = HDA_FIXUP_PINS,
10605 .v.pins = (const struct hda_pintbl[]) {
10606 { 0x16, 0x0421101f }, /* HP */
10607 {}
10608 },
10609 .chained = true,
10610 .chain_id = ALC668_FIXUP_MIC_COEF
10611 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010612 [ALC891_FIXUP_HEADSET_MODE] = {
10613 .type = HDA_FIXUP_FUNC,
10614 .v.func = alc_fixup_headset_mode,
10615 },
10616 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10617 .type = HDA_FIXUP_PINS,
10618 .v.pins = (const struct hda_pintbl[]) {
10619 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10620 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10621 { }
10622 },
10623 .chained = true,
10624 .chain_id = ALC891_FIXUP_HEADSET_MODE
10625 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010626 [ALC662_FIXUP_ACER_VERITON] = {
10627 .type = HDA_FIXUP_PINS,
10628 .v.pins = (const struct hda_pintbl[]) {
10629 { 0x15, 0x50170120 }, /* no internal speaker */
10630 { }
10631 }
10632 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010633 [ALC892_FIXUP_ASROCK_MOBO] = {
10634 .type = HDA_FIXUP_PINS,
10635 .v.pins = (const struct hda_pintbl[]) {
10636 { 0x15, 0x40f000f0 }, /* disabled */
10637 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010638 { }
10639 }
10640 },
Kailang Yangc6790c82016-11-25 16:15:17 +080010641 [ALC662_FIXUP_USI_FUNC] = {
10642 .type = HDA_FIXUP_FUNC,
10643 .v.func = alc662_fixup_usi_headset_mic,
10644 },
10645 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10646 .type = HDA_FIXUP_PINS,
10647 .v.pins = (const struct hda_pintbl[]) {
10648 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10649 { 0x18, 0x01a1903d },
10650 { }
10651 },
10652 .chained = true,
10653 .chain_id = ALC662_FIXUP_USI_FUNC
10654 },
Kailang Yangca169cc2017-04-25 16:17:40 +080010655 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10656 .type = HDA_FIXUP_FUNC,
10657 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10658 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010659 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10660 .type = HDA_FIXUP_FUNC,
10661 .v.func = alc662_fixup_aspire_ethos_hp,
10662 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010663 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10664 .type = HDA_FIXUP_PINS,
10665 .v.pins = (const struct hda_pintbl[]) {
10666 { 0x15, 0x92130110 }, /* front speakers */
10667 { 0x18, 0x99130111 }, /* center/subwoofer */
10668 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10669 { }
10670 },
10671 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +010010672 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010673 },
Kailang Yang5af290282020-01-17 14:04:01 +080010674 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10675 .type = HDA_FIXUP_FUNC,
10676 .v.func = alc671_fixup_hp_headset_mic2,
10677 },
Jian-Hong Pand858c702020-03-17 16:28:07 +080010678 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10679 .type = HDA_FIXUP_PINS,
10680 .v.pins = (const struct hda_pintbl[]) {
10681 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10682 { }
10683 },
10684 .chained = true,
10685 .chain_id = ALC662_FIXUP_USI_FUNC
10686 },
Jian-Hong Pana1244582020-03-17 16:28:09 +080010687 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10688 .type = HDA_FIXUP_PINS,
10689 .v.pins = (const struct hda_pintbl[]) {
10690 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10691 { 0x1b, 0x0221144f },
10692 { }
10693 },
10694 .chained = true,
10695 .chain_id = ALC662_FIXUP_USI_FUNC
10696 },
Hui Wanga3fd1a92021-10-12 19:47:48 +080010697 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
10698 .type = HDA_FIXUP_PINS,
10699 .v.pins = (const struct hda_pintbl[]) {
10700 { 0x1b, 0x04a1112c },
10701 { }
10702 },
10703 .chained = true,
10704 .chain_id = ALC668_FIXUP_HEADSET_MIC
10705 },
10706 [ALC668_FIXUP_HEADSET_MIC] = {
10707 .type = HDA_FIXUP_FUNC,
10708 .v.func = alc269_fixup_headset_mic,
10709 .chained = true,
10710 .chain_id = ALC668_FIXUP_MIC_DET_COEF
10711 },
10712 [ALC668_FIXUP_MIC_DET_COEF] = {
10713 .type = HDA_FIXUP_VERBS,
10714 .v.verbs = (const struct hda_verb[]) {
10715 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
10716 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
10717 {}
10718 },
10719 },
David Henningsson6cb3b702010-09-09 08:51:44 +020010720};
10721
Takashi Iwaia9111322011-05-02 11:30:18 +020010722static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010723 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +020010724 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +010010725 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +010010726 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +020010727 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +020010728 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +020010729 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -040010730 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Takashi Iwai9edeb112021-04-28 13:27:02 +020010731 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Jian-Hong Pana1244582020-03-17 16:28:09 +080010732 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +080010733 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +020010734 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10735 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +020010736 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010737 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +020010738 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +010010739 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +010010740 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +080010741 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10742 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +080010743 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010744 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Jeremy Szu148ebf542020-10-08 18:56:44 +080010745 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Kaho Ng2da2dc92016-05-09 00:27:49 +080010746 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +020010747 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010748 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +020010749 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
Takashi Iwai9edeb112021-04-28 13:27:02 +020010750 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010751 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +010010752 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010753 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10754 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Hui Wanga3fd1a92021-10-12 19:47:48 +080010755 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
Takashi Iwaic7efff92017-01-04 21:38:16 +010010756 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +010010757 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010758 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +010010759 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010760 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -050010761 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +080010762 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +080010763 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +060010764 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +020010765 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010766 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +020010767 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010768 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010769 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +010010770 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010771
10772#if 0
10773 /* Below is a quirk table taken from the old code.
10774 * Basically the device should work as is without the fixup table.
10775 * If BIOS doesn't give a proper info, enable the corresponding
10776 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +020010777 */
Takashi Iwai53c334a2011-08-23 18:27:14 +020010778 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10779 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10780 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10781 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10782 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10783 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10784 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10785 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10786 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10787 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10788 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10789 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10790 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10791 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10792 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10793 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10794 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10795 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10796 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10797 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10798 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10799 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10800 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10801 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10802 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10803 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10804 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10805 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10806 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10807 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10808 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10809 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10810 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10811 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10812 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10813 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10814 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10815 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10816 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10817 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10818 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10819 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10820 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10821 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10822 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10823 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10824 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10825 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10826 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10827 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10828#endif
David Henningsson6cb3b702010-09-09 08:51:44 +020010829 {}
10830};
10831
Takashi Iwai1727a772013-01-10 09:52:52 +010010832static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010833 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10834 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -080010835 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010836 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +020010837 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10838 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10839 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10840 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10841 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10842 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10843 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10844 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010845 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +020010846 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010847 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +020010848 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010849 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10850 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10851 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10852 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10853 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10854 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10855 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10856 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +020010857 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010858 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10859 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10860 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10861 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10862 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +020010863 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010864 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -080010865 {}
10866};
David Henningsson6cb3b702010-09-09 08:51:44 +020010867
Hui Wang532895c2014-05-29 15:59:19 +080010868static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010869 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10870 {0x17, 0x02211010},
10871 {0x18, 0x01a19030},
10872 {0x1a, 0x01813040},
10873 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +080010874 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10875 {0x16, 0x01813030},
10876 {0x17, 0x02211010},
10877 {0x18, 0x01a19040},
10878 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +020010879 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010880 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010881 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010882 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +080010883 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +020010884 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10885 {0x12, 0x99a30130},
10886 {0x14, 0x90170110},
10887 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010888 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010889 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10890 {0x12, 0x99a30140},
10891 {0x14, 0x90170110},
10892 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010893 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010894 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10895 {0x12, 0x99a30150},
10896 {0x14, 0x90170110},
10897 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010898 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010899 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +020010900 {0x14, 0x90170110},
10901 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010902 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010903 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10904 {0x12, 0x90a60130},
10905 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +080010906 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +080010907 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10908 {0x14, 0x01014010},
10909 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +080010910 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +080010911 {0x1b, 0x01813030},
10912 {0x21, 0x02211020}),
10913 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10914 {0x14, 0x01014010},
10915 {0x18, 0x01a19040},
10916 {0x1b, 0x01813030},
10917 {0x21, 0x02211020}),
10918 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10919 {0x14, 0x01014020},
10920 {0x17, 0x90170110},
10921 {0x18, 0x01a19050},
10922 {0x1b, 0x01813040},
10923 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +080010924 {}
10925};
10926
Takashi Iwai1d045db2011-07-07 18:23:21 +020010927/*
10928 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010929static int patch_alc662(struct hda_codec *codec)
10930{
10931 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +020010932 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010933
Takashi Iwai3de95172012-05-07 18:03:15 +020010934 err = alc_alloc_spec(codec, 0x0b);
10935 if (err < 0)
10936 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010937
Takashi Iwai3de95172012-05-07 18:03:15 +020010938 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010939
Takashi Iwai225068a2015-05-29 10:42:14 +020010940 spec->shutup = alc_eapd_shutup;
10941
Takashi Iwai53c334a2011-08-23 18:27:14 +020010942 /* handle multiple HPs as is */
10943 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10944
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +020010945 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10946
Takashi Iwai7639a062015-03-03 10:07:24 +010010947 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +080010948 case 0x10ec0668:
10949 spec->init_hook = alc668_restore_default_value;
10950 break;
Kailang Yangf3f91852014-10-24 15:43:46 +080010951 }
Kailang Yang8663ff72012-06-29 09:35:52 +020010952
Takashi Iwaic9af7532019-05-10 11:01:43 +020010953 alc_pre_init(codec);
10954
Takashi Iwai1727a772013-01-10 09:52:52 +010010955 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010956 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +080010957 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +010010958 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010959
10960 alc_auto_parse_customize_define(codec);
10961
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010962 if (has_cdefine_beep(codec))
10963 spec->gen.beep_nid = 0x01;
10964
Takashi Iwai1bb7e432011-10-17 16:50:59 +020010965 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +010010966 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010967 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +080010968 err = alc_codec_rename(codec, "ALC272X");
10969 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010970 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +020010971 }
Kailang Yang274693f2009-12-03 10:07:50 +010010972
Takashi Iwaib9c51062011-08-24 18:08:07 +020010973 /* automatic parse from the BIOS config */
10974 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010975 if (err < 0)
10976 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010977
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010978 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +010010979 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +010010980 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010981 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010982 break;
10983 case 0x10ec0272:
10984 case 0x10ec0663:
10985 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +080010986 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010987 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010988 break;
10989 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010990 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010991 break;
10992 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010993 if (err < 0)
10994 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +010010995 }
Takashi Iwai2134ea42008-01-10 16:53:55 +010010996
Takashi Iwai1727a772013-01-10 09:52:52 +010010997 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010998
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010999 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011000
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011001 error:
11002 alc_free(codec);
11003 return err;
Kailang Yangb478b992011-05-18 11:51:15 +020011004}
11005
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011006/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011007 * ALC680 support
11008 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011009
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011010static int alc680_parse_auto_config(struct hda_codec *codec)
11011{
Takashi Iwai3e6179b2011-07-08 16:55:13 +020011012 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011013}
11014
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011015/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011016 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011017static int patch_alc680(struct hda_codec *codec)
11018{
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011019 int err;
11020
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020011021 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +020011022 err = alc_alloc_spec(codec, 0);
11023 if (err < 0)
11024 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020011025
Takashi Iwai1ebec5f2011-08-15 13:21:48 +020011026 /* automatic parse from the BIOS config */
11027 err = alc680_parse_auto_config(codec);
11028 if (err < 0) {
11029 alc_free(codec);
11030 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011031 }
11032
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011033 return 0;
11034}
11035
11036/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070011037 * patch entries
11038 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011039static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +080011040 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011041 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +080011042 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +080011043 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwai1948fc02021-06-18 18:17:20 +020011044 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011045 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11046 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011047 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011048 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +080011049 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +080011050 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011051 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11052 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +080011053 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011054 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11055 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11056 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11057 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11058 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11059 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11060 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011061 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011062 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11063 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11064 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11065 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11066 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11067 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080011068 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011069 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080011070 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011071 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080011072 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011073 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11074 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11075 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011076 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080011077 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011078 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080011079 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080011080 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080011081 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011082 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11083 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11084 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11085 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11086 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11087 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11088 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11089 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11090 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11091 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11092 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11093 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11094 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11095 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080011096 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11097 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11098 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080011099 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080011100 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011101 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11102 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11103 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11104 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11105 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11106 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11107 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11108 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11109 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11110 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11111 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
Kailang Yange5782a52020-11-27 14:39:23 +080011112 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011113 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11114 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080011115 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080011116 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080011117 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070011118 {} /* terminator */
11119};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011120MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010011121
11122MODULE_LICENSE("GPL");
11123MODULE_DESCRIPTION("Realtek HD-audio codec");
11124
Takashi Iwaid8a766a2015-02-17 15:25:37 +010011125static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011126 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010011127};
11128
Takashi Iwaid8a766a2015-02-17 15:25:37 +010011129module_hda_codec_driver(realtek_driver);