blob: 308a58a83f33a9a676f0533e8ad732557a961484 [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 Iwai70a09762015-12-15 14:59:58 +0100112 void (*reboot_notify)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200113
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200114 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200115 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
Kailang Yang693abe12019-01-29 15:38:21 +0800118 unsigned int done_hp_init:1;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100119 unsigned int no_shutup_pins:1;
Kailang Yangd3ba58b2019-05-06 15:09:42 +0800120 unsigned int ultra_low_power:1;
Hui Wang476c02e2020-03-29 16:20:18 +0800121 unsigned int has_hs_key:1;
Kailang Yang92666d42020-11-19 17:04:21 +0800122 unsigned int no_internal_mic_pin:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100123
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200124 /* for PLL fix */
125 hda_nid_t pll_nid;
126 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200127 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100128 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800129 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100130};
131
Takashi Iwai23f0c042009-02-26 13:03:58 +0100132/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200133 * COEF access helper functions
134 */
135
136static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
137 unsigned int coef_idx)
138{
139 unsigned int val;
140
141 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
142 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
143 return val;
144}
145
146#define alc_read_coef_idx(codec, coef_idx) \
147 alc_read_coefex_idx(codec, 0x20, coef_idx)
148
149static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
150 unsigned int coef_idx, unsigned int coef_val)
151{
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
154}
155
156#define alc_write_coef_idx(codec, coef_idx, coef_val) \
157 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
158
Takashi Iwai98b24882014-08-18 13:47:50 +0200159static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 unsigned int coef_idx, unsigned int mask,
161 unsigned int bits_set)
162{
163 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
164
165 if (val != -1)
166 alc_write_coefex_idx(codec, nid, coef_idx,
167 (val & ~mask) | bits_set);
168}
169
170#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
171 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
172
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200173/* a special bypass for COEF 0; read the cached value at the second time */
174static unsigned int alc_get_coef0(struct hda_codec *codec)
175{
176 struct alc_spec *spec = codec->spec;
177
178 if (!spec->coef0)
179 spec->coef0 = alc_read_coef_idx(codec, 0);
180 return spec->coef0;
181}
182
Takashi Iwai54db6c32014-08-18 15:11:19 +0200183/* coef writes/updates batch */
184struct coef_fw {
185 unsigned char nid;
186 unsigned char idx;
187 unsigned short mask;
188 unsigned short val;
189};
190
191#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
192 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
193#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
194#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
195#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
196
197static void alc_process_coef_fw(struct hda_codec *codec,
198 const struct coef_fw *fw)
199{
200 for (; fw->nid; fw++) {
201 if (fw->mask == (unsigned short)-1)
202 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
203 else
204 alc_update_coefex_idx(codec, fw->nid, fw->idx,
205 fw->mask, fw->val);
206 }
207}
208
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200209/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200210 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100211 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200212
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200213/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200214static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
215{
216 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200217
Takashi Iwai5579cd62018-06-19 22:22:41 +0200218 spec->gpio_mask |= mask;
219 spec->gpio_dir |= mask;
220 spec->gpio_data |= mask;
221}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200222
Takashi Iwai5579cd62018-06-19 22:22:41 +0200223static void alc_write_gpio_data(struct hda_codec *codec)
224{
225 struct alc_spec *spec = codec->spec;
226
227 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
228 spec->gpio_data);
229}
230
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200231static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
232 bool on)
233{
234 struct alc_spec *spec = codec->spec;
235 unsigned int oldval = spec->gpio_data;
236
237 if (on)
238 spec->gpio_data |= mask;
239 else
240 spec->gpio_data &= ~mask;
241 if (oldval != spec->gpio_data)
242 alc_write_gpio_data(codec);
243}
244
Takashi Iwai5579cd62018-06-19 22:22:41 +0200245static void alc_write_gpio(struct hda_codec *codec)
246{
247 struct alc_spec *spec = codec->spec;
248
249 if (!spec->gpio_mask)
250 return;
251
252 snd_hda_codec_write(codec, codec->core.afg, 0,
253 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
254 snd_hda_codec_write(codec, codec->core.afg, 0,
255 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200256 if (spec->gpio_write_delay)
257 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200258 alc_write_gpio_data(codec);
259}
260
261static void alc_fixup_gpio(struct hda_codec *codec, int action,
262 unsigned int mask)
263{
264 if (action == HDA_FIXUP_ACT_PRE_PROBE)
265 alc_setup_gpio(codec, mask);
266}
267
268static void alc_fixup_gpio1(struct hda_codec *codec,
269 const struct hda_fixup *fix, int action)
270{
271 alc_fixup_gpio(codec, action, 0x01);
272}
273
274static void alc_fixup_gpio2(struct hda_codec *codec,
275 const struct hda_fixup *fix, int action)
276{
277 alc_fixup_gpio(codec, action, 0x02);
278}
279
280static void alc_fixup_gpio3(struct hda_codec *codec,
281 const struct hda_fixup *fix, int action)
282{
283 alc_fixup_gpio(codec, action, 0x03);
284}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200285
Takashi Iwaiae065f12018-06-19 23:00:03 +0200286static void alc_fixup_gpio4(struct hda_codec *codec,
287 const struct hda_fixup *fix, int action)
288{
289 alc_fixup_gpio(codec, action, 0x04);
290}
291
Takashi Iwai8a503552020-06-18 13:08:32 +0200292static void alc_fixup_micmute_led(struct hda_codec *codec,
293 const struct hda_fixup *fix, int action)
294{
Jaroslav Kyselae65bf992021-03-17 18:29:43 +0100295 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai8a503552020-06-18 13:08:32 +0200296 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
297}
298
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200299/*
300 * Fix hardware PLL issue
301 * On some codecs, the analog PLL gating control must be off while
302 * the default value is 1.
303 */
304static void alc_fix_pll(struct hda_codec *codec)
305{
306 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200307
Takashi Iwai98b24882014-08-18 13:47:50 +0200308 if (spec->pll_nid)
309 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
310 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200311}
312
313static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
314 unsigned int coef_idx, unsigned int coef_bit)
315{
316 struct alc_spec *spec = codec->spec;
317 spec->pll_nid = nid;
318 spec->pll_coef_idx = coef_idx;
319 spec->pll_coef_bit = coef_bit;
320 alc_fix_pll(codec);
321}
322
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100323/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200324static void alc_update_knob_master(struct hda_codec *codec,
325 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100326{
327 unsigned int val;
328 struct snd_kcontrol *kctl;
329 struct snd_ctl_elem_value *uctl;
330
331 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
332 if (!kctl)
333 return;
334 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
335 if (!uctl)
336 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100337 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100338 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
339 val &= HDA_AMP_VOLMASK;
340 uctl->value.integer.value[0] = val;
341 uctl->value.integer.value[1] = val;
342 kctl->put(kctl, uctl);
343 kfree(uctl);
344}
345
David Henningsson29adc4b2012-09-25 11:31:00 +0200346static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100347{
David Henningsson29adc4b2012-09-25 11:31:00 +0200348 /* For some reason, the res given from ALC880 is broken.
349 Here we adjust it properly. */
350 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100351}
352
Kailang Yang394c97f2014-11-12 17:38:08 +0800353/* Change EAPD to verb control */
354static void alc_fill_eapd_coef(struct hda_codec *codec)
355{
356 int coef;
357
358 coef = alc_get_coef0(codec);
359
Takashi Iwai7639a062015-03-03 10:07:24 +0100360 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800361 case 0x10ec0262:
362 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
363 break;
364 case 0x10ec0267:
365 case 0x10ec0268:
366 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
367 break;
368 case 0x10ec0269:
369 if ((coef & 0x00f0) == 0x0010)
370 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
371 if ((coef & 0x00f0) == 0x0020)
372 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
373 if ((coef & 0x00f0) == 0x0030)
374 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
375 break;
376 case 0x10ec0280:
377 case 0x10ec0284:
378 case 0x10ec0290:
379 case 0x10ec0292:
380 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
381 break;
Kailang Yang42314302016-02-03 15:03:50 +0800382 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100383 case 0x10ec0295:
384 case 0x10ec0299:
385 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -0500386 fallthrough;
Takashi Iwai44be77c2017-12-27 08:53:59 +0100387 case 0x10ec0215:
Takashi Iwai1948fc02021-06-18 18:17:20 +0200388 case 0x10ec0230:
Kailang Yang394c97f2014-11-12 17:38:08 +0800389 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800390 case 0x10ec0235:
Thomas Hebbc4473742020-03-30 12:09:38 -0400391 case 0x10ec0236:
Kailang Yang7fbdcd82020-04-23 14:18:31 +0800392 case 0x10ec0245:
Kailang Yang394c97f2014-11-12 17:38:08 +0800393 case 0x10ec0255:
Thomas Hebbc4473742020-03-30 12:09:38 -0400394 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800395 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800396 case 0x10ec0282:
397 case 0x10ec0283:
398 case 0x10ec0286:
399 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800400 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800401 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800402 case 0x10ec0289:
Kailang Yang1078bef2018-11-08 16:36:15 +0800403 case 0x10ec0300:
Kailang Yang394c97f2014-11-12 17:38:08 +0800404 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
405 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800406 case 0x10ec0275:
407 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
408 break;
Hui Wang88227022021-05-07 10:44:52 +0800409 case 0x10ec0287:
410 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
411 alc_write_coef_idx(codec, 0x8, 0x4ab7);
412 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800413 case 0x10ec0293:
414 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
415 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800416 case 0x10ec0234:
417 case 0x10ec0274:
418 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800419 case 0x10ec0700:
420 case 0x10ec0701:
421 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +0800422 case 0x10ec0711:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800423 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
424 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800425 case 0x10ec0662:
426 if ((coef & 0x00f0) == 0x0030)
427 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
428 break;
429 case 0x10ec0272:
430 case 0x10ec0273:
431 case 0x10ec0663:
432 case 0x10ec0665:
433 case 0x10ec0670:
434 case 0x10ec0671:
435 case 0x10ec0672:
436 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
437 break;
Kailang Yang9194a1e2020-01-07 17:22:19 +0800438 case 0x10ec0222:
Kailang Yangf0778872019-10-24 15:13:32 +0800439 case 0x10ec0623:
440 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
441 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800442 case 0x10ec0668:
443 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
444 break;
445 case 0x10ec0867:
446 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
447 break;
448 case 0x10ec0888:
449 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
450 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
451 break;
452 case 0x10ec0892:
Kailang Yange5782a52020-11-27 14:39:23 +0800453 case 0x10ec0897:
Kailang Yang394c97f2014-11-12 17:38:08 +0800454 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
455 break;
456 case 0x10ec0899:
457 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +0800458 case 0x10ec0b00:
Kailang Yang65553b12017-07-11 15:15:47 +0800459 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800460 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800461 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
462 break;
463 }
464}
465
Kailang Yangf9423e72008-05-27 12:32:25 +0200466/* additional initialization for ALC888 variants */
467static void alc888_coef_init(struct hda_codec *codec)
468{
Kailang Yang1df88742014-10-29 16:10:13 +0800469 switch (alc_get_coef0(codec) & 0x00f0) {
470 /* alc888-VA */
471 case 0x00:
472 /* alc888-VB */
473 case 0x10:
474 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
475 break;
476 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200477}
478
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100479/* turn on/off EAPD control (only if available) */
480static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
481{
482 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
483 return;
484 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
485 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
486 on ? 2 : 0);
487}
488
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200489/* turn on/off EAPD controls of the codec */
490static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
491{
492 /* We currently only handle front, HP */
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100493 static const hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800494 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200495 };
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100496 const hda_nid_t *p;
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200497 for (p = pins; *p; p++)
498 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200499}
500
Kailang Yangdad31972019-05-10 16:28:57 +0800501static int find_ext_mic_pin(struct hda_codec *codec);
502
503static void alc_headset_mic_no_shutup(struct hda_codec *codec)
504{
505 const struct hda_pincfg *pin;
506 int mic_pin = find_ext_mic_pin(codec);
507 int i;
508
509 /* don't shut up pins when unloading the driver; otherwise it breaks
510 * the default pin setup at the next load of the driver
511 */
512 if (codec->bus->shutdown)
513 return;
514
515 snd_array_for_each(&codec->init_pins, i, pin) {
516 /* use read here for syncing after issuing each verb */
517 if (pin->nid != mic_pin)
518 snd_hda_codec_read(codec, pin->nid, 0,
519 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
520 }
521
522 codec->pins_shutup = 1;
523}
524
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100525static void alc_shutup_pins(struct hda_codec *codec)
526{
527 struct alc_spec *spec = codec->spec;
528
Kailang Yangdad31972019-05-10 16:28:57 +0800529 switch (codec->core.vendor_id) {
Kailang Yang66c5d712019-12-09 15:56:15 +0800530 case 0x10ec0283:
Kailang Yangdad31972019-05-10 16:28:57 +0800531 case 0x10ec0286:
532 case 0x10ec0288:
533 case 0x10ec0298:
534 alc_headset_mic_no_shutup(codec);
535 break;
536 default:
537 if (!spec->no_shutup_pins)
538 snd_hda_shutup_pins(codec);
539 break;
540 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100541}
542
Takashi Iwai1c7161532011-04-07 10:37:16 +0200543/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100544 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200545 */
546static void alc_eapd_shutup(struct hda_codec *codec)
547{
Kailang Yang97a26572013-11-29 00:35:26 -0500548 struct alc_spec *spec = codec->spec;
549
Takashi Iwai1c7161532011-04-07 10:37:16 +0200550 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500551 if (!spec->no_depop_delay)
552 msleep(200);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100553 alc_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200554}
555
Takashi Iwai1d045db2011-07-07 18:23:21 +0200556/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200557static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200558{
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200559 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200560 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200561 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200562 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100563 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200564 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200565 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200566 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200567 case 0x10ec0880:
568 case 0x10ec0882:
569 case 0x10ec0883:
570 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800571 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200572 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200573 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200574 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200575 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200576 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200577 break;
578 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200579}
Kailang Yangea1fb292008-08-26 12:58:38 +0200580
Takashi Iwai35a39f92019-02-01 11:19:50 +0100581/* get a primary headphone pin if available */
582static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
583{
584 if (spec->gen.autocfg.hp_pins[0])
585 return spec->gen.autocfg.hp_pins[0];
586 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
587 return spec->gen.autocfg.line_out_pins[0];
588 return 0;
589}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200590
591/*
592 * Realtek SSID verification
593 */
594
David Henningsson90622912010-10-14 14:50:18 +0200595/* Could be any non-zero and even value. When used as fixup, tells
596 * the driver to ignore any present sku defines.
597 */
598#define ALC_FIXUP_SKU_IGNORE (2)
599
Takashi Iwai23d30f22012-05-07 17:17:32 +0200600static void alc_fixup_sku_ignore(struct hda_codec *codec,
601 const struct hda_fixup *fix, int action)
602{
603 struct alc_spec *spec = codec->spec;
604 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
605 spec->cdefine.fixup = 1;
606 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
607 }
608}
609
Mengdong Linb5c66112013-11-29 00:35:35 -0500610static void alc_fixup_no_depop_delay(struct hda_codec *codec,
611 const struct hda_fixup *fix, int action)
612{
613 struct alc_spec *spec = codec->spec;
614
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500615 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500616 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500617 codec->depop_delay = 0;
618 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500619}
620
Kailang Yangda00c242010-03-19 11:23:45 +0100621static int alc_auto_parse_customize_define(struct hda_codec *codec)
622{
623 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100624 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100625 struct alc_spec *spec = codec->spec;
626
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200627 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
628
David Henningsson90622912010-10-14 14:50:18 +0200629 if (spec->cdefine.fixup) {
630 ass = spec->cdefine.sku_cfg;
631 if (ass == ALC_FIXUP_SKU_IGNORE)
632 return -1;
633 goto do_sku;
634 }
635
Takashi Iwai5100cd02014-02-15 10:03:19 +0100636 if (!codec->bus->pci)
637 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100638 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200639 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100640 goto do_sku;
641
642 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100643 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100644 nid = 0x17;
645 ass = snd_hda_codec_get_pincfg(codec, nid);
646
647 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100648 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100649 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100650 return -1;
651 }
652
653 /* check sum */
654 tmp = 0;
655 for (i = 1; i < 16; i++) {
656 if ((ass >> i) & 1)
657 tmp++;
658 }
659 if (((ass >> 16) & 0xf) != tmp)
660 return -1;
661
662 spec->cdefine.port_connectivity = ass >> 30;
663 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
664 spec->cdefine.check_sum = (ass >> 16) & 0xf;
665 spec->cdefine.customization = ass >> 8;
666do_sku:
667 spec->cdefine.sku_cfg = ass;
668 spec->cdefine.external_amp = (ass & 0x38) >> 3;
669 spec->cdefine.platform_type = (ass & 0x4) >> 2;
670 spec->cdefine.swap = (ass & 0x2) >> 1;
671 spec->cdefine.override = ass & 0x1;
672
Takashi Iwai4e76a882014-02-25 12:21:03 +0100673 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100674 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100675 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100676 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100677 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
678 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
679 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
680 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
681 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
682 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
683 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100684
685 return 0;
686}
687
Takashi Iwai08c189f2012-12-19 15:22:24 +0100688/* return the position of NID in the list, or -1 if not found */
689static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
690{
691 int i;
692 for (i = 0; i < nums; i++)
693 if (list[i] == nid)
694 return i;
695 return -1;
696}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200697/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200698static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
699{
Takashi Iwai21268962011-07-07 15:01:13 +0200700 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200701}
702
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200703/* check subsystem ID and set up device-specific initialization;
704 * return 1 if initialized, 0 if invalid SSID
705 */
706/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
707 * 31 ~ 16 : Manufacture ID
708 * 15 ~ 8 : SKU ID
709 * 7 ~ 0 : Assembly ID
710 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
711 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100712static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200713{
714 unsigned int ass, tmp, i;
715 unsigned nid;
716 struct alc_spec *spec = codec->spec;
717
David Henningsson90622912010-10-14 14:50:18 +0200718 if (spec->cdefine.fixup) {
719 ass = spec->cdefine.sku_cfg;
720 if (ass == ALC_FIXUP_SKU_IGNORE)
721 return 0;
722 goto do_sku;
723 }
724
Takashi Iwai7639a062015-03-03 10:07:24 +0100725 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100726 if (codec->bus->pci &&
727 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200728 goto do_sku;
729
730 /* invalid SSID, check the special NID pin defcfg instead */
731 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400732 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200733 * 29~21 : reserve
734 * 20 : PCBEEP input
735 * 19~16 : Check sum (15:1)
736 * 15~1 : Custom
737 * 0 : override
738 */
739 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100740 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200741 nid = 0x17;
742 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100743 codec_dbg(codec,
744 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200745 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100746 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200747 return 0;
748 if ((ass >> 30) != 1) /* no physical connection */
749 return 0;
750
751 /* check sum */
752 tmp = 0;
753 for (i = 1; i < 16; i++) {
754 if ((ass >> i) & 1)
755 tmp++;
756 }
757 if (((ass >> 16) & 0xf) != tmp)
758 return 0;
759do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100760 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100761 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200762 /*
763 * 0 : override
764 * 1 : Swap Jack
765 * 2 : 0 --> Desktop, 1 --> Laptop
766 * 3~5 : External Amplifier control
767 * 7~6 : Reserved
768 */
769 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200770 if (spec->init_amp == ALC_INIT_UNDEFINED) {
771 switch (tmp) {
772 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200773 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200774 break;
775 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200776 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200777 break;
778 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200779 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200780 break;
781 case 5:
782 default:
783 spec->init_amp = ALC_INIT_DEFAULT;
784 break;
785 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200786 }
787
788 /* is laptop or Desktop and enable the function "Mute internal speaker
789 * when the external headphone out jack is plugged"
790 */
791 if (!(ass & 0x8000))
792 return 1;
793 /*
794 * 10~8 : Jack location
795 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
796 * 14~13: Resvered
797 * 15 : 1 --> enable the function "Mute internal speaker
798 * when the external headphone out jack is plugged"
799 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100800 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200801 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200802 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100803 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100804 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
805 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200806 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100807 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200808 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200809 return 1;
810}
Kailang Yangea1fb292008-08-26 12:58:38 +0200811
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200812/* Check the validity of ALC subsystem-id
813 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
814static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200815{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100816 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200817 struct alc_spec *spec = codec->spec;
Takashi Iwai67791202020-04-18 21:06:39 +0200818 if (spec->init_amp == ALC_INIT_UNDEFINED) {
819 codec_dbg(codec,
820 "realtek: Enable default setup for auto mode as fallback\n");
821 spec->init_amp = ALC_INIT_DEFAULT;
822 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200823 }
Takashi Iwai21268962011-07-07 15:01:13 +0200824}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200825
Takashi Iwai41e41f12005-06-08 14:48:49 +0200826/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200827 */
828
David Henningsson9d36a7d2014-10-07 10:18:42 +0200829static void alc_fixup_inv_dmic(struct hda_codec *codec,
830 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200831{
832 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100833
David Henningsson9d36a7d2014-10-07 10:18:42 +0200834 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200835}
836
Takashi Iwai603c4012008-07-30 15:01:44 +0200837
Takashi Iwai2eab6942012-12-18 15:30:41 +0100838static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200840 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841
Takashi Iwai08c189f2012-12-19 15:22:24 +0100842 err = snd_hda_gen_build_controls(codec);
843 if (err < 0)
844 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700845
Takashi Iwai1727a772013-01-10 09:52:52 +0100846 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100847 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700848}
849
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200850
Linus Torvalds1da177e2005-04-16 15:20:36 -0700851/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100852 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200853 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200854
Takashi Iwaic9af7532019-05-10 11:01:43 +0200855static void alc_pre_init(struct hda_codec *codec)
856{
857 alc_fill_eapd_coef(codec);
858}
859
Kailang Yangaeac1a02019-05-16 16:10:44 +0800860#define is_s3_resume(codec) \
861 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
Takashi Iwaic9af7532019-05-10 11:01:43 +0200862#define is_s4_resume(codec) \
863 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
864
Linus Torvalds1da177e2005-04-16 15:20:36 -0700865static int alc_init(struct hda_codec *codec)
866{
867 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200868
Takashi Iwaic9af7532019-05-10 11:01:43 +0200869 /* hibernation resume needs the full chip initialization */
870 if (is_s4_resume(codec))
871 alc_pre_init(codec);
872
Takashi Iwai546bb672012-03-07 08:37:19 +0100873 if (spec->init_hook)
874 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100875
Takashi Iwai89781d02019-08-30 12:03:38 +0200876 spec->gen.skip_verbs = 1; /* applied in below */
Kailang Yang607ca3b2019-04-26 16:35:41 +0800877 snd_hda_gen_init(codec);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200878 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200879 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai89781d02019-08-30 12:03:38 +0200880 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200881
Takashi Iwai1727a772013-01-10 09:52:52 +0100882 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200883
Linus Torvalds1da177e2005-04-16 15:20:36 -0700884 return 0;
885}
886
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100887static inline void alc_shutup(struct hda_codec *codec)
888{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200889 struct alc_spec *spec = codec->spec;
890
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200891 if (!snd_hda_get_bool_hint(codec, "shutup"))
892 return; /* disabled explicitly by hints */
893
Takashi Iwai1c7161532011-04-07 10:37:16 +0200894 if (spec && spec->shutup)
895 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200896 else
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100897 alc_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100898}
899
Takashi Iwai70a09762015-12-15 14:59:58 +0100900static void alc_reboot_notify(struct hda_codec *codec)
901{
902 struct alc_spec *spec = codec->spec;
903
904 if (spec && spec->reboot_notify)
905 spec->reboot_notify(codec);
906 else
907 alc_shutup(codec);
908}
909
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100910#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700911
Takashi Iwai83012a72012-08-24 18:38:08 +0200912#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500913static void alc_power_eapd(struct hda_codec *codec)
914{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200915 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500916}
917
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200918static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100919{
920 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100921 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100922 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500923 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100924 return 0;
925}
926#endif
927
Takashi Iwai2a439522011-07-26 09:52:50 +0200928#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100929static int alc_resume(struct hda_codec *codec)
930{
Kailang Yang97a26572013-11-29 00:35:26 -0500931 struct alc_spec *spec = codec->spec;
932
933 if (!spec->no_depop_delay)
934 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100935 codec->patch_ops.init(codec);
Takashi Iwai1a462be2020-01-09 10:01:04 +0100936 snd_hda_regmap_sync(codec);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200937 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100938 return 0;
939}
Takashi Iwaie044c392008-10-27 16:56:24 +0100940#endif
941
Linus Torvalds1da177e2005-04-16 15:20:36 -0700942/*
943 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200944static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700945 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100946 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700947 .init = alc_init,
948 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200949 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200950#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100951 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100952 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100953 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200954#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100955 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700956};
957
David Henningsson29adc4b2012-09-25 11:31:00 +0200958
Takashi Iwaided255b2015-10-01 17:59:43 +0200959#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100960
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200961/*
Kailang Yang4b016932013-11-28 11:55:09 +0100962 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200963 */
964struct alc_codec_rename_table {
965 unsigned int vendor_id;
966 unsigned short coef_mask;
967 unsigned short coef_bits;
968 const char *name;
969};
970
Kailang Yang4b016932013-11-28 11:55:09 +0100971struct alc_codec_rename_pci_table {
972 unsigned int codec_vendor_id;
973 unsigned short pci_subvendor;
974 unsigned short pci_subdevice;
975 const char *name;
976};
977
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100978static const struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800979 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200980 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
981 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
982 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
983 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
984 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
985 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
986 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200987 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800988 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200989 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
990 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
991 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
992 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
993 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
994 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
995 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
996 { } /* terminator */
997};
998
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100999static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
Kailang Yang4b016932013-11-28 11:55:09 +01001000 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1001 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1002 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +08001003 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +01001004 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +08001005 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +01001006 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1007 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001008 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1009 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +08001010 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +08001011 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +08001012 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +08001013 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +08001014 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +08001015 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001016 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1017 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1018 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1019 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1020 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1021 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1022 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1023 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1024 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1025 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1026 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +01001027 { } /* terminator */
1028};
1029
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001030static int alc_codec_rename_from_preset(struct hda_codec *codec)
1031{
1032 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +01001033 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001034
1035 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001036 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001037 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02001038 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001039 return alc_codec_rename(codec, p->name);
1040 }
Kailang Yang4b016932013-11-28 11:55:09 +01001041
Takashi Iwai5100cd02014-02-15 10:03:19 +01001042 if (!codec->bus->pci)
1043 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +01001044 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001045 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +01001046 continue;
1047 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1048 continue;
1049 if (!q->pci_subdevice ||
1050 q->pci_subdevice == codec->bus->pci->subsystem_device)
1051 return alc_codec_rename(codec, q->name);
1052 }
1053
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001054 return 0;
1055}
1056
Takashi Iwaie4770622011-07-08 11:11:35 +02001057
1058/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001059 * Digital-beep handlers
1060 */
1061#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001062
1063/* additional beep mixers; private_value will be overwritten */
1064static const struct snd_kcontrol_new alc_beep_mixer[] = {
1065 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1066 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1067};
1068
1069/* set up and create beep controls */
1070static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1071 int idx, int dir)
1072{
1073 struct snd_kcontrol_new *knew;
1074 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1075 int i;
1076
1077 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1078 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1079 &alc_beep_mixer[i]);
1080 if (!knew)
1081 return -ENOMEM;
1082 knew->private_value = beep_amp;
1083 }
1084 return 0;
1085}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001086
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001087static const struct snd_pci_quirk beep_allow_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001088 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001089 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001090 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001091 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001092 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1093 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1094 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001095 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001096 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001097 /* denylist -- no beep available */
Takashi Iwai051c78a2019-08-22 09:58:07 +02001098 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1099 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001100 {}
1101};
1102
1103static inline int has_cdefine_beep(struct hda_codec *codec)
1104{
1105 struct alc_spec *spec = codec->spec;
1106 const struct snd_pci_quirk *q;
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001107 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001108 if (q)
1109 return q->value;
1110 return spec->cdefine.enable_pcbeep;
1111}
1112#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001113#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001114#define has_cdefine_beep(codec) 0
1115#endif
1116
1117/* parse the BIOS configuration and set up the alc_spec */
1118/* return 1 if successful, 0 if the proper config is not found,
1119 * or a negative error code
1120 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001121static int alc_parse_auto_config(struct hda_codec *codec,
1122 const hda_nid_t *ignore_nids,
1123 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001124{
1125 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001126 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001127 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001128
Takashi Iwai53c334a2011-08-23 18:27:14 +02001129 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1130 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001131 if (err < 0)
1132 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001133
1134 if (ssid_nids)
1135 alc_ssid_check(codec, ssid_nids);
1136
Takashi Iwai08c189f2012-12-19 15:22:24 +01001137 err = snd_hda_gen_parse_auto_config(codec, cfg);
1138 if (err < 0)
1139 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001140
Takashi Iwai1d045db2011-07-07 18:23:21 +02001141 return 1;
1142}
1143
Takashi Iwai3de95172012-05-07 18:03:15 +02001144/* common preparation job for alc_spec */
1145static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1146{
1147 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1148 int err;
1149
1150 if (!spec)
1151 return -ENOMEM;
1152 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001153 snd_hda_gen_spec_init(&spec->gen);
1154 spec->gen.mixer_nid = mixer_nid;
1155 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001156 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001157 /* FIXME: do we need this for all Realtek codec models? */
1158 codec->spdif_status_reset = 1;
Kai Vehmanena6e7d0a2020-10-12 13:27:04 +03001159 codec->forced_resume = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001160 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001161
1162 err = alc_codec_rename_from_preset(codec);
1163 if (err < 0) {
1164 kfree(spec);
1165 return err;
1166 }
1167 return 0;
1168}
1169
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001170static int alc880_parse_auto_config(struct hda_codec *codec)
1171{
1172 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001173 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001174 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1175}
1176
Takashi Iwai1d045db2011-07-07 18:23:21 +02001177/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001178 * ALC880 fix-ups
1179 */
1180enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001181 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001182 ALC880_FIXUP_GPIO2,
1183 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001184 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001185 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001186 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001187 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001188 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001189 ALC880_FIXUP_VOL_KNOB,
1190 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001191 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001192 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001193 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001194 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001195 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001196 ALC880_FIXUP_3ST_BASE,
1197 ALC880_FIXUP_3ST,
1198 ALC880_FIXUP_3ST_DIG,
1199 ALC880_FIXUP_5ST_BASE,
1200 ALC880_FIXUP_5ST,
1201 ALC880_FIXUP_5ST_DIG,
1202 ALC880_FIXUP_6ST_BASE,
1203 ALC880_FIXUP_6ST,
1204 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001205 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001206};
1207
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001208/* enable the volume-knob widget support on NID 0x21 */
1209static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001210 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001211{
Takashi Iwai1727a772013-01-10 09:52:52 +01001212 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001213 snd_hda_jack_detect_enable_callback(codec, 0x21,
1214 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001215}
1216
Takashi Iwai1727a772013-01-10 09:52:52 +01001217static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001218 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001219 .type = HDA_FIXUP_FUNC,
1220 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001221 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001222 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001223 .type = HDA_FIXUP_FUNC,
1224 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001225 },
1226 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001227 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001228 .v.verbs = (const struct hda_verb[]) {
1229 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1230 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1231 { }
1232 },
1233 .chained = true,
1234 .chain_id = ALC880_FIXUP_GPIO2,
1235 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001236 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001237 .type = HDA_FIXUP_PINS,
1238 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001239 /* disable bogus unused pins */
1240 { 0x16, 0x411111f0 },
1241 { 0x18, 0x411111f0 },
1242 { 0x1a, 0x411111f0 },
1243 { }
1244 }
1245 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001246 [ALC880_FIXUP_LG_LW25] = {
1247 .type = HDA_FIXUP_PINS,
1248 .v.pins = (const struct hda_pintbl[]) {
1249 { 0x1a, 0x0181344f }, /* line-in */
1250 { 0x1b, 0x0321403f }, /* headphone */
1251 { }
1252 }
1253 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001254 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001255 .type = HDA_FIXUP_PINS,
1256 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001257 /* disable bogus unused pins */
1258 { 0x17, 0x411111f0 },
1259 { }
1260 },
1261 .chained = true,
1262 .chain_id = ALC880_FIXUP_GPIO2,
1263 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001264 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001265 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001266 .v.verbs = (const struct hda_verb[]) {
1267 /* change to EAPD mode */
1268 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1269 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1270 {}
1271 },
1272 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001273 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001274 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001275 .v.verbs = (const struct hda_verb[]) {
1276 /* change to EAPD mode */
1277 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1278 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1279 {}
1280 },
1281 .chained = true,
1282 .chain_id = ALC880_FIXUP_GPIO2,
1283 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001284 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001285 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001286 .v.func = alc880_fixup_vol_knob,
1287 },
1288 [ALC880_FIXUP_FUJITSU] = {
1289 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001290 .type = HDA_FIXUP_PINS,
1291 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001292 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001293 { 0x15, 0x99030120 }, /* speaker */
1294 { 0x16, 0x99030130 }, /* bass speaker */
1295 { 0x17, 0x411111f0 }, /* N/A */
1296 { 0x18, 0x411111f0 }, /* N/A */
1297 { 0x19, 0x01a19950 }, /* mic-in */
1298 { 0x1a, 0x411111f0 }, /* N/A */
1299 { 0x1b, 0x411111f0 }, /* N/A */
1300 { 0x1c, 0x411111f0 }, /* N/A */
1301 { 0x1d, 0x411111f0 }, /* N/A */
1302 { 0x1e, 0x01454140 }, /* SPDIF out */
1303 { }
1304 },
1305 .chained = true,
1306 .chain_id = ALC880_FIXUP_VOL_KNOB,
1307 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001308 [ALC880_FIXUP_F1734] = {
1309 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001310 .type = HDA_FIXUP_PINS,
1311 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001312 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001313 { 0x15, 0x99030120 }, /* speaker */
1314 { 0x16, 0x411111f0 }, /* N/A */
1315 { 0x17, 0x411111f0 }, /* N/A */
1316 { 0x18, 0x411111f0 }, /* N/A */
1317 { 0x19, 0x01a19950 }, /* mic-in */
1318 { 0x1a, 0x411111f0 }, /* N/A */
1319 { 0x1b, 0x411111f0 }, /* N/A */
1320 { 0x1c, 0x411111f0 }, /* N/A */
1321 { 0x1d, 0x411111f0 }, /* N/A */
1322 { 0x1e, 0x411111f0 }, /* N/A */
1323 { }
1324 },
1325 .chained = true,
1326 .chain_id = ALC880_FIXUP_VOL_KNOB,
1327 },
Takashi Iwai817de922012-02-20 17:20:48 +01001328 [ALC880_FIXUP_UNIWILL] = {
1329 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001330 .type = HDA_FIXUP_PINS,
1331 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001332 { 0x14, 0x0121411f }, /* HP */
1333 { 0x15, 0x99030120 }, /* speaker */
1334 { 0x16, 0x99030130 }, /* bass speaker */
1335 { }
1336 },
1337 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001338 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001339 .type = HDA_FIXUP_PINS,
1340 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001341 /* disable bogus unused pins */
1342 { 0x17, 0x411111f0 },
1343 { 0x19, 0x411111f0 },
1344 { 0x1b, 0x411111f0 },
1345 { 0x1f, 0x411111f0 },
1346 { }
1347 }
1348 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001349 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001350 .type = HDA_FIXUP_PINS,
1351 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001352 /* set up the whole pins as BIOS is utterly broken */
1353 { 0x14, 0x99030120 }, /* speaker */
1354 { 0x15, 0x0121411f }, /* HP */
1355 { 0x16, 0x411111f0 }, /* N/A */
1356 { 0x17, 0x411111f0 }, /* N/A */
1357 { 0x18, 0x01a19950 }, /* mic-in */
1358 { 0x19, 0x411111f0 }, /* N/A */
1359 { 0x1a, 0x01813031 }, /* line-in */
1360 { 0x1b, 0x411111f0 }, /* N/A */
1361 { 0x1c, 0x411111f0 }, /* N/A */
1362 { 0x1d, 0x411111f0 }, /* N/A */
1363 { 0x1e, 0x0144111e }, /* SPDIF */
1364 { }
1365 }
1366 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001367 [ALC880_FIXUP_ASUS_W5A] = {
1368 .type = HDA_FIXUP_PINS,
1369 .v.pins = (const struct hda_pintbl[]) {
1370 /* set up the whole pins as BIOS is utterly broken */
1371 { 0x14, 0x0121411f }, /* HP */
1372 { 0x15, 0x411111f0 }, /* N/A */
1373 { 0x16, 0x411111f0 }, /* N/A */
1374 { 0x17, 0x411111f0 }, /* N/A */
1375 { 0x18, 0x90a60160 }, /* mic */
1376 { 0x19, 0x411111f0 }, /* N/A */
1377 { 0x1a, 0x411111f0 }, /* N/A */
1378 { 0x1b, 0x411111f0 }, /* N/A */
1379 { 0x1c, 0x411111f0 }, /* N/A */
1380 { 0x1d, 0x411111f0 }, /* N/A */
1381 { 0x1e, 0xb743111e }, /* SPDIF out */
1382 { }
1383 },
1384 .chained = true,
1385 .chain_id = ALC880_FIXUP_GPIO1,
1386 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001387 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001388 .type = HDA_FIXUP_PINS,
1389 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001390 { 0x14, 0x01014010 }, /* line-out */
1391 { 0x15, 0x411111f0 }, /* N/A */
1392 { 0x16, 0x411111f0 }, /* N/A */
1393 { 0x17, 0x411111f0 }, /* N/A */
1394 { 0x18, 0x01a19c30 }, /* mic-in */
1395 { 0x19, 0x0121411f }, /* HP */
1396 { 0x1a, 0x01813031 }, /* line-in */
1397 { 0x1b, 0x02a19c40 }, /* front-mic */
1398 { 0x1c, 0x411111f0 }, /* N/A */
1399 { 0x1d, 0x411111f0 }, /* N/A */
1400 /* 0x1e is filled in below */
1401 { 0x1f, 0x411111f0 }, /* N/A */
1402 { }
1403 }
1404 },
1405 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001406 .type = HDA_FIXUP_PINS,
1407 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001408 { 0x1e, 0x411111f0 }, /* N/A */
1409 { }
1410 },
1411 .chained = true,
1412 .chain_id = ALC880_FIXUP_3ST_BASE,
1413 },
1414 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001415 .type = HDA_FIXUP_PINS,
1416 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001417 { 0x1e, 0x0144111e }, /* SPDIF */
1418 { }
1419 },
1420 .chained = true,
1421 .chain_id = ALC880_FIXUP_3ST_BASE,
1422 },
1423 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001424 .type = HDA_FIXUP_PINS,
1425 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001426 { 0x14, 0x01014010 }, /* front */
1427 { 0x15, 0x411111f0 }, /* N/A */
1428 { 0x16, 0x01011411 }, /* CLFE */
1429 { 0x17, 0x01016412 }, /* surr */
1430 { 0x18, 0x01a19c30 }, /* mic-in */
1431 { 0x19, 0x0121411f }, /* HP */
1432 { 0x1a, 0x01813031 }, /* line-in */
1433 { 0x1b, 0x02a19c40 }, /* front-mic */
1434 { 0x1c, 0x411111f0 }, /* N/A */
1435 { 0x1d, 0x411111f0 }, /* N/A */
1436 /* 0x1e is filled in below */
1437 { 0x1f, 0x411111f0 }, /* N/A */
1438 { }
1439 }
1440 },
1441 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001442 .type = HDA_FIXUP_PINS,
1443 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001444 { 0x1e, 0x411111f0 }, /* N/A */
1445 { }
1446 },
1447 .chained = true,
1448 .chain_id = ALC880_FIXUP_5ST_BASE,
1449 },
1450 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001451 .type = HDA_FIXUP_PINS,
1452 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001453 { 0x1e, 0x0144111e }, /* SPDIF */
1454 { }
1455 },
1456 .chained = true,
1457 .chain_id = ALC880_FIXUP_5ST_BASE,
1458 },
1459 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001460 .type = HDA_FIXUP_PINS,
1461 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001462 { 0x14, 0x01014010 }, /* front */
1463 { 0x15, 0x01016412 }, /* surr */
1464 { 0x16, 0x01011411 }, /* CLFE */
1465 { 0x17, 0x01012414 }, /* side */
1466 { 0x18, 0x01a19c30 }, /* mic-in */
1467 { 0x19, 0x02a19c40 }, /* front-mic */
1468 { 0x1a, 0x01813031 }, /* line-in */
1469 { 0x1b, 0x0121411f }, /* HP */
1470 { 0x1c, 0x411111f0 }, /* N/A */
1471 { 0x1d, 0x411111f0 }, /* N/A */
1472 /* 0x1e is filled in below */
1473 { 0x1f, 0x411111f0 }, /* N/A */
1474 { }
1475 }
1476 },
1477 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001478 .type = HDA_FIXUP_PINS,
1479 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001480 { 0x1e, 0x411111f0 }, /* N/A */
1481 { }
1482 },
1483 .chained = true,
1484 .chain_id = ALC880_FIXUP_6ST_BASE,
1485 },
1486 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001487 .type = HDA_FIXUP_PINS,
1488 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001489 { 0x1e, 0x0144111e }, /* SPDIF */
1490 { }
1491 },
1492 .chained = true,
1493 .chain_id = ALC880_FIXUP_6ST_BASE,
1494 },
Takashi Iwai53971452013-01-23 18:21:37 +01001495 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1496 .type = HDA_FIXUP_PINS,
1497 .v.pins = (const struct hda_pintbl[]) {
1498 { 0x1b, 0x0121401f }, /* HP with jack detect */
1499 { }
1500 },
1501 .chained_before = true,
1502 .chain_id = ALC880_FIXUP_6ST_BASE,
1503 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001504};
1505
1506static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001507 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001508 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001509 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001510 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001511 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001512 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001513 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001514 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001515 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001516 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001517 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001518 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001519 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001520 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001521 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001522 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001523 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001524 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001525 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1526 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1527 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001528 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001529 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001530
1531 /* Below is the copied entries from alc880_quirks.c.
1532 * It's not quite sure whether BIOS sets the correct pin-config table
1533 * on these machines, thus they are kept to be compatible with
1534 * the old static quirks. Once when it's confirmed to work without
1535 * these overrides, it'd be better to remove.
1536 */
1537 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1538 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1539 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1540 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1541 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1542 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1543 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1544 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1545 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1546 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1547 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1548 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1549 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1550 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1551 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1552 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1553 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1554 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1555 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1556 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1557 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1558 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1559 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1560 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1561 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1563 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1564 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1565 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1566 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1567 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1568 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1569 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1570 /* default Intel */
1571 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1572 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1573 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1574 {}
1575};
1576
Takashi Iwai1727a772013-01-10 09:52:52 +01001577static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001578 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1579 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1580 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1581 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1582 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1583 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001584 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001585 {}
1586};
1587
1588
1589/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001590 * OK, here we have finally the patch for ALC880
1591 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001592static int patch_alc880(struct hda_codec *codec)
1593{
1594 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001595 int err;
1596
Takashi Iwai3de95172012-05-07 18:03:15 +02001597 err = alc_alloc_spec(codec, 0x0b);
1598 if (err < 0)
1599 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001600
Takashi Iwai3de95172012-05-07 18:03:15 +02001601 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001602 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001603 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001604
Takashi Iwai225068a2015-05-29 10:42:14 +02001605 codec->patch_ops.unsol_event = alc880_unsol_event;
1606
Takashi Iwaic9af7532019-05-10 11:01:43 +02001607 alc_pre_init(codec);
1608
Takashi Iwai1727a772013-01-10 09:52:52 +01001609 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001610 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001611 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001612
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001613 /* automatic parse from the BIOS config */
1614 err = alc880_parse_auto_config(codec);
1615 if (err < 0)
1616 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001617
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001618 if (!spec->gen.no_analog) {
1619 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1620 if (err < 0)
1621 goto error;
1622 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001623
Takashi Iwai1727a772013-01-10 09:52:52 +01001624 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001625
Takashi Iwai1d045db2011-07-07 18:23:21 +02001626 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001627
1628 error:
1629 alc_free(codec);
1630 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001631}
1632
1633
1634/*
1635 * ALC260 support
1636 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001637static int alc260_parse_auto_config(struct hda_codec *codec)
1638{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001639 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001640 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1641 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001642}
1643
Takashi Iwai1d045db2011-07-07 18:23:21 +02001644/*
1645 * Pin config fixes
1646 */
1647enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001648 ALC260_FIXUP_HP_DC5750,
1649 ALC260_FIXUP_HP_PIN_0F,
1650 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001651 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001652 ALC260_FIXUP_GPIO1_TOGGLE,
1653 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001654 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001655 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001656 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001657 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001658 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001659};
1660
Takashi Iwai20f7d922012-02-16 12:35:16 +01001661static void alc260_gpio1_automute(struct hda_codec *codec)
1662{
1663 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001664
1665 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001666}
1667
1668static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001669 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001670{
1671 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001672 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001673 /* although the machine has only one output pin, we need to
1674 * toggle GPIO1 according to the jack state
1675 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001676 spec->gen.automute_hook = alc260_gpio1_automute;
1677 spec->gen.detect_hp = 1;
1678 spec->gen.automute_speaker = 1;
1679 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001680 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001681 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001682 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001683 }
1684}
1685
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001686static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001687 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001688{
1689 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001690 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001691 { 0x0f, 0x02214000 }, /* HP/speaker */
1692 { 0x12, 0x90a60160 }, /* int mic */
1693 { 0x13, 0x02a19000 }, /* ext mic */
1694 { 0x18, 0x01446000 }, /* SPDIF out */
1695 /* disable bogus I/O pins */
1696 { 0x10, 0x411111f0 },
1697 { 0x11, 0x411111f0 },
1698 { 0x14, 0x411111f0 },
1699 { 0x15, 0x411111f0 },
1700 { 0x16, 0x411111f0 },
1701 { 0x17, 0x411111f0 },
1702 { 0x19, 0x411111f0 },
1703 { }
1704 };
1705
1706 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001707 case HDA_FIXUP_ACT_PRE_PROBE:
1708 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001709 spec->init_amp = ALC_INIT_NONE;
1710 break;
1711 }
1712}
1713
Takashi Iwai39aedee2013-01-10 17:10:40 +01001714static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1715 const struct hda_fixup *fix, int action)
1716{
1717 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001718 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001719 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001720}
1721
1722static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1723 const struct hda_fixup *fix, int action)
1724{
1725 struct alc_spec *spec = codec->spec;
1726 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001727 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001728 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001729 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001730}
1731
Takashi Iwai1727a772013-01-10 09:52:52 +01001732static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001733 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001734 .type = HDA_FIXUP_PINS,
1735 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001736 { 0x11, 0x90130110 }, /* speaker */
1737 { }
1738 }
1739 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001740 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001741 .type = HDA_FIXUP_PINS,
1742 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001743 { 0x0f, 0x01214000 }, /* HP */
1744 { }
1745 }
1746 },
1747 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001748 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001749 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001750 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1751 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001752 { }
1753 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001754 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001755 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001756 .type = HDA_FIXUP_FUNC,
1757 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001758 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001759 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001760 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001761 .v.func = alc260_fixup_gpio1_toggle,
1762 .chained = true,
1763 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1764 },
1765 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001766 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001767 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001768 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1769 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001770 { }
1771 },
1772 .chained = true,
1773 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1774 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001775 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001776 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001777 .v.func = alc260_fixup_gpio1_toggle,
1778 .chained = true,
1779 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001780 },
1781 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001782 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001783 .v.func = alc260_fixup_kn1,
1784 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001785 [ALC260_FIXUP_FSC_S7020] = {
1786 .type = HDA_FIXUP_FUNC,
1787 .v.func = alc260_fixup_fsc_s7020,
1788 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001789 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1790 .type = HDA_FIXUP_FUNC,
1791 .v.func = alc260_fixup_fsc_s7020_jwse,
1792 .chained = true,
1793 .chain_id = ALC260_FIXUP_FSC_S7020,
1794 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001795 [ALC260_FIXUP_VAIO_PINS] = {
1796 .type = HDA_FIXUP_PINS,
1797 .v.pins = (const struct hda_pintbl[]) {
1798 /* Pin configs are missing completely on some VAIOs */
1799 { 0x0f, 0x01211020 },
1800 { 0x10, 0x0001003f },
1801 { 0x11, 0x411111f0 },
1802 { 0x12, 0x01a15930 },
1803 { 0x13, 0x411111f0 },
1804 { 0x14, 0x411111f0 },
1805 { 0x15, 0x411111f0 },
1806 { 0x16, 0x411111f0 },
1807 { 0x17, 0x411111f0 },
1808 { 0x18, 0x411111f0 },
1809 { 0x19, 0x411111f0 },
1810 { }
1811 }
1812 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001813};
1814
1815static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001816 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001817 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001818 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001819 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001820 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001821 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001822 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001823 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001824 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001825 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001826 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001827 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001828 {}
1829};
1830
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001831static const struct hda_model_fixup alc260_fixup_models[] = {
1832 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1833 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1834 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1835 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1836 {}
1837};
1838
Takashi Iwai1d045db2011-07-07 18:23:21 +02001839/*
1840 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001841static int patch_alc260(struct hda_codec *codec)
1842{
1843 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001844 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001845
Takashi Iwai3de95172012-05-07 18:03:15 +02001846 err = alc_alloc_spec(codec, 0x07);
1847 if (err < 0)
1848 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001849
Takashi Iwai3de95172012-05-07 18:03:15 +02001850 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001851 /* as quite a few machines require HP amp for speaker outputs,
1852 * it's easier to enable it unconditionally; even if it's unneeded,
1853 * it's almost harmless.
1854 */
1855 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001856 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001857
Takashi Iwai225068a2015-05-29 10:42:14 +02001858 spec->shutup = alc_eapd_shutup;
1859
Takashi Iwaic9af7532019-05-10 11:01:43 +02001860 alc_pre_init(codec);
1861
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001862 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1863 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001864 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001865
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001866 /* automatic parse from the BIOS config */
1867 err = alc260_parse_auto_config(codec);
1868 if (err < 0)
1869 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001870
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001871 if (!spec->gen.no_analog) {
1872 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1873 if (err < 0)
1874 goto error;
1875 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001876
Takashi Iwai1727a772013-01-10 09:52:52 +01001877 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001878
Takashi Iwai1d045db2011-07-07 18:23:21 +02001879 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001880
1881 error:
1882 alc_free(codec);
1883 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001884}
1885
1886
1887/*
1888 * ALC882/883/885/888/889 support
1889 *
1890 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1891 * configuration. Each pin widget can choose any input DACs and a mixer.
1892 * Each ADC is connected from a mixer of all inputs. This makes possible
1893 * 6-channel independent captures.
1894 *
1895 * In addition, an independent DAC for the multi-playback (not used in this
1896 * driver yet).
1897 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001898
1899/*
1900 * Pin config fixes
1901 */
1902enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001903 ALC882_FIXUP_ABIT_AW9D_MAX,
1904 ALC882_FIXUP_LENOVO_Y530,
1905 ALC882_FIXUP_PB_M5210,
1906 ALC882_FIXUP_ACER_ASPIRE_7736,
1907 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001908 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001909 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001910 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001911 ALC888_FIXUP_EEE1601,
PeiSen Hou4841b8e2021-02-02 10:30:22 +01001912 ALC886_FIXUP_EAPD,
Takashi Iwai177943a32011-11-09 12:55:18 +01001913 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001914 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001915 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001916 ALC882_FIXUP_GPIO1,
1917 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001918 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001919 ALC889_FIXUP_COEF,
1920 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001921 ALC882_FIXUP_ACER_ASPIRE_4930G,
1922 ALC882_FIXUP_ACER_ASPIRE_8930G,
1923 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001924 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001925 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001926 ALC889_FIXUP_MBP_VREF,
1927 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001928 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001929 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001930 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001931 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001932 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001933 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001934 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001935 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001936 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001937 ALC1220_FIXUP_CLEVO_P950,
Richard Sailer80690a22019-04-02 15:52:04 +02001938 ALC1220_FIXUP_CLEVO_PB51ED,
1939 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Jian-Hong Panca184352020-10-07 13:22:25 +08001940 ALC887_FIXUP_ASUS_AUDIO,
1941 ALC887_FIXUP_ASUS_HMIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001942};
1943
Takashi Iwai68ef0562011-11-09 18:24:44 +01001944static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001945 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001946{
Takashi Iwai1727a772013-01-10 09:52:52 +01001947 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001948 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001949 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001950}
1951
Takashi Iwai56710872011-11-14 17:42:11 +01001952/* set up GPIO at initialization */
1953static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001954 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001955{
Takashi Iwai215c8502018-06-19 22:34:26 +02001956 struct alc_spec *spec = codec->spec;
1957
1958 spec->gpio_write_delay = true;
1959 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001960}
1961
Takashi Iwai02a237b2012-02-13 15:25:07 +01001962/* Fix the connection of some pins for ALC889:
1963 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1964 * work correctly (bko#42740)
1965 */
1966static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001967 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001968{
Takashi Iwai1727a772013-01-10 09:52:52 +01001969 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001970 /* fake the connections during parsing the tree */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001971 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1972 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1973 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1974 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1975 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1976 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001977 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001978 /* restore the connections */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001979 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1980 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1981 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1982 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1983 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001984 }
1985}
1986
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001987/* Set VREF on HP pin */
1988static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001989 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001990{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001991 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001992 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001993 int i;
1994
Takashi Iwai1727a772013-01-10 09:52:52 +01001995 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001996 return;
1997 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1998 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1999 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2000 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002001 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002002 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002003 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01002004 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002005 break;
2006 }
2007}
2008
Takashi Iwai0756f092013-12-04 13:59:45 +01002009static void alc889_fixup_mac_pins(struct hda_codec *codec,
2010 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002011{
2012 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002013 int i;
2014
Takashi Iwai0756f092013-12-04 13:59:45 +01002015 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002016 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002017 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002018 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002019 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002020 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01002021 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002022}
2023
Takashi Iwai0756f092013-12-04 13:59:45 +01002024/* Set VREF on speaker pins on imac91 */
2025static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2026 const struct hda_fixup *fix, int action)
2027{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002028 static const hda_nid_t nids[] = { 0x18, 0x1a };
Takashi Iwai0756f092013-12-04 13:59:45 +01002029
2030 if (action == HDA_FIXUP_ACT_INIT)
2031 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2032}
2033
Adrien Vergée7729a42014-01-24 14:56:14 -05002034/* Set VREF on speaker pins on mba11 */
2035static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2036 const struct hda_fixup *fix, int action)
2037{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002038 static const hda_nid_t nids[] = { 0x18 };
Adrien Vergée7729a42014-01-24 14:56:14 -05002039
2040 if (action == HDA_FIXUP_ACT_INIT)
2041 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2042}
2043
Takashi Iwai0756f092013-12-04 13:59:45 +01002044/* Set VREF on speaker pins on mba21 */
2045static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2046 const struct hda_fixup *fix, int action)
2047{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002048 static const hda_nid_t nids[] = { 0x18, 0x19 };
Takashi Iwai0756f092013-12-04 13:59:45 +01002049
2050 if (action == HDA_FIXUP_ACT_INIT)
2051 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2052}
2053
Takashi Iwaie427c232012-07-29 10:04:08 +02002054/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09002055 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2056 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02002057 */
2058static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002059 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02002060{
2061 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002062 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002063 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002064 spec->gen.no_multi_io = 1;
2065 }
Takashi Iwaie427c232012-07-29 10:04:08 +02002066}
2067
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002068static void alc_fixup_bass_chmap(struct hda_codec *codec,
2069 const struct hda_fixup *fix, int action);
2070
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002071/* For dual-codec configuration, we need to disable some features to avoid
2072 * conflicts of kctls and PCM streams
2073 */
2074static void alc_fixup_dual_codecs(struct hda_codec *codec,
2075 const struct hda_fixup *fix, int action)
2076{
2077 struct alc_spec *spec = codec->spec;
2078
2079 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2080 return;
2081 /* disable vmaster */
2082 spec->gen.suppress_vmaster = 1;
2083 /* auto-mute and auto-mic switch don't work with multiple codecs */
2084 spec->gen.suppress_auto_mute = 1;
2085 spec->gen.suppress_auto_mic = 1;
2086 /* disable aamix as well */
2087 spec->gen.mixer_nid = 0;
2088 /* add location prefix to avoid conflicts */
2089 codec->force_pin_prefix = 1;
2090}
2091
2092static void rename_ctl(struct hda_codec *codec, const char *oldname,
2093 const char *newname)
2094{
2095 struct snd_kcontrol *kctl;
2096
2097 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2098 if (kctl)
2099 strcpy(kctl->id.name, newname);
2100}
2101
2102static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2103 const struct hda_fixup *fix,
2104 int action)
2105{
2106 alc_fixup_dual_codecs(codec, fix, action);
2107 switch (action) {
2108 case HDA_FIXUP_ACT_PRE_PROBE:
2109 /* override card longname to provide a unique UCM profile */
2110 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2111 break;
2112 case HDA_FIXUP_ACT_BUILD:
2113 /* rename Capture controls depending on the codec */
2114 rename_ctl(codec, "Capture Volume",
2115 codec->addr == 0 ?
2116 "Rear-Panel Capture Volume" :
2117 "Front-Panel Capture Volume");
2118 rename_ctl(codec, "Capture Switch",
2119 codec->addr == 0 ?
2120 "Rear-Panel Capture Switch" :
2121 "Front-Panel Capture Switch");
2122 break;
2123 }
2124}
2125
Peisen0202f5c2017-10-26 10:35:36 +08002126static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2127 const struct hda_fixup *fix,
2128 int action)
2129{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002130 static const hda_nid_t conn1[] = { 0x0c };
Peisen0202f5c2017-10-26 10:35:36 +08002131
2132 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2133 return;
2134
2135 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2136 /* We therefore want to make sure 0x14 (front headphone) and
2137 * 0x1b (speakers) use the stereo DAC 0x02
2138 */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002139 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2140 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Peisen0202f5c2017-10-26 10:35:36 +08002141}
2142
Jeremy Soller7f665b12019-02-13 10:56:19 -07002143static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2144 const struct hda_fixup *fix, int action);
2145
Richard Sailer80690a22019-04-02 15:52:04 +02002146static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002147 const struct hda_fixup *fix,
2148 int action)
2149{
2150 alc1220_fixup_clevo_p950(codec, fix, action);
2151 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2152}
2153
Jian-Hong Panca184352020-10-07 13:22:25 +08002154static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2155 struct hda_jack_callback *jack)
2156{
2157 struct alc_spec *spec = codec->spec;
2158 unsigned int vref;
2159
2160 snd_hda_gen_hp_automute(codec, jack);
2161
2162 if (spec->gen.hp_jack_present)
2163 vref = AC_PINCTL_VREF_80;
2164 else
2165 vref = AC_PINCTL_VREF_HIZ;
2166 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2167}
2168
2169static void alc887_fixup_asus_jack(struct hda_codec *codec,
2170 const struct hda_fixup *fix, int action)
2171{
2172 struct alc_spec *spec = codec->spec;
2173 if (action != HDA_FIXUP_ACT_PROBE)
2174 return;
2175 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2176 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2177}
2178
Takashi Iwai1727a772013-01-10 09:52:52 +01002179static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002180 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002181 .type = HDA_FIXUP_PINS,
2182 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002183 { 0x15, 0x01080104 }, /* side */
2184 { 0x16, 0x01011012 }, /* rear */
2185 { 0x17, 0x01016011 }, /* clfe */
2186 { }
2187 }
2188 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002189 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002190 .type = HDA_FIXUP_PINS,
2191 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002192 { 0x15, 0x99130112 }, /* rear int speakers */
2193 { 0x16, 0x99130111 }, /* subwoofer */
2194 { }
2195 }
2196 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002197 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002198 .type = HDA_FIXUP_PINCTLS,
2199 .v.pins = (const struct hda_pintbl[]) {
2200 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002201 {}
2202 }
2203 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002204 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002205 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002206 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002207 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002208 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002209 .type = HDA_FIXUP_PINS,
2210 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002211 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2212 { }
2213 }
2214 },
Marton Balint8f239212012-03-05 21:33:23 +01002215 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002216 .type = HDA_FIXUP_PINS,
2217 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002218 { 0x1c, 0x993301f0 }, /* CD */
2219 { }
2220 }
2221 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002222 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2223 .type = HDA_FIXUP_PINS,
2224 .v.pins = (const struct hda_pintbl[]) {
2225 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2226 { }
2227 },
2228 .chained = true,
2229 .chain_id = ALC889_FIXUP_CD,
2230 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002231 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002232 .type = HDA_FIXUP_PINS,
2233 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002234 { 0x17, 0x90170111 }, /* hidden surround speaker */
2235 { }
2236 }
2237 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002238 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002239 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002240 .v.verbs = (const struct hda_verb[]) {
2241 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2242 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2243 { }
2244 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002245 },
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002246 [ALC886_FIXUP_EAPD] = {
2247 .type = HDA_FIXUP_VERBS,
2248 .v.verbs = (const struct hda_verb[]) {
2249 /* change to EAPD mode */
2250 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2251 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2252 { }
2253 }
2254 },
Takashi Iwai177943a32011-11-09 12:55:18 +01002255 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002256 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002257 .v.verbs = (const struct hda_verb[]) {
2258 /* change to EAPD mode */
2259 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2260 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2261 { }
2262 }
2263 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002264 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002265 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002266 .v.verbs = (const struct hda_verb[]) {
2267 /* change to EAPD mode */
2268 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2269 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2270 { }
2271 }
2272 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002273 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002274 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002275 .v.verbs = (const struct hda_verb[]) {
2276 /* eanable EAPD on Acer laptops */
2277 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2278 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2279 { }
2280 }
2281 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002282 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002283 .type = HDA_FIXUP_FUNC,
2284 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002285 },
2286 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002287 .type = HDA_FIXUP_FUNC,
2288 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002289 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002290 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002291 .type = HDA_FIXUP_FUNC,
2292 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002293 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002294 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002295 .type = HDA_FIXUP_FUNC,
2296 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002297 .chained = true,
2298 .chain_id = ALC882_FIXUP_EAPD,
2299 },
2300 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002301 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002302 .v.func = alc889_fixup_coef,
2303 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002304 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002305 .type = HDA_FIXUP_PINS,
2306 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002307 { 0x16, 0x99130111 }, /* CLFE speaker */
2308 { 0x17, 0x99130112 }, /* surround speaker */
2309 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002310 },
2311 .chained = true,
2312 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002313 },
2314 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002315 .type = HDA_FIXUP_PINS,
2316 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002317 { 0x16, 0x99130111 }, /* CLFE speaker */
2318 { 0x1b, 0x99130112 }, /* surround speaker */
2319 { }
2320 },
2321 .chained = true,
2322 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2323 },
2324 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2325 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002326 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002327 .v.verbs = (const struct hda_verb[]) {
2328 /* Enable all DACs */
2329 /* DAC DISABLE/MUTE 1? */
2330 /* setting bits 1-5 disables DAC nids 0x02-0x06
2331 * apparently. Init=0x38 */
2332 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2333 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2334 /* DAC DISABLE/MUTE 2? */
2335 /* some bit here disables the other DACs.
2336 * Init=0x4900 */
2337 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2338 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2339 /* DMIC fix
2340 * This laptop has a stereo digital microphone.
2341 * The mics are only 1cm apart which makes the stereo
2342 * useless. However, either the mic or the ALC889
2343 * makes the signal become a difference/sum signal
2344 * instead of standard stereo, which is annoying.
2345 * So instead we flip this bit which makes the
2346 * codec replicate the sum signal to both channels,
2347 * turning it into a normal mono mic.
2348 */
2349 /* DMIC_CONTROL? Init value = 0x0001 */
2350 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2351 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2352 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2353 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2354 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002355 },
2356 .chained = true,
2357 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002358 },
Takashi Iwai56710872011-11-14 17:42:11 +01002359 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002360 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002361 .v.func = alc885_fixup_macpro_gpio,
2362 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002363 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002364 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002365 .v.func = alc889_fixup_dac_route,
2366 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002367 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002368 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002369 .v.func = alc889_fixup_mbp_vref,
2370 .chained = true,
2371 .chain_id = ALC882_FIXUP_GPIO1,
2372 },
2373 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002374 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002375 .v.func = alc889_fixup_imac91_vref,
2376 .chained = true,
2377 .chain_id = ALC882_FIXUP_GPIO1,
2378 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002379 [ALC889_FIXUP_MBA11_VREF] = {
2380 .type = HDA_FIXUP_FUNC,
2381 .v.func = alc889_fixup_mba11_vref,
2382 .chained = true,
2383 .chain_id = ALC889_FIXUP_MBP_VREF,
2384 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002385 [ALC889_FIXUP_MBA21_VREF] = {
2386 .type = HDA_FIXUP_FUNC,
2387 .v.func = alc889_fixup_mba21_vref,
2388 .chained = true,
2389 .chain_id = ALC889_FIXUP_MBP_VREF,
2390 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002391 [ALC889_FIXUP_MP11_VREF] = {
2392 .type = HDA_FIXUP_FUNC,
2393 .v.func = alc889_fixup_mba11_vref,
2394 .chained = true,
2395 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2396 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002397 [ALC889_FIXUP_MP41_VREF] = {
2398 .type = HDA_FIXUP_FUNC,
2399 .v.func = alc889_fixup_mbp_vref,
2400 .chained = true,
2401 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2402 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002403 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002404 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002405 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002406 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002407 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002408 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002409 .v.func = alc882_fixup_no_primary_hp,
2410 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002411 [ALC887_FIXUP_ASUS_BASS] = {
2412 .type = HDA_FIXUP_PINS,
2413 .v.pins = (const struct hda_pintbl[]) {
2414 {0x16, 0x99130130}, /* bass speaker */
2415 {}
2416 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002417 .chained = true,
2418 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2419 },
2420 [ALC887_FIXUP_BASS_CHMAP] = {
2421 .type = HDA_FIXUP_FUNC,
2422 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002423 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002424 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2425 .type = HDA_FIXUP_FUNC,
2426 .v.func = alc1220_fixup_gb_dual_codecs,
2427 },
Peisen0202f5c2017-10-26 10:35:36 +08002428 [ALC1220_FIXUP_CLEVO_P950] = {
2429 .type = HDA_FIXUP_FUNC,
2430 .v.func = alc1220_fixup_clevo_p950,
2431 },
Richard Sailer80690a22019-04-02 15:52:04 +02002432 [ALC1220_FIXUP_CLEVO_PB51ED] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002433 .type = HDA_FIXUP_FUNC,
Richard Sailer80690a22019-04-02 15:52:04 +02002434 .v.func = alc1220_fixup_clevo_pb51ed,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002435 },
Richard Sailer80690a22019-04-02 15:52:04 +02002436 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002437 .type = HDA_FIXUP_PINS,
2438 .v.pins = (const struct hda_pintbl[]) {
2439 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2440 {}
2441 },
2442 .chained = true,
Richard Sailer80690a22019-04-02 15:52:04 +02002443 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002444 },
Jian-Hong Panca184352020-10-07 13:22:25 +08002445 [ALC887_FIXUP_ASUS_AUDIO] = {
2446 .type = HDA_FIXUP_PINS,
2447 .v.pins = (const struct hda_pintbl[]) {
2448 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2449 { 0x19, 0x22219420 },
2450 {}
2451 },
2452 },
2453 [ALC887_FIXUP_ASUS_HMIC] = {
2454 .type = HDA_FIXUP_FUNC,
2455 .v.func = alc887_fixup_asus_jack,
2456 .chained = true,
2457 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2458 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002459};
2460
2461static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002462 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2463 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002464 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002465 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2466 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2467 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2468 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002469 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2470 ALC882_FIXUP_ACER_ASPIRE_4930G),
2471 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2472 ALC882_FIXUP_ACER_ASPIRE_4930G),
2473 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2474 ALC882_FIXUP_ACER_ASPIRE_8930G),
2475 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2476 ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaib2650472021-04-28 13:26:52 +02002477 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2478 ALC882_FIXUP_ACER_ASPIRE_4930G),
2479 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002480 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2481 ALC882_FIXUP_ACER_ASPIRE_4930G),
2482 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2483 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002484 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2485 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002486 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002487 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002488 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002489 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002490 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002491 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Jian-Hong Panca184352020-10-07 13:22:25 +08002492 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002493 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002494 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002495 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaib7529c12021-04-28 13:26:53 +02002496 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2497 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002498 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002499 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002500 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002501
2502 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002503 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2504 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2505 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002506 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002507 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2508 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002509 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2510 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002511 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002512 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002513 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002514 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2515 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002516 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002517 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2518 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2519 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002520 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002521 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002522 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2523 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002524 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002525
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002526 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002527 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002528 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002529 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Christian Lachner0d45e862020-02-23 10:24:16 +01002530 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
Christian Lachnerd9e8fe02020-05-18 07:38:44 +02002531 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia0b03952020-06-16 15:21:50 +02002532 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia655e2b2020-02-17 16:19:47 +01002533 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai09926202020-12-20 09:09:43 +01002534 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai1d3aa4a2020-04-08 15:56:45 +02002535 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7dafba32020-02-12 09:10:47 +01002536 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaicc5049a2020-02-18 09:09:15 +01002537 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002538 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai26af1772021-03-03 15:23:46 +01002539 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwai63691582017-05-22 16:32:46 +02002540 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002541 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002542 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
PeiSen Hou259eb822020-05-19 08:50:12 +02002543 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002544 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2545 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2546 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002547 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002548 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2549 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002550 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002551 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2552 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Takashi Iwai13e1a4c2021-04-28 13:26:54 +02002553 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2554 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2555 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2556 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2557 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2558 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2559 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2560 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2561 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2562 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2563 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2564 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002565 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2566 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002567 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002568 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002569 {}
2570};
2571
Takashi Iwai1727a772013-01-10 09:52:52 +01002572static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002573 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2574 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2575 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2576 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2577 {.id = ALC889_FIXUP_CD, .name = "cd"},
2578 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2579 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2580 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2581 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2582 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2583 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2584 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2585 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2586 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2587 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002588 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2589 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2590 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002591 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2592 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2593 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2594 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2595 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2596 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2597 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2598 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002599 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002600 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002601 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002602 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002603 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002604 {}
2605};
2606
Hui Wang119b75c2021-05-22 11:47:41 +08002607static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2608 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2609 {0x14, 0x01014010},
2610 {0x15, 0x01011012},
2611 {0x16, 0x01016011},
2612 {0x18, 0x01a19040},
2613 {0x19, 0x02a19050},
2614 {0x1a, 0x0181304f},
2615 {0x1b, 0x0221401f},
2616 {0x1e, 0x01456130}),
2617 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2618 {0x14, 0x01015010},
2619 {0x15, 0x01011012},
2620 {0x16, 0x01011011},
2621 {0x18, 0x01a11040},
2622 {0x19, 0x02a19050},
2623 {0x1a, 0x0181104f},
2624 {0x1b, 0x0221401f},
2625 {0x1e, 0x01451130}),
2626 {}
2627};
2628
Takashi Iwai1d045db2011-07-07 18:23:21 +02002629/*
2630 * BIOS auto configuration
2631 */
2632/* almost identical with ALC880 parser... */
2633static int alc882_parse_auto_config(struct hda_codec *codec)
2634{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002635 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002636 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2637 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002638}
2639
Takashi Iwai1d045db2011-07-07 18:23:21 +02002640/*
2641 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002642static int patch_alc882(struct hda_codec *codec)
2643{
2644 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002645 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002646
Takashi Iwai3de95172012-05-07 18:03:15 +02002647 err = alc_alloc_spec(codec, 0x0b);
2648 if (err < 0)
2649 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002650
Takashi Iwai3de95172012-05-07 18:03:15 +02002651 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002652
Takashi Iwai7639a062015-03-03 10:07:24 +01002653 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002654 case 0x10ec0882:
2655 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002656 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002657 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002658 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002659 break;
2660 default:
2661 /* ALC883 and variants */
2662 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2663 break;
2664 }
2665
Takashi Iwaic9af7532019-05-10 11:01:43 +02002666 alc_pre_init(codec);
2667
Takashi Iwai1727a772013-01-10 09:52:52 +01002668 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002669 alc882_fixups);
Hui Wang119b75c2021-05-22 11:47:41 +08002670 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +01002671 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002672
2673 alc_auto_parse_customize_define(codec);
2674
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002675 if (has_cdefine_beep(codec))
2676 spec->gen.beep_nid = 0x01;
2677
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002678 /* automatic parse from the BIOS config */
2679 err = alc882_parse_auto_config(codec);
2680 if (err < 0)
2681 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002682
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002683 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2684 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2685 if (err < 0)
2686 goto error;
2687 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002688
Takashi Iwai1727a772013-01-10 09:52:52 +01002689 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002690
Takashi Iwai1d045db2011-07-07 18:23:21 +02002691 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002692
2693 error:
2694 alc_free(codec);
2695 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002696}
2697
2698
2699/*
2700 * ALC262 support
2701 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002702static int alc262_parse_auto_config(struct hda_codec *codec)
2703{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002704 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002705 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2706 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002707}
2708
2709/*
2710 * Pin config fixes
2711 */
2712enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002713 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002714 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002715 ALC262_FIXUP_HP_Z200,
2716 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002717 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002718 ALC262_FIXUP_BENQ,
2719 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002720 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002721 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002722};
2723
Takashi Iwai1727a772013-01-10 09:52:52 +01002724static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002725 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002726 .type = HDA_FIXUP_PINS,
2727 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002728 { 0x14, 0x99130110 }, /* speaker */
2729 { 0x15, 0x0221142f }, /* front HP */
2730 { 0x1b, 0x0121141f }, /* rear HP */
2731 { }
2732 }
2733 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002734 [ALC262_FIXUP_FSC_S7110] = {
2735 .type = HDA_FIXUP_PINS,
2736 .v.pins = (const struct hda_pintbl[]) {
2737 { 0x15, 0x90170110 }, /* speaker */
2738 { }
2739 },
2740 .chained = true,
2741 .chain_id = ALC262_FIXUP_BENQ,
2742 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002743 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002744 .type = HDA_FIXUP_PINS,
2745 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002746 { 0x16, 0x99130120 }, /* internal speaker */
2747 { }
2748 }
2749 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002750 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002751 .type = HDA_FIXUP_PINS,
2752 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002753 { 0x14, 0x1993e1f0 }, /* int AUX */
2754 { }
2755 }
2756 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002757 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002758 .type = HDA_FIXUP_PINCTLS,
2759 .v.pins = (const struct hda_pintbl[]) {
2760 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002761 {}
2762 },
2763 .chained = true,
2764 .chain_id = ALC262_FIXUP_BENQ,
2765 },
2766 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002767 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002768 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002769 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2770 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2771 {}
2772 }
2773 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002774 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002775 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002776 .v.verbs = (const struct hda_verb[]) {
2777 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2778 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2779 {}
2780 }
2781 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002782 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002783 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002784 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002785 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002786 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2787 .type = HDA_FIXUP_FUNC,
2788 .v.func = alc_fixup_no_depop_delay,
2789 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002790};
2791
2792static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002793 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002794 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002795 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002796 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002797 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002798 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002799 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002800 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2801 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002802 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002803 {}
2804};
2805
Takashi Iwai1727a772013-01-10 09:52:52 +01002806static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002807 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002808 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2809 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2810 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2811 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2812 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2813 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2814 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2815 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002816 {}
2817};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002818
Takashi Iwai1d045db2011-07-07 18:23:21 +02002819/*
2820 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002821static int patch_alc262(struct hda_codec *codec)
2822{
2823 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002824 int err;
2825
Takashi Iwai3de95172012-05-07 18:03:15 +02002826 err = alc_alloc_spec(codec, 0x0b);
2827 if (err < 0)
2828 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002829
Takashi Iwai3de95172012-05-07 18:03:15 +02002830 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002831 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002832
Takashi Iwai225068a2015-05-29 10:42:14 +02002833 spec->shutup = alc_eapd_shutup;
2834
Takashi Iwai1d045db2011-07-07 18:23:21 +02002835#if 0
2836 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2837 * under-run
2838 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002839 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002840#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002841 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2842
Takashi Iwaic9af7532019-05-10 11:01:43 +02002843 alc_pre_init(codec);
2844
Takashi Iwai1727a772013-01-10 09:52:52 +01002845 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002846 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002847 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002848
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002849 alc_auto_parse_customize_define(codec);
2850
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002851 if (has_cdefine_beep(codec))
2852 spec->gen.beep_nid = 0x01;
2853
Takashi Iwai42399f72011-11-07 17:18:44 +01002854 /* automatic parse from the BIOS config */
2855 err = alc262_parse_auto_config(codec);
2856 if (err < 0)
2857 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002858
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002859 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2860 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2861 if (err < 0)
2862 goto error;
2863 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002864
Takashi Iwai1727a772013-01-10 09:52:52 +01002865 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002866
Takashi Iwai1d045db2011-07-07 18:23:21 +02002867 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002868
2869 error:
2870 alc_free(codec);
2871 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002872}
2873
2874/*
2875 * ALC268
2876 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002877/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002878static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2879 struct snd_ctl_elem_value *ucontrol)
2880{
2881 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2882 unsigned long pval;
2883 int err;
2884
2885 mutex_lock(&codec->control_mutex);
2886 pval = kcontrol->private_value;
2887 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2888 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2889 if (err >= 0) {
2890 kcontrol->private_value = (pval & ~0xff) | 0x10;
2891 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2892 }
2893 kcontrol->private_value = pval;
2894 mutex_unlock(&codec->control_mutex);
2895 return err;
2896}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002897
2898static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2899 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002900 {
2901 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2902 .name = "Beep Playback Switch",
2903 .subdevice = HDA_SUBDEV_AMP_FLAG,
2904 .info = snd_hda_mixer_amp_switch_info,
2905 .get = snd_hda_mixer_amp_switch_get,
2906 .put = alc268_beep_switch_put,
2907 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2908 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002909};
2910
2911/* set PCBEEP vol = 0, mute connections */
2912static const struct hda_verb alc268_beep_init_verbs[] = {
2913 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2914 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2915 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2916 { }
2917};
2918
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002919enum {
2920 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002921 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002922 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002923};
2924
Takashi Iwai1727a772013-01-10 09:52:52 +01002925static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002926 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002927 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002928 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002929 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002930 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002931 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002932 .v.verbs = (const struct hda_verb[]) {
2933 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2934 {}
2935 }
2936 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002937 [ALC268_FIXUP_SPDIF] = {
2938 .type = HDA_FIXUP_PINS,
2939 .v.pins = (const struct hda_pintbl[]) {
2940 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2941 {}
2942 }
2943 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002944};
2945
Takashi Iwai1727a772013-01-10 09:52:52 +01002946static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002947 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002948 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002949 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002950 {}
2951};
2952
2953static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002954 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002955 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002956 /* below is codec SSID since multiple Toshiba laptops have the
2957 * same PCI SSID 1179:ff00
2958 */
2959 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002960 {}
2961};
2962
Takashi Iwai1d045db2011-07-07 18:23:21 +02002963/*
2964 * BIOS auto configuration
2965 */
2966static int alc268_parse_auto_config(struct hda_codec *codec)
2967{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002968 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002969 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002970}
2971
Takashi Iwai1d045db2011-07-07 18:23:21 +02002972/*
2973 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002974static int patch_alc268(struct hda_codec *codec)
2975{
2976 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002977 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002978
Takashi Iwai1d045db2011-07-07 18:23:21 +02002979 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002980 err = alc_alloc_spec(codec, 0);
2981 if (err < 0)
2982 return err;
2983
2984 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02002985 if (has_cdefine_beep(codec))
2986 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002987
Takashi Iwai225068a2015-05-29 10:42:14 +02002988 spec->shutup = alc_eapd_shutup;
2989
Takashi Iwaic9af7532019-05-10 11:01:43 +02002990 alc_pre_init(codec);
2991
Takashi Iwai1727a772013-01-10 09:52:52 +01002992 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2993 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002994
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002995 /* automatic parse from the BIOS config */
2996 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002997 if (err < 0)
2998 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002999
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003000 if (err > 0 && !spec->gen.no_analog &&
3001 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02003002 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3003 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3004 &alc268_beep_mixer[i])) {
3005 err = -ENOMEM;
3006 goto error;
3007 }
3008 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003009 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003010 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3011 /* override the amp caps for beep generator */
3012 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3013 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3014 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3015 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3016 (0 << AC_AMPCAP_MUTE_SHIFT));
3017 }
3018
Takashi Iwai1727a772013-01-10 09:52:52 +01003019 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003020
Takashi Iwai1d045db2011-07-07 18:23:21 +02003021 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02003022
3023 error:
3024 alc_free(codec);
3025 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003026}
3027
3028/*
3029 * ALC269
3030 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003031
Takashi Iwai1d045db2011-07-07 18:23:21 +02003032static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003033 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003034};
3035
3036static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003037 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003038};
3039
Takashi Iwai1d045db2011-07-07 18:23:21 +02003040/* different alc269-variants */
3041enum {
3042 ALC269_TYPE_ALC269VA,
3043 ALC269_TYPE_ALC269VB,
3044 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02003045 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01003046 ALC269_TYPE_ALC280,
3047 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02003048 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01003049 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08003050 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02003051 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08003052 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003053 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08003054 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003055 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003056 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003057 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003058 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003059 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003060 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003061 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003062};
3063
3064/*
3065 * BIOS auto configuration
3066 */
3067static int alc269_parse_auto_config(struct hda_codec *codec)
3068{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003069 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003070 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3071 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3072 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003073 const hda_nid_t *ssids;
3074
3075 switch (spec->codec_variant) {
3076 case ALC269_TYPE_ALC269VA:
3077 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003078 case ALC269_TYPE_ALC280:
3079 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003080 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003081 ssids = alc269va_ssids;
3082 break;
3083 case ALC269_TYPE_ALC269VB:
3084 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003085 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003086 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003087 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003088 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003089 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003090 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003091 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003092 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003093 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003094 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003095 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003096 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003097 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003098 ssids = alc269_ssids;
3099 break;
3100 default:
3101 ssids = alc269_ssids;
3102 break;
3103 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003104
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003105 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003106}
3107
Hui Wang476c02e2020-03-29 16:20:18 +08003108static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3109 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3110 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3111 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3112 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3113 {}
3114};
3115
3116static void alc_headset_btn_callback(struct hda_codec *codec,
3117 struct hda_jack_callback *jack)
3118{
3119 int report = 0;
3120
3121 if (jack->unsol_res & (7 << 13))
3122 report |= SND_JACK_BTN_0;
3123
3124 if (jack->unsol_res & (1 << 16 | 3 << 8))
3125 report |= SND_JACK_BTN_1;
3126
3127 /* Volume up key */
3128 if (jack->unsol_res & (7 << 23))
3129 report |= SND_JACK_BTN_2;
3130
3131 /* Volume down key */
3132 if (jack->unsol_res & (7 << 10))
3133 report |= SND_JACK_BTN_3;
3134
Hui Wang04f77912021-03-05 17:26:08 +08003135 snd_hda_jack_set_button_state(codec, jack->nid, report);
Hui Wang476c02e2020-03-29 16:20:18 +08003136}
3137
3138static void alc_disable_headset_jack_key(struct hda_codec *codec)
3139{
3140 struct alc_spec *spec = codec->spec;
3141
3142 if (!spec->has_hs_key)
3143 return;
3144
3145 switch (codec->core.vendor_id) {
3146 case 0x10ec0215:
3147 case 0x10ec0225:
3148 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003149 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003150 case 0x10ec0295:
3151 case 0x10ec0289:
3152 case 0x10ec0299:
3153 alc_write_coef_idx(codec, 0x48, 0x0);
3154 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3155 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3156 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02003157 case 0x10ec0230:
Hui Wang476c02e2020-03-29 16:20:18 +08003158 case 0x10ec0236:
3159 case 0x10ec0256:
3160 alc_write_coef_idx(codec, 0x48, 0x0);
3161 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3162 break;
3163 }
3164}
3165
3166static void alc_enable_headset_jack_key(struct hda_codec *codec)
3167{
3168 struct alc_spec *spec = codec->spec;
3169
3170 if (!spec->has_hs_key)
3171 return;
3172
3173 switch (codec->core.vendor_id) {
3174 case 0x10ec0215:
3175 case 0x10ec0225:
3176 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003177 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003178 case 0x10ec0295:
3179 case 0x10ec0289:
3180 case 0x10ec0299:
3181 alc_write_coef_idx(codec, 0x48, 0xd011);
3182 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3183 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3184 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02003185 case 0x10ec0230:
Hui Wang476c02e2020-03-29 16:20:18 +08003186 case 0x10ec0236:
3187 case 0x10ec0256:
3188 alc_write_coef_idx(codec, 0x48, 0xd011);
3189 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3190 break;
3191 }
3192}
3193
3194static void alc_fixup_headset_jack(struct hda_codec *codec,
3195 const struct hda_fixup *fix, int action)
3196{
3197 struct alc_spec *spec = codec->spec;
Hui Wang04f77912021-03-05 17:26:08 +08003198 hda_nid_t hp_pin;
Hui Wang476c02e2020-03-29 16:20:18 +08003199
3200 switch (action) {
3201 case HDA_FIXUP_ACT_PRE_PROBE:
3202 spec->has_hs_key = 1;
3203 snd_hda_jack_detect_enable_callback(codec, 0x55,
3204 alc_headset_btn_callback);
Hui Wang476c02e2020-03-29 16:20:18 +08003205 break;
Hui Wang04f77912021-03-05 17:26:08 +08003206 case HDA_FIXUP_ACT_BUILD:
3207 hp_pin = alc_get_hp_pin(spec);
3208 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3209 alc_headset_btn_keymap,
3210 hp_pin))
3211 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3212 false, SND_JACK_HEADSET,
3213 alc_headset_btn_keymap);
3214
Hui Wang476c02e2020-03-29 16:20:18 +08003215 alc_enable_headset_jack_key(codec);
3216 break;
3217 }
3218}
3219
Kailang Yang1387e2d2012-11-08 10:23:18 +01003220static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003221{
Takashi Iwai98b24882014-08-18 13:47:50 +02003222 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003223}
3224
3225static void alc269_shutup(struct hda_codec *codec)
3226{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003227 struct alc_spec *spec = codec->spec;
3228
Kailang Yang1387e2d2012-11-08 10:23:18 +01003229 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3230 alc269vb_toggle_power_output(codec, 0);
3231 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3232 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003233 msleep(150);
3234 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003235 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003236}
3237
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003238static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003239 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003240 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003241 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3242 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3243 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3244 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3245 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3246 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3247 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3248 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3249 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3250 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3251 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3252 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3253 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3254 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3255 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3256 WRITE_COEF(0x63, 0x2902), /* PLL */
3257 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3258 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3259 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3260 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3261 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3262 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3263 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3264 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3265 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3266 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3267 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3268 {}
3269};
3270
Kailang Yangcb149cb2014-03-18 16:45:32 +08003271static void alc282_restore_default_value(struct hda_codec *codec)
3272{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003273 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003274}
3275
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003276static void alc282_init(struct hda_codec *codec)
3277{
3278 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003279 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003280 bool hp_pin_sense;
3281 int coef78;
3282
Kailang Yangcb149cb2014-03-18 16:45:32 +08003283 alc282_restore_default_value(codec);
3284
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003285 if (!hp_pin)
3286 return;
3287 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3288 coef78 = alc_read_coef_idx(codec, 0x78);
3289
3290 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3291 /* Headphone capless set to high power mode */
3292 alc_write_coef_idx(codec, 0x78, 0x9004);
3293
3294 if (hp_pin_sense)
3295 msleep(2);
3296
3297 snd_hda_codec_write(codec, hp_pin, 0,
3298 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3299
3300 if (hp_pin_sense)
3301 msleep(85);
3302
3303 snd_hda_codec_write(codec, hp_pin, 0,
3304 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3305
3306 if (hp_pin_sense)
3307 msleep(100);
3308
3309 /* Headphone capless set to normal mode */
3310 alc_write_coef_idx(codec, 0x78, coef78);
3311}
3312
3313static void alc282_shutup(struct hda_codec *codec)
3314{
3315 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003316 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003317 bool hp_pin_sense;
3318 int coef78;
3319
3320 if (!hp_pin) {
3321 alc269_shutup(codec);
3322 return;
3323 }
3324
3325 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3326 coef78 = alc_read_coef_idx(codec, 0x78);
3327 alc_write_coef_idx(codec, 0x78, 0x9004);
3328
3329 if (hp_pin_sense)
3330 msleep(2);
3331
3332 snd_hda_codec_write(codec, hp_pin, 0,
3333 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3334
3335 if (hp_pin_sense)
3336 msleep(85);
3337
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003338 if (!spec->no_shutup_pins)
3339 snd_hda_codec_write(codec, hp_pin, 0,
3340 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003341
3342 if (hp_pin_sense)
3343 msleep(100);
3344
3345 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003346 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003347 alc_write_coef_idx(codec, 0x78, coef78);
3348}
3349
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003350static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003351 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003352 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003353 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3354 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3355 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3356 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3357 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3358 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3359 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3360 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3361 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3362 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3363 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3364 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3365 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3366 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3367 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3368 WRITE_COEF(0x2e, 0x2902), /* PLL */
3369 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3370 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3371 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3372 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3373 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3374 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3375 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3376 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3377 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3378 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3379 WRITE_COEF(0x49, 0x0), /* test mode */
3380 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3381 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3382 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003383 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003384 {}
3385};
3386
Kailang Yang6bd55b02014-03-17 13:51:27 +08003387static void alc283_restore_default_value(struct hda_codec *codec)
3388{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003389 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003390}
3391
Kailang Yang2af02be2013-08-22 10:03:50 +02003392static void alc283_init(struct hda_codec *codec)
3393{
3394 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003395 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003396 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003397
Kailang Yang6bd55b02014-03-17 13:51:27 +08003398 alc283_restore_default_value(codec);
3399
Kailang Yang2af02be2013-08-22 10:03:50 +02003400 if (!hp_pin)
3401 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003402
3403 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003404 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3405
3406 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3407 /* Headphone capless set to high power mode */
3408 alc_write_coef_idx(codec, 0x43, 0x9004);
3409
3410 snd_hda_codec_write(codec, hp_pin, 0,
3411 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3412
3413 if (hp_pin_sense)
3414 msleep(85);
3415
3416 snd_hda_codec_write(codec, hp_pin, 0,
3417 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3418
3419 if (hp_pin_sense)
3420 msleep(85);
3421 /* Index 0x46 Combo jack auto switch control 2 */
3422 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003423 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003424 /* Headphone capless set to normal mode */
3425 alc_write_coef_idx(codec, 0x43, 0x9614);
3426}
3427
3428static void alc283_shutup(struct hda_codec *codec)
3429{
3430 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003431 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003432 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003433
3434 if (!hp_pin) {
3435 alc269_shutup(codec);
3436 return;
3437 }
3438
3439 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3440
3441 alc_write_coef_idx(codec, 0x43, 0x9004);
3442
Harsha Priyab450b172014-10-09 11:04:56 +00003443 /*depop hp during suspend*/
3444 alc_write_coef_idx(codec, 0x06, 0x2100);
3445
Kailang Yang2af02be2013-08-22 10:03:50 +02003446 snd_hda_codec_write(codec, hp_pin, 0,
3447 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3448
3449 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003450 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003451
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003452 if (!spec->no_shutup_pins)
3453 snd_hda_codec_write(codec, hp_pin, 0,
3454 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003455
Takashi Iwai98b24882014-08-18 13:47:50 +02003456 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003457
3458 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003459 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003460 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003461 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003462 alc_write_coef_idx(codec, 0x43, 0x9614);
3463}
3464
Kailang Yang4a219ef2017-06-16 16:54:35 +08003465static void alc256_init(struct hda_codec *codec)
3466{
3467 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003468 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003469 bool hp_pin_sense;
3470
3471 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003472 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003473
3474 msleep(30);
3475
3476 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3477
3478 if (hp_pin_sense)
3479 msleep(2);
3480
3481 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003482 if (spec->ultra_low_power) {
3483 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3484 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3485 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3486 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3487 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3488 msleep(30);
3489 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003490
3491 snd_hda_codec_write(codec, hp_pin, 0,
3492 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3493
Kailang Yang6447c962019-05-08 16:27:03 +08003494 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003495 msleep(85);
3496
3497 snd_hda_codec_write(codec, hp_pin, 0,
3498 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3499
Kailang Yang6447c962019-05-08 16:27:03 +08003500 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003501 msleep(100);
3502
3503 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3504 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003505 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3506 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003507 /*
3508 * Expose headphone mic (or possibly Line In on some machines) instead
3509 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3510 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3511 * this register.
3512 */
3513 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003514}
3515
3516static void alc256_shutup(struct hda_codec *codec)
3517{
3518 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003519 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003520 bool hp_pin_sense;
3521
Kailang Yang6447c962019-05-08 16:27:03 +08003522 if (!hp_pin)
3523 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003524
3525 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3526
3527 if (hp_pin_sense)
3528 msleep(2);
3529
3530 snd_hda_codec_write(codec, hp_pin, 0,
3531 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3532
Kailang Yang6447c962019-05-08 16:27:03 +08003533 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003534 msleep(85);
3535
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003536 /* 3k pull low control for Headset jack. */
3537 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003538 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3539 * when booting with headset plugged. So skip setting it for the codec alc257
3540 */
3541 if (codec->core.vendor_id != 0x10ec0257)
3542 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003543
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003544 if (!spec->no_shutup_pins)
3545 snd_hda_codec_write(codec, hp_pin, 0,
3546 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003547
Kailang Yang6447c962019-05-08 16:27:03 +08003548 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003549 msleep(100);
3550
3551 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003552 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003553 if (spec->ultra_low_power) {
3554 msleep(50);
3555 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3556 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3557 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3558 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3559 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3560 msleep(30);
3561 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003562}
3563
Kailang Yangda911b12018-01-05 16:50:08 +08003564static void alc225_init(struct hda_codec *codec)
3565{
3566 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003567 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003568 bool hp1_pin_sense, hp2_pin_sense;
3569
3570 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003571 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003572 msleep(30);
3573
3574 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3575 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3576
3577 if (hp1_pin_sense || hp2_pin_sense)
3578 msleep(2);
3579
3580 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003581 if (spec->ultra_low_power) {
3582 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3583 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3584 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3585 msleep(30);
3586 }
Kailang Yangda911b12018-01-05 16:50:08 +08003587
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003588 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003589 snd_hda_codec_write(codec, hp_pin, 0,
3590 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3591 if (hp2_pin_sense)
3592 snd_hda_codec_write(codec, 0x16, 0,
3593 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3594
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003595 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003596 msleep(85);
3597
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003598 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003599 snd_hda_codec_write(codec, hp_pin, 0,
3600 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3601 if (hp2_pin_sense)
3602 snd_hda_codec_write(codec, 0x16, 0,
3603 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3604
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003605 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003606 msleep(100);
3607
3608 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3609 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3610}
3611
3612static void alc225_shutup(struct hda_codec *codec)
3613{
3614 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003615 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003616 bool hp1_pin_sense, hp2_pin_sense;
3617
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003618 if (!hp_pin)
3619 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003620
3621 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003622 /* 3k pull low control for Headset jack. */
3623 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3624
3625 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3626 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3627
3628 if (hp1_pin_sense || hp2_pin_sense)
3629 msleep(2);
3630
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003631 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003632 snd_hda_codec_write(codec, hp_pin, 0,
3633 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3634 if (hp2_pin_sense)
3635 snd_hda_codec_write(codec, 0x16, 0,
3636 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3637
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003638 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003639 msleep(85);
3640
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003641 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003642 snd_hda_codec_write(codec, hp_pin, 0,
3643 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3644 if (hp2_pin_sense)
3645 snd_hda_codec_write(codec, 0x16, 0,
3646 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3647
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003648 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003649 msleep(100);
3650
3651 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003652 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003653 if (spec->ultra_low_power) {
3654 msleep(50);
3655 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3656 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3657 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3658 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3659 msleep(30);
3660 }
Hui Wang476c02e2020-03-29 16:20:18 +08003661
3662 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3663 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003664}
3665
Kailang Yangc2d6af52017-06-21 14:50:54 +08003666static void alc_default_init(struct hda_codec *codec)
3667{
3668 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003669 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003670 bool hp_pin_sense;
3671
3672 if (!hp_pin)
3673 return;
3674
3675 msleep(30);
3676
3677 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3678
3679 if (hp_pin_sense)
3680 msleep(2);
3681
3682 snd_hda_codec_write(codec, hp_pin, 0,
3683 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3684
3685 if (hp_pin_sense)
3686 msleep(85);
3687
3688 snd_hda_codec_write(codec, hp_pin, 0,
3689 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3690
3691 if (hp_pin_sense)
3692 msleep(100);
3693}
3694
3695static void alc_default_shutup(struct hda_codec *codec)
3696{
3697 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003698 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003699 bool hp_pin_sense;
3700
3701 if (!hp_pin) {
3702 alc269_shutup(codec);
3703 return;
3704 }
3705
3706 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3707
3708 if (hp_pin_sense)
3709 msleep(2);
3710
3711 snd_hda_codec_write(codec, hp_pin, 0,
3712 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3713
3714 if (hp_pin_sense)
3715 msleep(85);
3716
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003717 if (!spec->no_shutup_pins)
3718 snd_hda_codec_write(codec, hp_pin, 0,
3719 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003720
3721 if (hp_pin_sense)
3722 msleep(100);
3723
3724 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003725 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003726}
3727
Kailang Yang693abe12019-01-29 15:38:21 +08003728static void alc294_hp_init(struct hda_codec *codec)
3729{
3730 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003731 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003732 int i, val;
3733
3734 if (!hp_pin)
3735 return;
3736
3737 snd_hda_codec_write(codec, hp_pin, 0,
3738 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3739
3740 msleep(100);
3741
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003742 if (!spec->no_shutup_pins)
3743 snd_hda_codec_write(codec, hp_pin, 0,
3744 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003745
3746 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3747 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3748
3749 /* Wait for depop procedure finish */
3750 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3751 for (i = 0; i < 20 && val & 0x0080; i++) {
3752 msleep(50);
3753 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3754 }
3755 /* Set HP depop to auto mode */
3756 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3757 msleep(50);
3758}
3759
3760static void alc294_init(struct hda_codec *codec)
3761{
3762 struct alc_spec *spec = codec->spec;
3763
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003764 /* required only at boot or S4 resume time */
3765 if (!spec->done_hp_init ||
3766 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003767 alc294_hp_init(codec);
3768 spec->done_hp_init = true;
3769 }
3770 alc_default_init(codec);
3771}
3772
Kailang Yangad60d502013-06-28 12:03:01 +02003773static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3774 unsigned int val)
3775{
3776 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3777 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3778 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3779}
3780
3781static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3782{
3783 unsigned int val;
3784
3785 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3786 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3787 & 0xffff;
3788 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3789 << 16;
3790 return val;
3791}
3792
3793static void alc5505_dsp_halt(struct hda_codec *codec)
3794{
3795 unsigned int val;
3796
3797 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3798 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3799 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3800 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3801 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3802 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3803 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3804 val = alc5505_coef_get(codec, 0x6220);
3805 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3806}
3807
3808static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3809{
3810 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3811 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3812 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3813 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3814 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3815 alc5505_coef_set(codec, 0x880c, 0x00000004);
3816}
3817
3818static void alc5505_dsp_init(struct hda_codec *codec)
3819{
3820 unsigned int val;
3821
3822 alc5505_dsp_halt(codec);
3823 alc5505_dsp_back_from_halt(codec);
3824 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3825 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3826 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3827 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3828 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3829 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3830 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3831 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3832 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3833 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3834 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3835 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3836 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3837
3838 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3839 if (val <= 3)
3840 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3841 else
3842 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3843
3844 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3845 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3846 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3847 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3848 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3849 alc5505_coef_set(codec, 0x880c, 0x00000003);
3850 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003851
3852#ifdef HALT_REALTEK_ALC5505
3853 alc5505_dsp_halt(codec);
3854#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003855}
3856
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003857#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003858#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3859#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003860#else
3861#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3862#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3863#endif
3864
Takashi Iwai2a439522011-07-26 09:52:50 +02003865#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003866static int alc269_suspend(struct hda_codec *codec)
3867{
3868 struct alc_spec *spec = codec->spec;
3869
3870 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003871 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003872 return alc_suspend(codec);
3873}
3874
Takashi Iwai1d045db2011-07-07 18:23:21 +02003875static int alc269_resume(struct hda_codec *codec)
3876{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003877 struct alc_spec *spec = codec->spec;
3878
Kailang Yang1387e2d2012-11-08 10:23:18 +01003879 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3880 alc269vb_toggle_power_output(codec, 0);
3881 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003882 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003883 msleep(150);
3884 }
3885
3886 codec->patch_ops.init(codec);
3887
Kailang Yang1387e2d2012-11-08 10:23:18 +01003888 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3889 alc269vb_toggle_power_output(codec, 1);
3890 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003891 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003892 msleep(200);
3893 }
3894
Takashi Iwai1a462be2020-01-09 10:01:04 +01003895 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003896 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003897
3898 /* on some machine, the BIOS will clear the codec gpio data when enter
3899 * suspend, and won't restore the data after resume, so we restore it
3900 * in the driver.
3901 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003902 if (spec->gpio_data)
3903 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003904
Kailang Yangad60d502013-06-28 12:03:01 +02003905 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003906 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003907
Takashi Iwai1d045db2011-07-07 18:23:21 +02003908 return 0;
3909}
Takashi Iwai2a439522011-07-26 09:52:50 +02003910#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003911
David Henningsson108cc102012-07-20 10:37:25 +02003912static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003913 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003914{
3915 struct alc_spec *spec = codec->spec;
3916
Takashi Iwai1727a772013-01-10 09:52:52 +01003917 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003918 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3919}
3920
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003921static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3922 const struct hda_fixup *fix,
3923 int action)
3924{
3925 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3926 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3927
3928 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3929 snd_hda_codec_set_pincfg(codec, 0x19,
3930 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3931 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3932}
3933
Takashi Iwai1d045db2011-07-07 18:23:21 +02003934static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003935 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003936{
Takashi Iwai98b24882014-08-18 13:47:50 +02003937 if (action == HDA_FIXUP_ACT_INIT)
3938 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003939}
3940
David Henningsson7c478f02013-10-11 10:18:46 +02003941static void alc269_fixup_headset_mic(struct hda_codec *codec,
3942 const struct hda_fixup *fix, int action)
3943{
3944 struct alc_spec *spec = codec->spec;
3945
3946 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3947 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3948}
3949
Takashi Iwai1d045db2011-07-07 18:23:21 +02003950static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003951 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003952{
3953 static const struct hda_verb verbs[] = {
3954 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3955 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3956 {}
3957 };
3958 unsigned int cfg;
3959
Takashi Iwai7639a062015-03-03 10:07:24 +01003960 if (strcmp(codec->core.chip_name, "ALC271X") &&
3961 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003962 return;
3963 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3964 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3965 snd_hda_sequence_write(codec, verbs);
3966}
3967
Takashi Iwaic8426b22021-04-07 11:57:30 +02003968/* Fix the speaker amp after resume, etc */
3969static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
3970 const struct hda_fixup *fix,
3971 int action)
3972{
3973 if (action == HDA_FIXUP_ACT_INIT)
3974 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
3975}
3976
Takashi Iwai017f2a12011-07-09 14:42:25 +02003977static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003978 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003979{
3980 struct alc_spec *spec = codec->spec;
3981
Takashi Iwai1727a772013-01-10 09:52:52 +01003982 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003983 return;
3984
3985 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3986 * fix the sample rate of analog I/O to 44.1kHz
3987 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003988 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3989 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003990}
3991
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003992static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003993 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003994{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003995 /* The digital-mic unit sends PDM (differential signal) instead of
3996 * the standard PCM, thus you can't record a valid mono stream as is.
3997 * Below is a workaround specific to ALC269 to control the dmic
3998 * signal source as mono.
3999 */
Takashi Iwai98b24882014-08-18 13:47:50 +02004000 if (action == HDA_FIXUP_ACT_INIT)
4001 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004002}
4003
Takashi Iwai24519912011-08-16 15:08:49 +02004004static void alc269_quanta_automute(struct hda_codec *codec)
4005{
Takashi Iwai08c189f2012-12-19 15:22:24 +01004006 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02004007
Takashi Iwai1687ccc2014-08-18 13:49:35 +02004008 alc_write_coef_idx(codec, 0x0c, 0x680);
4009 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02004010}
4011
4012static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004013 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02004014{
4015 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01004016 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02004017 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01004018 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02004019}
4020
David Henningssond240d1d2013-04-15 12:50:02 +02004021static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004022 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02004023{
4024 struct alc_spec *spec = codec->spec;
4025 int vref;
4026 msleep(200);
4027 snd_hda_gen_hp_automute(codec, jack);
4028
4029 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4030 msleep(100);
4031 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4032 vref);
4033 msleep(500);
4034 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4035 vref);
4036}
4037
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02004038/*
4039 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4040 */
4041struct hda_alc298_mbxinit {
4042 unsigned char value_0x23;
4043 unsigned char value_0x25;
4044};
4045
4046static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4047 const struct hda_alc298_mbxinit *initval,
4048 bool first)
4049{
4050 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4051 alc_write_coef_idx(codec, 0x26, 0xb000);
4052
4053 if (first)
4054 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4055
4056 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4057 alc_write_coef_idx(codec, 0x26, 0xf000);
4058 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4059
4060 if (initval->value_0x23 != 0x1e)
4061 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4062
4063 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4064 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4065}
4066
4067static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4068 const struct hda_fixup *fix,
4069 int action)
4070{
4071 /* Initialization magic */
4072 static const struct hda_alc298_mbxinit dac_init[] = {
4073 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4074 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4075 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4076 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4077 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4078 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4079 {0x2f, 0x00},
4080 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4081 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4082 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4083 {}
4084 };
4085 const struct hda_alc298_mbxinit *seq;
4086
4087 if (action != HDA_FIXUP_ACT_INIT)
4088 return;
4089
4090 /* Start */
4091 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4092 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4093 alc_write_coef_idx(codec, 0x26, 0xf000);
4094 alc_write_coef_idx(codec, 0x22, 0x31);
4095 alc_write_coef_idx(codec, 0x23, 0x0b);
4096 alc_write_coef_idx(codec, 0x25, 0x00);
4097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4098 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4099
4100 for (seq = dac_init; seq->value_0x23; seq++)
4101 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4102}
4103
David Henningssond240d1d2013-04-15 12:50:02 +02004104static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4105 const struct hda_fixup *fix, int action)
4106{
4107 struct alc_spec *spec = codec->spec;
4108 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4109 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4110 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4111 }
4112}
4113
Takashi Iwai766538a2020-06-18 13:08:41 +02004114static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4115 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004116{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004117 unsigned int pinval;
4118
Takashi Iwai766538a2020-06-18 13:08:41 +02004119 if (!pin)
4120 return;
4121 if (polarity)
4122 on = !on;
4123 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004124 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004125 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4126 /* temporarily power up/down for setting VREF */
4127 snd_hda_power_up_pm(codec);
4128 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4129 snd_hda_power_down_pm(codec);
4130}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004131
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004132/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004133static int vref_mute_led_set(struct led_classdev *led_cdev,
4134 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004135{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004136 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004137 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004138
Takashi Iwai766538a2020-06-18 13:08:41 +02004139 alc_update_vref_led(codec, spec->mute_led_nid,
4140 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004141 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004142}
4143
David Henningssond5b6b652013-11-06 10:50:44 +01004144/* Make sure the led works even in runtime suspend */
4145static unsigned int led_power_filter(struct hda_codec *codec,
4146 hda_nid_t nid,
4147 unsigned int power_state)
4148{
4149 struct alc_spec *spec = codec->spec;
4150
Hui Wang50dd9052014-07-08 17:56:15 +08004151 if (power_state != AC_PWRST_D3 || nid == 0 ||
4152 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004153 return power_state;
4154
4155 /* Set pin ctl again, it might have just been set to 0 */
4156 snd_hda_set_pin_ctl(codec, nid,
4157 snd_hda_codec_get_pin_target(codec, nid));
4158
Takashi Iwaicffd3962015-04-09 10:30:25 +02004159 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004160}
4161
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004162static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4163 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004164{
4165 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004166 const struct dmi_device *dev = NULL;
4167
4168 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4169 return;
4170
4171 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4172 int pol, pin;
4173 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4174 continue;
4175 if (pin < 0x0a || pin >= 0x10)
4176 break;
4177 spec->mute_led_polarity = pol;
4178 spec->mute_led_nid = pin - 0x0a + 0x18;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004179 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004180 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004181 codec_dbg(codec,
4182 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004183 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004184 break;
4185 }
4186}
4187
Takashi Iwai85c467d2018-05-29 11:38:38 +02004188static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4189 const struct hda_fixup *fix,
4190 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004191{
4192 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004193
David Henningssond06ac142013-02-18 11:41:55 +01004194 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4195 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004196 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004197 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004198 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004199 }
4200}
4201
Takashi Iwai85c467d2018-05-29 11:38:38 +02004202static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4203 const struct hda_fixup *fix, int action)
4204{
4205 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4206}
4207
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004208static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4209 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004210{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004211 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004212}
4213
Tom Briden7f783bd2017-03-25 10:12:01 +00004214static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4215 const struct hda_fixup *fix, int action)
4216{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004217 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004218}
4219
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004220/* update LED status via GPIO */
4221static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004222 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004223{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004224 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004225 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004226 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004227}
4228
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004229/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004230static int gpio_mute_led_set(struct led_classdev *led_cdev,
4231 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004232{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004233 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004234 struct alc_spec *spec = codec->spec;
4235
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004236 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004237 spec->mute_led_polarity, !brightness);
4238 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004239}
4240
4241/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004242static int micmute_led_set(struct led_classdev *led_cdev,
4243 enum led_brightness brightness)
4244{
4245 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4246 struct alc_spec *spec = codec->spec;
4247
4248 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004249 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004250 return 0;
4251}
4252
Takashi Iwai01e4a272018-06-19 22:47:30 +02004253/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4254static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4255 int action,
4256 unsigned int mute_mask,
4257 unsigned int micmute_mask)
4258{
4259 struct alc_spec *spec = codec->spec;
4260
4261 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4262
4263 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4264 return;
4265 if (mute_mask) {
4266 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004267 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004268 }
4269 if (micmute_mask) {
4270 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004271 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004272 }
4273}
4274
Jeremy Szue7d66cf2021-03-16 15:46:24 +08004275static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4276 const struct hda_fixup *fix, int action)
4277{
4278 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4279}
4280
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004281static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4282 const struct hda_fixup *fix, int action)
4283{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004284 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004285}
4286
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004287static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4288 const struct hda_fixup *fix, int action)
4289{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004290 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004291}
4292
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004293static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4294 const struct hda_fixup *fix, int action)
4295{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004296 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004297}
4298
Kailang Yanga0ccbc52020-11-06 15:20:38 +08004299static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4300 const struct hda_fixup *fix, int action)
4301{
4302 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4303}
4304
Takashi Iwai8a503552020-06-18 13:08:32 +02004305/* turn on/off mic-mute LED per capture hook via VREF change */
4306static int vref_micmute_led_set(struct led_classdev *led_cdev,
4307 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004308{
Takashi Iwai8a503552020-06-18 13:08:32 +02004309 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004310 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004311
Takashi Iwai766538a2020-06-18 13:08:41 +02004312 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4313 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004314 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004315}
4316
4317static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4318 const struct hda_fixup *fix, int action)
4319{
4320 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004321
Takashi Iwai01e4a272018-06-19 22:47:30 +02004322 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004323 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004324 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4325 * enable headphone amp
4326 */
4327 spec->gpio_mask |= 0x10;
4328 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004329 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004330 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004331 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004332 }
4333}
4334
David Henningsson7a5255f2014-10-30 08:26:01 +01004335static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4336 const struct hda_fixup *fix, int action)
4337{
David Henningsson7a5255f2014-10-30 08:26:01 +01004338 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004339
Takashi Iwai01e4a272018-06-19 22:47:30 +02004340 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004341 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004342 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004343 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004344 codec->power_filter = led_power_filter;
4345 }
4346}
4347
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01004348/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4349 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4350 */
4351static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4352 const struct hda_fixup *fix, int action)
4353{
4354 struct alc_spec *spec = codec->spec;
4355
4356 switch (action) {
4357 case HDA_FIXUP_ACT_PRE_PROBE:
4358 spec->gpio_mask |= 0x01;
4359 spec->gpio_dir |= 0x01;
4360 break;
4361 case HDA_FIXUP_ACT_INIT:
4362 /* need to toggle GPIO to enable the amp */
4363 alc_update_gpio_data(codec, 0x01, true);
4364 msleep(100);
4365 alc_update_gpio_data(codec, 0x01, false);
4366 break;
4367 }
4368}
4369
Takashi Iwai622464c2021-05-04 11:18:02 +02004370/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4371static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4372 struct hda_codec *codec,
4373 struct snd_pcm_substream *substream,
4374 int action)
4375{
4376 switch (action) {
4377 case HDA_GEN_PCM_ACT_PREPARE:
4378 alc_update_gpio_data(codec, 0x04, true);
4379 break;
4380 case HDA_GEN_PCM_ACT_CLEANUP:
4381 alc_update_gpio_data(codec, 0x04, false);
4382 break;
4383 }
4384}
4385
4386static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4387 const struct hda_fixup *fix,
4388 int action)
4389{
4390 struct alc_spec *spec = codec->spec;
4391
4392 if (action == HDA_FIXUP_ACT_PROBE) {
4393 spec->gpio_mask |= 0x04;
4394 spec->gpio_dir |= 0x04;
4395 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4396 }
4397}
4398
Takashi Iwai766538a2020-06-18 13:08:41 +02004399static void alc_update_coef_led(struct hda_codec *codec,
4400 struct alc_coef_led *led,
4401 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004402{
Takashi Iwai766538a2020-06-18 13:08:41 +02004403 if (polarity)
4404 on = !on;
4405 /* temporarily power up/down for setting COEF bit */
4406 alc_update_coef_idx(codec, led->idx, led->mask,
4407 on ? led->on : led->off);
4408}
4409
Kailang Yang431e76c2020-04-07 14:40:20 +08004410/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004411static int coef_mute_led_set(struct led_classdev *led_cdev,
4412 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004413{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004414 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004415 struct alc_spec *spec = codec->spec;
4416
Takashi Iwai766538a2020-06-18 13:08:41 +02004417 alc_update_coef_led(codec, &spec->mute_led_coef,
4418 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004419 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004420}
4421
4422static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4423 const struct hda_fixup *fix,
4424 int action)
4425{
4426 struct alc_spec *spec = codec->spec;
4427
4428 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4429 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004430 spec->mute_led_coef.idx = 0x0b;
4431 spec->mute_led_coef.mask = 1 << 3;
4432 spec->mute_led_coef.on = 1 << 3;
4433 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004434 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004435 }
4436}
4437
Kailang Yang24164f42020-04-07 14:52:42 +08004438static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4439 const struct hda_fixup *fix,
4440 int action)
4441{
4442 struct alc_spec *spec = codec->spec;
4443
4444 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4445 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004446 spec->mute_led_coef.idx = 0x34;
4447 spec->mute_led_coef.mask = 1 << 5;
4448 spec->mute_led_coef.on = 0;
4449 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004450 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004451 }
4452}
4453
Kailang Yang431e76c2020-04-07 14:40:20 +08004454/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004455static int coef_micmute_led_set(struct led_classdev *led_cdev,
4456 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004457{
Takashi Iwai8a503552020-06-18 13:08:32 +02004458 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004459 struct alc_spec *spec = codec->spec;
4460
Takashi Iwai766538a2020-06-18 13:08:41 +02004461 alc_update_coef_led(codec, &spec->mic_led_coef,
4462 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004463 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004464}
4465
4466static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4467 const struct hda_fixup *fix, int action)
4468{
4469 struct alc_spec *spec = codec->spec;
4470
4471 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004472 spec->mic_led_coef.idx = 0x19;
4473 spec->mic_led_coef.mask = 1 << 13;
4474 spec->mic_led_coef.on = 1 << 13;
4475 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004476 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004477 }
4478}
4479
Kailang Yang24164f42020-04-07 14:52:42 +08004480static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4481 const struct hda_fixup *fix, int action)
4482{
4483 struct alc_spec *spec = codec->spec;
4484
4485 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004486 spec->mic_led_coef.idx = 0x35;
4487 spec->mic_led_coef.mask = 3 << 2;
4488 spec->mic_led_coef.on = 2 << 2;
4489 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004490 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004491 }
4492}
4493
Kailang Yang431e76c2020-04-07 14:40:20 +08004494static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4495 const struct hda_fixup *fix, int action)
4496{
4497 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4498 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4499}
4500
Kailang Yang24164f42020-04-07 14:52:42 +08004501static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4502 const struct hda_fixup *fix, int action)
4503{
4504 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4505 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4506}
4507
Jonas Witschel75b62ab2021-04-16 12:58:54 +02004508static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4509 const struct hda_fixup *fix, int action)
4510{
4511 struct alc_spec *spec = codec->spec;
4512
4513 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4514 spec->cap_mute_led_nid = 0x1a;
4515 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4516 codec->power_filter = led_power_filter;
4517 }
4518}
4519
4520static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4521 const struct hda_fixup *fix, int action)
4522{
4523 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4524 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4525}
4526
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004527#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004528static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4529 struct hda_jack_callback *event)
4530{
4531 struct alc_spec *spec = codec->spec;
4532
4533 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4534 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004535 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004536 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004537 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004538 input_sync(spec->kb_dev);
4539}
David Henningsson33f4acd2015-01-07 15:50:13 +01004540
Kailang3694cb22015-12-28 11:35:24 +08004541static int alc_register_micmute_input_device(struct hda_codec *codec)
4542{
4543 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004544 int i;
Kailang3694cb22015-12-28 11:35:24 +08004545
4546 spec->kb_dev = input_allocate_device();
4547 if (!spec->kb_dev) {
4548 codec_err(codec, "Out of memory (input_allocate_device)\n");
4549 return -ENOMEM;
4550 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004551
4552 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4553
Kailang3694cb22015-12-28 11:35:24 +08004554 spec->kb_dev->name = "Microphone Mute Button";
4555 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004556 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4557 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4558 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4559 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4560 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004561
4562 if (input_register_device(spec->kb_dev)) {
4563 codec_err(codec, "input_register_device failed\n");
4564 input_free_device(spec->kb_dev);
4565 spec->kb_dev = NULL;
4566 return -ENOMEM;
4567 }
4568
4569 return 0;
4570}
4571
Takashi Iwai01e4a272018-06-19 22:47:30 +02004572/* GPIO1 = set according to SKU external amp
4573 * GPIO2 = mic mute hotkey
4574 * GPIO3 = mute LED
4575 * GPIO4 = mic mute LED
4576 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004577static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4578 const struct hda_fixup *fix, int action)
4579{
David Henningsson33f4acd2015-01-07 15:50:13 +01004580 struct alc_spec *spec = codec->spec;
4581
Takashi Iwai01e4a272018-06-19 22:47:30 +02004582 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004583 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004584 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004585 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004586 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004587
Takashi Iwai01e4a272018-06-19 22:47:30 +02004588 spec->gpio_mask |= 0x06;
4589 spec->gpio_dir |= 0x02;
4590 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004591 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004592 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004593 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004594 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004595 return;
4596 }
4597
4598 if (!spec->kb_dev)
4599 return;
4600
4601 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004602 case HDA_FIXUP_ACT_FREE:
4603 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004604 spec->kb_dev = NULL;
4605 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004606}
4607
Takashi Iwai01e4a272018-06-19 22:47:30 +02004608/* Line2 = mic mute hotkey
4609 * GPIO2 = mic mute LED
4610 */
Kailang3694cb22015-12-28 11:35:24 +08004611static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4612 const struct hda_fixup *fix, int action)
4613{
Kailang3694cb22015-12-28 11:35:24 +08004614 struct alc_spec *spec = codec->spec;
4615
Takashi Iwai01e4a272018-06-19 22:47:30 +02004616 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004617 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004618 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004619 if (alc_register_micmute_input_device(codec) != 0)
4620 return;
4621
Kailang3694cb22015-12-28 11:35:24 +08004622 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4623 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004624 return;
4625 }
4626
4627 if (!spec->kb_dev)
4628 return;
4629
4630 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004631 case HDA_FIXUP_ACT_FREE:
4632 input_unregister_device(spec->kb_dev);
4633 spec->kb_dev = NULL;
4634 }
4635}
Takashi Iwaic4696522018-01-15 10:44:35 +01004636#else /* INPUT */
4637#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4638#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4639#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004640
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004641static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4642 const struct hda_fixup *fix, int action)
4643{
4644 struct alc_spec *spec = codec->spec;
4645
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004646 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004647 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004648 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004649 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004650 }
4651}
4652
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004653static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004654 UPDATE_COEF(0x4a, 1<<8, 0),
4655 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4656 UPDATE_COEF(0x63, 3<<14, 3<<14),
4657 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4658 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4659 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4660 UPDATE_COEF(0x4a, 3<<10, 0),
4661 {}
4662};
4663
David Henningsson73bdd592013-04-15 15:44:14 +02004664static void alc_headset_mode_unplugged(struct hda_codec *codec)
4665{
Kailang Yang92666d42020-11-19 17:04:21 +08004666 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004667 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004668 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004669 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4670 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4671 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4672 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4673 {}
4674 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004675 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004676 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004677 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4678 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4679 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4680 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004681 {}
4682 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004683 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004684 WRITE_COEF(0x1b, 0x0c0b),
4685 WRITE_COEF(0x45, 0xc429),
4686 UPDATE_COEF(0x35, 0x4000, 0),
4687 WRITE_COEF(0x06, 0x2104),
4688 WRITE_COEF(0x1a, 0x0001),
4689 WRITE_COEF(0x26, 0x0004),
4690 WRITE_COEF(0x32, 0x42a3),
4691 {}
4692 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004693 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004694 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4695 UPDATE_COEF(0x50, 0x2000, 0x2000),
4696 UPDATE_COEF(0x56, 0x0006, 0x0006),
4697 UPDATE_COEF(0x66, 0x0008, 0),
4698 UPDATE_COEF(0x67, 0x2000, 0),
4699 {}
4700 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004701 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004702 UPDATE_COEF(0x19, 0x1300, 0x0300),
4703 {}
4704 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004705 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004706 WRITE_COEF(0x76, 0x000e),
4707 WRITE_COEF(0x6c, 0x2400),
4708 WRITE_COEF(0x18, 0x7308),
4709 WRITE_COEF(0x6b, 0xc429),
4710 {}
4711 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004712 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004713 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4714 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4715 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4716 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4717 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4718 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4719 {}
4720 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004721 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004722 WRITE_COEF(0x15, 0x0d40),
4723 WRITE_COEF(0xb7, 0x802b),
4724 {}
4725 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004726 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004727 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004728 {}
4729 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004730 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004731 UPDATE_COEF(0x4a, 0x0100, 0),
4732 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4733 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4734 UPDATE_COEF(0x4a, 0x0010, 0),
4735 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4736 WRITE_COEF(0x45, 0x5289),
4737 UPDATE_COEF(0x4a, 0x0c00, 0),
4738 {}
4739 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004740
Kailang Yang92666d42020-11-19 17:04:21 +08004741 if (spec->no_internal_mic_pin) {
4742 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4743 return;
4744 }
4745
Takashi Iwai7639a062015-03-03 10:07:24 +01004746 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004747 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004748 alc_process_coef_fw(codec, coef0255);
4749 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02004750 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08004751 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004752 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004753 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004754 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004755 case 0x10ec0234:
4756 case 0x10ec0274:
4757 case 0x10ec0294:
4758 alc_process_coef_fw(codec, coef0274);
4759 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004760 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004761 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004762 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004763 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004764 case 0x10ec0286:
4765 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004766 alc_process_coef_fw(codec, coef0288);
4767 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004768 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004769 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004770 alc_process_coef_fw(codec, coef0288);
4771 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004772 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004773 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004774 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004775 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004776 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004777 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004778 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004779 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004780 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004781 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004782 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004783 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004784 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004785 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004786 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004787 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004788 alc_process_coef_fw(codec, coef0225);
4789 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004790 case 0x10ec0867:
4791 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4792 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004793 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004794 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004795}
4796
4797
4798static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4799 hda_nid_t mic_pin)
4800{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004801 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004802 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4803 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4804 {}
4805 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004806 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004807 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4808 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4809 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4810 {}
4811 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004812 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004813 UPDATE_COEF(0x35, 0, 1<<14),
4814 WRITE_COEF(0x06, 0x2100),
4815 WRITE_COEF(0x1a, 0x0021),
4816 WRITE_COEF(0x26, 0x008c),
4817 {}
4818 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004819 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004820 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004821 UPDATE_COEF(0x50, 0x2000, 0),
4822 UPDATE_COEF(0x56, 0x0006, 0),
4823 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4824 UPDATE_COEF(0x66, 0x0008, 0x0008),
4825 UPDATE_COEF(0x67, 0x2000, 0x2000),
4826 {}
4827 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004828 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004829 WRITE_COEF(0x19, 0xa208),
4830 WRITE_COEF(0x2e, 0xacf0),
4831 {}
4832 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004833 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004834 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4835 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4836 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4837 {}
4838 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004839 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004840 WRITE_COEF(0xb7, 0x802b),
4841 WRITE_COEF(0xb5, 0x1040),
4842 UPDATE_COEF(0xc3, 0, 1<<12),
4843 {}
4844 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004845 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004846 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4847 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4848 UPDATE_COEF(0x63, 3<<14, 0),
4849 {}
4850 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004851 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004852 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4853 UPDATE_COEF(0x4a, 0x0010, 0),
4854 UPDATE_COEF(0x6b, 0xf000, 0),
4855 {}
4856 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004857
Takashi Iwai7639a062015-03-03 10:07:24 +01004858 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004859 case 0x10ec0255:
4860 alc_write_coef_idx(codec, 0x45, 0xc489);
4861 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004862 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004863 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4864 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02004865 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08004866 case 0x10ec0236:
4867 case 0x10ec0256:
4868 alc_write_coef_idx(codec, 0x45, 0xc489);
4869 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4870 alc_process_coef_fw(codec, coef0256);
4871 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4872 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004873 case 0x10ec0234:
4874 case 0x10ec0274:
4875 case 0x10ec0294:
4876 alc_write_coef_idx(codec, 0x45, 0x4689);
4877 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4878 alc_process_coef_fw(codec, coef0274);
4879 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4880 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004881 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004882 case 0x10ec0283:
4883 alc_write_coef_idx(codec, 0x45, 0xc429);
4884 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004885 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004886 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4887 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004888 case 0x10ec0286:
4889 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004890 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004891 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4892 alc_process_coef_fw(codec, coef0288);
4893 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4894 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004895 case 0x10ec0292:
4896 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004897 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004898 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004899 case 0x10ec0293:
4900 /* Set to TRS mode */
4901 alc_write_coef_idx(codec, 0x45, 0xc429);
4902 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004903 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004904 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4905 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004906 case 0x10ec0867:
4907 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05004908 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004909 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004910 case 0x10ec0662:
4911 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4912 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4913 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004914 case 0x10ec0668:
4915 alc_write_coef_idx(codec, 0x11, 0x0001);
4916 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004917 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004918 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4919 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004920 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004921 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004922 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004923 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004924 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004925 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004926 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004927 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4928 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4929 alc_process_coef_fw(codec, coef0225);
4930 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4931 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004932 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004933 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004934}
4935
4936static void alc_headset_mode_default(struct hda_codec *codec)
4937{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004938 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004939 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4940 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4941 UPDATE_COEF(0x49, 3<<8, 0<<8),
4942 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4943 UPDATE_COEF(0x63, 3<<14, 0),
4944 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004945 {}
4946 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004947 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004948 WRITE_COEF(0x45, 0xc089),
4949 WRITE_COEF(0x45, 0xc489),
4950 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4951 WRITE_COEF(0x49, 0x0049),
4952 {}
4953 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004954 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004955 WRITE_COEF(0x45, 0xc489),
4956 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4957 WRITE_COEF(0x49, 0x0049),
4958 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4959 WRITE_COEF(0x06, 0x6100),
4960 {}
4961 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004962 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004963 WRITE_COEF(0x06, 0x2100),
4964 WRITE_COEF(0x32, 0x4ea3),
4965 {}
4966 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004967 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004968 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4969 UPDATE_COEF(0x50, 0x2000, 0x2000),
4970 UPDATE_COEF(0x56, 0x0006, 0x0006),
4971 UPDATE_COEF(0x66, 0x0008, 0),
4972 UPDATE_COEF(0x67, 0x2000, 0),
4973 {}
4974 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004975 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004976 WRITE_COEF(0x76, 0x000e),
4977 WRITE_COEF(0x6c, 0x2400),
4978 WRITE_COEF(0x6b, 0xc429),
4979 WRITE_COEF(0x18, 0x7308),
4980 {}
4981 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004982 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004983 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4984 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4985 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4986 {}
4987 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004988 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004989 WRITE_COEF(0x11, 0x0041),
4990 WRITE_COEF(0x15, 0x0d40),
4991 WRITE_COEF(0xb7, 0x802b),
4992 {}
4993 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004994 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004995 WRITE_COEF(0x45, 0x4289),
4996 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4997 UPDATE_COEF(0x6b, 0x0f00, 0),
4998 UPDATE_COEF(0x49, 0x0300, 0x0300),
4999 {}
5000 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005001
Takashi Iwai7639a062015-03-03 10:07:24 +01005002 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08005003 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01005004 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005005 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005006 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005007 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005008 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005009 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01005010 alc_process_coef_fw(codec, coef0225);
5011 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005012 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005013 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005014 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005015 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005016 case 0x10ec0236:
5017 case 0x10ec0256:
5018 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5019 alc_write_coef_idx(codec, 0x45, 0xc089);
5020 msleep(50);
5021 alc_process_coef_fw(codec, coef0256);
5022 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005023 case 0x10ec0234:
5024 case 0x10ec0274:
5025 case 0x10ec0294:
5026 alc_process_coef_fw(codec, coef0274);
5027 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005028 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005029 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005030 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005031 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005032 case 0x10ec0286:
5033 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005034 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08005035 alc_process_coef_fw(codec, coef0288);
5036 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005037 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005038 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005039 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005040 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005041 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005042 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005043 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005044 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005045 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005046 case 0x10ec0867:
5047 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5048 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005049 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005050 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005051}
5052
5053/* Iphone type */
5054static void alc_headset_mode_ctia(struct hda_codec *codec)
5055{
Kailang Yang89542932017-07-17 15:03:43 +08005056 int val;
5057
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005058 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005059 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5060 WRITE_COEF(0x1b, 0x0c2b),
5061 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5062 {}
5063 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005064 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005065 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005066 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005067 {}
5068 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005069 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005070 WRITE_COEF(0x45, 0xd429),
5071 WRITE_COEF(0x1b, 0x0c2b),
5072 WRITE_COEF(0x32, 0x4ea3),
5073 {}
5074 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005075 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005076 UPDATE_COEF(0x50, 0x2000, 0x2000),
5077 UPDATE_COEF(0x56, 0x0006, 0x0006),
5078 UPDATE_COEF(0x66, 0x0008, 0),
5079 UPDATE_COEF(0x67, 0x2000, 0),
5080 {}
5081 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005082 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005083 WRITE_COEF(0x6b, 0xd429),
5084 WRITE_COEF(0x76, 0x0008),
5085 WRITE_COEF(0x18, 0x7388),
5086 {}
5087 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005088 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005089 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5090 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5091 {}
5092 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005093 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005094 WRITE_COEF(0x11, 0x0001),
5095 WRITE_COEF(0x15, 0x0d60),
5096 WRITE_COEF(0xc3, 0x0000),
5097 {}
5098 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005099 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005100 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005101 UPDATE_COEF(0x63, 3<<14, 2<<14),
5102 {}
5103 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005104 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005105 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5106 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005107 {}
5108 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005109
Takashi Iwai7639a062015-03-03 10:07:24 +01005110 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005111 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005112 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005113 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005114 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005115 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005116 case 0x10ec0256:
5117 alc_process_coef_fw(codec, coef0256);
5118 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005119 case 0x10ec0234:
5120 case 0x10ec0274:
5121 case 0x10ec0294:
5122 alc_write_coef_idx(codec, 0x45, 0xd689);
5123 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005124 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005125 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005126 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005127 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005128 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005129 val = alc_read_coef_idx(codec, 0x50);
5130 if (val & (1 << 12)) {
5131 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5132 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5133 msleep(300);
5134 } else {
5135 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5136 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5137 msleep(300);
5138 }
5139 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005140 case 0x10ec0286:
5141 case 0x10ec0288:
5142 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5143 msleep(300);
5144 alc_process_coef_fw(codec, coef0288);
5145 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005146 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005147 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005148 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005149 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005150 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005151 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005152 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005153 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005154 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005155 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005156 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005157 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005158 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005159 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005160 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005161 val = alc_read_coef_idx(codec, 0x45);
5162 if (val & (1 << 9))
5163 alc_process_coef_fw(codec, coef0225_2);
5164 else
5165 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005166 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005167 case 0x10ec0867:
5168 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5169 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005170 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005171 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005172}
5173
5174/* Nokia type */
5175static void alc_headset_mode_omtp(struct hda_codec *codec)
5176{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005177 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005178 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5179 WRITE_COEF(0x1b, 0x0c2b),
5180 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5181 {}
5182 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005183 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005184 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005185 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005186 {}
5187 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005188 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005189 WRITE_COEF(0x45, 0xe429),
5190 WRITE_COEF(0x1b, 0x0c2b),
5191 WRITE_COEF(0x32, 0x4ea3),
5192 {}
5193 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005194 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005195 UPDATE_COEF(0x50, 0x2000, 0x2000),
5196 UPDATE_COEF(0x56, 0x0006, 0x0006),
5197 UPDATE_COEF(0x66, 0x0008, 0),
5198 UPDATE_COEF(0x67, 0x2000, 0),
5199 {}
5200 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005201 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005202 WRITE_COEF(0x6b, 0xe429),
5203 WRITE_COEF(0x76, 0x0008),
5204 WRITE_COEF(0x18, 0x7388),
5205 {}
5206 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005207 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005208 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5209 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5210 {}
5211 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005212 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005213 WRITE_COEF(0x11, 0x0001),
5214 WRITE_COEF(0x15, 0x0d50),
5215 WRITE_COEF(0xc3, 0x0000),
5216 {}
5217 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005218 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005219 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005220 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005221 {}
5222 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005223
Takashi Iwai7639a062015-03-03 10:07:24 +01005224 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005225 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005226 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005227 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005228 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005229 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005230 case 0x10ec0256:
5231 alc_process_coef_fw(codec, coef0256);
5232 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005233 case 0x10ec0234:
5234 case 0x10ec0274:
5235 case 0x10ec0294:
5236 alc_write_coef_idx(codec, 0x45, 0xe689);
5237 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005238 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005239 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005240 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005241 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005242 case 0x10ec0298:
5243 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005244 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5245 msleep(300);
5246 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005247 case 0x10ec0286:
5248 case 0x10ec0288:
5249 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5250 msleep(300);
5251 alc_process_coef_fw(codec, coef0288);
5252 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005253 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005254 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005255 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005256 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005257 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005258 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005259 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005260 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005261 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005262 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005263 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005264 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005265 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005266 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005267 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005268 alc_process_coef_fw(codec, coef0225);
5269 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005270 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005271 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005272}
5273
5274static void alc_determine_headset_type(struct hda_codec *codec)
5275{
5276 int val;
5277 bool is_ctia = false;
5278 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005279 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005280 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5281 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5282 conteol) */
5283 {}
5284 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005285 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005286 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5287 {}
5288 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005289 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005290 UPDATE_COEF(0x50, 0x2000, 0x2000),
5291 UPDATE_COEF(0x56, 0x0006, 0x0006),
5292 UPDATE_COEF(0x66, 0x0008, 0),
5293 UPDATE_COEF(0x67, 0x2000, 0),
5294 UPDATE_COEF(0x19, 0x1300, 0x1300),
5295 {}
5296 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005297 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005298 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5299 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5300 {}
5301 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005302 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005303 WRITE_COEF(0x11, 0x0001),
5304 WRITE_COEF(0xb7, 0x802b),
5305 WRITE_COEF(0x15, 0x0d60),
5306 WRITE_COEF(0xc3, 0x0c00),
5307 {}
5308 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005309 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005310 UPDATE_COEF(0x4a, 0x0010, 0),
5311 UPDATE_COEF(0x4a, 0x8000, 0),
5312 WRITE_COEF(0x45, 0xd289),
5313 UPDATE_COEF(0x49, 0x0300, 0x0300),
5314 {}
5315 };
David Henningsson73bdd592013-04-15 15:44:14 +02005316
Kailang Yang92666d42020-11-19 17:04:21 +08005317 if (spec->no_internal_mic_pin) {
5318 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5319 return;
5320 }
5321
Takashi Iwai7639a062015-03-03 10:07:24 +01005322 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005323 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005324 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005325 msleep(300);
5326 val = alc_read_coef_idx(codec, 0x46);
5327 is_ctia = (val & 0x0070) == 0x0070;
5328 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005329 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005330 case 0x10ec0236:
5331 case 0x10ec0256:
5332 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5333 alc_write_coef_idx(codec, 0x06, 0x6104);
5334 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5335
5336 snd_hda_codec_write(codec, 0x21, 0,
5337 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5338 msleep(80);
5339 snd_hda_codec_write(codec, 0x21, 0,
5340 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5341
5342 alc_process_coef_fw(codec, coef0255);
5343 msleep(300);
5344 val = alc_read_coef_idx(codec, 0x46);
5345 is_ctia = (val & 0x0070) == 0x0070;
5346
5347 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5348 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5349
5350 snd_hda_codec_write(codec, 0x21, 0,
5351 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5352 msleep(80);
5353 snd_hda_codec_write(codec, 0x21, 0,
5354 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5355 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005356 case 0x10ec0234:
5357 case 0x10ec0274:
5358 case 0x10ec0294:
5359 alc_process_coef_fw(codec, coef0274);
Hui Wangfebf22562021-03-20 17:15:41 +08005360 msleep(850);
Kailang Yang71683c32017-06-20 16:33:50 +08005361 val = alc_read_coef_idx(codec, 0x46);
5362 is_ctia = (val & 0x00f0) == 0x00f0;
5363 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005364 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005365 case 0x10ec0283:
5366 alc_write_coef_idx(codec, 0x45, 0xd029);
5367 msleep(300);
5368 val = alc_read_coef_idx(codec, 0x46);
5369 is_ctia = (val & 0x0070) == 0x0070;
5370 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005371 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005372 snd_hda_codec_write(codec, 0x21, 0,
5373 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5374 msleep(100);
5375 snd_hda_codec_write(codec, 0x21, 0,
5376 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5377 msleep(200);
5378
5379 val = alc_read_coef_idx(codec, 0x50);
5380 if (val & (1 << 12)) {
5381 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5382 alc_process_coef_fw(codec, coef0288);
5383 msleep(350);
5384 val = alc_read_coef_idx(codec, 0x50);
5385 is_ctia = (val & 0x0070) == 0x0070;
5386 } else {
5387 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5388 alc_process_coef_fw(codec, coef0288);
5389 msleep(350);
5390 val = alc_read_coef_idx(codec, 0x50);
5391 is_ctia = (val & 0x0070) == 0x0070;
5392 }
5393 alc_process_coef_fw(codec, coef0298);
5394 snd_hda_codec_write(codec, 0x21, 0,
5395 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5396 msleep(75);
5397 snd_hda_codec_write(codec, 0x21, 0,
5398 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5399 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005400 case 0x10ec0286:
5401 case 0x10ec0288:
5402 alc_process_coef_fw(codec, coef0288);
5403 msleep(350);
5404 val = alc_read_coef_idx(codec, 0x50);
5405 is_ctia = (val & 0x0070) == 0x0070;
5406 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005407 case 0x10ec0292:
5408 alc_write_coef_idx(codec, 0x6b, 0xd429);
5409 msleep(300);
5410 val = alc_read_coef_idx(codec, 0x6c);
5411 is_ctia = (val & 0x001c) == 0x001c;
5412 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005413 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005414 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005415 msleep(300);
5416 val = alc_read_coef_idx(codec, 0x46);
5417 is_ctia = (val & 0x0070) == 0x0070;
5418 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005419 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005420 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005421 msleep(300);
5422 val = alc_read_coef_idx(codec, 0xbe);
5423 is_ctia = (val & 0x1c02) == 0x1c02;
5424 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005425 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005426 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005427 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005428 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005429 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005430 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005431 snd_hda_codec_write(codec, 0x21, 0,
5432 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5433 msleep(80);
5434 snd_hda_codec_write(codec, 0x21, 0,
5435 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5436
Kailang Yang5a367672017-07-21 15:23:53 +08005437 alc_process_coef_fw(codec, alc225_pre_hsmode);
5438 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5439 val = alc_read_coef_idx(codec, 0x45);
5440 if (val & (1 << 9)) {
5441 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5442 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5443 msleep(800);
5444 val = alc_read_coef_idx(codec, 0x46);
5445 is_ctia = (val & 0x00f0) == 0x00f0;
5446 } else {
5447 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5448 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5449 msleep(800);
5450 val = alc_read_coef_idx(codec, 0x46);
5451 is_ctia = (val & 0x00f0) == 0x00f0;
5452 }
5453 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5454 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5455 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005456
5457 snd_hda_codec_write(codec, 0x21, 0,
5458 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5459 msleep(80);
5460 snd_hda_codec_write(codec, 0x21, 0,
5461 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005462 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005463 case 0x10ec0867:
5464 is_ctia = true;
5465 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005466 }
5467
Takashi Iwai4e76a882014-02-25 12:21:03 +01005468 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005469 is_ctia ? "yes" : "no");
5470 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5471}
5472
5473static void alc_update_headset_mode(struct hda_codec *codec)
5474{
5475 struct alc_spec *spec = codec->spec;
5476
5477 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005478 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005479
5480 int new_headset_mode;
5481
5482 if (!snd_hda_jack_detect(codec, hp_pin))
5483 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5484 else if (mux_pin == spec->headset_mic_pin)
5485 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5486 else if (mux_pin == spec->headphone_mic_pin)
5487 new_headset_mode = ALC_HEADSET_MODE_MIC;
5488 else
5489 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5490
David Henningsson5959a6b2013-11-12 11:10:57 +01005491 if (new_headset_mode == spec->current_headset_mode) {
5492 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005493 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005494 }
David Henningsson73bdd592013-04-15 15:44:14 +02005495
5496 switch (new_headset_mode) {
5497 case ALC_HEADSET_MODE_UNPLUGGED:
5498 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005499 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5500 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005501 spec->gen.hp_jack_present = false;
5502 break;
5503 case ALC_HEADSET_MODE_HEADSET:
5504 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5505 alc_determine_headset_type(codec);
5506 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5507 alc_headset_mode_ctia(codec);
5508 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5509 alc_headset_mode_omtp(codec);
5510 spec->gen.hp_jack_present = true;
5511 break;
5512 case ALC_HEADSET_MODE_MIC:
5513 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5514 spec->gen.hp_jack_present = false;
5515 break;
5516 case ALC_HEADSET_MODE_HEADPHONE:
5517 alc_headset_mode_default(codec);
5518 spec->gen.hp_jack_present = true;
5519 break;
5520 }
5521 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5522 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5523 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005524 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005525 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5526 PIN_VREFHIZ);
5527 }
5528 spec->current_headset_mode = new_headset_mode;
5529
5530 snd_hda_gen_update_outputs(codec);
5531}
5532
5533static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005534 struct snd_kcontrol *kcontrol,
5535 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005536{
5537 alc_update_headset_mode(codec);
5538}
5539
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005540static void alc_update_headset_jack_cb(struct hda_codec *codec,
5541 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005542{
David Henningsson73bdd592013-04-15 15:44:14 +02005543 snd_hda_gen_hp_automute(codec, jack);
Hui Wange54f30b2021-03-20 17:15:42 +08005544 alc_update_headset_mode(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005545}
5546
5547static void alc_probe_headset_mode(struct hda_codec *codec)
5548{
5549 int i;
5550 struct alc_spec *spec = codec->spec;
5551 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5552
5553 /* Find mic pins */
5554 for (i = 0; i < cfg->num_inputs; i++) {
5555 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5556 spec->headset_mic_pin = cfg->inputs[i].pin;
5557 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5558 spec->headphone_mic_pin = cfg->inputs[i].pin;
5559 }
5560
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005561 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005562 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5563 spec->gen.automute_hook = alc_update_headset_mode;
5564 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5565}
5566
5567static void alc_fixup_headset_mode(struct hda_codec *codec,
5568 const struct hda_fixup *fix, int action)
5569{
5570 struct alc_spec *spec = codec->spec;
5571
5572 switch (action) {
5573 case HDA_FIXUP_ACT_PRE_PROBE:
5574 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5575 break;
5576 case HDA_FIXUP_ACT_PROBE:
5577 alc_probe_headset_mode(codec);
5578 break;
5579 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005580 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5581 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5582 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5583 }
David Henningsson73bdd592013-04-15 15:44:14 +02005584 alc_update_headset_mode(codec);
5585 break;
5586 }
5587}
5588
5589static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5590 const struct hda_fixup *fix, int action)
5591{
5592 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5593 struct alc_spec *spec = codec->spec;
5594 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5595 }
5596 else
5597 alc_fixup_headset_mode(codec, fix, action);
5598}
5599
Kailang Yang31278992014-03-03 15:27:22 +08005600static void alc255_set_default_jack_type(struct hda_codec *codec)
5601{
5602 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005603 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005604 WRITE_COEF(0x1b, 0x880b),
5605 WRITE_COEF(0x45, 0xd089),
5606 WRITE_COEF(0x1b, 0x080b),
5607 WRITE_COEF(0x46, 0x0004),
5608 WRITE_COEF(0x1b, 0x0c0b),
5609 {}
5610 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005611 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005612 WRITE_COEF(0x1b, 0x884b),
5613 WRITE_COEF(0x45, 0xd089),
5614 WRITE_COEF(0x1b, 0x084b),
5615 WRITE_COEF(0x46, 0x0004),
5616 WRITE_COEF(0x1b, 0x0c4b),
5617 {}
5618 };
5619 switch (codec->core.vendor_id) {
5620 case 0x10ec0255:
5621 alc_process_coef_fw(codec, alc255fw);
5622 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005623 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005624 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005625 case 0x10ec0256:
5626 alc_process_coef_fw(codec, alc256fw);
5627 break;
5628 }
Kailang Yang31278992014-03-03 15:27:22 +08005629 msleep(30);
5630}
5631
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005632static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5633 const struct hda_fixup *fix, int action)
5634{
5635 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005636 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005637 }
5638 alc_fixup_headset_mode(codec, fix, action);
5639}
5640
Kailang Yang31278992014-03-03 15:27:22 +08005641static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5642 const struct hda_fixup *fix, int action)
5643{
5644 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5645 struct alc_spec *spec = codec->spec;
5646 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5647 alc255_set_default_jack_type(codec);
5648 }
5649 else
5650 alc_fixup_headset_mode(codec, fix, action);
5651}
5652
Kailang Yange1e62b92015-04-08 16:01:22 +08005653static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5654 struct hda_jack_callback *jack)
5655{
5656 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005657
5658 alc_update_headset_jack_cb(codec, jack);
5659 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005660 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005661}
5662
5663static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5664 const struct hda_fixup *fix, int action)
5665{
5666 alc_fixup_headset_mode(codec, fix, action);
5667 if (action == HDA_FIXUP_ACT_PROBE) {
5668 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005669 /* toggled via hp_automute_hook */
5670 spec->gpio_mask |= 0x40;
5671 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005672 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5673 }
5674}
5675
Hui Wang493a52a2014-01-14 14:07:36 +08005676static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5677 const struct hda_fixup *fix, int action)
5678{
5679 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5680 struct alc_spec *spec = codec->spec;
5681 spec->gen.auto_mute_via_amp = 1;
5682 }
5683}
5684
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005685static void alc_fixup_no_shutup(struct hda_codec *codec,
5686 const struct hda_fixup *fix, int action)
5687{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005688 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005689 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005690 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005691 }
5692}
5693
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005694static void alc_fixup_disable_aamix(struct hda_codec *codec,
5695 const struct hda_fixup *fix, int action)
5696{
5697 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5698 struct alc_spec *spec = codec->spec;
5699 /* Disable AA-loopback as it causes white noise */
5700 spec->gen.mixer_nid = 0;
5701 }
5702}
5703
Takashi Iwai7f57d802015-09-24 17:36:51 +02005704/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5705static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5706 const struct hda_fixup *fix, int action)
5707{
5708 static const struct hda_pintbl pincfgs[] = {
5709 { 0x16, 0x21211010 }, /* dock headphone */
5710 { 0x19, 0x21a11010 }, /* dock mic */
5711 { }
5712 };
5713 struct alc_spec *spec = codec->spec;
5714
5715 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Hui Wang871b9062019-08-14 12:09:08 +08005716 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02005717 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5718 codec->power_save_node = 0; /* avoid click noises */
5719 snd_hda_apply_pincfgs(codec, pincfgs);
5720 }
5721}
5722
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005723static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5724 const struct hda_fixup *fix, int action)
5725{
5726 static const struct hda_pintbl pincfgs[] = {
5727 { 0x17, 0x21211010 }, /* dock headphone */
5728 { 0x19, 0x21a11010 }, /* dock mic */
5729 { }
5730 };
5731 struct alc_spec *spec = codec->spec;
5732
5733 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5734 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005735 snd_hda_apply_pincfgs(codec, pincfgs);
5736 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005737 /* Enable DOCK device */
5738 snd_hda_codec_write(codec, 0x17, 0,
5739 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5740 /* Enable DOCK device */
5741 snd_hda_codec_write(codec, 0x19, 0,
5742 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005743 }
5744}
5745
Takashi Iwai399c01a2020-05-26 08:24:06 +02005746static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5747 const struct hda_fixup *fix, int action)
5748{
5749 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5750 * the speaker output becomes too low by some reason on Thinkpads with
5751 * ALC298 codec
5752 */
5753 static const hda_nid_t preferred_pairs[] = {
5754 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5755 0
5756 };
5757 struct alc_spec *spec = codec->spec;
5758
5759 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5760 spec->gen.preferred_dacs = preferred_pairs;
5761}
5762
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02005763static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5764 const struct hda_fixup *fix, int action)
5765{
5766 static const hda_nid_t preferred_pairs[] = {
5767 0x17, 0x02, 0x21, 0x03, 0
5768 };
5769 struct alc_spec *spec = codec->spec;
5770
5771 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5772 spec->gen.preferred_dacs = preferred_pairs;
5773}
5774
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005775static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005776{
5777 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005778 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005779
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005780 /* Prevent pop noises when headphones are plugged in */
5781 snd_hda_codec_write(codec, hp_pin, 0,
5782 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5783 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005784}
5785
5786static void alc_fixup_dell_xps13(struct hda_codec *codec,
5787 const struct hda_fixup *fix, int action)
5788{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005789 struct alc_spec *spec = codec->spec;
5790 struct hda_input_mux *imux = &spec->gen.input_mux;
5791 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005792
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005793 switch (action) {
5794 case HDA_FIXUP_ACT_PRE_PROBE:
5795 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5796 * it causes a click noise at start up
5797 */
5798 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005799 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005800 break;
5801 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005802 /* Make the internal mic the default input source. */
5803 for (i = 0; i < imux->num_items; i++) {
5804 if (spec->gen.imux_pins[i] == 0x12) {
5805 spec->gen.cur_mux[0] = i;
5806 break;
5807 }
5808 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005809 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005810 }
5811}
5812
David Henningsson1f8b46c2015-05-12 14:38:15 +02005813static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5814 const struct hda_fixup *fix, int action)
5815{
5816 struct alc_spec *spec = codec->spec;
5817
5818 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5819 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5820 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005821
5822 /* Disable boost for mic-in permanently. (This code is only called
5823 from quirks that guarantee that the headphone is at NID 0x1b.) */
5824 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5825 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005826 } else
5827 alc_fixup_headset_mode(codec, fix, action);
5828}
5829
David Henningsson73bdd592013-04-15 15:44:14 +02005830static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5831 const struct hda_fixup *fix, int action)
5832{
5833 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005834 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005835 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005836 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5837 }
5838 alc_fixup_headset_mode(codec, fix, action);
5839}
5840
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005841/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5842static int find_ext_mic_pin(struct hda_codec *codec)
5843{
5844 struct alc_spec *spec = codec->spec;
5845 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5846 hda_nid_t nid;
5847 unsigned int defcfg;
5848 int i;
5849
5850 for (i = 0; i < cfg->num_inputs; i++) {
5851 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5852 continue;
5853 nid = cfg->inputs[i].pin;
5854 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5855 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5856 continue;
5857 return nid;
5858 }
5859
5860 return 0;
5861}
5862
Dylan Reid08a978d2012-11-18 22:56:40 -08005863static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005864 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005865 int action)
5866{
5867 struct alc_spec *spec = codec->spec;
5868
Takashi Iwai0db75792013-01-23 13:57:20 +01005869 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005870 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005871 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005872
5873 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005874 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005875 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005876 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005877}
David Henningsson693b6132012-06-22 19:12:10 +02005878
David Henningsson3e0d6112013-04-22 14:30:14 +02005879static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5880 const struct hda_fixup *fix,
5881 int action)
5882{
5883 struct alc_spec *spec = codec->spec;
5884 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5885 int i;
5886
5887 /* The mic boosts on level 2 and 3 are too noisy
5888 on the internal mic input.
5889 Therefore limit the boost to 0 or 1. */
5890
5891 if (action != HDA_FIXUP_ACT_PROBE)
5892 return;
5893
5894 for (i = 0; i < cfg->num_inputs; i++) {
5895 hda_nid_t nid = cfg->inputs[i].pin;
5896 unsigned int defcfg;
5897 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5898 continue;
5899 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5900 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5901 continue;
5902
5903 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5904 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5905 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5906 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5907 (0 << AC_AMPCAP_MUTE_SHIFT));
5908 }
5909}
5910
Kailang Yangcd217a62013-08-22 10:15:24 +02005911static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005912 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005913{
5914 struct alc_spec *spec = codec->spec;
5915 int vref;
5916
5917 msleep(200);
5918 snd_hda_gen_hp_automute(codec, jack);
5919
5920 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5921
5922 msleep(600);
5923 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5924 vref);
5925}
5926
Kailang Yangcd217a62013-08-22 10:15:24 +02005927static void alc283_fixup_chromebook(struct hda_codec *codec,
5928 const struct hda_fixup *fix, int action)
5929{
5930 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005931
5932 switch (action) {
5933 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005934 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005935 /* Disable AA-loopback as it causes white noise */
5936 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005937 break;
5938 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005939 /* MIC2-VREF control */
5940 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005941 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005942 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005943 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005944 break;
5945 }
5946}
5947
5948static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5949 const struct hda_fixup *fix, int action)
5950{
5951 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005952
5953 switch (action) {
5954 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005955 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5956 break;
5957 case HDA_FIXUP_ACT_INIT:
5958 /* MIC2-VREF control */
5959 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005960 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005961 break;
5962 }
5963}
5964
Takashi Iwai7bba2152013-09-06 15:45:38 +02005965/* mute tablet speaker pin (0x14) via dock plugging in addition */
5966static void asus_tx300_automute(struct hda_codec *codec)
5967{
5968 struct alc_spec *spec = codec->spec;
5969 snd_hda_gen_update_outputs(codec);
5970 if (snd_hda_jack_detect(codec, 0x1b))
5971 spec->gen.mute_bits |= (1ULL << 0x14);
5972}
5973
5974static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5975 const struct hda_fixup *fix, int action)
5976{
5977 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005978 static const struct hda_pintbl dock_pins[] = {
5979 { 0x1b, 0x21114000 }, /* dock speaker pin */
5980 {}
5981 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005982
5983 switch (action) {
5984 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005985 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02005986 /* TX300 needs to set up GPIO2 for the speaker amp */
5987 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02005988 snd_hda_apply_pincfgs(codec, dock_pins);
5989 spec->gen.auto_mute_via_amp = 1;
5990 spec->gen.automute_hook = asus_tx300_automute;
5991 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005992 snd_hda_gen_hp_automute);
5993 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005994 case HDA_FIXUP_ACT_PROBE:
5995 spec->init_amp = ALC_INIT_DEFAULT;
5996 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005997 case HDA_FIXUP_ACT_BUILD:
5998 /* this is a bit tricky; give more sane names for the main
5999 * (tablet) speaker and the dock speaker, respectively
6000 */
Takashi Iwai56798e62017-04-11 08:10:52 +02006001 rename_ctl(codec, "Speaker Playback Switch",
6002 "Dock Speaker Playback Switch");
6003 rename_ctl(codec, "Bass Speaker Playback Switch",
6004 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02006005 break;
6006 }
6007}
6008
David Henningsson338cae52013-10-07 10:39:59 +02006009static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6010 const struct hda_fixup *fix, int action)
6011{
David Henningsson0f4881d2013-12-20 16:08:13 +01006012 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6013 /* DAC node 0x03 is giving mono output. We therefore want to
6014 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6015 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006016 static const hda_nid_t conn1[] = { 0x0c };
6017 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6018 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01006019 }
David Henningsson338cae52013-10-07 10:39:59 +02006020}
6021
Hui Wangdd9aa332016-08-01 10:20:32 +08006022static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6023 const struct hda_fixup *fix, int action)
6024{
6025 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6026 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6027 we can't adjust the speaker's volume since this node does not has
6028 Amp-out capability. we change the speaker's route to:
6029 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6030 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6031 speaker's volume now. */
6032
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006033 static const hda_nid_t conn1[] = { 0x0c };
6034 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08006035 }
6036}
6037
Takashi Iwaie312a862018-03-06 12:14:17 +01006038/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6039static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6040 const struct hda_fixup *fix, int action)
6041{
6042 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006043 static const hda_nid_t conn[] = { 0x02, 0x03 };
6044 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01006045 }
6046}
6047
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006048/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6049static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6050 const struct hda_fixup *fix, int action)
6051{
6052 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006053 static const hda_nid_t conn[] = { 0x02 };
6054 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006055 }
6056}
6057
Keith Packard98973f22015-07-15 12:14:39 -07006058/* Hook to update amp GPIO4 for automute */
6059static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6060 struct hda_jack_callback *jack)
6061{
6062 struct alc_spec *spec = codec->spec;
6063
6064 snd_hda_gen_hp_automute(codec, jack);
6065 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08006066 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6067 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07006068}
6069
6070/* Manage GPIOs for HP EliteBook Folio 9480m.
6071 *
6072 * GPIO4 is the headphone amplifier power control
6073 * GPIO3 is the audio output mute indicator LED
6074 */
6075
6076static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6077 const struct hda_fixup *fix,
6078 int action)
6079{
6080 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07006081
Takashi Iwai01e4a272018-06-19 22:47:30 +02006082 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07006083 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02006084 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6085 spec->gpio_mask |= 0x10;
6086 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07006087 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07006088 }
6089}
6090
Takashi Iwaiae065f12018-06-19 23:00:03 +02006091static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6092 const struct hda_fixup *fix,
6093 int action)
6094{
6095 struct alc_spec *spec = codec->spec;
6096
6097 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6098 spec->gpio_mask |= 0x04;
6099 spec->gpio_dir |= 0x04;
6100 /* set data bit low */
6101 }
6102}
6103
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006104/* Quirk for Thinkpad X1 7th and 8th Gen
6105 * The following fixed routing needed
6106 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6107 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6108 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6109 */
6110static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6111 const struct hda_fixup *fix, int action)
6112{
6113 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6114 static const hda_nid_t preferred_pairs[] = {
6115 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6116 };
6117 struct alc_spec *spec = codec->spec;
6118
6119 switch (action) {
6120 case HDA_FIXUP_ACT_PRE_PROBE:
6121 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6122 spec->gen.preferred_dacs = preferred_pairs;
6123 break;
6124 case HDA_FIXUP_ACT_BUILD:
6125 /* The generic parser creates somewhat unintuitive volume ctls
6126 * with the fixed routing above, and the shared DAC2 may be
6127 * confusing for PA.
6128 * Rename those to unique names so that PA doesn't touch them
6129 * and use only Master volume.
6130 */
6131 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6132 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6133 break;
6134 }
6135}
6136
Kailang Yangca169cc2017-04-25 16:17:40 +08006137static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6138 const struct hda_fixup *fix,
6139 int action)
6140{
6141 alc_fixup_dual_codecs(codec, fix, action);
6142 switch (action) {
6143 case HDA_FIXUP_ACT_PRE_PROBE:
6144 /* override card longname to provide a unique UCM profile */
6145 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6146 break;
6147 case HDA_FIXUP_ACT_BUILD:
6148 /* rename Capture controls depending on the codec */
6149 rename_ctl(codec, "Capture Volume",
6150 codec->addr == 0 ?
6151 "Rear-Panel Capture Volume" :
6152 "Front-Panel Capture Volume");
6153 rename_ctl(codec, "Capture Switch",
6154 codec->addr == 0 ?
6155 "Rear-Panel Capture Switch" :
6156 "Front-Panel Capture Switch");
6157 break;
6158 }
6159}
6160
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006161static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6162 const struct hda_fixup *fix, int action)
6163{
6164 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6165 return;
6166
6167 codec->power_save_node = 1;
6168}
6169
Kailang Yang92266652017-12-14 15:28:58 +08006170/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6171static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6172 const struct hda_fixup *fix, int action)
6173{
6174 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006175 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08006176 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6177 0
6178 };
6179
6180 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6181 return;
6182
6183 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08006184 spec->gen.auto_mute_via_amp = 1;
6185 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08006186}
6187
Takashi Iwaic84bfed2020-11-27 15:11:04 +01006188/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6189static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6190 const struct hda_fixup *fix, int action)
6191{
6192 static const hda_nid_t preferred_pairs[] = {
6193 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6194 };
6195 struct alc_spec *spec = codec->spec;
6196
6197 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6198 spec->gen.preferred_dacs = preferred_pairs;
6199 spec->gen.obey_preferred_dacs = 1;
6200 }
6201}
6202
Hui Wangc4cfcf62018-11-26 14:17:16 +08006203/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6204static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6205 const struct hda_fixup *fix, int action)
6206{
6207 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6208 return;
6209
6210 snd_hda_override_wcaps(codec, 0x03, 0);
6211}
6212
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006213static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6214{
6215 switch (codec->core.vendor_id) {
6216 case 0x10ec0274:
6217 case 0x10ec0294:
6218 case 0x10ec0225:
6219 case 0x10ec0295:
6220 case 0x10ec0299:
6221 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6222 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6223 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02006224 case 0x10ec0230:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006225 case 0x10ec0235:
6226 case 0x10ec0236:
6227 case 0x10ec0255:
6228 case 0x10ec0256:
6229 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6230 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6231 break;
6232 }
6233}
6234
Kailang Yang8983eb62019-04-03 15:31:49 +08006235static void alc295_fixup_chromebook(struct hda_codec *codec,
6236 const struct hda_fixup *fix, int action)
6237{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006238 struct alc_spec *spec = codec->spec;
6239
Kailang Yang8983eb62019-04-03 15:31:49 +08006240 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006241 case HDA_FIXUP_ACT_PRE_PROBE:
6242 spec->ultra_low_power = true;
6243 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006244 case HDA_FIXUP_ACT_INIT:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006245 alc_combo_jack_hp_jd_restart(codec);
Kailang Yang8983eb62019-04-03 15:31:49 +08006246 break;
6247 }
6248}
6249
Kailang Yangd1dd4212019-01-09 17:05:24 +08006250static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6251 const struct hda_fixup *fix, int action)
6252{
6253 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6254 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6255}
6256
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006257
6258static void alc294_gx502_toggle_output(struct hda_codec *codec,
6259 struct hda_jack_callback *cb)
6260{
6261 /* The Windows driver sets the codec up in a very different way where
6262 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6263 */
6264 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6265 alc_write_coef_idx(codec, 0x10, 0x8a20);
6266 else
6267 alc_write_coef_idx(codec, 0x10, 0x0a20);
6268}
6269
6270static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6271 const struct hda_fixup *fix, int action)
6272{
6273 /* Pin 0x21: headphones/headset mic */
6274 if (!is_jack_detectable(codec, 0x21))
6275 return;
6276
6277 switch (action) {
6278 case HDA_FIXUP_ACT_PRE_PROBE:
6279 snd_hda_jack_detect_enable_callback(codec, 0x21,
6280 alc294_gx502_toggle_output);
6281 break;
6282 case HDA_FIXUP_ACT_INIT:
6283 /* Make sure to start in a correct state, i.e. if
6284 * headphones have been plugged in before powering up the system
6285 */
6286 alc294_gx502_toggle_output(codec, NULL);
6287 break;
6288 }
6289}
6290
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006291static void alc294_gu502_toggle_output(struct hda_codec *codec,
6292 struct hda_jack_callback *cb)
6293{
6294 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6295 * responsible from changes between speakers and headphones
6296 */
6297 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6298 alc_write_coef_idx(codec, 0x10, 0x8420);
6299 else
6300 alc_write_coef_idx(codec, 0x10, 0x0a20);
6301}
6302
6303static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6304 const struct hda_fixup *fix, int action)
6305{
6306 if (!is_jack_detectable(codec, 0x21))
6307 return;
6308
6309 switch (action) {
6310 case HDA_FIXUP_ACT_PRE_PROBE:
6311 snd_hda_jack_detect_enable_callback(codec, 0x21,
6312 alc294_gu502_toggle_output);
6313 break;
6314 case HDA_FIXUP_ACT_INIT:
6315 alc294_gu502_toggle_output(codec, NULL);
6316 break;
6317 }
6318}
6319
Kailang Yang56496252020-07-29 15:09:27 +08006320static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6321 const struct hda_fixup *fix, int action)
6322{
6323 if (action != HDA_FIXUP_ACT_INIT)
6324 return;
6325
6326 msleep(100);
6327 alc_write_coef_idx(codec, 0x65, 0x0);
6328}
6329
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006330static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6331 const struct hda_fixup *fix, int action)
6332{
6333 switch (action) {
6334 case HDA_FIXUP_ACT_INIT:
6335 alc_combo_jack_hp_jd_restart(codec);
6336 break;
6337 }
6338}
6339
Kailang Yang92666d42020-11-19 17:04:21 +08006340static void alc_fixup_no_int_mic(struct hda_codec *codec,
6341 const struct hda_fixup *fix, int action)
6342{
6343 struct alc_spec *spec = codec->spec;
6344
6345 switch (action) {
6346 case HDA_FIXUP_ACT_PRE_PROBE:
6347 /* Mic RING SLEEVE swap for combo jack */
6348 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6349 spec->no_internal_mic_pin = true;
6350 break;
6351 case HDA_FIXUP_ACT_INIT:
6352 alc_combo_jack_hp_jd_restart(codec);
6353 break;
6354 }
6355}
6356
Elia Devito434591b2021-06-19 22:41:04 +02006357static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6358 const struct hda_fixup *fix, int action)
6359{
6360 static const hda_nid_t conn[] = { 0x02 };
6361 static const struct hda_pintbl pincfgs[] = {
6362 { 0x14, 0x90170110 }, /* rear speaker */
6363 { }
6364 };
6365
6366 switch (action) {
6367 case HDA_FIXUP_ACT_PRE_PROBE:
6368 snd_hda_apply_pincfgs(codec, pincfgs);
6369 /* force front speaker to DAC1 */
6370 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6371 break;
6372 }
6373}
6374
Takashi Iwaib317b032014-01-08 11:44:21 +01006375/* for hda_fixup_thinkpad_acpi() */
6376#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006377
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006378static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6379 const struct hda_fixup *fix, int action)
6380{
6381 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6382 hda_fixup_thinkpad_acpi(codec, fix, action);
6383}
6384
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006385/* for alc295_fixup_hp_top_speakers */
6386#include "hp_x360_helper.c"
6387
Takashi Iwai26928ca2021-04-16 10:12:11 +02006388/* for alc285_fixup_ideapad_s740_coef() */
6389#include "ideapad_s740_helper.c"
6390
Takashi Iwai1d045db2011-07-07 18:23:21 +02006391enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006392 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006393 ALC269_FIXUP_SONY_VAIO,
6394 ALC275_FIXUP_SONY_VAIO_GPIO2,
6395 ALC269_FIXUP_DELL_M101Z,
6396 ALC269_FIXUP_SKU_IGNORE,
6397 ALC269_FIXUP_ASUS_G73JW,
6398 ALC269_FIXUP_LENOVO_EAPD,
6399 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006400 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006401 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006402 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006403 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006404 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006405 ALC269_FIXUP_QUANTA_MUTE,
6406 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006407 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006408 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006409 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006410 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006411 ALC269_FIXUP_AMIC,
6412 ALC269_FIXUP_DMIC,
6413 ALC269VB_FIXUP_AMIC,
6414 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006415 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006416 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006417 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006418 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006419 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006420 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6421 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006422 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006423 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006424 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006425 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006426 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006427 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006428 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6429 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006430 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006431 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006432 ALC269_FIXUP_HEADSET_MODE,
6433 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006434 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006435 ALC269_FIXUP_ASUS_X101_FUNC,
6436 ALC269_FIXUP_ASUS_X101_VERB,
6437 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006438 ALC271_FIXUP_AMIC_MIC2,
6439 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006440 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006441 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006442 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006443 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006444 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006445 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006446 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006447 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006448 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006449 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006450 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006451 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006452 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6453 ALC290_FIXUP_SUBWOOFER,
6454 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006455 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006456 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006457 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006458 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006459 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006460 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006461 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006462 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006463 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006464 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006465 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006466 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006467 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006468 ALC282_FIXUP_ASPIRE_V5_PINS,
Takashi Iwaic8426b22021-04-07 11:57:30 +02006469 ALC269VB_FIXUP_ASPIRE_E1_COEF,
David Henningsson7a5255f2014-10-30 08:26:01 +01006470 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006471 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006472 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006473 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006474 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006475 ALC280_FIXUP_HP_9480M,
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01006476 ALC245_FIXUP_HP_X360_AMP,
Kailang Yange1e62b92015-04-08 16:01:22 +08006477 ALC288_FIXUP_DELL_HEADSET_MODE,
6478 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006479 ALC288_FIXUP_DELL_XPS_13,
6480 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006481 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006482 ALC292_FIXUP_DELL_E7X,
6483 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006484 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006485 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006486 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006487 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006488 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006489 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006490 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006491 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006492 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006493 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006494 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006495 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006496 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006497 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006498 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006499 ALC298_FIXUP_SPK_VOLUME,
Kailang Yangf86de9b2020-10-23 14:46:47 +08006500 ALC298_FIXUP_LENOVO_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006501 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006502 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006503 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006504 ALC256_FIXUP_ASUS_HEADSET_MODE,
6505 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006506 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006507 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6508 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006509 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006510 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006511 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006512 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006513 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006514 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006515 ALC274_FIXUP_DELL_BIND_DACS,
6516 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006517 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006518 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006519 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006520 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006521 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006522 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006523 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006524 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006525 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006526 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006527 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006528 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006529 ALC294_FIXUP_ASUS_HEADSET_MIC,
6530 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006531 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006532 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006533 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006534 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006535 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006536 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6537 ALC225_FIXUP_WYSE_AUTO_MUTE,
6538 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006539 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006540 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006541 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006542 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006543 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006544 ALC289_FIXUP_DELL_SPK2,
6545 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006546 ALC294_FIXUP_SPK2_TO_DAC1,
6547 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006548 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006549 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006550 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006551 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006552 ALC294_FIXUP_ASUS_GX502_HP,
6553 ALC294_FIXUP_ASUS_GX502_PINS,
6554 ALC294_FIXUP_ASUS_GX502_VERBS,
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006555 ALC294_FIXUP_ASUS_GU502_HP,
6556 ALC294_FIXUP_ASUS_GU502_PINS,
6557 ALC294_FIXUP_ASUS_GU502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006558 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006559 ALC285_FIXUP_HP_MUTE_LED,
Jeremy Szue7d66cf2021-03-16 15:46:24 +08006560 ALC236_FIXUP_HP_GPIO_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006561 ALC236_FIXUP_HP_MUTE_LED,
Jonas Witschel75b62ab2021-04-16 12:58:54 +02006562 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
Mike Pozulp14425f12020-05-09 20:28:37 -07006563 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006564 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006565 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006566 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006567 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006568 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006569 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006570 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006571 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006572 ALC269_FIXUP_CZC_B20,
6573 ALC269_FIXUP_CZC_TMI,
6574 ALC269_FIXUP_CZC_L101,
6575 ALC269_FIXUP_LEMOTE_A1802,
6576 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006577 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Phil Calvind1ee66c2021-04-15 18:01:29 -04006578 ALC233_FIXUP_INTEL_NUC8_DMIC,
6579 ALC233_FIXUP_INTEL_NUC8_BOOST,
Werner Sembach73e71612021-03-02 19:04:14 +01006580 ALC256_FIXUP_INTEL_NUC10,
Hui Wangfc19d552020-09-09 10:00:41 +08006581 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006582 ALC274_FIXUP_HP_MIC,
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006583 ALC274_FIXUP_HP_HEADSET_MIC,
Takashi Iwai622464c2021-05-04 11:18:02 +02006584 ALC274_FIXUP_HP_ENVY_GPIO,
Kailang Yangef9ce662020-11-03 15:40:35 +08006585 ALC256_FIXUP_ASUS_HPE,
Kailang Yang446b8182020-11-02 15:00:12 +08006586 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Kailang Yanga0ccbc52020-11-06 15:20:38 +08006587 ALC287_FIXUP_HP_GPIO_LED,
Kailang Yang9e885772020-11-03 15:30:51 +08006588 ALC256_FIXUP_HP_HEADSET_MIC,
Kailang Yang92666d42020-11-19 17:04:21 +08006589 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
Chris Chiu34cdf402020-12-16 20:52:00 +08006590 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
Chris Chiu495dc762021-01-14 16:27:28 +08006591 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
Chris Chiud0e18562021-02-26 09:04:40 +08006592 ALC256_FIXUP_ACER_HEADSET_MIC,
Takashi Iwai26928ca2021-04-16 10:12:11 +02006593 ALC285_FIXUP_IDEAPAD_S740_COEF,
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08006594 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02006595 ALC295_FIXUP_ASUS_DACS,
Takashi Iwai5d84b532021-05-04 14:18:32 +02006596 ALC295_FIXUP_HP_OMEN,
Elia Devitof2be77f2021-05-11 14:46:49 +02006597 ALC285_FIXUP_HP_SPECTRE_X360,
Hui Wang9ebaef02021-05-22 12:26:45 +08006598 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03006599 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
Hui Wang57c9e212021-06-08 10:46:00 +08006600 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006601};
6602
Takashi Iwai1727a772013-01-10 09:52:52 +01006603static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006604 [ALC269_FIXUP_GPIO2] = {
6605 .type = HDA_FIXUP_FUNC,
6606 .v.func = alc_fixup_gpio2,
6607 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006608 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01006609 .type = HDA_FIXUP_PINCTLS,
6610 .v.pins = (const struct hda_pintbl[]) {
6611 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006612 {}
6613 }
6614 },
6615 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006616 .type = HDA_FIXUP_FUNC,
6617 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006618 .chained = true,
6619 .chain_id = ALC269_FIXUP_SONY_VAIO
6620 },
6621 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006622 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006623 .v.verbs = (const struct hda_verb[]) {
6624 /* Enables internal speaker */
6625 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6626 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6627 {}
6628 }
6629 },
6630 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006631 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02006632 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006633 },
6634 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006635 .type = HDA_FIXUP_PINS,
6636 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02006637 { 0x17, 0x99130111 }, /* subwoofer */
6638 { }
6639 }
6640 },
6641 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006642 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006643 .v.verbs = (const struct hda_verb[]) {
6644 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6645 {}
6646 }
6647 },
6648 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006649 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006650 .v.func = alc269_fixup_hweq,
6651 .chained = true,
6652 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6653 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006654 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6655 .type = HDA_FIXUP_FUNC,
6656 .v.func = alc_fixup_disable_aamix,
6657 .chained = true,
6658 .chain_id = ALC269_FIXUP_SONY_VAIO
6659 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006660 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006661 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006662 .v.func = alc271_fixup_dmic,
6663 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02006664 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006665 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006666 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02006667 .chained = true,
6668 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02006669 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006670 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006671 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006672 .v.func = alc269_fixup_stereo_dmic,
6673 },
David Henningsson7c478f02013-10-11 10:18:46 +02006674 [ALC269_FIXUP_HEADSET_MIC] = {
6675 .type = HDA_FIXUP_FUNC,
6676 .v.func = alc269_fixup_headset_mic,
6677 },
Takashi Iwai24519912011-08-16 15:08:49 +02006678 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006679 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02006680 .v.func = alc269_fixup_quanta_mute,
6681 },
6682 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006683 .type = HDA_FIXUP_PINS,
6684 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02006685 { 0x1a, 0x2101103f }, /* dock line-out */
6686 { 0x1b, 0x23a11040 }, /* dock mic-in */
6687 { }
6688 },
6689 .chained = true,
6690 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6691 },
David Henningsson2041d562014-06-13 11:15:44 +02006692 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6693 .type = HDA_FIXUP_PINS,
6694 .v.pins = (const struct hda_pintbl[]) {
6695 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6696 { }
6697 },
6698 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006699 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6700 .type = HDA_FIXUP_PINS,
6701 .v.pins = (const struct hda_pintbl[]) {
6702 { 0x21, 0x0221102f }, /* HP out */
6703 { }
6704 },
6705 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006706 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6707 .type = HDA_FIXUP_FUNC,
6708 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6709 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006710 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6711 .type = HDA_FIXUP_FUNC,
6712 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6713 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02006714 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006715 .type = HDA_FIXUP_PINS,
6716 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006717 { 0x14, 0x99130110 }, /* speaker */
6718 { 0x15, 0x0121401f }, /* HP out */
6719 { 0x18, 0x01a19c20 }, /* mic */
6720 { 0x19, 0x99a3092f }, /* int-mic */
6721 { }
6722 },
6723 },
6724 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006725 .type = HDA_FIXUP_PINS,
6726 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006727 { 0x12, 0x99a3092f }, /* int-mic */
6728 { 0x14, 0x99130110 }, /* speaker */
6729 { 0x15, 0x0121401f }, /* HP out */
6730 { 0x18, 0x01a19c20 }, /* mic */
6731 { }
6732 },
6733 },
6734 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006735 .type = HDA_FIXUP_PINS,
6736 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006737 { 0x14, 0x99130110 }, /* speaker */
6738 { 0x18, 0x01a19c20 }, /* mic */
6739 { 0x19, 0x99a3092f }, /* int-mic */
6740 { 0x21, 0x0121401f }, /* HP out */
6741 { }
6742 },
6743 },
David Henningsson2267ea92012-01-03 08:45:56 +01006744 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006745 .type = HDA_FIXUP_PINS,
6746 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006747 { 0x12, 0x99a3092f }, /* int-mic */
6748 { 0x14, 0x99130110 }, /* speaker */
6749 { 0x18, 0x01a19c20 }, /* mic */
6750 { 0x21, 0x0121401f }, /* HP out */
6751 { }
6752 },
6753 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006754 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006755 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006756 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01006757 },
David Henningssond06ac142013-02-18 11:41:55 +01006758 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6759 .type = HDA_FIXUP_FUNC,
6760 .v.func = alc269_fixup_hp_mute_led_mic1,
6761 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006762 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006763 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006764 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01006765 },
Tom Briden7f783bd2017-03-25 10:12:01 +00006766 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6767 .type = HDA_FIXUP_FUNC,
6768 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006769 .chained = true,
6770 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00006771 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006772 [ALC269_FIXUP_HP_GPIO_LED] = {
6773 .type = HDA_FIXUP_FUNC,
6774 .v.func = alc269_fixup_hp_gpio_led,
6775 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006776 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6777 .type = HDA_FIXUP_FUNC,
6778 .v.func = alc269_fixup_hp_gpio_mic1_led,
6779 },
6780 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6781 .type = HDA_FIXUP_FUNC,
6782 .v.func = alc269_fixup_hp_line1_mic1_led,
6783 },
David Henningsson693b6132012-06-22 19:12:10 +02006784 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006785 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02006786 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02006787 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006788 [ALC269_FIXUP_NO_SHUTUP] = {
6789 .type = HDA_FIXUP_FUNC,
6790 .v.func = alc_fixup_no_shutup,
6791 },
David Henningsson108cc102012-07-20 10:37:25 +02006792 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006793 .type = HDA_FIXUP_PINS,
6794 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02006795 { 0x19, 0x23a11040 }, /* dock mic */
6796 { 0x1b, 0x2121103f }, /* dock headphone */
6797 { }
6798 },
6799 .chained = true,
6800 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6801 },
Takashi Iwaib590b382020-05-14 18:05:33 +02006802 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6803 .type = HDA_FIXUP_FUNC,
6804 .v.func = alc269_fixup_limit_int_mic_boost,
6805 .chained = true,
6806 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6807 },
David Henningsson108cc102012-07-20 10:37:25 +02006808 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006809 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02006810 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01006811 .chained = true,
6812 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02006813 },
David Henningsson73bdd592013-04-15 15:44:14 +02006814 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6815 .type = HDA_FIXUP_PINS,
6816 .v.pins = (const struct hda_pintbl[]) {
6817 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6818 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6819 { }
6820 },
6821 .chained = true,
6822 .chain_id = ALC269_FIXUP_HEADSET_MODE
6823 },
6824 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6825 .type = HDA_FIXUP_PINS,
6826 .v.pins = (const struct hda_pintbl[]) {
6827 { 0x16, 0x21014020 }, /* dock line out */
6828 { 0x19, 0x21a19030 }, /* dock mic */
6829 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6830 { }
6831 },
6832 .chained = true,
6833 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6834 },
David Henningsson338cae52013-10-07 10:39:59 +02006835 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6836 .type = HDA_FIXUP_PINS,
6837 .v.pins = (const struct hda_pintbl[]) {
6838 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6839 { }
6840 },
6841 .chained = true,
6842 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6843 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08006844 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6845 .type = HDA_FIXUP_PINS,
6846 .v.pins = (const struct hda_pintbl[]) {
6847 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6848 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6849 { }
6850 },
6851 .chained = true,
6852 .chain_id = ALC269_FIXUP_HEADSET_MODE
6853 },
David Henningsson73bdd592013-04-15 15:44:14 +02006854 [ALC269_FIXUP_HEADSET_MODE] = {
6855 .type = HDA_FIXUP_FUNC,
6856 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08006857 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006858 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02006859 },
6860 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6861 .type = HDA_FIXUP_FUNC,
6862 .v.func = alc_fixup_headset_mode_no_hp_mic,
6863 },
Takashi Iwai78197172015-06-27 10:21:13 +02006864 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6865 .type = HDA_FIXUP_PINS,
6866 .v.pins = (const struct hda_pintbl[]) {
6867 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6868 { }
6869 },
6870 .chained = true,
6871 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6872 },
David Henningsson88cfcf82013-10-11 10:18:45 +02006873 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6874 .type = HDA_FIXUP_PINS,
6875 .v.pins = (const struct hda_pintbl[]) {
6876 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6877 { }
6878 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02006879 .chained = true,
6880 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02006881 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006882 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006883 .type = HDA_FIXUP_PINS,
6884 .v.pins = (const struct hda_pintbl[]) {
6885 {0x12, 0x90a60130},
6886 {0x13, 0x40000000},
6887 {0x14, 0x90170110},
6888 {0x18, 0x411111f0},
6889 {0x19, 0x04a11040},
6890 {0x1a, 0x411111f0},
6891 {0x1b, 0x90170112},
6892 {0x1d, 0x40759a05},
6893 {0x1e, 0x411111f0},
6894 {0x21, 0x04211020},
6895 { }
6896 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05006897 .chained = true,
6898 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006899 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006900 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6901 .type = HDA_FIXUP_FUNC,
6902 .v.func = alc298_fixup_huawei_mbx_stereo,
6903 .chained = true,
6904 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6905 },
David Henningssond240d1d2013-04-15 12:50:02 +02006906 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6907 .type = HDA_FIXUP_FUNC,
6908 .v.func = alc269_fixup_x101_headset_mic,
6909 },
6910 [ALC269_FIXUP_ASUS_X101_VERB] = {
6911 .type = HDA_FIXUP_VERBS,
6912 .v.verbs = (const struct hda_verb[]) {
6913 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6914 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6915 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6916 { }
6917 },
6918 .chained = true,
6919 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6920 },
6921 [ALC269_FIXUP_ASUS_X101] = {
6922 .type = HDA_FIXUP_PINS,
6923 .v.pins = (const struct hda_pintbl[]) {
6924 { 0x18, 0x04a1182c }, /* Headset mic */
6925 { }
6926 },
6927 .chained = true,
6928 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6929 },
Dylan Reid08a978d2012-11-18 22:56:40 -08006930 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006931 .type = HDA_FIXUP_PINS,
6932 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08006933 { 0x14, 0x99130110 }, /* speaker */
6934 { 0x19, 0x01a19c20 }, /* mic */
6935 { 0x1b, 0x99a7012f }, /* int-mic */
6936 { 0x21, 0x0121401f }, /* HP out */
6937 { }
6938 },
6939 },
6940 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006941 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08006942 .v.func = alc271_hp_gate_mic_jack,
6943 .chained = true,
6944 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6945 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006946 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6947 .type = HDA_FIXUP_FUNC,
6948 .v.func = alc269_fixup_limit_int_mic_boost,
6949 .chained = true,
6950 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6951 },
Dylan Reid42397002013-04-05 14:58:22 -07006952 [ALC269_FIXUP_ACER_AC700] = {
6953 .type = HDA_FIXUP_PINS,
6954 .v.pins = (const struct hda_pintbl[]) {
6955 { 0x12, 0x99a3092f }, /* int-mic */
6956 { 0x14, 0x99130110 }, /* speaker */
6957 { 0x18, 0x03a11c20 }, /* mic */
6958 { 0x1e, 0x0346101e }, /* SPDIF1 */
6959 { 0x21, 0x0321101f }, /* HP out */
6960 { }
6961 },
6962 .chained = true,
6963 .chain_id = ALC271_FIXUP_DMIC,
6964 },
David Henningsson3e0d6112013-04-22 14:30:14 +02006965 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6966 .type = HDA_FIXUP_FUNC,
6967 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01006968 .chained = true,
6969 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02006970 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01006971 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6972 .type = HDA_FIXUP_FUNC,
6973 .v.func = alc269_fixup_limit_int_mic_boost,
6974 .chained = true,
6975 .chain_id = ALC269VB_FIXUP_DMIC,
6976 },
Takashi Iwai23870832013-11-29 14:13:12 +01006977 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6978 .type = HDA_FIXUP_VERBS,
6979 .v.verbs = (const struct hda_verb[]) {
6980 /* class-D output amp +5dB */
6981 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6982 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6983 {}
6984 },
6985 .chained = true,
6986 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6987 },
David Henningsson8e35cd42013-11-06 11:20:01 +01006988 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6989 .type = HDA_FIXUP_FUNC,
6990 .v.func = alc269_fixup_limit_int_mic_boost,
6991 .chained = true,
6992 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6993 },
Anisse Astier02b504d2013-06-03 11:53:10 +02006994 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6995 .type = HDA_FIXUP_PINS,
6996 .v.pins = (const struct hda_pintbl[]) {
6997 { 0x12, 0x99a3092f }, /* int-mic */
6998 { 0x18, 0x03a11d20 }, /* mic */
6999 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7000 { }
7001 },
7002 },
Kailang Yangcd217a62013-08-22 10:15:24 +02007003 [ALC283_FIXUP_CHROME_BOOK] = {
7004 .type = HDA_FIXUP_FUNC,
7005 .v.func = alc283_fixup_chromebook,
7006 },
Kailang Yang0202e992013-12-02 15:20:15 +08007007 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7008 .type = HDA_FIXUP_FUNC,
7009 .v.func = alc283_fixup_sense_combo_jack,
7010 .chained = true,
7011 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7012 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02007013 [ALC282_FIXUP_ASUS_TX300] = {
7014 .type = HDA_FIXUP_FUNC,
7015 .v.func = alc282_fixup_asus_tx300,
7016 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02007017 [ALC283_FIXUP_INT_MIC] = {
7018 .type = HDA_FIXUP_VERBS,
7019 .v.verbs = (const struct hda_verb[]) {
7020 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7021 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7022 { }
7023 },
7024 .chained = true,
7025 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7026 },
David Henningsson0f4881d2013-12-20 16:08:13 +01007027 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7028 .type = HDA_FIXUP_PINS,
7029 .v.pins = (const struct hda_pintbl[]) {
7030 { 0x17, 0x90170112 }, /* subwoofer */
7031 { }
7032 },
7033 .chained = true,
7034 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7035 },
7036 [ALC290_FIXUP_SUBWOOFER] = {
7037 .type = HDA_FIXUP_PINS,
7038 .v.pins = (const struct hda_pintbl[]) {
7039 { 0x17, 0x90170112 }, /* subwoofer */
7040 { }
7041 },
7042 .chained = true,
7043 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7044 },
David Henningsson338cae52013-10-07 10:39:59 +02007045 [ALC290_FIXUP_MONO_SPEAKERS] = {
7046 .type = HDA_FIXUP_FUNC,
7047 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01007048 },
7049 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7050 .type = HDA_FIXUP_FUNC,
7051 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02007052 .chained = true,
7053 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7054 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01007055 [ALC269_FIXUP_THINKPAD_ACPI] = {
7056 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02007057 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02007058 .chained = true,
7059 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01007060 },
David Henningsson56f27012016-01-11 09:33:14 +01007061 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7062 .type = HDA_FIXUP_FUNC,
7063 .v.func = alc_fixup_inv_dmic,
7064 .chained = true,
7065 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7066 },
Chris Chiu5824ce82017-02-28 14:17:11 -06007067 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08007068 .type = HDA_FIXUP_PINS,
7069 .v.pins = (const struct hda_pintbl[]) {
7070 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7071 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06007072 },
7073 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08007074 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06007075 },
Chris Chiu615966a2017-02-28 14:17:12 -06007076 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7077 .type = HDA_FIXUP_PINS,
7078 .v.pins = (const struct hda_pintbl[]) {
7079 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7080 { }
7081 },
7082 .chained = true,
7083 .chain_id = ALC255_FIXUP_HEADSET_MODE
7084 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007085 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7086 .type = HDA_FIXUP_PINS,
7087 .v.pins = (const struct hda_pintbl[]) {
7088 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7089 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7090 { }
7091 },
7092 .chained = true,
7093 .chain_id = ALC255_FIXUP_HEADSET_MODE
7094 },
Kailang Yang31278992014-03-03 15:27:22 +08007095 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7096 .type = HDA_FIXUP_PINS,
7097 .v.pins = (const struct hda_pintbl[]) {
7098 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7099 { }
7100 },
7101 .chained = true,
7102 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7103 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007104 [ALC255_FIXUP_HEADSET_MODE] = {
7105 .type = HDA_FIXUP_FUNC,
7106 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08007107 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007108 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007109 },
Kailang Yang31278992014-03-03 15:27:22 +08007110 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7111 .type = HDA_FIXUP_FUNC,
7112 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7113 },
Kailang Yanga22aa262014-04-23 17:34:28 +08007114 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7115 .type = HDA_FIXUP_PINS,
7116 .v.pins = (const struct hda_pintbl[]) {
7117 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7118 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7119 { }
7120 },
7121 .chained = true,
7122 .chain_id = ALC269_FIXUP_HEADSET_MODE
7123 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02007124 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02007125 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02007126 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02007127 .chained = true,
7128 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7129 },
Takashi Iwai9a811232015-12-09 15:17:43 +01007130 [ALC292_FIXUP_TPT440] = {
7131 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01007132 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01007133 .chained = true,
7134 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7135 },
Anisse Astierabaa22742016-08-24 09:14:13 +02007136 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01007137 .type = HDA_FIXUP_PINS,
7138 .v.pins = (const struct hda_pintbl[]) {
7139 { 0x19, 0x04a110f0 },
7140 { },
7141 },
7142 },
Takashi Iwaib3802782018-11-26 17:47:46 +01007143 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08007144 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007145 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08007146 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007147 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7148 .type = HDA_FIXUP_PINS,
7149 .v.pins = (const struct hda_pintbl[]) {
7150 { 0x12, 0x90a60130 },
7151 { 0x14, 0x90170110 },
7152 { 0x17, 0x40000008 },
7153 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02007154 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007155 { 0x1a, 0x411111f0 },
7156 { 0x1b, 0x411111f0 },
7157 { 0x1d, 0x40f89b2d },
7158 { 0x1e, 0x411111f0 },
7159 { 0x21, 0x0321101f },
7160 { },
7161 },
7162 },
Takashi Iwaic8426b22021-04-07 11:57:30 +02007163 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7164 .type = HDA_FIXUP_FUNC,
7165 .v.func = alc269vb_fixup_aspire_e1_coef,
7166 },
David Henningsson7a5255f2014-10-30 08:26:01 +01007167 [ALC280_FIXUP_HP_GPIO4] = {
7168 .type = HDA_FIXUP_FUNC,
7169 .v.func = alc280_fixup_hp_gpio4,
7170 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007171 [ALC286_FIXUP_HP_GPIO_LED] = {
7172 .type = HDA_FIXUP_FUNC,
7173 .v.func = alc286_fixup_hp_gpio_led,
7174 },
David Henningsson33f4acd2015-01-07 15:50:13 +01007175 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7176 .type = HDA_FIXUP_FUNC,
7177 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7178 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01007179 [ALC280_FIXUP_HP_DOCK_PINS] = {
7180 .type = HDA_FIXUP_PINS,
7181 .v.pins = (const struct hda_pintbl[]) {
7182 { 0x1b, 0x21011020 }, /* line-out */
7183 { 0x1a, 0x01a1903c }, /* headset mic */
7184 { 0x18, 0x2181103f }, /* line-in */
7185 { },
7186 },
7187 .chained = true,
7188 .chain_id = ALC280_FIXUP_HP_GPIO4
7189 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007190 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7191 .type = HDA_FIXUP_PINS,
7192 .v.pins = (const struct hda_pintbl[]) {
7193 { 0x1b, 0x21011020 }, /* line-out */
7194 { 0x18, 0x2181103f }, /* line-in */
7195 { },
7196 },
7197 .chained = true,
7198 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7199 },
Keith Packard98973f22015-07-15 12:14:39 -07007200 [ALC280_FIXUP_HP_9480M] = {
7201 .type = HDA_FIXUP_FUNC,
7202 .v.func = alc280_fixup_hp_9480m,
7203 },
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007204 [ALC245_FIXUP_HP_X360_AMP] = {
7205 .type = HDA_FIXUP_FUNC,
7206 .v.func = alc245_fixup_hp_x360_amp,
7207 },
Kailang Yange1e62b92015-04-08 16:01:22 +08007208 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7209 .type = HDA_FIXUP_FUNC,
7210 .v.func = alc_fixup_headset_mode_dell_alc288,
7211 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007212 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08007213 },
7214 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7215 .type = HDA_FIXUP_PINS,
7216 .v.pins = (const struct hda_pintbl[]) {
7217 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7218 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7219 { }
7220 },
7221 .chained = true,
7222 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7223 },
Hui Wang831bfdf92015-06-26 12:35:17 +08007224 [ALC288_FIXUP_DISABLE_AAMIX] = {
7225 .type = HDA_FIXUP_FUNC,
7226 .v.func = alc_fixup_disable_aamix,
7227 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02007228 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08007229 },
7230 [ALC288_FIXUP_DELL_XPS_13] = {
7231 .type = HDA_FIXUP_FUNC,
7232 .v.func = alc_fixup_dell_xps13,
7233 .chained = true,
7234 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7235 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007236 [ALC292_FIXUP_DISABLE_AAMIX] = {
7237 .type = HDA_FIXUP_FUNC,
7238 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08007239 .chained = true,
7240 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007241 },
David Henningssonc04017e2015-12-15 14:44:03 +01007242 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7243 .type = HDA_FIXUP_FUNC,
7244 .v.func = alc_fixup_disable_aamix,
7245 .chained = true,
7246 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7247 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007248 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007249 .type = HDA_FIXUP_FUNC,
7250 .v.func = alc_fixup_dell_xps13,
7251 .chained = true,
7252 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7253 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007254 [ALC292_FIXUP_DELL_E7X] = {
7255 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007256 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01007257 /* micmute fixup must be applied at last */
7258 .chained_before = true,
7259 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7260 },
James McDonnell54324222019-09-16 14:53:38 +00007261 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7262 .type = HDA_FIXUP_PINS,
7263 .v.pins = (const struct hda_pintbl[]) {
7264 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7265 { }
7266 },
7267 .chained_before = true,
7268 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7269 },
Kailang Yang977e6272015-05-18 15:31:20 +08007270 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7271 .type = HDA_FIXUP_PINS,
7272 .v.pins = (const struct hda_pintbl[]) {
7273 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7274 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7275 { }
7276 },
7277 .chained = true,
7278 .chain_id = ALC269_FIXUP_HEADSET_MODE
7279 },
Hui Wang2f726ae2017-03-31 10:31:40 +08007280 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7281 .type = HDA_FIXUP_PINS,
7282 .v.pins = (const struct hda_pintbl[]) {
7283 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7284 { }
7285 },
7286 .chained = true,
7287 .chain_id = ALC269_FIXUP_HEADSET_MODE
7288 },
Kailang Yang6ed11312015-10-26 15:37:39 +08007289 [ALC275_FIXUP_DELL_XPS] = {
7290 .type = HDA_FIXUP_VERBS,
7291 .v.verbs = (const struct hda_verb[]) {
7292 /* Enables internal speaker */
7293 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7294 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7295 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7296 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7297 {}
7298 }
7299 },
Hui Wang23adc192015-12-08 12:27:18 +08007300 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7301 .type = HDA_FIXUP_FUNC,
7302 .v.func = alc_fixup_disable_aamix,
7303 .chained = true,
7304 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7305 },
Kailang3694cb22015-12-28 11:35:24 +08007306 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7307 .type = HDA_FIXUP_FUNC,
7308 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7309 },
Phil Calvind1ee66c2021-04-15 18:01:29 -04007310 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7311 .type = HDA_FIXUP_FUNC,
7312 .v.func = alc_fixup_inv_dmic,
7313 .chained = true,
7314 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7315 },
7316 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7317 .type = HDA_FIXUP_FUNC,
7318 .v.func = alc269_fixup_limit_int_mic_boost
7319 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007320 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7321 .type = HDA_FIXUP_FUNC,
7322 .v.func = alc_fixup_disable_aamix,
7323 .chained = true,
7324 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7325 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08007326 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7327 .type = HDA_FIXUP_FUNC,
7328 .v.func = alc_fixup_disable_mic_vref,
7329 .chained = true,
7330 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7331 },
David Henningsson2ae95572016-02-25 09:37:05 +01007332 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7333 .type = HDA_FIXUP_VERBS,
7334 .v.verbs = (const struct hda_verb[]) {
7335 /* Disable pass-through path for FRONT 14h */
7336 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7337 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7338 {}
7339 },
7340 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007341 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007342 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007343 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7344 .type = HDA_FIXUP_FUNC,
7345 .v.func = alc_fixup_disable_aamix,
7346 .chained = true,
7347 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7348 },
Hui Wange549d192016-04-01 11:00:15 +08007349 [ALC221_FIXUP_HP_FRONT_MIC] = {
7350 .type = HDA_FIXUP_PINS,
7351 .v.pins = (const struct hda_pintbl[]) {
7352 { 0x19, 0x02a19020 }, /* Front Mic */
7353 { }
7354 },
7355 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007356 [ALC292_FIXUP_TPT460] = {
7357 .type = HDA_FIXUP_FUNC,
7358 .v.func = alc_fixup_tpt440_dock,
7359 .chained = true,
7360 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7361 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007362 [ALC298_FIXUP_SPK_VOLUME] = {
7363 .type = HDA_FIXUP_FUNC,
7364 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007365 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007366 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007367 },
Kailang Yangf86de9b2020-10-23 14:46:47 +08007368 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7369 .type = HDA_FIXUP_FUNC,
7370 .v.func = alc298_fixup_speaker_volume,
7371 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007372 [ALC295_FIXUP_DISABLE_DAC3] = {
7373 .type = HDA_FIXUP_FUNC,
7374 .v.func = alc295_fixup_disable_dac3,
7375 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007376 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7377 .type = HDA_FIXUP_FUNC,
7378 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007379 .chained = true,
7380 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007381 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007382 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7383 .type = HDA_FIXUP_PINS,
7384 .v.pins = (const struct hda_pintbl[]) {
7385 { 0x1b, 0x90170151 },
7386 { }
7387 },
7388 .chained = true,
7389 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7390 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007391 [ALC269_FIXUP_ATIV_BOOK_8] = {
7392 .type = HDA_FIXUP_FUNC,
7393 .v.func = alc_fixup_auto_mute_via_amp,
7394 .chained = true,
7395 .chain_id = ALC269_FIXUP_NO_SHUTUP
7396 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007397 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7398 .type = HDA_FIXUP_PINS,
7399 .v.pins = (const struct hda_pintbl[]) {
7400 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7401 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7402 { }
7403 },
7404 .chained = true,
7405 .chain_id = ALC269_FIXUP_HEADSET_MODE
7406 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007407 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7408 .type = HDA_FIXUP_FUNC,
7409 .v.func = alc_fixup_headset_mode,
7410 },
7411 [ALC256_FIXUP_ASUS_MIC] = {
7412 .type = HDA_FIXUP_PINS,
7413 .v.pins = (const struct hda_pintbl[]) {
7414 { 0x13, 0x90a60160 }, /* use as internal mic */
7415 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7416 { }
7417 },
7418 .chained = true,
7419 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7420 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007421 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007422 .type = HDA_FIXUP_FUNC,
7423 /* Set up GPIO2 for the speaker amp */
7424 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007425 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007426 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7427 .type = HDA_FIXUP_PINS,
7428 .v.pins = (const struct hda_pintbl[]) {
7429 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7430 { }
7431 },
7432 .chained = true,
7433 .chain_id = ALC269_FIXUP_HEADSET_MIC
7434 },
7435 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7436 .type = HDA_FIXUP_VERBS,
7437 .v.verbs = (const struct hda_verb[]) {
7438 /* Enables internal speaker */
7439 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7440 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7441 {}
7442 },
7443 .chained = true,
7444 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7445 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007446 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7447 .type = HDA_FIXUP_FUNC,
7448 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007449 .chained = true,
7450 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007451 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007452 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7453 .type = HDA_FIXUP_VERBS,
7454 .v.verbs = (const struct hda_verb[]) {
7455 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7456 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7457 { }
7458 },
7459 .chained = true,
7460 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7461 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007462 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7463 .type = HDA_FIXUP_PINS,
7464 .v.pins = (const struct hda_pintbl[]) {
7465 /* Change the mic location from front to right, otherwise there are
7466 two front mics with the same name, pulseaudio can't handle them.
7467 This is just a temporary workaround, after applying this fixup,
7468 there will be one "Front Mic" and one "Mic" in this machine.
7469 */
7470 { 0x1a, 0x04a19040 },
7471 { }
7472 },
7473 },
Kailang Yang5f364132017-07-25 16:28:16 +08007474 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7475 .type = HDA_FIXUP_PINS,
7476 .v.pins = (const struct hda_pintbl[]) {
7477 { 0x16, 0x0101102f }, /* Rear Headset HP */
7478 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7479 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7480 { 0x1b, 0x02011020 },
7481 { }
7482 },
7483 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007484 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7485 },
7486 [ALC225_FIXUP_S3_POP_NOISE] = {
7487 .type = HDA_FIXUP_FUNC,
7488 .v.func = alc225_fixup_s3_pop_noise,
7489 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007490 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7491 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007492 [ALC700_FIXUP_INTEL_REFERENCE] = {
7493 .type = HDA_FIXUP_VERBS,
7494 .v.verbs = (const struct hda_verb[]) {
7495 /* Enables internal speaker */
7496 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7497 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7498 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7499 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7500 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7501 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7502 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7503 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7504 {}
7505 }
7506 },
Kailang Yang92266652017-12-14 15:28:58 +08007507 [ALC274_FIXUP_DELL_BIND_DACS] = {
7508 .type = HDA_FIXUP_FUNC,
7509 .v.func = alc274_fixup_bind_dacs,
7510 .chained = true,
7511 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7512 },
7513 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7514 .type = HDA_FIXUP_PINS,
7515 .v.pins = (const struct hda_pintbl[]) {
7516 { 0x1b, 0x0401102f },
7517 { }
7518 },
7519 .chained = true,
7520 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7521 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007522 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007523 .type = HDA_FIXUP_FUNC,
7524 .v.func = alc_fixup_tpt470_dock,
7525 .chained = true,
7526 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7527 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007528 [ALC298_FIXUP_TPT470_DOCK] = {
7529 .type = HDA_FIXUP_FUNC,
7530 .v.func = alc_fixup_tpt470_dacs,
7531 .chained = true,
7532 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7533 },
Kailang Yangae104a22018-02-05 16:07:20 +08007534 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7535 .type = HDA_FIXUP_PINS,
7536 .v.pins = (const struct hda_pintbl[]) {
7537 { 0x14, 0x0201101f },
7538 { }
7539 },
7540 .chained = true,
7541 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7542 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007543 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7544 .type = HDA_FIXUP_PINS,
7545 .v.pins = (const struct hda_pintbl[]) {
7546 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7547 { }
7548 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007549 .chained = true,
7550 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007551 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007552 [ALC295_FIXUP_HP_X360] = {
7553 .type = HDA_FIXUP_FUNC,
7554 .v.func = alc295_fixup_hp_top_speakers,
7555 .chained = true,
7556 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007557 },
7558 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7559 .type = HDA_FIXUP_PINS,
7560 .v.pins = (const struct hda_pintbl[]) {
7561 { 0x19, 0x0181313f},
7562 { }
7563 },
7564 .chained = true,
7565 .chain_id = ALC269_FIXUP_HEADSET_MIC
7566 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007567 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7568 .type = HDA_FIXUP_FUNC,
7569 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007570 .chained = true,
7571 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007572 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007573 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7574 .type = HDA_FIXUP_FUNC,
7575 .v.func = alc_fixup_auto_mute_via_amp,
7576 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007577 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7578 .type = HDA_FIXUP_PINS,
7579 .v.pins = (const struct hda_pintbl[]) {
7580 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7581 { }
7582 },
7583 .chained = true,
7584 .chain_id = ALC269_FIXUP_HEADSET_MIC
7585 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007586 [ALC294_FIXUP_ASUS_MIC] = {
7587 .type = HDA_FIXUP_PINS,
7588 .v.pins = (const struct hda_pintbl[]) {
7589 { 0x13, 0x90a60160 }, /* use as internal mic */
7590 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7591 { }
7592 },
7593 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007594 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007595 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007596 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7597 .type = HDA_FIXUP_PINS,
7598 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007599 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007600 { }
7601 },
7602 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007603 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007604 },
7605 [ALC294_FIXUP_ASUS_SPK] = {
7606 .type = HDA_FIXUP_VERBS,
7607 .v.verbs = (const struct hda_verb[]) {
7608 /* Set EAPD high */
7609 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7610 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08007611 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7612 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007613 { }
7614 },
7615 .chained = true,
7616 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7617 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007618 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08007619 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007620 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08007621 .chained = true,
7622 .chain_id = ALC225_FIXUP_HEADSET_JACK
7623 },
7624 [ALC225_FIXUP_HEADSET_JACK] = {
7625 .type = HDA_FIXUP_FUNC,
7626 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08007627 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07007628 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7629 .type = HDA_FIXUP_PINS,
7630 .v.pins = (const struct hda_pintbl[]) {
7631 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7632 { }
7633 },
7634 .chained = true,
7635 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7636 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08007637 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7638 .type = HDA_FIXUP_VERBS,
7639 .v.verbs = (const struct hda_verb[]) {
7640 /* Disable PCBEEP-IN passthrough */
7641 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7642 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7643 { }
7644 },
7645 .chained = true,
7646 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7647 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007648 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7649 .type = HDA_FIXUP_PINS,
7650 .v.pins = (const struct hda_pintbl[]) {
7651 { 0x19, 0x03a11130 },
7652 { 0x1a, 0x90a60140 }, /* use as internal mic */
7653 { }
7654 },
7655 .chained = true,
7656 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7657 },
Kailang Yang136824e2019-03-14 16:22:45 +08007658 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7659 .type = HDA_FIXUP_PINS,
7660 .v.pins = (const struct hda_pintbl[]) {
7661 { 0x16, 0x01011020 }, /* Rear Line out */
7662 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7663 { }
7664 },
7665 .chained = true,
7666 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7667 },
7668 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7669 .type = HDA_FIXUP_FUNC,
7670 .v.func = alc_fixup_auto_mute_via_amp,
7671 .chained = true,
7672 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7673 },
7674 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7675 .type = HDA_FIXUP_FUNC,
7676 .v.func = alc_fixup_disable_mic_vref,
7677 .chained = true,
7678 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7679 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007680 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7681 .type = HDA_FIXUP_VERBS,
7682 .v.verbs = (const struct hda_verb[]) {
7683 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7684 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7685 { }
7686 },
7687 .chained = true,
7688 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7689 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08007690 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7691 .type = HDA_FIXUP_PINS,
7692 .v.pins = (const struct hda_pintbl[]) {
7693 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7694 { }
7695 },
7696 .chained = true,
7697 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7698 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08007699 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7700 .type = HDA_FIXUP_PINS,
7701 .v.pins = (const struct hda_pintbl[]) {
7702 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7703 { }
7704 },
7705 .chained = true,
7706 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7707 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007708 [ALC299_FIXUP_PREDATOR_SPK] = {
7709 .type = HDA_FIXUP_PINS,
7710 .v.pins = (const struct hda_pintbl[]) {
7711 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7712 { }
7713 }
7714 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02007715 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7716 .type = HDA_FIXUP_PINS,
7717 .v.pins = (const struct hda_pintbl[]) {
7718 { 0x19, 0x04a11040 },
7719 { 0x21, 0x04211020 },
7720 { }
7721 },
7722 .chained = true,
7723 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7724 },
Kailang Yange79c2262019-12-19 14:12:15 +08007725 [ALC289_FIXUP_DELL_SPK2] = {
7726 .type = HDA_FIXUP_PINS,
7727 .v.pins = (const struct hda_pintbl[]) {
7728 { 0x17, 0x90170130 }, /* bass spk */
7729 { }
7730 },
7731 .chained = true,
7732 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7733 },
7734 [ALC289_FIXUP_DUAL_SPK] = {
7735 .type = HDA_FIXUP_FUNC,
7736 .v.func = alc285_fixup_speaker2_to_dac1,
7737 .chained = true,
7738 .chain_id = ALC289_FIXUP_DELL_SPK2
7739 },
Chris Chiu48e01502019-12-30 11:11:18 +08007740 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7741 .type = HDA_FIXUP_FUNC,
7742 .v.func = alc285_fixup_speaker2_to_dac1,
7743 .chained = true,
7744 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7745 },
7746 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007747 .type = HDA_FIXUP_FUNC,
7748 /* The GPIO must be pulled to initialize the AMP */
7749 .v.func = alc_fixup_gpio4,
7750 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08007751 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007752 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007753 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7754 .type = HDA_FIXUP_FUNC,
7755 .v.func = alc285_fixup_thinkpad_x1_gen7,
7756 .chained = true,
7757 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7758 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08007759 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7760 .type = HDA_FIXUP_FUNC,
7761 .v.func = alc_fixup_headset_jack,
7762 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007763 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08007764 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007765 [ALC294_FIXUP_ASUS_HPE] = {
7766 .type = HDA_FIXUP_VERBS,
7767 .v.verbs = (const struct hda_verb[]) {
7768 /* Set EAPD high */
7769 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7770 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7771 { }
7772 },
7773 .chained = true,
7774 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7775 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007776 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7777 .type = HDA_FIXUP_PINS,
7778 .v.pins = (const struct hda_pintbl[]) {
7779 { 0x19, 0x03a11050 }, /* front HP mic */
7780 { 0x1a, 0x01a11830 }, /* rear external mic */
7781 { 0x21, 0x03211020 }, /* front HP out */
7782 { }
7783 },
7784 .chained = true,
7785 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7786 },
7787 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7788 .type = HDA_FIXUP_VERBS,
7789 .v.verbs = (const struct hda_verb[]) {
7790 /* set 0x15 to HP-OUT ctrl */
7791 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7792 /* unmute the 0x15 amp */
7793 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7794 { }
7795 },
7796 .chained = true,
7797 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7798 },
7799 [ALC294_FIXUP_ASUS_GX502_HP] = {
7800 .type = HDA_FIXUP_FUNC,
7801 .v.func = alc294_fixup_gx502_hp,
7802 },
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05007803 [ALC294_FIXUP_ASUS_GU502_PINS] = {
7804 .type = HDA_FIXUP_PINS,
7805 .v.pins = (const struct hda_pintbl[]) {
7806 { 0x19, 0x01a11050 }, /* rear HP mic */
7807 { 0x1a, 0x01a11830 }, /* rear external mic */
7808 { 0x21, 0x012110f0 }, /* rear HP out */
7809 { }
7810 },
7811 .chained = true,
7812 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
7813 },
7814 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
7815 .type = HDA_FIXUP_VERBS,
7816 .v.verbs = (const struct hda_verb[]) {
7817 /* set 0x15 to HP-OUT ctrl */
7818 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7819 /* unmute the 0x15 amp */
7820 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7821 /* set 0x1b to HP-OUT */
7822 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
7823 { }
7824 },
7825 .chained = true,
7826 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
7827 },
7828 [ALC294_FIXUP_ASUS_GU502_HP] = {
7829 .type = HDA_FIXUP_FUNC,
7830 .v.func = alc294_fixup_gu502_hp,
7831 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02007832 [ALC294_FIXUP_ASUS_COEF_1B] = {
7833 .type = HDA_FIXUP_VERBS,
7834 .v.verbs = (const struct hda_verb[]) {
7835 /* Set bit 10 to correct noisy output after reboot from
7836 * Windows 10 (due to pop noise reduction?)
7837 */
7838 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7839 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7840 { }
7841 },
Takashi Iwaif8fbcdf2021-06-20 08:59:52 +02007842 .chained = true,
7843 .chain_id = ALC289_FIXUP_ASUS_GA401,
Takashi Iwai1b94e592020-05-12 09:32:03 +02007844 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08007845 [ALC285_FIXUP_HP_GPIO_LED] = {
7846 .type = HDA_FIXUP_FUNC,
7847 .v.func = alc285_fixup_hp_gpio_led,
7848 },
Kailang Yang431e76c2020-04-07 14:40:20 +08007849 [ALC285_FIXUP_HP_MUTE_LED] = {
7850 .type = HDA_FIXUP_FUNC,
7851 .v.func = alc285_fixup_hp_mute_led,
7852 },
Jeremy Szue7d66cf2021-03-16 15:46:24 +08007853 [ALC236_FIXUP_HP_GPIO_LED] = {
7854 .type = HDA_FIXUP_FUNC,
7855 .v.func = alc236_fixup_hp_gpio_led,
7856 },
Kailang Yang24164f42020-04-07 14:52:42 +08007857 [ALC236_FIXUP_HP_MUTE_LED] = {
7858 .type = HDA_FIXUP_FUNC,
7859 .v.func = alc236_fixup_hp_mute_led,
7860 },
Jonas Witschel75b62ab2021-04-16 12:58:54 +02007861 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
7862 .type = HDA_FIXUP_FUNC,
7863 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
7864 },
Mike Pozulp14425f12020-05-09 20:28:37 -07007865 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7866 .type = HDA_FIXUP_VERBS,
7867 .v.verbs = (const struct hda_verb[]) {
7868 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7869 { }
7870 },
7871 },
Chris Chiu9e433422020-05-12 14:15:24 +08007872 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7873 .type = HDA_FIXUP_PINS,
7874 .v.pins = (const struct hda_pintbl[]) {
7875 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7876 { }
7877 },
7878 .chained = true,
7879 .chain_id = ALC269_FIXUP_HEADSET_MODE
7880 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007881 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7882 .type = HDA_FIXUP_PINS,
7883 .v.pins = (const struct hda_pintbl[]) {
7884 { 0x14, 0x90100120 }, /* use as internal speaker */
7885 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7886 { 0x1a, 0x01011020 }, /* use as line out */
7887 { },
7888 },
7889 .chained = true,
7890 .chain_id = ALC269_FIXUP_HEADSET_MIC
7891 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007892 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7893 .type = HDA_FIXUP_PINS,
7894 .v.pins = (const struct hda_pintbl[]) {
7895 { 0x18, 0x02a11030 }, /* use as headset mic */
7896 { }
7897 },
7898 .chained = true,
7899 .chain_id = ALC269_FIXUP_HEADSET_MIC
7900 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007901 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7902 .type = HDA_FIXUP_PINS,
7903 .v.pins = (const struct hda_pintbl[]) {
7904 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7905 { }
7906 },
7907 .chained = true,
7908 .chain_id = ALC269_FIXUP_HEADSET_MIC
7909 },
Armas Spann293a92c2020-07-24 16:08:37 +02007910 [ALC289_FIXUP_ASUS_GA401] = {
Takashi Iwaic84bfed2020-11-27 15:11:04 +01007911 .type = HDA_FIXUP_FUNC,
7912 .v.func = alc289_fixup_asus_ga401,
7913 .chained = true,
7914 .chain_id = ALC289_FIXUP_ASUS_GA502,
Armas Spannff536642020-07-11 13:05:57 +02007915 },
Armas Spann4b43d052020-07-24 16:06:16 +02007916 [ALC289_FIXUP_ASUS_GA502] = {
7917 .type = HDA_FIXUP_PINS,
7918 .v.pins = (const struct hda_pintbl[]) {
7919 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7920 { }
7921 },
7922 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007923 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7924 .type = HDA_FIXUP_PINS,
7925 .v.pins = (const struct hda_pintbl[]) {
7926 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7927 { }
7928 },
7929 .chained = true,
7930 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7931 },
Kailang Yang56496252020-07-29 15:09:27 +08007932 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7933 .type = HDA_FIXUP_FUNC,
7934 .v.func = alc285_fixup_hp_gpio_amp_init,
7935 .chained = true,
7936 .chain_id = ALC285_FIXUP_HP_GPIO_LED
7937 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08007938 [ALC269_FIXUP_CZC_B20] = {
7939 .type = HDA_FIXUP_PINS,
7940 .v.pins = (const struct hda_pintbl[]) {
7941 { 0x12, 0x411111f0 },
7942 { 0x14, 0x90170110 }, /* speaker */
7943 { 0x15, 0x032f1020 }, /* HP out */
7944 { 0x17, 0x411111f0 },
7945 { 0x18, 0x03ab1040 }, /* mic */
7946 { 0x19, 0xb7a7013f },
7947 { 0x1a, 0x0181305f },
7948 { 0x1b, 0x411111f0 },
7949 { 0x1d, 0x411111f0 },
7950 { 0x1e, 0x411111f0 },
7951 { }
7952 },
7953 .chain_id = ALC269_FIXUP_DMIC,
7954 },
7955 [ALC269_FIXUP_CZC_TMI] = {
7956 .type = HDA_FIXUP_PINS,
7957 .v.pins = (const struct hda_pintbl[]) {
7958 { 0x12, 0x4000c000 },
7959 { 0x14, 0x90170110 }, /* speaker */
7960 { 0x15, 0x0421401f }, /* HP out */
7961 { 0x17, 0x411111f0 },
7962 { 0x18, 0x04a19020 }, /* mic */
7963 { 0x19, 0x411111f0 },
7964 { 0x1a, 0x411111f0 },
7965 { 0x1b, 0x411111f0 },
7966 { 0x1d, 0x40448505 },
7967 { 0x1e, 0x411111f0 },
7968 { 0x20, 0x8000ffff },
7969 { }
7970 },
7971 .chain_id = ALC269_FIXUP_DMIC,
7972 },
7973 [ALC269_FIXUP_CZC_L101] = {
7974 .type = HDA_FIXUP_PINS,
7975 .v.pins = (const struct hda_pintbl[]) {
7976 { 0x12, 0x40000000 },
7977 { 0x14, 0x01014010 }, /* speaker */
7978 { 0x15, 0x411111f0 }, /* HP out */
7979 { 0x16, 0x411111f0 },
7980 { 0x18, 0x01a19020 }, /* mic */
7981 { 0x19, 0x02a19021 },
7982 { 0x1a, 0x0181302f },
7983 { 0x1b, 0x0221401f },
7984 { 0x1c, 0x411111f0 },
7985 { 0x1d, 0x4044c601 },
7986 { 0x1e, 0x411111f0 },
7987 { }
7988 },
7989 .chain_id = ALC269_FIXUP_DMIC,
7990 },
7991 [ALC269_FIXUP_LEMOTE_A1802] = {
7992 .type = HDA_FIXUP_PINS,
7993 .v.pins = (const struct hda_pintbl[]) {
7994 { 0x12, 0x40000000 },
7995 { 0x14, 0x90170110 }, /* speaker */
7996 { 0x17, 0x411111f0 },
7997 { 0x18, 0x03a19040 }, /* mic1 */
7998 { 0x19, 0x90a70130 }, /* mic2 */
7999 { 0x1a, 0x411111f0 },
8000 { 0x1b, 0x411111f0 },
8001 { 0x1d, 0x40489d2d },
8002 { 0x1e, 0x411111f0 },
8003 { 0x20, 0x0003ffff },
8004 { 0x21, 0x03214020 },
8005 { }
8006 },
8007 .chain_id = ALC269_FIXUP_DMIC,
8008 },
8009 [ALC269_FIXUP_LEMOTE_A190X] = {
8010 .type = HDA_FIXUP_PINS,
8011 .v.pins = (const struct hda_pintbl[]) {
8012 { 0x14, 0x99130110 }, /* speaker */
8013 { 0x15, 0x0121401f }, /* HP out */
8014 { 0x18, 0x01a19c20 }, /* rear mic */
8015 { 0x19, 0x99a3092f }, /* front mic */
8016 { 0x1b, 0x0201401f }, /* front lineout */
8017 { }
8018 },
8019 .chain_id = ALC269_FIXUP_DMIC,
8020 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008021 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8022 .type = HDA_FIXUP_PINS,
8023 .v.pins = (const struct hda_pintbl[]) {
8024 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8025 { }
8026 },
8027 .chained = true,
8028 .chain_id = ALC269_FIXUP_HEADSET_MODE
8029 },
Werner Sembach73e71612021-03-02 19:04:14 +01008030 [ALC256_FIXUP_INTEL_NUC10] = {
8031 .type = HDA_FIXUP_PINS,
8032 .v.pins = (const struct hda_pintbl[]) {
8033 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8034 { }
8035 },
8036 .chained = true,
8037 .chain_id = ALC269_FIXUP_HEADSET_MODE
8038 },
Hui Wangfc19d552020-09-09 10:00:41 +08008039 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8040 .type = HDA_FIXUP_VERBS,
8041 .v.verbs = (const struct hda_verb[]) {
8042 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8043 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8044 { }
8045 },
8046 .chained = true,
Takashi Iwaic84bfed2020-11-27 15:11:04 +01008047 .chain_id = ALC289_FIXUP_ASUS_GA502
Hui Wangfc19d552020-09-09 10:00:41 +08008048 },
Hui Wang13468bf2020-09-28 16:01:17 +08008049 [ALC274_FIXUP_HP_MIC] = {
8050 .type = HDA_FIXUP_VERBS,
8051 .v.verbs = (const struct hda_verb[]) {
8052 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8053 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8054 { }
8055 },
8056 },
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008057 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8058 .type = HDA_FIXUP_FUNC,
8059 .v.func = alc274_fixup_hp_headset_mic,
8060 .chained = true,
8061 .chain_id = ALC274_FIXUP_HP_MIC
8062 },
Takashi Iwai622464c2021-05-04 11:18:02 +02008063 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8064 .type = HDA_FIXUP_FUNC,
8065 .v.func = alc274_fixup_hp_envy_gpio,
8066 },
Kailang Yangef9ce662020-11-03 15:40:35 +08008067 [ALC256_FIXUP_ASUS_HPE] = {
8068 .type = HDA_FIXUP_VERBS,
8069 .v.verbs = (const struct hda_verb[]) {
8070 /* Set EAPD high */
8071 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8072 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8073 { }
8074 },
8075 .chained = true,
8076 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8077 },
Kailang Yang446b8182020-11-02 15:00:12 +08008078 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8079 .type = HDA_FIXUP_FUNC,
8080 .v.func = alc_fixup_headset_jack,
8081 .chained = true,
8082 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8083 },
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008084 [ALC287_FIXUP_HP_GPIO_LED] = {
8085 .type = HDA_FIXUP_FUNC,
8086 .v.func = alc287_fixup_hp_gpio_led,
8087 },
Kailang Yang9e885772020-11-03 15:30:51 +08008088 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8089 .type = HDA_FIXUP_FUNC,
8090 .v.func = alc274_fixup_hp_headset_mic,
8091 },
Kailang Yang92666d42020-11-19 17:04:21 +08008092 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8093 .type = HDA_FIXUP_FUNC,
8094 .v.func = alc_fixup_no_int_mic,
8095 .chained = true,
8096 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8097 },
Chris Chiu34cdf402020-12-16 20:52:00 +08008098 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8099 .type = HDA_FIXUP_PINS,
8100 .v.pins = (const struct hda_pintbl[]) {
8101 { 0x1b, 0x411111f0 },
8102 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8103 { },
8104 },
8105 .chained = true,
8106 .chain_id = ALC269_FIXUP_HEADSET_MODE
8107 },
Chris Chiu495dc762021-01-14 16:27:28 +08008108 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8109 .type = HDA_FIXUP_FUNC,
8110 .v.func = alc269_fixup_limit_int_mic_boost,
8111 .chained = true,
8112 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8113 },
Chris Chiud0e18562021-02-26 09:04:40 +08008114 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8115 .type = HDA_FIXUP_PINS,
8116 .v.pins = (const struct hda_pintbl[]) {
8117 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8118 { 0x1a, 0x90a1092f }, /* use as internal mic */
8119 { }
8120 },
8121 .chained = true,
8122 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8123 },
Takashi Iwai26928ca2021-04-16 10:12:11 +02008124 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8125 .type = HDA_FIXUP_FUNC,
8126 .v.func = alc285_fixup_ideapad_s740_coef,
8127 .chained = true,
8128 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8129 },
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008130 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8131 .type = HDA_FIXUP_FUNC,
8132 .v.func = alc269_fixup_limit_int_mic_boost,
8133 .chained = true,
8134 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8135 },
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008136 [ALC295_FIXUP_ASUS_DACS] = {
8137 .type = HDA_FIXUP_FUNC,
8138 .v.func = alc295_fixup_asus_dacs,
8139 },
Takashi Iwai5d84b532021-05-04 14:18:32 +02008140 [ALC295_FIXUP_HP_OMEN] = {
8141 .type = HDA_FIXUP_PINS,
8142 .v.pins = (const struct hda_pintbl[]) {
8143 { 0x12, 0xb7a60130 },
8144 { 0x13, 0x40000000 },
8145 { 0x14, 0x411111f0 },
8146 { 0x16, 0x411111f0 },
8147 { 0x17, 0x90170110 },
8148 { 0x18, 0x411111f0 },
8149 { 0x19, 0x02a11030 },
8150 { 0x1a, 0x411111f0 },
8151 { 0x1b, 0x04a19030 },
8152 { 0x1d, 0x40600001 },
8153 { 0x1e, 0x411111f0 },
8154 { 0x21, 0x03211020 },
8155 {}
8156 },
8157 .chained = true,
8158 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8159 },
Elia Devitof2be77f2021-05-11 14:46:49 +02008160 [ALC285_FIXUP_HP_SPECTRE_X360] = {
Elia Devito434591b2021-06-19 22:41:04 +02008161 .type = HDA_FIXUP_FUNC,
8162 .v.func = alc285_fixup_hp_spectre_x360,
Elia Devitof2be77f2021-05-11 14:46:49 +02008163 },
Hui Wang9ebaef02021-05-22 12:26:45 +08008164 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8165 .type = HDA_FIXUP_FUNC,
8166 .v.func = alc285_fixup_ideapad_s740_coef,
8167 .chained = true,
8168 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8169 },
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008170 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8171 .type = HDA_FIXUP_FUNC,
8172 .v.func = alc_fixup_no_shutup,
8173 .chained = true,
8174 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8175 },
Hui Wang57c9e212021-06-08 10:46:00 +08008176 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8177 .type = HDA_FIXUP_PINS,
8178 .v.pins = (const struct hda_pintbl[]) {
8179 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8180 { }
8181 },
8182 .chained = true,
8183 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8184 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02008185};
8186
8187static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01008188 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02008189 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8190 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008191 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02008192 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008193 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8194 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05008195 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01008196 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02008197 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Takashi Iwai433f8942021-04-28 13:26:56 +02008198 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
Takashi Iwaic8426b22021-04-07 11:57:30 +02008199 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
Chris Chiu13be30f2020-12-22 23:04:59 +08008200 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
Chris Chiu705b65f2018-12-05 14:48:54 +08008201 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008202 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01008203 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiu495dc762021-01-14 16:27:28 +08008204 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
Chris Chiuc7531e32019-03-21 17:17:31 +08008205 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8206 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiu13be30f2020-12-22 23:04:59 +08008207 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8208 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008209 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008210 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008211 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiud0e18562021-02-26 09:04:40 +08008212 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08008213 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8214 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8215 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Chris Chiud0e18562021-02-26 09:04:40 +08008216 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08008217 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08008218 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08008219 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008220 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
Hui Wang57c9e212021-06-08 10:46:00 +08008221 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008222 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08008223 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01008224 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01008225 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02008226 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8227 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008228 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02008229 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8230 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8231 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01008232 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8233 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01008234 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02008235 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008236 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08008237 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8238 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08008239 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02008240 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02008241 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08008242 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08008243 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8244 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01008245 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8246 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8247 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8248 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8249 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08008250 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08008251 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01008252 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08008253 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08008254 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwai493de342017-02-28 17:27:57 +01008255 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008256 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Kailang Yang5f364132017-07-25 16:28:16 +08008257 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08008258 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8259 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08008260 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8261 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08008262 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08008263 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08008264 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08008265 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08008266 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008267 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08008268 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8269 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yang92666d42020-11-19 17:04:21 +08008270 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8271 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
Kailang Yangc1e89522020-12-23 15:34:57 +08008272 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yanga22aa262014-04-23 17:34:28 +08008273 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8274 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01008275 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008276 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01008277 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
Hui Wang7976eb42015-02-13 11:14:41 +08008278 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008279 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008280 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008281 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8282 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8283 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8284 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008285 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8286 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8287 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8288 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008289 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008290 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8291 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8292 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8293 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8294 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008295 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008296 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008297 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08008298 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008299 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8300 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8301 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008302 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8303 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8304 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8305 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8306 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008307 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008308 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008309 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008310 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008311 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08008312 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008313 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008314 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008315 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008316 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8317 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8318 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8319 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8320 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008321 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008322 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8323 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008324 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8325 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8326 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8327 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang8a02b162014-06-13 17:16:31 +08008328 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8329 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8330 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8331 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008332 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8333 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Kailang Yang1c9d9df2021-04-20 14:17:34 +08008334 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8335 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
Takashi Iwai563785e2018-11-12 09:43:12 +01008336 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08008337 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01008338 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Takashi Iwaiaeedad22020-11-28 10:00:15 +01008339 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008340 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8341 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05008342 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Carlos M901be142021-05-31 22:20:26 +02008343 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02008344 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai5d84b532021-05-04 14:18:32 +02008345 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
Sam Bazleyd33cd422019-09-01 03:31:30 +01008346 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Elia Devitof2be77f2021-05-11 14:46:49 +02008347 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
Takashi Iwai0ac05b22021-06-23 14:20:22 +02008348 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008349 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Takashi Iwai622464c2021-05-04 11:18:02 +02008350 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
Jeremy Szu15d295b2021-06-05 16:25:36 +08008351 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szu61d3e872021-06-05 16:25:37 +08008352 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 +08008353 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008354 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008355 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Kailang Yang56496252020-07-29 15:09:27 +08008356 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Qiu Wenbo08befca2020-10-02 20:44:54 +08008357 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08008358 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08008359 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Jeremy Szu91bc1562021-01-06 21:05:46 +08008360 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8361 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8362 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8363 ALC285_FIXUP_HP_GPIO_AMP_INIT),
Manuel Jiménez48422952020-12-29 15:38:56 +01008364 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008365 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szu417eadf2021-03-30 19:44:27 +08008366 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008367 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8368 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008369 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Jeremy Szu53b861b2021-03-16 17:42:35 +08008370 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuc3d2c882021-06-18 01:14:20 +08008371 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szudfb06402021-06-05 16:25:38 +08008372 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuca688332021-03-16 14:54:50 +08008373 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szu50dbfae2021-05-20 01:03:56 +08008374 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 +08008375 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 +08008376 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 +08008377 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 +08008378 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008379 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008380 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02008381 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02008382 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01008383 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008384 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008385 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02008386 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008387 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008388 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiu5cfca592020-12-07 15:27:55 +08008389 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008390 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8391 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008392 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008393 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008394 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01008395 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01008396 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02008397 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008398 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
Chris Chiu48e01502019-12-30 11:11:18 +08008399 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008400 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Daniel Drake8c8967a2019-10-17 16:15:01 +08008401 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08008402 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08008403 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan5de3b942021-01-22 13:47:06 +08008404 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08008405 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08008406 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02008407 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06008408 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02008409 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02008410 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06008411 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008412 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008413 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Kailang Yangef9ce662020-11-03 15:40:35 +08008414 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
Armas Spann4b43d052020-07-24 16:06:16 +02008415 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05008416 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
Luke D Jones76fae612021-04-19 15:04:11 +12008417 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
Armas Spann293a92c2020-07-24 16:08:37 +02008418 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Chris Chiueeed4cd2017-02-28 14:17:15 -06008419 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02008420 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8421 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8422 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8423 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02008424 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008425 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8426 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8427 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02008428 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwaicab561f2021-04-28 13:26:59 +02008429 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8430 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai24519912011-08-16 15:08:49 +02008431 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02008432 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02008433 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01008434 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
Takashi Iwaic656f742021-04-28 13:27:01 +02008435 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
David Henningsson2041d562014-06-13 11:15:44 +02008436 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08008437 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
Takashi Iwaic656f742021-04-28 13:27:01 +02008438 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02008439 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
PeiSen Houce2e79b2020-12-31 11:57:28 +01008440 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8441 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09008442 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02008443 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07008444 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8445 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07008446 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09008447 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01008448 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09008449 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Takashi Iwaic656f742021-04-28 13:27:01 +02008450 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02008451 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8452 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01008453 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Chris Chiu6ca653e2020-12-22 23:04:58 +08008454 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008455 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02008456 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008457 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8458 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8459 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8460 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8461 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8462 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8463 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8464 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8465 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8466 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8467 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8468 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8469 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8470 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8471 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8472 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008473 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008474 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008475 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8476 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008477 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8478 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8479 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8480 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8481 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008482 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8483 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8484 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8485 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008486 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8487 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8488 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8489 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8490 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02008491 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8492 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8493 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8494 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
8495 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008496 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8497 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8498 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8499 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8500 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8501 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8502 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008503 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008504 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8505 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02008506 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8507 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008508 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8509 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8510 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8511 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8512 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8513 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008514 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008515 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008516 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8517 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8518 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8519 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8520 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaif552ff52021-04-28 13:27:00 +02008521 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwaib590b382020-05-14 18:05:33 +02008522 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02008523 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02008524 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02008525 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02008526 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01008527 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02008528 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02008529 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05008530 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02008531 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01008532 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02008533 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01008534 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07008535 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02008536 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008537 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8538 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02008539 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02008540 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008541 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8542 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8543 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01008544 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008545 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8546 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8547 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01008548 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09008549 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02008550 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang Yang446b8182020-11-02 15:00:12 +08008551 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8552 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Kailang3694cb22015-12-28 11:35:24 +08008553 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08008554 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08008555 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02008556 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08008557 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08008558 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08008559 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08008560 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08008561 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8562 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Kailang Yangf86de9b2020-10-23 14:46:47 +08008563 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
Takashi Iwai26928ca2021-04-16 10:12:11 +02008564 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
Hui Wang9ebaef02021-05-22 12:26:45 +08008565 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
David Henningsson56f27012016-01-11 09:33:14 +01008566 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01008567 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02008568 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaif552ff52021-04-28 13:27:00 +02008569 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
David Henningssona4a9e082013-08-16 14:09:01 +02008570 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02008571 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02008572 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008573 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02008574 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01008575 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02008576 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02008577 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08008578 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008579 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02008580 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008581 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008582 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8583 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8584 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008585 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008586 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8587 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008588 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008589 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008590 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8591 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8592 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02008593 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaic656f742021-04-28 13:27:01 +02008594 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8595 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Hui Wangfc19d552020-09-09 10:00:41 +08008596 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Xiaoliang Yub95bc122021-03-16 00:49:00 +08008597 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang695d1ec2019-11-21 10:54:27 +08008598 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Xiaoliang Yue1c86212021-03-13 07:54:53 +08008599 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Phil Calvind1ee66c2021-04-15 18:01:29 -04008600 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008601 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Werner Sembach73e71612021-03-02 19:04:14 +01008602 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008603
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01008604#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02008605 /* Below is a quirk table taken from the old code.
8606 * Basically the device should work as is without the fixup table.
8607 * If BIOS doesn't give a proper info, enable the corresponding
8608 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008609 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02008610 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8611 ALC269_FIXUP_AMIC),
8612 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008613 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8614 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8615 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8616 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8617 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8618 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8619 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8620 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8621 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8622 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8623 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8624 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8625 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8626 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8627 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8628 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8629 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8630 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8631 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8632 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8633 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8634 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8635 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8636 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8637 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8638 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8639 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8640 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8641 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8642 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8643 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8644 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8645 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8646 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8647 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8648 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8649 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8650 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8651#endif
8652 {}
8653};
8654
David Henningsson214eef72014-07-22 14:09:35 +02008655static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8656 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8657 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8658 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8659 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008660 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02008661 {}
8662};
8663
Takashi Iwai1727a772013-01-10 09:52:52 +01008664static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02008665 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8666 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008667 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8668 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8669 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02008670 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02008671 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8672 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02008673 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02008674 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008675 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008676 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02008677 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8678 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008679 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8680 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08008681 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08008682 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02008683 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01008684 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02008685 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02008686 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008687 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008688 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02008689 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008690 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8691 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8692 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8693 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8694 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8695 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8696 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8697 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8698 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8699 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8700 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8701 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8702 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8703 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8704 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8705 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8706 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8707 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8708 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8709 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8710 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8711 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8712 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8713 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8714 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8715 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8716 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8717 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8718 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8719 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8720 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8721 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8722 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8723 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8724 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8725 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8726 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8727 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8728 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8729 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01008730 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008731 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
Takashi Iwaic8426b22021-04-07 11:57:30 +02008732 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008733 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8734 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8735 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8736 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8737 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8738 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8739 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8740 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8741 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8742 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8743 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8744 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8745 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8746 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008747 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8748 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8749 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08008750 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008751 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01008752 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008753 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8754 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8755 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8756 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8757 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8758 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8759 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8760 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8761 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8762 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8763 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8764 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8765 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8766 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8767 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8768 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8769 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08008770 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8771 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008772 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02008773 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008774 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07008775 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08008776 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08008777 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008778 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
Takashi Iwai5d84b532021-05-04 14:18:32 +02008779 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
Elia Devitof2be77f2021-05-11 14:46:49 +02008780 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
Hui Wang9ebaef02021-05-22 12:26:45 +08008781 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008782 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
Hui Wang57c9e212021-06-08 10:46:00 +08008783 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02008784 {}
8785};
Kailang Yangcfc5a842016-02-03 15:20:39 +08008786#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08008787 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02008788
Hui Wange8191a82015-04-24 13:39:59 +08008789#define ALC256_STANDARD_PINS \
8790 {0x12, 0x90a60140}, \
8791 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08008792 {0x21, 0x02211020}
8793
David Henningssonfea185e2014-09-03 10:23:04 +02008794#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008795 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08008796
David Henningssonfea185e2014-09-03 10:23:04 +02008797#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008798 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02008799
8800#define ALC292_STANDARD_PINS \
8801 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08008802 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08008803
Hui Wang3f6409702016-09-11 11:26:16 +08008804#define ALC295_STANDARD_PINS \
8805 {0x12, 0xb7a60130}, \
8806 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08008807 {0x21, 0x04211020}
8808
Woodrow Shen703867e2015-08-05 12:34:12 +08008809#define ALC298_STANDARD_PINS \
8810 {0x12, 0x90a60130}, \
8811 {0x21, 0x03211020}
8812
Hui Wange1918932014-05-26 16:22:44 +08008813static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08008814 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
8815 {0x14, 0x01014020},
8816 {0x17, 0x90170110},
8817 {0x18, 0x02a11030},
8818 {0x19, 0x0181303F},
8819 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06008820 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8821 {0x12, 0x90a601c0},
8822 {0x14, 0x90171120},
8823 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06008824 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8825 {0x14, 0x90170110},
8826 {0x1b, 0x90a70130},
8827 {0x21, 0x03211020}),
8828 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8829 {0x1a, 0x90a70130},
8830 {0x1b, 0x90170110},
8831 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01008832 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008833 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008834 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008835 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01008836 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008837 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008838 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008839 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08008840 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8841 ALC225_STANDARD_PINS,
8842 {0x12, 0xb7a60150},
8843 {0x14, 0x901701a0}),
8844 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8845 ALC225_STANDARD_PINS,
8846 {0x12, 0xb7a60150},
8847 {0x14, 0x901701b0}),
8848 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8849 ALC225_STANDARD_PINS,
8850 {0x12, 0xb7a60130},
8851 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05008852 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8853 {0x1b, 0x01111010},
8854 {0x1e, 0x01451130},
8855 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08008856 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
8857 {0x12, 0x90a60140},
8858 {0x14, 0x90170110},
8859 {0x19, 0x02a11030},
8860 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08008861 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8862 {0x14, 0x90170110},
8863 {0x19, 0x02a11030},
8864 {0x1a, 0x02a11040},
8865 {0x1b, 0x01014020},
8866 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08008867 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8868 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08008869 {0x19, 0x02a11030},
8870 {0x1a, 0x02a11040},
8871 {0x1b, 0x01011020},
8872 {0x21, 0x0221101f}),
8873 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8874 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08008875 {0x19, 0x02a11020},
8876 {0x1a, 0x02a11030},
8877 {0x21, 0x0221101f}),
Kailang Yang92666d42020-11-19 17:04:21 +08008878 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
8879 {0x21, 0x02211010}),
Kailang Yang9e885772020-11-03 15:30:51 +08008880 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8881 {0x14, 0x90170110},
8882 {0x19, 0x02a11020},
8883 {0x21, 0x02211030}),
Hui Wangc77900e2014-09-03 11:31:07 +08008884 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08008885 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08008886 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02008887 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08008888 {0x14, 0x90170130},
8889 {0x21, 0x02211040}),
8890 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008891 {0x12, 0x90a60140},
8892 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02008893 {0x21, 0x02211020}),
8894 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8895 {0x12, 0x90a60160},
8896 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008897 {0x21, 0x02211030}),
8898 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08008899 {0x14, 0x90170110},
8900 {0x1b, 0x02011020},
8901 {0x21, 0x0221101f}),
8902 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08008903 {0x14, 0x90170110},
8904 {0x1b, 0x01011020},
8905 {0x21, 0x0221101f}),
8906 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02008907 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02008908 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02008909 {0x21, 0x0221103f}),
8910 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08008911 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08008912 {0x1b, 0x01011020},
8913 {0x21, 0x0221103f}),
8914 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8915 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08008916 {0x1b, 0x02011020},
8917 {0x21, 0x0221103f}),
8918 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008919 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008920 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008921 {0x21, 0x0221105f}),
8922 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008923 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008924 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008925 {0x21, 0x0221101f}),
8926 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008927 {0x12, 0x90a60160},
8928 {0x14, 0x90170120},
8929 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008930 {0x21, 0x0321102f}),
8931 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8932 {0x12, 0x90a60160},
8933 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008934 {0x21, 0x02211040}),
8935 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8936 {0x12, 0x90a60160},
8937 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008938 {0x21, 0x02211050}),
8939 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8940 {0x12, 0x90a60170},
8941 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008942 {0x21, 0x02211030}),
8943 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8944 {0x12, 0x90a60170},
8945 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008946 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08008947 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08008948 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08008949 {0x14, 0x90171130},
8950 {0x21, 0x02211040}),
8951 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8952 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08008953 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08008954 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02008955 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02008956 {0x12, 0x90a60180},
8957 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02008958 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08008959 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8960 {0x12, 0x90a60180},
8961 {0x14, 0x90170120},
8962 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08008963 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8964 {0x1b, 0x01011020},
8965 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008966 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8967 {0x14, 0x90170110},
8968 {0x1b, 0x90a70130},
8969 {0x21, 0x04211020}),
8970 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8971 {0x14, 0x90170110},
8972 {0x1b, 0x90a70130},
8973 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08008974 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08008975 {0x12, 0x90a60130},
8976 {0x14, 0x90170110},
8977 {0x21, 0x03211020}),
8978 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08008979 {0x12, 0x90a60130},
8980 {0x14, 0x90170110},
8981 {0x21, 0x04211020}),
8982 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08008983 {0x1a, 0x90a70130},
8984 {0x1b, 0x90170110},
8985 {0x21, 0x03211020}),
Kailang Yang9e885772020-11-03 15:30:51 +08008986 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8987 {0x14, 0x90170110},
8988 {0x19, 0x02a11020},
8989 {0x21, 0x0221101f}),
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008990 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
8991 {0x17, 0x90170110},
8992 {0x19, 0x03a11030},
8993 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01008994 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
8995 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01008996 {0x14, 0x90170110},
8997 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008998 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08008999 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9000 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08009001 {0x14, 0x90170110},
9002 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08009003 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08009004 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08009005 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02009006 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009007 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02009008 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02009009 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02009010 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08009011 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009012 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009013 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009014 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08009015 {0x21, 0x03211040}),
9016 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009017 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009018 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009019 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08009020 {0x21, 0x03211020}),
9021 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009022 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009023 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009024 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08009025 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08009026 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02009027 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08009028 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08009029 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08009030 {0x21, 0x04211020}),
Chris Chiu34cdf402020-12-16 20:52:00 +08009031 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9032 ALC282_STANDARD_PINS,
9033 {0x12, 0x90a609c0},
9034 {0x18, 0x03a11830},
9035 {0x19, 0x04a19831},
9036 {0x1a, 0x0481303f},
9037 {0x1b, 0x04211020},
9038 {0x21, 0x0321101f}),
9039 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9040 ALC282_STANDARD_PINS,
9041 {0x12, 0x90a60940},
9042 {0x18, 0x03a11830},
9043 {0x19, 0x04a19831},
9044 {0x1a, 0x0481303f},
9045 {0x1b, 0x04211020},
9046 {0x21, 0x0321101f}),
David Henningsson76c21322014-06-24 14:46:54 +02009047 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009048 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009049 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02009050 {0x21, 0x0321101f}),
9051 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9052 {0x12, 0x90a60160},
9053 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009054 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08009055 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009056 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08009057 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08009058 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08009059 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08009060 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Sami Loone266fd992021-05-01 12:07:53 +02009061 {0x12, 0x90a60130},
9062 {0x14, 0x90170110},
9063 {0x19, 0x04a11040},
9064 {0x21, 0x04211020}),
9065 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9066 {0x14, 0x90170110},
9067 {0x19, 0x04a11040},
9068 {0x1d, 0x40600001},
9069 {0x21, 0x04211020}),
9070 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Hui Wangc4cfcf62018-11-26 14:17:16 +08009071 {0x14, 0x90170110},
9072 {0x19, 0x04a11040},
9073 {0x21, 0x04211020}),
Hui Wangc72b9bf2020-12-05 13:11:30 +08009074 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9075 {0x14, 0x90170110},
9076 {0x17, 0x90170111},
9077 {0x19, 0x03a11030},
9078 {0x21, 0x03211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08009079 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9080 {0x12, 0x90a60130},
9081 {0x17, 0x90170110},
9082 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02009083 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08009084 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08009085 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08009086 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08009087 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009088 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009089 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009090 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08009091 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009092 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009093 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009094 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009095 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08009096 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009097 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009098 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009099 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009100 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009101 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009102 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009103 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009104 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009105 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009106 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009107 {0x14, 0x90170110},
9108 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009109 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009110 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009111 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009112 {0x14, 0x90170110},
9113 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009114 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009115 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009116 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009117 {0x14, 0x90170110},
9118 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009119 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08009120 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009121 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009122 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009123 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08009124 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08009125 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009126 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009127 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009128 {0x16, 0x01014020},
9129 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08009130 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02009131 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009132 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009133 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02009134 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009135 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009136 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02009137 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08009138 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02009139 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009140 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009141 {0x13, 0x90a60140}),
Jian-Hong Paneeacd802020-11-24 17:20:25 +08009142 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9143 {0x17, 0x90170110},
9144 {0x21, 0x04211020}),
Chris Chiud8ae4582018-12-07 17:17:11 +08009145 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9146 {0x14, 0x90170110},
9147 {0x1b, 0x90a70130},
9148 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009149 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9150 {0x12, 0x90a60130},
9151 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08009152 {0x21, 0x03211020}),
9153 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9154 {0x12, 0x90a60130},
9155 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009156 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02009157 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9158 {0x12, 0x90a60130},
9159 {0x17, 0x90170110},
9160 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08009161 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08009162 {0x12, 0x90a60120},
9163 {0x17, 0x90170110},
9164 {0x21, 0x04211030}),
9165 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08009166 {0x12, 0x90a60130},
9167 {0x17, 0x90170110},
9168 {0x21, 0x03211020}),
9169 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9170 {0x12, 0x90a60130},
9171 {0x17, 0x90170110},
9172 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009173 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08009174 {0x14, 0x90170110},
9175 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009176 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9177 {0x14, 0x90170110},
9178 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08009179 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08009180 ALC295_STANDARD_PINS,
9181 {0x17, 0x21014020},
9182 {0x18, 0x21a19030}),
9183 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9184 ALC295_STANDARD_PINS,
9185 {0x17, 0x21014040},
9186 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08009187 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9188 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08009189 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08009190 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009191 {0x17, 0x90170110}),
9192 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9193 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08009194 {0x17, 0x90170140}),
9195 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9196 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009197 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08009198 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9199 {0x12, 0xb7a60140},
9200 {0x13, 0xb7a60150},
9201 {0x17, 0x90170110},
9202 {0x1a, 0x03011020},
9203 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00009204 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9205 {0x12, 0xb7a60140},
9206 {0x17, 0x90170110},
9207 {0x1a, 0x03a11030},
9208 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08009209 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9210 ALC225_STANDARD_PINS,
9211 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08009212 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08009213 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9214 {0x14, 0x01014010},
9215 {0x17, 0x90170120},
9216 {0x18, 0x02a11030},
9217 {0x19, 0x02a1103f},
9218 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08009219 {}
9220};
Takashi Iwai1d045db2011-07-07 18:23:21 +02009221
Hui Wang7c0a6932019-08-16 14:27:40 +08009222/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9223 * more machines, don't need to match all valid pins, just need to match
9224 * all the pins defined in the tbl. Just because of this reason, it is possible
9225 * that a single machine matches multiple tbls, so there is one limitation:
9226 * at most one tbl is allowed to define for the same vendor and same codec
9227 */
9228static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9229 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9230 {0x19, 0x40000000},
9231 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08009232 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9233 {0x19, 0x40000000},
9234 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08009235 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9236 {0x19, 0x40000000},
9237 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08009238 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9239 {0x19, 0x40000000},
9240 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08009241 {}
9242};
9243
Takashi Iwai546bb672012-03-07 08:37:19 +01009244static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02009245{
Kailang Yang526af6e2012-03-07 08:25:20 +01009246 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009247 int val;
9248
Kailang Yang526af6e2012-03-07 08:25:20 +01009249 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01009250 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01009251
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009252 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009253 alc_write_coef_idx(codec, 0xf, 0x960b);
9254 alc_write_coef_idx(codec, 0xe, 0x8817);
9255 }
9256
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009257 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009258 alc_write_coef_idx(codec, 0xf, 0x960b);
9259 alc_write_coef_idx(codec, 0xe, 0x8814);
9260 }
9261
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009262 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009263 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02009264 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009265 }
9266
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009267 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009268 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009269 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009270 /* Capless ramp up clock control */
9271 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9272 }
9273 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009274 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009275 /* Class D power on reset */
9276 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9277 }
9278 }
9279
Takashi Iwai98b24882014-08-18 13:47:50 +02009280 /* HP */
9281 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009282}
9283
9284/*
9285 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009286static int patch_alc269(struct hda_codec *codec)
9287{
9288 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02009289 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009290
Takashi Iwai3de95172012-05-07 18:03:15 +02009291 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009292 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02009293 return err;
9294
9295 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01009296 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08009297 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009298
Takashi Iwai225068a2015-05-29 10:42:14 +02009299#ifdef CONFIG_PM
9300 codec->patch_ops.suspend = alc269_suspend;
9301 codec->patch_ops.resume = alc269_resume;
9302#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08009303 spec->shutup = alc_default_shutup;
9304 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02009305
Takashi Iwai7639a062015-03-03 10:07:24 +01009306 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01009307 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009308 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009309 switch (alc_get_coef0(codec) & 0x00f0) {
9310 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009311 if (codec->bus->pci &&
9312 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009313 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009314 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009315 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009316 break;
9317 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009318 if (codec->bus->pci &&
9319 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009320 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009321 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009322 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009323 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02009324 case 0x0030:
9325 spec->codec_variant = ALC269_TYPE_ALC269VD;
9326 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009327 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009328 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009329 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009330 if (err < 0)
9331 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08009332 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01009333 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009334 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01009335 break;
9336
9337 case 0x10ec0280:
9338 case 0x10ec0290:
9339 spec->codec_variant = ALC269_TYPE_ALC280;
9340 break;
9341 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01009342 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08009343 spec->shutup = alc282_shutup;
9344 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01009345 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02009346 case 0x10ec0233:
9347 case 0x10ec0283:
9348 spec->codec_variant = ALC269_TYPE_ALC283;
9349 spec->shutup = alc283_shutup;
9350 spec->init_hook = alc283_init;
9351 break;
Kailang Yang065380f2013-01-10 10:25:48 +01009352 case 0x10ec0284:
9353 case 0x10ec0292:
9354 spec->codec_variant = ALC269_TYPE_ALC284;
9355 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02009356 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08009357 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02009358 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02009359 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08009360 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02009361 spec->codec_variant = ALC269_TYPE_ALC286;
9362 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08009363 case 0x10ec0298:
9364 spec->codec_variant = ALC269_TYPE_ALC298;
9365 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08009366 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009367 case 0x10ec0255:
9368 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08009369 spec->shutup = alc256_shutup;
9370 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009371 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02009372 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08009373 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08009374 case 0x10ec0256:
9375 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08009376 spec->shutup = alc256_shutup;
9377 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02009378 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08009379 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009380 case 0x10ec0257:
9381 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08009382 spec->shutup = alc256_shutup;
9383 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009384 spec->gen.mixer_nid = 0;
9385 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009386 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +08009387 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009388 case 0x10ec0285:
Kailang Yang630e3612020-05-27 14:10:26 +08009389 case 0x10ec0287:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009390 case 0x10ec0289:
9391 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08009392 spec->shutup = alc225_shutup;
9393 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009394 spec->gen.mixer_nid = 0;
9395 break;
Kailang Yang42314302016-02-03 15:03:50 +08009396 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08009397 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08009398 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08009399 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08009400 spec->shutup = alc225_shutup;
9401 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01009402 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08009403 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009404 case 0x10ec0234:
9405 case 0x10ec0274:
9406 case 0x10ec0294:
9407 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08009408 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08009409 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08009410 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009411 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08009412 case 0x10ec0300:
9413 spec->codec_variant = ALC269_TYPE_ALC300;
9414 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009415 break;
Kailang Yangf0778872019-10-24 15:13:32 +08009416 case 0x10ec0623:
9417 spec->codec_variant = ALC269_TYPE_ALC623;
9418 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08009419 case 0x10ec0700:
9420 case 0x10ec0701:
9421 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +08009422 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +08009423 spec->codec_variant = ALC269_TYPE_ALC700;
9424 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08009425 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08009426 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08009427 break;
9428
Takashi Iwai1d045db2011-07-07 18:23:21 +02009429 }
9430
Kailang Yangad60d502013-06-28 12:03:01 +02009431 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05009432 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02009433 spec->init_hook = alc5505_dsp_init;
9434 }
9435
Takashi Iwaic9af7532019-05-10 11:01:43 +02009436 alc_pre_init(codec);
9437
Takashi Iwaiefe55732018-06-15 11:55:02 +02009438 snd_hda_pick_fixup(codec, alc269_fixup_models,
9439 alc269_fixup_tbl, alc269_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +08009440 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +08009441 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +02009442 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9443 alc269_fixups);
9444 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9445
9446 alc_auto_parse_customize_define(codec);
9447
9448 if (has_cdefine_beep(codec))
9449 spec->gen.beep_nid = 0x01;
9450
Takashi Iwaia4297b52011-08-23 18:40:12 +02009451 /* automatic parse from the BIOS config */
9452 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009453 if (err < 0)
9454 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009455
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009456 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9457 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9458 if (err < 0)
9459 goto error;
9460 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009461
Takashi Iwai1727a772013-01-10 09:52:52 +01009462 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009463
Takashi Iwai1d045db2011-07-07 18:23:21 +02009464 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009465
9466 error:
9467 alc_free(codec);
9468 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009469}
9470
9471/*
9472 * ALC861
9473 */
9474
Takashi Iwai1d045db2011-07-07 18:23:21 +02009475static int alc861_parse_auto_config(struct hda_codec *codec)
9476{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009477 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009478 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9479 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009480}
9481
Takashi Iwai1d045db2011-07-07 18:23:21 +02009482/* Pin config fixes */
9483enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009484 ALC861_FIXUP_FSC_AMILO_PI1505,
9485 ALC861_FIXUP_AMP_VREF_0F,
9486 ALC861_FIXUP_NO_JACK_DETECT,
9487 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009488 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009489};
9490
Takashi Iwai31150f22012-01-30 10:54:08 +01009491/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9492static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009493 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01009494{
9495 struct alc_spec *spec = codec->spec;
9496 unsigned int val;
9497
Takashi Iwai1727a772013-01-10 09:52:52 +01009498 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01009499 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01009500 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01009501 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9502 val |= AC_PINCTL_IN_EN;
9503 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02009504 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01009505 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01009506}
9507
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009508/* suppress the jack-detection */
9509static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009510 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009511{
Takashi Iwai1727a772013-01-10 09:52:52 +01009512 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009513 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009514}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009515
Takashi Iwai1727a772013-01-10 09:52:52 +01009516static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009517 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009518 .type = HDA_FIXUP_PINS,
9519 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009520 { 0x0b, 0x0221101f }, /* HP */
9521 { 0x0f, 0x90170310 }, /* speaker */
9522 { }
9523 }
9524 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009525 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009526 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01009527 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01009528 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009529 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009530 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009531 .v.func = alc_fixup_no_jack_detect,
9532 },
9533 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009534 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009535 .v.func = alc861_fixup_asus_amp_vref_0f,
9536 .chained = true,
9537 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009538 },
9539 [ALC660_FIXUP_ASUS_W7J] = {
9540 .type = HDA_FIXUP_VERBS,
9541 .v.verbs = (const struct hda_verb[]) {
9542 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9543 * for enabling outputs
9544 */
9545 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9546 { }
9547 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009548 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009549};
9550
9551static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009552 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01009553 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009554 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9555 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9556 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
Takashi Iwaidefce242021-04-28 13:27:03 +02009557 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009558 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009559 {}
9560};
9561
9562/*
9563 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009564static int patch_alc861(struct hda_codec *codec)
9565{
9566 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009567 int err;
9568
Takashi Iwai3de95172012-05-07 18:03:15 +02009569 err = alc_alloc_spec(codec, 0x15);
9570 if (err < 0)
9571 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009572
Takashi Iwai3de95172012-05-07 18:03:15 +02009573 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009574 if (has_cdefine_beep(codec))
9575 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009576
Takashi Iwai225068a2015-05-29 10:42:14 +02009577#ifdef CONFIG_PM
9578 spec->power_hook = alc_power_eapd;
9579#endif
9580
Takashi Iwaic9af7532019-05-10 11:01:43 +02009581 alc_pre_init(codec);
9582
Takashi Iwai1727a772013-01-10 09:52:52 +01009583 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9584 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009585
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009586 /* automatic parse from the BIOS config */
9587 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009588 if (err < 0)
9589 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009590
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009591 if (!spec->gen.no_analog) {
9592 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9593 if (err < 0)
9594 goto error;
9595 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009596
Takashi Iwai1727a772013-01-10 09:52:52 +01009597 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009598
Takashi Iwai1d045db2011-07-07 18:23:21 +02009599 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009600
9601 error:
9602 alc_free(codec);
9603 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009604}
9605
9606/*
9607 * ALC861-VD support
9608 *
9609 * Based on ALC882
9610 *
9611 * In addition, an independent DAC
9612 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009613static int alc861vd_parse_auto_config(struct hda_codec *codec)
9614{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009615 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009616 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9617 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009618}
9619
Takashi Iwai1d045db2011-07-07 18:23:21 +02009620enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009621 ALC660VD_FIX_ASUS_GPIO1,
9622 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009623};
9624
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009625/* exclude VREF80 */
9626static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009627 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009628{
Takashi Iwai1727a772013-01-10 09:52:52 +01009629 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01009630 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9631 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009632 }
9633}
9634
Takashi Iwaidf73d832018-06-19 23:05:47 +02009635/* reset GPIO1 */
9636static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9637 const struct hda_fixup *fix, int action)
9638{
9639 struct alc_spec *spec = codec->spec;
9640
9641 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9642 spec->gpio_mask |= 0x02;
9643 alc_fixup_gpio(codec, action, 0x01);
9644}
9645
Takashi Iwai1727a772013-01-10 09:52:52 +01009646static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009647 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +02009648 .type = HDA_FIXUP_FUNC,
9649 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009650 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009651 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009652 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009653 .v.func = alc861vd_fixup_dallas,
9654 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02009655};
9656
9657static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009658 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009659 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009660 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009661 {}
9662};
9663
Takashi Iwai1d045db2011-07-07 18:23:21 +02009664/*
9665 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009666static int patch_alc861vd(struct hda_codec *codec)
9667{
9668 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009669 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009670
Takashi Iwai3de95172012-05-07 18:03:15 +02009671 err = alc_alloc_spec(codec, 0x0b);
9672 if (err < 0)
9673 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009674
Takashi Iwai3de95172012-05-07 18:03:15 +02009675 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009676 if (has_cdefine_beep(codec))
9677 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009678
Takashi Iwai225068a2015-05-29 10:42:14 +02009679 spec->shutup = alc_eapd_shutup;
9680
Takashi Iwaic9af7532019-05-10 11:01:43 +02009681 alc_pre_init(codec);
9682
Takashi Iwai1727a772013-01-10 09:52:52 +01009683 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
9684 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009685
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009686 /* automatic parse from the BIOS config */
9687 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009688 if (err < 0)
9689 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009690
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009691 if (!spec->gen.no_analog) {
9692 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9693 if (err < 0)
9694 goto error;
9695 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009696
Takashi Iwai1727a772013-01-10 09:52:52 +01009697 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009698
Takashi Iwai1d045db2011-07-07 18:23:21 +02009699 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009700
9701 error:
9702 alc_free(codec);
9703 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009704}
9705
9706/*
9707 * ALC662 support
9708 *
9709 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9710 * configuration. Each pin widget can choose any input DACs and a mixer.
9711 * Each ADC is connected from a mixer of all inputs. This makes possible
9712 * 6-channel independent captures.
9713 *
9714 * In addition, an independent DAC for the multi-playback (not used in this
9715 * driver yet).
9716 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009717
9718/*
9719 * BIOS auto configuration
9720 */
9721
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009722static int alc662_parse_auto_config(struct hda_codec *codec)
9723{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02009724 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009725 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9726 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9727 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02009728
Takashi Iwai7639a062015-03-03 10:07:24 +01009729 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9730 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9731 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009732 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01009733 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009734 ssids = alc662_ssids;
9735 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009736}
9737
Todd Broch6be79482010-12-07 16:51:05 -08009738static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009739 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009740{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01009741 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009742 return;
Todd Broch6be79482010-12-07 16:51:05 -08009743 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9744 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9745 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9746 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9747 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01009748 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08009749}
9750
Takashi Iwai8e383952013-10-30 17:41:12 +01009751static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9752 { .channels = 2,
9753 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9754 { .channels = 4,
9755 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9756 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9757 { }
9758};
9759
9760/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009761static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01009762 const struct hda_fixup *fix, int action)
9763{
9764 if (action == HDA_FIXUP_ACT_BUILD) {
9765 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01009766 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01009767 }
9768}
9769
Takashi Iwaibf686652014-01-13 16:18:25 +01009770/* avoid D3 for keeping GPIO up */
9771static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9772 hda_nid_t nid,
9773 unsigned int power_state)
9774{
9775 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02009776 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01009777 return AC_PWRST_D0;
9778 return power_state;
9779}
9780
Takashi Iwai3e887f32014-01-10 17:50:58 +01009781static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9782 const struct hda_fixup *fix, int action)
9783{
9784 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009785
Takashi Iwai01e4a272018-06-19 22:47:30 +02009786 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01009787 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01009788 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01009789 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009790 }
9791}
9792
Kailang Yangc6790c82016-11-25 16:15:17 +08009793static void alc662_usi_automute_hook(struct hda_codec *codec,
9794 struct hda_jack_callback *jack)
9795{
9796 struct alc_spec *spec = codec->spec;
9797 int vref;
9798 msleep(200);
9799 snd_hda_gen_hp_automute(codec, jack);
9800
9801 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
9802 msleep(100);
9803 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9804 vref);
9805}
9806
9807static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
9808 const struct hda_fixup *fix, int action)
9809{
9810 struct alc_spec *spec = codec->spec;
9811 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9812 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9813 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
9814 }
9815}
9816
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009817static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
9818 struct hda_jack_callback *cb)
9819{
9820 /* surround speakers at 0x1b already get muted automatically when
9821 * headphones are plugged in, but we have to mute/unmute the remaining
9822 * channels manually:
9823 * 0x15 - front left/front right
9824 * 0x18 - front center/ LFE
9825 */
9826 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
9827 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
9828 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
9829 } else {
9830 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
9831 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
9832 }
9833}
9834
9835static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
9836 const struct hda_fixup *fix, int action)
9837{
9838 /* Pin 0x1b: shared headphones jack and surround speakers */
9839 if (!is_jack_detectable(codec, 0x1b))
9840 return;
9841
9842 switch (action) {
9843 case HDA_FIXUP_ACT_PRE_PROBE:
9844 snd_hda_jack_detect_enable_callback(codec, 0x1b,
9845 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +01009846 /* subwoofer needs an extra GPIO setting to become audible */
9847 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009848 break;
9849 case HDA_FIXUP_ACT_INIT:
9850 /* Make sure to start in a correct state, i.e. if
9851 * headphones have been plugged in before powering up the system
9852 */
9853 alc662_aspire_ethos_mute_speakers(codec, NULL);
9854 break;
9855 }
9856}
9857
Kailang Yang5af290282020-01-17 14:04:01 +08009858static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
9859 const struct hda_fixup *fix, int action)
9860{
9861 struct alc_spec *spec = codec->spec;
9862
9863 static const struct hda_pintbl pincfgs[] = {
9864 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
9865 { 0x1b, 0x0181304f },
9866 { }
9867 };
9868
9869 switch (action) {
9870 case HDA_FIXUP_ACT_PRE_PROBE:
9871 spec->gen.mixer_nid = 0;
9872 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9873 snd_hda_apply_pincfgs(codec, pincfgs);
9874 break;
9875 case HDA_FIXUP_ACT_INIT:
9876 alc_write_coef_idx(codec, 0x19, 0xa054);
9877 break;
9878 }
9879}
9880
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01009881static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +08009882 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
9883 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
9884 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
9885 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
9886 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
9887 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
9888 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
9889 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
9890 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
9891 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
9892 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
9893 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
9894 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
9895 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
9896 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
9897 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
9898 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
9899 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
9900 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
9901 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
9902 {}
9903};
9904
9905static void alc668_restore_default_value(struct hda_codec *codec)
9906{
9907 alc_process_coef_fw(codec, alc668_coefs);
9908}
9909
David Henningsson6cb3b702010-09-09 08:51:44 +02009910enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04009911 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01009912 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009913 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08009914 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009915 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009916 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02009917 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009918 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02009919 ALC662_FIXUP_ASUS_MODE1,
9920 ALC662_FIXUP_ASUS_MODE2,
9921 ALC662_FIXUP_ASUS_MODE3,
9922 ALC662_FIXUP_ASUS_MODE4,
9923 ALC662_FIXUP_ASUS_MODE5,
9924 ALC662_FIXUP_ASUS_MODE6,
9925 ALC662_FIXUP_ASUS_MODE7,
9926 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009927 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02009928 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02009929 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009930 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02009931 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009932 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02009933 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009934 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01009935 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009936 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009937 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08009938 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009939 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009940 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009941 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009942 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009943 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009944 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +02009945 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009946 ALC891_FIXUP_HEADSET_MODE,
9947 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009948 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009949 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08009950 ALC662_FIXUP_USI_FUNC,
9951 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08009952 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009953 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009954 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +08009955 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +08009956 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +08009957 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
David Henningsson6cb3b702010-09-09 08:51:44 +02009958};
9959
Takashi Iwai1727a772013-01-10 09:52:52 +01009960static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04009961 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009962 .type = HDA_FIXUP_PINS,
9963 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04009964 { 0x15, 0x99130112 }, /* subwoofer */
9965 { }
9966 }
9967 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01009968 [ALC662_FIXUP_LED_GPIO1] = {
9969 .type = HDA_FIXUP_FUNC,
9970 .v.func = alc662_fixup_led_gpio1,
9971 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009972 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009973 .type = HDA_FIXUP_PINS,
9974 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02009975 { 0x17, 0x99130112 }, /* subwoofer */
9976 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01009977 },
9978 .chained = true,
9979 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009980 },
Todd Broch6be79482010-12-07 16:51:05 -08009981 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009982 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01009983 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009984 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009985 [ALC662_FIXUP_CZC_ET26] = {
9986 .type = HDA_FIXUP_PINS,
9987 .v.pins = (const struct hda_pintbl[]) {
9988 {0x12, 0x403cc000},
9989 {0x14, 0x90170110}, /* speaker */
9990 {0x15, 0x411111f0},
9991 {0x16, 0x411111f0},
9992 {0x18, 0x01a19030}, /* mic */
9993 {0x19, 0x90a7013f}, /* int-mic */
9994 {0x1a, 0x01014020},
9995 {0x1b, 0x0121401f},
9996 {0x1c, 0x411111f0},
9997 {0x1d, 0x411111f0},
9998 {0x1e, 0x40478e35},
9999 {}
10000 },
10001 .chained = true,
10002 .chain_id = ALC662_FIXUP_SKU_IGNORE
10003 },
Anisse Astierd2ebd472011-01-20 12:36:21 +010010004 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010005 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010006 .v.verbs = (const struct hda_verb[]) {
10007 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10008 {}
10009 }
10010 },
David Henningsson94024cd2011-04-29 14:10:55 +020010011 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010012 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +020010013 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +020010014 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010015 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010016 .type = HDA_FIXUP_PINS,
10017 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010018 { 0x14, 0x0221201f }, /* HP out */
10019 { }
10020 },
10021 .chained = true,
10022 .chain_id = ALC662_FIXUP_SKU_IGNORE
10023 },
Takashi Iwai53c334a2011-08-23 18:27:14 +020010024 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010025 .type = HDA_FIXUP_PINS,
10026 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010027 { 0x14, 0x99130110 }, /* speaker */
10028 { 0x18, 0x01a19c20 }, /* mic */
10029 { 0x19, 0x99a3092f }, /* int-mic */
10030 { 0x21, 0x0121401f }, /* HP out */
10031 { }
10032 },
10033 .chained = true,
10034 .chain_id = ALC662_FIXUP_SKU_IGNORE
10035 },
10036 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010037 .type = HDA_FIXUP_PINS,
10038 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010039 { 0x14, 0x99130110 }, /* speaker */
10040 { 0x18, 0x01a19820 }, /* mic */
10041 { 0x19, 0x99a3092f }, /* int-mic */
10042 { 0x1b, 0x0121401f }, /* HP out */
10043 { }
10044 },
Takashi Iwai53c334a2011-08-23 18:27:14 +020010045 .chained = true,
10046 .chain_id = ALC662_FIXUP_SKU_IGNORE
10047 },
10048 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010049 .type = HDA_FIXUP_PINS,
10050 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010051 { 0x14, 0x99130110 }, /* speaker */
10052 { 0x15, 0x0121441f }, /* HP */
10053 { 0x18, 0x01a19840 }, /* mic */
10054 { 0x19, 0x99a3094f }, /* int-mic */
10055 { 0x21, 0x01211420 }, /* HP2 */
10056 { }
10057 },
10058 .chained = true,
10059 .chain_id = ALC662_FIXUP_SKU_IGNORE
10060 },
10061 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010062 .type = HDA_FIXUP_PINS,
10063 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010064 { 0x14, 0x99130110 }, /* speaker */
10065 { 0x16, 0x99130111 }, /* speaker */
10066 { 0x18, 0x01a19840 }, /* mic */
10067 { 0x19, 0x99a3094f }, /* int-mic */
10068 { 0x21, 0x0121441f }, /* HP */
10069 { }
10070 },
10071 .chained = true,
10072 .chain_id = ALC662_FIXUP_SKU_IGNORE
10073 },
10074 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010075 .type = HDA_FIXUP_PINS,
10076 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010077 { 0x14, 0x99130110 }, /* speaker */
10078 { 0x15, 0x0121441f }, /* HP */
10079 { 0x16, 0x99130111 }, /* speaker */
10080 { 0x18, 0x01a19840 }, /* mic */
10081 { 0x19, 0x99a3094f }, /* int-mic */
10082 { }
10083 },
10084 .chained = true,
10085 .chain_id = ALC662_FIXUP_SKU_IGNORE
10086 },
10087 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010088 .type = HDA_FIXUP_PINS,
10089 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010090 { 0x14, 0x99130110 }, /* speaker */
10091 { 0x15, 0x01211420 }, /* HP2 */
10092 { 0x18, 0x01a19840 }, /* mic */
10093 { 0x19, 0x99a3094f }, /* int-mic */
10094 { 0x1b, 0x0121441f }, /* HP */
10095 { }
10096 },
10097 .chained = true,
10098 .chain_id = ALC662_FIXUP_SKU_IGNORE
10099 },
10100 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010101 .type = HDA_FIXUP_PINS,
10102 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010103 { 0x14, 0x99130110 }, /* speaker */
10104 { 0x17, 0x99130111 }, /* speaker */
10105 { 0x18, 0x01a19840 }, /* mic */
10106 { 0x19, 0x99a3094f }, /* int-mic */
10107 { 0x1b, 0x01214020 }, /* HP */
10108 { 0x21, 0x0121401f }, /* HP */
10109 { }
10110 },
10111 .chained = true,
10112 .chain_id = ALC662_FIXUP_SKU_IGNORE
10113 },
10114 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010115 .type = HDA_FIXUP_PINS,
10116 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010117 { 0x14, 0x99130110 }, /* speaker */
10118 { 0x12, 0x99a30970 }, /* int-mic */
10119 { 0x15, 0x01214020 }, /* HP */
10120 { 0x17, 0x99130111 }, /* speaker */
10121 { 0x18, 0x01a19840 }, /* mic */
10122 { 0x21, 0x0121401f }, /* HP */
10123 { }
10124 },
10125 .chained = true,
10126 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010127 },
Takashi Iwai1565cc32012-02-13 12:03:25 +010010128 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010129 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +010010130 .v.func = alc_fixup_no_jack_detect,
10131 },
David Henningssonedfe3bf2012-06-12 13:15:12 +020010132 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010133 .type = HDA_FIXUP_PINS,
10134 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +020010135 { 0x1b, 0x02214020 }, /* Front HP */
10136 { }
10137 }
10138 },
Takashi Iwai125821a2012-06-22 14:30:29 +020010139 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010140 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +020010141 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +020010142 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010143 [ALC668_FIXUP_DELL_XPS13] = {
10144 .type = HDA_FIXUP_FUNC,
10145 .v.func = alc_fixup_dell_xps13,
10146 .chained = true,
10147 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10148 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +020010149 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10150 .type = HDA_FIXUP_FUNC,
10151 .v.func = alc_fixup_disable_aamix,
10152 .chained = true,
10153 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10154 },
Hui Wang493a52a2014-01-14 14:07:36 +080010155 [ALC668_FIXUP_AUTO_MUTE] = {
10156 .type = HDA_FIXUP_FUNC,
10157 .v.func = alc_fixup_auto_mute_via_amp,
10158 .chained = true,
10159 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10160 },
David Henningsson1f8b46c2015-05-12 14:38:15 +020010161 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10162 .type = HDA_FIXUP_PINS,
10163 .v.pins = (const struct hda_pintbl[]) {
10164 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10165 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10166 { }
10167 },
10168 .chained = true,
10169 .chain_id = ALC662_FIXUP_HEADSET_MODE
10170 },
10171 [ALC662_FIXUP_HEADSET_MODE] = {
10172 .type = HDA_FIXUP_FUNC,
10173 .v.func = alc_fixup_headset_mode_alc662,
10174 },
David Henningsson73bdd592013-04-15 15:44:14 +020010175 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10176 .type = HDA_FIXUP_PINS,
10177 .v.pins = (const struct hda_pintbl[]) {
10178 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10179 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10180 { }
10181 },
10182 .chained = true,
10183 .chain_id = ALC668_FIXUP_HEADSET_MODE
10184 },
10185 [ALC668_FIXUP_HEADSET_MODE] = {
10186 .type = HDA_FIXUP_FUNC,
10187 .v.func = alc_fixup_headset_mode_alc668,
10188 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010189 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +010010190 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010191 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +010010192 .chained = true,
10193 .chain_id = ALC662_FIXUP_ASUS_MODE4
10194 },
David Henningsson61a75f12014-02-07 09:31:08 +010010195 [ALC662_FIXUP_BASS_16] = {
10196 .type = HDA_FIXUP_PINS,
10197 .v.pins = (const struct hda_pintbl[]) {
10198 {0x16, 0x80106111}, /* bass speaker */
10199 {}
10200 },
10201 .chained = true,
10202 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10203 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010204 [ALC662_FIXUP_BASS_1A] = {
10205 .type = HDA_FIXUP_PINS,
10206 .v.pins = (const struct hda_pintbl[]) {
10207 {0x1a, 0x80106111}, /* bass speaker */
10208 {}
10209 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010210 .chained = true,
10211 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010212 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010213 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010214 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010215 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010216 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010217 [ALC662_FIXUP_ASUS_Nx50] = {
10218 .type = HDA_FIXUP_FUNC,
10219 .v.func = alc_fixup_auto_mute_via_amp,
10220 .chained = true,
10221 .chain_id = ALC662_FIXUP_BASS_1A
10222 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010223 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10224 .type = HDA_FIXUP_FUNC,
10225 .v.func = alc_fixup_headset_mode_alc668,
10226 .chain_id = ALC662_FIXUP_BASS_CHMAP
10227 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010228 [ALC668_FIXUP_ASUS_Nx51] = {
10229 .type = HDA_FIXUP_PINS,
10230 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010231 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10232 { 0x1a, 0x90170151 }, /* bass speaker */
10233 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010234 {}
10235 },
10236 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010237 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010238 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010239 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +020010240 .type = HDA_FIXUP_VERBS,
10241 .v.verbs = (const struct hda_verb[]) {
10242 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10243 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10244 {}
10245 },
10246 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010247 [ALC668_FIXUP_ASUS_G751] = {
10248 .type = HDA_FIXUP_PINS,
10249 .v.pins = (const struct hda_pintbl[]) {
10250 { 0x16, 0x0421101f }, /* HP */
10251 {}
10252 },
10253 .chained = true,
10254 .chain_id = ALC668_FIXUP_MIC_COEF
10255 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010256 [ALC891_FIXUP_HEADSET_MODE] = {
10257 .type = HDA_FIXUP_FUNC,
10258 .v.func = alc_fixup_headset_mode,
10259 },
10260 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10261 .type = HDA_FIXUP_PINS,
10262 .v.pins = (const struct hda_pintbl[]) {
10263 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10264 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10265 { }
10266 },
10267 .chained = true,
10268 .chain_id = ALC891_FIXUP_HEADSET_MODE
10269 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010270 [ALC662_FIXUP_ACER_VERITON] = {
10271 .type = HDA_FIXUP_PINS,
10272 .v.pins = (const struct hda_pintbl[]) {
10273 { 0x15, 0x50170120 }, /* no internal speaker */
10274 { }
10275 }
10276 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010277 [ALC892_FIXUP_ASROCK_MOBO] = {
10278 .type = HDA_FIXUP_PINS,
10279 .v.pins = (const struct hda_pintbl[]) {
10280 { 0x15, 0x40f000f0 }, /* disabled */
10281 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010282 { }
10283 }
10284 },
Kailang Yangc6790c82016-11-25 16:15:17 +080010285 [ALC662_FIXUP_USI_FUNC] = {
10286 .type = HDA_FIXUP_FUNC,
10287 .v.func = alc662_fixup_usi_headset_mic,
10288 },
10289 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10290 .type = HDA_FIXUP_PINS,
10291 .v.pins = (const struct hda_pintbl[]) {
10292 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10293 { 0x18, 0x01a1903d },
10294 { }
10295 },
10296 .chained = true,
10297 .chain_id = ALC662_FIXUP_USI_FUNC
10298 },
Kailang Yangca169cc2017-04-25 16:17:40 +080010299 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10300 .type = HDA_FIXUP_FUNC,
10301 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10302 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010303 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10304 .type = HDA_FIXUP_FUNC,
10305 .v.func = alc662_fixup_aspire_ethos_hp,
10306 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010307 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10308 .type = HDA_FIXUP_PINS,
10309 .v.pins = (const struct hda_pintbl[]) {
10310 { 0x15, 0x92130110 }, /* front speakers */
10311 { 0x18, 0x99130111 }, /* center/subwoofer */
10312 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10313 { }
10314 },
10315 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +010010316 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010317 },
Kailang Yang5af290282020-01-17 14:04:01 +080010318 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10319 .type = HDA_FIXUP_FUNC,
10320 .v.func = alc671_fixup_hp_headset_mic2,
10321 },
Jian-Hong Pand858c702020-03-17 16:28:07 +080010322 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10323 .type = HDA_FIXUP_PINS,
10324 .v.pins = (const struct hda_pintbl[]) {
10325 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10326 { }
10327 },
10328 .chained = true,
10329 .chain_id = ALC662_FIXUP_USI_FUNC
10330 },
Jian-Hong Pana1244582020-03-17 16:28:09 +080010331 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10332 .type = HDA_FIXUP_PINS,
10333 .v.pins = (const struct hda_pintbl[]) {
10334 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10335 { 0x1b, 0x0221144f },
10336 { }
10337 },
10338 .chained = true,
10339 .chain_id = ALC662_FIXUP_USI_FUNC
10340 },
David Henningsson6cb3b702010-09-09 08:51:44 +020010341};
10342
Takashi Iwaia9111322011-05-02 11:30:18 +020010343static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010344 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +020010345 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +010010346 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +010010347 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +020010348 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +020010349 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +020010350 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -040010351 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Takashi Iwai9edeb112021-04-28 13:27:02 +020010352 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Jian-Hong Pana1244582020-03-17 16:28:09 +080010353 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +080010354 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +020010355 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10356 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +020010357 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010358 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +020010359 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +010010360 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +010010361 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +080010362 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10363 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +080010364 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010365 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Jeremy Szu148ebf542020-10-08 18:56:44 +080010366 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Kaho Ng2da2dc92016-05-09 00:27:49 +080010367 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +020010368 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010369 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +020010370 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
Takashi Iwai9edeb112021-04-28 13:27:02 +020010371 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010372 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +010010373 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010374 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10375 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +010010376 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +010010377 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010378 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +010010379 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010380 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -050010381 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +080010382 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +080010383 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +060010384 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +020010385 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010386 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +020010387 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010388 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010389 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +010010390 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010391
10392#if 0
10393 /* Below is a quirk table taken from the old code.
10394 * Basically the device should work as is without the fixup table.
10395 * If BIOS doesn't give a proper info, enable the corresponding
10396 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +020010397 */
Takashi Iwai53c334a2011-08-23 18:27:14 +020010398 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10399 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10400 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10401 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10402 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10403 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10404 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10405 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10406 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10407 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10408 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10409 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10410 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10411 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10412 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10413 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10414 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10415 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10416 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10417 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10418 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10419 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10420 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10421 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10422 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10423 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10424 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10425 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10426 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10427 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10428 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10429 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10430 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10431 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10432 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10433 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10434 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10435 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10436 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10437 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10438 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10439 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10440 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10441 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10442 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10443 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10444 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10445 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10446 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10447 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10448#endif
David Henningsson6cb3b702010-09-09 08:51:44 +020010449 {}
10450};
10451
Takashi Iwai1727a772013-01-10 09:52:52 +010010452static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010453 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10454 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -080010455 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010456 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +020010457 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10458 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10459 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10460 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10461 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10462 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10463 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10464 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010465 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +020010466 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010467 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +020010468 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010469 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10470 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10471 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10472 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10473 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10474 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10475 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10476 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +020010477 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010478 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10479 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10480 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10481 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10482 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +020010483 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010484 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -080010485 {}
10486};
David Henningsson6cb3b702010-09-09 08:51:44 +020010487
Hui Wang532895c2014-05-29 15:59:19 +080010488static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010489 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10490 {0x17, 0x02211010},
10491 {0x18, 0x01a19030},
10492 {0x1a, 0x01813040},
10493 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +080010494 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10495 {0x16, 0x01813030},
10496 {0x17, 0x02211010},
10497 {0x18, 0x01a19040},
10498 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +020010499 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010500 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010501 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010502 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +080010503 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +020010504 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10505 {0x12, 0x99a30130},
10506 {0x14, 0x90170110},
10507 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010508 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010509 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10510 {0x12, 0x99a30140},
10511 {0x14, 0x90170110},
10512 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010513 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010514 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10515 {0x12, 0x99a30150},
10516 {0x14, 0x90170110},
10517 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010518 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010519 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +020010520 {0x14, 0x90170110},
10521 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010522 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010523 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10524 {0x12, 0x90a60130},
10525 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +080010526 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +080010527 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10528 {0x14, 0x01014010},
10529 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +080010530 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +080010531 {0x1b, 0x01813030},
10532 {0x21, 0x02211020}),
10533 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10534 {0x14, 0x01014010},
10535 {0x18, 0x01a19040},
10536 {0x1b, 0x01813030},
10537 {0x21, 0x02211020}),
10538 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10539 {0x14, 0x01014020},
10540 {0x17, 0x90170110},
10541 {0x18, 0x01a19050},
10542 {0x1b, 0x01813040},
10543 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +080010544 {}
10545};
10546
Takashi Iwai1d045db2011-07-07 18:23:21 +020010547/*
10548 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010549static int patch_alc662(struct hda_codec *codec)
10550{
10551 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +020010552 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010553
Takashi Iwai3de95172012-05-07 18:03:15 +020010554 err = alc_alloc_spec(codec, 0x0b);
10555 if (err < 0)
10556 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010557
Takashi Iwai3de95172012-05-07 18:03:15 +020010558 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010559
Takashi Iwai225068a2015-05-29 10:42:14 +020010560 spec->shutup = alc_eapd_shutup;
10561
Takashi Iwai53c334a2011-08-23 18:27:14 +020010562 /* handle multiple HPs as is */
10563 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10564
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +020010565 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10566
Takashi Iwai7639a062015-03-03 10:07:24 +010010567 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +080010568 case 0x10ec0668:
10569 spec->init_hook = alc668_restore_default_value;
10570 break;
Kailang Yangf3f91852014-10-24 15:43:46 +080010571 }
Kailang Yang8663ff72012-06-29 09:35:52 +020010572
Takashi Iwaic9af7532019-05-10 11:01:43 +020010573 alc_pre_init(codec);
10574
Takashi Iwai1727a772013-01-10 09:52:52 +010010575 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010576 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +080010577 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +010010578 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010579
10580 alc_auto_parse_customize_define(codec);
10581
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010582 if (has_cdefine_beep(codec))
10583 spec->gen.beep_nid = 0x01;
10584
Takashi Iwai1bb7e432011-10-17 16:50:59 +020010585 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +010010586 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010587 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +080010588 err = alc_codec_rename(codec, "ALC272X");
10589 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010590 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +020010591 }
Kailang Yang274693f2009-12-03 10:07:50 +010010592
Takashi Iwaib9c51062011-08-24 18:08:07 +020010593 /* automatic parse from the BIOS config */
10594 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010595 if (err < 0)
10596 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010597
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010598 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +010010599 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +010010600 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010601 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010602 break;
10603 case 0x10ec0272:
10604 case 0x10ec0663:
10605 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +080010606 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010607 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010608 break;
10609 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010610 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010611 break;
10612 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010613 if (err < 0)
10614 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +010010615 }
Takashi Iwai2134ea42008-01-10 16:53:55 +010010616
Takashi Iwai1727a772013-01-10 09:52:52 +010010617 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010618
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010619 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010620
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010621 error:
10622 alc_free(codec);
10623 return err;
Kailang Yangb478b992011-05-18 11:51:15 +020010624}
10625
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010626/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010627 * ALC680 support
10628 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010629
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010630static int alc680_parse_auto_config(struct hda_codec *codec)
10631{
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010632 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010633}
10634
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010635/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010636 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010637static int patch_alc680(struct hda_codec *codec)
10638{
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010639 int err;
10640
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010641 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +020010642 err = alc_alloc_spec(codec, 0);
10643 if (err < 0)
10644 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010645
Takashi Iwai1ebec5f2011-08-15 13:21:48 +020010646 /* automatic parse from the BIOS config */
10647 err = alc680_parse_auto_config(codec);
10648 if (err < 0) {
10649 alc_free(codec);
10650 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010651 }
10652
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010653 return 0;
10654}
10655
10656/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070010657 * patch entries
10658 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010659static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +080010660 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010661 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +080010662 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +080010663 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwai1948fc02021-06-18 18:17:20 +020010664 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010665 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
10666 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010667 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010668 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +080010669 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +080010670 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010671 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
10672 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +080010673 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010674 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
10675 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
10676 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
10677 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
10678 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
10679 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
10680 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010681 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010682 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
10683 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
10684 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
10685 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
10686 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
10687 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010688 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010689 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080010690 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010691 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010692 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010693 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10694 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10695 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010696 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080010697 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010698 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080010699 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080010700 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080010701 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010702 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10703 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10704 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10705 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10706 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10707 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10708 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10709 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10710 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10711 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10712 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10713 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10714 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10715 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080010716 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10717 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10718 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080010719 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010720 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010721 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10722 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10723 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10724 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10725 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10726 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10727 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10728 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10729 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10730 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10731 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
Kailang Yange5782a52020-11-27 14:39:23 +080010732 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010733 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10734 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080010735 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080010736 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080010737 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070010738 {} /* terminator */
10739};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010740MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010741
10742MODULE_LICENSE("GPL");
10743MODULE_DESCRIPTION("Realtek HD-audio codec");
10744
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010745static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010746 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010747};
10748
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010749module_hda_codec_driver(realtek_driver);