blob: 58946d069ee59e068bf8990fdbe3a9cab59632e8 [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{
295 if (action == HDA_FIXUP_ACT_PROBE)
296 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:
Kailang Yang394c97f2014-11-12 17:38:08 +0800388 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800389 case 0x10ec0235:
Thomas Hebbc4473742020-03-30 12:09:38 -0400390 case 0x10ec0236:
Kailang Yang7fbdcd82020-04-23 14:18:31 +0800391 case 0x10ec0245:
Kailang Yang394c97f2014-11-12 17:38:08 +0800392 case 0x10ec0255:
Thomas Hebbc4473742020-03-30 12:09:38 -0400393 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800394 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800395 case 0x10ec0282:
396 case 0x10ec0283:
397 case 0x10ec0286:
Kailang Yang630e3612020-05-27 14:10:26 +0800398 case 0x10ec0287:
Kailang Yang394c97f2014-11-12 17:38:08 +0800399 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;
Kailang Yang394c97f2014-11-12 17:38:08 +0800409 case 0x10ec0293:
410 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
411 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800412 case 0x10ec0234:
413 case 0x10ec0274:
414 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800415 case 0x10ec0700:
416 case 0x10ec0701:
417 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +0800418 case 0x10ec0711:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800419 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
420 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800421 case 0x10ec0662:
422 if ((coef & 0x00f0) == 0x0030)
423 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
424 break;
425 case 0x10ec0272:
426 case 0x10ec0273:
427 case 0x10ec0663:
428 case 0x10ec0665:
429 case 0x10ec0670:
430 case 0x10ec0671:
431 case 0x10ec0672:
432 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
433 break;
Kailang Yang9194a1e2020-01-07 17:22:19 +0800434 case 0x10ec0222:
Kailang Yangf0778872019-10-24 15:13:32 +0800435 case 0x10ec0623:
436 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
437 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800438 case 0x10ec0668:
439 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
440 break;
441 case 0x10ec0867:
442 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
443 break;
444 case 0x10ec0888:
445 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
446 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
447 break;
448 case 0x10ec0892:
Kailang Yange5782a52020-11-27 14:39:23 +0800449 case 0x10ec0897:
Kailang Yang394c97f2014-11-12 17:38:08 +0800450 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
451 break;
452 case 0x10ec0899:
453 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +0800454 case 0x10ec0b00:
Kailang Yang65553b12017-07-11 15:15:47 +0800455 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800456 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800457 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
458 break;
459 }
460}
461
Kailang Yangf9423e72008-05-27 12:32:25 +0200462/* additional initialization for ALC888 variants */
463static void alc888_coef_init(struct hda_codec *codec)
464{
Kailang Yang1df88742014-10-29 16:10:13 +0800465 switch (alc_get_coef0(codec) & 0x00f0) {
466 /* alc888-VA */
467 case 0x00:
468 /* alc888-VB */
469 case 0x10:
470 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
471 break;
472 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200473}
474
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100475/* turn on/off EAPD control (only if available) */
476static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
477{
478 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
479 return;
480 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
481 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
482 on ? 2 : 0);
483}
484
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200485/* turn on/off EAPD controls of the codec */
486static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
487{
488 /* We currently only handle front, HP */
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100489 static const hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800490 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200491 };
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100492 const hda_nid_t *p;
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200493 for (p = pins; *p; p++)
494 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200495}
496
Kailang Yangdad31972019-05-10 16:28:57 +0800497static int find_ext_mic_pin(struct hda_codec *codec);
498
499static void alc_headset_mic_no_shutup(struct hda_codec *codec)
500{
501 const struct hda_pincfg *pin;
502 int mic_pin = find_ext_mic_pin(codec);
503 int i;
504
505 /* don't shut up pins when unloading the driver; otherwise it breaks
506 * the default pin setup at the next load of the driver
507 */
508 if (codec->bus->shutdown)
509 return;
510
511 snd_array_for_each(&codec->init_pins, i, pin) {
512 /* use read here for syncing after issuing each verb */
513 if (pin->nid != mic_pin)
514 snd_hda_codec_read(codec, pin->nid, 0,
515 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
516 }
517
518 codec->pins_shutup = 1;
519}
520
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100521static void alc_shutup_pins(struct hda_codec *codec)
522{
523 struct alc_spec *spec = codec->spec;
524
Kailang Yangdad31972019-05-10 16:28:57 +0800525 switch (codec->core.vendor_id) {
Kailang Yang66c5d712019-12-09 15:56:15 +0800526 case 0x10ec0283:
Kailang Yangdad31972019-05-10 16:28:57 +0800527 case 0x10ec0286:
528 case 0x10ec0288:
529 case 0x10ec0298:
530 alc_headset_mic_no_shutup(codec);
531 break;
532 default:
533 if (!spec->no_shutup_pins)
534 snd_hda_shutup_pins(codec);
535 break;
536 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100537}
538
Takashi Iwai1c7161532011-04-07 10:37:16 +0200539/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100540 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200541 */
542static void alc_eapd_shutup(struct hda_codec *codec)
543{
Kailang Yang97a26572013-11-29 00:35:26 -0500544 struct alc_spec *spec = codec->spec;
545
Takashi Iwai1c7161532011-04-07 10:37:16 +0200546 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500547 if (!spec->no_depop_delay)
548 msleep(200);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100549 alc_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200550}
551
Takashi Iwai1d045db2011-07-07 18:23:21 +0200552/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200553static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200554{
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200555 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200556 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200557 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200558 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100559 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200560 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200561 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200562 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200563 case 0x10ec0880:
564 case 0x10ec0882:
565 case 0x10ec0883:
566 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800567 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200568 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200569 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200570 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200571 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200572 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200573 break;
574 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200575}
Kailang Yangea1fb292008-08-26 12:58:38 +0200576
Takashi Iwai35a39f92019-02-01 11:19:50 +0100577/* get a primary headphone pin if available */
578static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
579{
580 if (spec->gen.autocfg.hp_pins[0])
581 return spec->gen.autocfg.hp_pins[0];
582 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
583 return spec->gen.autocfg.line_out_pins[0];
584 return 0;
585}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200586
587/*
588 * Realtek SSID verification
589 */
590
David Henningsson90622912010-10-14 14:50:18 +0200591/* Could be any non-zero and even value. When used as fixup, tells
592 * the driver to ignore any present sku defines.
593 */
594#define ALC_FIXUP_SKU_IGNORE (2)
595
Takashi Iwai23d30f22012-05-07 17:17:32 +0200596static void alc_fixup_sku_ignore(struct hda_codec *codec,
597 const struct hda_fixup *fix, int action)
598{
599 struct alc_spec *spec = codec->spec;
600 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
601 spec->cdefine.fixup = 1;
602 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
603 }
604}
605
Mengdong Linb5c66112013-11-29 00:35:35 -0500606static void alc_fixup_no_depop_delay(struct hda_codec *codec,
607 const struct hda_fixup *fix, int action)
608{
609 struct alc_spec *spec = codec->spec;
610
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500611 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500612 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500613 codec->depop_delay = 0;
614 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500615}
616
Kailang Yangda00c242010-03-19 11:23:45 +0100617static int alc_auto_parse_customize_define(struct hda_codec *codec)
618{
619 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100620 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100621 struct alc_spec *spec = codec->spec;
622
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200623 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
624
David Henningsson90622912010-10-14 14:50:18 +0200625 if (spec->cdefine.fixup) {
626 ass = spec->cdefine.sku_cfg;
627 if (ass == ALC_FIXUP_SKU_IGNORE)
628 return -1;
629 goto do_sku;
630 }
631
Takashi Iwai5100cd02014-02-15 10:03:19 +0100632 if (!codec->bus->pci)
633 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100634 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200635 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100636 goto do_sku;
637
638 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100639 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100640 nid = 0x17;
641 ass = snd_hda_codec_get_pincfg(codec, nid);
642
643 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100644 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100645 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100646 return -1;
647 }
648
649 /* check sum */
650 tmp = 0;
651 for (i = 1; i < 16; i++) {
652 if ((ass >> i) & 1)
653 tmp++;
654 }
655 if (((ass >> 16) & 0xf) != tmp)
656 return -1;
657
658 spec->cdefine.port_connectivity = ass >> 30;
659 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
660 spec->cdefine.check_sum = (ass >> 16) & 0xf;
661 spec->cdefine.customization = ass >> 8;
662do_sku:
663 spec->cdefine.sku_cfg = ass;
664 spec->cdefine.external_amp = (ass & 0x38) >> 3;
665 spec->cdefine.platform_type = (ass & 0x4) >> 2;
666 spec->cdefine.swap = (ass & 0x2) >> 1;
667 spec->cdefine.override = ass & 0x1;
668
Takashi Iwai4e76a882014-02-25 12:21:03 +0100669 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100670 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100671 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100672 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100673 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
674 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
675 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
676 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
677 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
678 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
679 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100680
681 return 0;
682}
683
Takashi Iwai08c189f2012-12-19 15:22:24 +0100684/* return the position of NID in the list, or -1 if not found */
685static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
686{
687 int i;
688 for (i = 0; i < nums; i++)
689 if (list[i] == nid)
690 return i;
691 return -1;
692}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200693/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200694static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
695{
Takashi Iwai21268962011-07-07 15:01:13 +0200696 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200697}
698
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200699/* check subsystem ID and set up device-specific initialization;
700 * return 1 if initialized, 0 if invalid SSID
701 */
702/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
703 * 31 ~ 16 : Manufacture ID
704 * 15 ~ 8 : SKU ID
705 * 7 ~ 0 : Assembly ID
706 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
707 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100708static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200709{
710 unsigned int ass, tmp, i;
711 unsigned nid;
712 struct alc_spec *spec = codec->spec;
713
David Henningsson90622912010-10-14 14:50:18 +0200714 if (spec->cdefine.fixup) {
715 ass = spec->cdefine.sku_cfg;
716 if (ass == ALC_FIXUP_SKU_IGNORE)
717 return 0;
718 goto do_sku;
719 }
720
Takashi Iwai7639a062015-03-03 10:07:24 +0100721 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100722 if (codec->bus->pci &&
723 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200724 goto do_sku;
725
726 /* invalid SSID, check the special NID pin defcfg instead */
727 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400728 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200729 * 29~21 : reserve
730 * 20 : PCBEEP input
731 * 19~16 : Check sum (15:1)
732 * 15~1 : Custom
733 * 0 : override
734 */
735 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100736 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200737 nid = 0x17;
738 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100739 codec_dbg(codec,
740 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200741 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100742 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200743 return 0;
744 if ((ass >> 30) != 1) /* no physical connection */
745 return 0;
746
747 /* check sum */
748 tmp = 0;
749 for (i = 1; i < 16; i++) {
750 if ((ass >> i) & 1)
751 tmp++;
752 }
753 if (((ass >> 16) & 0xf) != tmp)
754 return 0;
755do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100756 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100757 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200758 /*
759 * 0 : override
760 * 1 : Swap Jack
761 * 2 : 0 --> Desktop, 1 --> Laptop
762 * 3~5 : External Amplifier control
763 * 7~6 : Reserved
764 */
765 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200766 if (spec->init_amp == ALC_INIT_UNDEFINED) {
767 switch (tmp) {
768 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200769 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200770 break;
771 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200772 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200773 break;
774 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200775 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200776 break;
777 case 5:
778 default:
779 spec->init_amp = ALC_INIT_DEFAULT;
780 break;
781 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200782 }
783
784 /* is laptop or Desktop and enable the function "Mute internal speaker
785 * when the external headphone out jack is plugged"
786 */
787 if (!(ass & 0x8000))
788 return 1;
789 /*
790 * 10~8 : Jack location
791 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
792 * 14~13: Resvered
793 * 15 : 1 --> enable the function "Mute internal speaker
794 * when the external headphone out jack is plugged"
795 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100796 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200797 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200798 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100799 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100800 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
801 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200802 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100803 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200804 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200805 return 1;
806}
Kailang Yangea1fb292008-08-26 12:58:38 +0200807
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200808/* Check the validity of ALC subsystem-id
809 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
810static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200811{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100812 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200813 struct alc_spec *spec = codec->spec;
Takashi Iwai67791202020-04-18 21:06:39 +0200814 if (spec->init_amp == ALC_INIT_UNDEFINED) {
815 codec_dbg(codec,
816 "realtek: Enable default setup for auto mode as fallback\n");
817 spec->init_amp = ALC_INIT_DEFAULT;
818 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200819 }
Takashi Iwai21268962011-07-07 15:01:13 +0200820}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200821
Takashi Iwai41e41f12005-06-08 14:48:49 +0200822/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200823 */
824
David Henningsson9d36a7d2014-10-07 10:18:42 +0200825static void alc_fixup_inv_dmic(struct hda_codec *codec,
826 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200827{
828 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100829
David Henningsson9d36a7d2014-10-07 10:18:42 +0200830 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200831}
832
Takashi Iwai603c4012008-07-30 15:01:44 +0200833
Takashi Iwai2eab6942012-12-18 15:30:41 +0100834static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200836 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837
Takashi Iwai08c189f2012-12-19 15:22:24 +0100838 err = snd_hda_gen_build_controls(codec);
839 if (err < 0)
840 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841
Takashi Iwai1727a772013-01-10 09:52:52 +0100842 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100843 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844}
845
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200846
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100848 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200849 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200850
Takashi Iwaic9af7532019-05-10 11:01:43 +0200851static void alc_pre_init(struct hda_codec *codec)
852{
853 alc_fill_eapd_coef(codec);
854}
855
Kailang Yangaeac1a02019-05-16 16:10:44 +0800856#define is_s3_resume(codec) \
857 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
Takashi Iwaic9af7532019-05-10 11:01:43 +0200858#define is_s4_resume(codec) \
859 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
860
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861static int alc_init(struct hda_codec *codec)
862{
863 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200864
Takashi Iwaic9af7532019-05-10 11:01:43 +0200865 /* hibernation resume needs the full chip initialization */
866 if (is_s4_resume(codec))
867 alc_pre_init(codec);
868
Takashi Iwai546bb672012-03-07 08:37:19 +0100869 if (spec->init_hook)
870 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100871
Takashi Iwai89781d02019-08-30 12:03:38 +0200872 spec->gen.skip_verbs = 1; /* applied in below */
Kailang Yang607ca3b2019-04-26 16:35:41 +0800873 snd_hda_gen_init(codec);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200874 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200875 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai89781d02019-08-30 12:03:38 +0200876 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200877
Takashi Iwai1727a772013-01-10 09:52:52 +0100878 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200879
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880 return 0;
881}
882
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100883static inline void alc_shutup(struct hda_codec *codec)
884{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200885 struct alc_spec *spec = codec->spec;
886
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200887 if (!snd_hda_get_bool_hint(codec, "shutup"))
888 return; /* disabled explicitly by hints */
889
Takashi Iwai1c7161532011-04-07 10:37:16 +0200890 if (spec && spec->shutup)
891 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200892 else
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100893 alc_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100894}
895
Takashi Iwai70a09762015-12-15 14:59:58 +0100896static void alc_reboot_notify(struct hda_codec *codec)
897{
898 struct alc_spec *spec = codec->spec;
899
900 if (spec && spec->reboot_notify)
901 spec->reboot_notify(codec);
902 else
903 alc_shutup(codec);
904}
905
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100906#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700907
Takashi Iwai83012a72012-08-24 18:38:08 +0200908#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500909static void alc_power_eapd(struct hda_codec *codec)
910{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200911 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500912}
913
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200914static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100915{
916 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100917 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100918 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500919 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100920 return 0;
921}
922#endif
923
Takashi Iwai2a439522011-07-26 09:52:50 +0200924#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100925static int alc_resume(struct hda_codec *codec)
926{
Kailang Yang97a26572013-11-29 00:35:26 -0500927 struct alc_spec *spec = codec->spec;
928
929 if (!spec->no_depop_delay)
930 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100931 codec->patch_ops.init(codec);
Takashi Iwai1a462be2020-01-09 10:01:04 +0100932 snd_hda_regmap_sync(codec);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200933 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100934 return 0;
935}
Takashi Iwaie044c392008-10-27 16:56:24 +0100936#endif
937
Linus Torvalds1da177e2005-04-16 15:20:36 -0700938/*
939 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200940static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700941 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100942 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700943 .init = alc_init,
944 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200945 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200946#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100947 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100948 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100949 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200950#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100951 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700952};
953
David Henningsson29adc4b2012-09-25 11:31:00 +0200954
Takashi Iwaided255b2015-10-01 17:59:43 +0200955#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100956
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200957/*
Kailang Yang4b016932013-11-28 11:55:09 +0100958 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200959 */
960struct alc_codec_rename_table {
961 unsigned int vendor_id;
962 unsigned short coef_mask;
963 unsigned short coef_bits;
964 const char *name;
965};
966
Kailang Yang4b016932013-11-28 11:55:09 +0100967struct alc_codec_rename_pci_table {
968 unsigned int codec_vendor_id;
969 unsigned short pci_subvendor;
970 unsigned short pci_subdevice;
971 const char *name;
972};
973
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100974static const struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800975 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200976 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
977 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
978 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
979 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
980 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
981 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
982 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200983 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800984 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200985 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
986 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
987 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
988 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
989 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
990 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
991 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
992 { } /* terminator */
993};
994
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100995static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
Kailang Yang4b016932013-11-28 11:55:09 +0100996 { 0x10ec0280, 0x1028, 0, "ALC3220" },
997 { 0x10ec0282, 0x1028, 0, "ALC3221" },
998 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800999 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +01001000 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +08001001 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +01001002 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1003 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001004 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1005 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +08001006 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +08001007 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +08001008 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +08001009 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +08001010 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +08001011 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001012 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1013 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1014 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1015 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1016 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1017 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1018 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1019 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1020 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1021 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1022 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +01001023 { } /* terminator */
1024};
1025
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001026static int alc_codec_rename_from_preset(struct hda_codec *codec)
1027{
1028 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +01001029 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001030
1031 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001032 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001033 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02001034 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001035 return alc_codec_rename(codec, p->name);
1036 }
Kailang Yang4b016932013-11-28 11:55:09 +01001037
Takashi Iwai5100cd02014-02-15 10:03:19 +01001038 if (!codec->bus->pci)
1039 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +01001040 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001041 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +01001042 continue;
1043 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1044 continue;
1045 if (!q->pci_subdevice ||
1046 q->pci_subdevice == codec->bus->pci->subsystem_device)
1047 return alc_codec_rename(codec, q->name);
1048 }
1049
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001050 return 0;
1051}
1052
Takashi Iwaie4770622011-07-08 11:11:35 +02001053
1054/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001055 * Digital-beep handlers
1056 */
1057#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001058
1059/* additional beep mixers; private_value will be overwritten */
1060static const struct snd_kcontrol_new alc_beep_mixer[] = {
1061 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1062 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1063};
1064
1065/* set up and create beep controls */
1066static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1067 int idx, int dir)
1068{
1069 struct snd_kcontrol_new *knew;
1070 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1071 int i;
1072
1073 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1074 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1075 &alc_beep_mixer[i]);
1076 if (!knew)
1077 return -ENOMEM;
1078 knew->private_value = beep_amp;
1079 }
1080 return 0;
1081}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001082
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001083static const struct snd_pci_quirk beep_allow_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001084 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001085 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001086 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001087 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001088 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1089 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1090 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001091 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001092 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001093 /* denylist -- no beep available */
Takashi Iwai051c78a2019-08-22 09:58:07 +02001094 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1095 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001096 {}
1097};
1098
1099static inline int has_cdefine_beep(struct hda_codec *codec)
1100{
1101 struct alc_spec *spec = codec->spec;
1102 const struct snd_pci_quirk *q;
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001103 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001104 if (q)
1105 return q->value;
1106 return spec->cdefine.enable_pcbeep;
1107}
1108#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001109#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001110#define has_cdefine_beep(codec) 0
1111#endif
1112
1113/* parse the BIOS configuration and set up the alc_spec */
1114/* return 1 if successful, 0 if the proper config is not found,
1115 * or a negative error code
1116 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001117static int alc_parse_auto_config(struct hda_codec *codec,
1118 const hda_nid_t *ignore_nids,
1119 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001120{
1121 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001122 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001123 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001124
Takashi Iwai53c334a2011-08-23 18:27:14 +02001125 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1126 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001127 if (err < 0)
1128 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001129
1130 if (ssid_nids)
1131 alc_ssid_check(codec, ssid_nids);
1132
Takashi Iwai08c189f2012-12-19 15:22:24 +01001133 err = snd_hda_gen_parse_auto_config(codec, cfg);
1134 if (err < 0)
1135 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001136
Takashi Iwai1d045db2011-07-07 18:23:21 +02001137 return 1;
1138}
1139
Takashi Iwai3de95172012-05-07 18:03:15 +02001140/* common preparation job for alc_spec */
1141static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1142{
1143 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1144 int err;
1145
1146 if (!spec)
1147 return -ENOMEM;
1148 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001149 snd_hda_gen_spec_init(&spec->gen);
1150 spec->gen.mixer_nid = mixer_nid;
1151 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001152 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001153 /* FIXME: do we need this for all Realtek codec models? */
1154 codec->spdif_status_reset = 1;
Kai Vehmanena6e7d0a2020-10-12 13:27:04 +03001155 codec->forced_resume = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001156 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001157
1158 err = alc_codec_rename_from_preset(codec);
1159 if (err < 0) {
1160 kfree(spec);
1161 return err;
1162 }
1163 return 0;
1164}
1165
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001166static int alc880_parse_auto_config(struct hda_codec *codec)
1167{
1168 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001169 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001170 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1171}
1172
Takashi Iwai1d045db2011-07-07 18:23:21 +02001173/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001174 * ALC880 fix-ups
1175 */
1176enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001177 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001178 ALC880_FIXUP_GPIO2,
1179 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001180 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001181 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001182 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001183 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001184 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001185 ALC880_FIXUP_VOL_KNOB,
1186 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001187 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001188 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001189 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001190 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001191 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001192 ALC880_FIXUP_3ST_BASE,
1193 ALC880_FIXUP_3ST,
1194 ALC880_FIXUP_3ST_DIG,
1195 ALC880_FIXUP_5ST_BASE,
1196 ALC880_FIXUP_5ST,
1197 ALC880_FIXUP_5ST_DIG,
1198 ALC880_FIXUP_6ST_BASE,
1199 ALC880_FIXUP_6ST,
1200 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001201 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001202};
1203
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001204/* enable the volume-knob widget support on NID 0x21 */
1205static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001206 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001207{
Takashi Iwai1727a772013-01-10 09:52:52 +01001208 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001209 snd_hda_jack_detect_enable_callback(codec, 0x21,
1210 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001211}
1212
Takashi Iwai1727a772013-01-10 09:52:52 +01001213static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001214 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001215 .type = HDA_FIXUP_FUNC,
1216 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001217 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001218 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001219 .type = HDA_FIXUP_FUNC,
1220 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001221 },
1222 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001223 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001224 .v.verbs = (const struct hda_verb[]) {
1225 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1226 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1227 { }
1228 },
1229 .chained = true,
1230 .chain_id = ALC880_FIXUP_GPIO2,
1231 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001232 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001233 .type = HDA_FIXUP_PINS,
1234 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001235 /* disable bogus unused pins */
1236 { 0x16, 0x411111f0 },
1237 { 0x18, 0x411111f0 },
1238 { 0x1a, 0x411111f0 },
1239 { }
1240 }
1241 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001242 [ALC880_FIXUP_LG_LW25] = {
1243 .type = HDA_FIXUP_PINS,
1244 .v.pins = (const struct hda_pintbl[]) {
1245 { 0x1a, 0x0181344f }, /* line-in */
1246 { 0x1b, 0x0321403f }, /* headphone */
1247 { }
1248 }
1249 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001250 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001251 .type = HDA_FIXUP_PINS,
1252 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001253 /* disable bogus unused pins */
1254 { 0x17, 0x411111f0 },
1255 { }
1256 },
1257 .chained = true,
1258 .chain_id = ALC880_FIXUP_GPIO2,
1259 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001260 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001261 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001262 .v.verbs = (const struct hda_verb[]) {
1263 /* change to EAPD mode */
1264 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1265 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1266 {}
1267 },
1268 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001269 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001270 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001271 .v.verbs = (const struct hda_verb[]) {
1272 /* change to EAPD mode */
1273 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1274 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1275 {}
1276 },
1277 .chained = true,
1278 .chain_id = ALC880_FIXUP_GPIO2,
1279 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001280 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001281 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001282 .v.func = alc880_fixup_vol_knob,
1283 },
1284 [ALC880_FIXUP_FUJITSU] = {
1285 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001286 .type = HDA_FIXUP_PINS,
1287 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001288 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001289 { 0x15, 0x99030120 }, /* speaker */
1290 { 0x16, 0x99030130 }, /* bass speaker */
1291 { 0x17, 0x411111f0 }, /* N/A */
1292 { 0x18, 0x411111f0 }, /* N/A */
1293 { 0x19, 0x01a19950 }, /* mic-in */
1294 { 0x1a, 0x411111f0 }, /* N/A */
1295 { 0x1b, 0x411111f0 }, /* N/A */
1296 { 0x1c, 0x411111f0 }, /* N/A */
1297 { 0x1d, 0x411111f0 }, /* N/A */
1298 { 0x1e, 0x01454140 }, /* SPDIF out */
1299 { }
1300 },
1301 .chained = true,
1302 .chain_id = ALC880_FIXUP_VOL_KNOB,
1303 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001304 [ALC880_FIXUP_F1734] = {
1305 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001306 .type = HDA_FIXUP_PINS,
1307 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001308 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001309 { 0x15, 0x99030120 }, /* speaker */
1310 { 0x16, 0x411111f0 }, /* N/A */
1311 { 0x17, 0x411111f0 }, /* N/A */
1312 { 0x18, 0x411111f0 }, /* N/A */
1313 { 0x19, 0x01a19950 }, /* mic-in */
1314 { 0x1a, 0x411111f0 }, /* N/A */
1315 { 0x1b, 0x411111f0 }, /* N/A */
1316 { 0x1c, 0x411111f0 }, /* N/A */
1317 { 0x1d, 0x411111f0 }, /* N/A */
1318 { 0x1e, 0x411111f0 }, /* N/A */
1319 { }
1320 },
1321 .chained = true,
1322 .chain_id = ALC880_FIXUP_VOL_KNOB,
1323 },
Takashi Iwai817de922012-02-20 17:20:48 +01001324 [ALC880_FIXUP_UNIWILL] = {
1325 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001326 .type = HDA_FIXUP_PINS,
1327 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001328 { 0x14, 0x0121411f }, /* HP */
1329 { 0x15, 0x99030120 }, /* speaker */
1330 { 0x16, 0x99030130 }, /* bass speaker */
1331 { }
1332 },
1333 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001334 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001335 .type = HDA_FIXUP_PINS,
1336 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001337 /* disable bogus unused pins */
1338 { 0x17, 0x411111f0 },
1339 { 0x19, 0x411111f0 },
1340 { 0x1b, 0x411111f0 },
1341 { 0x1f, 0x411111f0 },
1342 { }
1343 }
1344 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001345 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001346 .type = HDA_FIXUP_PINS,
1347 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001348 /* set up the whole pins as BIOS is utterly broken */
1349 { 0x14, 0x99030120 }, /* speaker */
1350 { 0x15, 0x0121411f }, /* HP */
1351 { 0x16, 0x411111f0 }, /* N/A */
1352 { 0x17, 0x411111f0 }, /* N/A */
1353 { 0x18, 0x01a19950 }, /* mic-in */
1354 { 0x19, 0x411111f0 }, /* N/A */
1355 { 0x1a, 0x01813031 }, /* line-in */
1356 { 0x1b, 0x411111f0 }, /* N/A */
1357 { 0x1c, 0x411111f0 }, /* N/A */
1358 { 0x1d, 0x411111f0 }, /* N/A */
1359 { 0x1e, 0x0144111e }, /* SPDIF */
1360 { }
1361 }
1362 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001363 [ALC880_FIXUP_ASUS_W5A] = {
1364 .type = HDA_FIXUP_PINS,
1365 .v.pins = (const struct hda_pintbl[]) {
1366 /* set up the whole pins as BIOS is utterly broken */
1367 { 0x14, 0x0121411f }, /* HP */
1368 { 0x15, 0x411111f0 }, /* N/A */
1369 { 0x16, 0x411111f0 }, /* N/A */
1370 { 0x17, 0x411111f0 }, /* N/A */
1371 { 0x18, 0x90a60160 }, /* mic */
1372 { 0x19, 0x411111f0 }, /* N/A */
1373 { 0x1a, 0x411111f0 }, /* N/A */
1374 { 0x1b, 0x411111f0 }, /* N/A */
1375 { 0x1c, 0x411111f0 }, /* N/A */
1376 { 0x1d, 0x411111f0 }, /* N/A */
1377 { 0x1e, 0xb743111e }, /* SPDIF out */
1378 { }
1379 },
1380 .chained = true,
1381 .chain_id = ALC880_FIXUP_GPIO1,
1382 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001383 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001384 .type = HDA_FIXUP_PINS,
1385 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001386 { 0x14, 0x01014010 }, /* line-out */
1387 { 0x15, 0x411111f0 }, /* N/A */
1388 { 0x16, 0x411111f0 }, /* N/A */
1389 { 0x17, 0x411111f0 }, /* N/A */
1390 { 0x18, 0x01a19c30 }, /* mic-in */
1391 { 0x19, 0x0121411f }, /* HP */
1392 { 0x1a, 0x01813031 }, /* line-in */
1393 { 0x1b, 0x02a19c40 }, /* front-mic */
1394 { 0x1c, 0x411111f0 }, /* N/A */
1395 { 0x1d, 0x411111f0 }, /* N/A */
1396 /* 0x1e is filled in below */
1397 { 0x1f, 0x411111f0 }, /* N/A */
1398 { }
1399 }
1400 },
1401 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001402 .type = HDA_FIXUP_PINS,
1403 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001404 { 0x1e, 0x411111f0 }, /* N/A */
1405 { }
1406 },
1407 .chained = true,
1408 .chain_id = ALC880_FIXUP_3ST_BASE,
1409 },
1410 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001411 .type = HDA_FIXUP_PINS,
1412 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001413 { 0x1e, 0x0144111e }, /* SPDIF */
1414 { }
1415 },
1416 .chained = true,
1417 .chain_id = ALC880_FIXUP_3ST_BASE,
1418 },
1419 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001420 .type = HDA_FIXUP_PINS,
1421 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001422 { 0x14, 0x01014010 }, /* front */
1423 { 0x15, 0x411111f0 }, /* N/A */
1424 { 0x16, 0x01011411 }, /* CLFE */
1425 { 0x17, 0x01016412 }, /* surr */
1426 { 0x18, 0x01a19c30 }, /* mic-in */
1427 { 0x19, 0x0121411f }, /* HP */
1428 { 0x1a, 0x01813031 }, /* line-in */
1429 { 0x1b, 0x02a19c40 }, /* front-mic */
1430 { 0x1c, 0x411111f0 }, /* N/A */
1431 { 0x1d, 0x411111f0 }, /* N/A */
1432 /* 0x1e is filled in below */
1433 { 0x1f, 0x411111f0 }, /* N/A */
1434 { }
1435 }
1436 },
1437 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001438 .type = HDA_FIXUP_PINS,
1439 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001440 { 0x1e, 0x411111f0 }, /* N/A */
1441 { }
1442 },
1443 .chained = true,
1444 .chain_id = ALC880_FIXUP_5ST_BASE,
1445 },
1446 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001447 .type = HDA_FIXUP_PINS,
1448 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001449 { 0x1e, 0x0144111e }, /* SPDIF */
1450 { }
1451 },
1452 .chained = true,
1453 .chain_id = ALC880_FIXUP_5ST_BASE,
1454 },
1455 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001456 .type = HDA_FIXUP_PINS,
1457 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001458 { 0x14, 0x01014010 }, /* front */
1459 { 0x15, 0x01016412 }, /* surr */
1460 { 0x16, 0x01011411 }, /* CLFE */
1461 { 0x17, 0x01012414 }, /* side */
1462 { 0x18, 0x01a19c30 }, /* mic-in */
1463 { 0x19, 0x02a19c40 }, /* front-mic */
1464 { 0x1a, 0x01813031 }, /* line-in */
1465 { 0x1b, 0x0121411f }, /* HP */
1466 { 0x1c, 0x411111f0 }, /* N/A */
1467 { 0x1d, 0x411111f0 }, /* N/A */
1468 /* 0x1e is filled in below */
1469 { 0x1f, 0x411111f0 }, /* N/A */
1470 { }
1471 }
1472 },
1473 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001474 .type = HDA_FIXUP_PINS,
1475 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001476 { 0x1e, 0x411111f0 }, /* N/A */
1477 { }
1478 },
1479 .chained = true,
1480 .chain_id = ALC880_FIXUP_6ST_BASE,
1481 },
1482 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001483 .type = HDA_FIXUP_PINS,
1484 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001485 { 0x1e, 0x0144111e }, /* SPDIF */
1486 { }
1487 },
1488 .chained = true,
1489 .chain_id = ALC880_FIXUP_6ST_BASE,
1490 },
Takashi Iwai53971452013-01-23 18:21:37 +01001491 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1492 .type = HDA_FIXUP_PINS,
1493 .v.pins = (const struct hda_pintbl[]) {
1494 { 0x1b, 0x0121401f }, /* HP with jack detect */
1495 { }
1496 },
1497 .chained_before = true,
1498 .chain_id = ALC880_FIXUP_6ST_BASE,
1499 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001500};
1501
1502static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001503 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001504 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001505 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001506 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001507 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001508 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001509 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001510 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001511 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001512 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001513 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001514 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001515 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001516 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001517 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001518 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001519 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001520 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001521 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1522 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1523 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001524 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001525 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001526
1527 /* Below is the copied entries from alc880_quirks.c.
1528 * It's not quite sure whether BIOS sets the correct pin-config table
1529 * on these machines, thus they are kept to be compatible with
1530 * the old static quirks. Once when it's confirmed to work without
1531 * these overrides, it'd be better to remove.
1532 */
1533 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1534 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1535 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1536 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1537 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1538 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1539 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1540 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1541 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1542 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1543 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1544 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1545 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1546 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1547 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1548 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1549 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1550 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1551 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1552 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1553 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1554 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1555 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1556 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1557 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1558 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1560 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1561 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1563 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1564 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1565 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1566 /* default Intel */
1567 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1568 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1569 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1570 {}
1571};
1572
Takashi Iwai1727a772013-01-10 09:52:52 +01001573static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001574 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1575 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1576 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1577 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1578 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1579 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001580 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001581 {}
1582};
1583
1584
1585/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001586 * OK, here we have finally the patch for ALC880
1587 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001588static int patch_alc880(struct hda_codec *codec)
1589{
1590 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001591 int err;
1592
Takashi Iwai3de95172012-05-07 18:03:15 +02001593 err = alc_alloc_spec(codec, 0x0b);
1594 if (err < 0)
1595 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001596
Takashi Iwai3de95172012-05-07 18:03:15 +02001597 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001598 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001599 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001600
Takashi Iwai225068a2015-05-29 10:42:14 +02001601 codec->patch_ops.unsol_event = alc880_unsol_event;
1602
Takashi Iwaic9af7532019-05-10 11:01:43 +02001603 alc_pre_init(codec);
1604
Takashi Iwai1727a772013-01-10 09:52:52 +01001605 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001606 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001607 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001608
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001609 /* automatic parse from the BIOS config */
1610 err = alc880_parse_auto_config(codec);
1611 if (err < 0)
1612 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001613
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001614 if (!spec->gen.no_analog) {
1615 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1616 if (err < 0)
1617 goto error;
1618 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001619
Takashi Iwai1727a772013-01-10 09:52:52 +01001620 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001621
Takashi Iwai1d045db2011-07-07 18:23:21 +02001622 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001623
1624 error:
1625 alc_free(codec);
1626 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001627}
1628
1629
1630/*
1631 * ALC260 support
1632 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001633static int alc260_parse_auto_config(struct hda_codec *codec)
1634{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001635 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001636 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1637 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001638}
1639
Takashi Iwai1d045db2011-07-07 18:23:21 +02001640/*
1641 * Pin config fixes
1642 */
1643enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001644 ALC260_FIXUP_HP_DC5750,
1645 ALC260_FIXUP_HP_PIN_0F,
1646 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001647 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001648 ALC260_FIXUP_GPIO1_TOGGLE,
1649 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001650 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001651 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001652 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001653 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001654 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001655};
1656
Takashi Iwai20f7d922012-02-16 12:35:16 +01001657static void alc260_gpio1_automute(struct hda_codec *codec)
1658{
1659 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001660
1661 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001662}
1663
1664static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001665 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001666{
1667 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001668 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001669 /* although the machine has only one output pin, we need to
1670 * toggle GPIO1 according to the jack state
1671 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001672 spec->gen.automute_hook = alc260_gpio1_automute;
1673 spec->gen.detect_hp = 1;
1674 spec->gen.automute_speaker = 1;
1675 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001676 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001677 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001678 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001679 }
1680}
1681
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001682static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001683 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001684{
1685 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001686 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001687 { 0x0f, 0x02214000 }, /* HP/speaker */
1688 { 0x12, 0x90a60160 }, /* int mic */
1689 { 0x13, 0x02a19000 }, /* ext mic */
1690 { 0x18, 0x01446000 }, /* SPDIF out */
1691 /* disable bogus I/O pins */
1692 { 0x10, 0x411111f0 },
1693 { 0x11, 0x411111f0 },
1694 { 0x14, 0x411111f0 },
1695 { 0x15, 0x411111f0 },
1696 { 0x16, 0x411111f0 },
1697 { 0x17, 0x411111f0 },
1698 { 0x19, 0x411111f0 },
1699 { }
1700 };
1701
1702 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001703 case HDA_FIXUP_ACT_PRE_PROBE:
1704 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001705 spec->init_amp = ALC_INIT_NONE;
1706 break;
1707 }
1708}
1709
Takashi Iwai39aedee2013-01-10 17:10:40 +01001710static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1711 const struct hda_fixup *fix, int action)
1712{
1713 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001714 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001715 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001716}
1717
1718static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1719 const struct hda_fixup *fix, int action)
1720{
1721 struct alc_spec *spec = codec->spec;
1722 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001723 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001724 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001725 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001726}
1727
Takashi Iwai1727a772013-01-10 09:52:52 +01001728static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001729 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001730 .type = HDA_FIXUP_PINS,
1731 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001732 { 0x11, 0x90130110 }, /* speaker */
1733 { }
1734 }
1735 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001736 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001737 .type = HDA_FIXUP_PINS,
1738 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001739 { 0x0f, 0x01214000 }, /* HP */
1740 { }
1741 }
1742 },
1743 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001744 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001745 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001746 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1747 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001748 { }
1749 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001750 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001751 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001752 .type = HDA_FIXUP_FUNC,
1753 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001754 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001755 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001756 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001757 .v.func = alc260_fixup_gpio1_toggle,
1758 .chained = true,
1759 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1760 },
1761 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001762 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001763 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001764 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1765 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001766 { }
1767 },
1768 .chained = true,
1769 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1770 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001771 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001772 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001773 .v.func = alc260_fixup_gpio1_toggle,
1774 .chained = true,
1775 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001776 },
1777 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001778 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001779 .v.func = alc260_fixup_kn1,
1780 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001781 [ALC260_FIXUP_FSC_S7020] = {
1782 .type = HDA_FIXUP_FUNC,
1783 .v.func = alc260_fixup_fsc_s7020,
1784 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001785 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1786 .type = HDA_FIXUP_FUNC,
1787 .v.func = alc260_fixup_fsc_s7020_jwse,
1788 .chained = true,
1789 .chain_id = ALC260_FIXUP_FSC_S7020,
1790 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001791 [ALC260_FIXUP_VAIO_PINS] = {
1792 .type = HDA_FIXUP_PINS,
1793 .v.pins = (const struct hda_pintbl[]) {
1794 /* Pin configs are missing completely on some VAIOs */
1795 { 0x0f, 0x01211020 },
1796 { 0x10, 0x0001003f },
1797 { 0x11, 0x411111f0 },
1798 { 0x12, 0x01a15930 },
1799 { 0x13, 0x411111f0 },
1800 { 0x14, 0x411111f0 },
1801 { 0x15, 0x411111f0 },
1802 { 0x16, 0x411111f0 },
1803 { 0x17, 0x411111f0 },
1804 { 0x18, 0x411111f0 },
1805 { 0x19, 0x411111f0 },
1806 { }
1807 }
1808 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001809};
1810
1811static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001812 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001813 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001814 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001815 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001816 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001817 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001818 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001819 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001820 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001821 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001822 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001823 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001824 {}
1825};
1826
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001827static const struct hda_model_fixup alc260_fixup_models[] = {
1828 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1829 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1830 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1831 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1832 {}
1833};
1834
Takashi Iwai1d045db2011-07-07 18:23:21 +02001835/*
1836 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001837static int patch_alc260(struct hda_codec *codec)
1838{
1839 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001840 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001841
Takashi Iwai3de95172012-05-07 18:03:15 +02001842 err = alc_alloc_spec(codec, 0x07);
1843 if (err < 0)
1844 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001845
Takashi Iwai3de95172012-05-07 18:03:15 +02001846 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001847 /* as quite a few machines require HP amp for speaker outputs,
1848 * it's easier to enable it unconditionally; even if it's unneeded,
1849 * it's almost harmless.
1850 */
1851 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001852 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001853
Takashi Iwai225068a2015-05-29 10:42:14 +02001854 spec->shutup = alc_eapd_shutup;
1855
Takashi Iwaic9af7532019-05-10 11:01:43 +02001856 alc_pre_init(codec);
1857
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001858 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1859 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001860 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001861
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001862 /* automatic parse from the BIOS config */
1863 err = alc260_parse_auto_config(codec);
1864 if (err < 0)
1865 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001866
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001867 if (!spec->gen.no_analog) {
1868 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1869 if (err < 0)
1870 goto error;
1871 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001872
Takashi Iwai1727a772013-01-10 09:52:52 +01001873 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001874
Takashi Iwai1d045db2011-07-07 18:23:21 +02001875 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001876
1877 error:
1878 alc_free(codec);
1879 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001880}
1881
1882
1883/*
1884 * ALC882/883/885/888/889 support
1885 *
1886 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1887 * configuration. Each pin widget can choose any input DACs and a mixer.
1888 * Each ADC is connected from a mixer of all inputs. This makes possible
1889 * 6-channel independent captures.
1890 *
1891 * In addition, an independent DAC for the multi-playback (not used in this
1892 * driver yet).
1893 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001894
1895/*
1896 * Pin config fixes
1897 */
1898enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001899 ALC882_FIXUP_ABIT_AW9D_MAX,
1900 ALC882_FIXUP_LENOVO_Y530,
1901 ALC882_FIXUP_PB_M5210,
1902 ALC882_FIXUP_ACER_ASPIRE_7736,
1903 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001904 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001905 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001906 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001907 ALC888_FIXUP_EEE1601,
PeiSen Hou4841b8e2021-02-02 10:30:22 +01001908 ALC886_FIXUP_EAPD,
Takashi Iwai177943a32011-11-09 12:55:18 +01001909 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001910 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001911 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001912 ALC882_FIXUP_GPIO1,
1913 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001914 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001915 ALC889_FIXUP_COEF,
1916 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001917 ALC882_FIXUP_ACER_ASPIRE_4930G,
1918 ALC882_FIXUP_ACER_ASPIRE_8930G,
1919 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001920 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001921 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001922 ALC889_FIXUP_MBP_VREF,
1923 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001924 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001925 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001926 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001927 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001928 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001929 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001930 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001931 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001932 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001933 ALC1220_FIXUP_CLEVO_P950,
Richard Sailer80690a22019-04-02 15:52:04 +02001934 ALC1220_FIXUP_CLEVO_PB51ED,
1935 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Jian-Hong Panca184352020-10-07 13:22:25 +08001936 ALC887_FIXUP_ASUS_AUDIO,
1937 ALC887_FIXUP_ASUS_HMIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001938};
1939
Takashi Iwai68ef0562011-11-09 18:24:44 +01001940static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001941 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001942{
Takashi Iwai1727a772013-01-10 09:52:52 +01001943 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001944 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001945 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001946}
1947
Takashi Iwai56710872011-11-14 17:42:11 +01001948/* set up GPIO at initialization */
1949static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001950 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001951{
Takashi Iwai215c8502018-06-19 22:34:26 +02001952 struct alc_spec *spec = codec->spec;
1953
1954 spec->gpio_write_delay = true;
1955 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001956}
1957
Takashi Iwai02a237b2012-02-13 15:25:07 +01001958/* Fix the connection of some pins for ALC889:
1959 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1960 * work correctly (bko#42740)
1961 */
1962static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001963 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001964{
Takashi Iwai1727a772013-01-10 09:52:52 +01001965 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001966 /* fake the connections during parsing the tree */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001967 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1968 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1969 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1970 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1971 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1972 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001973 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001974 /* restore the connections */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001975 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1976 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1977 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1978 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1979 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001980 }
1981}
1982
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001983/* Set VREF on HP pin */
1984static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001985 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001986{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001987 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001988 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001989 int i;
1990
Takashi Iwai1727a772013-01-10 09:52:52 +01001991 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001992 return;
1993 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1994 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1995 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1996 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001997 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001998 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001999 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01002000 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002001 break;
2002 }
2003}
2004
Takashi Iwai0756f092013-12-04 13:59:45 +01002005static void alc889_fixup_mac_pins(struct hda_codec *codec,
2006 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002007{
2008 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002009 int i;
2010
Takashi Iwai0756f092013-12-04 13:59:45 +01002011 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002012 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002013 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002014 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002015 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002016 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01002017 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002018}
2019
Takashi Iwai0756f092013-12-04 13:59:45 +01002020/* Set VREF on speaker pins on imac91 */
2021static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2022 const struct hda_fixup *fix, int action)
2023{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002024 static const hda_nid_t nids[] = { 0x18, 0x1a };
Takashi Iwai0756f092013-12-04 13:59:45 +01002025
2026 if (action == HDA_FIXUP_ACT_INIT)
2027 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2028}
2029
Adrien Vergée7729a42014-01-24 14:56:14 -05002030/* Set VREF on speaker pins on mba11 */
2031static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2032 const struct hda_fixup *fix, int action)
2033{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002034 static const hda_nid_t nids[] = { 0x18 };
Adrien Vergée7729a42014-01-24 14:56:14 -05002035
2036 if (action == HDA_FIXUP_ACT_INIT)
2037 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2038}
2039
Takashi Iwai0756f092013-12-04 13:59:45 +01002040/* Set VREF on speaker pins on mba21 */
2041static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2042 const struct hda_fixup *fix, int action)
2043{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002044 static const hda_nid_t nids[] = { 0x18, 0x19 };
Takashi Iwai0756f092013-12-04 13:59:45 +01002045
2046 if (action == HDA_FIXUP_ACT_INIT)
2047 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2048}
2049
Takashi Iwaie427c232012-07-29 10:04:08 +02002050/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09002051 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2052 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02002053 */
2054static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002055 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02002056{
2057 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002058 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002059 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002060 spec->gen.no_multi_io = 1;
2061 }
Takashi Iwaie427c232012-07-29 10:04:08 +02002062}
2063
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002064static void alc_fixup_bass_chmap(struct hda_codec *codec,
2065 const struct hda_fixup *fix, int action);
2066
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002067/* For dual-codec configuration, we need to disable some features to avoid
2068 * conflicts of kctls and PCM streams
2069 */
2070static void alc_fixup_dual_codecs(struct hda_codec *codec,
2071 const struct hda_fixup *fix, int action)
2072{
2073 struct alc_spec *spec = codec->spec;
2074
2075 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2076 return;
2077 /* disable vmaster */
2078 spec->gen.suppress_vmaster = 1;
2079 /* auto-mute and auto-mic switch don't work with multiple codecs */
2080 spec->gen.suppress_auto_mute = 1;
2081 spec->gen.suppress_auto_mic = 1;
2082 /* disable aamix as well */
2083 spec->gen.mixer_nid = 0;
2084 /* add location prefix to avoid conflicts */
2085 codec->force_pin_prefix = 1;
2086}
2087
2088static void rename_ctl(struct hda_codec *codec, const char *oldname,
2089 const char *newname)
2090{
2091 struct snd_kcontrol *kctl;
2092
2093 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2094 if (kctl)
2095 strcpy(kctl->id.name, newname);
2096}
2097
2098static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2099 const struct hda_fixup *fix,
2100 int action)
2101{
2102 alc_fixup_dual_codecs(codec, fix, action);
2103 switch (action) {
2104 case HDA_FIXUP_ACT_PRE_PROBE:
2105 /* override card longname to provide a unique UCM profile */
2106 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2107 break;
2108 case HDA_FIXUP_ACT_BUILD:
2109 /* rename Capture controls depending on the codec */
2110 rename_ctl(codec, "Capture Volume",
2111 codec->addr == 0 ?
2112 "Rear-Panel Capture Volume" :
2113 "Front-Panel Capture Volume");
2114 rename_ctl(codec, "Capture Switch",
2115 codec->addr == 0 ?
2116 "Rear-Panel Capture Switch" :
2117 "Front-Panel Capture Switch");
2118 break;
2119 }
2120}
2121
Peisen0202f5c2017-10-26 10:35:36 +08002122static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2123 const struct hda_fixup *fix,
2124 int action)
2125{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002126 static const hda_nid_t conn1[] = { 0x0c };
Peisen0202f5c2017-10-26 10:35:36 +08002127
2128 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2129 return;
2130
2131 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2132 /* We therefore want to make sure 0x14 (front headphone) and
2133 * 0x1b (speakers) use the stereo DAC 0x02
2134 */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002135 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2136 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Peisen0202f5c2017-10-26 10:35:36 +08002137}
2138
Jeremy Soller7f665b12019-02-13 10:56:19 -07002139static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2140 const struct hda_fixup *fix, int action);
2141
Richard Sailer80690a22019-04-02 15:52:04 +02002142static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002143 const struct hda_fixup *fix,
2144 int action)
2145{
2146 alc1220_fixup_clevo_p950(codec, fix, action);
2147 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2148}
2149
Jian-Hong Panca184352020-10-07 13:22:25 +08002150static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2151 struct hda_jack_callback *jack)
2152{
2153 struct alc_spec *spec = codec->spec;
2154 unsigned int vref;
2155
2156 snd_hda_gen_hp_automute(codec, jack);
2157
2158 if (spec->gen.hp_jack_present)
2159 vref = AC_PINCTL_VREF_80;
2160 else
2161 vref = AC_PINCTL_VREF_HIZ;
2162 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2163}
2164
2165static void alc887_fixup_asus_jack(struct hda_codec *codec,
2166 const struct hda_fixup *fix, int action)
2167{
2168 struct alc_spec *spec = codec->spec;
2169 if (action != HDA_FIXUP_ACT_PROBE)
2170 return;
2171 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2172 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2173}
2174
Takashi Iwai1727a772013-01-10 09:52:52 +01002175static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002176 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002177 .type = HDA_FIXUP_PINS,
2178 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002179 { 0x15, 0x01080104 }, /* side */
2180 { 0x16, 0x01011012 }, /* rear */
2181 { 0x17, 0x01016011 }, /* clfe */
2182 { }
2183 }
2184 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002185 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002186 .type = HDA_FIXUP_PINS,
2187 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002188 { 0x15, 0x99130112 }, /* rear int speakers */
2189 { 0x16, 0x99130111 }, /* subwoofer */
2190 { }
2191 }
2192 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002193 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002194 .type = HDA_FIXUP_PINCTLS,
2195 .v.pins = (const struct hda_pintbl[]) {
2196 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002197 {}
2198 }
2199 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002200 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002201 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002202 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002203 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002204 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002205 .type = HDA_FIXUP_PINS,
2206 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002207 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2208 { }
2209 }
2210 },
Marton Balint8f239212012-03-05 21:33:23 +01002211 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002212 .type = HDA_FIXUP_PINS,
2213 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002214 { 0x1c, 0x993301f0 }, /* CD */
2215 { }
2216 }
2217 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002218 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2219 .type = HDA_FIXUP_PINS,
2220 .v.pins = (const struct hda_pintbl[]) {
2221 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2222 { }
2223 },
2224 .chained = true,
2225 .chain_id = ALC889_FIXUP_CD,
2226 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002227 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002228 .type = HDA_FIXUP_PINS,
2229 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002230 { 0x17, 0x90170111 }, /* hidden surround speaker */
2231 { }
2232 }
2233 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002234 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002235 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002236 .v.verbs = (const struct hda_verb[]) {
2237 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2238 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2239 { }
2240 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002241 },
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002242 [ALC886_FIXUP_EAPD] = {
2243 .type = HDA_FIXUP_VERBS,
2244 .v.verbs = (const struct hda_verb[]) {
2245 /* change to EAPD mode */
2246 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2247 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2248 { }
2249 }
2250 },
Takashi Iwai177943a32011-11-09 12:55:18 +01002251 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002252 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002253 .v.verbs = (const struct hda_verb[]) {
2254 /* change to EAPD mode */
2255 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2256 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2257 { }
2258 }
2259 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002260 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002261 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002262 .v.verbs = (const struct hda_verb[]) {
2263 /* change to EAPD mode */
2264 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2265 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2266 { }
2267 }
2268 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002269 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002270 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002271 .v.verbs = (const struct hda_verb[]) {
2272 /* eanable EAPD on Acer laptops */
2273 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2274 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2275 { }
2276 }
2277 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002278 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002279 .type = HDA_FIXUP_FUNC,
2280 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002281 },
2282 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002283 .type = HDA_FIXUP_FUNC,
2284 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002285 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002286 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002287 .type = HDA_FIXUP_FUNC,
2288 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002289 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002290 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002291 .type = HDA_FIXUP_FUNC,
2292 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002293 .chained = true,
2294 .chain_id = ALC882_FIXUP_EAPD,
2295 },
2296 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002297 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002298 .v.func = alc889_fixup_coef,
2299 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002300 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002301 .type = HDA_FIXUP_PINS,
2302 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002303 { 0x16, 0x99130111 }, /* CLFE speaker */
2304 { 0x17, 0x99130112 }, /* surround speaker */
2305 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002306 },
2307 .chained = true,
2308 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002309 },
2310 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002311 .type = HDA_FIXUP_PINS,
2312 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002313 { 0x16, 0x99130111 }, /* CLFE speaker */
2314 { 0x1b, 0x99130112 }, /* surround speaker */
2315 { }
2316 },
2317 .chained = true,
2318 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2319 },
2320 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2321 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002322 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002323 .v.verbs = (const struct hda_verb[]) {
2324 /* Enable all DACs */
2325 /* DAC DISABLE/MUTE 1? */
2326 /* setting bits 1-5 disables DAC nids 0x02-0x06
2327 * apparently. Init=0x38 */
2328 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2329 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2330 /* DAC DISABLE/MUTE 2? */
2331 /* some bit here disables the other DACs.
2332 * Init=0x4900 */
2333 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2334 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2335 /* DMIC fix
2336 * This laptop has a stereo digital microphone.
2337 * The mics are only 1cm apart which makes the stereo
2338 * useless. However, either the mic or the ALC889
2339 * makes the signal become a difference/sum signal
2340 * instead of standard stereo, which is annoying.
2341 * So instead we flip this bit which makes the
2342 * codec replicate the sum signal to both channels,
2343 * turning it into a normal mono mic.
2344 */
2345 /* DMIC_CONTROL? Init value = 0x0001 */
2346 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2347 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2348 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2349 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2350 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002351 },
2352 .chained = true,
2353 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002354 },
Takashi Iwai56710872011-11-14 17:42:11 +01002355 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002356 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002357 .v.func = alc885_fixup_macpro_gpio,
2358 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002359 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002360 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002361 .v.func = alc889_fixup_dac_route,
2362 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002363 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002364 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002365 .v.func = alc889_fixup_mbp_vref,
2366 .chained = true,
2367 .chain_id = ALC882_FIXUP_GPIO1,
2368 },
2369 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002370 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002371 .v.func = alc889_fixup_imac91_vref,
2372 .chained = true,
2373 .chain_id = ALC882_FIXUP_GPIO1,
2374 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002375 [ALC889_FIXUP_MBA11_VREF] = {
2376 .type = HDA_FIXUP_FUNC,
2377 .v.func = alc889_fixup_mba11_vref,
2378 .chained = true,
2379 .chain_id = ALC889_FIXUP_MBP_VREF,
2380 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002381 [ALC889_FIXUP_MBA21_VREF] = {
2382 .type = HDA_FIXUP_FUNC,
2383 .v.func = alc889_fixup_mba21_vref,
2384 .chained = true,
2385 .chain_id = ALC889_FIXUP_MBP_VREF,
2386 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002387 [ALC889_FIXUP_MP11_VREF] = {
2388 .type = HDA_FIXUP_FUNC,
2389 .v.func = alc889_fixup_mba11_vref,
2390 .chained = true,
2391 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2392 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002393 [ALC889_FIXUP_MP41_VREF] = {
2394 .type = HDA_FIXUP_FUNC,
2395 .v.func = alc889_fixup_mbp_vref,
2396 .chained = true,
2397 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2398 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002399 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002400 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002401 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002402 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002403 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002404 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002405 .v.func = alc882_fixup_no_primary_hp,
2406 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002407 [ALC887_FIXUP_ASUS_BASS] = {
2408 .type = HDA_FIXUP_PINS,
2409 .v.pins = (const struct hda_pintbl[]) {
2410 {0x16, 0x99130130}, /* bass speaker */
2411 {}
2412 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002413 .chained = true,
2414 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2415 },
2416 [ALC887_FIXUP_BASS_CHMAP] = {
2417 .type = HDA_FIXUP_FUNC,
2418 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002419 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002420 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2421 .type = HDA_FIXUP_FUNC,
2422 .v.func = alc1220_fixup_gb_dual_codecs,
2423 },
Peisen0202f5c2017-10-26 10:35:36 +08002424 [ALC1220_FIXUP_CLEVO_P950] = {
2425 .type = HDA_FIXUP_FUNC,
2426 .v.func = alc1220_fixup_clevo_p950,
2427 },
Richard Sailer80690a22019-04-02 15:52:04 +02002428 [ALC1220_FIXUP_CLEVO_PB51ED] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002429 .type = HDA_FIXUP_FUNC,
Richard Sailer80690a22019-04-02 15:52:04 +02002430 .v.func = alc1220_fixup_clevo_pb51ed,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002431 },
Richard Sailer80690a22019-04-02 15:52:04 +02002432 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002433 .type = HDA_FIXUP_PINS,
2434 .v.pins = (const struct hda_pintbl[]) {
2435 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2436 {}
2437 },
2438 .chained = true,
Richard Sailer80690a22019-04-02 15:52:04 +02002439 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002440 },
Jian-Hong Panca184352020-10-07 13:22:25 +08002441 [ALC887_FIXUP_ASUS_AUDIO] = {
2442 .type = HDA_FIXUP_PINS,
2443 .v.pins = (const struct hda_pintbl[]) {
2444 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2445 { 0x19, 0x22219420 },
2446 {}
2447 },
2448 },
2449 [ALC887_FIXUP_ASUS_HMIC] = {
2450 .type = HDA_FIXUP_FUNC,
2451 .v.func = alc887_fixup_asus_jack,
2452 .chained = true,
2453 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2454 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002455};
2456
2457static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002458 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2459 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002460 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002461 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2462 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2463 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2464 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002465 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2466 ALC882_FIXUP_ACER_ASPIRE_4930G),
2467 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2468 ALC882_FIXUP_ACER_ASPIRE_4930G),
2469 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2470 ALC882_FIXUP_ACER_ASPIRE_8930G),
2471 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2472 ALC882_FIXUP_ACER_ASPIRE_8930G),
2473 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2474 ALC882_FIXUP_ACER_ASPIRE_4930G),
2475 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2476 ALC882_FIXUP_ACER_ASPIRE_4930G),
2477 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2478 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002479 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002480 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2481 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002482 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002483 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002484 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002485 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002486 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002487 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Jian-Hong Panca184352020-10-07 13:22:25 +08002488 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002489 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002490 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002491 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002492 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002493 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002494 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Fernando Luis Vázquez Cao12e31a72013-02-12 16:47:44 +09002495 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaic44d9b12016-02-07 09:38:26 +01002496 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002497
2498 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002499 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2500 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2501 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002502 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002503 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2504 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002505 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2506 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002507 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002508 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002509 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002510 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2511 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002512 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002513 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2514 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2515 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002516 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002517 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002518 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2519 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002520 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002521
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002522 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002523 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002524 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002525 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Christian Lachner0d45e862020-02-23 10:24:16 +01002526 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
Christian Lachnerd9e8fe02020-05-18 07:38:44 +02002527 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia0b03952020-06-16 15:21:50 +02002528 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia655e2b2020-02-17 16:19:47 +01002529 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai09926202020-12-20 09:09:43 +01002530 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai1d3aa4a2020-04-08 15:56:45 +02002531 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7dafba32020-02-12 09:10:47 +01002532 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaicc5049a2020-02-18 09:09:15 +01002533 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002534 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai26af1772021-03-03 15:23:46 +01002535 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwai63691582017-05-22 16:32:46 +02002536 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002537 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002538 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Peisen0202f5c2017-10-26 10:35:36 +08002539 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002540 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2541 SND_PCI_QUIRK(0x1558, 0x950A, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaif3d737b2018-07-17 17:08:32 +02002542 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller2f0d5202018-05-07 09:28:45 -06002543 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002544 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2545 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2546 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2547 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
Richard Sailer503d90b2019-06-19 13:33:11 +02002548 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2549 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002550 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
PeiSen Hou259eb822020-05-19 08:50:12 +02002551 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002552 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2553 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2554 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2555 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2556 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002557 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2558 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002559 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2560 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002561 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002562 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002563 {}
2564};
2565
Takashi Iwai1727a772013-01-10 09:52:52 +01002566static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002567 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2568 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2569 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2570 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2571 {.id = ALC889_FIXUP_CD, .name = "cd"},
2572 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2573 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2574 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2575 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2576 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2577 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2578 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2579 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2580 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2581 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002582 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2583 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2584 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002585 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2586 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2587 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2588 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2589 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2590 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2591 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2592 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002593 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002594 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002595 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002596 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002597 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002598 {}
2599};
2600
Takashi Iwai1d045db2011-07-07 18:23:21 +02002601/*
2602 * BIOS auto configuration
2603 */
2604/* almost identical with ALC880 parser... */
2605static int alc882_parse_auto_config(struct hda_codec *codec)
2606{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002607 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002608 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2609 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002610}
2611
Takashi Iwai1d045db2011-07-07 18:23:21 +02002612/*
2613 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002614static int patch_alc882(struct hda_codec *codec)
2615{
2616 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002617 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002618
Takashi Iwai3de95172012-05-07 18:03:15 +02002619 err = alc_alloc_spec(codec, 0x0b);
2620 if (err < 0)
2621 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002622
Takashi Iwai3de95172012-05-07 18:03:15 +02002623 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002624
Takashi Iwai7639a062015-03-03 10:07:24 +01002625 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002626 case 0x10ec0882:
2627 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002628 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002629 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002630 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002631 break;
2632 default:
2633 /* ALC883 and variants */
2634 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2635 break;
2636 }
2637
Takashi Iwaic9af7532019-05-10 11:01:43 +02002638 alc_pre_init(codec);
2639
Takashi Iwai1727a772013-01-10 09:52:52 +01002640 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002641 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002642 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002643
2644 alc_auto_parse_customize_define(codec);
2645
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002646 if (has_cdefine_beep(codec))
2647 spec->gen.beep_nid = 0x01;
2648
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002649 /* automatic parse from the BIOS config */
2650 err = alc882_parse_auto_config(codec);
2651 if (err < 0)
2652 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002653
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002654 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2655 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2656 if (err < 0)
2657 goto error;
2658 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002659
Takashi Iwai1727a772013-01-10 09:52:52 +01002660 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002661
Takashi Iwai1d045db2011-07-07 18:23:21 +02002662 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002663
2664 error:
2665 alc_free(codec);
2666 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002667}
2668
2669
2670/*
2671 * ALC262 support
2672 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002673static int alc262_parse_auto_config(struct hda_codec *codec)
2674{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002675 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002676 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2677 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002678}
2679
2680/*
2681 * Pin config fixes
2682 */
2683enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002684 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002685 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002686 ALC262_FIXUP_HP_Z200,
2687 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002688 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002689 ALC262_FIXUP_BENQ,
2690 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002691 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002692 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002693};
2694
Takashi Iwai1727a772013-01-10 09:52:52 +01002695static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002696 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002697 .type = HDA_FIXUP_PINS,
2698 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002699 { 0x14, 0x99130110 }, /* speaker */
2700 { 0x15, 0x0221142f }, /* front HP */
2701 { 0x1b, 0x0121141f }, /* rear HP */
2702 { }
2703 }
2704 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002705 [ALC262_FIXUP_FSC_S7110] = {
2706 .type = HDA_FIXUP_PINS,
2707 .v.pins = (const struct hda_pintbl[]) {
2708 { 0x15, 0x90170110 }, /* speaker */
2709 { }
2710 },
2711 .chained = true,
2712 .chain_id = ALC262_FIXUP_BENQ,
2713 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002714 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002715 .type = HDA_FIXUP_PINS,
2716 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002717 { 0x16, 0x99130120 }, /* internal speaker */
2718 { }
2719 }
2720 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002721 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002722 .type = HDA_FIXUP_PINS,
2723 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002724 { 0x14, 0x1993e1f0 }, /* int AUX */
2725 { }
2726 }
2727 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002728 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002729 .type = HDA_FIXUP_PINCTLS,
2730 .v.pins = (const struct hda_pintbl[]) {
2731 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002732 {}
2733 },
2734 .chained = true,
2735 .chain_id = ALC262_FIXUP_BENQ,
2736 },
2737 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002738 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002739 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002740 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2741 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2742 {}
2743 }
2744 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002745 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002746 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002747 .v.verbs = (const struct hda_verb[]) {
2748 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2749 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2750 {}
2751 }
2752 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002753 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002754 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002755 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002756 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002757 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2758 .type = HDA_FIXUP_FUNC,
2759 .v.func = alc_fixup_no_depop_delay,
2760 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002761};
2762
2763static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002764 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002765 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002766 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002767 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002768 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002769 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002770 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002771 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2772 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002773 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002774 {}
2775};
2776
Takashi Iwai1727a772013-01-10 09:52:52 +01002777static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002778 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002779 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2780 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2781 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2782 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2783 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2784 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2785 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2786 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002787 {}
2788};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002789
Takashi Iwai1d045db2011-07-07 18:23:21 +02002790/*
2791 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002792static int patch_alc262(struct hda_codec *codec)
2793{
2794 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002795 int err;
2796
Takashi Iwai3de95172012-05-07 18:03:15 +02002797 err = alc_alloc_spec(codec, 0x0b);
2798 if (err < 0)
2799 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002800
Takashi Iwai3de95172012-05-07 18:03:15 +02002801 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002802 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002803
Takashi Iwai225068a2015-05-29 10:42:14 +02002804 spec->shutup = alc_eapd_shutup;
2805
Takashi Iwai1d045db2011-07-07 18:23:21 +02002806#if 0
2807 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2808 * under-run
2809 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002810 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002811#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002812 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2813
Takashi Iwaic9af7532019-05-10 11:01:43 +02002814 alc_pre_init(codec);
2815
Takashi Iwai1727a772013-01-10 09:52:52 +01002816 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002817 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002818 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002819
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002820 alc_auto_parse_customize_define(codec);
2821
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002822 if (has_cdefine_beep(codec))
2823 spec->gen.beep_nid = 0x01;
2824
Takashi Iwai42399f72011-11-07 17:18:44 +01002825 /* automatic parse from the BIOS config */
2826 err = alc262_parse_auto_config(codec);
2827 if (err < 0)
2828 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002829
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002830 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2831 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2832 if (err < 0)
2833 goto error;
2834 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002835
Takashi Iwai1727a772013-01-10 09:52:52 +01002836 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002837
Takashi Iwai1d045db2011-07-07 18:23:21 +02002838 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002839
2840 error:
2841 alc_free(codec);
2842 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002843}
2844
2845/*
2846 * ALC268
2847 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002848/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002849static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2850 struct snd_ctl_elem_value *ucontrol)
2851{
2852 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2853 unsigned long pval;
2854 int err;
2855
2856 mutex_lock(&codec->control_mutex);
2857 pval = kcontrol->private_value;
2858 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2859 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2860 if (err >= 0) {
2861 kcontrol->private_value = (pval & ~0xff) | 0x10;
2862 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2863 }
2864 kcontrol->private_value = pval;
2865 mutex_unlock(&codec->control_mutex);
2866 return err;
2867}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002868
2869static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2870 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002871 {
2872 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2873 .name = "Beep Playback Switch",
2874 .subdevice = HDA_SUBDEV_AMP_FLAG,
2875 .info = snd_hda_mixer_amp_switch_info,
2876 .get = snd_hda_mixer_amp_switch_get,
2877 .put = alc268_beep_switch_put,
2878 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2879 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002880};
2881
2882/* set PCBEEP vol = 0, mute connections */
2883static const struct hda_verb alc268_beep_init_verbs[] = {
2884 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2885 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2886 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2887 { }
2888};
2889
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002890enum {
2891 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002892 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002893 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002894};
2895
Takashi Iwai1727a772013-01-10 09:52:52 +01002896static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002897 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002898 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002899 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002900 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002901 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002902 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002903 .v.verbs = (const struct hda_verb[]) {
2904 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2905 {}
2906 }
2907 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002908 [ALC268_FIXUP_SPDIF] = {
2909 .type = HDA_FIXUP_PINS,
2910 .v.pins = (const struct hda_pintbl[]) {
2911 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2912 {}
2913 }
2914 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002915};
2916
Takashi Iwai1727a772013-01-10 09:52:52 +01002917static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002918 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002919 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002920 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002921 {}
2922};
2923
2924static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002925 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002926 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002927 /* below is codec SSID since multiple Toshiba laptops have the
2928 * same PCI SSID 1179:ff00
2929 */
2930 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002931 {}
2932};
2933
Takashi Iwai1d045db2011-07-07 18:23:21 +02002934/*
2935 * BIOS auto configuration
2936 */
2937static int alc268_parse_auto_config(struct hda_codec *codec)
2938{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002939 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002940 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002941}
2942
Takashi Iwai1d045db2011-07-07 18:23:21 +02002943/*
2944 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002945static int patch_alc268(struct hda_codec *codec)
2946{
2947 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002948 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002949
Takashi Iwai1d045db2011-07-07 18:23:21 +02002950 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002951 err = alc_alloc_spec(codec, 0);
2952 if (err < 0)
2953 return err;
2954
2955 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02002956 if (has_cdefine_beep(codec))
2957 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002958
Takashi Iwai225068a2015-05-29 10:42:14 +02002959 spec->shutup = alc_eapd_shutup;
2960
Takashi Iwaic9af7532019-05-10 11:01:43 +02002961 alc_pre_init(codec);
2962
Takashi Iwai1727a772013-01-10 09:52:52 +01002963 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2964 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002965
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002966 /* automatic parse from the BIOS config */
2967 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002968 if (err < 0)
2969 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002970
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002971 if (err > 0 && !spec->gen.no_analog &&
2972 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002973 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2974 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2975 &alc268_beep_mixer[i])) {
2976 err = -ENOMEM;
2977 goto error;
2978 }
2979 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002980 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002981 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2982 /* override the amp caps for beep generator */
2983 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2984 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2985 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2986 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2987 (0 << AC_AMPCAP_MUTE_SHIFT));
2988 }
2989
Takashi Iwai1727a772013-01-10 09:52:52 +01002990 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002991
Takashi Iwai1d045db2011-07-07 18:23:21 +02002992 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002993
2994 error:
2995 alc_free(codec);
2996 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002997}
2998
2999/*
3000 * ALC269
3001 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003002
Takashi Iwai1d045db2011-07-07 18:23:21 +02003003static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003004 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003005};
3006
3007static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003008 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003009};
3010
Takashi Iwai1d045db2011-07-07 18:23:21 +02003011/* different alc269-variants */
3012enum {
3013 ALC269_TYPE_ALC269VA,
3014 ALC269_TYPE_ALC269VB,
3015 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02003016 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01003017 ALC269_TYPE_ALC280,
3018 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02003019 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01003020 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08003021 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02003022 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08003023 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003024 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08003025 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003026 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003027 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003028 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003029 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003030 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003031 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003032 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003033};
3034
3035/*
3036 * BIOS auto configuration
3037 */
3038static int alc269_parse_auto_config(struct hda_codec *codec)
3039{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003040 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003041 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3042 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3043 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003044 const hda_nid_t *ssids;
3045
3046 switch (spec->codec_variant) {
3047 case ALC269_TYPE_ALC269VA:
3048 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003049 case ALC269_TYPE_ALC280:
3050 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003051 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003052 ssids = alc269va_ssids;
3053 break;
3054 case ALC269_TYPE_ALC269VB:
3055 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003056 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003057 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003058 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003059 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003060 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003061 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003062 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003063 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003064 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003065 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003066 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003067 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003068 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003069 ssids = alc269_ssids;
3070 break;
3071 default:
3072 ssids = alc269_ssids;
3073 break;
3074 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003075
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003076 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003077}
3078
Hui Wang476c02e2020-03-29 16:20:18 +08003079static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3080 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3081 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3082 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3083 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3084 {}
3085};
3086
3087static void alc_headset_btn_callback(struct hda_codec *codec,
3088 struct hda_jack_callback *jack)
3089{
3090 int report = 0;
3091
3092 if (jack->unsol_res & (7 << 13))
3093 report |= SND_JACK_BTN_0;
3094
3095 if (jack->unsol_res & (1 << 16 | 3 << 8))
3096 report |= SND_JACK_BTN_1;
3097
3098 /* Volume up key */
3099 if (jack->unsol_res & (7 << 23))
3100 report |= SND_JACK_BTN_2;
3101
3102 /* Volume down key */
3103 if (jack->unsol_res & (7 << 10))
3104 report |= SND_JACK_BTN_3;
3105
3106 jack->jack->button_state = report;
3107}
3108
3109static void alc_disable_headset_jack_key(struct hda_codec *codec)
3110{
3111 struct alc_spec *spec = codec->spec;
3112
3113 if (!spec->has_hs_key)
3114 return;
3115
3116 switch (codec->core.vendor_id) {
3117 case 0x10ec0215:
3118 case 0x10ec0225:
3119 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003120 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003121 case 0x10ec0295:
3122 case 0x10ec0289:
3123 case 0x10ec0299:
3124 alc_write_coef_idx(codec, 0x48, 0x0);
3125 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3126 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3127 break;
3128 case 0x10ec0236:
3129 case 0x10ec0256:
3130 alc_write_coef_idx(codec, 0x48, 0x0);
3131 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3132 break;
3133 }
3134}
3135
3136static void alc_enable_headset_jack_key(struct hda_codec *codec)
3137{
3138 struct alc_spec *spec = codec->spec;
3139
3140 if (!spec->has_hs_key)
3141 return;
3142
3143 switch (codec->core.vendor_id) {
3144 case 0x10ec0215:
3145 case 0x10ec0225:
3146 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003147 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003148 case 0x10ec0295:
3149 case 0x10ec0289:
3150 case 0x10ec0299:
3151 alc_write_coef_idx(codec, 0x48, 0xd011);
3152 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3153 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3154 break;
3155 case 0x10ec0236:
3156 case 0x10ec0256:
3157 alc_write_coef_idx(codec, 0x48, 0xd011);
3158 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3159 break;
3160 }
3161}
3162
3163static void alc_fixup_headset_jack(struct hda_codec *codec,
3164 const struct hda_fixup *fix, int action)
3165{
3166 struct alc_spec *spec = codec->spec;
3167
3168 switch (action) {
3169 case HDA_FIXUP_ACT_PRE_PROBE:
3170 spec->has_hs_key = 1;
3171 snd_hda_jack_detect_enable_callback(codec, 0x55,
3172 alc_headset_btn_callback);
3173 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3174 SND_JACK_HEADSET, alc_headset_btn_keymap);
3175 break;
3176 case HDA_FIXUP_ACT_INIT:
3177 alc_enable_headset_jack_key(codec);
3178 break;
3179 }
3180}
3181
Kailang Yang1387e2d2012-11-08 10:23:18 +01003182static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003183{
Takashi Iwai98b24882014-08-18 13:47:50 +02003184 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003185}
3186
3187static void alc269_shutup(struct hda_codec *codec)
3188{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003189 struct alc_spec *spec = codec->spec;
3190
Kailang Yang1387e2d2012-11-08 10:23:18 +01003191 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3192 alc269vb_toggle_power_output(codec, 0);
3193 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3194 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003195 msleep(150);
3196 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003197 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003198}
3199
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003200static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003201 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003202 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003203 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3204 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3205 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3206 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3207 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3208 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3209 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3210 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3211 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3212 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3213 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3214 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3215 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3216 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3217 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3218 WRITE_COEF(0x63, 0x2902), /* PLL */
3219 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3220 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3221 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3222 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3223 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3224 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3225 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3226 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3227 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3228 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3229 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3230 {}
3231};
3232
Kailang Yangcb149cb2014-03-18 16:45:32 +08003233static void alc282_restore_default_value(struct hda_codec *codec)
3234{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003235 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003236}
3237
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003238static void alc282_init(struct hda_codec *codec)
3239{
3240 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003241 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003242 bool hp_pin_sense;
3243 int coef78;
3244
Kailang Yangcb149cb2014-03-18 16:45:32 +08003245 alc282_restore_default_value(codec);
3246
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003247 if (!hp_pin)
3248 return;
3249 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3250 coef78 = alc_read_coef_idx(codec, 0x78);
3251
3252 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3253 /* Headphone capless set to high power mode */
3254 alc_write_coef_idx(codec, 0x78, 0x9004);
3255
3256 if (hp_pin_sense)
3257 msleep(2);
3258
3259 snd_hda_codec_write(codec, hp_pin, 0,
3260 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3261
3262 if (hp_pin_sense)
3263 msleep(85);
3264
3265 snd_hda_codec_write(codec, hp_pin, 0,
3266 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3267
3268 if (hp_pin_sense)
3269 msleep(100);
3270
3271 /* Headphone capless set to normal mode */
3272 alc_write_coef_idx(codec, 0x78, coef78);
3273}
3274
3275static void alc282_shutup(struct hda_codec *codec)
3276{
3277 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003278 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003279 bool hp_pin_sense;
3280 int coef78;
3281
3282 if (!hp_pin) {
3283 alc269_shutup(codec);
3284 return;
3285 }
3286
3287 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3288 coef78 = alc_read_coef_idx(codec, 0x78);
3289 alc_write_coef_idx(codec, 0x78, 0x9004);
3290
3291 if (hp_pin_sense)
3292 msleep(2);
3293
3294 snd_hda_codec_write(codec, hp_pin, 0,
3295 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3296
3297 if (hp_pin_sense)
3298 msleep(85);
3299
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003300 if (!spec->no_shutup_pins)
3301 snd_hda_codec_write(codec, hp_pin, 0,
3302 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003303
3304 if (hp_pin_sense)
3305 msleep(100);
3306
3307 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003308 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003309 alc_write_coef_idx(codec, 0x78, coef78);
3310}
3311
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003312static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003313 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003314 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003315 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3316 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3317 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3318 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3319 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3320 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3321 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3322 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3323 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3324 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3325 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3326 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3327 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3328 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3329 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3330 WRITE_COEF(0x2e, 0x2902), /* PLL */
3331 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3332 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3333 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3334 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3335 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3336 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3337 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3338 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3339 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3340 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3341 WRITE_COEF(0x49, 0x0), /* test mode */
3342 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3343 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3344 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003345 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003346 {}
3347};
3348
Kailang Yang6bd55b02014-03-17 13:51:27 +08003349static void alc283_restore_default_value(struct hda_codec *codec)
3350{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003351 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003352}
3353
Kailang Yang2af02be2013-08-22 10:03:50 +02003354static void alc283_init(struct hda_codec *codec)
3355{
3356 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003357 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003358 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003359
Kailang Yang6bd55b02014-03-17 13:51:27 +08003360 alc283_restore_default_value(codec);
3361
Kailang Yang2af02be2013-08-22 10:03:50 +02003362 if (!hp_pin)
3363 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003364
3365 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003366 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3367
3368 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3369 /* Headphone capless set to high power mode */
3370 alc_write_coef_idx(codec, 0x43, 0x9004);
3371
3372 snd_hda_codec_write(codec, hp_pin, 0,
3373 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3374
3375 if (hp_pin_sense)
3376 msleep(85);
3377
3378 snd_hda_codec_write(codec, hp_pin, 0,
3379 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3380
3381 if (hp_pin_sense)
3382 msleep(85);
3383 /* Index 0x46 Combo jack auto switch control 2 */
3384 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003385 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003386 /* Headphone capless set to normal mode */
3387 alc_write_coef_idx(codec, 0x43, 0x9614);
3388}
3389
3390static void alc283_shutup(struct hda_codec *codec)
3391{
3392 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003393 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003394 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003395
3396 if (!hp_pin) {
3397 alc269_shutup(codec);
3398 return;
3399 }
3400
3401 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3402
3403 alc_write_coef_idx(codec, 0x43, 0x9004);
3404
Harsha Priyab450b172014-10-09 11:04:56 +00003405 /*depop hp during suspend*/
3406 alc_write_coef_idx(codec, 0x06, 0x2100);
3407
Kailang Yang2af02be2013-08-22 10:03:50 +02003408 snd_hda_codec_write(codec, hp_pin, 0,
3409 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3410
3411 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003412 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003413
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003414 if (!spec->no_shutup_pins)
3415 snd_hda_codec_write(codec, hp_pin, 0,
3416 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003417
Takashi Iwai98b24882014-08-18 13:47:50 +02003418 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003419
3420 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003421 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003422 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003423 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003424 alc_write_coef_idx(codec, 0x43, 0x9614);
3425}
3426
Kailang Yang4a219ef2017-06-16 16:54:35 +08003427static void alc256_init(struct hda_codec *codec)
3428{
3429 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003430 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003431 bool hp_pin_sense;
3432
3433 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003434 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003435
3436 msleep(30);
3437
3438 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3439
3440 if (hp_pin_sense)
3441 msleep(2);
3442
3443 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003444 if (spec->ultra_low_power) {
3445 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3446 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3447 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3448 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3449 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3450 msleep(30);
3451 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003452
3453 snd_hda_codec_write(codec, hp_pin, 0,
3454 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3455
Kailang Yang6447c962019-05-08 16:27:03 +08003456 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003457 msleep(85);
3458
3459 snd_hda_codec_write(codec, hp_pin, 0,
3460 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3461
Kailang Yang6447c962019-05-08 16:27:03 +08003462 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003463 msleep(100);
3464
3465 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3466 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003467 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3468 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003469 /*
3470 * Expose headphone mic (or possibly Line In on some machines) instead
3471 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3472 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3473 * this register.
3474 */
3475 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003476}
3477
3478static void alc256_shutup(struct hda_codec *codec)
3479{
3480 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003481 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003482 bool hp_pin_sense;
3483
Kailang Yang6447c962019-05-08 16:27:03 +08003484 if (!hp_pin)
3485 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003486
3487 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3488
3489 if (hp_pin_sense)
3490 msleep(2);
3491
3492 snd_hda_codec_write(codec, hp_pin, 0,
3493 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3494
Kailang Yang6447c962019-05-08 16:27:03 +08003495 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003496 msleep(85);
3497
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003498 /* 3k pull low control for Headset jack. */
3499 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003500 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3501 * when booting with headset plugged. So skip setting it for the codec alc257
3502 */
3503 if (codec->core.vendor_id != 0x10ec0257)
3504 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003505
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003506 if (!spec->no_shutup_pins)
3507 snd_hda_codec_write(codec, hp_pin, 0,
3508 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003509
Kailang Yang6447c962019-05-08 16:27:03 +08003510 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003511 msleep(100);
3512
3513 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003514 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003515 if (spec->ultra_low_power) {
3516 msleep(50);
3517 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3518 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3519 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3520 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3521 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3522 msleep(30);
3523 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003524}
3525
Kailang Yangda911b12018-01-05 16:50:08 +08003526static void alc225_init(struct hda_codec *codec)
3527{
3528 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003529 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003530 bool hp1_pin_sense, hp2_pin_sense;
3531
3532 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003533 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003534 msleep(30);
3535
3536 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3537 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3538
3539 if (hp1_pin_sense || hp2_pin_sense)
3540 msleep(2);
3541
3542 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003543 if (spec->ultra_low_power) {
3544 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3545 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3546 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3547 msleep(30);
3548 }
Kailang Yangda911b12018-01-05 16:50:08 +08003549
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003550 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003551 snd_hda_codec_write(codec, hp_pin, 0,
3552 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3553 if (hp2_pin_sense)
3554 snd_hda_codec_write(codec, 0x16, 0,
3555 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3556
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003557 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003558 msleep(85);
3559
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003560 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003561 snd_hda_codec_write(codec, hp_pin, 0,
3562 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3563 if (hp2_pin_sense)
3564 snd_hda_codec_write(codec, 0x16, 0,
3565 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3566
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003567 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003568 msleep(100);
3569
3570 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3571 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3572}
3573
3574static void alc225_shutup(struct hda_codec *codec)
3575{
3576 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003577 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003578 bool hp1_pin_sense, hp2_pin_sense;
3579
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003580 if (!hp_pin)
3581 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003582
3583 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003584 /* 3k pull low control for Headset jack. */
3585 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3586
3587 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3588 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3589
3590 if (hp1_pin_sense || hp2_pin_sense)
3591 msleep(2);
3592
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003593 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003594 snd_hda_codec_write(codec, hp_pin, 0,
3595 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3596 if (hp2_pin_sense)
3597 snd_hda_codec_write(codec, 0x16, 0,
3598 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3599
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003600 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003601 msleep(85);
3602
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003603 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003604 snd_hda_codec_write(codec, hp_pin, 0,
3605 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3606 if (hp2_pin_sense)
3607 snd_hda_codec_write(codec, 0x16, 0,
3608 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3609
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003610 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003611 msleep(100);
3612
3613 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003614 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003615 if (spec->ultra_low_power) {
3616 msleep(50);
3617 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3618 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3619 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3620 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3621 msleep(30);
3622 }
Hui Wang476c02e2020-03-29 16:20:18 +08003623
3624 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3625 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003626}
3627
Kailang Yangc2d6af52017-06-21 14:50:54 +08003628static void alc_default_init(struct hda_codec *codec)
3629{
3630 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003631 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003632 bool hp_pin_sense;
3633
3634 if (!hp_pin)
3635 return;
3636
3637 msleep(30);
3638
3639 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3640
3641 if (hp_pin_sense)
3642 msleep(2);
3643
3644 snd_hda_codec_write(codec, hp_pin, 0,
3645 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3646
3647 if (hp_pin_sense)
3648 msleep(85);
3649
3650 snd_hda_codec_write(codec, hp_pin, 0,
3651 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3652
3653 if (hp_pin_sense)
3654 msleep(100);
3655}
3656
3657static void alc_default_shutup(struct hda_codec *codec)
3658{
3659 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003660 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003661 bool hp_pin_sense;
3662
3663 if (!hp_pin) {
3664 alc269_shutup(codec);
3665 return;
3666 }
3667
3668 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3669
3670 if (hp_pin_sense)
3671 msleep(2);
3672
3673 snd_hda_codec_write(codec, hp_pin, 0,
3674 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3675
3676 if (hp_pin_sense)
3677 msleep(85);
3678
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003679 if (!spec->no_shutup_pins)
3680 snd_hda_codec_write(codec, hp_pin, 0,
3681 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003682
3683 if (hp_pin_sense)
3684 msleep(100);
3685
3686 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003687 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003688}
3689
Kailang Yang693abe12019-01-29 15:38:21 +08003690static void alc294_hp_init(struct hda_codec *codec)
3691{
3692 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003693 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003694 int i, val;
3695
3696 if (!hp_pin)
3697 return;
3698
3699 snd_hda_codec_write(codec, hp_pin, 0,
3700 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3701
3702 msleep(100);
3703
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003704 if (!spec->no_shutup_pins)
3705 snd_hda_codec_write(codec, hp_pin, 0,
3706 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003707
3708 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3709 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3710
3711 /* Wait for depop procedure finish */
3712 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3713 for (i = 0; i < 20 && val & 0x0080; i++) {
3714 msleep(50);
3715 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3716 }
3717 /* Set HP depop to auto mode */
3718 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3719 msleep(50);
3720}
3721
3722static void alc294_init(struct hda_codec *codec)
3723{
3724 struct alc_spec *spec = codec->spec;
3725
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003726 /* required only at boot or S4 resume time */
3727 if (!spec->done_hp_init ||
3728 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003729 alc294_hp_init(codec);
3730 spec->done_hp_init = true;
3731 }
3732 alc_default_init(codec);
3733}
3734
Kailang Yangad60d502013-06-28 12:03:01 +02003735static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3736 unsigned int val)
3737{
3738 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3739 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3740 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3741}
3742
3743static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3744{
3745 unsigned int val;
3746
3747 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3748 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3749 & 0xffff;
3750 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3751 << 16;
3752 return val;
3753}
3754
3755static void alc5505_dsp_halt(struct hda_codec *codec)
3756{
3757 unsigned int val;
3758
3759 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3760 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3761 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3762 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3763 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3764 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3765 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3766 val = alc5505_coef_get(codec, 0x6220);
3767 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3768}
3769
3770static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3771{
3772 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3773 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3774 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3775 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3776 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3777 alc5505_coef_set(codec, 0x880c, 0x00000004);
3778}
3779
3780static void alc5505_dsp_init(struct hda_codec *codec)
3781{
3782 unsigned int val;
3783
3784 alc5505_dsp_halt(codec);
3785 alc5505_dsp_back_from_halt(codec);
3786 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3787 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3788 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3789 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3790 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3791 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3792 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3793 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3794 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3795 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3796 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3797 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3798 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3799
3800 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3801 if (val <= 3)
3802 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3803 else
3804 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3805
3806 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3807 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3808 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3809 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3810 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3811 alc5505_coef_set(codec, 0x880c, 0x00000003);
3812 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003813
3814#ifdef HALT_REALTEK_ALC5505
3815 alc5505_dsp_halt(codec);
3816#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003817}
3818
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003819#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003820#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3821#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003822#else
3823#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3824#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3825#endif
3826
Takashi Iwai2a439522011-07-26 09:52:50 +02003827#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003828static int alc269_suspend(struct hda_codec *codec)
3829{
3830 struct alc_spec *spec = codec->spec;
3831
3832 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003833 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003834 return alc_suspend(codec);
3835}
3836
Takashi Iwai1d045db2011-07-07 18:23:21 +02003837static int alc269_resume(struct hda_codec *codec)
3838{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003839 struct alc_spec *spec = codec->spec;
3840
Kailang Yang1387e2d2012-11-08 10:23:18 +01003841 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3842 alc269vb_toggle_power_output(codec, 0);
3843 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003844 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003845 msleep(150);
3846 }
3847
3848 codec->patch_ops.init(codec);
3849
Kailang Yang1387e2d2012-11-08 10:23:18 +01003850 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3851 alc269vb_toggle_power_output(codec, 1);
3852 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003853 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003854 msleep(200);
3855 }
3856
Takashi Iwai1a462be2020-01-09 10:01:04 +01003857 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003858 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003859
3860 /* on some machine, the BIOS will clear the codec gpio data when enter
3861 * suspend, and won't restore the data after resume, so we restore it
3862 * in the driver.
3863 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003864 if (spec->gpio_data)
3865 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003866
Kailang Yangad60d502013-06-28 12:03:01 +02003867 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003868 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003869
Takashi Iwai1d045db2011-07-07 18:23:21 +02003870 return 0;
3871}
Takashi Iwai2a439522011-07-26 09:52:50 +02003872#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003873
David Henningsson108cc102012-07-20 10:37:25 +02003874static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003875 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003876{
3877 struct alc_spec *spec = codec->spec;
3878
Takashi Iwai1727a772013-01-10 09:52:52 +01003879 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003880 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3881}
3882
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003883static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3884 const struct hda_fixup *fix,
3885 int action)
3886{
3887 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3888 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3889
3890 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3891 snd_hda_codec_set_pincfg(codec, 0x19,
3892 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3893 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3894}
3895
Takashi Iwai1d045db2011-07-07 18:23:21 +02003896static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003897 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003898{
Takashi Iwai98b24882014-08-18 13:47:50 +02003899 if (action == HDA_FIXUP_ACT_INIT)
3900 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003901}
3902
David Henningsson7c478f02013-10-11 10:18:46 +02003903static void alc269_fixup_headset_mic(struct hda_codec *codec,
3904 const struct hda_fixup *fix, int action)
3905{
3906 struct alc_spec *spec = codec->spec;
3907
3908 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3909 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3910}
3911
Takashi Iwai1d045db2011-07-07 18:23:21 +02003912static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003913 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003914{
3915 static const struct hda_verb verbs[] = {
3916 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3917 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3918 {}
3919 };
3920 unsigned int cfg;
3921
Takashi Iwai7639a062015-03-03 10:07:24 +01003922 if (strcmp(codec->core.chip_name, "ALC271X") &&
3923 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003924 return;
3925 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3926 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3927 snd_hda_sequence_write(codec, verbs);
3928}
3929
Takashi Iwai017f2a12011-07-09 14:42:25 +02003930static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003931 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003932{
3933 struct alc_spec *spec = codec->spec;
3934
Takashi Iwai1727a772013-01-10 09:52:52 +01003935 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003936 return;
3937
3938 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3939 * fix the sample rate of analog I/O to 44.1kHz
3940 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003941 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3942 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003943}
3944
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003945static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003946 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003947{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003948 /* The digital-mic unit sends PDM (differential signal) instead of
3949 * the standard PCM, thus you can't record a valid mono stream as is.
3950 * Below is a workaround specific to ALC269 to control the dmic
3951 * signal source as mono.
3952 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003953 if (action == HDA_FIXUP_ACT_INIT)
3954 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003955}
3956
Takashi Iwai24519912011-08-16 15:08:49 +02003957static void alc269_quanta_automute(struct hda_codec *codec)
3958{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003959 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003960
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003961 alc_write_coef_idx(codec, 0x0c, 0x680);
3962 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003963}
3964
3965static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003966 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003967{
3968 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003969 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003970 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003971 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003972}
3973
David Henningssond240d1d2013-04-15 12:50:02 +02003974static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003975 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003976{
3977 struct alc_spec *spec = codec->spec;
3978 int vref;
3979 msleep(200);
3980 snd_hda_gen_hp_automute(codec, jack);
3981
3982 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3983 msleep(100);
3984 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3985 vref);
3986 msleep(500);
3987 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3988 vref);
3989}
3990
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02003991/*
3992 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
3993 */
3994struct hda_alc298_mbxinit {
3995 unsigned char value_0x23;
3996 unsigned char value_0x25;
3997};
3998
3999static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4000 const struct hda_alc298_mbxinit *initval,
4001 bool first)
4002{
4003 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4004 alc_write_coef_idx(codec, 0x26, 0xb000);
4005
4006 if (first)
4007 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4008
4009 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4010 alc_write_coef_idx(codec, 0x26, 0xf000);
4011 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4012
4013 if (initval->value_0x23 != 0x1e)
4014 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4015
4016 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4017 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4018}
4019
4020static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4021 const struct hda_fixup *fix,
4022 int action)
4023{
4024 /* Initialization magic */
4025 static const struct hda_alc298_mbxinit dac_init[] = {
4026 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4027 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4028 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4029 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4030 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4031 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4032 {0x2f, 0x00},
4033 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4034 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4035 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4036 {}
4037 };
4038 const struct hda_alc298_mbxinit *seq;
4039
4040 if (action != HDA_FIXUP_ACT_INIT)
4041 return;
4042
4043 /* Start */
4044 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4045 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4046 alc_write_coef_idx(codec, 0x26, 0xf000);
4047 alc_write_coef_idx(codec, 0x22, 0x31);
4048 alc_write_coef_idx(codec, 0x23, 0x0b);
4049 alc_write_coef_idx(codec, 0x25, 0x00);
4050 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4051 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4052
4053 for (seq = dac_init; seq->value_0x23; seq++)
4054 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4055}
4056
David Henningssond240d1d2013-04-15 12:50:02 +02004057static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4058 const struct hda_fixup *fix, int action)
4059{
4060 struct alc_spec *spec = codec->spec;
4061 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4062 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4063 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4064 }
4065}
4066
Takashi Iwai766538a2020-06-18 13:08:41 +02004067static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4068 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004069{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004070 unsigned int pinval;
4071
Takashi Iwai766538a2020-06-18 13:08:41 +02004072 if (!pin)
4073 return;
4074 if (polarity)
4075 on = !on;
4076 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004077 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004078 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4079 /* temporarily power up/down for setting VREF */
4080 snd_hda_power_up_pm(codec);
4081 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4082 snd_hda_power_down_pm(codec);
4083}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004084
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004085/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004086static int vref_mute_led_set(struct led_classdev *led_cdev,
4087 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004088{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004089 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004090 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004091
Takashi Iwai766538a2020-06-18 13:08:41 +02004092 alc_update_vref_led(codec, spec->mute_led_nid,
4093 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004094 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004095}
4096
David Henningssond5b6b652013-11-06 10:50:44 +01004097/* Make sure the led works even in runtime suspend */
4098static unsigned int led_power_filter(struct hda_codec *codec,
4099 hda_nid_t nid,
4100 unsigned int power_state)
4101{
4102 struct alc_spec *spec = codec->spec;
4103
Hui Wang50dd9052014-07-08 17:56:15 +08004104 if (power_state != AC_PWRST_D3 || nid == 0 ||
4105 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004106 return power_state;
4107
4108 /* Set pin ctl again, it might have just been set to 0 */
4109 snd_hda_set_pin_ctl(codec, nid,
4110 snd_hda_codec_get_pin_target(codec, nid));
4111
Takashi Iwaicffd3962015-04-09 10:30:25 +02004112 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004113}
4114
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004115static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4116 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004117{
4118 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004119 const struct dmi_device *dev = NULL;
4120
4121 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4122 return;
4123
4124 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4125 int pol, pin;
4126 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4127 continue;
4128 if (pin < 0x0a || pin >= 0x10)
4129 break;
4130 spec->mute_led_polarity = pol;
4131 spec->mute_led_nid = pin - 0x0a + 0x18;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004132 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004133 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004134 codec_dbg(codec,
4135 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004136 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004137 break;
4138 }
4139}
4140
Takashi Iwai85c467d2018-05-29 11:38:38 +02004141static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4142 const struct hda_fixup *fix,
4143 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004144{
4145 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004146
David Henningssond06ac142013-02-18 11:41:55 +01004147 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4148 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004149 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004150 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004151 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004152 }
4153}
4154
Takashi Iwai85c467d2018-05-29 11:38:38 +02004155static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4156 const struct hda_fixup *fix, int action)
4157{
4158 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4159}
4160
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004161static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4162 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004163{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004164 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004165}
4166
Tom Briden7f783bd2017-03-25 10:12:01 +00004167static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4168 const struct hda_fixup *fix, int action)
4169{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004170 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004171}
4172
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004173/* update LED status via GPIO */
4174static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004175 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004176{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004177 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004178 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004179 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004180}
4181
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004182/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004183static int gpio_mute_led_set(struct led_classdev *led_cdev,
4184 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004185{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004186 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004187 struct alc_spec *spec = codec->spec;
4188
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004189 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004190 spec->mute_led_polarity, !brightness);
4191 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004192}
4193
4194/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004195static int micmute_led_set(struct led_classdev *led_cdev,
4196 enum led_brightness brightness)
4197{
4198 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4199 struct alc_spec *spec = codec->spec;
4200
4201 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004202 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004203 return 0;
4204}
4205
Takashi Iwai01e4a272018-06-19 22:47:30 +02004206/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4207static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4208 int action,
4209 unsigned int mute_mask,
4210 unsigned int micmute_mask)
4211{
4212 struct alc_spec *spec = codec->spec;
4213
4214 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4215
4216 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4217 return;
4218 if (mute_mask) {
4219 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004220 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004221 }
4222 if (micmute_mask) {
4223 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004224 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004225 }
4226}
4227
Jeremy Szue7d66cf2021-03-16 15:46:24 +08004228static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4229 const struct hda_fixup *fix, int action)
4230{
4231 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4232}
4233
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004234static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4235 const struct hda_fixup *fix, int action)
4236{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004237 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004238}
4239
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004240static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4241 const struct hda_fixup *fix, int action)
4242{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004243 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004244}
4245
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004246static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4247 const struct hda_fixup *fix, int action)
4248{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004249 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004250}
4251
Kailang Yanga0ccbc52020-11-06 15:20:38 +08004252static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4253 const struct hda_fixup *fix, int action)
4254{
4255 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4256}
4257
Takashi Iwai8a503552020-06-18 13:08:32 +02004258/* turn on/off mic-mute LED per capture hook via VREF change */
4259static int vref_micmute_led_set(struct led_classdev *led_cdev,
4260 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004261{
Takashi Iwai8a503552020-06-18 13:08:32 +02004262 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004263 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004264
Takashi Iwai766538a2020-06-18 13:08:41 +02004265 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4266 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004267 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004268}
4269
4270static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4271 const struct hda_fixup *fix, int action)
4272{
4273 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004274
Takashi Iwai01e4a272018-06-19 22:47:30 +02004275 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004276 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004277 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4278 * enable headphone amp
4279 */
4280 spec->gpio_mask |= 0x10;
4281 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004282 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004283 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004284 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004285 }
4286}
4287
David Henningsson7a5255f2014-10-30 08:26:01 +01004288static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4289 const struct hda_fixup *fix, int action)
4290{
David Henningsson7a5255f2014-10-30 08:26:01 +01004291 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004292
Takashi Iwai01e4a272018-06-19 22:47:30 +02004293 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004294 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004295 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004296 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004297 codec->power_filter = led_power_filter;
4298 }
4299}
4300
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01004301/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4302 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4303 */
4304static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4305 const struct hda_fixup *fix, int action)
4306{
4307 struct alc_spec *spec = codec->spec;
4308
4309 switch (action) {
4310 case HDA_FIXUP_ACT_PRE_PROBE:
4311 spec->gpio_mask |= 0x01;
4312 spec->gpio_dir |= 0x01;
4313 break;
4314 case HDA_FIXUP_ACT_INIT:
4315 /* need to toggle GPIO to enable the amp */
4316 alc_update_gpio_data(codec, 0x01, true);
4317 msleep(100);
4318 alc_update_gpio_data(codec, 0x01, false);
4319 break;
4320 }
4321}
4322
Takashi Iwai766538a2020-06-18 13:08:41 +02004323static void alc_update_coef_led(struct hda_codec *codec,
4324 struct alc_coef_led *led,
4325 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004326{
Takashi Iwai766538a2020-06-18 13:08:41 +02004327 if (polarity)
4328 on = !on;
4329 /* temporarily power up/down for setting COEF bit */
4330 alc_update_coef_idx(codec, led->idx, led->mask,
4331 on ? led->on : led->off);
4332}
4333
Kailang Yang431e76c2020-04-07 14:40:20 +08004334/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004335static int coef_mute_led_set(struct led_classdev *led_cdev,
4336 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004337{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004338 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004339 struct alc_spec *spec = codec->spec;
4340
Takashi Iwai766538a2020-06-18 13:08:41 +02004341 alc_update_coef_led(codec, &spec->mute_led_coef,
4342 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004343 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004344}
4345
4346static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4347 const struct hda_fixup *fix,
4348 int action)
4349{
4350 struct alc_spec *spec = codec->spec;
4351
4352 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4353 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004354 spec->mute_led_coef.idx = 0x0b;
4355 spec->mute_led_coef.mask = 1 << 3;
4356 spec->mute_led_coef.on = 1 << 3;
4357 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004358 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004359 }
4360}
4361
Kailang Yang24164f42020-04-07 14:52:42 +08004362static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4363 const struct hda_fixup *fix,
4364 int action)
4365{
4366 struct alc_spec *spec = codec->spec;
4367
4368 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4369 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004370 spec->mute_led_coef.idx = 0x34;
4371 spec->mute_led_coef.mask = 1 << 5;
4372 spec->mute_led_coef.on = 0;
4373 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004374 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004375 }
4376}
4377
Kailang Yang431e76c2020-04-07 14:40:20 +08004378/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004379static int coef_micmute_led_set(struct led_classdev *led_cdev,
4380 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004381{
Takashi Iwai8a503552020-06-18 13:08:32 +02004382 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004383 struct alc_spec *spec = codec->spec;
4384
Takashi Iwai766538a2020-06-18 13:08:41 +02004385 alc_update_coef_led(codec, &spec->mic_led_coef,
4386 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004387 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004388}
4389
4390static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4391 const struct hda_fixup *fix, int action)
4392{
4393 struct alc_spec *spec = codec->spec;
4394
4395 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004396 spec->mic_led_coef.idx = 0x19;
4397 spec->mic_led_coef.mask = 1 << 13;
4398 spec->mic_led_coef.on = 1 << 13;
4399 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004400 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004401 }
4402}
4403
Kailang Yang24164f42020-04-07 14:52:42 +08004404static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4405 const struct hda_fixup *fix, int action)
4406{
4407 struct alc_spec *spec = codec->spec;
4408
4409 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004410 spec->mic_led_coef.idx = 0x35;
4411 spec->mic_led_coef.mask = 3 << 2;
4412 spec->mic_led_coef.on = 2 << 2;
4413 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004414 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004415 }
4416}
4417
Kailang Yang431e76c2020-04-07 14:40:20 +08004418static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4419 const struct hda_fixup *fix, int action)
4420{
4421 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4422 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4423}
4424
Kailang Yang24164f42020-04-07 14:52:42 +08004425static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4426 const struct hda_fixup *fix, int action)
4427{
4428 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4429 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4430}
4431
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004432#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004433static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4434 struct hda_jack_callback *event)
4435{
4436 struct alc_spec *spec = codec->spec;
4437
4438 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4439 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004440 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004441 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004442 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004443 input_sync(spec->kb_dev);
4444}
David Henningsson33f4acd2015-01-07 15:50:13 +01004445
Kailang3694cb22015-12-28 11:35:24 +08004446static int alc_register_micmute_input_device(struct hda_codec *codec)
4447{
4448 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004449 int i;
Kailang3694cb22015-12-28 11:35:24 +08004450
4451 spec->kb_dev = input_allocate_device();
4452 if (!spec->kb_dev) {
4453 codec_err(codec, "Out of memory (input_allocate_device)\n");
4454 return -ENOMEM;
4455 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004456
4457 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4458
Kailang3694cb22015-12-28 11:35:24 +08004459 spec->kb_dev->name = "Microphone Mute Button";
4460 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004461 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4462 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4463 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4464 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4465 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004466
4467 if (input_register_device(spec->kb_dev)) {
4468 codec_err(codec, "input_register_device failed\n");
4469 input_free_device(spec->kb_dev);
4470 spec->kb_dev = NULL;
4471 return -ENOMEM;
4472 }
4473
4474 return 0;
4475}
4476
Takashi Iwai01e4a272018-06-19 22:47:30 +02004477/* GPIO1 = set according to SKU external amp
4478 * GPIO2 = mic mute hotkey
4479 * GPIO3 = mute LED
4480 * GPIO4 = mic mute LED
4481 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004482static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4483 const struct hda_fixup *fix, int action)
4484{
David Henningsson33f4acd2015-01-07 15:50:13 +01004485 struct alc_spec *spec = codec->spec;
4486
Takashi Iwai01e4a272018-06-19 22:47:30 +02004487 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004488 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004489 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004490 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004491 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004492
Takashi Iwai01e4a272018-06-19 22:47:30 +02004493 spec->gpio_mask |= 0x06;
4494 spec->gpio_dir |= 0x02;
4495 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004496 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004497 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004498 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004499 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004500 return;
4501 }
4502
4503 if (!spec->kb_dev)
4504 return;
4505
4506 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004507 case HDA_FIXUP_ACT_FREE:
4508 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004509 spec->kb_dev = NULL;
4510 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004511}
4512
Takashi Iwai01e4a272018-06-19 22:47:30 +02004513/* Line2 = mic mute hotkey
4514 * GPIO2 = mic mute LED
4515 */
Kailang3694cb22015-12-28 11:35:24 +08004516static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4517 const struct hda_fixup *fix, int action)
4518{
Kailang3694cb22015-12-28 11:35:24 +08004519 struct alc_spec *spec = codec->spec;
4520
Takashi Iwai01e4a272018-06-19 22:47:30 +02004521 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004522 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004523 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004524 if (alc_register_micmute_input_device(codec) != 0)
4525 return;
4526
Kailang3694cb22015-12-28 11:35:24 +08004527 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4528 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004529 return;
4530 }
4531
4532 if (!spec->kb_dev)
4533 return;
4534
4535 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004536 case HDA_FIXUP_ACT_FREE:
4537 input_unregister_device(spec->kb_dev);
4538 spec->kb_dev = NULL;
4539 }
4540}
Takashi Iwaic4696522018-01-15 10:44:35 +01004541#else /* INPUT */
4542#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4543#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4544#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004545
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004546static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4547 const struct hda_fixup *fix, int action)
4548{
4549 struct alc_spec *spec = codec->spec;
4550
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004551 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004552 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004553 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004554 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004555 }
4556}
4557
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004558static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004559 UPDATE_COEF(0x4a, 1<<8, 0),
4560 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4561 UPDATE_COEF(0x63, 3<<14, 3<<14),
4562 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4563 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4564 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4565 UPDATE_COEF(0x4a, 3<<10, 0),
4566 {}
4567};
4568
David Henningsson73bdd592013-04-15 15:44:14 +02004569static void alc_headset_mode_unplugged(struct hda_codec *codec)
4570{
Kailang Yang92666d42020-11-19 17:04:21 +08004571 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004572 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004573 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004574 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4575 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4576 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4577 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4578 {}
4579 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004580 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004581 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004582 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4583 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4584 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4585 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004586 {}
4587 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004588 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004589 WRITE_COEF(0x1b, 0x0c0b),
4590 WRITE_COEF(0x45, 0xc429),
4591 UPDATE_COEF(0x35, 0x4000, 0),
4592 WRITE_COEF(0x06, 0x2104),
4593 WRITE_COEF(0x1a, 0x0001),
4594 WRITE_COEF(0x26, 0x0004),
4595 WRITE_COEF(0x32, 0x42a3),
4596 {}
4597 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004598 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004599 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4600 UPDATE_COEF(0x50, 0x2000, 0x2000),
4601 UPDATE_COEF(0x56, 0x0006, 0x0006),
4602 UPDATE_COEF(0x66, 0x0008, 0),
4603 UPDATE_COEF(0x67, 0x2000, 0),
4604 {}
4605 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004606 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004607 UPDATE_COEF(0x19, 0x1300, 0x0300),
4608 {}
4609 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004610 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004611 WRITE_COEF(0x76, 0x000e),
4612 WRITE_COEF(0x6c, 0x2400),
4613 WRITE_COEF(0x18, 0x7308),
4614 WRITE_COEF(0x6b, 0xc429),
4615 {}
4616 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004617 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004618 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4619 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4620 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4621 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4622 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4623 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4624 {}
4625 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004626 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004627 WRITE_COEF(0x15, 0x0d40),
4628 WRITE_COEF(0xb7, 0x802b),
4629 {}
4630 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004631 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004632 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004633 {}
4634 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004635 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004636 UPDATE_COEF(0x4a, 0x0100, 0),
4637 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4638 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4639 UPDATE_COEF(0x4a, 0x0010, 0),
4640 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4641 WRITE_COEF(0x45, 0x5289),
4642 UPDATE_COEF(0x4a, 0x0c00, 0),
4643 {}
4644 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004645
Kailang Yang92666d42020-11-19 17:04:21 +08004646 if (spec->no_internal_mic_pin) {
4647 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4648 return;
4649 }
4650
Takashi Iwai7639a062015-03-03 10:07:24 +01004651 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004652 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004653 alc_process_coef_fw(codec, coef0255);
4654 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004655 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004656 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004657 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004658 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004659 case 0x10ec0234:
4660 case 0x10ec0274:
4661 case 0x10ec0294:
4662 alc_process_coef_fw(codec, coef0274);
4663 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004664 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004665 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004666 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004667 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004668 case 0x10ec0286:
4669 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004670 alc_process_coef_fw(codec, coef0288);
4671 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004672 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004673 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004674 alc_process_coef_fw(codec, coef0288);
4675 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004676 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004677 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004678 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004679 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004680 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004681 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004682 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004683 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004684 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004685 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004686 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004687 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004688 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004689 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004690 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004691 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004692 alc_process_coef_fw(codec, coef0225);
4693 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004694 case 0x10ec0867:
4695 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4696 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004697 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004698 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004699}
4700
4701
4702static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4703 hda_nid_t mic_pin)
4704{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004705 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004706 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4707 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4708 {}
4709 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004710 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004711 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4712 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4713 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4714 {}
4715 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004716 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004717 UPDATE_COEF(0x35, 0, 1<<14),
4718 WRITE_COEF(0x06, 0x2100),
4719 WRITE_COEF(0x1a, 0x0021),
4720 WRITE_COEF(0x26, 0x008c),
4721 {}
4722 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004723 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004724 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004725 UPDATE_COEF(0x50, 0x2000, 0),
4726 UPDATE_COEF(0x56, 0x0006, 0),
4727 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4728 UPDATE_COEF(0x66, 0x0008, 0x0008),
4729 UPDATE_COEF(0x67, 0x2000, 0x2000),
4730 {}
4731 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004732 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004733 WRITE_COEF(0x19, 0xa208),
4734 WRITE_COEF(0x2e, 0xacf0),
4735 {}
4736 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004737 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004738 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4739 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4740 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4741 {}
4742 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004743 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004744 WRITE_COEF(0xb7, 0x802b),
4745 WRITE_COEF(0xb5, 0x1040),
4746 UPDATE_COEF(0xc3, 0, 1<<12),
4747 {}
4748 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004749 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004750 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4751 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4752 UPDATE_COEF(0x63, 3<<14, 0),
4753 {}
4754 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004755 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004756 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4757 UPDATE_COEF(0x4a, 0x0010, 0),
4758 UPDATE_COEF(0x6b, 0xf000, 0),
4759 {}
4760 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004761
Takashi Iwai7639a062015-03-03 10:07:24 +01004762 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004763 case 0x10ec0255:
4764 alc_write_coef_idx(codec, 0x45, 0xc489);
4765 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004766 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004767 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4768 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004769 case 0x10ec0236:
4770 case 0x10ec0256:
4771 alc_write_coef_idx(codec, 0x45, 0xc489);
4772 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4773 alc_process_coef_fw(codec, coef0256);
4774 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4775 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004776 case 0x10ec0234:
4777 case 0x10ec0274:
4778 case 0x10ec0294:
4779 alc_write_coef_idx(codec, 0x45, 0x4689);
4780 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4781 alc_process_coef_fw(codec, coef0274);
4782 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4783 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004784 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004785 case 0x10ec0283:
4786 alc_write_coef_idx(codec, 0x45, 0xc429);
4787 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004788 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004789 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4790 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004791 case 0x10ec0286:
4792 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004793 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004794 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4795 alc_process_coef_fw(codec, coef0288);
4796 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4797 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004798 case 0x10ec0292:
4799 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004800 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004801 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004802 case 0x10ec0293:
4803 /* Set to TRS mode */
4804 alc_write_coef_idx(codec, 0x45, 0xc429);
4805 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004806 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004807 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4808 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004809 case 0x10ec0867:
4810 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05004811 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004812 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004813 case 0x10ec0662:
4814 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4815 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4816 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004817 case 0x10ec0668:
4818 alc_write_coef_idx(codec, 0x11, 0x0001);
4819 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004820 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004821 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4822 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004823 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004824 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004825 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004826 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004827 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004828 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004829 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004830 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4831 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4832 alc_process_coef_fw(codec, coef0225);
4833 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4834 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004835 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004836 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004837}
4838
4839static void alc_headset_mode_default(struct hda_codec *codec)
4840{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004841 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004842 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4843 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4844 UPDATE_COEF(0x49, 3<<8, 0<<8),
4845 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4846 UPDATE_COEF(0x63, 3<<14, 0),
4847 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004848 {}
4849 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004850 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004851 WRITE_COEF(0x45, 0xc089),
4852 WRITE_COEF(0x45, 0xc489),
4853 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4854 WRITE_COEF(0x49, 0x0049),
4855 {}
4856 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004857 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004858 WRITE_COEF(0x45, 0xc489),
4859 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4860 WRITE_COEF(0x49, 0x0049),
4861 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4862 WRITE_COEF(0x06, 0x6100),
4863 {}
4864 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004865 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004866 WRITE_COEF(0x06, 0x2100),
4867 WRITE_COEF(0x32, 0x4ea3),
4868 {}
4869 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004870 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004871 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4872 UPDATE_COEF(0x50, 0x2000, 0x2000),
4873 UPDATE_COEF(0x56, 0x0006, 0x0006),
4874 UPDATE_COEF(0x66, 0x0008, 0),
4875 UPDATE_COEF(0x67, 0x2000, 0),
4876 {}
4877 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004878 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004879 WRITE_COEF(0x76, 0x000e),
4880 WRITE_COEF(0x6c, 0x2400),
4881 WRITE_COEF(0x6b, 0xc429),
4882 WRITE_COEF(0x18, 0x7308),
4883 {}
4884 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004885 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004886 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4887 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4888 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4889 {}
4890 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004891 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004892 WRITE_COEF(0x11, 0x0041),
4893 WRITE_COEF(0x15, 0x0d40),
4894 WRITE_COEF(0xb7, 0x802b),
4895 {}
4896 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004897 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004898 WRITE_COEF(0x45, 0x4289),
4899 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4900 UPDATE_COEF(0x6b, 0x0f00, 0),
4901 UPDATE_COEF(0x49, 0x0300, 0x0300),
4902 {}
4903 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004904
Takashi Iwai7639a062015-03-03 10:07:24 +01004905 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004906 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004907 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004908 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004909 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004910 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004911 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004912 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004913 alc_process_coef_fw(codec, coef0225);
4914 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004915 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004916 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004917 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004918 case 0x10ec0236:
4919 case 0x10ec0256:
4920 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4921 alc_write_coef_idx(codec, 0x45, 0xc089);
4922 msleep(50);
4923 alc_process_coef_fw(codec, coef0256);
4924 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004925 case 0x10ec0234:
4926 case 0x10ec0274:
4927 case 0x10ec0294:
4928 alc_process_coef_fw(codec, coef0274);
4929 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004930 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004931 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004932 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004933 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004934 case 0x10ec0286:
4935 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004936 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004937 alc_process_coef_fw(codec, coef0288);
4938 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004939 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004940 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004941 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004942 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004943 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004944 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004945 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004946 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004947 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004948 case 0x10ec0867:
4949 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4950 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004951 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004952 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004953}
4954
4955/* Iphone type */
4956static void alc_headset_mode_ctia(struct hda_codec *codec)
4957{
Kailang Yang89542932017-07-17 15:03:43 +08004958 int val;
4959
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004960 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004961 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4962 WRITE_COEF(0x1b, 0x0c2b),
4963 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4964 {}
4965 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004966 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004967 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08004968 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08004969 {}
4970 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004971 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004972 WRITE_COEF(0x45, 0xd429),
4973 WRITE_COEF(0x1b, 0x0c2b),
4974 WRITE_COEF(0x32, 0x4ea3),
4975 {}
4976 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004977 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004978 UPDATE_COEF(0x50, 0x2000, 0x2000),
4979 UPDATE_COEF(0x56, 0x0006, 0x0006),
4980 UPDATE_COEF(0x66, 0x0008, 0),
4981 UPDATE_COEF(0x67, 0x2000, 0),
4982 {}
4983 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004984 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004985 WRITE_COEF(0x6b, 0xd429),
4986 WRITE_COEF(0x76, 0x0008),
4987 WRITE_COEF(0x18, 0x7388),
4988 {}
4989 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004990 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004991 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4992 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4993 {}
4994 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004995 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004996 WRITE_COEF(0x11, 0x0001),
4997 WRITE_COEF(0x15, 0x0d60),
4998 WRITE_COEF(0xc3, 0x0000),
4999 {}
5000 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005001 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005002 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005003 UPDATE_COEF(0x63, 3<<14, 2<<14),
5004 {}
5005 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005006 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005007 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5008 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005009 {}
5010 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005011
Takashi Iwai7639a062015-03-03 10:07:24 +01005012 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005013 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005014 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005015 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005016 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005017 case 0x10ec0256:
5018 alc_process_coef_fw(codec, coef0256);
5019 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005020 case 0x10ec0234:
5021 case 0x10ec0274:
5022 case 0x10ec0294:
5023 alc_write_coef_idx(codec, 0x45, 0xd689);
5024 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005025 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005026 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005027 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005028 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005029 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005030 val = alc_read_coef_idx(codec, 0x50);
5031 if (val & (1 << 12)) {
5032 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5033 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5034 msleep(300);
5035 } else {
5036 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5037 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5038 msleep(300);
5039 }
5040 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005041 case 0x10ec0286:
5042 case 0x10ec0288:
5043 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5044 msleep(300);
5045 alc_process_coef_fw(codec, coef0288);
5046 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005047 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005048 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005049 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005050 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005051 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005052 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005053 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005054 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005055 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005056 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005057 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005058 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005059 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005060 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005061 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005062 val = alc_read_coef_idx(codec, 0x45);
5063 if (val & (1 << 9))
5064 alc_process_coef_fw(codec, coef0225_2);
5065 else
5066 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005067 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005068 case 0x10ec0867:
5069 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5070 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005071 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005072 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005073}
5074
5075/* Nokia type */
5076static void alc_headset_mode_omtp(struct hda_codec *codec)
5077{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005078 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005079 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5080 WRITE_COEF(0x1b, 0x0c2b),
5081 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5082 {}
5083 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005084 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005085 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005086 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005087 {}
5088 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005089 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005090 WRITE_COEF(0x45, 0xe429),
5091 WRITE_COEF(0x1b, 0x0c2b),
5092 WRITE_COEF(0x32, 0x4ea3),
5093 {}
5094 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005095 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005096 UPDATE_COEF(0x50, 0x2000, 0x2000),
5097 UPDATE_COEF(0x56, 0x0006, 0x0006),
5098 UPDATE_COEF(0x66, 0x0008, 0),
5099 UPDATE_COEF(0x67, 0x2000, 0),
5100 {}
5101 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005102 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005103 WRITE_COEF(0x6b, 0xe429),
5104 WRITE_COEF(0x76, 0x0008),
5105 WRITE_COEF(0x18, 0x7388),
5106 {}
5107 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005108 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005109 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5110 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5111 {}
5112 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005113 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005114 WRITE_COEF(0x11, 0x0001),
5115 WRITE_COEF(0x15, 0x0d50),
5116 WRITE_COEF(0xc3, 0x0000),
5117 {}
5118 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005119 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005120 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005121 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005122 {}
5123 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005124
Takashi Iwai7639a062015-03-03 10:07:24 +01005125 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005126 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005127 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005128 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005129 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005130 case 0x10ec0256:
5131 alc_process_coef_fw(codec, coef0256);
5132 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005133 case 0x10ec0234:
5134 case 0x10ec0274:
5135 case 0x10ec0294:
5136 alc_write_coef_idx(codec, 0x45, 0xe689);
5137 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005138 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005139 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005140 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005141 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005142 case 0x10ec0298:
5143 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005144 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5145 msleep(300);
5146 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005147 case 0x10ec0286:
5148 case 0x10ec0288:
5149 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5150 msleep(300);
5151 alc_process_coef_fw(codec, coef0288);
5152 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005153 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005154 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005155 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005156 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005157 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005158 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005159 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005160 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005161 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005162 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005163 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005164 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005165 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005166 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005167 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005168 alc_process_coef_fw(codec, coef0225);
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 Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005172}
5173
5174static void alc_determine_headset_type(struct hda_codec *codec)
5175{
5176 int val;
5177 bool is_ctia = false;
5178 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005179 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005180 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5181 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5182 conteol) */
5183 {}
5184 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005185 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005186 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5187 {}
5188 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005189 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005190 UPDATE_COEF(0x50, 0x2000, 0x2000),
5191 UPDATE_COEF(0x56, 0x0006, 0x0006),
5192 UPDATE_COEF(0x66, 0x0008, 0),
5193 UPDATE_COEF(0x67, 0x2000, 0),
5194 UPDATE_COEF(0x19, 0x1300, 0x1300),
5195 {}
5196 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005197 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005198 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5199 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5200 {}
5201 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005202 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005203 WRITE_COEF(0x11, 0x0001),
5204 WRITE_COEF(0xb7, 0x802b),
5205 WRITE_COEF(0x15, 0x0d60),
5206 WRITE_COEF(0xc3, 0x0c00),
5207 {}
5208 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005209 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005210 UPDATE_COEF(0x4a, 0x0010, 0),
5211 UPDATE_COEF(0x4a, 0x8000, 0),
5212 WRITE_COEF(0x45, 0xd289),
5213 UPDATE_COEF(0x49, 0x0300, 0x0300),
5214 {}
5215 };
David Henningsson73bdd592013-04-15 15:44:14 +02005216
Kailang Yang92666d42020-11-19 17:04:21 +08005217 if (spec->no_internal_mic_pin) {
5218 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5219 return;
5220 }
5221
Takashi Iwai7639a062015-03-03 10:07:24 +01005222 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005223 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005224 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005225 msleep(300);
5226 val = alc_read_coef_idx(codec, 0x46);
5227 is_ctia = (val & 0x0070) == 0x0070;
5228 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08005229 case 0x10ec0236:
5230 case 0x10ec0256:
5231 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5232 alc_write_coef_idx(codec, 0x06, 0x6104);
5233 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5234
5235 snd_hda_codec_write(codec, 0x21, 0,
5236 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5237 msleep(80);
5238 snd_hda_codec_write(codec, 0x21, 0,
5239 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5240
5241 alc_process_coef_fw(codec, coef0255);
5242 msleep(300);
5243 val = alc_read_coef_idx(codec, 0x46);
5244 is_ctia = (val & 0x0070) == 0x0070;
5245
5246 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5247 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5248
5249 snd_hda_codec_write(codec, 0x21, 0,
5250 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5251 msleep(80);
5252 snd_hda_codec_write(codec, 0x21, 0,
5253 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5254 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005255 case 0x10ec0234:
5256 case 0x10ec0274:
5257 case 0x10ec0294:
5258 alc_process_coef_fw(codec, coef0274);
Hui Wangfebf22562021-03-20 17:15:41 +08005259 msleep(850);
Kailang Yang71683c32017-06-20 16:33:50 +08005260 val = alc_read_coef_idx(codec, 0x46);
5261 is_ctia = (val & 0x00f0) == 0x00f0;
5262 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005263 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005264 case 0x10ec0283:
5265 alc_write_coef_idx(codec, 0x45, 0xd029);
5266 msleep(300);
5267 val = alc_read_coef_idx(codec, 0x46);
5268 is_ctia = (val & 0x0070) == 0x0070;
5269 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005270 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005271 snd_hda_codec_write(codec, 0x21, 0,
5272 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5273 msleep(100);
5274 snd_hda_codec_write(codec, 0x21, 0,
5275 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5276 msleep(200);
5277
5278 val = alc_read_coef_idx(codec, 0x50);
5279 if (val & (1 << 12)) {
5280 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5281 alc_process_coef_fw(codec, coef0288);
5282 msleep(350);
5283 val = alc_read_coef_idx(codec, 0x50);
5284 is_ctia = (val & 0x0070) == 0x0070;
5285 } else {
5286 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5287 alc_process_coef_fw(codec, coef0288);
5288 msleep(350);
5289 val = alc_read_coef_idx(codec, 0x50);
5290 is_ctia = (val & 0x0070) == 0x0070;
5291 }
5292 alc_process_coef_fw(codec, coef0298);
5293 snd_hda_codec_write(codec, 0x21, 0,
5294 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5295 msleep(75);
5296 snd_hda_codec_write(codec, 0x21, 0,
5297 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5298 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005299 case 0x10ec0286:
5300 case 0x10ec0288:
5301 alc_process_coef_fw(codec, coef0288);
5302 msleep(350);
5303 val = alc_read_coef_idx(codec, 0x50);
5304 is_ctia = (val & 0x0070) == 0x0070;
5305 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005306 case 0x10ec0292:
5307 alc_write_coef_idx(codec, 0x6b, 0xd429);
5308 msleep(300);
5309 val = alc_read_coef_idx(codec, 0x6c);
5310 is_ctia = (val & 0x001c) == 0x001c;
5311 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005312 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005313 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005314 msleep(300);
5315 val = alc_read_coef_idx(codec, 0x46);
5316 is_ctia = (val & 0x0070) == 0x0070;
5317 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005318 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005319 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005320 msleep(300);
5321 val = alc_read_coef_idx(codec, 0xbe);
5322 is_ctia = (val & 0x1c02) == 0x1c02;
5323 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005324 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005325 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005326 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005327 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005328 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005329 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005330 snd_hda_codec_write(codec, 0x21, 0,
5331 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5332 msleep(80);
5333 snd_hda_codec_write(codec, 0x21, 0,
5334 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5335
Kailang Yang5a367672017-07-21 15:23:53 +08005336 alc_process_coef_fw(codec, alc225_pre_hsmode);
5337 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5338 val = alc_read_coef_idx(codec, 0x45);
5339 if (val & (1 << 9)) {
5340 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5341 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5342 msleep(800);
5343 val = alc_read_coef_idx(codec, 0x46);
5344 is_ctia = (val & 0x00f0) == 0x00f0;
5345 } else {
5346 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5347 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5348 msleep(800);
5349 val = alc_read_coef_idx(codec, 0x46);
5350 is_ctia = (val & 0x00f0) == 0x00f0;
5351 }
5352 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5353 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5354 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005355
5356 snd_hda_codec_write(codec, 0x21, 0,
5357 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5358 msleep(80);
5359 snd_hda_codec_write(codec, 0x21, 0,
5360 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005361 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005362 case 0x10ec0867:
5363 is_ctia = true;
5364 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005365 }
5366
Takashi Iwai4e76a882014-02-25 12:21:03 +01005367 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005368 is_ctia ? "yes" : "no");
5369 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5370}
5371
5372static void alc_update_headset_mode(struct hda_codec *codec)
5373{
5374 struct alc_spec *spec = codec->spec;
5375
5376 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005377 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005378
5379 int new_headset_mode;
5380
5381 if (!snd_hda_jack_detect(codec, hp_pin))
5382 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5383 else if (mux_pin == spec->headset_mic_pin)
5384 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5385 else if (mux_pin == spec->headphone_mic_pin)
5386 new_headset_mode = ALC_HEADSET_MODE_MIC;
5387 else
5388 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5389
David Henningsson5959a6b2013-11-12 11:10:57 +01005390 if (new_headset_mode == spec->current_headset_mode) {
5391 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005392 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005393 }
David Henningsson73bdd592013-04-15 15:44:14 +02005394
5395 switch (new_headset_mode) {
5396 case ALC_HEADSET_MODE_UNPLUGGED:
5397 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005398 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5399 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005400 spec->gen.hp_jack_present = false;
5401 break;
5402 case ALC_HEADSET_MODE_HEADSET:
5403 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5404 alc_determine_headset_type(codec);
5405 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5406 alc_headset_mode_ctia(codec);
5407 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5408 alc_headset_mode_omtp(codec);
5409 spec->gen.hp_jack_present = true;
5410 break;
5411 case ALC_HEADSET_MODE_MIC:
5412 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5413 spec->gen.hp_jack_present = false;
5414 break;
5415 case ALC_HEADSET_MODE_HEADPHONE:
5416 alc_headset_mode_default(codec);
5417 spec->gen.hp_jack_present = true;
5418 break;
5419 }
5420 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5421 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5422 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005423 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005424 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5425 PIN_VREFHIZ);
5426 }
5427 spec->current_headset_mode = new_headset_mode;
5428
5429 snd_hda_gen_update_outputs(codec);
5430}
5431
5432static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005433 struct snd_kcontrol *kcontrol,
5434 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005435{
5436 alc_update_headset_mode(codec);
5437}
5438
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005439static void alc_update_headset_jack_cb(struct hda_codec *codec,
5440 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005441{
David Henningsson73bdd592013-04-15 15:44:14 +02005442 snd_hda_gen_hp_automute(codec, jack);
Hui Wange54f30b2021-03-20 17:15:42 +08005443 alc_update_headset_mode(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005444}
5445
5446static void alc_probe_headset_mode(struct hda_codec *codec)
5447{
5448 int i;
5449 struct alc_spec *spec = codec->spec;
5450 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5451
5452 /* Find mic pins */
5453 for (i = 0; i < cfg->num_inputs; i++) {
5454 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5455 spec->headset_mic_pin = cfg->inputs[i].pin;
5456 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5457 spec->headphone_mic_pin = cfg->inputs[i].pin;
5458 }
5459
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005460 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005461 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5462 spec->gen.automute_hook = alc_update_headset_mode;
5463 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5464}
5465
5466static void alc_fixup_headset_mode(struct hda_codec *codec,
5467 const struct hda_fixup *fix, int action)
5468{
5469 struct alc_spec *spec = codec->spec;
5470
5471 switch (action) {
5472 case HDA_FIXUP_ACT_PRE_PROBE:
5473 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5474 break;
5475 case HDA_FIXUP_ACT_PROBE:
5476 alc_probe_headset_mode(codec);
5477 break;
5478 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005479 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5480 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5481 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5482 }
David Henningsson73bdd592013-04-15 15:44:14 +02005483 alc_update_headset_mode(codec);
5484 break;
5485 }
5486}
5487
5488static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5489 const struct hda_fixup *fix, int action)
5490{
5491 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5492 struct alc_spec *spec = codec->spec;
5493 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5494 }
5495 else
5496 alc_fixup_headset_mode(codec, fix, action);
5497}
5498
Kailang Yang31278992014-03-03 15:27:22 +08005499static void alc255_set_default_jack_type(struct hda_codec *codec)
5500{
5501 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005502 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005503 WRITE_COEF(0x1b, 0x880b),
5504 WRITE_COEF(0x45, 0xd089),
5505 WRITE_COEF(0x1b, 0x080b),
5506 WRITE_COEF(0x46, 0x0004),
5507 WRITE_COEF(0x1b, 0x0c0b),
5508 {}
5509 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005510 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005511 WRITE_COEF(0x1b, 0x884b),
5512 WRITE_COEF(0x45, 0xd089),
5513 WRITE_COEF(0x1b, 0x084b),
5514 WRITE_COEF(0x46, 0x0004),
5515 WRITE_COEF(0x1b, 0x0c4b),
5516 {}
5517 };
5518 switch (codec->core.vendor_id) {
5519 case 0x10ec0255:
5520 alc_process_coef_fw(codec, alc255fw);
5521 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005522 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005523 case 0x10ec0256:
5524 alc_process_coef_fw(codec, alc256fw);
5525 break;
5526 }
Kailang Yang31278992014-03-03 15:27:22 +08005527 msleep(30);
5528}
5529
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005530static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5531 const struct hda_fixup *fix, int action)
5532{
5533 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005534 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005535 }
5536 alc_fixup_headset_mode(codec, fix, action);
5537}
5538
Kailang Yang31278992014-03-03 15:27:22 +08005539static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5540 const struct hda_fixup *fix, int action)
5541{
5542 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5543 struct alc_spec *spec = codec->spec;
5544 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5545 alc255_set_default_jack_type(codec);
5546 }
5547 else
5548 alc_fixup_headset_mode(codec, fix, action);
5549}
5550
Kailang Yange1e62b92015-04-08 16:01:22 +08005551static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5552 struct hda_jack_callback *jack)
5553{
5554 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005555
5556 alc_update_headset_jack_cb(codec, jack);
5557 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005558 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005559}
5560
5561static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5562 const struct hda_fixup *fix, int action)
5563{
5564 alc_fixup_headset_mode(codec, fix, action);
5565 if (action == HDA_FIXUP_ACT_PROBE) {
5566 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005567 /* toggled via hp_automute_hook */
5568 spec->gpio_mask |= 0x40;
5569 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005570 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5571 }
5572}
5573
Hui Wang493a52a2014-01-14 14:07:36 +08005574static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5575 const struct hda_fixup *fix, int action)
5576{
5577 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5578 struct alc_spec *spec = codec->spec;
5579 spec->gen.auto_mute_via_amp = 1;
5580 }
5581}
5582
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005583static void alc_fixup_no_shutup(struct hda_codec *codec,
5584 const struct hda_fixup *fix, int action)
5585{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005586 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005587 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005588 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005589 }
5590}
5591
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005592static void alc_fixup_disable_aamix(struct hda_codec *codec,
5593 const struct hda_fixup *fix, int action)
5594{
5595 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5596 struct alc_spec *spec = codec->spec;
5597 /* Disable AA-loopback as it causes white noise */
5598 spec->gen.mixer_nid = 0;
5599 }
5600}
5601
Takashi Iwai7f57d802015-09-24 17:36:51 +02005602/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5603static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5604 const struct hda_fixup *fix, int action)
5605{
5606 static const struct hda_pintbl pincfgs[] = {
5607 { 0x16, 0x21211010 }, /* dock headphone */
5608 { 0x19, 0x21a11010 }, /* dock mic */
5609 { }
5610 };
5611 struct alc_spec *spec = codec->spec;
5612
5613 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Hui Wang871b9062019-08-14 12:09:08 +08005614 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02005615 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5616 codec->power_save_node = 0; /* avoid click noises */
5617 snd_hda_apply_pincfgs(codec, pincfgs);
5618 }
5619}
5620
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005621static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5622 const struct hda_fixup *fix, int action)
5623{
5624 static const struct hda_pintbl pincfgs[] = {
5625 { 0x17, 0x21211010 }, /* dock headphone */
5626 { 0x19, 0x21a11010 }, /* dock mic */
5627 { }
5628 };
5629 struct alc_spec *spec = codec->spec;
5630
5631 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5632 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005633 snd_hda_apply_pincfgs(codec, pincfgs);
5634 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005635 /* Enable DOCK device */
5636 snd_hda_codec_write(codec, 0x17, 0,
5637 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5638 /* Enable DOCK device */
5639 snd_hda_codec_write(codec, 0x19, 0,
5640 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005641 }
5642}
5643
Takashi Iwai399c01a2020-05-26 08:24:06 +02005644static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5645 const struct hda_fixup *fix, int action)
5646{
5647 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5648 * the speaker output becomes too low by some reason on Thinkpads with
5649 * ALC298 codec
5650 */
5651 static const hda_nid_t preferred_pairs[] = {
5652 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5653 0
5654 };
5655 struct alc_spec *spec = codec->spec;
5656
5657 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5658 spec->gen.preferred_dacs = preferred_pairs;
5659}
5660
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005661static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005662{
5663 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005664 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005665
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005666 /* Prevent pop noises when headphones are plugged in */
5667 snd_hda_codec_write(codec, hp_pin, 0,
5668 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5669 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005670}
5671
5672static void alc_fixup_dell_xps13(struct hda_codec *codec,
5673 const struct hda_fixup *fix, int action)
5674{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005675 struct alc_spec *spec = codec->spec;
5676 struct hda_input_mux *imux = &spec->gen.input_mux;
5677 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005678
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005679 switch (action) {
5680 case HDA_FIXUP_ACT_PRE_PROBE:
5681 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5682 * it causes a click noise at start up
5683 */
5684 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005685 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005686 break;
5687 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005688 /* Make the internal mic the default input source. */
5689 for (i = 0; i < imux->num_items; i++) {
5690 if (spec->gen.imux_pins[i] == 0x12) {
5691 spec->gen.cur_mux[0] = i;
5692 break;
5693 }
5694 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005695 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005696 }
5697}
5698
David Henningsson1f8b46c2015-05-12 14:38:15 +02005699static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5700 const struct hda_fixup *fix, int action)
5701{
5702 struct alc_spec *spec = codec->spec;
5703
5704 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5705 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5706 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005707
5708 /* Disable boost for mic-in permanently. (This code is only called
5709 from quirks that guarantee that the headphone is at NID 0x1b.) */
5710 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5711 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005712 } else
5713 alc_fixup_headset_mode(codec, fix, action);
5714}
5715
David Henningsson73bdd592013-04-15 15:44:14 +02005716static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5717 const struct hda_fixup *fix, int action)
5718{
5719 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005720 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005721 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005722 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5723 }
5724 alc_fixup_headset_mode(codec, fix, action);
5725}
5726
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005727/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5728static int find_ext_mic_pin(struct hda_codec *codec)
5729{
5730 struct alc_spec *spec = codec->spec;
5731 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5732 hda_nid_t nid;
5733 unsigned int defcfg;
5734 int i;
5735
5736 for (i = 0; i < cfg->num_inputs; i++) {
5737 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5738 continue;
5739 nid = cfg->inputs[i].pin;
5740 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5741 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5742 continue;
5743 return nid;
5744 }
5745
5746 return 0;
5747}
5748
Dylan Reid08a978d2012-11-18 22:56:40 -08005749static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005750 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005751 int action)
5752{
5753 struct alc_spec *spec = codec->spec;
5754
Takashi Iwai0db75792013-01-23 13:57:20 +01005755 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005756 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005757 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005758
5759 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005760 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005761 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005762 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005763}
David Henningsson693b6132012-06-22 19:12:10 +02005764
David Henningsson3e0d6112013-04-22 14:30:14 +02005765static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5766 const struct hda_fixup *fix,
5767 int action)
5768{
5769 struct alc_spec *spec = codec->spec;
5770 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5771 int i;
5772
5773 /* The mic boosts on level 2 and 3 are too noisy
5774 on the internal mic input.
5775 Therefore limit the boost to 0 or 1. */
5776
5777 if (action != HDA_FIXUP_ACT_PROBE)
5778 return;
5779
5780 for (i = 0; i < cfg->num_inputs; i++) {
5781 hda_nid_t nid = cfg->inputs[i].pin;
5782 unsigned int defcfg;
5783 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5784 continue;
5785 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5786 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5787 continue;
5788
5789 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5790 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5791 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5792 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5793 (0 << AC_AMPCAP_MUTE_SHIFT));
5794 }
5795}
5796
Kailang Yangcd217a62013-08-22 10:15:24 +02005797static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005798 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005799{
5800 struct alc_spec *spec = codec->spec;
5801 int vref;
5802
5803 msleep(200);
5804 snd_hda_gen_hp_automute(codec, jack);
5805
5806 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5807
5808 msleep(600);
5809 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5810 vref);
5811}
5812
Kailang Yangcd217a62013-08-22 10:15:24 +02005813static void alc283_fixup_chromebook(struct hda_codec *codec,
5814 const struct hda_fixup *fix, int action)
5815{
5816 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005817
5818 switch (action) {
5819 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005820 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005821 /* Disable AA-loopback as it causes white noise */
5822 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005823 break;
5824 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005825 /* MIC2-VREF control */
5826 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005827 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005828 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005829 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005830 break;
5831 }
5832}
5833
5834static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5835 const struct hda_fixup *fix, int action)
5836{
5837 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005838
5839 switch (action) {
5840 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005841 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5842 break;
5843 case HDA_FIXUP_ACT_INIT:
5844 /* MIC2-VREF control */
5845 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005846 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005847 break;
5848 }
5849}
5850
Takashi Iwai7bba2152013-09-06 15:45:38 +02005851/* mute tablet speaker pin (0x14) via dock plugging in addition */
5852static void asus_tx300_automute(struct hda_codec *codec)
5853{
5854 struct alc_spec *spec = codec->spec;
5855 snd_hda_gen_update_outputs(codec);
5856 if (snd_hda_jack_detect(codec, 0x1b))
5857 spec->gen.mute_bits |= (1ULL << 0x14);
5858}
5859
5860static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5861 const struct hda_fixup *fix, int action)
5862{
5863 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005864 static const struct hda_pintbl dock_pins[] = {
5865 { 0x1b, 0x21114000 }, /* dock speaker pin */
5866 {}
5867 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005868
5869 switch (action) {
5870 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005871 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02005872 /* TX300 needs to set up GPIO2 for the speaker amp */
5873 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02005874 snd_hda_apply_pincfgs(codec, dock_pins);
5875 spec->gen.auto_mute_via_amp = 1;
5876 spec->gen.automute_hook = asus_tx300_automute;
5877 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005878 snd_hda_gen_hp_automute);
5879 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005880 case HDA_FIXUP_ACT_PROBE:
5881 spec->init_amp = ALC_INIT_DEFAULT;
5882 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005883 case HDA_FIXUP_ACT_BUILD:
5884 /* this is a bit tricky; give more sane names for the main
5885 * (tablet) speaker and the dock speaker, respectively
5886 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005887 rename_ctl(codec, "Speaker Playback Switch",
5888 "Dock Speaker Playback Switch");
5889 rename_ctl(codec, "Bass Speaker Playback Switch",
5890 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005891 break;
5892 }
5893}
5894
David Henningsson338cae52013-10-07 10:39:59 +02005895static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5896 const struct hda_fixup *fix, int action)
5897{
David Henningsson0f4881d2013-12-20 16:08:13 +01005898 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5899 /* DAC node 0x03 is giving mono output. We therefore want to
5900 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5901 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005902 static const hda_nid_t conn1[] = { 0x0c };
5903 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
5904 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01005905 }
David Henningsson338cae52013-10-07 10:39:59 +02005906}
5907
Hui Wangdd9aa332016-08-01 10:20:32 +08005908static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5909 const struct hda_fixup *fix, int action)
5910{
5911 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5912 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5913 we can't adjust the speaker's volume since this node does not has
5914 Amp-out capability. we change the speaker's route to:
5915 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5916 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5917 speaker's volume now. */
5918
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005919 static const hda_nid_t conn1[] = { 0x0c };
5920 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08005921 }
5922}
5923
Takashi Iwaie312a862018-03-06 12:14:17 +01005924/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5925static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5926 const struct hda_fixup *fix, int action)
5927{
5928 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005929 static const hda_nid_t conn[] = { 0x02, 0x03 };
5930 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01005931 }
5932}
5933
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01005934/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
5935static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
5936 const struct hda_fixup *fix, int action)
5937{
5938 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005939 static const hda_nid_t conn[] = { 0x02 };
5940 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01005941 }
5942}
5943
Keith Packard98973f22015-07-15 12:14:39 -07005944/* Hook to update amp GPIO4 for automute */
5945static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5946 struct hda_jack_callback *jack)
5947{
5948 struct alc_spec *spec = codec->spec;
5949
5950 snd_hda_gen_hp_automute(codec, jack);
5951 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08005952 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
5953 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07005954}
5955
5956/* Manage GPIOs for HP EliteBook Folio 9480m.
5957 *
5958 * GPIO4 is the headphone amplifier power control
5959 * GPIO3 is the audio output mute indicator LED
5960 */
5961
5962static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5963 const struct hda_fixup *fix,
5964 int action)
5965{
5966 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07005967
Takashi Iwai01e4a272018-06-19 22:47:30 +02005968 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07005969 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02005970 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5971 spec->gpio_mask |= 0x10;
5972 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07005973 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07005974 }
5975}
5976
Takashi Iwaiae065f12018-06-19 23:00:03 +02005977static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5978 const struct hda_fixup *fix,
5979 int action)
5980{
5981 struct alc_spec *spec = codec->spec;
5982
5983 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5984 spec->gpio_mask |= 0x04;
5985 spec->gpio_dir |= 0x04;
5986 /* set data bit low */
5987 }
5988}
5989
Takashi Iwai6a6660d2020-09-03 10:33:00 +02005990/* Quirk for Thinkpad X1 7th and 8th Gen
5991 * The following fixed routing needed
5992 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
5993 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
5994 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
5995 */
5996static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
5997 const struct hda_fixup *fix, int action)
5998{
5999 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6000 static const hda_nid_t preferred_pairs[] = {
6001 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6002 };
6003 struct alc_spec *spec = codec->spec;
6004
6005 switch (action) {
6006 case HDA_FIXUP_ACT_PRE_PROBE:
6007 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6008 spec->gen.preferred_dacs = preferred_pairs;
6009 break;
6010 case HDA_FIXUP_ACT_BUILD:
6011 /* The generic parser creates somewhat unintuitive volume ctls
6012 * with the fixed routing above, and the shared DAC2 may be
6013 * confusing for PA.
6014 * Rename those to unique names so that PA doesn't touch them
6015 * and use only Master volume.
6016 */
6017 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6018 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6019 break;
6020 }
6021}
6022
Kailang Yangca169cc2017-04-25 16:17:40 +08006023static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6024 const struct hda_fixup *fix,
6025 int action)
6026{
6027 alc_fixup_dual_codecs(codec, fix, action);
6028 switch (action) {
6029 case HDA_FIXUP_ACT_PRE_PROBE:
6030 /* override card longname to provide a unique UCM profile */
6031 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6032 break;
6033 case HDA_FIXUP_ACT_BUILD:
6034 /* rename Capture controls depending on the codec */
6035 rename_ctl(codec, "Capture Volume",
6036 codec->addr == 0 ?
6037 "Rear-Panel Capture Volume" :
6038 "Front-Panel Capture Volume");
6039 rename_ctl(codec, "Capture Switch",
6040 codec->addr == 0 ?
6041 "Rear-Panel Capture Switch" :
6042 "Front-Panel Capture Switch");
6043 break;
6044 }
6045}
6046
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006047static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6048 const struct hda_fixup *fix, int action)
6049{
6050 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6051 return;
6052
6053 codec->power_save_node = 1;
6054}
6055
Kailang Yang92266652017-12-14 15:28:58 +08006056/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6057static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6058 const struct hda_fixup *fix, int action)
6059{
6060 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006061 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08006062 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6063 0
6064 };
6065
6066 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6067 return;
6068
6069 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08006070 spec->gen.auto_mute_via_amp = 1;
6071 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08006072}
6073
Takashi Iwaic84bfed2020-11-27 15:11:04 +01006074/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6075static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6076 const struct hda_fixup *fix, int action)
6077{
6078 static const hda_nid_t preferred_pairs[] = {
6079 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6080 };
6081 struct alc_spec *spec = codec->spec;
6082
6083 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6084 spec->gen.preferred_dacs = preferred_pairs;
6085 spec->gen.obey_preferred_dacs = 1;
6086 }
6087}
6088
Hui Wangc4cfcf62018-11-26 14:17:16 +08006089/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6090static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6091 const struct hda_fixup *fix, int action)
6092{
6093 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6094 return;
6095
6096 snd_hda_override_wcaps(codec, 0x03, 0);
6097}
6098
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006099static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6100{
6101 switch (codec->core.vendor_id) {
6102 case 0x10ec0274:
6103 case 0x10ec0294:
6104 case 0x10ec0225:
6105 case 0x10ec0295:
6106 case 0x10ec0299:
6107 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6108 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6109 break;
6110 case 0x10ec0235:
6111 case 0x10ec0236:
6112 case 0x10ec0255:
6113 case 0x10ec0256:
6114 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6115 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6116 break;
6117 }
6118}
6119
Kailang Yang8983eb62019-04-03 15:31:49 +08006120static void alc295_fixup_chromebook(struct hda_codec *codec,
6121 const struct hda_fixup *fix, int action)
6122{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006123 struct alc_spec *spec = codec->spec;
6124
Kailang Yang8983eb62019-04-03 15:31:49 +08006125 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006126 case HDA_FIXUP_ACT_PRE_PROBE:
6127 spec->ultra_low_power = true;
6128 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006129 case HDA_FIXUP_ACT_INIT:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006130 alc_combo_jack_hp_jd_restart(codec);
Kailang Yang8983eb62019-04-03 15:31:49 +08006131 break;
6132 }
6133}
6134
Kailang Yangd1dd4212019-01-09 17:05:24 +08006135static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6136 const struct hda_fixup *fix, int action)
6137{
6138 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6139 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6140}
6141
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006142
6143static void alc294_gx502_toggle_output(struct hda_codec *codec,
6144 struct hda_jack_callback *cb)
6145{
6146 /* The Windows driver sets the codec up in a very different way where
6147 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6148 */
6149 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6150 alc_write_coef_idx(codec, 0x10, 0x8a20);
6151 else
6152 alc_write_coef_idx(codec, 0x10, 0x0a20);
6153}
6154
6155static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6156 const struct hda_fixup *fix, int action)
6157{
6158 /* Pin 0x21: headphones/headset mic */
6159 if (!is_jack_detectable(codec, 0x21))
6160 return;
6161
6162 switch (action) {
6163 case HDA_FIXUP_ACT_PRE_PROBE:
6164 snd_hda_jack_detect_enable_callback(codec, 0x21,
6165 alc294_gx502_toggle_output);
6166 break;
6167 case HDA_FIXUP_ACT_INIT:
6168 /* Make sure to start in a correct state, i.e. if
6169 * headphones have been plugged in before powering up the system
6170 */
6171 alc294_gx502_toggle_output(codec, NULL);
6172 break;
6173 }
6174}
6175
Kailang Yang56496252020-07-29 15:09:27 +08006176static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6177 const struct hda_fixup *fix, int action)
6178{
6179 if (action != HDA_FIXUP_ACT_INIT)
6180 return;
6181
6182 msleep(100);
6183 alc_write_coef_idx(codec, 0x65, 0x0);
6184}
6185
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006186static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6187 const struct hda_fixup *fix, int action)
6188{
6189 switch (action) {
6190 case HDA_FIXUP_ACT_INIT:
6191 alc_combo_jack_hp_jd_restart(codec);
6192 break;
6193 }
6194}
6195
Kailang Yang92666d42020-11-19 17:04:21 +08006196static void alc_fixup_no_int_mic(struct hda_codec *codec,
6197 const struct hda_fixup *fix, int action)
6198{
6199 struct alc_spec *spec = codec->spec;
6200
6201 switch (action) {
6202 case HDA_FIXUP_ACT_PRE_PROBE:
6203 /* Mic RING SLEEVE swap for combo jack */
6204 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6205 spec->no_internal_mic_pin = true;
6206 break;
6207 case HDA_FIXUP_ACT_INIT:
6208 alc_combo_jack_hp_jd_restart(codec);
6209 break;
6210 }
6211}
6212
Takashi Iwaib317b032014-01-08 11:44:21 +01006213/* for hda_fixup_thinkpad_acpi() */
6214#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006215
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006216static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6217 const struct hda_fixup *fix, int action)
6218{
6219 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6220 hda_fixup_thinkpad_acpi(codec, fix, action);
6221}
6222
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006223/* for alc295_fixup_hp_top_speakers */
6224#include "hp_x360_helper.c"
6225
Takashi Iwai1d045db2011-07-07 18:23:21 +02006226enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006227 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006228 ALC269_FIXUP_SONY_VAIO,
6229 ALC275_FIXUP_SONY_VAIO_GPIO2,
6230 ALC269_FIXUP_DELL_M101Z,
6231 ALC269_FIXUP_SKU_IGNORE,
6232 ALC269_FIXUP_ASUS_G73JW,
6233 ALC269_FIXUP_LENOVO_EAPD,
6234 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006235 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006236 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006237 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006238 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006239 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006240 ALC269_FIXUP_QUANTA_MUTE,
6241 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006242 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006243 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006244 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006245 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006246 ALC269_FIXUP_AMIC,
6247 ALC269_FIXUP_DMIC,
6248 ALC269VB_FIXUP_AMIC,
6249 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006250 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006251 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006252 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006253 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006254 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006255 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6256 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006257 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006258 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006259 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006260 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006261 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006262 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006263 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6264 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006265 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006266 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006267 ALC269_FIXUP_HEADSET_MODE,
6268 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006269 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006270 ALC269_FIXUP_ASUS_X101_FUNC,
6271 ALC269_FIXUP_ASUS_X101_VERB,
6272 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006273 ALC271_FIXUP_AMIC_MIC2,
6274 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006275 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006276 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006277 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006278 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006279 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006280 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006281 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006282 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006283 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006284 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006285 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006286 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006287 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6288 ALC290_FIXUP_SUBWOOFER,
6289 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006290 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006291 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006292 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006293 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006294 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006295 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006296 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006297 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006298 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006299 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006300 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006301 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006302 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006303 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01006304 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006305 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006306 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006307 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006308 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006309 ALC280_FIXUP_HP_9480M,
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01006310 ALC245_FIXUP_HP_X360_AMP,
Kailang Yange1e62b92015-04-08 16:01:22 +08006311 ALC288_FIXUP_DELL_HEADSET_MODE,
6312 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006313 ALC288_FIXUP_DELL_XPS_13,
6314 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006315 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006316 ALC292_FIXUP_DELL_E7X,
6317 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006318 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006319 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006320 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006321 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006322 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006323 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006324 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006325 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006326 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006327 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006328 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006329 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006330 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006331 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006332 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006333 ALC298_FIXUP_SPK_VOLUME,
Kailang Yangf86de9b2020-10-23 14:46:47 +08006334 ALC298_FIXUP_LENOVO_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006335 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006336 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006337 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006338 ALC256_FIXUP_ASUS_HEADSET_MODE,
6339 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006340 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006341 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6342 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006343 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006344 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006345 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006346 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006347 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006348 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006349 ALC274_FIXUP_DELL_BIND_DACS,
6350 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006351 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006352 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006353 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006354 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006355 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006356 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006357 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006358 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006359 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006360 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006361 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006362 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006363 ALC294_FIXUP_ASUS_HEADSET_MIC,
6364 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006365 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006366 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006367 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006368 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006369 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006370 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6371 ALC225_FIXUP_WYSE_AUTO_MUTE,
6372 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006373 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006374 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006375 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006376 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006377 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006378 ALC289_FIXUP_DELL_SPK2,
6379 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006380 ALC294_FIXUP_SPK2_TO_DAC1,
6381 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006382 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006383 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006384 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006385 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006386 ALC294_FIXUP_ASUS_GX502_HP,
6387 ALC294_FIXUP_ASUS_GX502_PINS,
6388 ALC294_FIXUP_ASUS_GX502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006389 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006390 ALC285_FIXUP_HP_MUTE_LED,
Jeremy Szue7d66cf2021-03-16 15:46:24 +08006391 ALC236_FIXUP_HP_GPIO_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006392 ALC236_FIXUP_HP_MUTE_LED,
Mike Pozulp14425f12020-05-09 20:28:37 -07006393 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006394 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006395 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006396 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006397 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006398 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006399 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006400 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006401 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006402 ALC269_FIXUP_CZC_B20,
6403 ALC269_FIXUP_CZC_TMI,
6404 ALC269_FIXUP_CZC_L101,
6405 ALC269_FIXUP_LEMOTE_A1802,
6406 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006407 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Werner Sembach73e71612021-03-02 19:04:14 +01006408 ALC256_FIXUP_INTEL_NUC10,
Hui Wangfc19d552020-09-09 10:00:41 +08006409 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006410 ALC274_FIXUP_HP_MIC,
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006411 ALC274_FIXUP_HP_HEADSET_MIC,
Kailang Yangef9ce662020-11-03 15:40:35 +08006412 ALC256_FIXUP_ASUS_HPE,
Kailang Yang446b8182020-11-02 15:00:12 +08006413 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Kailang Yanga0ccbc52020-11-06 15:20:38 +08006414 ALC287_FIXUP_HP_GPIO_LED,
Kailang Yang9e885772020-11-03 15:30:51 +08006415 ALC256_FIXUP_HP_HEADSET_MIC,
Kailang Yang92666d42020-11-19 17:04:21 +08006416 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
Chris Chiu34cdf402020-12-16 20:52:00 +08006417 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
Chris Chiu495dc762021-01-14 16:27:28 +08006418 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
Chris Chiud0e18562021-02-26 09:04:40 +08006419 ALC256_FIXUP_ACER_HEADSET_MIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006420};
6421
Takashi Iwai1727a772013-01-10 09:52:52 +01006422static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006423 [ALC269_FIXUP_GPIO2] = {
6424 .type = HDA_FIXUP_FUNC,
6425 .v.func = alc_fixup_gpio2,
6426 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006427 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01006428 .type = HDA_FIXUP_PINCTLS,
6429 .v.pins = (const struct hda_pintbl[]) {
6430 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006431 {}
6432 }
6433 },
6434 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006435 .type = HDA_FIXUP_FUNC,
6436 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006437 .chained = true,
6438 .chain_id = ALC269_FIXUP_SONY_VAIO
6439 },
6440 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006441 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006442 .v.verbs = (const struct hda_verb[]) {
6443 /* Enables internal speaker */
6444 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6445 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6446 {}
6447 }
6448 },
6449 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006450 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02006451 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006452 },
6453 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006454 .type = HDA_FIXUP_PINS,
6455 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02006456 { 0x17, 0x99130111 }, /* subwoofer */
6457 { }
6458 }
6459 },
6460 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006461 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006462 .v.verbs = (const struct hda_verb[]) {
6463 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6464 {}
6465 }
6466 },
6467 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006468 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006469 .v.func = alc269_fixup_hweq,
6470 .chained = true,
6471 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6472 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006473 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6474 .type = HDA_FIXUP_FUNC,
6475 .v.func = alc_fixup_disable_aamix,
6476 .chained = true,
6477 .chain_id = ALC269_FIXUP_SONY_VAIO
6478 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006479 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006480 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006481 .v.func = alc271_fixup_dmic,
6482 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02006483 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006484 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006485 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02006486 .chained = true,
6487 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02006488 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006489 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006490 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006491 .v.func = alc269_fixup_stereo_dmic,
6492 },
David Henningsson7c478f02013-10-11 10:18:46 +02006493 [ALC269_FIXUP_HEADSET_MIC] = {
6494 .type = HDA_FIXUP_FUNC,
6495 .v.func = alc269_fixup_headset_mic,
6496 },
Takashi Iwai24519912011-08-16 15:08:49 +02006497 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006498 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02006499 .v.func = alc269_fixup_quanta_mute,
6500 },
6501 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006502 .type = HDA_FIXUP_PINS,
6503 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02006504 { 0x1a, 0x2101103f }, /* dock line-out */
6505 { 0x1b, 0x23a11040 }, /* dock mic-in */
6506 { }
6507 },
6508 .chained = true,
6509 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6510 },
David Henningsson2041d562014-06-13 11:15:44 +02006511 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6512 .type = HDA_FIXUP_PINS,
6513 .v.pins = (const struct hda_pintbl[]) {
6514 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6515 { }
6516 },
6517 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006518 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6519 .type = HDA_FIXUP_PINS,
6520 .v.pins = (const struct hda_pintbl[]) {
6521 { 0x21, 0x0221102f }, /* HP out */
6522 { }
6523 },
6524 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006525 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6526 .type = HDA_FIXUP_FUNC,
6527 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6528 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006529 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6530 .type = HDA_FIXUP_FUNC,
6531 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6532 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02006533 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006534 .type = HDA_FIXUP_PINS,
6535 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006536 { 0x14, 0x99130110 }, /* speaker */
6537 { 0x15, 0x0121401f }, /* HP out */
6538 { 0x18, 0x01a19c20 }, /* mic */
6539 { 0x19, 0x99a3092f }, /* int-mic */
6540 { }
6541 },
6542 },
6543 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006544 .type = HDA_FIXUP_PINS,
6545 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006546 { 0x12, 0x99a3092f }, /* int-mic */
6547 { 0x14, 0x99130110 }, /* speaker */
6548 { 0x15, 0x0121401f }, /* HP out */
6549 { 0x18, 0x01a19c20 }, /* mic */
6550 { }
6551 },
6552 },
6553 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006554 .type = HDA_FIXUP_PINS,
6555 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006556 { 0x14, 0x99130110 }, /* speaker */
6557 { 0x18, 0x01a19c20 }, /* mic */
6558 { 0x19, 0x99a3092f }, /* int-mic */
6559 { 0x21, 0x0121401f }, /* HP out */
6560 { }
6561 },
6562 },
David Henningsson2267ea92012-01-03 08:45:56 +01006563 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006564 .type = HDA_FIXUP_PINS,
6565 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006566 { 0x12, 0x99a3092f }, /* int-mic */
6567 { 0x14, 0x99130110 }, /* speaker */
6568 { 0x18, 0x01a19c20 }, /* mic */
6569 { 0x21, 0x0121401f }, /* HP out */
6570 { }
6571 },
6572 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006573 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006574 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006575 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01006576 },
David Henningssond06ac142013-02-18 11:41:55 +01006577 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6578 .type = HDA_FIXUP_FUNC,
6579 .v.func = alc269_fixup_hp_mute_led_mic1,
6580 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006581 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006582 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006583 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01006584 },
Tom Briden7f783bd2017-03-25 10:12:01 +00006585 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6586 .type = HDA_FIXUP_FUNC,
6587 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006588 .chained = true,
6589 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00006590 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006591 [ALC269_FIXUP_HP_GPIO_LED] = {
6592 .type = HDA_FIXUP_FUNC,
6593 .v.func = alc269_fixup_hp_gpio_led,
6594 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006595 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6596 .type = HDA_FIXUP_FUNC,
6597 .v.func = alc269_fixup_hp_gpio_mic1_led,
6598 },
6599 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6600 .type = HDA_FIXUP_FUNC,
6601 .v.func = alc269_fixup_hp_line1_mic1_led,
6602 },
David Henningsson693b6132012-06-22 19:12:10 +02006603 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006604 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02006605 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02006606 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006607 [ALC269_FIXUP_NO_SHUTUP] = {
6608 .type = HDA_FIXUP_FUNC,
6609 .v.func = alc_fixup_no_shutup,
6610 },
David Henningsson108cc102012-07-20 10:37:25 +02006611 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006612 .type = HDA_FIXUP_PINS,
6613 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02006614 { 0x19, 0x23a11040 }, /* dock mic */
6615 { 0x1b, 0x2121103f }, /* dock headphone */
6616 { }
6617 },
6618 .chained = true,
6619 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6620 },
Takashi Iwaib590b382020-05-14 18:05:33 +02006621 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6622 .type = HDA_FIXUP_FUNC,
6623 .v.func = alc269_fixup_limit_int_mic_boost,
6624 .chained = true,
6625 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6626 },
David Henningsson108cc102012-07-20 10:37:25 +02006627 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006628 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02006629 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01006630 .chained = true,
6631 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02006632 },
David Henningsson73bdd592013-04-15 15:44:14 +02006633 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6634 .type = HDA_FIXUP_PINS,
6635 .v.pins = (const struct hda_pintbl[]) {
6636 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6637 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6638 { }
6639 },
6640 .chained = true,
6641 .chain_id = ALC269_FIXUP_HEADSET_MODE
6642 },
6643 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6644 .type = HDA_FIXUP_PINS,
6645 .v.pins = (const struct hda_pintbl[]) {
6646 { 0x16, 0x21014020 }, /* dock line out */
6647 { 0x19, 0x21a19030 }, /* dock mic */
6648 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6649 { }
6650 },
6651 .chained = true,
6652 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6653 },
David Henningsson338cae52013-10-07 10:39:59 +02006654 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6655 .type = HDA_FIXUP_PINS,
6656 .v.pins = (const struct hda_pintbl[]) {
6657 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6658 { }
6659 },
6660 .chained = true,
6661 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6662 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08006663 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6664 .type = HDA_FIXUP_PINS,
6665 .v.pins = (const struct hda_pintbl[]) {
6666 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6667 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6668 { }
6669 },
6670 .chained = true,
6671 .chain_id = ALC269_FIXUP_HEADSET_MODE
6672 },
David Henningsson73bdd592013-04-15 15:44:14 +02006673 [ALC269_FIXUP_HEADSET_MODE] = {
6674 .type = HDA_FIXUP_FUNC,
6675 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08006676 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006677 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02006678 },
6679 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6680 .type = HDA_FIXUP_FUNC,
6681 .v.func = alc_fixup_headset_mode_no_hp_mic,
6682 },
Takashi Iwai78197172015-06-27 10:21:13 +02006683 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6684 .type = HDA_FIXUP_PINS,
6685 .v.pins = (const struct hda_pintbl[]) {
6686 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6687 { }
6688 },
6689 .chained = true,
6690 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6691 },
David Henningsson88cfcf82013-10-11 10:18:45 +02006692 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6693 .type = HDA_FIXUP_PINS,
6694 .v.pins = (const struct hda_pintbl[]) {
6695 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6696 { }
6697 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02006698 .chained = true,
6699 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02006700 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006701 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006702 .type = HDA_FIXUP_PINS,
6703 .v.pins = (const struct hda_pintbl[]) {
6704 {0x12, 0x90a60130},
6705 {0x13, 0x40000000},
6706 {0x14, 0x90170110},
6707 {0x18, 0x411111f0},
6708 {0x19, 0x04a11040},
6709 {0x1a, 0x411111f0},
6710 {0x1b, 0x90170112},
6711 {0x1d, 0x40759a05},
6712 {0x1e, 0x411111f0},
6713 {0x21, 0x04211020},
6714 { }
6715 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05006716 .chained = true,
6717 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006718 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006719 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6720 .type = HDA_FIXUP_FUNC,
6721 .v.func = alc298_fixup_huawei_mbx_stereo,
6722 .chained = true,
6723 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6724 },
David Henningssond240d1d2013-04-15 12:50:02 +02006725 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6726 .type = HDA_FIXUP_FUNC,
6727 .v.func = alc269_fixup_x101_headset_mic,
6728 },
6729 [ALC269_FIXUP_ASUS_X101_VERB] = {
6730 .type = HDA_FIXUP_VERBS,
6731 .v.verbs = (const struct hda_verb[]) {
6732 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6733 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6734 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6735 { }
6736 },
6737 .chained = true,
6738 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6739 },
6740 [ALC269_FIXUP_ASUS_X101] = {
6741 .type = HDA_FIXUP_PINS,
6742 .v.pins = (const struct hda_pintbl[]) {
6743 { 0x18, 0x04a1182c }, /* Headset mic */
6744 { }
6745 },
6746 .chained = true,
6747 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6748 },
Dylan Reid08a978d2012-11-18 22:56:40 -08006749 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006750 .type = HDA_FIXUP_PINS,
6751 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08006752 { 0x14, 0x99130110 }, /* speaker */
6753 { 0x19, 0x01a19c20 }, /* mic */
6754 { 0x1b, 0x99a7012f }, /* int-mic */
6755 { 0x21, 0x0121401f }, /* HP out */
6756 { }
6757 },
6758 },
6759 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006760 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08006761 .v.func = alc271_hp_gate_mic_jack,
6762 .chained = true,
6763 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6764 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006765 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6766 .type = HDA_FIXUP_FUNC,
6767 .v.func = alc269_fixup_limit_int_mic_boost,
6768 .chained = true,
6769 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6770 },
Dylan Reid42397002013-04-05 14:58:22 -07006771 [ALC269_FIXUP_ACER_AC700] = {
6772 .type = HDA_FIXUP_PINS,
6773 .v.pins = (const struct hda_pintbl[]) {
6774 { 0x12, 0x99a3092f }, /* int-mic */
6775 { 0x14, 0x99130110 }, /* speaker */
6776 { 0x18, 0x03a11c20 }, /* mic */
6777 { 0x1e, 0x0346101e }, /* SPDIF1 */
6778 { 0x21, 0x0321101f }, /* HP out */
6779 { }
6780 },
6781 .chained = true,
6782 .chain_id = ALC271_FIXUP_DMIC,
6783 },
David Henningsson3e0d6112013-04-22 14:30:14 +02006784 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6785 .type = HDA_FIXUP_FUNC,
6786 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01006787 .chained = true,
6788 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02006789 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01006790 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6791 .type = HDA_FIXUP_FUNC,
6792 .v.func = alc269_fixup_limit_int_mic_boost,
6793 .chained = true,
6794 .chain_id = ALC269VB_FIXUP_DMIC,
6795 },
Takashi Iwai23870832013-11-29 14:13:12 +01006796 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6797 .type = HDA_FIXUP_VERBS,
6798 .v.verbs = (const struct hda_verb[]) {
6799 /* class-D output amp +5dB */
6800 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6801 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6802 {}
6803 },
6804 .chained = true,
6805 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6806 },
David Henningsson8e35cd42013-11-06 11:20:01 +01006807 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6808 .type = HDA_FIXUP_FUNC,
6809 .v.func = alc269_fixup_limit_int_mic_boost,
6810 .chained = true,
6811 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6812 },
Anisse Astier02b504d2013-06-03 11:53:10 +02006813 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6814 .type = HDA_FIXUP_PINS,
6815 .v.pins = (const struct hda_pintbl[]) {
6816 { 0x12, 0x99a3092f }, /* int-mic */
6817 { 0x18, 0x03a11d20 }, /* mic */
6818 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6819 { }
6820 },
6821 },
Kailang Yangcd217a62013-08-22 10:15:24 +02006822 [ALC283_FIXUP_CHROME_BOOK] = {
6823 .type = HDA_FIXUP_FUNC,
6824 .v.func = alc283_fixup_chromebook,
6825 },
Kailang Yang0202e992013-12-02 15:20:15 +08006826 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6827 .type = HDA_FIXUP_FUNC,
6828 .v.func = alc283_fixup_sense_combo_jack,
6829 .chained = true,
6830 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6831 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02006832 [ALC282_FIXUP_ASUS_TX300] = {
6833 .type = HDA_FIXUP_FUNC,
6834 .v.func = alc282_fixup_asus_tx300,
6835 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02006836 [ALC283_FIXUP_INT_MIC] = {
6837 .type = HDA_FIXUP_VERBS,
6838 .v.verbs = (const struct hda_verb[]) {
6839 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6840 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6841 { }
6842 },
6843 .chained = true,
6844 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6845 },
David Henningsson0f4881d2013-12-20 16:08:13 +01006846 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6847 .type = HDA_FIXUP_PINS,
6848 .v.pins = (const struct hda_pintbl[]) {
6849 { 0x17, 0x90170112 }, /* subwoofer */
6850 { }
6851 },
6852 .chained = true,
6853 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6854 },
6855 [ALC290_FIXUP_SUBWOOFER] = {
6856 .type = HDA_FIXUP_PINS,
6857 .v.pins = (const struct hda_pintbl[]) {
6858 { 0x17, 0x90170112 }, /* subwoofer */
6859 { }
6860 },
6861 .chained = true,
6862 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6863 },
David Henningsson338cae52013-10-07 10:39:59 +02006864 [ALC290_FIXUP_MONO_SPEAKERS] = {
6865 .type = HDA_FIXUP_FUNC,
6866 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01006867 },
6868 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6869 .type = HDA_FIXUP_FUNC,
6870 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02006871 .chained = true,
6872 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6873 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01006874 [ALC269_FIXUP_THINKPAD_ACPI] = {
6875 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006876 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02006877 .chained = true,
6878 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006879 },
David Henningsson56f27012016-01-11 09:33:14 +01006880 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6881 .type = HDA_FIXUP_FUNC,
6882 .v.func = alc_fixup_inv_dmic,
6883 .chained = true,
6884 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6885 },
Chris Chiu5824ce82017-02-28 14:17:11 -06006886 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08006887 .type = HDA_FIXUP_PINS,
6888 .v.pins = (const struct hda_pintbl[]) {
6889 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6890 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06006891 },
6892 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08006893 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06006894 },
Chris Chiu615966a2017-02-28 14:17:12 -06006895 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6896 .type = HDA_FIXUP_PINS,
6897 .v.pins = (const struct hda_pintbl[]) {
6898 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6899 { }
6900 },
6901 .chained = true,
6902 .chain_id = ALC255_FIXUP_HEADSET_MODE
6903 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006904 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6905 .type = HDA_FIXUP_PINS,
6906 .v.pins = (const struct hda_pintbl[]) {
6907 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6908 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6909 { }
6910 },
6911 .chained = true,
6912 .chain_id = ALC255_FIXUP_HEADSET_MODE
6913 },
Kailang Yang31278992014-03-03 15:27:22 +08006914 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6915 .type = HDA_FIXUP_PINS,
6916 .v.pins = (const struct hda_pintbl[]) {
6917 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6918 { }
6919 },
6920 .chained = true,
6921 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6922 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006923 [ALC255_FIXUP_HEADSET_MODE] = {
6924 .type = HDA_FIXUP_FUNC,
6925 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08006926 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006927 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006928 },
Kailang Yang31278992014-03-03 15:27:22 +08006929 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6930 .type = HDA_FIXUP_FUNC,
6931 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6932 },
Kailang Yanga22aa262014-04-23 17:34:28 +08006933 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6934 .type = HDA_FIXUP_PINS,
6935 .v.pins = (const struct hda_pintbl[]) {
6936 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6937 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6938 { }
6939 },
6940 .chained = true,
6941 .chain_id = ALC269_FIXUP_HEADSET_MODE
6942 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02006943 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02006944 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02006945 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006946 .chained = true,
6947 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6948 },
Takashi Iwai9a811232015-12-09 15:17:43 +01006949 [ALC292_FIXUP_TPT440] = {
6950 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01006951 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01006952 .chained = true,
6953 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6954 },
Anisse Astierabaa22742016-08-24 09:14:13 +02006955 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01006956 .type = HDA_FIXUP_PINS,
6957 .v.pins = (const struct hda_pintbl[]) {
6958 { 0x19, 0x04a110f0 },
6959 { },
6960 },
6961 },
Takashi Iwaib3802782018-11-26 17:47:46 +01006962 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08006963 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02006964 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08006965 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006966 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6967 .type = HDA_FIXUP_PINS,
6968 .v.pins = (const struct hda_pintbl[]) {
6969 { 0x12, 0x90a60130 },
6970 { 0x14, 0x90170110 },
6971 { 0x17, 0x40000008 },
6972 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02006973 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006974 { 0x1a, 0x411111f0 },
6975 { 0x1b, 0x411111f0 },
6976 { 0x1d, 0x40f89b2d },
6977 { 0x1e, 0x411111f0 },
6978 { 0x21, 0x0321101f },
6979 { },
6980 },
6981 },
David Henningsson7a5255f2014-10-30 08:26:01 +01006982 [ALC280_FIXUP_HP_GPIO4] = {
6983 .type = HDA_FIXUP_FUNC,
6984 .v.func = alc280_fixup_hp_gpio4,
6985 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006986 [ALC286_FIXUP_HP_GPIO_LED] = {
6987 .type = HDA_FIXUP_FUNC,
6988 .v.func = alc286_fixup_hp_gpio_led,
6989 },
David Henningsson33f4acd2015-01-07 15:50:13 +01006990 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6991 .type = HDA_FIXUP_FUNC,
6992 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6993 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01006994 [ALC280_FIXUP_HP_DOCK_PINS] = {
6995 .type = HDA_FIXUP_PINS,
6996 .v.pins = (const struct hda_pintbl[]) {
6997 { 0x1b, 0x21011020 }, /* line-out */
6998 { 0x1a, 0x01a1903c }, /* headset mic */
6999 { 0x18, 0x2181103f }, /* line-in */
7000 { },
7001 },
7002 .chained = true,
7003 .chain_id = ALC280_FIXUP_HP_GPIO4
7004 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007005 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7006 .type = HDA_FIXUP_PINS,
7007 .v.pins = (const struct hda_pintbl[]) {
7008 { 0x1b, 0x21011020 }, /* line-out */
7009 { 0x18, 0x2181103f }, /* line-in */
7010 { },
7011 },
7012 .chained = true,
7013 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7014 },
Keith Packard98973f22015-07-15 12:14:39 -07007015 [ALC280_FIXUP_HP_9480M] = {
7016 .type = HDA_FIXUP_FUNC,
7017 .v.func = alc280_fixup_hp_9480m,
7018 },
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007019 [ALC245_FIXUP_HP_X360_AMP] = {
7020 .type = HDA_FIXUP_FUNC,
7021 .v.func = alc245_fixup_hp_x360_amp,
7022 },
Kailang Yange1e62b92015-04-08 16:01:22 +08007023 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7024 .type = HDA_FIXUP_FUNC,
7025 .v.func = alc_fixup_headset_mode_dell_alc288,
7026 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007027 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08007028 },
7029 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7030 .type = HDA_FIXUP_PINS,
7031 .v.pins = (const struct hda_pintbl[]) {
7032 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7033 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7034 { }
7035 },
7036 .chained = true,
7037 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7038 },
Hui Wang831bfdf92015-06-26 12:35:17 +08007039 [ALC288_FIXUP_DISABLE_AAMIX] = {
7040 .type = HDA_FIXUP_FUNC,
7041 .v.func = alc_fixup_disable_aamix,
7042 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02007043 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08007044 },
7045 [ALC288_FIXUP_DELL_XPS_13] = {
7046 .type = HDA_FIXUP_FUNC,
7047 .v.func = alc_fixup_dell_xps13,
7048 .chained = true,
7049 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7050 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007051 [ALC292_FIXUP_DISABLE_AAMIX] = {
7052 .type = HDA_FIXUP_FUNC,
7053 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08007054 .chained = true,
7055 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007056 },
David Henningssonc04017e2015-12-15 14:44:03 +01007057 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7058 .type = HDA_FIXUP_FUNC,
7059 .v.func = alc_fixup_disable_aamix,
7060 .chained = true,
7061 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7062 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007063 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007064 .type = HDA_FIXUP_FUNC,
7065 .v.func = alc_fixup_dell_xps13,
7066 .chained = true,
7067 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7068 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007069 [ALC292_FIXUP_DELL_E7X] = {
7070 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007071 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01007072 /* micmute fixup must be applied at last */
7073 .chained_before = true,
7074 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7075 },
James McDonnell54324222019-09-16 14:53:38 +00007076 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7077 .type = HDA_FIXUP_PINS,
7078 .v.pins = (const struct hda_pintbl[]) {
7079 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7080 { }
7081 },
7082 .chained_before = true,
7083 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7084 },
Kailang Yang977e6272015-05-18 15:31:20 +08007085 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7086 .type = HDA_FIXUP_PINS,
7087 .v.pins = (const struct hda_pintbl[]) {
7088 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7089 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7090 { }
7091 },
7092 .chained = true,
7093 .chain_id = ALC269_FIXUP_HEADSET_MODE
7094 },
Hui Wang2f726ae2017-03-31 10:31:40 +08007095 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7096 .type = HDA_FIXUP_PINS,
7097 .v.pins = (const struct hda_pintbl[]) {
7098 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7099 { }
7100 },
7101 .chained = true,
7102 .chain_id = ALC269_FIXUP_HEADSET_MODE
7103 },
Kailang Yang6ed11312015-10-26 15:37:39 +08007104 [ALC275_FIXUP_DELL_XPS] = {
7105 .type = HDA_FIXUP_VERBS,
7106 .v.verbs = (const struct hda_verb[]) {
7107 /* Enables internal speaker */
7108 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7109 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7110 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7111 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7112 {}
7113 }
7114 },
Hui Wang23adc192015-12-08 12:27:18 +08007115 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7116 .type = HDA_FIXUP_FUNC,
7117 .v.func = alc_fixup_disable_aamix,
7118 .chained = true,
7119 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7120 },
Kailang3694cb22015-12-28 11:35:24 +08007121 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7122 .type = HDA_FIXUP_FUNC,
7123 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7124 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007125 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7126 .type = HDA_FIXUP_FUNC,
7127 .v.func = alc_fixup_disable_aamix,
7128 .chained = true,
7129 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7130 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08007131 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7132 .type = HDA_FIXUP_FUNC,
7133 .v.func = alc_fixup_disable_mic_vref,
7134 .chained = true,
7135 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7136 },
David Henningsson2ae95572016-02-25 09:37:05 +01007137 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7138 .type = HDA_FIXUP_VERBS,
7139 .v.verbs = (const struct hda_verb[]) {
7140 /* Disable pass-through path for FRONT 14h */
7141 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7142 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7143 {}
7144 },
7145 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007146 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007147 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007148 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7149 .type = HDA_FIXUP_FUNC,
7150 .v.func = alc_fixup_disable_aamix,
7151 .chained = true,
7152 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7153 },
Hui Wange549d192016-04-01 11:00:15 +08007154 [ALC221_FIXUP_HP_FRONT_MIC] = {
7155 .type = HDA_FIXUP_PINS,
7156 .v.pins = (const struct hda_pintbl[]) {
7157 { 0x19, 0x02a19020 }, /* Front Mic */
7158 { }
7159 },
7160 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007161 [ALC292_FIXUP_TPT460] = {
7162 .type = HDA_FIXUP_FUNC,
7163 .v.func = alc_fixup_tpt440_dock,
7164 .chained = true,
7165 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7166 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007167 [ALC298_FIXUP_SPK_VOLUME] = {
7168 .type = HDA_FIXUP_FUNC,
7169 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007170 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007171 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007172 },
Kailang Yangf86de9b2020-10-23 14:46:47 +08007173 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7174 .type = HDA_FIXUP_FUNC,
7175 .v.func = alc298_fixup_speaker_volume,
7176 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007177 [ALC295_FIXUP_DISABLE_DAC3] = {
7178 .type = HDA_FIXUP_FUNC,
7179 .v.func = alc295_fixup_disable_dac3,
7180 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007181 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7182 .type = HDA_FIXUP_FUNC,
7183 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007184 .chained = true,
7185 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007186 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007187 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7188 .type = HDA_FIXUP_PINS,
7189 .v.pins = (const struct hda_pintbl[]) {
7190 { 0x1b, 0x90170151 },
7191 { }
7192 },
7193 .chained = true,
7194 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7195 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007196 [ALC269_FIXUP_ATIV_BOOK_8] = {
7197 .type = HDA_FIXUP_FUNC,
7198 .v.func = alc_fixup_auto_mute_via_amp,
7199 .chained = true,
7200 .chain_id = ALC269_FIXUP_NO_SHUTUP
7201 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007202 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7203 .type = HDA_FIXUP_PINS,
7204 .v.pins = (const struct hda_pintbl[]) {
7205 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7206 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7207 { }
7208 },
7209 .chained = true,
7210 .chain_id = ALC269_FIXUP_HEADSET_MODE
7211 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007212 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7213 .type = HDA_FIXUP_FUNC,
7214 .v.func = alc_fixup_headset_mode,
7215 },
7216 [ALC256_FIXUP_ASUS_MIC] = {
7217 .type = HDA_FIXUP_PINS,
7218 .v.pins = (const struct hda_pintbl[]) {
7219 { 0x13, 0x90a60160 }, /* use as internal mic */
7220 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7221 { }
7222 },
7223 .chained = true,
7224 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7225 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007226 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007227 .type = HDA_FIXUP_FUNC,
7228 /* Set up GPIO2 for the speaker amp */
7229 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007230 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007231 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7232 .type = HDA_FIXUP_PINS,
7233 .v.pins = (const struct hda_pintbl[]) {
7234 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7235 { }
7236 },
7237 .chained = true,
7238 .chain_id = ALC269_FIXUP_HEADSET_MIC
7239 },
7240 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7241 .type = HDA_FIXUP_VERBS,
7242 .v.verbs = (const struct hda_verb[]) {
7243 /* Enables internal speaker */
7244 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7245 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7246 {}
7247 },
7248 .chained = true,
7249 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7250 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007251 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7252 .type = HDA_FIXUP_FUNC,
7253 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007254 .chained = true,
7255 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007256 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007257 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7258 .type = HDA_FIXUP_VERBS,
7259 .v.verbs = (const struct hda_verb[]) {
7260 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7261 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7262 { }
7263 },
7264 .chained = true,
7265 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7266 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007267 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7268 .type = HDA_FIXUP_PINS,
7269 .v.pins = (const struct hda_pintbl[]) {
7270 /* Change the mic location from front to right, otherwise there are
7271 two front mics with the same name, pulseaudio can't handle them.
7272 This is just a temporary workaround, after applying this fixup,
7273 there will be one "Front Mic" and one "Mic" in this machine.
7274 */
7275 { 0x1a, 0x04a19040 },
7276 { }
7277 },
7278 },
Kailang Yang5f364132017-07-25 16:28:16 +08007279 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7280 .type = HDA_FIXUP_PINS,
7281 .v.pins = (const struct hda_pintbl[]) {
7282 { 0x16, 0x0101102f }, /* Rear Headset HP */
7283 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7284 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7285 { 0x1b, 0x02011020 },
7286 { }
7287 },
7288 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007289 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7290 },
7291 [ALC225_FIXUP_S3_POP_NOISE] = {
7292 .type = HDA_FIXUP_FUNC,
7293 .v.func = alc225_fixup_s3_pop_noise,
7294 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007295 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7296 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007297 [ALC700_FIXUP_INTEL_REFERENCE] = {
7298 .type = HDA_FIXUP_VERBS,
7299 .v.verbs = (const struct hda_verb[]) {
7300 /* Enables internal speaker */
7301 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7302 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7303 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7304 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7305 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7306 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7307 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7308 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7309 {}
7310 }
7311 },
Kailang Yang92266652017-12-14 15:28:58 +08007312 [ALC274_FIXUP_DELL_BIND_DACS] = {
7313 .type = HDA_FIXUP_FUNC,
7314 .v.func = alc274_fixup_bind_dacs,
7315 .chained = true,
7316 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7317 },
7318 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7319 .type = HDA_FIXUP_PINS,
7320 .v.pins = (const struct hda_pintbl[]) {
7321 { 0x1b, 0x0401102f },
7322 { }
7323 },
7324 .chained = true,
7325 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7326 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007327 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007328 .type = HDA_FIXUP_FUNC,
7329 .v.func = alc_fixup_tpt470_dock,
7330 .chained = true,
7331 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7332 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007333 [ALC298_FIXUP_TPT470_DOCK] = {
7334 .type = HDA_FIXUP_FUNC,
7335 .v.func = alc_fixup_tpt470_dacs,
7336 .chained = true,
7337 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7338 },
Kailang Yangae104a22018-02-05 16:07:20 +08007339 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7340 .type = HDA_FIXUP_PINS,
7341 .v.pins = (const struct hda_pintbl[]) {
7342 { 0x14, 0x0201101f },
7343 { }
7344 },
7345 .chained = true,
7346 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7347 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007348 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7349 .type = HDA_FIXUP_PINS,
7350 .v.pins = (const struct hda_pintbl[]) {
7351 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7352 { }
7353 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007354 .chained = true,
7355 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007356 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007357 [ALC295_FIXUP_HP_X360] = {
7358 .type = HDA_FIXUP_FUNC,
7359 .v.func = alc295_fixup_hp_top_speakers,
7360 .chained = true,
7361 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007362 },
7363 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7364 .type = HDA_FIXUP_PINS,
7365 .v.pins = (const struct hda_pintbl[]) {
7366 { 0x19, 0x0181313f},
7367 { }
7368 },
7369 .chained = true,
7370 .chain_id = ALC269_FIXUP_HEADSET_MIC
7371 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007372 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7373 .type = HDA_FIXUP_FUNC,
7374 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007375 .chained = true,
7376 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007377 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007378 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7379 .type = HDA_FIXUP_FUNC,
7380 .v.func = alc_fixup_auto_mute_via_amp,
7381 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007382 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7383 .type = HDA_FIXUP_PINS,
7384 .v.pins = (const struct hda_pintbl[]) {
7385 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7386 { }
7387 },
7388 .chained = true,
7389 .chain_id = ALC269_FIXUP_HEADSET_MIC
7390 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007391 [ALC294_FIXUP_ASUS_MIC] = {
7392 .type = HDA_FIXUP_PINS,
7393 .v.pins = (const struct hda_pintbl[]) {
7394 { 0x13, 0x90a60160 }, /* use as internal mic */
7395 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7396 { }
7397 },
7398 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007399 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007400 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007401 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7402 .type = HDA_FIXUP_PINS,
7403 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007404 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007405 { }
7406 },
7407 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007408 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007409 },
7410 [ALC294_FIXUP_ASUS_SPK] = {
7411 .type = HDA_FIXUP_VERBS,
7412 .v.verbs = (const struct hda_verb[]) {
7413 /* Set EAPD high */
7414 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7415 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08007416 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7417 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007418 { }
7419 },
7420 .chained = true,
7421 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7422 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007423 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08007424 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007425 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08007426 .chained = true,
7427 .chain_id = ALC225_FIXUP_HEADSET_JACK
7428 },
7429 [ALC225_FIXUP_HEADSET_JACK] = {
7430 .type = HDA_FIXUP_FUNC,
7431 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08007432 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07007433 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7434 .type = HDA_FIXUP_PINS,
7435 .v.pins = (const struct hda_pintbl[]) {
7436 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7437 { }
7438 },
7439 .chained = true,
7440 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7441 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08007442 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7443 .type = HDA_FIXUP_VERBS,
7444 .v.verbs = (const struct hda_verb[]) {
7445 /* Disable PCBEEP-IN passthrough */
7446 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7447 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7448 { }
7449 },
7450 .chained = true,
7451 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7452 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007453 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7454 .type = HDA_FIXUP_PINS,
7455 .v.pins = (const struct hda_pintbl[]) {
7456 { 0x19, 0x03a11130 },
7457 { 0x1a, 0x90a60140 }, /* use as internal mic */
7458 { }
7459 },
7460 .chained = true,
7461 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7462 },
Kailang Yang136824e2019-03-14 16:22:45 +08007463 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7464 .type = HDA_FIXUP_PINS,
7465 .v.pins = (const struct hda_pintbl[]) {
7466 { 0x16, 0x01011020 }, /* Rear Line out */
7467 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7468 { }
7469 },
7470 .chained = true,
7471 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7472 },
7473 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7474 .type = HDA_FIXUP_FUNC,
7475 .v.func = alc_fixup_auto_mute_via_amp,
7476 .chained = true,
7477 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7478 },
7479 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7480 .type = HDA_FIXUP_FUNC,
7481 .v.func = alc_fixup_disable_mic_vref,
7482 .chained = true,
7483 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7484 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007485 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7486 .type = HDA_FIXUP_VERBS,
7487 .v.verbs = (const struct hda_verb[]) {
7488 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7489 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7490 { }
7491 },
7492 .chained = true,
7493 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7494 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08007495 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7496 .type = HDA_FIXUP_PINS,
7497 .v.pins = (const struct hda_pintbl[]) {
7498 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7499 { }
7500 },
7501 .chained = true,
7502 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7503 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08007504 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7505 .type = HDA_FIXUP_PINS,
7506 .v.pins = (const struct hda_pintbl[]) {
7507 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7508 { }
7509 },
7510 .chained = true,
7511 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7512 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007513 [ALC299_FIXUP_PREDATOR_SPK] = {
7514 .type = HDA_FIXUP_PINS,
7515 .v.pins = (const struct hda_pintbl[]) {
7516 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7517 { }
7518 }
7519 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02007520 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7521 .type = HDA_FIXUP_PINS,
7522 .v.pins = (const struct hda_pintbl[]) {
7523 { 0x19, 0x04a11040 },
7524 { 0x21, 0x04211020 },
7525 { }
7526 },
7527 .chained = true,
7528 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7529 },
Kailang Yange79c2262019-12-19 14:12:15 +08007530 [ALC289_FIXUP_DELL_SPK2] = {
7531 .type = HDA_FIXUP_PINS,
7532 .v.pins = (const struct hda_pintbl[]) {
7533 { 0x17, 0x90170130 }, /* bass spk */
7534 { }
7535 },
7536 .chained = true,
7537 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7538 },
7539 [ALC289_FIXUP_DUAL_SPK] = {
7540 .type = HDA_FIXUP_FUNC,
7541 .v.func = alc285_fixup_speaker2_to_dac1,
7542 .chained = true,
7543 .chain_id = ALC289_FIXUP_DELL_SPK2
7544 },
Chris Chiu48e01502019-12-30 11:11:18 +08007545 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7546 .type = HDA_FIXUP_FUNC,
7547 .v.func = alc285_fixup_speaker2_to_dac1,
7548 .chained = true,
7549 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7550 },
7551 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007552 .type = HDA_FIXUP_FUNC,
7553 /* The GPIO must be pulled to initialize the AMP */
7554 .v.func = alc_fixup_gpio4,
7555 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08007556 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007557 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007558 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7559 .type = HDA_FIXUP_FUNC,
7560 .v.func = alc285_fixup_thinkpad_x1_gen7,
7561 .chained = true,
7562 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7563 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08007564 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7565 .type = HDA_FIXUP_FUNC,
7566 .v.func = alc_fixup_headset_jack,
7567 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007568 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08007569 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007570 [ALC294_FIXUP_ASUS_HPE] = {
7571 .type = HDA_FIXUP_VERBS,
7572 .v.verbs = (const struct hda_verb[]) {
7573 /* Set EAPD high */
7574 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7575 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7576 { }
7577 },
7578 .chained = true,
7579 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7580 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007581 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7582 .type = HDA_FIXUP_PINS,
7583 .v.pins = (const struct hda_pintbl[]) {
7584 { 0x19, 0x03a11050 }, /* front HP mic */
7585 { 0x1a, 0x01a11830 }, /* rear external mic */
7586 { 0x21, 0x03211020 }, /* front HP out */
7587 { }
7588 },
7589 .chained = true,
7590 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7591 },
7592 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7593 .type = HDA_FIXUP_VERBS,
7594 .v.verbs = (const struct hda_verb[]) {
7595 /* set 0x15 to HP-OUT ctrl */
7596 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7597 /* unmute the 0x15 amp */
7598 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7599 { }
7600 },
7601 .chained = true,
7602 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7603 },
7604 [ALC294_FIXUP_ASUS_GX502_HP] = {
7605 .type = HDA_FIXUP_FUNC,
7606 .v.func = alc294_fixup_gx502_hp,
7607 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02007608 [ALC294_FIXUP_ASUS_COEF_1B] = {
7609 .type = HDA_FIXUP_VERBS,
7610 .v.verbs = (const struct hda_verb[]) {
7611 /* Set bit 10 to correct noisy output after reboot from
7612 * Windows 10 (due to pop noise reduction?)
7613 */
7614 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7615 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7616 { }
7617 },
7618 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08007619 [ALC285_FIXUP_HP_GPIO_LED] = {
7620 .type = HDA_FIXUP_FUNC,
7621 .v.func = alc285_fixup_hp_gpio_led,
7622 },
Kailang Yang431e76c2020-04-07 14:40:20 +08007623 [ALC285_FIXUP_HP_MUTE_LED] = {
7624 .type = HDA_FIXUP_FUNC,
7625 .v.func = alc285_fixup_hp_mute_led,
7626 },
Jeremy Szue7d66cf2021-03-16 15:46:24 +08007627 [ALC236_FIXUP_HP_GPIO_LED] = {
7628 .type = HDA_FIXUP_FUNC,
7629 .v.func = alc236_fixup_hp_gpio_led,
7630 },
Kailang Yang24164f42020-04-07 14:52:42 +08007631 [ALC236_FIXUP_HP_MUTE_LED] = {
7632 .type = HDA_FIXUP_FUNC,
7633 .v.func = alc236_fixup_hp_mute_led,
7634 },
Mike Pozulp14425f12020-05-09 20:28:37 -07007635 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7636 .type = HDA_FIXUP_VERBS,
7637 .v.verbs = (const struct hda_verb[]) {
7638 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7639 { }
7640 },
7641 },
Chris Chiu9e433422020-05-12 14:15:24 +08007642 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7643 .type = HDA_FIXUP_PINS,
7644 .v.pins = (const struct hda_pintbl[]) {
7645 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7646 { }
7647 },
7648 .chained = true,
7649 .chain_id = ALC269_FIXUP_HEADSET_MODE
7650 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007651 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7652 .type = HDA_FIXUP_PINS,
7653 .v.pins = (const struct hda_pintbl[]) {
7654 { 0x14, 0x90100120 }, /* use as internal speaker */
7655 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7656 { 0x1a, 0x01011020 }, /* use as line out */
7657 { },
7658 },
7659 .chained = true,
7660 .chain_id = ALC269_FIXUP_HEADSET_MIC
7661 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007662 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7663 .type = HDA_FIXUP_PINS,
7664 .v.pins = (const struct hda_pintbl[]) {
7665 { 0x18, 0x02a11030 }, /* use as headset mic */
7666 { }
7667 },
7668 .chained = true,
7669 .chain_id = ALC269_FIXUP_HEADSET_MIC
7670 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007671 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7672 .type = HDA_FIXUP_PINS,
7673 .v.pins = (const struct hda_pintbl[]) {
7674 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7675 { }
7676 },
7677 .chained = true,
7678 .chain_id = ALC269_FIXUP_HEADSET_MIC
7679 },
Armas Spann293a92c2020-07-24 16:08:37 +02007680 [ALC289_FIXUP_ASUS_GA401] = {
Takashi Iwaic84bfed2020-11-27 15:11:04 +01007681 .type = HDA_FIXUP_FUNC,
7682 .v.func = alc289_fixup_asus_ga401,
7683 .chained = true,
7684 .chain_id = ALC289_FIXUP_ASUS_GA502,
Armas Spannff536642020-07-11 13:05:57 +02007685 },
Armas Spann4b43d052020-07-24 16:06:16 +02007686 [ALC289_FIXUP_ASUS_GA502] = {
7687 .type = HDA_FIXUP_PINS,
7688 .v.pins = (const struct hda_pintbl[]) {
7689 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7690 { }
7691 },
7692 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007693 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7694 .type = HDA_FIXUP_PINS,
7695 .v.pins = (const struct hda_pintbl[]) {
7696 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7697 { }
7698 },
7699 .chained = true,
7700 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7701 },
Kailang Yang56496252020-07-29 15:09:27 +08007702 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7703 .type = HDA_FIXUP_FUNC,
7704 .v.func = alc285_fixup_hp_gpio_amp_init,
7705 .chained = true,
7706 .chain_id = ALC285_FIXUP_HP_GPIO_LED
7707 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08007708 [ALC269_FIXUP_CZC_B20] = {
7709 .type = HDA_FIXUP_PINS,
7710 .v.pins = (const struct hda_pintbl[]) {
7711 { 0x12, 0x411111f0 },
7712 { 0x14, 0x90170110 }, /* speaker */
7713 { 0x15, 0x032f1020 }, /* HP out */
7714 { 0x17, 0x411111f0 },
7715 { 0x18, 0x03ab1040 }, /* mic */
7716 { 0x19, 0xb7a7013f },
7717 { 0x1a, 0x0181305f },
7718 { 0x1b, 0x411111f0 },
7719 { 0x1d, 0x411111f0 },
7720 { 0x1e, 0x411111f0 },
7721 { }
7722 },
7723 .chain_id = ALC269_FIXUP_DMIC,
7724 },
7725 [ALC269_FIXUP_CZC_TMI] = {
7726 .type = HDA_FIXUP_PINS,
7727 .v.pins = (const struct hda_pintbl[]) {
7728 { 0x12, 0x4000c000 },
7729 { 0x14, 0x90170110 }, /* speaker */
7730 { 0x15, 0x0421401f }, /* HP out */
7731 { 0x17, 0x411111f0 },
7732 { 0x18, 0x04a19020 }, /* mic */
7733 { 0x19, 0x411111f0 },
7734 { 0x1a, 0x411111f0 },
7735 { 0x1b, 0x411111f0 },
7736 { 0x1d, 0x40448505 },
7737 { 0x1e, 0x411111f0 },
7738 { 0x20, 0x8000ffff },
7739 { }
7740 },
7741 .chain_id = ALC269_FIXUP_DMIC,
7742 },
7743 [ALC269_FIXUP_CZC_L101] = {
7744 .type = HDA_FIXUP_PINS,
7745 .v.pins = (const struct hda_pintbl[]) {
7746 { 0x12, 0x40000000 },
7747 { 0x14, 0x01014010 }, /* speaker */
7748 { 0x15, 0x411111f0 }, /* HP out */
7749 { 0x16, 0x411111f0 },
7750 { 0x18, 0x01a19020 }, /* mic */
7751 { 0x19, 0x02a19021 },
7752 { 0x1a, 0x0181302f },
7753 { 0x1b, 0x0221401f },
7754 { 0x1c, 0x411111f0 },
7755 { 0x1d, 0x4044c601 },
7756 { 0x1e, 0x411111f0 },
7757 { }
7758 },
7759 .chain_id = ALC269_FIXUP_DMIC,
7760 },
7761 [ALC269_FIXUP_LEMOTE_A1802] = {
7762 .type = HDA_FIXUP_PINS,
7763 .v.pins = (const struct hda_pintbl[]) {
7764 { 0x12, 0x40000000 },
7765 { 0x14, 0x90170110 }, /* speaker */
7766 { 0x17, 0x411111f0 },
7767 { 0x18, 0x03a19040 }, /* mic1 */
7768 { 0x19, 0x90a70130 }, /* mic2 */
7769 { 0x1a, 0x411111f0 },
7770 { 0x1b, 0x411111f0 },
7771 { 0x1d, 0x40489d2d },
7772 { 0x1e, 0x411111f0 },
7773 { 0x20, 0x0003ffff },
7774 { 0x21, 0x03214020 },
7775 { }
7776 },
7777 .chain_id = ALC269_FIXUP_DMIC,
7778 },
7779 [ALC269_FIXUP_LEMOTE_A190X] = {
7780 .type = HDA_FIXUP_PINS,
7781 .v.pins = (const struct hda_pintbl[]) {
7782 { 0x14, 0x99130110 }, /* speaker */
7783 { 0x15, 0x0121401f }, /* HP out */
7784 { 0x18, 0x01a19c20 }, /* rear mic */
7785 { 0x19, 0x99a3092f }, /* front mic */
7786 { 0x1b, 0x0201401f }, /* front lineout */
7787 { }
7788 },
7789 .chain_id = ALC269_FIXUP_DMIC,
7790 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08007791 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
7792 .type = HDA_FIXUP_PINS,
7793 .v.pins = (const struct hda_pintbl[]) {
7794 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7795 { }
7796 },
7797 .chained = true,
7798 .chain_id = ALC269_FIXUP_HEADSET_MODE
7799 },
Werner Sembach73e71612021-03-02 19:04:14 +01007800 [ALC256_FIXUP_INTEL_NUC10] = {
7801 .type = HDA_FIXUP_PINS,
7802 .v.pins = (const struct hda_pintbl[]) {
7803 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7804 { }
7805 },
7806 .chained = true,
7807 .chain_id = ALC269_FIXUP_HEADSET_MODE
7808 },
Hui Wangfc19d552020-09-09 10:00:41 +08007809 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
7810 .type = HDA_FIXUP_VERBS,
7811 .v.verbs = (const struct hda_verb[]) {
7812 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7813 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7814 { }
7815 },
7816 .chained = true,
Takashi Iwaic84bfed2020-11-27 15:11:04 +01007817 .chain_id = ALC289_FIXUP_ASUS_GA502
Hui Wangfc19d552020-09-09 10:00:41 +08007818 },
Hui Wang13468bf2020-09-28 16:01:17 +08007819 [ALC274_FIXUP_HP_MIC] = {
7820 .type = HDA_FIXUP_VERBS,
7821 .v.verbs = (const struct hda_verb[]) {
7822 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7823 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7824 { }
7825 },
7826 },
Kailang Yang8a8de09c2020-10-27 16:46:38 +08007827 [ALC274_FIXUP_HP_HEADSET_MIC] = {
7828 .type = HDA_FIXUP_FUNC,
7829 .v.func = alc274_fixup_hp_headset_mic,
7830 .chained = true,
7831 .chain_id = ALC274_FIXUP_HP_MIC
7832 },
Kailang Yangef9ce662020-11-03 15:40:35 +08007833 [ALC256_FIXUP_ASUS_HPE] = {
7834 .type = HDA_FIXUP_VERBS,
7835 .v.verbs = (const struct hda_verb[]) {
7836 /* Set EAPD high */
7837 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7838 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
7839 { }
7840 },
7841 .chained = true,
7842 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7843 },
Kailang Yang446b8182020-11-02 15:00:12 +08007844 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
7845 .type = HDA_FIXUP_FUNC,
7846 .v.func = alc_fixup_headset_jack,
7847 .chained = true,
7848 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7849 },
Kailang Yanga0ccbc52020-11-06 15:20:38 +08007850 [ALC287_FIXUP_HP_GPIO_LED] = {
7851 .type = HDA_FIXUP_FUNC,
7852 .v.func = alc287_fixup_hp_gpio_led,
7853 },
Kailang Yang9e885772020-11-03 15:30:51 +08007854 [ALC256_FIXUP_HP_HEADSET_MIC] = {
7855 .type = HDA_FIXUP_FUNC,
7856 .v.func = alc274_fixup_hp_headset_mic,
7857 },
Kailang Yang92666d42020-11-19 17:04:21 +08007858 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
7859 .type = HDA_FIXUP_FUNC,
7860 .v.func = alc_fixup_no_int_mic,
7861 .chained = true,
7862 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7863 },
Chris Chiu34cdf402020-12-16 20:52:00 +08007864 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
7865 .type = HDA_FIXUP_PINS,
7866 .v.pins = (const struct hda_pintbl[]) {
7867 { 0x1b, 0x411111f0 },
7868 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7869 { },
7870 },
7871 .chained = true,
7872 .chain_id = ALC269_FIXUP_HEADSET_MODE
7873 },
Chris Chiu495dc762021-01-14 16:27:28 +08007874 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
7875 .type = HDA_FIXUP_FUNC,
7876 .v.func = alc269_fixup_limit_int_mic_boost,
7877 .chained = true,
7878 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7879 },
Chris Chiud0e18562021-02-26 09:04:40 +08007880 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
7881 .type = HDA_FIXUP_PINS,
7882 .v.pins = (const struct hda_pintbl[]) {
7883 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
7884 { 0x1a, 0x90a1092f }, /* use as internal mic */
7885 { }
7886 },
7887 .chained = true,
7888 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7889 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007890};
7891
7892static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01007893 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02007894 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
7895 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02007896 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02007897 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
7898 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02007899 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
7900 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05007901 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01007902 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02007903 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Chris Chiu13be30f2020-12-22 23:04:59 +08007904 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
Chris Chiu705b65f2018-12-05 14:48:54 +08007905 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007906 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01007907 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiu495dc762021-01-14 16:27:28 +08007908 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
Chris Chiuc7531e32019-03-21 17:17:31 +08007909 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
7910 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiu13be30f2020-12-22 23:04:59 +08007911 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
7912 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007913 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007914 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007915 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiud0e18562021-02-26 09:04:40 +08007916 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007917 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7918 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7919 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Chris Chiud0e18562021-02-26 09:04:40 +08007920 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08007921 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007922 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007923 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007924 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
David Henningssonaaedfb42013-08-16 14:09:02 +02007925 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08007926 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01007927 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01007928 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007929 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
7930 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01007931 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02007932 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7933 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7934 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01007935 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
7936 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01007937 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02007938 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01007939 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08007940 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7941 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08007942 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02007943 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02007944 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08007945 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08007946 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7947 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01007948 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7949 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7950 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7951 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7952 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007953 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007954 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01007955 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08007956 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08007957 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwaie312a862018-03-06 12:14:17 +01007958 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Takashi Iwai493de342017-02-28 17:27:57 +01007959 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kailang Yang5f364132017-07-25 16:28:16 +08007960 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08007961 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7962 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007963 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
7964 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08007965 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08007966 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08007967 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08007968 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08007969 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7970 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08007971 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
7972 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yang92666d42020-11-19 17:04:21 +08007973 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
7974 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
Kailang Yangc1e89522020-12-23 15:34:57 +08007975 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yanga22aa262014-04-23 17:34:28 +08007976 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7977 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007978 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01007979 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01007980 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
David Henningsson33f4acd2015-01-07 15:50:13 +01007981 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08007982 /* ALC282 */
Hui Wang7976eb42015-02-13 11:14:41 +08007983 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007984 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007985 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007986 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7987 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7988 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7989 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007990 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007991 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007992 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7993 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007994 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007995 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
TienFu Chenb4b33f92015-01-20 15:06:21 +01007996 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
TienFu Chen3271cb22015-02-10 09:09:41 +01007997 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yangc60666b2014-02-21 16:23:35 +08007998 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007999 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8000 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8001 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008002 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Keith Packard98973f22015-07-15 12:14:39 -07008003 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008004 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8005 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08008006 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008007 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008008 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008009 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008010 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8011 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8012 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8013 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8014 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008015 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008016 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08008017 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008018 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8019 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8020 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008021 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8022 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008023 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08008024 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008025 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008026 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008027 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8028 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008029 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8030 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008031 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008032 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8033 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8034 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8035 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwaif8839822016-02-25 14:31:59 +01008036 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008037 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8038 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Takashi Iwai563785e2018-11-12 09:43:12 +01008039 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08008040 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01008041 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Takashi Iwaiaeedad22020-11-28 10:00:15 +01008042 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008043 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8044 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05008045 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02008046 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Sam Bazleyd33cd422019-09-01 03:31:30 +01008047 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008048 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Kai-Heng Fenga5980982020-12-30 20:56:35 +08008049 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008050 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Kailang Yang56496252020-07-29 15:09:27 +08008051 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Qiu Wenbo08befca2020-10-02 20:44:54 +08008052 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08008053 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08008054 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Jeremy Szu91bc1562021-01-06 21:05:46 +08008055 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8056 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8057 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8058 ALC285_FIXUP_HP_GPIO_AMP_INIT),
Manuel Jiménez48422952020-12-29 15:38:56 +01008059 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008060 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szu417eadf2021-03-30 19:44:27 +08008061 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008062 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8063 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008064 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Jeremy Szu53b861b2021-03-16 17:42:35 +08008065 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuca688332021-03-16 14:54:50 +08008066 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008067 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02008068 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02008069 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01008070 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008071 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008072 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02008073 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008074 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiu5cfca592020-12-07 15:27:55 +08008075 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008076 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8077 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008078 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
8079 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
8080 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01008081 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01008082 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02008083 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Chris Chiu48e01502019-12-30 11:11:18 +08008084 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Daniel Drake8c8967a2019-10-17 16:15:01 +08008085 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08008086 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08008087 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan5de3b942021-01-22 13:47:06 +08008088 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08008089 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08008090 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02008091 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06008092 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02008093 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02008094 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06008095 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008096 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiu7e413522020-12-09 12:57:30 +08008097 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008098 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Kailang Yangef9ce662020-11-03 15:40:35 +08008099 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
Armas Spann4b43d052020-07-24 16:06:16 +02008100 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Armas Spann293a92c2020-07-24 16:08:37 +02008101 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Luke D Jonesc3cdf182020-09-07 20:19:59 +12008102 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Chris Chiueeed4cd2017-02-28 14:17:15 -06008103 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02008104 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8105 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8106 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8107 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02008108 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01008109 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02008110 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008111 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8112 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8113 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02008114 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02008115 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02008116 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02008117 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Takashi Iwai88776f32015-05-01 09:20:34 +02008118 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01008119 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
David Henningsson2041d562014-06-13 11:15:44 +02008120 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08008121 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02008122 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
PeiSen Houce2e79b2020-12-31 11:57:28 +01008123 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8124 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09008125 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02008126 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07008127 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8128 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07008129 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09008130 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8131 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01008132 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09008133 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02008134 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8135 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01008136 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Chris Chiu6ca653e2020-12-22 23:04:58 +08008137 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008138 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller89e3a562019-01-30 16:12:31 -07008139 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008140 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8141 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8142 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8143 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8144 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8145 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8146 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8147 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8148 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8149 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8150 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8151 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8152 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8153 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8154 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8155 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8156 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8157 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8158 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8159 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8160 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8161 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8162 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8163 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8164 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8165 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8166 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller80a50522019-05-07 17:11:08 -04008167 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller891afcf2019-05-10 10:15:07 -04008168 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8169 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
8170 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
Eckhart Mohr48698c92021-03-02 17:25:22 +01008171 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008172 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8173 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8174 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8175 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8176 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8177 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8178 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8179 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8180 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8181 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008182 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Hui Wangef0b3202020-04-27 11:00:39 +08008183 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008184 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8185 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8186 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8187 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8188 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaib590b382020-05-14 18:05:33 +02008189 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02008190 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02008191 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02008192 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02008193 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02008194 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01008195 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02008196 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02008197 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05008198 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02008199 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01008200 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02008201 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01008202 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07008203 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02008204 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008205 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8206 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02008207 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02008208 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008209 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8210 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8211 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01008212 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008213 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8214 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8215 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01008216 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09008217 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02008218 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang Yang446b8182020-11-02 15:00:12 +08008219 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8220 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Kailang3694cb22015-12-28 11:35:24 +08008221 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08008222 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08008223 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02008224 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08008225 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08008226 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08008227 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08008228 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08008229 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8230 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Kailang Yangf86de9b2020-10-23 14:46:47 +08008231 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
David Henningsson56f27012016-01-11 09:33:14 +01008232 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01008233 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02008234 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
David Henningssona4a9e082013-08-16 14:09:01 +02008235 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02008236 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02008237 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008238 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02008239 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01008240 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02008241 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02008242 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08008243 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008244 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02008245 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008246 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008247 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8248 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8249 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008250 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008251 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8252 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningsson012e7eb2012-08-08 08:43:37 +02008253 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008254 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008255 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008256 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8257 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8258 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02008259 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Hui Wangfc19d552020-09-09 10:00:41 +08008260 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Xiaoliang Yub95bc122021-03-16 00:49:00 +08008261 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang695d1ec2019-11-21 10:54:27 +08008262 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Xiaoliang Yue1c86212021-03-13 07:54:53 +08008263 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008264 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008265 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8266 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008267 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Werner Sembach73e71612021-03-02 19:04:14 +01008268 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008269
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01008270#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02008271 /* Below is a quirk table taken from the old code.
8272 * Basically the device should work as is without the fixup table.
8273 * If BIOS doesn't give a proper info, enable the corresponding
8274 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008275 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02008276 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8277 ALC269_FIXUP_AMIC),
8278 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008279 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8280 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8281 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8282 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8283 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8284 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8285 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8286 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8287 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8288 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8289 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8290 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8291 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8292 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8293 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8294 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8295 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8296 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8297 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8298 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8299 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8300 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8301 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8302 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8303 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8304 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8305 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8306 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8307 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8308 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8309 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8310 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8311 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8312 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8313 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8314 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8315 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8316 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8317#endif
8318 {}
8319};
8320
David Henningsson214eef72014-07-22 14:09:35 +02008321static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8322 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8323 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8324 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8325 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008326 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02008327 {}
8328};
8329
Takashi Iwai1727a772013-01-10 09:52:52 +01008330static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02008331 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8332 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008333 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8334 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8335 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02008336 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02008337 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8338 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02008339 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02008340 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008341 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008342 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02008343 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8344 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008345 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8346 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08008347 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08008348 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02008349 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01008350 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02008351 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02008352 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008353 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008354 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02008355 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008356 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8357 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8358 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8359 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8360 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8361 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8362 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8363 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8364 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8365 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8366 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8367 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8368 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8369 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8370 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8371 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8372 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8373 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8374 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8375 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8376 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8377 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8378 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8379 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8380 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8381 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8382 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8383 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8384 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8385 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8386 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8387 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8388 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8389 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8390 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8391 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8392 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8393 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8394 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8395 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01008396 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008397 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
8398 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8399 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8400 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8401 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8402 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8403 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8404 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8405 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8406 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8407 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8408 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8409 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8410 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8411 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008412 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8413 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8414 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08008415 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008416 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01008417 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008418 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8419 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8420 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8421 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8422 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8423 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8424 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8425 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8426 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8427 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8428 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8429 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8430 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8431 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8432 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8433 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8434 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08008435 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8436 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008437 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02008438 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008439 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07008440 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08008441 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08008442 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008443 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02008444 {}
8445};
Kailang Yangcfc5a842016-02-03 15:20:39 +08008446#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08008447 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02008448
Hui Wange8191a82015-04-24 13:39:59 +08008449#define ALC256_STANDARD_PINS \
8450 {0x12, 0x90a60140}, \
8451 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08008452 {0x21, 0x02211020}
8453
David Henningssonfea185e2014-09-03 10:23:04 +02008454#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008455 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08008456
David Henningssonfea185e2014-09-03 10:23:04 +02008457#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008458 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02008459
8460#define ALC292_STANDARD_PINS \
8461 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08008462 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08008463
Hui Wang3f6409702016-09-11 11:26:16 +08008464#define ALC295_STANDARD_PINS \
8465 {0x12, 0xb7a60130}, \
8466 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08008467 {0x21, 0x04211020}
8468
Woodrow Shen703867e2015-08-05 12:34:12 +08008469#define ALC298_STANDARD_PINS \
8470 {0x12, 0x90a60130}, \
8471 {0x21, 0x03211020}
8472
Hui Wange1918932014-05-26 16:22:44 +08008473static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08008474 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
8475 {0x14, 0x01014020},
8476 {0x17, 0x90170110},
8477 {0x18, 0x02a11030},
8478 {0x19, 0x0181303F},
8479 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06008480 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8481 {0x12, 0x90a601c0},
8482 {0x14, 0x90171120},
8483 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06008484 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8485 {0x14, 0x90170110},
8486 {0x1b, 0x90a70130},
8487 {0x21, 0x03211020}),
8488 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8489 {0x1a, 0x90a70130},
8490 {0x1b, 0x90170110},
8491 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01008492 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008493 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008494 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008495 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01008496 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008497 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008498 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008499 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08008500 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8501 ALC225_STANDARD_PINS,
8502 {0x12, 0xb7a60150},
8503 {0x14, 0x901701a0}),
8504 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8505 ALC225_STANDARD_PINS,
8506 {0x12, 0xb7a60150},
8507 {0x14, 0x901701b0}),
8508 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8509 ALC225_STANDARD_PINS,
8510 {0x12, 0xb7a60130},
8511 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05008512 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8513 {0x1b, 0x01111010},
8514 {0x1e, 0x01451130},
8515 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08008516 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
8517 {0x12, 0x90a60140},
8518 {0x14, 0x90170110},
8519 {0x19, 0x02a11030},
8520 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08008521 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8522 {0x14, 0x90170110},
8523 {0x19, 0x02a11030},
8524 {0x1a, 0x02a11040},
8525 {0x1b, 0x01014020},
8526 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08008527 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8528 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08008529 {0x19, 0x02a11030},
8530 {0x1a, 0x02a11040},
8531 {0x1b, 0x01011020},
8532 {0x21, 0x0221101f}),
8533 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8534 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08008535 {0x19, 0x02a11020},
8536 {0x1a, 0x02a11030},
8537 {0x21, 0x0221101f}),
Kailang Yang92666d42020-11-19 17:04:21 +08008538 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
8539 {0x21, 0x02211010}),
Kailang Yang9e885772020-11-03 15:30:51 +08008540 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8541 {0x14, 0x90170110},
8542 {0x19, 0x02a11020},
8543 {0x21, 0x02211030}),
Hui Wangc77900e2014-09-03 11:31:07 +08008544 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08008545 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08008546 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02008547 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08008548 {0x14, 0x90170130},
8549 {0x21, 0x02211040}),
8550 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008551 {0x12, 0x90a60140},
8552 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02008553 {0x21, 0x02211020}),
8554 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8555 {0x12, 0x90a60160},
8556 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008557 {0x21, 0x02211030}),
8558 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08008559 {0x14, 0x90170110},
8560 {0x1b, 0x02011020},
8561 {0x21, 0x0221101f}),
8562 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08008563 {0x14, 0x90170110},
8564 {0x1b, 0x01011020},
8565 {0x21, 0x0221101f}),
8566 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02008567 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02008568 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02008569 {0x21, 0x0221103f}),
8570 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08008571 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08008572 {0x1b, 0x01011020},
8573 {0x21, 0x0221103f}),
8574 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8575 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08008576 {0x1b, 0x02011020},
8577 {0x21, 0x0221103f}),
8578 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008579 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008580 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008581 {0x21, 0x0221105f}),
8582 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008583 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008584 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008585 {0x21, 0x0221101f}),
8586 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008587 {0x12, 0x90a60160},
8588 {0x14, 0x90170120},
8589 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008590 {0x21, 0x0321102f}),
8591 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8592 {0x12, 0x90a60160},
8593 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008594 {0x21, 0x02211040}),
8595 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8596 {0x12, 0x90a60160},
8597 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008598 {0x21, 0x02211050}),
8599 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8600 {0x12, 0x90a60170},
8601 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008602 {0x21, 0x02211030}),
8603 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8604 {0x12, 0x90a60170},
8605 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008606 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08008607 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08008608 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08008609 {0x14, 0x90171130},
8610 {0x21, 0x02211040}),
8611 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8612 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08008613 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08008614 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02008615 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02008616 {0x12, 0x90a60180},
8617 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02008618 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08008619 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8620 {0x12, 0x90a60180},
8621 {0x14, 0x90170120},
8622 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08008623 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8624 {0x1b, 0x01011020},
8625 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008626 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8627 {0x14, 0x90170110},
8628 {0x1b, 0x90a70130},
8629 {0x21, 0x04211020}),
8630 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8631 {0x14, 0x90170110},
8632 {0x1b, 0x90a70130},
8633 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08008634 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08008635 {0x12, 0x90a60130},
8636 {0x14, 0x90170110},
8637 {0x21, 0x03211020}),
8638 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08008639 {0x12, 0x90a60130},
8640 {0x14, 0x90170110},
8641 {0x21, 0x04211020}),
8642 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08008643 {0x1a, 0x90a70130},
8644 {0x1b, 0x90170110},
8645 {0x21, 0x03211020}),
Kailang Yang9e885772020-11-03 15:30:51 +08008646 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8647 {0x14, 0x90170110},
8648 {0x19, 0x02a11020},
8649 {0x21, 0x0221101f}),
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008650 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
8651 {0x17, 0x90170110},
8652 {0x19, 0x03a11030},
8653 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01008654 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
8655 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01008656 {0x14, 0x90170110},
8657 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008658 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08008659 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
8660 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08008661 {0x14, 0x90170110},
8662 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08008663 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08008664 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08008665 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02008666 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008667 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02008668 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02008669 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02008670 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08008671 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008672 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008673 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008674 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008675 {0x21, 0x03211040}),
8676 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008677 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008678 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008679 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08008680 {0x21, 0x03211020}),
8681 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008682 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008683 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008684 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008685 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08008686 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02008687 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08008688 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08008689 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08008690 {0x21, 0x04211020}),
Chris Chiu34cdf402020-12-16 20:52:00 +08008691 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
8692 ALC282_STANDARD_PINS,
8693 {0x12, 0x90a609c0},
8694 {0x18, 0x03a11830},
8695 {0x19, 0x04a19831},
8696 {0x1a, 0x0481303f},
8697 {0x1b, 0x04211020},
8698 {0x21, 0x0321101f}),
8699 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
8700 ALC282_STANDARD_PINS,
8701 {0x12, 0x90a60940},
8702 {0x18, 0x03a11830},
8703 {0x19, 0x04a19831},
8704 {0x1a, 0x0481303f},
8705 {0x1b, 0x04211020},
8706 {0x21, 0x0321101f}),
David Henningsson76c21322014-06-24 14:46:54 +02008707 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008708 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02008709 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02008710 {0x21, 0x0321101f}),
8711 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8712 {0x12, 0x90a60160},
8713 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008714 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08008715 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008716 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08008717 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08008718 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08008719 {0x21, 0x0321101f}),
Kailang Yang607184c2020-12-11 14:17:09 +08008720 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
8721 {0x14, 0x90170110},
8722 {0x19, 0x04a11040},
8723 {0x21, 0x04211020}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08008724 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Hui Wangc4cfcf62018-11-26 14:17:16 +08008725 {0x12, 0x90a60130},
8726 {0x14, 0x90170110},
8727 {0x19, 0x04a11040},
8728 {0x21, 0x04211020}),
Hui Wangc72b9bf2020-12-05 13:11:30 +08008729 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8730 {0x14, 0x90170110},
8731 {0x17, 0x90170111},
8732 {0x19, 0x03a11030},
8733 {0x21, 0x03211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08008734 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
8735 {0x12, 0x90a60130},
8736 {0x17, 0x90170110},
8737 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02008738 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08008739 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08008740 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08008741 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08008742 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008743 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008744 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08008745 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08008746 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008747 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008748 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008749 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08008750 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008751 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008752 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008753 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008754 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008755 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008756 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008757 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008758 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008759 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08008760 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008761 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008762 {0x14, 0x90170110},
8763 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008764 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08008765 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008766 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008767 {0x14, 0x90170110},
8768 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008769 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008770 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008771 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008772 {0x14, 0x90170110},
8773 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008774 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08008775 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008776 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08008777 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08008778 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08008779 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08008780 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008781 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08008782 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08008783 {0x16, 0x01014020},
8784 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08008785 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02008786 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008787 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08008788 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02008789 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008790 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02008791 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02008792 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08008793 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02008794 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008795 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08008796 {0x13, 0x90a60140}),
Jian-Hong Paneeacd802020-11-24 17:20:25 +08008797 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
8798 {0x17, 0x90170110},
8799 {0x21, 0x04211020}),
Chris Chiud8ae4582018-12-07 17:17:11 +08008800 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
8801 {0x14, 0x90170110},
8802 {0x1b, 0x90a70130},
8803 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08008804 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8805 {0x12, 0x90a60130},
8806 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08008807 {0x21, 0x03211020}),
8808 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8809 {0x12, 0x90a60130},
8810 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08008811 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02008812 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8813 {0x12, 0x90a60130},
8814 {0x17, 0x90170110},
8815 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08008816 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08008817 {0x12, 0x90a60120},
8818 {0x17, 0x90170110},
8819 {0x21, 0x04211030}),
8820 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08008821 {0x12, 0x90a60130},
8822 {0x17, 0x90170110},
8823 {0x21, 0x03211020}),
8824 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8825 {0x12, 0x90a60130},
8826 {0x17, 0x90170110},
8827 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08008828 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08008829 {0x14, 0x90170110},
8830 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08008831 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8832 {0x14, 0x90170110},
8833 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08008834 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08008835 ALC295_STANDARD_PINS,
8836 {0x17, 0x21014020},
8837 {0x18, 0x21a19030}),
8838 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8839 ALC295_STANDARD_PINS,
8840 {0x17, 0x21014040},
8841 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08008842 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8843 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08008844 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08008845 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02008846 {0x17, 0x90170110}),
8847 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8848 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08008849 {0x17, 0x90170140}),
8850 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8851 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02008852 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08008853 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
8854 {0x12, 0xb7a60140},
8855 {0x13, 0xb7a60150},
8856 {0x17, 0x90170110},
8857 {0x1a, 0x03011020},
8858 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00008859 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
8860 {0x12, 0xb7a60140},
8861 {0x17, 0x90170110},
8862 {0x1a, 0x03a11030},
8863 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08008864 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8865 ALC225_STANDARD_PINS,
8866 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08008867 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08008868 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
8869 {0x14, 0x01014010},
8870 {0x17, 0x90170120},
8871 {0x18, 0x02a11030},
8872 {0x19, 0x02a1103f},
8873 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08008874 {}
8875};
Takashi Iwai1d045db2011-07-07 18:23:21 +02008876
Hui Wang7c0a6932019-08-16 14:27:40 +08008877/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
8878 * more machines, don't need to match all valid pins, just need to match
8879 * all the pins defined in the tbl. Just because of this reason, it is possible
8880 * that a single machine matches multiple tbls, so there is one limitation:
8881 * at most one tbl is allowed to define for the same vendor and same codec
8882 */
8883static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
8884 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8885 {0x19, 0x40000000},
8886 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08008887 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8888 {0x19, 0x40000000},
8889 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08008890 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8891 {0x19, 0x40000000},
8892 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08008893 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
8894 {0x19, 0x40000000},
8895 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08008896 {}
8897};
8898
Takashi Iwai546bb672012-03-07 08:37:19 +01008899static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02008900{
Kailang Yang526af6e2012-03-07 08:25:20 +01008901 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008902 int val;
8903
Kailang Yang526af6e2012-03-07 08:25:20 +01008904 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01008905 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01008906
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008907 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008908 alc_write_coef_idx(codec, 0xf, 0x960b);
8909 alc_write_coef_idx(codec, 0xe, 0x8817);
8910 }
8911
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008912 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008913 alc_write_coef_idx(codec, 0xf, 0x960b);
8914 alc_write_coef_idx(codec, 0xe, 0x8814);
8915 }
8916
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008917 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008918 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02008919 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008920 }
8921
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008922 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008923 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02008924 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008925 /* Capless ramp up clock control */
8926 alc_write_coef_idx(codec, 0xd, val | (1<<10));
8927 }
8928 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02008929 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008930 /* Class D power on reset */
8931 alc_write_coef_idx(codec, 0x17, val | (1<<7));
8932 }
8933 }
8934
Takashi Iwai98b24882014-08-18 13:47:50 +02008935 /* HP */
8936 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008937}
8938
8939/*
8940 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008941static int patch_alc269(struct hda_codec *codec)
8942{
8943 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02008944 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008945
Takashi Iwai3de95172012-05-07 18:03:15 +02008946 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008947 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02008948 return err;
8949
8950 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01008951 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08008952 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008953
Takashi Iwai225068a2015-05-29 10:42:14 +02008954#ifdef CONFIG_PM
8955 codec->patch_ops.suspend = alc269_suspend;
8956 codec->patch_ops.resume = alc269_resume;
8957#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08008958 spec->shutup = alc_default_shutup;
8959 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02008960
Takashi Iwai7639a062015-03-03 10:07:24 +01008961 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01008962 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02008963 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008964 switch (alc_get_coef0(codec) & 0x00f0) {
8965 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01008966 if (codec->bus->pci &&
8967 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008968 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008969 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02008970 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008971 break;
8972 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01008973 if (codec->bus->pci &&
8974 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008975 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008976 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02008977 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008978 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02008979 case 0x0030:
8980 spec->codec_variant = ALC269_TYPE_ALC269VD;
8981 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008982 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02008983 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008984 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008985 if (err < 0)
8986 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08008987 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01008988 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008989 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01008990 break;
8991
8992 case 0x10ec0280:
8993 case 0x10ec0290:
8994 spec->codec_variant = ALC269_TYPE_ALC280;
8995 break;
8996 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01008997 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08008998 spec->shutup = alc282_shutup;
8999 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01009000 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02009001 case 0x10ec0233:
9002 case 0x10ec0283:
9003 spec->codec_variant = ALC269_TYPE_ALC283;
9004 spec->shutup = alc283_shutup;
9005 spec->init_hook = alc283_init;
9006 break;
Kailang Yang065380f2013-01-10 10:25:48 +01009007 case 0x10ec0284:
9008 case 0x10ec0292:
9009 spec->codec_variant = ALC269_TYPE_ALC284;
9010 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02009011 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08009012 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02009013 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02009014 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08009015 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02009016 spec->codec_variant = ALC269_TYPE_ALC286;
9017 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08009018 case 0x10ec0298:
9019 spec->codec_variant = ALC269_TYPE_ALC298;
9020 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08009021 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009022 case 0x10ec0255:
9023 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08009024 spec->shutup = alc256_shutup;
9025 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009026 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08009027 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08009028 case 0x10ec0256:
9029 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08009030 spec->shutup = alc256_shutup;
9031 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02009032 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08009033 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009034 case 0x10ec0257:
9035 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08009036 spec->shutup = alc256_shutup;
9037 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009038 spec->gen.mixer_nid = 0;
9039 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009040 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +08009041 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009042 case 0x10ec0285:
Kailang Yang630e3612020-05-27 14:10:26 +08009043 case 0x10ec0287:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009044 case 0x10ec0289:
9045 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08009046 spec->shutup = alc225_shutup;
9047 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009048 spec->gen.mixer_nid = 0;
9049 break;
Kailang Yang42314302016-02-03 15:03:50 +08009050 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08009051 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08009052 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08009053 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08009054 spec->shutup = alc225_shutup;
9055 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01009056 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08009057 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009058 case 0x10ec0234:
9059 case 0x10ec0274:
9060 case 0x10ec0294:
9061 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08009062 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08009063 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08009064 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009065 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08009066 case 0x10ec0300:
9067 spec->codec_variant = ALC269_TYPE_ALC300;
9068 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009069 break;
Kailang Yangf0778872019-10-24 15:13:32 +08009070 case 0x10ec0623:
9071 spec->codec_variant = ALC269_TYPE_ALC623;
9072 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08009073 case 0x10ec0700:
9074 case 0x10ec0701:
9075 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +08009076 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +08009077 spec->codec_variant = ALC269_TYPE_ALC700;
9078 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08009079 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08009080 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08009081 break;
9082
Takashi Iwai1d045db2011-07-07 18:23:21 +02009083 }
9084
Kailang Yangad60d502013-06-28 12:03:01 +02009085 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05009086 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02009087 spec->init_hook = alc5505_dsp_init;
9088 }
9089
Takashi Iwaic9af7532019-05-10 11:01:43 +02009090 alc_pre_init(codec);
9091
Takashi Iwaiefe55732018-06-15 11:55:02 +02009092 snd_hda_pick_fixup(codec, alc269_fixup_models,
9093 alc269_fixup_tbl, alc269_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +08009094 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +08009095 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +02009096 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9097 alc269_fixups);
9098 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9099
9100 alc_auto_parse_customize_define(codec);
9101
9102 if (has_cdefine_beep(codec))
9103 spec->gen.beep_nid = 0x01;
9104
Takashi Iwaia4297b52011-08-23 18:40:12 +02009105 /* automatic parse from the BIOS config */
9106 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009107 if (err < 0)
9108 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009109
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009110 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9111 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9112 if (err < 0)
9113 goto error;
9114 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009115
Takashi Iwai1727a772013-01-10 09:52:52 +01009116 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009117
Takashi Iwai1d045db2011-07-07 18:23:21 +02009118 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009119
9120 error:
9121 alc_free(codec);
9122 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009123}
9124
9125/*
9126 * ALC861
9127 */
9128
Takashi Iwai1d045db2011-07-07 18:23:21 +02009129static int alc861_parse_auto_config(struct hda_codec *codec)
9130{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009131 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009132 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9133 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009134}
9135
Takashi Iwai1d045db2011-07-07 18:23:21 +02009136/* Pin config fixes */
9137enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009138 ALC861_FIXUP_FSC_AMILO_PI1505,
9139 ALC861_FIXUP_AMP_VREF_0F,
9140 ALC861_FIXUP_NO_JACK_DETECT,
9141 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009142 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009143};
9144
Takashi Iwai31150f22012-01-30 10:54:08 +01009145/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9146static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009147 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01009148{
9149 struct alc_spec *spec = codec->spec;
9150 unsigned int val;
9151
Takashi Iwai1727a772013-01-10 09:52:52 +01009152 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01009153 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01009154 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01009155 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9156 val |= AC_PINCTL_IN_EN;
9157 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02009158 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01009159 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01009160}
9161
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009162/* suppress the jack-detection */
9163static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009164 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009165{
Takashi Iwai1727a772013-01-10 09:52:52 +01009166 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009167 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009168}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009169
Takashi Iwai1727a772013-01-10 09:52:52 +01009170static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009171 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009172 .type = HDA_FIXUP_PINS,
9173 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009174 { 0x0b, 0x0221101f }, /* HP */
9175 { 0x0f, 0x90170310 }, /* speaker */
9176 { }
9177 }
9178 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009179 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009180 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01009181 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01009182 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009183 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009184 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009185 .v.func = alc_fixup_no_jack_detect,
9186 },
9187 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009188 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009189 .v.func = alc861_fixup_asus_amp_vref_0f,
9190 .chained = true,
9191 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009192 },
9193 [ALC660_FIXUP_ASUS_W7J] = {
9194 .type = HDA_FIXUP_VERBS,
9195 .v.verbs = (const struct hda_verb[]) {
9196 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9197 * for enabling outputs
9198 */
9199 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9200 { }
9201 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009202 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009203};
9204
9205static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009206 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01009207 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009208 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9209 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9210 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
9211 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
9212 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
9213 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009214 {}
9215};
9216
9217/*
9218 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009219static int patch_alc861(struct hda_codec *codec)
9220{
9221 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009222 int err;
9223
Takashi Iwai3de95172012-05-07 18:03:15 +02009224 err = alc_alloc_spec(codec, 0x15);
9225 if (err < 0)
9226 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009227
Takashi Iwai3de95172012-05-07 18:03:15 +02009228 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009229 if (has_cdefine_beep(codec))
9230 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009231
Takashi Iwai225068a2015-05-29 10:42:14 +02009232#ifdef CONFIG_PM
9233 spec->power_hook = alc_power_eapd;
9234#endif
9235
Takashi Iwaic9af7532019-05-10 11:01:43 +02009236 alc_pre_init(codec);
9237
Takashi Iwai1727a772013-01-10 09:52:52 +01009238 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9239 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009240
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009241 /* automatic parse from the BIOS config */
9242 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009243 if (err < 0)
9244 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009245
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009246 if (!spec->gen.no_analog) {
9247 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9248 if (err < 0)
9249 goto error;
9250 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009251
Takashi Iwai1727a772013-01-10 09:52:52 +01009252 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009253
Takashi Iwai1d045db2011-07-07 18:23:21 +02009254 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009255
9256 error:
9257 alc_free(codec);
9258 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009259}
9260
9261/*
9262 * ALC861-VD support
9263 *
9264 * Based on ALC882
9265 *
9266 * In addition, an independent DAC
9267 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009268static int alc861vd_parse_auto_config(struct hda_codec *codec)
9269{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009270 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009271 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9272 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009273}
9274
Takashi Iwai1d045db2011-07-07 18:23:21 +02009275enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009276 ALC660VD_FIX_ASUS_GPIO1,
9277 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009278};
9279
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009280/* exclude VREF80 */
9281static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009282 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009283{
Takashi Iwai1727a772013-01-10 09:52:52 +01009284 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01009285 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9286 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009287 }
9288}
9289
Takashi Iwaidf73d832018-06-19 23:05:47 +02009290/* reset GPIO1 */
9291static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9292 const struct hda_fixup *fix, int action)
9293{
9294 struct alc_spec *spec = codec->spec;
9295
9296 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9297 spec->gpio_mask |= 0x02;
9298 alc_fixup_gpio(codec, action, 0x01);
9299}
9300
Takashi Iwai1727a772013-01-10 09:52:52 +01009301static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009302 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +02009303 .type = HDA_FIXUP_FUNC,
9304 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009305 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009306 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009307 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009308 .v.func = alc861vd_fixup_dallas,
9309 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02009310};
9311
9312static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009313 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009314 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009315 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009316 {}
9317};
9318
Takashi Iwai1d045db2011-07-07 18:23:21 +02009319/*
9320 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009321static int patch_alc861vd(struct hda_codec *codec)
9322{
9323 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009324 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009325
Takashi Iwai3de95172012-05-07 18:03:15 +02009326 err = alc_alloc_spec(codec, 0x0b);
9327 if (err < 0)
9328 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009329
Takashi Iwai3de95172012-05-07 18:03:15 +02009330 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009331 if (has_cdefine_beep(codec))
9332 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009333
Takashi Iwai225068a2015-05-29 10:42:14 +02009334 spec->shutup = alc_eapd_shutup;
9335
Takashi Iwaic9af7532019-05-10 11:01:43 +02009336 alc_pre_init(codec);
9337
Takashi Iwai1727a772013-01-10 09:52:52 +01009338 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
9339 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009340
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009341 /* automatic parse from the BIOS config */
9342 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009343 if (err < 0)
9344 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009345
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009346 if (!spec->gen.no_analog) {
9347 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9348 if (err < 0)
9349 goto error;
9350 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009351
Takashi Iwai1727a772013-01-10 09:52:52 +01009352 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009353
Takashi Iwai1d045db2011-07-07 18:23:21 +02009354 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009355
9356 error:
9357 alc_free(codec);
9358 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009359}
9360
9361/*
9362 * ALC662 support
9363 *
9364 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9365 * configuration. Each pin widget can choose any input DACs and a mixer.
9366 * Each ADC is connected from a mixer of all inputs. This makes possible
9367 * 6-channel independent captures.
9368 *
9369 * In addition, an independent DAC for the multi-playback (not used in this
9370 * driver yet).
9371 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009372
9373/*
9374 * BIOS auto configuration
9375 */
9376
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009377static int alc662_parse_auto_config(struct hda_codec *codec)
9378{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02009379 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009380 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9381 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9382 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02009383
Takashi Iwai7639a062015-03-03 10:07:24 +01009384 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9385 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9386 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009387 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01009388 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009389 ssids = alc662_ssids;
9390 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009391}
9392
Todd Broch6be79482010-12-07 16:51:05 -08009393static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009394 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009395{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01009396 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009397 return;
Todd Broch6be79482010-12-07 16:51:05 -08009398 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9399 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9400 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9401 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9402 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01009403 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08009404}
9405
Takashi Iwai8e383952013-10-30 17:41:12 +01009406static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9407 { .channels = 2,
9408 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9409 { .channels = 4,
9410 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9411 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9412 { }
9413};
9414
9415/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009416static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01009417 const struct hda_fixup *fix, int action)
9418{
9419 if (action == HDA_FIXUP_ACT_BUILD) {
9420 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01009421 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01009422 }
9423}
9424
Takashi Iwaibf686652014-01-13 16:18:25 +01009425/* avoid D3 for keeping GPIO up */
9426static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9427 hda_nid_t nid,
9428 unsigned int power_state)
9429{
9430 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02009431 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01009432 return AC_PWRST_D0;
9433 return power_state;
9434}
9435
Takashi Iwai3e887f32014-01-10 17:50:58 +01009436static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9437 const struct hda_fixup *fix, int action)
9438{
9439 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009440
Takashi Iwai01e4a272018-06-19 22:47:30 +02009441 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01009442 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01009443 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01009444 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009445 }
9446}
9447
Kailang Yangc6790c82016-11-25 16:15:17 +08009448static void alc662_usi_automute_hook(struct hda_codec *codec,
9449 struct hda_jack_callback *jack)
9450{
9451 struct alc_spec *spec = codec->spec;
9452 int vref;
9453 msleep(200);
9454 snd_hda_gen_hp_automute(codec, jack);
9455
9456 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
9457 msleep(100);
9458 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9459 vref);
9460}
9461
9462static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
9463 const struct hda_fixup *fix, int action)
9464{
9465 struct alc_spec *spec = codec->spec;
9466 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9467 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9468 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
9469 }
9470}
9471
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009472static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
9473 struct hda_jack_callback *cb)
9474{
9475 /* surround speakers at 0x1b already get muted automatically when
9476 * headphones are plugged in, but we have to mute/unmute the remaining
9477 * channels manually:
9478 * 0x15 - front left/front right
9479 * 0x18 - front center/ LFE
9480 */
9481 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
9482 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
9483 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
9484 } else {
9485 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
9486 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
9487 }
9488}
9489
9490static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
9491 const struct hda_fixup *fix, int action)
9492{
9493 /* Pin 0x1b: shared headphones jack and surround speakers */
9494 if (!is_jack_detectable(codec, 0x1b))
9495 return;
9496
9497 switch (action) {
9498 case HDA_FIXUP_ACT_PRE_PROBE:
9499 snd_hda_jack_detect_enable_callback(codec, 0x1b,
9500 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +01009501 /* subwoofer needs an extra GPIO setting to become audible */
9502 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009503 break;
9504 case HDA_FIXUP_ACT_INIT:
9505 /* Make sure to start in a correct state, i.e. if
9506 * headphones have been plugged in before powering up the system
9507 */
9508 alc662_aspire_ethos_mute_speakers(codec, NULL);
9509 break;
9510 }
9511}
9512
Kailang Yang5af290282020-01-17 14:04:01 +08009513static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
9514 const struct hda_fixup *fix, int action)
9515{
9516 struct alc_spec *spec = codec->spec;
9517
9518 static const struct hda_pintbl pincfgs[] = {
9519 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
9520 { 0x1b, 0x0181304f },
9521 { }
9522 };
9523
9524 switch (action) {
9525 case HDA_FIXUP_ACT_PRE_PROBE:
9526 spec->gen.mixer_nid = 0;
9527 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9528 snd_hda_apply_pincfgs(codec, pincfgs);
9529 break;
9530 case HDA_FIXUP_ACT_INIT:
9531 alc_write_coef_idx(codec, 0x19, 0xa054);
9532 break;
9533 }
9534}
9535
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01009536static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +08009537 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
9538 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
9539 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
9540 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
9541 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
9542 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
9543 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
9544 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
9545 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
9546 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
9547 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
9548 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
9549 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
9550 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
9551 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
9552 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
9553 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
9554 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
9555 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
9556 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
9557 {}
9558};
9559
9560static void alc668_restore_default_value(struct hda_codec *codec)
9561{
9562 alc_process_coef_fw(codec, alc668_coefs);
9563}
9564
David Henningsson6cb3b702010-09-09 08:51:44 +02009565enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04009566 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01009567 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009568 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08009569 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009570 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009571 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02009572 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009573 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02009574 ALC662_FIXUP_ASUS_MODE1,
9575 ALC662_FIXUP_ASUS_MODE2,
9576 ALC662_FIXUP_ASUS_MODE3,
9577 ALC662_FIXUP_ASUS_MODE4,
9578 ALC662_FIXUP_ASUS_MODE5,
9579 ALC662_FIXUP_ASUS_MODE6,
9580 ALC662_FIXUP_ASUS_MODE7,
9581 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009582 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02009583 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02009584 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009585 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02009586 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009587 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02009588 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009589 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01009590 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009591 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009592 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08009593 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009594 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009595 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009596 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009597 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009598 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009599 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +02009600 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009601 ALC891_FIXUP_HEADSET_MODE,
9602 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009603 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009604 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08009605 ALC662_FIXUP_USI_FUNC,
9606 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08009607 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009608 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009609 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +08009610 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +08009611 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +08009612 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
David Henningsson6cb3b702010-09-09 08:51:44 +02009613};
9614
Takashi Iwai1727a772013-01-10 09:52:52 +01009615static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04009616 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009617 .type = HDA_FIXUP_PINS,
9618 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04009619 { 0x15, 0x99130112 }, /* subwoofer */
9620 { }
9621 }
9622 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01009623 [ALC662_FIXUP_LED_GPIO1] = {
9624 .type = HDA_FIXUP_FUNC,
9625 .v.func = alc662_fixup_led_gpio1,
9626 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009627 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009628 .type = HDA_FIXUP_PINS,
9629 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02009630 { 0x17, 0x99130112 }, /* subwoofer */
9631 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01009632 },
9633 .chained = true,
9634 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009635 },
Todd Broch6be79482010-12-07 16:51:05 -08009636 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009637 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01009638 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009639 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009640 [ALC662_FIXUP_CZC_ET26] = {
9641 .type = HDA_FIXUP_PINS,
9642 .v.pins = (const struct hda_pintbl[]) {
9643 {0x12, 0x403cc000},
9644 {0x14, 0x90170110}, /* speaker */
9645 {0x15, 0x411111f0},
9646 {0x16, 0x411111f0},
9647 {0x18, 0x01a19030}, /* mic */
9648 {0x19, 0x90a7013f}, /* int-mic */
9649 {0x1a, 0x01014020},
9650 {0x1b, 0x0121401f},
9651 {0x1c, 0x411111f0},
9652 {0x1d, 0x411111f0},
9653 {0x1e, 0x40478e35},
9654 {}
9655 },
9656 .chained = true,
9657 .chain_id = ALC662_FIXUP_SKU_IGNORE
9658 },
Anisse Astierd2ebd472011-01-20 12:36:21 +01009659 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009660 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009661 .v.verbs = (const struct hda_verb[]) {
9662 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
9663 {}
9664 }
9665 },
David Henningsson94024cd2011-04-29 14:10:55 +02009666 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009667 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02009668 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02009669 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009670 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009671 .type = HDA_FIXUP_PINS,
9672 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009673 { 0x14, 0x0221201f }, /* HP out */
9674 { }
9675 },
9676 .chained = true,
9677 .chain_id = ALC662_FIXUP_SKU_IGNORE
9678 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009679 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009680 .type = HDA_FIXUP_PINS,
9681 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009682 { 0x14, 0x99130110 }, /* speaker */
9683 { 0x18, 0x01a19c20 }, /* mic */
9684 { 0x19, 0x99a3092f }, /* int-mic */
9685 { 0x21, 0x0121401f }, /* HP out */
9686 { }
9687 },
9688 .chained = true,
9689 .chain_id = ALC662_FIXUP_SKU_IGNORE
9690 },
9691 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009692 .type = HDA_FIXUP_PINS,
9693 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009694 { 0x14, 0x99130110 }, /* speaker */
9695 { 0x18, 0x01a19820 }, /* mic */
9696 { 0x19, 0x99a3092f }, /* int-mic */
9697 { 0x1b, 0x0121401f }, /* HP out */
9698 { }
9699 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009700 .chained = true,
9701 .chain_id = ALC662_FIXUP_SKU_IGNORE
9702 },
9703 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009704 .type = HDA_FIXUP_PINS,
9705 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009706 { 0x14, 0x99130110 }, /* speaker */
9707 { 0x15, 0x0121441f }, /* HP */
9708 { 0x18, 0x01a19840 }, /* mic */
9709 { 0x19, 0x99a3094f }, /* int-mic */
9710 { 0x21, 0x01211420 }, /* HP2 */
9711 { }
9712 },
9713 .chained = true,
9714 .chain_id = ALC662_FIXUP_SKU_IGNORE
9715 },
9716 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009717 .type = HDA_FIXUP_PINS,
9718 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009719 { 0x14, 0x99130110 }, /* speaker */
9720 { 0x16, 0x99130111 }, /* speaker */
9721 { 0x18, 0x01a19840 }, /* mic */
9722 { 0x19, 0x99a3094f }, /* int-mic */
9723 { 0x21, 0x0121441f }, /* HP */
9724 { }
9725 },
9726 .chained = true,
9727 .chain_id = ALC662_FIXUP_SKU_IGNORE
9728 },
9729 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009730 .type = HDA_FIXUP_PINS,
9731 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009732 { 0x14, 0x99130110 }, /* speaker */
9733 { 0x15, 0x0121441f }, /* HP */
9734 { 0x16, 0x99130111 }, /* speaker */
9735 { 0x18, 0x01a19840 }, /* mic */
9736 { 0x19, 0x99a3094f }, /* int-mic */
9737 { }
9738 },
9739 .chained = true,
9740 .chain_id = ALC662_FIXUP_SKU_IGNORE
9741 },
9742 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009743 .type = HDA_FIXUP_PINS,
9744 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009745 { 0x14, 0x99130110 }, /* speaker */
9746 { 0x15, 0x01211420 }, /* HP2 */
9747 { 0x18, 0x01a19840 }, /* mic */
9748 { 0x19, 0x99a3094f }, /* int-mic */
9749 { 0x1b, 0x0121441f }, /* HP */
9750 { }
9751 },
9752 .chained = true,
9753 .chain_id = ALC662_FIXUP_SKU_IGNORE
9754 },
9755 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009756 .type = HDA_FIXUP_PINS,
9757 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009758 { 0x14, 0x99130110 }, /* speaker */
9759 { 0x17, 0x99130111 }, /* speaker */
9760 { 0x18, 0x01a19840 }, /* mic */
9761 { 0x19, 0x99a3094f }, /* int-mic */
9762 { 0x1b, 0x01214020 }, /* HP */
9763 { 0x21, 0x0121401f }, /* HP */
9764 { }
9765 },
9766 .chained = true,
9767 .chain_id = ALC662_FIXUP_SKU_IGNORE
9768 },
9769 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009770 .type = HDA_FIXUP_PINS,
9771 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009772 { 0x14, 0x99130110 }, /* speaker */
9773 { 0x12, 0x99a30970 }, /* int-mic */
9774 { 0x15, 0x01214020 }, /* HP */
9775 { 0x17, 0x99130111 }, /* speaker */
9776 { 0x18, 0x01a19840 }, /* mic */
9777 { 0x21, 0x0121401f }, /* HP */
9778 { }
9779 },
9780 .chained = true,
9781 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009782 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01009783 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009784 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009785 .v.func = alc_fixup_no_jack_detect,
9786 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02009787 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009788 .type = HDA_FIXUP_PINS,
9789 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02009790 { 0x1b, 0x02214020 }, /* Front HP */
9791 { }
9792 }
9793 },
Takashi Iwai125821a2012-06-22 14:30:29 +02009794 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009795 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02009796 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02009797 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009798 [ALC668_FIXUP_DELL_XPS13] = {
9799 .type = HDA_FIXUP_FUNC,
9800 .v.func = alc_fixup_dell_xps13,
9801 .chained = true,
9802 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
9803 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009804 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
9805 .type = HDA_FIXUP_FUNC,
9806 .v.func = alc_fixup_disable_aamix,
9807 .chained = true,
9808 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9809 },
Hui Wang493a52a2014-01-14 14:07:36 +08009810 [ALC668_FIXUP_AUTO_MUTE] = {
9811 .type = HDA_FIXUP_FUNC,
9812 .v.func = alc_fixup_auto_mute_via_amp,
9813 .chained = true,
9814 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9815 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02009816 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
9817 .type = HDA_FIXUP_PINS,
9818 .v.pins = (const struct hda_pintbl[]) {
9819 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9820 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
9821 { }
9822 },
9823 .chained = true,
9824 .chain_id = ALC662_FIXUP_HEADSET_MODE
9825 },
9826 [ALC662_FIXUP_HEADSET_MODE] = {
9827 .type = HDA_FIXUP_FUNC,
9828 .v.func = alc_fixup_headset_mode_alc662,
9829 },
David Henningsson73bdd592013-04-15 15:44:14 +02009830 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
9831 .type = HDA_FIXUP_PINS,
9832 .v.pins = (const struct hda_pintbl[]) {
9833 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9834 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9835 { }
9836 },
9837 .chained = true,
9838 .chain_id = ALC668_FIXUP_HEADSET_MODE
9839 },
9840 [ALC668_FIXUP_HEADSET_MODE] = {
9841 .type = HDA_FIXUP_FUNC,
9842 .v.func = alc_fixup_headset_mode_alc668,
9843 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009844 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01009845 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009846 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01009847 .chained = true,
9848 .chain_id = ALC662_FIXUP_ASUS_MODE4
9849 },
David Henningsson61a75f12014-02-07 09:31:08 +01009850 [ALC662_FIXUP_BASS_16] = {
9851 .type = HDA_FIXUP_PINS,
9852 .v.pins = (const struct hda_pintbl[]) {
9853 {0x16, 0x80106111}, /* bass speaker */
9854 {}
9855 },
9856 .chained = true,
9857 .chain_id = ALC662_FIXUP_BASS_CHMAP,
9858 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009859 [ALC662_FIXUP_BASS_1A] = {
9860 .type = HDA_FIXUP_PINS,
9861 .v.pins = (const struct hda_pintbl[]) {
9862 {0x1a, 0x80106111}, /* bass speaker */
9863 {}
9864 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009865 .chained = true,
9866 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009867 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009868 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009869 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009870 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009871 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009872 [ALC662_FIXUP_ASUS_Nx50] = {
9873 .type = HDA_FIXUP_FUNC,
9874 .v.func = alc_fixup_auto_mute_via_amp,
9875 .chained = true,
9876 .chain_id = ALC662_FIXUP_BASS_1A
9877 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009878 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
9879 .type = HDA_FIXUP_FUNC,
9880 .v.func = alc_fixup_headset_mode_alc668,
9881 .chain_id = ALC662_FIXUP_BASS_CHMAP
9882 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009883 [ALC668_FIXUP_ASUS_Nx51] = {
9884 .type = HDA_FIXUP_PINS,
9885 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009886 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9887 { 0x1a, 0x90170151 }, /* bass speaker */
9888 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009889 {}
9890 },
9891 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009892 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009893 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009894 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +02009895 .type = HDA_FIXUP_VERBS,
9896 .v.verbs = (const struct hda_verb[]) {
9897 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
9898 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
9899 {}
9900 },
9901 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009902 [ALC668_FIXUP_ASUS_G751] = {
9903 .type = HDA_FIXUP_PINS,
9904 .v.pins = (const struct hda_pintbl[]) {
9905 { 0x16, 0x0421101f }, /* HP */
9906 {}
9907 },
9908 .chained = true,
9909 .chain_id = ALC668_FIXUP_MIC_COEF
9910 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009911 [ALC891_FIXUP_HEADSET_MODE] = {
9912 .type = HDA_FIXUP_FUNC,
9913 .v.func = alc_fixup_headset_mode,
9914 },
9915 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
9916 .type = HDA_FIXUP_PINS,
9917 .v.pins = (const struct hda_pintbl[]) {
9918 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9919 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9920 { }
9921 },
9922 .chained = true,
9923 .chain_id = ALC891_FIXUP_HEADSET_MODE
9924 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009925 [ALC662_FIXUP_ACER_VERITON] = {
9926 .type = HDA_FIXUP_PINS,
9927 .v.pins = (const struct hda_pintbl[]) {
9928 { 0x15, 0x50170120 }, /* no internal speaker */
9929 { }
9930 }
9931 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009932 [ALC892_FIXUP_ASROCK_MOBO] = {
9933 .type = HDA_FIXUP_PINS,
9934 .v.pins = (const struct hda_pintbl[]) {
9935 { 0x15, 0x40f000f0 }, /* disabled */
9936 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009937 { }
9938 }
9939 },
Kailang Yangc6790c82016-11-25 16:15:17 +08009940 [ALC662_FIXUP_USI_FUNC] = {
9941 .type = HDA_FIXUP_FUNC,
9942 .v.func = alc662_fixup_usi_headset_mic,
9943 },
9944 [ALC662_FIXUP_USI_HEADSET_MODE] = {
9945 .type = HDA_FIXUP_PINS,
9946 .v.pins = (const struct hda_pintbl[]) {
9947 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
9948 { 0x18, 0x01a1903d },
9949 { }
9950 },
9951 .chained = true,
9952 .chain_id = ALC662_FIXUP_USI_FUNC
9953 },
Kailang Yangca169cc2017-04-25 16:17:40 +08009954 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
9955 .type = HDA_FIXUP_FUNC,
9956 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
9957 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009958 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
9959 .type = HDA_FIXUP_FUNC,
9960 .v.func = alc662_fixup_aspire_ethos_hp,
9961 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009962 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
9963 .type = HDA_FIXUP_PINS,
9964 .v.pins = (const struct hda_pintbl[]) {
9965 { 0x15, 0x92130110 }, /* front speakers */
9966 { 0x18, 0x99130111 }, /* center/subwoofer */
9967 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
9968 { }
9969 },
9970 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +01009971 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009972 },
Kailang Yang5af290282020-01-17 14:04:01 +08009973 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
9974 .type = HDA_FIXUP_FUNC,
9975 .v.func = alc671_fixup_hp_headset_mic2,
9976 },
Jian-Hong Pand858c702020-03-17 16:28:07 +08009977 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
9978 .type = HDA_FIXUP_PINS,
9979 .v.pins = (const struct hda_pintbl[]) {
9980 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9981 { }
9982 },
9983 .chained = true,
9984 .chain_id = ALC662_FIXUP_USI_FUNC
9985 },
Jian-Hong Pana1244582020-03-17 16:28:09 +08009986 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
9987 .type = HDA_FIXUP_PINS,
9988 .v.pins = (const struct hda_pintbl[]) {
9989 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
9990 { 0x1b, 0x0221144f },
9991 { }
9992 },
9993 .chained = true,
9994 .chain_id = ALC662_FIXUP_USI_FUNC
9995 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009996};
9997
Takashi Iwaia9111322011-05-02 11:30:18 +02009998static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009999 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +020010000 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +010010001 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +010010002 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +020010003 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +020010004 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +020010005 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -040010006 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Jian-Hong Pana1244582020-03-17 16:28:09 +080010007 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +080010008 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +020010009 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10010 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +020010011 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010012 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +020010013 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +010010014 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +010010015 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +080010016 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10017 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +080010018 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010019 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Jeremy Szu148ebf542020-10-08 18:56:44 +080010020 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Kaho Ng2da2dc92016-05-09 00:27:49 +080010021 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +020010022 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwaidb8948e2016-01-18 09:17:30 +010010023 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010024 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +020010025 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010026 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +010010027 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010028 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10029 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +010010030 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +010010031 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010032 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +010010033 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010034 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -050010035 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +080010036 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +080010037 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +060010038 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +020010039 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010040 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +020010041 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010042 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010043 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +010010044 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010045 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010046
10047#if 0
10048 /* Below is a quirk table taken from the old code.
10049 * Basically the device should work as is without the fixup table.
10050 * If BIOS doesn't give a proper info, enable the corresponding
10051 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +020010052 */
Takashi Iwai53c334a2011-08-23 18:27:14 +020010053 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10054 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10055 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10056 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10057 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10058 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10059 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10060 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10061 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10062 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10063 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10064 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10065 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10066 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10067 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10068 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10069 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10070 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10071 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10072 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10073 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10074 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10075 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10076 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10077 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10078 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10079 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10080 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10081 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10082 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10083 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10084 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10085 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10086 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10087 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10088 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10089 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10090 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10091 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10092 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10093 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10094 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10095 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10096 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10097 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10098 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10099 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10100 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10101 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10102 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10103#endif
David Henningsson6cb3b702010-09-09 08:51:44 +020010104 {}
10105};
10106
Takashi Iwai1727a772013-01-10 09:52:52 +010010107static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010108 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10109 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -080010110 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010111 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +020010112 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10113 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10114 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10115 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10116 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10117 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10118 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10119 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010120 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +020010121 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010122 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +020010123 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010124 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10125 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10126 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10127 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10128 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10129 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10130 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10131 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +020010132 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010133 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10134 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10135 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10136 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10137 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +020010138 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010139 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -080010140 {}
10141};
David Henningsson6cb3b702010-09-09 08:51:44 +020010142
Hui Wang532895c2014-05-29 15:59:19 +080010143static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010144 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10145 {0x17, 0x02211010},
10146 {0x18, 0x01a19030},
10147 {0x1a, 0x01813040},
10148 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +080010149 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10150 {0x16, 0x01813030},
10151 {0x17, 0x02211010},
10152 {0x18, 0x01a19040},
10153 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +020010154 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010155 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010156 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010157 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +080010158 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +020010159 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10160 {0x12, 0x99a30130},
10161 {0x14, 0x90170110},
10162 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010163 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010164 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10165 {0x12, 0x99a30140},
10166 {0x14, 0x90170110},
10167 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010168 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010169 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10170 {0x12, 0x99a30150},
10171 {0x14, 0x90170110},
10172 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010173 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010174 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +020010175 {0x14, 0x90170110},
10176 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010177 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010178 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10179 {0x12, 0x90a60130},
10180 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +080010181 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +080010182 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10183 {0x14, 0x01014010},
10184 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +080010185 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +080010186 {0x1b, 0x01813030},
10187 {0x21, 0x02211020}),
10188 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10189 {0x14, 0x01014010},
10190 {0x18, 0x01a19040},
10191 {0x1b, 0x01813030},
10192 {0x21, 0x02211020}),
10193 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10194 {0x14, 0x01014020},
10195 {0x17, 0x90170110},
10196 {0x18, 0x01a19050},
10197 {0x1b, 0x01813040},
10198 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +080010199 {}
10200};
10201
Takashi Iwai1d045db2011-07-07 18:23:21 +020010202/*
10203 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010204static int patch_alc662(struct hda_codec *codec)
10205{
10206 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +020010207 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010208
Takashi Iwai3de95172012-05-07 18:03:15 +020010209 err = alc_alloc_spec(codec, 0x0b);
10210 if (err < 0)
10211 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010212
Takashi Iwai3de95172012-05-07 18:03:15 +020010213 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010214
Takashi Iwai225068a2015-05-29 10:42:14 +020010215 spec->shutup = alc_eapd_shutup;
10216
Takashi Iwai53c334a2011-08-23 18:27:14 +020010217 /* handle multiple HPs as is */
10218 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10219
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +020010220 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10221
Takashi Iwai7639a062015-03-03 10:07:24 +010010222 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +080010223 case 0x10ec0668:
10224 spec->init_hook = alc668_restore_default_value;
10225 break;
Kailang Yangf3f91852014-10-24 15:43:46 +080010226 }
Kailang Yang8663ff72012-06-29 09:35:52 +020010227
Takashi Iwaic9af7532019-05-10 11:01:43 +020010228 alc_pre_init(codec);
10229
Takashi Iwai1727a772013-01-10 09:52:52 +010010230 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010231 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +080010232 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +010010233 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010234
10235 alc_auto_parse_customize_define(codec);
10236
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010237 if (has_cdefine_beep(codec))
10238 spec->gen.beep_nid = 0x01;
10239
Takashi Iwai1bb7e432011-10-17 16:50:59 +020010240 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +010010241 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010242 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +080010243 err = alc_codec_rename(codec, "ALC272X");
10244 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010245 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +020010246 }
Kailang Yang274693f2009-12-03 10:07:50 +010010247
Takashi Iwaib9c51062011-08-24 18:08:07 +020010248 /* automatic parse from the BIOS config */
10249 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010250 if (err < 0)
10251 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010252
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010253 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +010010254 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +010010255 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010256 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010257 break;
10258 case 0x10ec0272:
10259 case 0x10ec0663:
10260 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +080010261 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010262 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010263 break;
10264 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010265 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010266 break;
10267 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010268 if (err < 0)
10269 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +010010270 }
Takashi Iwai2134ea42008-01-10 16:53:55 +010010271
Takashi Iwai1727a772013-01-10 09:52:52 +010010272 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010273
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010274 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010275
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010276 error:
10277 alc_free(codec);
10278 return err;
Kailang Yangb478b992011-05-18 11:51:15 +020010279}
10280
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010281/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010282 * ALC680 support
10283 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010284
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010285static int alc680_parse_auto_config(struct hda_codec *codec)
10286{
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010287 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010288}
10289
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010290/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010291 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010292static int patch_alc680(struct hda_codec *codec)
10293{
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010294 int err;
10295
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010296 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +020010297 err = alc_alloc_spec(codec, 0);
10298 if (err < 0)
10299 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010300
Takashi Iwai1ebec5f2011-08-15 13:21:48 +020010301 /* automatic parse from the BIOS config */
10302 err = alc680_parse_auto_config(codec);
10303 if (err < 0) {
10304 alc_free(codec);
10305 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010306 }
10307
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010308 return 0;
10309}
10310
10311/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070010312 * patch entries
10313 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010314static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +080010315 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010316 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +080010317 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +080010318 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010319 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
10320 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010321 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010322 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +080010323 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +080010324 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010325 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
10326 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +080010327 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010328 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
10329 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
10330 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
10331 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
10332 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
10333 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
10334 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010335 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010336 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
10337 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
10338 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
10339 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
10340 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
10341 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010342 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010343 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080010344 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010345 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010346 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010347 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10348 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10349 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010350 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080010351 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010352 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080010353 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080010354 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080010355 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010356 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10357 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10358 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10359 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10360 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10361 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10362 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10363 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10364 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10365 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10366 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10367 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10368 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10369 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080010370 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10371 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10372 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080010373 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010374 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010375 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10376 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10377 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10378 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10379 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10380 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10381 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10382 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10383 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10384 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10385 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
Kailang Yange5782a52020-11-27 14:39:23 +080010386 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010387 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10388 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080010389 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080010390 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080010391 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070010392 {} /* terminator */
10393};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010394MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010395
10396MODULE_LICENSE("GPL");
10397MODULE_DESCRIPTION("Realtek HD-audio codec");
10398
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010399static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010400 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010401};
10402
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010403module_hda_codec_driver(realtek_driver);