blob: ee2841dd0c6da288d6153e2d3bb6310a996352bd [file] [log] [blame]
Thomas Gleixnerd0fa1172019-05-20 19:07:57 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
Takashi Iwai1d045db2011-07-07 18:23:21 +02005 * HD audio interface patch for Realtek ALC codecs
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
Kailang Yangdf694da2005-12-05 19:42:22 +01007 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * Takashi Iwai <tiwai@suse.de>
Jonathan Woithe409a3e92012-03-27 13:01:01 +103010 * Jonathan Woithe <jwoithe@just42.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
Takashi Iwai08fb0d02013-01-10 17:33:58 +010017#include <linux/dmi.h>
Paul Gortmakerda155d52011-07-15 12:38:28 -040018#include <linux/module.h>
David Henningsson33f4acd2015-01-07 15:50:13 +010019#include <linux/input.h>
Kai-Heng Feng87dc3642020-04-30 21:52:07 +080020#include <linux/leds.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <sound/core.h>
Kailang Yang9ad0e492010-09-14 23:22:00 +020022#include <sound/jack.h>
Pierre-Louis Bossartbe57bff2018-08-22 15:24:57 -050023#include <sound/hda_codec.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include "hda_local.h"
Takashi Iwai23d30f22012-05-07 17:17:32 +020025#include "hda_auto_parser.h"
Takashi Iwai1835a0f2011-10-27 22:12:46 +020026#include "hda_jack.h"
Takashi Iwai08c189f2012-12-19 15:22:24 +010027#include "hda_generic.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Takashi Iwaicd63a5f2013-07-05 12:13:59 +020029/* keep halting ALC5505 DSP, for power saving */
30#define HALT_REALTEK_ALC5505
31
Takashi Iwai4a79ba32009-04-22 16:31:35 +020032/* extra amp-initialization sequence types */
33enum {
Takashi Iwai1c76aa52018-06-21 16:37:54 +020034 ALC_INIT_UNDEFINED,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020035 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020037};
38
David Henningsson73bdd592013-04-15 15:44:14 +020039enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45};
46
47enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51};
52
Hui Wangc7b60a82015-12-28 11:35:25 +080053enum {
54 ALC_KEY_MICMUTE_INDEX,
55};
56
Kailang Yangda00c242010-03-19 11:23:45 +010057struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
David Henningsson90622912010-10-14 14:50:18 +020067 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010068};
69
Takashi Iwai766538a2020-06-18 13:08:41 +020070struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75};
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010078 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020079
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 /* codec parameterization */
Kailang Yangda00c242010-03-19 11:23:45 +010081 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010082 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
83
Takashi Iwai5579cd62018-06-19 22:22:41 +020084 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
Takashi Iwai215c8502018-06-19 22:34:26 +020088 bool gpio_write_delay; /* add a delay before writing gpio_data */
Takashi Iwai5579cd62018-06-19 22:22:41 +020089
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +020090 /* mute LED for HP laptops, see vref_mute_led_set() */
Takashi Iwai08fb0d02013-01-10 17:33:58 +010091 int mute_led_polarity;
Kai-Heng Fengdbd13172020-04-30 16:32:51 +080092 int micmute_led_polarity;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010093 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +080094 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010095
Takashi Iwai0f32fd192014-11-19 12:16:14 +010096 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
Takashi Iwai766538a2020-06-18 13:08:41 +020098 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100100
David Henningsson73bdd592013-04-15 15:44:14 +0200101 hda_nid_t headset_mic_pin;
102 hda_nid_t headphone_mic_pin;
103 int current_headset_mode;
104 int current_headset_type;
105
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100106 /* hooks */
107 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200108#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500109 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100110#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200111 void (*shutup)(struct hda_codec *codec);
Takashi Iwai70a09762015-12-15 14:59:58 +0100112 void (*reboot_notify)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200113
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200114 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200115 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
Kailang Yang693abe12019-01-29 15:38:21 +0800118 unsigned int done_hp_init:1;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100119 unsigned int no_shutup_pins:1;
Kailang Yangd3ba58b2019-05-06 15:09:42 +0800120 unsigned int ultra_low_power:1;
Hui Wang476c02e2020-03-29 16:20:18 +0800121 unsigned int has_hs_key:1;
Kailang Yang92666d42020-11-19 17:04:21 +0800122 unsigned int no_internal_mic_pin:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100123
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200124 /* for PLL fix */
125 hda_nid_t pll_nid;
126 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200127 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100128 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800129 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100130};
131
Takashi Iwai23f0c042009-02-26 13:03:58 +0100132/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200133 * COEF access helper functions
134 */
135
136static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
137 unsigned int coef_idx)
138{
139 unsigned int val;
140
141 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
142 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
143 return val;
144}
145
146#define alc_read_coef_idx(codec, coef_idx) \
147 alc_read_coefex_idx(codec, 0x20, coef_idx)
148
149static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
150 unsigned int coef_idx, unsigned int coef_val)
151{
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
154}
155
156#define alc_write_coef_idx(codec, coef_idx, coef_val) \
157 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
158
Takashi Iwai98b24882014-08-18 13:47:50 +0200159static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 unsigned int coef_idx, unsigned int mask,
161 unsigned int bits_set)
162{
163 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
164
165 if (val != -1)
166 alc_write_coefex_idx(codec, nid, coef_idx,
167 (val & ~mask) | bits_set);
168}
169
170#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
171 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
172
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200173/* a special bypass for COEF 0; read the cached value at the second time */
174static unsigned int alc_get_coef0(struct hda_codec *codec)
175{
176 struct alc_spec *spec = codec->spec;
177
178 if (!spec->coef0)
179 spec->coef0 = alc_read_coef_idx(codec, 0);
180 return spec->coef0;
181}
182
Takashi Iwai54db6c32014-08-18 15:11:19 +0200183/* coef writes/updates batch */
184struct coef_fw {
185 unsigned char nid;
186 unsigned char idx;
187 unsigned short mask;
188 unsigned short val;
189};
190
191#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
192 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
193#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
194#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
195#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
196
197static void alc_process_coef_fw(struct hda_codec *codec,
198 const struct coef_fw *fw)
199{
200 for (; fw->nid; fw++) {
201 if (fw->mask == (unsigned short)-1)
202 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
203 else
204 alc_update_coefex_idx(codec, fw->nid, fw->idx,
205 fw->mask, fw->val);
206 }
207}
208
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200209/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200210 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100211 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200212
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200213/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200214static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
215{
216 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200217
Takashi Iwai5579cd62018-06-19 22:22:41 +0200218 spec->gpio_mask |= mask;
219 spec->gpio_dir |= mask;
220 spec->gpio_data |= mask;
221}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200222
Takashi Iwai5579cd62018-06-19 22:22:41 +0200223static void alc_write_gpio_data(struct hda_codec *codec)
224{
225 struct alc_spec *spec = codec->spec;
226
227 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
228 spec->gpio_data);
229}
230
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200231static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
232 bool on)
233{
234 struct alc_spec *spec = codec->spec;
235 unsigned int oldval = spec->gpio_data;
236
237 if (on)
238 spec->gpio_data |= mask;
239 else
240 spec->gpio_data &= ~mask;
241 if (oldval != spec->gpio_data)
242 alc_write_gpio_data(codec);
243}
244
Takashi Iwai5579cd62018-06-19 22:22:41 +0200245static void alc_write_gpio(struct hda_codec *codec)
246{
247 struct alc_spec *spec = codec->spec;
248
249 if (!spec->gpio_mask)
250 return;
251
252 snd_hda_codec_write(codec, codec->core.afg, 0,
253 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
254 snd_hda_codec_write(codec, codec->core.afg, 0,
255 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200256 if (spec->gpio_write_delay)
257 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200258 alc_write_gpio_data(codec);
259}
260
261static void alc_fixup_gpio(struct hda_codec *codec, int action,
262 unsigned int mask)
263{
264 if (action == HDA_FIXUP_ACT_PRE_PROBE)
265 alc_setup_gpio(codec, mask);
266}
267
268static void alc_fixup_gpio1(struct hda_codec *codec,
269 const struct hda_fixup *fix, int action)
270{
271 alc_fixup_gpio(codec, action, 0x01);
272}
273
274static void alc_fixup_gpio2(struct hda_codec *codec,
275 const struct hda_fixup *fix, int action)
276{
277 alc_fixup_gpio(codec, action, 0x02);
278}
279
280static void alc_fixup_gpio3(struct hda_codec *codec,
281 const struct hda_fixup *fix, int action)
282{
283 alc_fixup_gpio(codec, action, 0x03);
284}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200285
Takashi Iwaiae065f12018-06-19 23:00:03 +0200286static void alc_fixup_gpio4(struct hda_codec *codec,
287 const struct hda_fixup *fix, int action)
288{
289 alc_fixup_gpio(codec, action, 0x04);
290}
291
Takashi Iwai8a503552020-06-18 13:08:32 +0200292static void alc_fixup_micmute_led(struct hda_codec *codec,
293 const struct hda_fixup *fix, int action)
294{
Jaroslav Kyselae65bf992021-03-17 18:29:43 +0100295 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai8a503552020-06-18 13:08:32 +0200296 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
297}
298
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200299/*
300 * Fix hardware PLL issue
301 * On some codecs, the analog PLL gating control must be off while
302 * the default value is 1.
303 */
304static void alc_fix_pll(struct hda_codec *codec)
305{
306 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200307
Takashi Iwai98b24882014-08-18 13:47:50 +0200308 if (spec->pll_nid)
309 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
310 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200311}
312
313static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
314 unsigned int coef_idx, unsigned int coef_bit)
315{
316 struct alc_spec *spec = codec->spec;
317 spec->pll_nid = nid;
318 spec->pll_coef_idx = coef_idx;
319 spec->pll_coef_bit = coef_bit;
320 alc_fix_pll(codec);
321}
322
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100323/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200324static void alc_update_knob_master(struct hda_codec *codec,
325 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100326{
327 unsigned int val;
328 struct snd_kcontrol *kctl;
329 struct snd_ctl_elem_value *uctl;
330
331 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
332 if (!kctl)
333 return;
334 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
335 if (!uctl)
336 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100337 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100338 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
339 val &= HDA_AMP_VOLMASK;
340 uctl->value.integer.value[0] = val;
341 uctl->value.integer.value[1] = val;
342 kctl->put(kctl, uctl);
343 kfree(uctl);
344}
345
David Henningsson29adc4b2012-09-25 11:31:00 +0200346static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100347{
David Henningsson29adc4b2012-09-25 11:31:00 +0200348 /* For some reason, the res given from ALC880 is broken.
349 Here we adjust it properly. */
350 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100351}
352
Kailang Yang394c97f2014-11-12 17:38:08 +0800353/* Change EAPD to verb control */
354static void alc_fill_eapd_coef(struct hda_codec *codec)
355{
356 int coef;
357
358 coef = alc_get_coef0(codec);
359
Takashi Iwai7639a062015-03-03 10:07:24 +0100360 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800361 case 0x10ec0262:
362 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
363 break;
364 case 0x10ec0267:
365 case 0x10ec0268:
366 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
367 break;
368 case 0x10ec0269:
369 if ((coef & 0x00f0) == 0x0010)
370 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
371 if ((coef & 0x00f0) == 0x0020)
372 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
373 if ((coef & 0x00f0) == 0x0030)
374 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
375 break;
376 case 0x10ec0280:
377 case 0x10ec0284:
378 case 0x10ec0290:
379 case 0x10ec0292:
380 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
381 break;
Kailang Yang42314302016-02-03 15:03:50 +0800382 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100383 case 0x10ec0295:
384 case 0x10ec0299:
385 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -0500386 fallthrough;
Takashi Iwai44be77c2017-12-27 08:53:59 +0100387 case 0x10ec0215:
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),
Takashi Iwaib2650472021-04-28 13:26:52 +02002473 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2474 ALC882_FIXUP_ACER_ASPIRE_4930G),
2475 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002476 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2477 ALC882_FIXUP_ACER_ASPIRE_4930G),
2478 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2479 ALC882_FIXUP_ACER_ASPIRE_4930G),
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 Iwaib7529c12021-04-28 13:26:53 +02002492 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2493 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002494 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002495 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002496 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", 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),
PeiSen Hou259eb822020-05-19 08:50:12 +02002539 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002540 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2541 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2542 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002543 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002544 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2545 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002546 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002547 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2548 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Takashi Iwai13e1a4c2021-04-28 13:26:54 +02002549 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2550 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2551 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2552 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2553 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2554 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2555 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2556 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2557 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2558 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2559 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2560 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002561 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2562 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002563 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002564 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002565 {}
2566};
2567
Takashi Iwai1727a772013-01-10 09:52:52 +01002568static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002569 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2570 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2571 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2572 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2573 {.id = ALC889_FIXUP_CD, .name = "cd"},
2574 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2575 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2576 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2577 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2578 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2579 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2580 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2581 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2582 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2583 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002584 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2585 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2586 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002587 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2588 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2589 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2590 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2591 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2592 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2593 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2594 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002595 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002596 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002597 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002598 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002599 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002600 {}
2601};
2602
Takashi Iwai1d045db2011-07-07 18:23:21 +02002603/*
2604 * BIOS auto configuration
2605 */
2606/* almost identical with ALC880 parser... */
2607static int alc882_parse_auto_config(struct hda_codec *codec)
2608{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002609 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002610 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2611 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002612}
2613
Takashi Iwai1d045db2011-07-07 18:23:21 +02002614/*
2615 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002616static int patch_alc882(struct hda_codec *codec)
2617{
2618 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002619 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002620
Takashi Iwai3de95172012-05-07 18:03:15 +02002621 err = alc_alloc_spec(codec, 0x0b);
2622 if (err < 0)
2623 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002624
Takashi Iwai3de95172012-05-07 18:03:15 +02002625 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002626
Takashi Iwai7639a062015-03-03 10:07:24 +01002627 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002628 case 0x10ec0882:
2629 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002630 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002631 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002632 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002633 break;
2634 default:
2635 /* ALC883 and variants */
2636 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2637 break;
2638 }
2639
Takashi Iwaic9af7532019-05-10 11:01:43 +02002640 alc_pre_init(codec);
2641
Takashi Iwai1727a772013-01-10 09:52:52 +01002642 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002643 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002644 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002645
2646 alc_auto_parse_customize_define(codec);
2647
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002648 if (has_cdefine_beep(codec))
2649 spec->gen.beep_nid = 0x01;
2650
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002651 /* automatic parse from the BIOS config */
2652 err = alc882_parse_auto_config(codec);
2653 if (err < 0)
2654 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002655
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002656 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2657 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2658 if (err < 0)
2659 goto error;
2660 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002661
Takashi Iwai1727a772013-01-10 09:52:52 +01002662 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002663
Takashi Iwai1d045db2011-07-07 18:23:21 +02002664 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002665
2666 error:
2667 alc_free(codec);
2668 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002669}
2670
2671
2672/*
2673 * ALC262 support
2674 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002675static int alc262_parse_auto_config(struct hda_codec *codec)
2676{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002677 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002678 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2679 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002680}
2681
2682/*
2683 * Pin config fixes
2684 */
2685enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002686 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002687 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002688 ALC262_FIXUP_HP_Z200,
2689 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002690 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002691 ALC262_FIXUP_BENQ,
2692 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002693 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002694 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002695};
2696
Takashi Iwai1727a772013-01-10 09:52:52 +01002697static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002698 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002699 .type = HDA_FIXUP_PINS,
2700 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002701 { 0x14, 0x99130110 }, /* speaker */
2702 { 0x15, 0x0221142f }, /* front HP */
2703 { 0x1b, 0x0121141f }, /* rear HP */
2704 { }
2705 }
2706 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002707 [ALC262_FIXUP_FSC_S7110] = {
2708 .type = HDA_FIXUP_PINS,
2709 .v.pins = (const struct hda_pintbl[]) {
2710 { 0x15, 0x90170110 }, /* speaker */
2711 { }
2712 },
2713 .chained = true,
2714 .chain_id = ALC262_FIXUP_BENQ,
2715 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002716 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002717 .type = HDA_FIXUP_PINS,
2718 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002719 { 0x16, 0x99130120 }, /* internal speaker */
2720 { }
2721 }
2722 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002723 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002724 .type = HDA_FIXUP_PINS,
2725 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002726 { 0x14, 0x1993e1f0 }, /* int AUX */
2727 { }
2728 }
2729 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002730 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002731 .type = HDA_FIXUP_PINCTLS,
2732 .v.pins = (const struct hda_pintbl[]) {
2733 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002734 {}
2735 },
2736 .chained = true,
2737 .chain_id = ALC262_FIXUP_BENQ,
2738 },
2739 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002740 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002741 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002742 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2743 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2744 {}
2745 }
2746 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002747 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002748 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002749 .v.verbs = (const struct hda_verb[]) {
2750 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2751 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2752 {}
2753 }
2754 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002755 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002756 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002757 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002758 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002759 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2760 .type = HDA_FIXUP_FUNC,
2761 .v.func = alc_fixup_no_depop_delay,
2762 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002763};
2764
2765static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002766 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002767 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002768 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002769 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002770 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002771 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002772 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002773 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2774 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002775 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002776 {}
2777};
2778
Takashi Iwai1727a772013-01-10 09:52:52 +01002779static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002780 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002781 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2782 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2783 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2784 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2785 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2786 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2787 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2788 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002789 {}
2790};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002791
Takashi Iwai1d045db2011-07-07 18:23:21 +02002792/*
2793 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002794static int patch_alc262(struct hda_codec *codec)
2795{
2796 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002797 int err;
2798
Takashi Iwai3de95172012-05-07 18:03:15 +02002799 err = alc_alloc_spec(codec, 0x0b);
2800 if (err < 0)
2801 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002802
Takashi Iwai3de95172012-05-07 18:03:15 +02002803 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002804 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002805
Takashi Iwai225068a2015-05-29 10:42:14 +02002806 spec->shutup = alc_eapd_shutup;
2807
Takashi Iwai1d045db2011-07-07 18:23:21 +02002808#if 0
2809 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2810 * under-run
2811 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002812 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002813#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002814 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2815
Takashi Iwaic9af7532019-05-10 11:01:43 +02002816 alc_pre_init(codec);
2817
Takashi Iwai1727a772013-01-10 09:52:52 +01002818 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002819 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002820 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002821
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002822 alc_auto_parse_customize_define(codec);
2823
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002824 if (has_cdefine_beep(codec))
2825 spec->gen.beep_nid = 0x01;
2826
Takashi Iwai42399f72011-11-07 17:18:44 +01002827 /* automatic parse from the BIOS config */
2828 err = alc262_parse_auto_config(codec);
2829 if (err < 0)
2830 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002831
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002832 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2833 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2834 if (err < 0)
2835 goto error;
2836 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002837
Takashi Iwai1727a772013-01-10 09:52:52 +01002838 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002839
Takashi Iwai1d045db2011-07-07 18:23:21 +02002840 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002841
2842 error:
2843 alc_free(codec);
2844 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002845}
2846
2847/*
2848 * ALC268
2849 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002850/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002851static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2852 struct snd_ctl_elem_value *ucontrol)
2853{
2854 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2855 unsigned long pval;
2856 int err;
2857
2858 mutex_lock(&codec->control_mutex);
2859 pval = kcontrol->private_value;
2860 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2861 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2862 if (err >= 0) {
2863 kcontrol->private_value = (pval & ~0xff) | 0x10;
2864 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2865 }
2866 kcontrol->private_value = pval;
2867 mutex_unlock(&codec->control_mutex);
2868 return err;
2869}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002870
2871static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2872 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002873 {
2874 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2875 .name = "Beep Playback Switch",
2876 .subdevice = HDA_SUBDEV_AMP_FLAG,
2877 .info = snd_hda_mixer_amp_switch_info,
2878 .get = snd_hda_mixer_amp_switch_get,
2879 .put = alc268_beep_switch_put,
2880 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2881 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002882};
2883
2884/* set PCBEEP vol = 0, mute connections */
2885static const struct hda_verb alc268_beep_init_verbs[] = {
2886 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2887 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2888 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2889 { }
2890};
2891
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002892enum {
2893 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002894 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002895 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002896};
2897
Takashi Iwai1727a772013-01-10 09:52:52 +01002898static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002899 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002900 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002901 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002902 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002903 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002904 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002905 .v.verbs = (const struct hda_verb[]) {
2906 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2907 {}
2908 }
2909 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002910 [ALC268_FIXUP_SPDIF] = {
2911 .type = HDA_FIXUP_PINS,
2912 .v.pins = (const struct hda_pintbl[]) {
2913 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2914 {}
2915 }
2916 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002917};
2918
Takashi Iwai1727a772013-01-10 09:52:52 +01002919static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002920 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002921 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002922 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002923 {}
2924};
2925
2926static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002927 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002928 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002929 /* below is codec SSID since multiple Toshiba laptops have the
2930 * same PCI SSID 1179:ff00
2931 */
2932 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002933 {}
2934};
2935
Takashi Iwai1d045db2011-07-07 18:23:21 +02002936/*
2937 * BIOS auto configuration
2938 */
2939static int alc268_parse_auto_config(struct hda_codec *codec)
2940{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002941 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002942 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002943}
2944
Takashi Iwai1d045db2011-07-07 18:23:21 +02002945/*
2946 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002947static int patch_alc268(struct hda_codec *codec)
2948{
2949 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002950 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002951
Takashi Iwai1d045db2011-07-07 18:23:21 +02002952 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002953 err = alc_alloc_spec(codec, 0);
2954 if (err < 0)
2955 return err;
2956
2957 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02002958 if (has_cdefine_beep(codec))
2959 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002960
Takashi Iwai225068a2015-05-29 10:42:14 +02002961 spec->shutup = alc_eapd_shutup;
2962
Takashi Iwaic9af7532019-05-10 11:01:43 +02002963 alc_pre_init(codec);
2964
Takashi Iwai1727a772013-01-10 09:52:52 +01002965 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2966 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002967
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002968 /* automatic parse from the BIOS config */
2969 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002970 if (err < 0)
2971 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002972
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002973 if (err > 0 && !spec->gen.no_analog &&
2974 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002975 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2976 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2977 &alc268_beep_mixer[i])) {
2978 err = -ENOMEM;
2979 goto error;
2980 }
2981 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002982 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002983 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2984 /* override the amp caps for beep generator */
2985 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2986 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2987 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2988 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2989 (0 << AC_AMPCAP_MUTE_SHIFT));
2990 }
2991
Takashi Iwai1727a772013-01-10 09:52:52 +01002992 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002993
Takashi Iwai1d045db2011-07-07 18:23:21 +02002994 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002995
2996 error:
2997 alc_free(codec);
2998 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002999}
3000
3001/*
3002 * ALC269
3003 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003004
Takashi Iwai1d045db2011-07-07 18:23:21 +02003005static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003006 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003007};
3008
3009static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003010 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003011};
3012
Takashi Iwai1d045db2011-07-07 18:23:21 +02003013/* different alc269-variants */
3014enum {
3015 ALC269_TYPE_ALC269VA,
3016 ALC269_TYPE_ALC269VB,
3017 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02003018 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01003019 ALC269_TYPE_ALC280,
3020 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02003021 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01003022 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08003023 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02003024 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08003025 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003026 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08003027 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003028 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003029 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003030 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003031 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003032 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003033 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003034 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003035};
3036
3037/*
3038 * BIOS auto configuration
3039 */
3040static int alc269_parse_auto_config(struct hda_codec *codec)
3041{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003042 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003043 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3044 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3045 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003046 const hda_nid_t *ssids;
3047
3048 switch (spec->codec_variant) {
3049 case ALC269_TYPE_ALC269VA:
3050 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003051 case ALC269_TYPE_ALC280:
3052 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003053 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003054 ssids = alc269va_ssids;
3055 break;
3056 case ALC269_TYPE_ALC269VB:
3057 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003058 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003059 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003060 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003061 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003062 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003063 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003064 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003065 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003066 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003067 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003068 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003069 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003070 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003071 ssids = alc269_ssids;
3072 break;
3073 default:
3074 ssids = alc269_ssids;
3075 break;
3076 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003077
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003078 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003079}
3080
Hui Wang476c02e2020-03-29 16:20:18 +08003081static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3082 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3083 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3084 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3085 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3086 {}
3087};
3088
3089static void alc_headset_btn_callback(struct hda_codec *codec,
3090 struct hda_jack_callback *jack)
3091{
3092 int report = 0;
3093
3094 if (jack->unsol_res & (7 << 13))
3095 report |= SND_JACK_BTN_0;
3096
3097 if (jack->unsol_res & (1 << 16 | 3 << 8))
3098 report |= SND_JACK_BTN_1;
3099
3100 /* Volume up key */
3101 if (jack->unsol_res & (7 << 23))
3102 report |= SND_JACK_BTN_2;
3103
3104 /* Volume down key */
3105 if (jack->unsol_res & (7 << 10))
3106 report |= SND_JACK_BTN_3;
3107
Hui Wang04f77912021-03-05 17:26:08 +08003108 snd_hda_jack_set_button_state(codec, jack->nid, report);
Hui Wang476c02e2020-03-29 16:20:18 +08003109}
3110
3111static void alc_disable_headset_jack_key(struct hda_codec *codec)
3112{
3113 struct alc_spec *spec = codec->spec;
3114
3115 if (!spec->has_hs_key)
3116 return;
3117
3118 switch (codec->core.vendor_id) {
3119 case 0x10ec0215:
3120 case 0x10ec0225:
3121 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003122 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003123 case 0x10ec0295:
3124 case 0x10ec0289:
3125 case 0x10ec0299:
3126 alc_write_coef_idx(codec, 0x48, 0x0);
3127 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3128 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3129 break;
3130 case 0x10ec0236:
3131 case 0x10ec0256:
3132 alc_write_coef_idx(codec, 0x48, 0x0);
3133 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3134 break;
3135 }
3136}
3137
3138static void alc_enable_headset_jack_key(struct hda_codec *codec)
3139{
3140 struct alc_spec *spec = codec->spec;
3141
3142 if (!spec->has_hs_key)
3143 return;
3144
3145 switch (codec->core.vendor_id) {
3146 case 0x10ec0215:
3147 case 0x10ec0225:
3148 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003149 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003150 case 0x10ec0295:
3151 case 0x10ec0289:
3152 case 0x10ec0299:
3153 alc_write_coef_idx(codec, 0x48, 0xd011);
3154 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3155 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3156 break;
3157 case 0x10ec0236:
3158 case 0x10ec0256:
3159 alc_write_coef_idx(codec, 0x48, 0xd011);
3160 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3161 break;
3162 }
3163}
3164
3165static void alc_fixup_headset_jack(struct hda_codec *codec,
3166 const struct hda_fixup *fix, int action)
3167{
3168 struct alc_spec *spec = codec->spec;
Hui Wang04f77912021-03-05 17:26:08 +08003169 hda_nid_t hp_pin;
Hui Wang476c02e2020-03-29 16:20:18 +08003170
3171 switch (action) {
3172 case HDA_FIXUP_ACT_PRE_PROBE:
3173 spec->has_hs_key = 1;
3174 snd_hda_jack_detect_enable_callback(codec, 0x55,
3175 alc_headset_btn_callback);
Hui Wang476c02e2020-03-29 16:20:18 +08003176 break;
Hui Wang04f77912021-03-05 17:26:08 +08003177 case HDA_FIXUP_ACT_BUILD:
3178 hp_pin = alc_get_hp_pin(spec);
3179 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3180 alc_headset_btn_keymap,
3181 hp_pin))
3182 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3183 false, SND_JACK_HEADSET,
3184 alc_headset_btn_keymap);
3185
Hui Wang476c02e2020-03-29 16:20:18 +08003186 alc_enable_headset_jack_key(codec);
3187 break;
3188 }
3189}
3190
Kailang Yang1387e2d2012-11-08 10:23:18 +01003191static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003192{
Takashi Iwai98b24882014-08-18 13:47:50 +02003193 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003194}
3195
3196static void alc269_shutup(struct hda_codec *codec)
3197{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003198 struct alc_spec *spec = codec->spec;
3199
Kailang Yang1387e2d2012-11-08 10:23:18 +01003200 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3201 alc269vb_toggle_power_output(codec, 0);
3202 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3203 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003204 msleep(150);
3205 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003206 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003207}
3208
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003209static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003210 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003211 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003212 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3213 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3214 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3215 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3216 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3217 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3218 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3219 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3220 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3221 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3222 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3223 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3224 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3225 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3226 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3227 WRITE_COEF(0x63, 0x2902), /* PLL */
3228 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3229 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3230 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3231 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3232 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3233 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3234 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3235 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3236 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3237 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3238 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3239 {}
3240};
3241
Kailang Yangcb149cb2014-03-18 16:45:32 +08003242static void alc282_restore_default_value(struct hda_codec *codec)
3243{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003244 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003245}
3246
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003247static void alc282_init(struct hda_codec *codec)
3248{
3249 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003250 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003251 bool hp_pin_sense;
3252 int coef78;
3253
Kailang Yangcb149cb2014-03-18 16:45:32 +08003254 alc282_restore_default_value(codec);
3255
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003256 if (!hp_pin)
3257 return;
3258 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3259 coef78 = alc_read_coef_idx(codec, 0x78);
3260
3261 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3262 /* Headphone capless set to high power mode */
3263 alc_write_coef_idx(codec, 0x78, 0x9004);
3264
3265 if (hp_pin_sense)
3266 msleep(2);
3267
3268 snd_hda_codec_write(codec, hp_pin, 0,
3269 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3270
3271 if (hp_pin_sense)
3272 msleep(85);
3273
3274 snd_hda_codec_write(codec, hp_pin, 0,
3275 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3276
3277 if (hp_pin_sense)
3278 msleep(100);
3279
3280 /* Headphone capless set to normal mode */
3281 alc_write_coef_idx(codec, 0x78, coef78);
3282}
3283
3284static void alc282_shutup(struct hda_codec *codec)
3285{
3286 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003287 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003288 bool hp_pin_sense;
3289 int coef78;
3290
3291 if (!hp_pin) {
3292 alc269_shutup(codec);
3293 return;
3294 }
3295
3296 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3297 coef78 = alc_read_coef_idx(codec, 0x78);
3298 alc_write_coef_idx(codec, 0x78, 0x9004);
3299
3300 if (hp_pin_sense)
3301 msleep(2);
3302
3303 snd_hda_codec_write(codec, hp_pin, 0,
3304 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3305
3306 if (hp_pin_sense)
3307 msleep(85);
3308
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003309 if (!spec->no_shutup_pins)
3310 snd_hda_codec_write(codec, hp_pin, 0,
3311 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003312
3313 if (hp_pin_sense)
3314 msleep(100);
3315
3316 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003317 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003318 alc_write_coef_idx(codec, 0x78, coef78);
3319}
3320
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003321static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003322 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003323 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003324 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3325 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3326 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3327 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3328 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3329 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3330 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3331 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3332 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3333 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3334 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3335 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3336 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3337 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3338 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3339 WRITE_COEF(0x2e, 0x2902), /* PLL */
3340 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3341 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3342 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3343 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3344 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3345 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3346 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3347 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3348 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3349 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3350 WRITE_COEF(0x49, 0x0), /* test mode */
3351 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3352 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3353 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003354 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003355 {}
3356};
3357
Kailang Yang6bd55b02014-03-17 13:51:27 +08003358static void alc283_restore_default_value(struct hda_codec *codec)
3359{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003360 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003361}
3362
Kailang Yang2af02be2013-08-22 10:03:50 +02003363static void alc283_init(struct hda_codec *codec)
3364{
3365 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003366 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003367 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003368
Kailang Yang6bd55b02014-03-17 13:51:27 +08003369 alc283_restore_default_value(codec);
3370
Kailang Yang2af02be2013-08-22 10:03:50 +02003371 if (!hp_pin)
3372 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003373
3374 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003375 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3376
3377 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3378 /* Headphone capless set to high power mode */
3379 alc_write_coef_idx(codec, 0x43, 0x9004);
3380
3381 snd_hda_codec_write(codec, hp_pin, 0,
3382 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3383
3384 if (hp_pin_sense)
3385 msleep(85);
3386
3387 snd_hda_codec_write(codec, hp_pin, 0,
3388 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3389
3390 if (hp_pin_sense)
3391 msleep(85);
3392 /* Index 0x46 Combo jack auto switch control 2 */
3393 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003394 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003395 /* Headphone capless set to normal mode */
3396 alc_write_coef_idx(codec, 0x43, 0x9614);
3397}
3398
3399static void alc283_shutup(struct hda_codec *codec)
3400{
3401 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003402 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003403 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003404
3405 if (!hp_pin) {
3406 alc269_shutup(codec);
3407 return;
3408 }
3409
3410 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3411
3412 alc_write_coef_idx(codec, 0x43, 0x9004);
3413
Harsha Priyab450b172014-10-09 11:04:56 +00003414 /*depop hp during suspend*/
3415 alc_write_coef_idx(codec, 0x06, 0x2100);
3416
Kailang Yang2af02be2013-08-22 10:03:50 +02003417 snd_hda_codec_write(codec, hp_pin, 0,
3418 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3419
3420 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003421 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003422
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003423 if (!spec->no_shutup_pins)
3424 snd_hda_codec_write(codec, hp_pin, 0,
3425 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003426
Takashi Iwai98b24882014-08-18 13:47:50 +02003427 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003428
3429 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003430 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003431 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003432 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003433 alc_write_coef_idx(codec, 0x43, 0x9614);
3434}
3435
Kailang Yang4a219ef2017-06-16 16:54:35 +08003436static void alc256_init(struct hda_codec *codec)
3437{
3438 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003439 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003440 bool hp_pin_sense;
3441
3442 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003443 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003444
3445 msleep(30);
3446
3447 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3448
3449 if (hp_pin_sense)
3450 msleep(2);
3451
3452 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003453 if (spec->ultra_low_power) {
3454 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3455 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3456 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3457 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3458 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3459 msleep(30);
3460 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003461
3462 snd_hda_codec_write(codec, hp_pin, 0,
3463 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3464
Kailang Yang6447c962019-05-08 16:27:03 +08003465 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003466 msleep(85);
3467
3468 snd_hda_codec_write(codec, hp_pin, 0,
3469 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3470
Kailang Yang6447c962019-05-08 16:27:03 +08003471 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003472 msleep(100);
3473
3474 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3475 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003476 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3477 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003478 /*
3479 * Expose headphone mic (or possibly Line In on some machines) instead
3480 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3481 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3482 * this register.
3483 */
3484 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003485}
3486
3487static void alc256_shutup(struct hda_codec *codec)
3488{
3489 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003490 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003491 bool hp_pin_sense;
3492
Kailang Yang6447c962019-05-08 16:27:03 +08003493 if (!hp_pin)
3494 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003495
3496 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3497
3498 if (hp_pin_sense)
3499 msleep(2);
3500
3501 snd_hda_codec_write(codec, hp_pin, 0,
3502 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3503
Kailang Yang6447c962019-05-08 16:27:03 +08003504 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003505 msleep(85);
3506
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003507 /* 3k pull low control for Headset jack. */
3508 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003509 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3510 * when booting with headset plugged. So skip setting it for the codec alc257
3511 */
3512 if (codec->core.vendor_id != 0x10ec0257)
3513 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003514
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003515 if (!spec->no_shutup_pins)
3516 snd_hda_codec_write(codec, hp_pin, 0,
3517 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003518
Kailang Yang6447c962019-05-08 16:27:03 +08003519 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003520 msleep(100);
3521
3522 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003523 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003524 if (spec->ultra_low_power) {
3525 msleep(50);
3526 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3527 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3528 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3529 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3530 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3531 msleep(30);
3532 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003533}
3534
Kailang Yangda911b12018-01-05 16:50:08 +08003535static void alc225_init(struct hda_codec *codec)
3536{
3537 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003538 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003539 bool hp1_pin_sense, hp2_pin_sense;
3540
3541 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003542 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003543 msleep(30);
3544
3545 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3546 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3547
3548 if (hp1_pin_sense || hp2_pin_sense)
3549 msleep(2);
3550
3551 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003552 if (spec->ultra_low_power) {
3553 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3554 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3555 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3556 msleep(30);
3557 }
Kailang Yangda911b12018-01-05 16:50:08 +08003558
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003559 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003560 snd_hda_codec_write(codec, hp_pin, 0,
3561 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3562 if (hp2_pin_sense)
3563 snd_hda_codec_write(codec, 0x16, 0,
3564 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3565
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003566 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003567 msleep(85);
3568
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003569 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003570 snd_hda_codec_write(codec, hp_pin, 0,
3571 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3572 if (hp2_pin_sense)
3573 snd_hda_codec_write(codec, 0x16, 0,
3574 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3575
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003576 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003577 msleep(100);
3578
3579 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3580 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3581}
3582
3583static void alc225_shutup(struct hda_codec *codec)
3584{
3585 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003586 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003587 bool hp1_pin_sense, hp2_pin_sense;
3588
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003589 if (!hp_pin)
3590 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003591
3592 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003593 /* 3k pull low control for Headset jack. */
3594 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3595
3596 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3597 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3598
3599 if (hp1_pin_sense || hp2_pin_sense)
3600 msleep(2);
3601
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003602 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003603 snd_hda_codec_write(codec, hp_pin, 0,
3604 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3605 if (hp2_pin_sense)
3606 snd_hda_codec_write(codec, 0x16, 0,
3607 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3608
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003609 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003610 msleep(85);
3611
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003612 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003613 snd_hda_codec_write(codec, hp_pin, 0,
3614 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3615 if (hp2_pin_sense)
3616 snd_hda_codec_write(codec, 0x16, 0,
3617 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3618
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003619 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003620 msleep(100);
3621
3622 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003623 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003624 if (spec->ultra_low_power) {
3625 msleep(50);
3626 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3627 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3628 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3629 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3630 msleep(30);
3631 }
Hui Wang476c02e2020-03-29 16:20:18 +08003632
3633 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3634 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003635}
3636
Kailang Yangc2d6af52017-06-21 14:50:54 +08003637static void alc_default_init(struct hda_codec *codec)
3638{
3639 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003640 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003641 bool hp_pin_sense;
3642
3643 if (!hp_pin)
3644 return;
3645
3646 msleep(30);
3647
3648 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3649
3650 if (hp_pin_sense)
3651 msleep(2);
3652
3653 snd_hda_codec_write(codec, hp_pin, 0,
3654 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3655
3656 if (hp_pin_sense)
3657 msleep(85);
3658
3659 snd_hda_codec_write(codec, hp_pin, 0,
3660 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3661
3662 if (hp_pin_sense)
3663 msleep(100);
3664}
3665
3666static void alc_default_shutup(struct hda_codec *codec)
3667{
3668 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003669 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003670 bool hp_pin_sense;
3671
3672 if (!hp_pin) {
3673 alc269_shutup(codec);
3674 return;
3675 }
3676
3677 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3678
3679 if (hp_pin_sense)
3680 msleep(2);
3681
3682 snd_hda_codec_write(codec, hp_pin, 0,
3683 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3684
3685 if (hp_pin_sense)
3686 msleep(85);
3687
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003688 if (!spec->no_shutup_pins)
3689 snd_hda_codec_write(codec, hp_pin, 0,
3690 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003691
3692 if (hp_pin_sense)
3693 msleep(100);
3694
3695 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003696 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003697}
3698
Kailang Yang693abe12019-01-29 15:38:21 +08003699static void alc294_hp_init(struct hda_codec *codec)
3700{
3701 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003702 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003703 int i, val;
3704
3705 if (!hp_pin)
3706 return;
3707
3708 snd_hda_codec_write(codec, hp_pin, 0,
3709 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3710
3711 msleep(100);
3712
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003713 if (!spec->no_shutup_pins)
3714 snd_hda_codec_write(codec, hp_pin, 0,
3715 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003716
3717 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3718 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3719
3720 /* Wait for depop procedure finish */
3721 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3722 for (i = 0; i < 20 && val & 0x0080; i++) {
3723 msleep(50);
3724 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3725 }
3726 /* Set HP depop to auto mode */
3727 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3728 msleep(50);
3729}
3730
3731static void alc294_init(struct hda_codec *codec)
3732{
3733 struct alc_spec *spec = codec->spec;
3734
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003735 /* required only at boot or S4 resume time */
3736 if (!spec->done_hp_init ||
3737 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003738 alc294_hp_init(codec);
3739 spec->done_hp_init = true;
3740 }
3741 alc_default_init(codec);
3742}
3743
Kailang Yangad60d502013-06-28 12:03:01 +02003744static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3745 unsigned int val)
3746{
3747 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3748 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3749 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3750}
3751
3752static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3753{
3754 unsigned int val;
3755
3756 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3757 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3758 & 0xffff;
3759 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3760 << 16;
3761 return val;
3762}
3763
3764static void alc5505_dsp_halt(struct hda_codec *codec)
3765{
3766 unsigned int val;
3767
3768 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3769 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3770 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3771 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3772 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3773 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3774 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3775 val = alc5505_coef_get(codec, 0x6220);
3776 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3777}
3778
3779static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3780{
3781 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3782 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3783 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3784 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3785 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3786 alc5505_coef_set(codec, 0x880c, 0x00000004);
3787}
3788
3789static void alc5505_dsp_init(struct hda_codec *codec)
3790{
3791 unsigned int val;
3792
3793 alc5505_dsp_halt(codec);
3794 alc5505_dsp_back_from_halt(codec);
3795 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3796 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3797 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3798 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3799 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3800 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3801 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3802 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3803 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3804 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3805 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3806 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3807 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3808
3809 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3810 if (val <= 3)
3811 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3812 else
3813 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3814
3815 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3816 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3817 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3818 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3819 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3820 alc5505_coef_set(codec, 0x880c, 0x00000003);
3821 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003822
3823#ifdef HALT_REALTEK_ALC5505
3824 alc5505_dsp_halt(codec);
3825#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003826}
3827
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003828#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003829#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3830#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003831#else
3832#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3833#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3834#endif
3835
Takashi Iwai2a439522011-07-26 09:52:50 +02003836#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003837static int alc269_suspend(struct hda_codec *codec)
3838{
3839 struct alc_spec *spec = codec->spec;
3840
3841 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003842 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003843 return alc_suspend(codec);
3844}
3845
Takashi Iwai1d045db2011-07-07 18:23:21 +02003846static int alc269_resume(struct hda_codec *codec)
3847{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003848 struct alc_spec *spec = codec->spec;
3849
Kailang Yang1387e2d2012-11-08 10:23:18 +01003850 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3851 alc269vb_toggle_power_output(codec, 0);
3852 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003853 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003854 msleep(150);
3855 }
3856
3857 codec->patch_ops.init(codec);
3858
Kailang Yang1387e2d2012-11-08 10:23:18 +01003859 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3860 alc269vb_toggle_power_output(codec, 1);
3861 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003862 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003863 msleep(200);
3864 }
3865
Takashi Iwai1a462be2020-01-09 10:01:04 +01003866 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003867 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003868
3869 /* on some machine, the BIOS will clear the codec gpio data when enter
3870 * suspend, and won't restore the data after resume, so we restore it
3871 * in the driver.
3872 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003873 if (spec->gpio_data)
3874 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003875
Kailang Yangad60d502013-06-28 12:03:01 +02003876 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003877 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003878
Takashi Iwai1d045db2011-07-07 18:23:21 +02003879 return 0;
3880}
Takashi Iwai2a439522011-07-26 09:52:50 +02003881#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003882
David Henningsson108cc102012-07-20 10:37:25 +02003883static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003884 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003885{
3886 struct alc_spec *spec = codec->spec;
3887
Takashi Iwai1727a772013-01-10 09:52:52 +01003888 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003889 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3890}
3891
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003892static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3893 const struct hda_fixup *fix,
3894 int action)
3895{
3896 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3897 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3898
3899 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3900 snd_hda_codec_set_pincfg(codec, 0x19,
3901 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3902 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3903}
3904
Takashi Iwai1d045db2011-07-07 18:23:21 +02003905static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003906 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003907{
Takashi Iwai98b24882014-08-18 13:47:50 +02003908 if (action == HDA_FIXUP_ACT_INIT)
3909 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003910}
3911
David Henningsson7c478f02013-10-11 10:18:46 +02003912static void alc269_fixup_headset_mic(struct hda_codec *codec,
3913 const struct hda_fixup *fix, int action)
3914{
3915 struct alc_spec *spec = codec->spec;
3916
3917 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3918 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3919}
3920
Takashi Iwai1d045db2011-07-07 18:23:21 +02003921static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003922 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003923{
3924 static const struct hda_verb verbs[] = {
3925 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3926 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3927 {}
3928 };
3929 unsigned int cfg;
3930
Takashi Iwai7639a062015-03-03 10:07:24 +01003931 if (strcmp(codec->core.chip_name, "ALC271X") &&
3932 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003933 return;
3934 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3935 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3936 snd_hda_sequence_write(codec, verbs);
3937}
3938
Takashi Iwaic8426b22021-04-07 11:57:30 +02003939/* Fix the speaker amp after resume, etc */
3940static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
3941 const struct hda_fixup *fix,
3942 int action)
3943{
3944 if (action == HDA_FIXUP_ACT_INIT)
3945 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
3946}
3947
Takashi Iwai017f2a12011-07-09 14:42:25 +02003948static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003949 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003950{
3951 struct alc_spec *spec = codec->spec;
3952
Takashi Iwai1727a772013-01-10 09:52:52 +01003953 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003954 return;
3955
3956 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3957 * fix the sample rate of analog I/O to 44.1kHz
3958 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003959 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3960 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003961}
3962
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003963static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003964 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003965{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003966 /* The digital-mic unit sends PDM (differential signal) instead of
3967 * the standard PCM, thus you can't record a valid mono stream as is.
3968 * Below is a workaround specific to ALC269 to control the dmic
3969 * signal source as mono.
3970 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003971 if (action == HDA_FIXUP_ACT_INIT)
3972 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003973}
3974
Takashi Iwai24519912011-08-16 15:08:49 +02003975static void alc269_quanta_automute(struct hda_codec *codec)
3976{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003977 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003978
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003979 alc_write_coef_idx(codec, 0x0c, 0x680);
3980 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003981}
3982
3983static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003984 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003985{
3986 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003987 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003988 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003989 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003990}
3991
David Henningssond240d1d2013-04-15 12:50:02 +02003992static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003993 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003994{
3995 struct alc_spec *spec = codec->spec;
3996 int vref;
3997 msleep(200);
3998 snd_hda_gen_hp_automute(codec, jack);
3999
4000 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4001 msleep(100);
4002 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4003 vref);
4004 msleep(500);
4005 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4006 vref);
4007}
4008
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02004009/*
4010 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4011 */
4012struct hda_alc298_mbxinit {
4013 unsigned char value_0x23;
4014 unsigned char value_0x25;
4015};
4016
4017static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4018 const struct hda_alc298_mbxinit *initval,
4019 bool first)
4020{
4021 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4022 alc_write_coef_idx(codec, 0x26, 0xb000);
4023
4024 if (first)
4025 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4026
4027 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4028 alc_write_coef_idx(codec, 0x26, 0xf000);
4029 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4030
4031 if (initval->value_0x23 != 0x1e)
4032 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4033
4034 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4035 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4036}
4037
4038static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4039 const struct hda_fixup *fix,
4040 int action)
4041{
4042 /* Initialization magic */
4043 static const struct hda_alc298_mbxinit dac_init[] = {
4044 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4045 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4046 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4047 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4048 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4049 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4050 {0x2f, 0x00},
4051 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4052 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4053 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4054 {}
4055 };
4056 const struct hda_alc298_mbxinit *seq;
4057
4058 if (action != HDA_FIXUP_ACT_INIT)
4059 return;
4060
4061 /* Start */
4062 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4063 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4064 alc_write_coef_idx(codec, 0x26, 0xf000);
4065 alc_write_coef_idx(codec, 0x22, 0x31);
4066 alc_write_coef_idx(codec, 0x23, 0x0b);
4067 alc_write_coef_idx(codec, 0x25, 0x00);
4068 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4069 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4070
4071 for (seq = dac_init; seq->value_0x23; seq++)
4072 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4073}
4074
David Henningssond240d1d2013-04-15 12:50:02 +02004075static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4076 const struct hda_fixup *fix, int action)
4077{
4078 struct alc_spec *spec = codec->spec;
4079 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4080 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4081 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4082 }
4083}
4084
Takashi Iwai766538a2020-06-18 13:08:41 +02004085static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4086 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004087{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004088 unsigned int pinval;
4089
Takashi Iwai766538a2020-06-18 13:08:41 +02004090 if (!pin)
4091 return;
4092 if (polarity)
4093 on = !on;
4094 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004095 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004096 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4097 /* temporarily power up/down for setting VREF */
4098 snd_hda_power_up_pm(codec);
4099 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4100 snd_hda_power_down_pm(codec);
4101}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004102
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004103/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004104static int vref_mute_led_set(struct led_classdev *led_cdev,
4105 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004106{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004107 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004108 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004109
Takashi Iwai766538a2020-06-18 13:08:41 +02004110 alc_update_vref_led(codec, spec->mute_led_nid,
4111 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004112 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004113}
4114
David Henningssond5b6b652013-11-06 10:50:44 +01004115/* Make sure the led works even in runtime suspend */
4116static unsigned int led_power_filter(struct hda_codec *codec,
4117 hda_nid_t nid,
4118 unsigned int power_state)
4119{
4120 struct alc_spec *spec = codec->spec;
4121
Hui Wang50dd9052014-07-08 17:56:15 +08004122 if (power_state != AC_PWRST_D3 || nid == 0 ||
4123 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004124 return power_state;
4125
4126 /* Set pin ctl again, it might have just been set to 0 */
4127 snd_hda_set_pin_ctl(codec, nid,
4128 snd_hda_codec_get_pin_target(codec, nid));
4129
Takashi Iwaicffd3962015-04-09 10:30:25 +02004130 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004131}
4132
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004133static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4134 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004135{
4136 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004137 const struct dmi_device *dev = NULL;
4138
4139 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4140 return;
4141
4142 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4143 int pol, pin;
4144 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4145 continue;
4146 if (pin < 0x0a || pin >= 0x10)
4147 break;
4148 spec->mute_led_polarity = pol;
4149 spec->mute_led_nid = pin - 0x0a + 0x18;
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;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004152 codec_dbg(codec,
4153 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004154 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004155 break;
4156 }
4157}
4158
Takashi Iwai85c467d2018-05-29 11:38:38 +02004159static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4160 const struct hda_fixup *fix,
4161 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004162{
4163 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004164
David Henningssond06ac142013-02-18 11:41:55 +01004165 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4166 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004167 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004168 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004169 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004170 }
4171}
4172
Takashi Iwai85c467d2018-05-29 11:38:38 +02004173static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4174 const struct hda_fixup *fix, int action)
4175{
4176 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4177}
4178
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004179static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4180 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004181{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004182 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004183}
4184
Tom Briden7f783bd2017-03-25 10:12:01 +00004185static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4186 const struct hda_fixup *fix, int action)
4187{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004188 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004189}
4190
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004191/* update LED status via GPIO */
4192static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004193 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004194{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004195 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004196 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004197 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004198}
4199
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004200/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004201static int gpio_mute_led_set(struct led_classdev *led_cdev,
4202 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004203{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004204 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004205 struct alc_spec *spec = codec->spec;
4206
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004207 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004208 spec->mute_led_polarity, !brightness);
4209 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004210}
4211
4212/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004213static int micmute_led_set(struct led_classdev *led_cdev,
4214 enum led_brightness brightness)
4215{
4216 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4217 struct alc_spec *spec = codec->spec;
4218
4219 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004220 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004221 return 0;
4222}
4223
Takashi Iwai01e4a272018-06-19 22:47:30 +02004224/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4225static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4226 int action,
4227 unsigned int mute_mask,
4228 unsigned int micmute_mask)
4229{
4230 struct alc_spec *spec = codec->spec;
4231
4232 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4233
4234 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4235 return;
4236 if (mute_mask) {
4237 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004238 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004239 }
4240 if (micmute_mask) {
4241 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004242 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004243 }
4244}
4245
Jeremy Szue7d66cf2021-03-16 15:46:24 +08004246static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4247 const struct hda_fixup *fix, int action)
4248{
4249 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4250}
4251
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004252static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4253 const struct hda_fixup *fix, int action)
4254{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004255 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004256}
4257
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004258static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4259 const struct hda_fixup *fix, int action)
4260{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004261 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004262}
4263
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004264static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4265 const struct hda_fixup *fix, int action)
4266{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004267 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004268}
4269
Kailang Yanga0ccbc52020-11-06 15:20:38 +08004270static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4271 const struct hda_fixup *fix, int action)
4272{
4273 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4274}
4275
Takashi Iwai8a503552020-06-18 13:08:32 +02004276/* turn on/off mic-mute LED per capture hook via VREF change */
4277static int vref_micmute_led_set(struct led_classdev *led_cdev,
4278 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004279{
Takashi Iwai8a503552020-06-18 13:08:32 +02004280 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004281 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004282
Takashi Iwai766538a2020-06-18 13:08:41 +02004283 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4284 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004285 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004286}
4287
4288static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4289 const struct hda_fixup *fix, int action)
4290{
4291 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004292
Takashi Iwai01e4a272018-06-19 22:47:30 +02004293 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004294 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004295 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4296 * enable headphone amp
4297 */
4298 spec->gpio_mask |= 0x10;
4299 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004300 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004301 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004302 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004303 }
4304}
4305
David Henningsson7a5255f2014-10-30 08:26:01 +01004306static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4307 const struct hda_fixup *fix, int action)
4308{
David Henningsson7a5255f2014-10-30 08:26:01 +01004309 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004310
Takashi Iwai01e4a272018-06-19 22:47:30 +02004311 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004312 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004313 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004314 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004315 codec->power_filter = led_power_filter;
4316 }
4317}
4318
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01004319/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4320 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4321 */
4322static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4323 const struct hda_fixup *fix, int action)
4324{
4325 struct alc_spec *spec = codec->spec;
4326
4327 switch (action) {
4328 case HDA_FIXUP_ACT_PRE_PROBE:
4329 spec->gpio_mask |= 0x01;
4330 spec->gpio_dir |= 0x01;
4331 break;
4332 case HDA_FIXUP_ACT_INIT:
4333 /* need to toggle GPIO to enable the amp */
4334 alc_update_gpio_data(codec, 0x01, true);
4335 msleep(100);
4336 alc_update_gpio_data(codec, 0x01, false);
4337 break;
4338 }
4339}
4340
Takashi Iwai622464c2021-05-04 11:18:02 +02004341/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4342static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4343 struct hda_codec *codec,
4344 struct snd_pcm_substream *substream,
4345 int action)
4346{
4347 switch (action) {
4348 case HDA_GEN_PCM_ACT_PREPARE:
4349 alc_update_gpio_data(codec, 0x04, true);
4350 break;
4351 case HDA_GEN_PCM_ACT_CLEANUP:
4352 alc_update_gpio_data(codec, 0x04, false);
4353 break;
4354 }
4355}
4356
4357static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4358 const struct hda_fixup *fix,
4359 int action)
4360{
4361 struct alc_spec *spec = codec->spec;
4362
4363 if (action == HDA_FIXUP_ACT_PROBE) {
4364 spec->gpio_mask |= 0x04;
4365 spec->gpio_dir |= 0x04;
4366 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4367 }
4368}
4369
Takashi Iwai766538a2020-06-18 13:08:41 +02004370static void alc_update_coef_led(struct hda_codec *codec,
4371 struct alc_coef_led *led,
4372 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004373{
Takashi Iwai766538a2020-06-18 13:08:41 +02004374 if (polarity)
4375 on = !on;
4376 /* temporarily power up/down for setting COEF bit */
4377 alc_update_coef_idx(codec, led->idx, led->mask,
4378 on ? led->on : led->off);
4379}
4380
Kailang Yang431e76c2020-04-07 14:40:20 +08004381/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004382static int coef_mute_led_set(struct led_classdev *led_cdev,
4383 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004384{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004385 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004386 struct alc_spec *spec = codec->spec;
4387
Takashi Iwai766538a2020-06-18 13:08:41 +02004388 alc_update_coef_led(codec, &spec->mute_led_coef,
4389 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004390 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004391}
4392
4393static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4394 const struct hda_fixup *fix,
4395 int action)
4396{
4397 struct alc_spec *spec = codec->spec;
4398
4399 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4400 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004401 spec->mute_led_coef.idx = 0x0b;
4402 spec->mute_led_coef.mask = 1 << 3;
4403 spec->mute_led_coef.on = 1 << 3;
4404 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004405 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004406 }
4407}
4408
Kailang Yang24164f42020-04-07 14:52:42 +08004409static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4410 const struct hda_fixup *fix,
4411 int action)
4412{
4413 struct alc_spec *spec = codec->spec;
4414
4415 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4416 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004417 spec->mute_led_coef.idx = 0x34;
4418 spec->mute_led_coef.mask = 1 << 5;
4419 spec->mute_led_coef.on = 0;
4420 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004421 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004422 }
4423}
4424
Kailang Yang431e76c2020-04-07 14:40:20 +08004425/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004426static int coef_micmute_led_set(struct led_classdev *led_cdev,
4427 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004428{
Takashi Iwai8a503552020-06-18 13:08:32 +02004429 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004430 struct alc_spec *spec = codec->spec;
4431
Takashi Iwai766538a2020-06-18 13:08:41 +02004432 alc_update_coef_led(codec, &spec->mic_led_coef,
4433 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004434 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004435}
4436
4437static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4438 const struct hda_fixup *fix, int action)
4439{
4440 struct alc_spec *spec = codec->spec;
4441
4442 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004443 spec->mic_led_coef.idx = 0x19;
4444 spec->mic_led_coef.mask = 1 << 13;
4445 spec->mic_led_coef.on = 1 << 13;
4446 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004447 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004448 }
4449}
4450
Kailang Yang24164f42020-04-07 14:52:42 +08004451static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4452 const struct hda_fixup *fix, int action)
4453{
4454 struct alc_spec *spec = codec->spec;
4455
4456 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004457 spec->mic_led_coef.idx = 0x35;
4458 spec->mic_led_coef.mask = 3 << 2;
4459 spec->mic_led_coef.on = 2 << 2;
4460 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004461 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004462 }
4463}
4464
Kailang Yang431e76c2020-04-07 14:40:20 +08004465static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4466 const struct hda_fixup *fix, int action)
4467{
4468 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4469 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4470}
4471
Kailang Yang24164f42020-04-07 14:52:42 +08004472static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4473 const struct hda_fixup *fix, int action)
4474{
4475 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4476 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4477}
4478
Jonas Witschel75b62ab2021-04-16 12:58:54 +02004479static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4480 const struct hda_fixup *fix, int action)
4481{
4482 struct alc_spec *spec = codec->spec;
4483
4484 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4485 spec->cap_mute_led_nid = 0x1a;
4486 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4487 codec->power_filter = led_power_filter;
4488 }
4489}
4490
4491static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4492 const struct hda_fixup *fix, int action)
4493{
4494 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4495 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4496}
4497
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004498#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004499static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4500 struct hda_jack_callback *event)
4501{
4502 struct alc_spec *spec = codec->spec;
4503
4504 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4505 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004506 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004507 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004508 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004509 input_sync(spec->kb_dev);
4510}
David Henningsson33f4acd2015-01-07 15:50:13 +01004511
Kailang3694cb22015-12-28 11:35:24 +08004512static int alc_register_micmute_input_device(struct hda_codec *codec)
4513{
4514 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004515 int i;
Kailang3694cb22015-12-28 11:35:24 +08004516
4517 spec->kb_dev = input_allocate_device();
4518 if (!spec->kb_dev) {
4519 codec_err(codec, "Out of memory (input_allocate_device)\n");
4520 return -ENOMEM;
4521 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004522
4523 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4524
Kailang3694cb22015-12-28 11:35:24 +08004525 spec->kb_dev->name = "Microphone Mute Button";
4526 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004527 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4528 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4529 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4530 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4531 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004532
4533 if (input_register_device(spec->kb_dev)) {
4534 codec_err(codec, "input_register_device failed\n");
4535 input_free_device(spec->kb_dev);
4536 spec->kb_dev = NULL;
4537 return -ENOMEM;
4538 }
4539
4540 return 0;
4541}
4542
Takashi Iwai01e4a272018-06-19 22:47:30 +02004543/* GPIO1 = set according to SKU external amp
4544 * GPIO2 = mic mute hotkey
4545 * GPIO3 = mute LED
4546 * GPIO4 = mic mute LED
4547 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004548static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4549 const struct hda_fixup *fix, int action)
4550{
David Henningsson33f4acd2015-01-07 15:50:13 +01004551 struct alc_spec *spec = codec->spec;
4552
Takashi Iwai01e4a272018-06-19 22:47:30 +02004553 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004554 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004555 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004556 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004557 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004558
Takashi Iwai01e4a272018-06-19 22:47:30 +02004559 spec->gpio_mask |= 0x06;
4560 spec->gpio_dir |= 0x02;
4561 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004562 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004563 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004564 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004565 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004566 return;
4567 }
4568
4569 if (!spec->kb_dev)
4570 return;
4571
4572 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004573 case HDA_FIXUP_ACT_FREE:
4574 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004575 spec->kb_dev = NULL;
4576 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004577}
4578
Takashi Iwai01e4a272018-06-19 22:47:30 +02004579/* Line2 = mic mute hotkey
4580 * GPIO2 = mic mute LED
4581 */
Kailang3694cb22015-12-28 11:35:24 +08004582static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4583 const struct hda_fixup *fix, int action)
4584{
Kailang3694cb22015-12-28 11:35:24 +08004585 struct alc_spec *spec = codec->spec;
4586
Takashi Iwai01e4a272018-06-19 22:47:30 +02004587 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004588 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004589 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004590 if (alc_register_micmute_input_device(codec) != 0)
4591 return;
4592
Kailang3694cb22015-12-28 11:35:24 +08004593 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4594 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004595 return;
4596 }
4597
4598 if (!spec->kb_dev)
4599 return;
4600
4601 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004602 case HDA_FIXUP_ACT_FREE:
4603 input_unregister_device(spec->kb_dev);
4604 spec->kb_dev = NULL;
4605 }
4606}
Takashi Iwaic4696522018-01-15 10:44:35 +01004607#else /* INPUT */
4608#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4609#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4610#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004611
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004612static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4613 const struct hda_fixup *fix, int action)
4614{
4615 struct alc_spec *spec = codec->spec;
4616
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004617 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004618 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004619 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004620 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004621 }
4622}
4623
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004624static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004625 UPDATE_COEF(0x4a, 1<<8, 0),
4626 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4627 UPDATE_COEF(0x63, 3<<14, 3<<14),
4628 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4629 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4630 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4631 UPDATE_COEF(0x4a, 3<<10, 0),
4632 {}
4633};
4634
David Henningsson73bdd592013-04-15 15:44:14 +02004635static void alc_headset_mode_unplugged(struct hda_codec *codec)
4636{
Kailang Yang92666d42020-11-19 17:04:21 +08004637 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004638 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004639 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004640 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4641 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4642 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4643 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4644 {}
4645 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004646 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004647 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004648 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4649 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4650 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4651 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004652 {}
4653 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004654 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004655 WRITE_COEF(0x1b, 0x0c0b),
4656 WRITE_COEF(0x45, 0xc429),
4657 UPDATE_COEF(0x35, 0x4000, 0),
4658 WRITE_COEF(0x06, 0x2104),
4659 WRITE_COEF(0x1a, 0x0001),
4660 WRITE_COEF(0x26, 0x0004),
4661 WRITE_COEF(0x32, 0x42a3),
4662 {}
4663 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004664 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004665 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4666 UPDATE_COEF(0x50, 0x2000, 0x2000),
4667 UPDATE_COEF(0x56, 0x0006, 0x0006),
4668 UPDATE_COEF(0x66, 0x0008, 0),
4669 UPDATE_COEF(0x67, 0x2000, 0),
4670 {}
4671 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004672 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004673 UPDATE_COEF(0x19, 0x1300, 0x0300),
4674 {}
4675 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004676 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004677 WRITE_COEF(0x76, 0x000e),
4678 WRITE_COEF(0x6c, 0x2400),
4679 WRITE_COEF(0x18, 0x7308),
4680 WRITE_COEF(0x6b, 0xc429),
4681 {}
4682 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004683 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004684 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4685 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4686 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4687 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4688 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4689 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4690 {}
4691 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004692 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004693 WRITE_COEF(0x15, 0x0d40),
4694 WRITE_COEF(0xb7, 0x802b),
4695 {}
4696 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004697 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004698 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004699 {}
4700 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004701 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004702 UPDATE_COEF(0x4a, 0x0100, 0),
4703 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4704 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4705 UPDATE_COEF(0x4a, 0x0010, 0),
4706 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4707 WRITE_COEF(0x45, 0x5289),
4708 UPDATE_COEF(0x4a, 0x0c00, 0),
4709 {}
4710 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004711
Kailang Yang92666d42020-11-19 17:04:21 +08004712 if (spec->no_internal_mic_pin) {
4713 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4714 return;
4715 }
4716
Takashi Iwai7639a062015-03-03 10:07:24 +01004717 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004718 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004719 alc_process_coef_fw(codec, coef0255);
4720 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004721 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004722 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004723 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004724 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004725 case 0x10ec0234:
4726 case 0x10ec0274:
4727 case 0x10ec0294:
4728 alc_process_coef_fw(codec, coef0274);
4729 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004730 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004731 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004732 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004733 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004734 case 0x10ec0286:
4735 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004736 alc_process_coef_fw(codec, coef0288);
4737 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004738 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004739 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004740 alc_process_coef_fw(codec, coef0288);
4741 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004742 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004743 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004744 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004745 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004746 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004747 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004748 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004749 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004750 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004751 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004752 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004753 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004754 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004755 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004756 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004757 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004758 alc_process_coef_fw(codec, coef0225);
4759 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004760 case 0x10ec0867:
4761 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4762 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004763 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004764 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004765}
4766
4767
4768static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4769 hda_nid_t mic_pin)
4770{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004771 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004772 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4773 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4774 {}
4775 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004776 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004777 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4778 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4779 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4780 {}
4781 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004782 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004783 UPDATE_COEF(0x35, 0, 1<<14),
4784 WRITE_COEF(0x06, 0x2100),
4785 WRITE_COEF(0x1a, 0x0021),
4786 WRITE_COEF(0x26, 0x008c),
4787 {}
4788 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004789 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004790 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004791 UPDATE_COEF(0x50, 0x2000, 0),
4792 UPDATE_COEF(0x56, 0x0006, 0),
4793 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4794 UPDATE_COEF(0x66, 0x0008, 0x0008),
4795 UPDATE_COEF(0x67, 0x2000, 0x2000),
4796 {}
4797 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004798 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004799 WRITE_COEF(0x19, 0xa208),
4800 WRITE_COEF(0x2e, 0xacf0),
4801 {}
4802 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004803 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004804 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4805 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4806 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4807 {}
4808 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004809 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004810 WRITE_COEF(0xb7, 0x802b),
4811 WRITE_COEF(0xb5, 0x1040),
4812 UPDATE_COEF(0xc3, 0, 1<<12),
4813 {}
4814 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004815 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004816 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4817 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4818 UPDATE_COEF(0x63, 3<<14, 0),
4819 {}
4820 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004821 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004822 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4823 UPDATE_COEF(0x4a, 0x0010, 0),
4824 UPDATE_COEF(0x6b, 0xf000, 0),
4825 {}
4826 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004827
Takashi Iwai7639a062015-03-03 10:07:24 +01004828 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004829 case 0x10ec0255:
4830 alc_write_coef_idx(codec, 0x45, 0xc489);
4831 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004832 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004833 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4834 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004835 case 0x10ec0236:
4836 case 0x10ec0256:
4837 alc_write_coef_idx(codec, 0x45, 0xc489);
4838 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4839 alc_process_coef_fw(codec, coef0256);
4840 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4841 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004842 case 0x10ec0234:
4843 case 0x10ec0274:
4844 case 0x10ec0294:
4845 alc_write_coef_idx(codec, 0x45, 0x4689);
4846 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4847 alc_process_coef_fw(codec, coef0274);
4848 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4849 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004850 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004851 case 0x10ec0283:
4852 alc_write_coef_idx(codec, 0x45, 0xc429);
4853 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004854 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004855 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4856 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004857 case 0x10ec0286:
4858 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004859 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004860 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4861 alc_process_coef_fw(codec, coef0288);
4862 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4863 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004864 case 0x10ec0292:
4865 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004866 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004867 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004868 case 0x10ec0293:
4869 /* Set to TRS mode */
4870 alc_write_coef_idx(codec, 0x45, 0xc429);
4871 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004872 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004873 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4874 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004875 case 0x10ec0867:
4876 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05004877 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004878 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004879 case 0x10ec0662:
4880 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4881 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4882 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004883 case 0x10ec0668:
4884 alc_write_coef_idx(codec, 0x11, 0x0001);
4885 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004886 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004887 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4888 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004889 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004890 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004891 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004892 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004893 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004894 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004895 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004896 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4897 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4898 alc_process_coef_fw(codec, coef0225);
4899 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4900 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004901 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004902 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004903}
4904
4905static void alc_headset_mode_default(struct hda_codec *codec)
4906{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004907 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004908 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4909 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4910 UPDATE_COEF(0x49, 3<<8, 0<<8),
4911 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4912 UPDATE_COEF(0x63, 3<<14, 0),
4913 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004914 {}
4915 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004916 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004917 WRITE_COEF(0x45, 0xc089),
4918 WRITE_COEF(0x45, 0xc489),
4919 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4920 WRITE_COEF(0x49, 0x0049),
4921 {}
4922 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004923 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004924 WRITE_COEF(0x45, 0xc489),
4925 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4926 WRITE_COEF(0x49, 0x0049),
4927 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4928 WRITE_COEF(0x06, 0x6100),
4929 {}
4930 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004931 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004932 WRITE_COEF(0x06, 0x2100),
4933 WRITE_COEF(0x32, 0x4ea3),
4934 {}
4935 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004936 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004937 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4938 UPDATE_COEF(0x50, 0x2000, 0x2000),
4939 UPDATE_COEF(0x56, 0x0006, 0x0006),
4940 UPDATE_COEF(0x66, 0x0008, 0),
4941 UPDATE_COEF(0x67, 0x2000, 0),
4942 {}
4943 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004944 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004945 WRITE_COEF(0x76, 0x000e),
4946 WRITE_COEF(0x6c, 0x2400),
4947 WRITE_COEF(0x6b, 0xc429),
4948 WRITE_COEF(0x18, 0x7308),
4949 {}
4950 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004951 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004952 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4953 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4954 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4955 {}
4956 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004957 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004958 WRITE_COEF(0x11, 0x0041),
4959 WRITE_COEF(0x15, 0x0d40),
4960 WRITE_COEF(0xb7, 0x802b),
4961 {}
4962 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004963 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004964 WRITE_COEF(0x45, 0x4289),
4965 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4966 UPDATE_COEF(0x6b, 0x0f00, 0),
4967 UPDATE_COEF(0x49, 0x0300, 0x0300),
4968 {}
4969 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004970
Takashi Iwai7639a062015-03-03 10:07:24 +01004971 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004972 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004973 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004974 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004975 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004976 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004977 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004978 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004979 alc_process_coef_fw(codec, coef0225);
4980 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004981 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004982 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004983 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004984 case 0x10ec0236:
4985 case 0x10ec0256:
4986 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4987 alc_write_coef_idx(codec, 0x45, 0xc089);
4988 msleep(50);
4989 alc_process_coef_fw(codec, coef0256);
4990 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004991 case 0x10ec0234:
4992 case 0x10ec0274:
4993 case 0x10ec0294:
4994 alc_process_coef_fw(codec, coef0274);
4995 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004996 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004997 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004998 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004999 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005000 case 0x10ec0286:
5001 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005002 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08005003 alc_process_coef_fw(codec, coef0288);
5004 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005005 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005006 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005007 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005008 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005009 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005010 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005011 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005012 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005013 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005014 case 0x10ec0867:
5015 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5016 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005017 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005018 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005019}
5020
5021/* Iphone type */
5022static void alc_headset_mode_ctia(struct hda_codec *codec)
5023{
Kailang Yang89542932017-07-17 15:03:43 +08005024 int val;
5025
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005026 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005027 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5028 WRITE_COEF(0x1b, 0x0c2b),
5029 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5030 {}
5031 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005032 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005033 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005034 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005035 {}
5036 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005037 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005038 WRITE_COEF(0x45, 0xd429),
5039 WRITE_COEF(0x1b, 0x0c2b),
5040 WRITE_COEF(0x32, 0x4ea3),
5041 {}
5042 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005043 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005044 UPDATE_COEF(0x50, 0x2000, 0x2000),
5045 UPDATE_COEF(0x56, 0x0006, 0x0006),
5046 UPDATE_COEF(0x66, 0x0008, 0),
5047 UPDATE_COEF(0x67, 0x2000, 0),
5048 {}
5049 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005050 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005051 WRITE_COEF(0x6b, 0xd429),
5052 WRITE_COEF(0x76, 0x0008),
5053 WRITE_COEF(0x18, 0x7388),
5054 {}
5055 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005056 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005057 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5058 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5059 {}
5060 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005061 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005062 WRITE_COEF(0x11, 0x0001),
5063 WRITE_COEF(0x15, 0x0d60),
5064 WRITE_COEF(0xc3, 0x0000),
5065 {}
5066 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005067 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005068 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005069 UPDATE_COEF(0x63, 3<<14, 2<<14),
5070 {}
5071 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005072 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005073 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5074 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005075 {}
5076 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005077
Takashi Iwai7639a062015-03-03 10:07:24 +01005078 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005079 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005080 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005081 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005082 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005083 case 0x10ec0256:
5084 alc_process_coef_fw(codec, coef0256);
5085 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005086 case 0x10ec0234:
5087 case 0x10ec0274:
5088 case 0x10ec0294:
5089 alc_write_coef_idx(codec, 0x45, 0xd689);
5090 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005091 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005092 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005093 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005094 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005095 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005096 val = alc_read_coef_idx(codec, 0x50);
5097 if (val & (1 << 12)) {
5098 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5099 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5100 msleep(300);
5101 } else {
5102 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5103 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5104 msleep(300);
5105 }
5106 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005107 case 0x10ec0286:
5108 case 0x10ec0288:
5109 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5110 msleep(300);
5111 alc_process_coef_fw(codec, coef0288);
5112 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005113 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005114 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005115 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005116 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005117 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005118 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005119 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005120 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005121 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005122 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005123 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005124 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005125 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005126 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005127 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005128 val = alc_read_coef_idx(codec, 0x45);
5129 if (val & (1 << 9))
5130 alc_process_coef_fw(codec, coef0225_2);
5131 else
5132 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005133 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005134 case 0x10ec0867:
5135 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5136 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005137 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005138 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005139}
5140
5141/* Nokia type */
5142static void alc_headset_mode_omtp(struct hda_codec *codec)
5143{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005144 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005145 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5146 WRITE_COEF(0x1b, 0x0c2b),
5147 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5148 {}
5149 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005150 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005151 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005152 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005153 {}
5154 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005155 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005156 WRITE_COEF(0x45, 0xe429),
5157 WRITE_COEF(0x1b, 0x0c2b),
5158 WRITE_COEF(0x32, 0x4ea3),
5159 {}
5160 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005161 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005162 UPDATE_COEF(0x50, 0x2000, 0x2000),
5163 UPDATE_COEF(0x56, 0x0006, 0x0006),
5164 UPDATE_COEF(0x66, 0x0008, 0),
5165 UPDATE_COEF(0x67, 0x2000, 0),
5166 {}
5167 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005168 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005169 WRITE_COEF(0x6b, 0xe429),
5170 WRITE_COEF(0x76, 0x0008),
5171 WRITE_COEF(0x18, 0x7388),
5172 {}
5173 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005174 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005175 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5176 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5177 {}
5178 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005179 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005180 WRITE_COEF(0x11, 0x0001),
5181 WRITE_COEF(0x15, 0x0d50),
5182 WRITE_COEF(0xc3, 0x0000),
5183 {}
5184 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005185 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005186 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005187 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005188 {}
5189 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005190
Takashi Iwai7639a062015-03-03 10:07:24 +01005191 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005192 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005193 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005194 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005195 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005196 case 0x10ec0256:
5197 alc_process_coef_fw(codec, coef0256);
5198 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005199 case 0x10ec0234:
5200 case 0x10ec0274:
5201 case 0x10ec0294:
5202 alc_write_coef_idx(codec, 0x45, 0xe689);
5203 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005204 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005205 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005206 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005207 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005208 case 0x10ec0298:
5209 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005210 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5211 msleep(300);
5212 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005213 case 0x10ec0286:
5214 case 0x10ec0288:
5215 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5216 msleep(300);
5217 alc_process_coef_fw(codec, coef0288);
5218 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005219 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005220 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005221 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005222 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005223 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005224 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005225 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005226 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005227 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005228 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005229 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005230 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005231 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005232 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005233 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005234 alc_process_coef_fw(codec, coef0225);
5235 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005236 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005237 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005238}
5239
5240static void alc_determine_headset_type(struct hda_codec *codec)
5241{
5242 int val;
5243 bool is_ctia = false;
5244 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005245 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005246 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5247 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5248 conteol) */
5249 {}
5250 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005251 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005252 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5253 {}
5254 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005255 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005256 UPDATE_COEF(0x50, 0x2000, 0x2000),
5257 UPDATE_COEF(0x56, 0x0006, 0x0006),
5258 UPDATE_COEF(0x66, 0x0008, 0),
5259 UPDATE_COEF(0x67, 0x2000, 0),
5260 UPDATE_COEF(0x19, 0x1300, 0x1300),
5261 {}
5262 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005263 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005264 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5265 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5266 {}
5267 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005268 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005269 WRITE_COEF(0x11, 0x0001),
5270 WRITE_COEF(0xb7, 0x802b),
5271 WRITE_COEF(0x15, 0x0d60),
5272 WRITE_COEF(0xc3, 0x0c00),
5273 {}
5274 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005275 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005276 UPDATE_COEF(0x4a, 0x0010, 0),
5277 UPDATE_COEF(0x4a, 0x8000, 0),
5278 WRITE_COEF(0x45, 0xd289),
5279 UPDATE_COEF(0x49, 0x0300, 0x0300),
5280 {}
5281 };
David Henningsson73bdd592013-04-15 15:44:14 +02005282
Kailang Yang92666d42020-11-19 17:04:21 +08005283 if (spec->no_internal_mic_pin) {
5284 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5285 return;
5286 }
5287
Takashi Iwai7639a062015-03-03 10:07:24 +01005288 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005289 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005290 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005291 msleep(300);
5292 val = alc_read_coef_idx(codec, 0x46);
5293 is_ctia = (val & 0x0070) == 0x0070;
5294 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08005295 case 0x10ec0236:
5296 case 0x10ec0256:
5297 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5298 alc_write_coef_idx(codec, 0x06, 0x6104);
5299 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5300
5301 snd_hda_codec_write(codec, 0x21, 0,
5302 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5303 msleep(80);
5304 snd_hda_codec_write(codec, 0x21, 0,
5305 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5306
5307 alc_process_coef_fw(codec, coef0255);
5308 msleep(300);
5309 val = alc_read_coef_idx(codec, 0x46);
5310 is_ctia = (val & 0x0070) == 0x0070;
5311
5312 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5313 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5314
5315 snd_hda_codec_write(codec, 0x21, 0,
5316 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5317 msleep(80);
5318 snd_hda_codec_write(codec, 0x21, 0,
5319 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5320 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005321 case 0x10ec0234:
5322 case 0x10ec0274:
5323 case 0x10ec0294:
5324 alc_process_coef_fw(codec, coef0274);
Hui Wangfebf22562021-03-20 17:15:41 +08005325 msleep(850);
Kailang Yang71683c32017-06-20 16:33:50 +08005326 val = alc_read_coef_idx(codec, 0x46);
5327 is_ctia = (val & 0x00f0) == 0x00f0;
5328 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005329 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005330 case 0x10ec0283:
5331 alc_write_coef_idx(codec, 0x45, 0xd029);
5332 msleep(300);
5333 val = alc_read_coef_idx(codec, 0x46);
5334 is_ctia = (val & 0x0070) == 0x0070;
5335 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005336 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005337 snd_hda_codec_write(codec, 0x21, 0,
5338 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5339 msleep(100);
5340 snd_hda_codec_write(codec, 0x21, 0,
5341 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5342 msleep(200);
5343
5344 val = alc_read_coef_idx(codec, 0x50);
5345 if (val & (1 << 12)) {
5346 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5347 alc_process_coef_fw(codec, coef0288);
5348 msleep(350);
5349 val = alc_read_coef_idx(codec, 0x50);
5350 is_ctia = (val & 0x0070) == 0x0070;
5351 } else {
5352 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5353 alc_process_coef_fw(codec, coef0288);
5354 msleep(350);
5355 val = alc_read_coef_idx(codec, 0x50);
5356 is_ctia = (val & 0x0070) == 0x0070;
5357 }
5358 alc_process_coef_fw(codec, coef0298);
5359 snd_hda_codec_write(codec, 0x21, 0,
5360 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5361 msleep(75);
5362 snd_hda_codec_write(codec, 0x21, 0,
5363 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5364 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005365 case 0x10ec0286:
5366 case 0x10ec0288:
5367 alc_process_coef_fw(codec, coef0288);
5368 msleep(350);
5369 val = alc_read_coef_idx(codec, 0x50);
5370 is_ctia = (val & 0x0070) == 0x0070;
5371 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005372 case 0x10ec0292:
5373 alc_write_coef_idx(codec, 0x6b, 0xd429);
5374 msleep(300);
5375 val = alc_read_coef_idx(codec, 0x6c);
5376 is_ctia = (val & 0x001c) == 0x001c;
5377 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005378 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005379 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005380 msleep(300);
5381 val = alc_read_coef_idx(codec, 0x46);
5382 is_ctia = (val & 0x0070) == 0x0070;
5383 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005384 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005385 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005386 msleep(300);
5387 val = alc_read_coef_idx(codec, 0xbe);
5388 is_ctia = (val & 0x1c02) == 0x1c02;
5389 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005390 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005391 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005392 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005393 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005394 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005395 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005396 snd_hda_codec_write(codec, 0x21, 0,
5397 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5398 msleep(80);
5399 snd_hda_codec_write(codec, 0x21, 0,
5400 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5401
Kailang Yang5a367672017-07-21 15:23:53 +08005402 alc_process_coef_fw(codec, alc225_pre_hsmode);
5403 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5404 val = alc_read_coef_idx(codec, 0x45);
5405 if (val & (1 << 9)) {
5406 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5407 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5408 msleep(800);
5409 val = alc_read_coef_idx(codec, 0x46);
5410 is_ctia = (val & 0x00f0) == 0x00f0;
5411 } else {
5412 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5413 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5414 msleep(800);
5415 val = alc_read_coef_idx(codec, 0x46);
5416 is_ctia = (val & 0x00f0) == 0x00f0;
5417 }
5418 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5419 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5420 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005421
5422 snd_hda_codec_write(codec, 0x21, 0,
5423 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5424 msleep(80);
5425 snd_hda_codec_write(codec, 0x21, 0,
5426 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005427 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005428 case 0x10ec0867:
5429 is_ctia = true;
5430 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005431 }
5432
Takashi Iwai4e76a882014-02-25 12:21:03 +01005433 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005434 is_ctia ? "yes" : "no");
5435 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5436}
5437
5438static void alc_update_headset_mode(struct hda_codec *codec)
5439{
5440 struct alc_spec *spec = codec->spec;
5441
5442 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005443 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005444
5445 int new_headset_mode;
5446
5447 if (!snd_hda_jack_detect(codec, hp_pin))
5448 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5449 else if (mux_pin == spec->headset_mic_pin)
5450 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5451 else if (mux_pin == spec->headphone_mic_pin)
5452 new_headset_mode = ALC_HEADSET_MODE_MIC;
5453 else
5454 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5455
David Henningsson5959a6b2013-11-12 11:10:57 +01005456 if (new_headset_mode == spec->current_headset_mode) {
5457 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005458 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005459 }
David Henningsson73bdd592013-04-15 15:44:14 +02005460
5461 switch (new_headset_mode) {
5462 case ALC_HEADSET_MODE_UNPLUGGED:
5463 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005464 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5465 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005466 spec->gen.hp_jack_present = false;
5467 break;
5468 case ALC_HEADSET_MODE_HEADSET:
5469 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5470 alc_determine_headset_type(codec);
5471 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5472 alc_headset_mode_ctia(codec);
5473 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5474 alc_headset_mode_omtp(codec);
5475 spec->gen.hp_jack_present = true;
5476 break;
5477 case ALC_HEADSET_MODE_MIC:
5478 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5479 spec->gen.hp_jack_present = false;
5480 break;
5481 case ALC_HEADSET_MODE_HEADPHONE:
5482 alc_headset_mode_default(codec);
5483 spec->gen.hp_jack_present = true;
5484 break;
5485 }
5486 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5487 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5488 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005489 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005490 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5491 PIN_VREFHIZ);
5492 }
5493 spec->current_headset_mode = new_headset_mode;
5494
5495 snd_hda_gen_update_outputs(codec);
5496}
5497
5498static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005499 struct snd_kcontrol *kcontrol,
5500 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005501{
5502 alc_update_headset_mode(codec);
5503}
5504
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005505static void alc_update_headset_jack_cb(struct hda_codec *codec,
5506 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005507{
David Henningsson73bdd592013-04-15 15:44:14 +02005508 snd_hda_gen_hp_automute(codec, jack);
Hui Wange54f30b2021-03-20 17:15:42 +08005509 alc_update_headset_mode(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005510}
5511
5512static void alc_probe_headset_mode(struct hda_codec *codec)
5513{
5514 int i;
5515 struct alc_spec *spec = codec->spec;
5516 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5517
5518 /* Find mic pins */
5519 for (i = 0; i < cfg->num_inputs; i++) {
5520 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5521 spec->headset_mic_pin = cfg->inputs[i].pin;
5522 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5523 spec->headphone_mic_pin = cfg->inputs[i].pin;
5524 }
5525
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005526 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005527 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5528 spec->gen.automute_hook = alc_update_headset_mode;
5529 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5530}
5531
5532static void alc_fixup_headset_mode(struct hda_codec *codec,
5533 const struct hda_fixup *fix, int action)
5534{
5535 struct alc_spec *spec = codec->spec;
5536
5537 switch (action) {
5538 case HDA_FIXUP_ACT_PRE_PROBE:
5539 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5540 break;
5541 case HDA_FIXUP_ACT_PROBE:
5542 alc_probe_headset_mode(codec);
5543 break;
5544 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005545 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5546 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5547 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5548 }
David Henningsson73bdd592013-04-15 15:44:14 +02005549 alc_update_headset_mode(codec);
5550 break;
5551 }
5552}
5553
5554static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5555 const struct hda_fixup *fix, int action)
5556{
5557 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5558 struct alc_spec *spec = codec->spec;
5559 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5560 }
5561 else
5562 alc_fixup_headset_mode(codec, fix, action);
5563}
5564
Kailang Yang31278992014-03-03 15:27:22 +08005565static void alc255_set_default_jack_type(struct hda_codec *codec)
5566{
5567 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005568 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005569 WRITE_COEF(0x1b, 0x880b),
5570 WRITE_COEF(0x45, 0xd089),
5571 WRITE_COEF(0x1b, 0x080b),
5572 WRITE_COEF(0x46, 0x0004),
5573 WRITE_COEF(0x1b, 0x0c0b),
5574 {}
5575 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005576 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005577 WRITE_COEF(0x1b, 0x884b),
5578 WRITE_COEF(0x45, 0xd089),
5579 WRITE_COEF(0x1b, 0x084b),
5580 WRITE_COEF(0x46, 0x0004),
5581 WRITE_COEF(0x1b, 0x0c4b),
5582 {}
5583 };
5584 switch (codec->core.vendor_id) {
5585 case 0x10ec0255:
5586 alc_process_coef_fw(codec, alc255fw);
5587 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005588 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005589 case 0x10ec0256:
5590 alc_process_coef_fw(codec, alc256fw);
5591 break;
5592 }
Kailang Yang31278992014-03-03 15:27:22 +08005593 msleep(30);
5594}
5595
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005596static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5597 const struct hda_fixup *fix, int action)
5598{
5599 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005600 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005601 }
5602 alc_fixup_headset_mode(codec, fix, action);
5603}
5604
Kailang Yang31278992014-03-03 15:27:22 +08005605static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5606 const struct hda_fixup *fix, int action)
5607{
5608 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5609 struct alc_spec *spec = codec->spec;
5610 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5611 alc255_set_default_jack_type(codec);
5612 }
5613 else
5614 alc_fixup_headset_mode(codec, fix, action);
5615}
5616
Kailang Yange1e62b92015-04-08 16:01:22 +08005617static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5618 struct hda_jack_callback *jack)
5619{
5620 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005621
5622 alc_update_headset_jack_cb(codec, jack);
5623 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005624 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005625}
5626
5627static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5628 const struct hda_fixup *fix, int action)
5629{
5630 alc_fixup_headset_mode(codec, fix, action);
5631 if (action == HDA_FIXUP_ACT_PROBE) {
5632 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005633 /* toggled via hp_automute_hook */
5634 spec->gpio_mask |= 0x40;
5635 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005636 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5637 }
5638}
5639
Hui Wang493a52a2014-01-14 14:07:36 +08005640static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5641 const struct hda_fixup *fix, int action)
5642{
5643 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5644 struct alc_spec *spec = codec->spec;
5645 spec->gen.auto_mute_via_amp = 1;
5646 }
5647}
5648
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005649static void alc_fixup_no_shutup(struct hda_codec *codec,
5650 const struct hda_fixup *fix, int action)
5651{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005652 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005653 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005654 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005655 }
5656}
5657
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005658static void alc_fixup_disable_aamix(struct hda_codec *codec,
5659 const struct hda_fixup *fix, int action)
5660{
5661 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5662 struct alc_spec *spec = codec->spec;
5663 /* Disable AA-loopback as it causes white noise */
5664 spec->gen.mixer_nid = 0;
5665 }
5666}
5667
Takashi Iwai7f57d802015-09-24 17:36:51 +02005668/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5669static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5670 const struct hda_fixup *fix, int action)
5671{
5672 static const struct hda_pintbl pincfgs[] = {
5673 { 0x16, 0x21211010 }, /* dock headphone */
5674 { 0x19, 0x21a11010 }, /* dock mic */
5675 { }
5676 };
5677 struct alc_spec *spec = codec->spec;
5678
5679 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Hui Wang871b9062019-08-14 12:09:08 +08005680 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02005681 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5682 codec->power_save_node = 0; /* avoid click noises */
5683 snd_hda_apply_pincfgs(codec, pincfgs);
5684 }
5685}
5686
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005687static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5688 const struct hda_fixup *fix, int action)
5689{
5690 static const struct hda_pintbl pincfgs[] = {
5691 { 0x17, 0x21211010 }, /* dock headphone */
5692 { 0x19, 0x21a11010 }, /* dock mic */
5693 { }
5694 };
5695 struct alc_spec *spec = codec->spec;
5696
5697 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5698 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005699 snd_hda_apply_pincfgs(codec, pincfgs);
5700 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005701 /* Enable DOCK device */
5702 snd_hda_codec_write(codec, 0x17, 0,
5703 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5704 /* Enable DOCK device */
5705 snd_hda_codec_write(codec, 0x19, 0,
5706 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005707 }
5708}
5709
Takashi Iwai399c01a2020-05-26 08:24:06 +02005710static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5711 const struct hda_fixup *fix, int action)
5712{
5713 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5714 * the speaker output becomes too low by some reason on Thinkpads with
5715 * ALC298 codec
5716 */
5717 static const hda_nid_t preferred_pairs[] = {
5718 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5719 0
5720 };
5721 struct alc_spec *spec = codec->spec;
5722
5723 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5724 spec->gen.preferred_dacs = preferred_pairs;
5725}
5726
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02005727static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5728 const struct hda_fixup *fix, int action)
5729{
5730 static const hda_nid_t preferred_pairs[] = {
5731 0x17, 0x02, 0x21, 0x03, 0
5732 };
5733 struct alc_spec *spec = codec->spec;
5734
5735 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5736 spec->gen.preferred_dacs = preferred_pairs;
5737}
5738
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005739static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005740{
5741 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005742 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005743
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005744 /* Prevent pop noises when headphones are plugged in */
5745 snd_hda_codec_write(codec, hp_pin, 0,
5746 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5747 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005748}
5749
5750static void alc_fixup_dell_xps13(struct hda_codec *codec,
5751 const struct hda_fixup *fix, int action)
5752{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005753 struct alc_spec *spec = codec->spec;
5754 struct hda_input_mux *imux = &spec->gen.input_mux;
5755 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005756
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005757 switch (action) {
5758 case HDA_FIXUP_ACT_PRE_PROBE:
5759 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5760 * it causes a click noise at start up
5761 */
5762 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005763 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005764 break;
5765 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005766 /* Make the internal mic the default input source. */
5767 for (i = 0; i < imux->num_items; i++) {
5768 if (spec->gen.imux_pins[i] == 0x12) {
5769 spec->gen.cur_mux[0] = i;
5770 break;
5771 }
5772 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005773 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005774 }
5775}
5776
David Henningsson1f8b46c2015-05-12 14:38:15 +02005777static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5778 const struct hda_fixup *fix, int action)
5779{
5780 struct alc_spec *spec = codec->spec;
5781
5782 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5783 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5784 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005785
5786 /* Disable boost for mic-in permanently. (This code is only called
5787 from quirks that guarantee that the headphone is at NID 0x1b.) */
5788 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5789 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005790 } else
5791 alc_fixup_headset_mode(codec, fix, action);
5792}
5793
David Henningsson73bdd592013-04-15 15:44:14 +02005794static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5795 const struct hda_fixup *fix, int action)
5796{
5797 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005798 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005799 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005800 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5801 }
5802 alc_fixup_headset_mode(codec, fix, action);
5803}
5804
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005805/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5806static int find_ext_mic_pin(struct hda_codec *codec)
5807{
5808 struct alc_spec *spec = codec->spec;
5809 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5810 hda_nid_t nid;
5811 unsigned int defcfg;
5812 int i;
5813
5814 for (i = 0; i < cfg->num_inputs; i++) {
5815 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5816 continue;
5817 nid = cfg->inputs[i].pin;
5818 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5819 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5820 continue;
5821 return nid;
5822 }
5823
5824 return 0;
5825}
5826
Dylan Reid08a978d2012-11-18 22:56:40 -08005827static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005828 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005829 int action)
5830{
5831 struct alc_spec *spec = codec->spec;
5832
Takashi Iwai0db75792013-01-23 13:57:20 +01005833 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005834 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005835 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005836
5837 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005838 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005839 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005840 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005841}
David Henningsson693b6132012-06-22 19:12:10 +02005842
David Henningsson3e0d6112013-04-22 14:30:14 +02005843static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5844 const struct hda_fixup *fix,
5845 int action)
5846{
5847 struct alc_spec *spec = codec->spec;
5848 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5849 int i;
5850
5851 /* The mic boosts on level 2 and 3 are too noisy
5852 on the internal mic input.
5853 Therefore limit the boost to 0 or 1. */
5854
5855 if (action != HDA_FIXUP_ACT_PROBE)
5856 return;
5857
5858 for (i = 0; i < cfg->num_inputs; i++) {
5859 hda_nid_t nid = cfg->inputs[i].pin;
5860 unsigned int defcfg;
5861 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5862 continue;
5863 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5864 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5865 continue;
5866
5867 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5868 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5869 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5870 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5871 (0 << AC_AMPCAP_MUTE_SHIFT));
5872 }
5873}
5874
Kailang Yangcd217a62013-08-22 10:15:24 +02005875static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005876 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005877{
5878 struct alc_spec *spec = codec->spec;
5879 int vref;
5880
5881 msleep(200);
5882 snd_hda_gen_hp_automute(codec, jack);
5883
5884 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5885
5886 msleep(600);
5887 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5888 vref);
5889}
5890
Kailang Yangcd217a62013-08-22 10:15:24 +02005891static void alc283_fixup_chromebook(struct hda_codec *codec,
5892 const struct hda_fixup *fix, int action)
5893{
5894 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005895
5896 switch (action) {
5897 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005898 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005899 /* Disable AA-loopback as it causes white noise */
5900 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005901 break;
5902 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005903 /* MIC2-VREF control */
5904 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005905 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005906 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005907 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005908 break;
5909 }
5910}
5911
5912static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5913 const struct hda_fixup *fix, int action)
5914{
5915 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005916
5917 switch (action) {
5918 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005919 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5920 break;
5921 case HDA_FIXUP_ACT_INIT:
5922 /* MIC2-VREF control */
5923 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005924 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005925 break;
5926 }
5927}
5928
Takashi Iwai7bba2152013-09-06 15:45:38 +02005929/* mute tablet speaker pin (0x14) via dock plugging in addition */
5930static void asus_tx300_automute(struct hda_codec *codec)
5931{
5932 struct alc_spec *spec = codec->spec;
5933 snd_hda_gen_update_outputs(codec);
5934 if (snd_hda_jack_detect(codec, 0x1b))
5935 spec->gen.mute_bits |= (1ULL << 0x14);
5936}
5937
5938static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5939 const struct hda_fixup *fix, int action)
5940{
5941 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005942 static const struct hda_pintbl dock_pins[] = {
5943 { 0x1b, 0x21114000 }, /* dock speaker pin */
5944 {}
5945 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005946
5947 switch (action) {
5948 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005949 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02005950 /* TX300 needs to set up GPIO2 for the speaker amp */
5951 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02005952 snd_hda_apply_pincfgs(codec, dock_pins);
5953 spec->gen.auto_mute_via_amp = 1;
5954 spec->gen.automute_hook = asus_tx300_automute;
5955 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005956 snd_hda_gen_hp_automute);
5957 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005958 case HDA_FIXUP_ACT_PROBE:
5959 spec->init_amp = ALC_INIT_DEFAULT;
5960 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005961 case HDA_FIXUP_ACT_BUILD:
5962 /* this is a bit tricky; give more sane names for the main
5963 * (tablet) speaker and the dock speaker, respectively
5964 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005965 rename_ctl(codec, "Speaker Playback Switch",
5966 "Dock Speaker Playback Switch");
5967 rename_ctl(codec, "Bass Speaker Playback Switch",
5968 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005969 break;
5970 }
5971}
5972
David Henningsson338cae52013-10-07 10:39:59 +02005973static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5974 const struct hda_fixup *fix, int action)
5975{
David Henningsson0f4881d2013-12-20 16:08:13 +01005976 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5977 /* DAC node 0x03 is giving mono output. We therefore want to
5978 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5979 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005980 static const hda_nid_t conn1[] = { 0x0c };
5981 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
5982 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01005983 }
David Henningsson338cae52013-10-07 10:39:59 +02005984}
5985
Hui Wangdd9aa332016-08-01 10:20:32 +08005986static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5987 const struct hda_fixup *fix, int action)
5988{
5989 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5990 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5991 we can't adjust the speaker's volume since this node does not has
5992 Amp-out capability. we change the speaker's route to:
5993 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5994 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5995 speaker's volume now. */
5996
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005997 static const hda_nid_t conn1[] = { 0x0c };
5998 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08005999 }
6000}
6001
Takashi Iwaie312a862018-03-06 12:14:17 +01006002/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6003static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6004 const struct hda_fixup *fix, int action)
6005{
6006 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006007 static const hda_nid_t conn[] = { 0x02, 0x03 };
6008 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01006009 }
6010}
6011
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006012/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6013static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6014 const struct hda_fixup *fix, int action)
6015{
6016 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006017 static const hda_nid_t conn[] = { 0x02 };
6018 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006019 }
6020}
6021
Keith Packard98973f22015-07-15 12:14:39 -07006022/* Hook to update amp GPIO4 for automute */
6023static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6024 struct hda_jack_callback *jack)
6025{
6026 struct alc_spec *spec = codec->spec;
6027
6028 snd_hda_gen_hp_automute(codec, jack);
6029 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08006030 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6031 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07006032}
6033
6034/* Manage GPIOs for HP EliteBook Folio 9480m.
6035 *
6036 * GPIO4 is the headphone amplifier power control
6037 * GPIO3 is the audio output mute indicator LED
6038 */
6039
6040static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6041 const struct hda_fixup *fix,
6042 int action)
6043{
6044 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07006045
Takashi Iwai01e4a272018-06-19 22:47:30 +02006046 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07006047 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02006048 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6049 spec->gpio_mask |= 0x10;
6050 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07006051 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07006052 }
6053}
6054
Takashi Iwaiae065f12018-06-19 23:00:03 +02006055static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6056 const struct hda_fixup *fix,
6057 int action)
6058{
6059 struct alc_spec *spec = codec->spec;
6060
6061 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6062 spec->gpio_mask |= 0x04;
6063 spec->gpio_dir |= 0x04;
6064 /* set data bit low */
6065 }
6066}
6067
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006068/* Quirk for Thinkpad X1 7th and 8th Gen
6069 * The following fixed routing needed
6070 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6071 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6072 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6073 */
6074static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6075 const struct hda_fixup *fix, int action)
6076{
6077 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6078 static const hda_nid_t preferred_pairs[] = {
6079 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6080 };
6081 struct alc_spec *spec = codec->spec;
6082
6083 switch (action) {
6084 case HDA_FIXUP_ACT_PRE_PROBE:
6085 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6086 spec->gen.preferred_dacs = preferred_pairs;
6087 break;
6088 case HDA_FIXUP_ACT_BUILD:
6089 /* The generic parser creates somewhat unintuitive volume ctls
6090 * with the fixed routing above, and the shared DAC2 may be
6091 * confusing for PA.
6092 * Rename those to unique names so that PA doesn't touch them
6093 * and use only Master volume.
6094 */
6095 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6096 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6097 break;
6098 }
6099}
6100
Kailang Yangca169cc2017-04-25 16:17:40 +08006101static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6102 const struct hda_fixup *fix,
6103 int action)
6104{
6105 alc_fixup_dual_codecs(codec, fix, action);
6106 switch (action) {
6107 case HDA_FIXUP_ACT_PRE_PROBE:
6108 /* override card longname to provide a unique UCM profile */
6109 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6110 break;
6111 case HDA_FIXUP_ACT_BUILD:
6112 /* rename Capture controls depending on the codec */
6113 rename_ctl(codec, "Capture Volume",
6114 codec->addr == 0 ?
6115 "Rear-Panel Capture Volume" :
6116 "Front-Panel Capture Volume");
6117 rename_ctl(codec, "Capture Switch",
6118 codec->addr == 0 ?
6119 "Rear-Panel Capture Switch" :
6120 "Front-Panel Capture Switch");
6121 break;
6122 }
6123}
6124
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006125static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6126 const struct hda_fixup *fix, int action)
6127{
6128 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6129 return;
6130
6131 codec->power_save_node = 1;
6132}
6133
Kailang Yang92266652017-12-14 15:28:58 +08006134/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6135static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6136 const struct hda_fixup *fix, int action)
6137{
6138 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006139 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08006140 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6141 0
6142 };
6143
6144 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6145 return;
6146
6147 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08006148 spec->gen.auto_mute_via_amp = 1;
6149 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08006150}
6151
Takashi Iwaic84bfed2020-11-27 15:11:04 +01006152/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6153static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6154 const struct hda_fixup *fix, int action)
6155{
6156 static const hda_nid_t preferred_pairs[] = {
6157 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6158 };
6159 struct alc_spec *spec = codec->spec;
6160
6161 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6162 spec->gen.preferred_dacs = preferred_pairs;
6163 spec->gen.obey_preferred_dacs = 1;
6164 }
6165}
6166
Hui Wangc4cfcf62018-11-26 14:17:16 +08006167/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6168static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6169 const struct hda_fixup *fix, int action)
6170{
6171 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6172 return;
6173
6174 snd_hda_override_wcaps(codec, 0x03, 0);
6175}
6176
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006177static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6178{
6179 switch (codec->core.vendor_id) {
6180 case 0x10ec0274:
6181 case 0x10ec0294:
6182 case 0x10ec0225:
6183 case 0x10ec0295:
6184 case 0x10ec0299:
6185 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6186 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6187 break;
6188 case 0x10ec0235:
6189 case 0x10ec0236:
6190 case 0x10ec0255:
6191 case 0x10ec0256:
6192 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6193 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6194 break;
6195 }
6196}
6197
Kailang Yang8983eb62019-04-03 15:31:49 +08006198static void alc295_fixup_chromebook(struct hda_codec *codec,
6199 const struct hda_fixup *fix, int action)
6200{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006201 struct alc_spec *spec = codec->spec;
6202
Kailang Yang8983eb62019-04-03 15:31:49 +08006203 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006204 case HDA_FIXUP_ACT_PRE_PROBE:
6205 spec->ultra_low_power = true;
6206 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006207 case HDA_FIXUP_ACT_INIT:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006208 alc_combo_jack_hp_jd_restart(codec);
Kailang Yang8983eb62019-04-03 15:31:49 +08006209 break;
6210 }
6211}
6212
Kailang Yangd1dd4212019-01-09 17:05:24 +08006213static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6214 const struct hda_fixup *fix, int action)
6215{
6216 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6217 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6218}
6219
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006220
6221static void alc294_gx502_toggle_output(struct hda_codec *codec,
6222 struct hda_jack_callback *cb)
6223{
6224 /* The Windows driver sets the codec up in a very different way where
6225 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6226 */
6227 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6228 alc_write_coef_idx(codec, 0x10, 0x8a20);
6229 else
6230 alc_write_coef_idx(codec, 0x10, 0x0a20);
6231}
6232
6233static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6234 const struct hda_fixup *fix, int action)
6235{
6236 /* Pin 0x21: headphones/headset mic */
6237 if (!is_jack_detectable(codec, 0x21))
6238 return;
6239
6240 switch (action) {
6241 case HDA_FIXUP_ACT_PRE_PROBE:
6242 snd_hda_jack_detect_enable_callback(codec, 0x21,
6243 alc294_gx502_toggle_output);
6244 break;
6245 case HDA_FIXUP_ACT_INIT:
6246 /* Make sure to start in a correct state, i.e. if
6247 * headphones have been plugged in before powering up the system
6248 */
6249 alc294_gx502_toggle_output(codec, NULL);
6250 break;
6251 }
6252}
6253
Kailang Yang56496252020-07-29 15:09:27 +08006254static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6255 const struct hda_fixup *fix, int action)
6256{
6257 if (action != HDA_FIXUP_ACT_INIT)
6258 return;
6259
6260 msleep(100);
6261 alc_write_coef_idx(codec, 0x65, 0x0);
6262}
6263
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006264static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6265 const struct hda_fixup *fix, int action)
6266{
6267 switch (action) {
6268 case HDA_FIXUP_ACT_INIT:
6269 alc_combo_jack_hp_jd_restart(codec);
6270 break;
6271 }
6272}
6273
Kailang Yang92666d42020-11-19 17:04:21 +08006274static void alc_fixup_no_int_mic(struct hda_codec *codec,
6275 const struct hda_fixup *fix, int action)
6276{
6277 struct alc_spec *spec = codec->spec;
6278
6279 switch (action) {
6280 case HDA_FIXUP_ACT_PRE_PROBE:
6281 /* Mic RING SLEEVE swap for combo jack */
6282 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6283 spec->no_internal_mic_pin = true;
6284 break;
6285 case HDA_FIXUP_ACT_INIT:
6286 alc_combo_jack_hp_jd_restart(codec);
6287 break;
6288 }
6289}
6290
Takashi Iwaib317b032014-01-08 11:44:21 +01006291/* for hda_fixup_thinkpad_acpi() */
6292#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006293
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006294static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6295 const struct hda_fixup *fix, int action)
6296{
6297 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6298 hda_fixup_thinkpad_acpi(codec, fix, action);
6299}
6300
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006301/* for alc295_fixup_hp_top_speakers */
6302#include "hp_x360_helper.c"
6303
Takashi Iwai26928ca2021-04-16 10:12:11 +02006304/* for alc285_fixup_ideapad_s740_coef() */
6305#include "ideapad_s740_helper.c"
6306
Takashi Iwai1d045db2011-07-07 18:23:21 +02006307enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006308 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006309 ALC269_FIXUP_SONY_VAIO,
6310 ALC275_FIXUP_SONY_VAIO_GPIO2,
6311 ALC269_FIXUP_DELL_M101Z,
6312 ALC269_FIXUP_SKU_IGNORE,
6313 ALC269_FIXUP_ASUS_G73JW,
6314 ALC269_FIXUP_LENOVO_EAPD,
6315 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006316 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006317 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006318 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006319 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006320 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006321 ALC269_FIXUP_QUANTA_MUTE,
6322 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006323 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006324 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006325 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006326 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006327 ALC269_FIXUP_AMIC,
6328 ALC269_FIXUP_DMIC,
6329 ALC269VB_FIXUP_AMIC,
6330 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006331 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006332 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006333 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006334 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006335 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006336 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6337 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006338 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006339 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006340 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006341 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006342 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006343 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006344 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6345 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006346 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006347 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006348 ALC269_FIXUP_HEADSET_MODE,
6349 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006350 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006351 ALC269_FIXUP_ASUS_X101_FUNC,
6352 ALC269_FIXUP_ASUS_X101_VERB,
6353 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006354 ALC271_FIXUP_AMIC_MIC2,
6355 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006356 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006357 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006358 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006359 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006360 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006361 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006362 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006363 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006364 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006365 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006366 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006367 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006368 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6369 ALC290_FIXUP_SUBWOOFER,
6370 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006371 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006372 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006373 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006374 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006375 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006376 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006377 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006378 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006379 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006380 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006381 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006382 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006383 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006384 ALC282_FIXUP_ASPIRE_V5_PINS,
Takashi Iwaic8426b22021-04-07 11:57:30 +02006385 ALC269VB_FIXUP_ASPIRE_E1_COEF,
David Henningsson7a5255f2014-10-30 08:26:01 +01006386 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006387 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006388 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006389 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006390 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006391 ALC280_FIXUP_HP_9480M,
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01006392 ALC245_FIXUP_HP_X360_AMP,
Kailang Yange1e62b92015-04-08 16:01:22 +08006393 ALC288_FIXUP_DELL_HEADSET_MODE,
6394 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006395 ALC288_FIXUP_DELL_XPS_13,
6396 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006397 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006398 ALC292_FIXUP_DELL_E7X,
6399 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006400 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006401 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006402 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006403 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006404 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006405 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006406 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006407 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006408 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006409 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006410 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006411 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006412 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006413 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006414 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006415 ALC298_FIXUP_SPK_VOLUME,
Kailang Yangf86de9b2020-10-23 14:46:47 +08006416 ALC298_FIXUP_LENOVO_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006417 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006418 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006419 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006420 ALC256_FIXUP_ASUS_HEADSET_MODE,
6421 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006422 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006423 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6424 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006425 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006426 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006427 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006428 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006429 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006430 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006431 ALC274_FIXUP_DELL_BIND_DACS,
6432 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006433 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006434 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006435 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006436 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006437 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006438 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006439 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006440 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006441 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006442 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006443 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006444 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006445 ALC294_FIXUP_ASUS_HEADSET_MIC,
6446 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006447 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006448 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006449 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006450 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006451 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006452 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6453 ALC225_FIXUP_WYSE_AUTO_MUTE,
6454 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006455 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006456 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006457 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006458 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006459 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006460 ALC289_FIXUP_DELL_SPK2,
6461 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006462 ALC294_FIXUP_SPK2_TO_DAC1,
6463 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006464 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006465 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006466 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006467 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006468 ALC294_FIXUP_ASUS_GX502_HP,
6469 ALC294_FIXUP_ASUS_GX502_PINS,
6470 ALC294_FIXUP_ASUS_GX502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006471 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006472 ALC285_FIXUP_HP_MUTE_LED,
Jeremy Szue7d66cf2021-03-16 15:46:24 +08006473 ALC236_FIXUP_HP_GPIO_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006474 ALC236_FIXUP_HP_MUTE_LED,
Jonas Witschel75b62ab2021-04-16 12:58:54 +02006475 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
Mike Pozulp14425f12020-05-09 20:28:37 -07006476 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006477 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006478 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006479 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006480 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006481 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006482 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006483 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006484 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006485 ALC269_FIXUP_CZC_B20,
6486 ALC269_FIXUP_CZC_TMI,
6487 ALC269_FIXUP_CZC_L101,
6488 ALC269_FIXUP_LEMOTE_A1802,
6489 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006490 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Phil Calvind1ee66c2021-04-15 18:01:29 -04006491 ALC233_FIXUP_INTEL_NUC8_DMIC,
6492 ALC233_FIXUP_INTEL_NUC8_BOOST,
Werner Sembach73e71612021-03-02 19:04:14 +01006493 ALC256_FIXUP_INTEL_NUC10,
Hui Wangfc19d552020-09-09 10:00:41 +08006494 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006495 ALC274_FIXUP_HP_MIC,
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006496 ALC274_FIXUP_HP_HEADSET_MIC,
Takashi Iwai622464c2021-05-04 11:18:02 +02006497 ALC274_FIXUP_HP_ENVY_GPIO,
Kailang Yangef9ce662020-11-03 15:40:35 +08006498 ALC256_FIXUP_ASUS_HPE,
Kailang Yang446b8182020-11-02 15:00:12 +08006499 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Kailang Yanga0ccbc52020-11-06 15:20:38 +08006500 ALC287_FIXUP_HP_GPIO_LED,
Kailang Yang9e885772020-11-03 15:30:51 +08006501 ALC256_FIXUP_HP_HEADSET_MIC,
Kailang Yang92666d42020-11-19 17:04:21 +08006502 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
Chris Chiu34cdf402020-12-16 20:52:00 +08006503 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
Chris Chiu495dc762021-01-14 16:27:28 +08006504 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
Chris Chiud0e18562021-02-26 09:04:40 +08006505 ALC256_FIXUP_ACER_HEADSET_MIC,
Takashi Iwai26928ca2021-04-16 10:12:11 +02006506 ALC285_FIXUP_IDEAPAD_S740_COEF,
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08006507 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02006508 ALC295_FIXUP_ASUS_DACS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006509};
6510
Takashi Iwai1727a772013-01-10 09:52:52 +01006511static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006512 [ALC269_FIXUP_GPIO2] = {
6513 .type = HDA_FIXUP_FUNC,
6514 .v.func = alc_fixup_gpio2,
6515 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006516 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01006517 .type = HDA_FIXUP_PINCTLS,
6518 .v.pins = (const struct hda_pintbl[]) {
6519 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006520 {}
6521 }
6522 },
6523 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006524 .type = HDA_FIXUP_FUNC,
6525 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006526 .chained = true,
6527 .chain_id = ALC269_FIXUP_SONY_VAIO
6528 },
6529 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006530 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006531 .v.verbs = (const struct hda_verb[]) {
6532 /* Enables internal speaker */
6533 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6534 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6535 {}
6536 }
6537 },
6538 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006539 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02006540 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006541 },
6542 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006543 .type = HDA_FIXUP_PINS,
6544 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02006545 { 0x17, 0x99130111 }, /* subwoofer */
6546 { }
6547 }
6548 },
6549 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006550 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006551 .v.verbs = (const struct hda_verb[]) {
6552 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6553 {}
6554 }
6555 },
6556 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006557 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006558 .v.func = alc269_fixup_hweq,
6559 .chained = true,
6560 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6561 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006562 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6563 .type = HDA_FIXUP_FUNC,
6564 .v.func = alc_fixup_disable_aamix,
6565 .chained = true,
6566 .chain_id = ALC269_FIXUP_SONY_VAIO
6567 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006568 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006569 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006570 .v.func = alc271_fixup_dmic,
6571 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02006572 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006573 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006574 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02006575 .chained = true,
6576 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02006577 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006578 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006579 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006580 .v.func = alc269_fixup_stereo_dmic,
6581 },
David Henningsson7c478f02013-10-11 10:18:46 +02006582 [ALC269_FIXUP_HEADSET_MIC] = {
6583 .type = HDA_FIXUP_FUNC,
6584 .v.func = alc269_fixup_headset_mic,
6585 },
Takashi Iwai24519912011-08-16 15:08:49 +02006586 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006587 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02006588 .v.func = alc269_fixup_quanta_mute,
6589 },
6590 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006591 .type = HDA_FIXUP_PINS,
6592 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02006593 { 0x1a, 0x2101103f }, /* dock line-out */
6594 { 0x1b, 0x23a11040 }, /* dock mic-in */
6595 { }
6596 },
6597 .chained = true,
6598 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6599 },
David Henningsson2041d562014-06-13 11:15:44 +02006600 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6601 .type = HDA_FIXUP_PINS,
6602 .v.pins = (const struct hda_pintbl[]) {
6603 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6604 { }
6605 },
6606 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006607 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6608 .type = HDA_FIXUP_PINS,
6609 .v.pins = (const struct hda_pintbl[]) {
6610 { 0x21, 0x0221102f }, /* HP out */
6611 { }
6612 },
6613 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006614 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6615 .type = HDA_FIXUP_FUNC,
6616 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6617 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006618 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6619 .type = HDA_FIXUP_FUNC,
6620 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6621 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02006622 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006623 .type = HDA_FIXUP_PINS,
6624 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006625 { 0x14, 0x99130110 }, /* speaker */
6626 { 0x15, 0x0121401f }, /* HP out */
6627 { 0x18, 0x01a19c20 }, /* mic */
6628 { 0x19, 0x99a3092f }, /* int-mic */
6629 { }
6630 },
6631 },
6632 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006633 .type = HDA_FIXUP_PINS,
6634 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006635 { 0x12, 0x99a3092f }, /* int-mic */
6636 { 0x14, 0x99130110 }, /* speaker */
6637 { 0x15, 0x0121401f }, /* HP out */
6638 { 0x18, 0x01a19c20 }, /* mic */
6639 { }
6640 },
6641 },
6642 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006643 .type = HDA_FIXUP_PINS,
6644 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006645 { 0x14, 0x99130110 }, /* speaker */
6646 { 0x18, 0x01a19c20 }, /* mic */
6647 { 0x19, 0x99a3092f }, /* int-mic */
6648 { 0x21, 0x0121401f }, /* HP out */
6649 { }
6650 },
6651 },
David Henningsson2267ea92012-01-03 08:45:56 +01006652 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006653 .type = HDA_FIXUP_PINS,
6654 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006655 { 0x12, 0x99a3092f }, /* int-mic */
6656 { 0x14, 0x99130110 }, /* speaker */
6657 { 0x18, 0x01a19c20 }, /* mic */
6658 { 0x21, 0x0121401f }, /* HP out */
6659 { }
6660 },
6661 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006662 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006663 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006664 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01006665 },
David Henningssond06ac142013-02-18 11:41:55 +01006666 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6667 .type = HDA_FIXUP_FUNC,
6668 .v.func = alc269_fixup_hp_mute_led_mic1,
6669 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006670 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006671 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006672 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01006673 },
Tom Briden7f783bd2017-03-25 10:12:01 +00006674 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6675 .type = HDA_FIXUP_FUNC,
6676 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006677 .chained = true,
6678 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00006679 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006680 [ALC269_FIXUP_HP_GPIO_LED] = {
6681 .type = HDA_FIXUP_FUNC,
6682 .v.func = alc269_fixup_hp_gpio_led,
6683 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006684 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6685 .type = HDA_FIXUP_FUNC,
6686 .v.func = alc269_fixup_hp_gpio_mic1_led,
6687 },
6688 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6689 .type = HDA_FIXUP_FUNC,
6690 .v.func = alc269_fixup_hp_line1_mic1_led,
6691 },
David Henningsson693b6132012-06-22 19:12:10 +02006692 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006693 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02006694 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02006695 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006696 [ALC269_FIXUP_NO_SHUTUP] = {
6697 .type = HDA_FIXUP_FUNC,
6698 .v.func = alc_fixup_no_shutup,
6699 },
David Henningsson108cc102012-07-20 10:37:25 +02006700 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006701 .type = HDA_FIXUP_PINS,
6702 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02006703 { 0x19, 0x23a11040 }, /* dock mic */
6704 { 0x1b, 0x2121103f }, /* dock headphone */
6705 { }
6706 },
6707 .chained = true,
6708 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6709 },
Takashi Iwaib590b382020-05-14 18:05:33 +02006710 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6711 .type = HDA_FIXUP_FUNC,
6712 .v.func = alc269_fixup_limit_int_mic_boost,
6713 .chained = true,
6714 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6715 },
David Henningsson108cc102012-07-20 10:37:25 +02006716 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006717 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02006718 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01006719 .chained = true,
6720 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02006721 },
David Henningsson73bdd592013-04-15 15:44:14 +02006722 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6723 .type = HDA_FIXUP_PINS,
6724 .v.pins = (const struct hda_pintbl[]) {
6725 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6726 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6727 { }
6728 },
6729 .chained = true,
6730 .chain_id = ALC269_FIXUP_HEADSET_MODE
6731 },
6732 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6733 .type = HDA_FIXUP_PINS,
6734 .v.pins = (const struct hda_pintbl[]) {
6735 { 0x16, 0x21014020 }, /* dock line out */
6736 { 0x19, 0x21a19030 }, /* dock mic */
6737 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6738 { }
6739 },
6740 .chained = true,
6741 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6742 },
David Henningsson338cae52013-10-07 10:39:59 +02006743 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6744 .type = HDA_FIXUP_PINS,
6745 .v.pins = (const struct hda_pintbl[]) {
6746 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6747 { }
6748 },
6749 .chained = true,
6750 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6751 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08006752 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6753 .type = HDA_FIXUP_PINS,
6754 .v.pins = (const struct hda_pintbl[]) {
6755 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6756 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6757 { }
6758 },
6759 .chained = true,
6760 .chain_id = ALC269_FIXUP_HEADSET_MODE
6761 },
David Henningsson73bdd592013-04-15 15:44:14 +02006762 [ALC269_FIXUP_HEADSET_MODE] = {
6763 .type = HDA_FIXUP_FUNC,
6764 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08006765 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006766 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02006767 },
6768 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6769 .type = HDA_FIXUP_FUNC,
6770 .v.func = alc_fixup_headset_mode_no_hp_mic,
6771 },
Takashi Iwai78197172015-06-27 10:21:13 +02006772 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6773 .type = HDA_FIXUP_PINS,
6774 .v.pins = (const struct hda_pintbl[]) {
6775 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6776 { }
6777 },
6778 .chained = true,
6779 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6780 },
David Henningsson88cfcf82013-10-11 10:18:45 +02006781 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6782 .type = HDA_FIXUP_PINS,
6783 .v.pins = (const struct hda_pintbl[]) {
6784 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6785 { }
6786 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02006787 .chained = true,
6788 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02006789 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006790 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006791 .type = HDA_FIXUP_PINS,
6792 .v.pins = (const struct hda_pintbl[]) {
6793 {0x12, 0x90a60130},
6794 {0x13, 0x40000000},
6795 {0x14, 0x90170110},
6796 {0x18, 0x411111f0},
6797 {0x19, 0x04a11040},
6798 {0x1a, 0x411111f0},
6799 {0x1b, 0x90170112},
6800 {0x1d, 0x40759a05},
6801 {0x1e, 0x411111f0},
6802 {0x21, 0x04211020},
6803 { }
6804 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05006805 .chained = true,
6806 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006807 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006808 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6809 .type = HDA_FIXUP_FUNC,
6810 .v.func = alc298_fixup_huawei_mbx_stereo,
6811 .chained = true,
6812 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6813 },
David Henningssond240d1d2013-04-15 12:50:02 +02006814 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6815 .type = HDA_FIXUP_FUNC,
6816 .v.func = alc269_fixup_x101_headset_mic,
6817 },
6818 [ALC269_FIXUP_ASUS_X101_VERB] = {
6819 .type = HDA_FIXUP_VERBS,
6820 .v.verbs = (const struct hda_verb[]) {
6821 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6822 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6823 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6824 { }
6825 },
6826 .chained = true,
6827 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6828 },
6829 [ALC269_FIXUP_ASUS_X101] = {
6830 .type = HDA_FIXUP_PINS,
6831 .v.pins = (const struct hda_pintbl[]) {
6832 { 0x18, 0x04a1182c }, /* Headset mic */
6833 { }
6834 },
6835 .chained = true,
6836 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6837 },
Dylan Reid08a978d2012-11-18 22:56:40 -08006838 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006839 .type = HDA_FIXUP_PINS,
6840 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08006841 { 0x14, 0x99130110 }, /* speaker */
6842 { 0x19, 0x01a19c20 }, /* mic */
6843 { 0x1b, 0x99a7012f }, /* int-mic */
6844 { 0x21, 0x0121401f }, /* HP out */
6845 { }
6846 },
6847 },
6848 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006849 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08006850 .v.func = alc271_hp_gate_mic_jack,
6851 .chained = true,
6852 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6853 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006854 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6855 .type = HDA_FIXUP_FUNC,
6856 .v.func = alc269_fixup_limit_int_mic_boost,
6857 .chained = true,
6858 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6859 },
Dylan Reid42397002013-04-05 14:58:22 -07006860 [ALC269_FIXUP_ACER_AC700] = {
6861 .type = HDA_FIXUP_PINS,
6862 .v.pins = (const struct hda_pintbl[]) {
6863 { 0x12, 0x99a3092f }, /* int-mic */
6864 { 0x14, 0x99130110 }, /* speaker */
6865 { 0x18, 0x03a11c20 }, /* mic */
6866 { 0x1e, 0x0346101e }, /* SPDIF1 */
6867 { 0x21, 0x0321101f }, /* HP out */
6868 { }
6869 },
6870 .chained = true,
6871 .chain_id = ALC271_FIXUP_DMIC,
6872 },
David Henningsson3e0d6112013-04-22 14:30:14 +02006873 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6874 .type = HDA_FIXUP_FUNC,
6875 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01006876 .chained = true,
6877 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02006878 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01006879 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6880 .type = HDA_FIXUP_FUNC,
6881 .v.func = alc269_fixup_limit_int_mic_boost,
6882 .chained = true,
6883 .chain_id = ALC269VB_FIXUP_DMIC,
6884 },
Takashi Iwai23870832013-11-29 14:13:12 +01006885 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6886 .type = HDA_FIXUP_VERBS,
6887 .v.verbs = (const struct hda_verb[]) {
6888 /* class-D output amp +5dB */
6889 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6890 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6891 {}
6892 },
6893 .chained = true,
6894 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6895 },
David Henningsson8e35cd42013-11-06 11:20:01 +01006896 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6897 .type = HDA_FIXUP_FUNC,
6898 .v.func = alc269_fixup_limit_int_mic_boost,
6899 .chained = true,
6900 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6901 },
Anisse Astier02b504d2013-06-03 11:53:10 +02006902 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6903 .type = HDA_FIXUP_PINS,
6904 .v.pins = (const struct hda_pintbl[]) {
6905 { 0x12, 0x99a3092f }, /* int-mic */
6906 { 0x18, 0x03a11d20 }, /* mic */
6907 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6908 { }
6909 },
6910 },
Kailang Yangcd217a62013-08-22 10:15:24 +02006911 [ALC283_FIXUP_CHROME_BOOK] = {
6912 .type = HDA_FIXUP_FUNC,
6913 .v.func = alc283_fixup_chromebook,
6914 },
Kailang Yang0202e992013-12-02 15:20:15 +08006915 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6916 .type = HDA_FIXUP_FUNC,
6917 .v.func = alc283_fixup_sense_combo_jack,
6918 .chained = true,
6919 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6920 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02006921 [ALC282_FIXUP_ASUS_TX300] = {
6922 .type = HDA_FIXUP_FUNC,
6923 .v.func = alc282_fixup_asus_tx300,
6924 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02006925 [ALC283_FIXUP_INT_MIC] = {
6926 .type = HDA_FIXUP_VERBS,
6927 .v.verbs = (const struct hda_verb[]) {
6928 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6929 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6930 { }
6931 },
6932 .chained = true,
6933 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6934 },
David Henningsson0f4881d2013-12-20 16:08:13 +01006935 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6936 .type = HDA_FIXUP_PINS,
6937 .v.pins = (const struct hda_pintbl[]) {
6938 { 0x17, 0x90170112 }, /* subwoofer */
6939 { }
6940 },
6941 .chained = true,
6942 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6943 },
6944 [ALC290_FIXUP_SUBWOOFER] = {
6945 .type = HDA_FIXUP_PINS,
6946 .v.pins = (const struct hda_pintbl[]) {
6947 { 0x17, 0x90170112 }, /* subwoofer */
6948 { }
6949 },
6950 .chained = true,
6951 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6952 },
David Henningsson338cae52013-10-07 10:39:59 +02006953 [ALC290_FIXUP_MONO_SPEAKERS] = {
6954 .type = HDA_FIXUP_FUNC,
6955 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01006956 },
6957 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6958 .type = HDA_FIXUP_FUNC,
6959 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02006960 .chained = true,
6961 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6962 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01006963 [ALC269_FIXUP_THINKPAD_ACPI] = {
6964 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006965 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02006966 .chained = true,
6967 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006968 },
David Henningsson56f27012016-01-11 09:33:14 +01006969 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6970 .type = HDA_FIXUP_FUNC,
6971 .v.func = alc_fixup_inv_dmic,
6972 .chained = true,
6973 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6974 },
Chris Chiu5824ce82017-02-28 14:17:11 -06006975 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08006976 .type = HDA_FIXUP_PINS,
6977 .v.pins = (const struct hda_pintbl[]) {
6978 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6979 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06006980 },
6981 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08006982 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06006983 },
Chris Chiu615966a2017-02-28 14:17:12 -06006984 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6985 .type = HDA_FIXUP_PINS,
6986 .v.pins = (const struct hda_pintbl[]) {
6987 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6988 { }
6989 },
6990 .chained = true,
6991 .chain_id = ALC255_FIXUP_HEADSET_MODE
6992 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006993 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6994 .type = HDA_FIXUP_PINS,
6995 .v.pins = (const struct hda_pintbl[]) {
6996 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6997 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6998 { }
6999 },
7000 .chained = true,
7001 .chain_id = ALC255_FIXUP_HEADSET_MODE
7002 },
Kailang Yang31278992014-03-03 15:27:22 +08007003 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7004 .type = HDA_FIXUP_PINS,
7005 .v.pins = (const struct hda_pintbl[]) {
7006 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7007 { }
7008 },
7009 .chained = true,
7010 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7011 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007012 [ALC255_FIXUP_HEADSET_MODE] = {
7013 .type = HDA_FIXUP_FUNC,
7014 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08007015 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007016 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007017 },
Kailang Yang31278992014-03-03 15:27:22 +08007018 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7019 .type = HDA_FIXUP_FUNC,
7020 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7021 },
Kailang Yanga22aa262014-04-23 17:34:28 +08007022 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7023 .type = HDA_FIXUP_PINS,
7024 .v.pins = (const struct hda_pintbl[]) {
7025 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7026 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7027 { }
7028 },
7029 .chained = true,
7030 .chain_id = ALC269_FIXUP_HEADSET_MODE
7031 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02007032 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02007033 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02007034 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02007035 .chained = true,
7036 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7037 },
Takashi Iwai9a811232015-12-09 15:17:43 +01007038 [ALC292_FIXUP_TPT440] = {
7039 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01007040 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01007041 .chained = true,
7042 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7043 },
Anisse Astierabaa22742016-08-24 09:14:13 +02007044 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01007045 .type = HDA_FIXUP_PINS,
7046 .v.pins = (const struct hda_pintbl[]) {
7047 { 0x19, 0x04a110f0 },
7048 { },
7049 },
7050 },
Takashi Iwaib3802782018-11-26 17:47:46 +01007051 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08007052 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007053 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08007054 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007055 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7056 .type = HDA_FIXUP_PINS,
7057 .v.pins = (const struct hda_pintbl[]) {
7058 { 0x12, 0x90a60130 },
7059 { 0x14, 0x90170110 },
7060 { 0x17, 0x40000008 },
7061 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02007062 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007063 { 0x1a, 0x411111f0 },
7064 { 0x1b, 0x411111f0 },
7065 { 0x1d, 0x40f89b2d },
7066 { 0x1e, 0x411111f0 },
7067 { 0x21, 0x0321101f },
7068 { },
7069 },
7070 },
Takashi Iwaic8426b22021-04-07 11:57:30 +02007071 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7072 .type = HDA_FIXUP_FUNC,
7073 .v.func = alc269vb_fixup_aspire_e1_coef,
7074 },
David Henningsson7a5255f2014-10-30 08:26:01 +01007075 [ALC280_FIXUP_HP_GPIO4] = {
7076 .type = HDA_FIXUP_FUNC,
7077 .v.func = alc280_fixup_hp_gpio4,
7078 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007079 [ALC286_FIXUP_HP_GPIO_LED] = {
7080 .type = HDA_FIXUP_FUNC,
7081 .v.func = alc286_fixup_hp_gpio_led,
7082 },
David Henningsson33f4acd2015-01-07 15:50:13 +01007083 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7084 .type = HDA_FIXUP_FUNC,
7085 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7086 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01007087 [ALC280_FIXUP_HP_DOCK_PINS] = {
7088 .type = HDA_FIXUP_PINS,
7089 .v.pins = (const struct hda_pintbl[]) {
7090 { 0x1b, 0x21011020 }, /* line-out */
7091 { 0x1a, 0x01a1903c }, /* headset mic */
7092 { 0x18, 0x2181103f }, /* line-in */
7093 { },
7094 },
7095 .chained = true,
7096 .chain_id = ALC280_FIXUP_HP_GPIO4
7097 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007098 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7099 .type = HDA_FIXUP_PINS,
7100 .v.pins = (const struct hda_pintbl[]) {
7101 { 0x1b, 0x21011020 }, /* line-out */
7102 { 0x18, 0x2181103f }, /* line-in */
7103 { },
7104 },
7105 .chained = true,
7106 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7107 },
Keith Packard98973f22015-07-15 12:14:39 -07007108 [ALC280_FIXUP_HP_9480M] = {
7109 .type = HDA_FIXUP_FUNC,
7110 .v.func = alc280_fixup_hp_9480m,
7111 },
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007112 [ALC245_FIXUP_HP_X360_AMP] = {
7113 .type = HDA_FIXUP_FUNC,
7114 .v.func = alc245_fixup_hp_x360_amp,
7115 },
Kailang Yange1e62b92015-04-08 16:01:22 +08007116 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7117 .type = HDA_FIXUP_FUNC,
7118 .v.func = alc_fixup_headset_mode_dell_alc288,
7119 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007120 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08007121 },
7122 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7123 .type = HDA_FIXUP_PINS,
7124 .v.pins = (const struct hda_pintbl[]) {
7125 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7126 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7127 { }
7128 },
7129 .chained = true,
7130 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7131 },
Hui Wang831bfdf92015-06-26 12:35:17 +08007132 [ALC288_FIXUP_DISABLE_AAMIX] = {
7133 .type = HDA_FIXUP_FUNC,
7134 .v.func = alc_fixup_disable_aamix,
7135 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02007136 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08007137 },
7138 [ALC288_FIXUP_DELL_XPS_13] = {
7139 .type = HDA_FIXUP_FUNC,
7140 .v.func = alc_fixup_dell_xps13,
7141 .chained = true,
7142 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7143 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007144 [ALC292_FIXUP_DISABLE_AAMIX] = {
7145 .type = HDA_FIXUP_FUNC,
7146 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08007147 .chained = true,
7148 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007149 },
David Henningssonc04017e2015-12-15 14:44:03 +01007150 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7151 .type = HDA_FIXUP_FUNC,
7152 .v.func = alc_fixup_disable_aamix,
7153 .chained = true,
7154 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7155 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007156 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007157 .type = HDA_FIXUP_FUNC,
7158 .v.func = alc_fixup_dell_xps13,
7159 .chained = true,
7160 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7161 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007162 [ALC292_FIXUP_DELL_E7X] = {
7163 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007164 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01007165 /* micmute fixup must be applied at last */
7166 .chained_before = true,
7167 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7168 },
James McDonnell54324222019-09-16 14:53:38 +00007169 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7170 .type = HDA_FIXUP_PINS,
7171 .v.pins = (const struct hda_pintbl[]) {
7172 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7173 { }
7174 },
7175 .chained_before = true,
7176 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7177 },
Kailang Yang977e6272015-05-18 15:31:20 +08007178 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7179 .type = HDA_FIXUP_PINS,
7180 .v.pins = (const struct hda_pintbl[]) {
7181 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7182 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7183 { }
7184 },
7185 .chained = true,
7186 .chain_id = ALC269_FIXUP_HEADSET_MODE
7187 },
Hui Wang2f726ae2017-03-31 10:31:40 +08007188 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7189 .type = HDA_FIXUP_PINS,
7190 .v.pins = (const struct hda_pintbl[]) {
7191 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7192 { }
7193 },
7194 .chained = true,
7195 .chain_id = ALC269_FIXUP_HEADSET_MODE
7196 },
Kailang Yang6ed11312015-10-26 15:37:39 +08007197 [ALC275_FIXUP_DELL_XPS] = {
7198 .type = HDA_FIXUP_VERBS,
7199 .v.verbs = (const struct hda_verb[]) {
7200 /* Enables internal speaker */
7201 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7202 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7203 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7204 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7205 {}
7206 }
7207 },
Hui Wang23adc192015-12-08 12:27:18 +08007208 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7209 .type = HDA_FIXUP_FUNC,
7210 .v.func = alc_fixup_disable_aamix,
7211 .chained = true,
7212 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7213 },
Kailang3694cb22015-12-28 11:35:24 +08007214 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7215 .type = HDA_FIXUP_FUNC,
7216 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7217 },
Phil Calvind1ee66c2021-04-15 18:01:29 -04007218 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7219 .type = HDA_FIXUP_FUNC,
7220 .v.func = alc_fixup_inv_dmic,
7221 .chained = true,
7222 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7223 },
7224 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7225 .type = HDA_FIXUP_FUNC,
7226 .v.func = alc269_fixup_limit_int_mic_boost
7227 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007228 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7229 .type = HDA_FIXUP_FUNC,
7230 .v.func = alc_fixup_disable_aamix,
7231 .chained = true,
7232 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7233 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08007234 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7235 .type = HDA_FIXUP_FUNC,
7236 .v.func = alc_fixup_disable_mic_vref,
7237 .chained = true,
7238 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7239 },
David Henningsson2ae95572016-02-25 09:37:05 +01007240 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7241 .type = HDA_FIXUP_VERBS,
7242 .v.verbs = (const struct hda_verb[]) {
7243 /* Disable pass-through path for FRONT 14h */
7244 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7245 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7246 {}
7247 },
7248 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007249 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007250 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007251 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7252 .type = HDA_FIXUP_FUNC,
7253 .v.func = alc_fixup_disable_aamix,
7254 .chained = true,
7255 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7256 },
Hui Wange549d192016-04-01 11:00:15 +08007257 [ALC221_FIXUP_HP_FRONT_MIC] = {
7258 .type = HDA_FIXUP_PINS,
7259 .v.pins = (const struct hda_pintbl[]) {
7260 { 0x19, 0x02a19020 }, /* Front Mic */
7261 { }
7262 },
7263 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007264 [ALC292_FIXUP_TPT460] = {
7265 .type = HDA_FIXUP_FUNC,
7266 .v.func = alc_fixup_tpt440_dock,
7267 .chained = true,
7268 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7269 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007270 [ALC298_FIXUP_SPK_VOLUME] = {
7271 .type = HDA_FIXUP_FUNC,
7272 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007273 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007274 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007275 },
Kailang Yangf86de9b2020-10-23 14:46:47 +08007276 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7277 .type = HDA_FIXUP_FUNC,
7278 .v.func = alc298_fixup_speaker_volume,
7279 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007280 [ALC295_FIXUP_DISABLE_DAC3] = {
7281 .type = HDA_FIXUP_FUNC,
7282 .v.func = alc295_fixup_disable_dac3,
7283 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007284 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7285 .type = HDA_FIXUP_FUNC,
7286 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007287 .chained = true,
7288 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007289 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007290 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7291 .type = HDA_FIXUP_PINS,
7292 .v.pins = (const struct hda_pintbl[]) {
7293 { 0x1b, 0x90170151 },
7294 { }
7295 },
7296 .chained = true,
7297 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7298 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007299 [ALC269_FIXUP_ATIV_BOOK_8] = {
7300 .type = HDA_FIXUP_FUNC,
7301 .v.func = alc_fixup_auto_mute_via_amp,
7302 .chained = true,
7303 .chain_id = ALC269_FIXUP_NO_SHUTUP
7304 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007305 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7306 .type = HDA_FIXUP_PINS,
7307 .v.pins = (const struct hda_pintbl[]) {
7308 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7309 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7310 { }
7311 },
7312 .chained = true,
7313 .chain_id = ALC269_FIXUP_HEADSET_MODE
7314 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007315 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7316 .type = HDA_FIXUP_FUNC,
7317 .v.func = alc_fixup_headset_mode,
7318 },
7319 [ALC256_FIXUP_ASUS_MIC] = {
7320 .type = HDA_FIXUP_PINS,
7321 .v.pins = (const struct hda_pintbl[]) {
7322 { 0x13, 0x90a60160 }, /* use as internal mic */
7323 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7324 { }
7325 },
7326 .chained = true,
7327 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7328 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007329 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007330 .type = HDA_FIXUP_FUNC,
7331 /* Set up GPIO2 for the speaker amp */
7332 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007333 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007334 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7335 .type = HDA_FIXUP_PINS,
7336 .v.pins = (const struct hda_pintbl[]) {
7337 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7338 { }
7339 },
7340 .chained = true,
7341 .chain_id = ALC269_FIXUP_HEADSET_MIC
7342 },
7343 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7344 .type = HDA_FIXUP_VERBS,
7345 .v.verbs = (const struct hda_verb[]) {
7346 /* Enables internal speaker */
7347 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7348 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7349 {}
7350 },
7351 .chained = true,
7352 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7353 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007354 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7355 .type = HDA_FIXUP_FUNC,
7356 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007357 .chained = true,
7358 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007359 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007360 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7361 .type = HDA_FIXUP_VERBS,
7362 .v.verbs = (const struct hda_verb[]) {
7363 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7364 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7365 { }
7366 },
7367 .chained = true,
7368 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7369 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007370 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7371 .type = HDA_FIXUP_PINS,
7372 .v.pins = (const struct hda_pintbl[]) {
7373 /* Change the mic location from front to right, otherwise there are
7374 two front mics with the same name, pulseaudio can't handle them.
7375 This is just a temporary workaround, after applying this fixup,
7376 there will be one "Front Mic" and one "Mic" in this machine.
7377 */
7378 { 0x1a, 0x04a19040 },
7379 { }
7380 },
7381 },
Kailang Yang5f364132017-07-25 16:28:16 +08007382 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7383 .type = HDA_FIXUP_PINS,
7384 .v.pins = (const struct hda_pintbl[]) {
7385 { 0x16, 0x0101102f }, /* Rear Headset HP */
7386 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7387 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7388 { 0x1b, 0x02011020 },
7389 { }
7390 },
7391 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007392 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7393 },
7394 [ALC225_FIXUP_S3_POP_NOISE] = {
7395 .type = HDA_FIXUP_FUNC,
7396 .v.func = alc225_fixup_s3_pop_noise,
7397 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007398 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7399 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007400 [ALC700_FIXUP_INTEL_REFERENCE] = {
7401 .type = HDA_FIXUP_VERBS,
7402 .v.verbs = (const struct hda_verb[]) {
7403 /* Enables internal speaker */
7404 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7405 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7406 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7407 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7408 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7409 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7410 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7411 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7412 {}
7413 }
7414 },
Kailang Yang92266652017-12-14 15:28:58 +08007415 [ALC274_FIXUP_DELL_BIND_DACS] = {
7416 .type = HDA_FIXUP_FUNC,
7417 .v.func = alc274_fixup_bind_dacs,
7418 .chained = true,
7419 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7420 },
7421 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7422 .type = HDA_FIXUP_PINS,
7423 .v.pins = (const struct hda_pintbl[]) {
7424 { 0x1b, 0x0401102f },
7425 { }
7426 },
7427 .chained = true,
7428 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7429 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007430 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007431 .type = HDA_FIXUP_FUNC,
7432 .v.func = alc_fixup_tpt470_dock,
7433 .chained = true,
7434 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7435 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007436 [ALC298_FIXUP_TPT470_DOCK] = {
7437 .type = HDA_FIXUP_FUNC,
7438 .v.func = alc_fixup_tpt470_dacs,
7439 .chained = true,
7440 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7441 },
Kailang Yangae104a22018-02-05 16:07:20 +08007442 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7443 .type = HDA_FIXUP_PINS,
7444 .v.pins = (const struct hda_pintbl[]) {
7445 { 0x14, 0x0201101f },
7446 { }
7447 },
7448 .chained = true,
7449 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7450 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007451 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7452 .type = HDA_FIXUP_PINS,
7453 .v.pins = (const struct hda_pintbl[]) {
7454 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7455 { }
7456 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007457 .chained = true,
7458 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007459 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007460 [ALC295_FIXUP_HP_X360] = {
7461 .type = HDA_FIXUP_FUNC,
7462 .v.func = alc295_fixup_hp_top_speakers,
7463 .chained = true,
7464 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007465 },
7466 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7467 .type = HDA_FIXUP_PINS,
7468 .v.pins = (const struct hda_pintbl[]) {
7469 { 0x19, 0x0181313f},
7470 { }
7471 },
7472 .chained = true,
7473 .chain_id = ALC269_FIXUP_HEADSET_MIC
7474 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007475 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7476 .type = HDA_FIXUP_FUNC,
7477 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007478 .chained = true,
7479 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007480 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007481 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7482 .type = HDA_FIXUP_FUNC,
7483 .v.func = alc_fixup_auto_mute_via_amp,
7484 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007485 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7486 .type = HDA_FIXUP_PINS,
7487 .v.pins = (const struct hda_pintbl[]) {
7488 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7489 { }
7490 },
7491 .chained = true,
7492 .chain_id = ALC269_FIXUP_HEADSET_MIC
7493 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007494 [ALC294_FIXUP_ASUS_MIC] = {
7495 .type = HDA_FIXUP_PINS,
7496 .v.pins = (const struct hda_pintbl[]) {
7497 { 0x13, 0x90a60160 }, /* use as internal mic */
7498 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7499 { }
7500 },
7501 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007502 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007503 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007504 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7505 .type = HDA_FIXUP_PINS,
7506 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007507 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007508 { }
7509 },
7510 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007511 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007512 },
7513 [ALC294_FIXUP_ASUS_SPK] = {
7514 .type = HDA_FIXUP_VERBS,
7515 .v.verbs = (const struct hda_verb[]) {
7516 /* Set EAPD high */
7517 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7518 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08007519 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7520 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007521 { }
7522 },
7523 .chained = true,
7524 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7525 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007526 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08007527 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007528 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08007529 .chained = true,
7530 .chain_id = ALC225_FIXUP_HEADSET_JACK
7531 },
7532 [ALC225_FIXUP_HEADSET_JACK] = {
7533 .type = HDA_FIXUP_FUNC,
7534 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08007535 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07007536 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7537 .type = HDA_FIXUP_PINS,
7538 .v.pins = (const struct hda_pintbl[]) {
7539 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7540 { }
7541 },
7542 .chained = true,
7543 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7544 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08007545 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7546 .type = HDA_FIXUP_VERBS,
7547 .v.verbs = (const struct hda_verb[]) {
7548 /* Disable PCBEEP-IN passthrough */
7549 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7550 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7551 { }
7552 },
7553 .chained = true,
7554 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7555 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007556 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7557 .type = HDA_FIXUP_PINS,
7558 .v.pins = (const struct hda_pintbl[]) {
7559 { 0x19, 0x03a11130 },
7560 { 0x1a, 0x90a60140 }, /* use as internal mic */
7561 { }
7562 },
7563 .chained = true,
7564 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7565 },
Kailang Yang136824e2019-03-14 16:22:45 +08007566 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7567 .type = HDA_FIXUP_PINS,
7568 .v.pins = (const struct hda_pintbl[]) {
7569 { 0x16, 0x01011020 }, /* Rear Line out */
7570 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7571 { }
7572 },
7573 .chained = true,
7574 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7575 },
7576 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7577 .type = HDA_FIXUP_FUNC,
7578 .v.func = alc_fixup_auto_mute_via_amp,
7579 .chained = true,
7580 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7581 },
7582 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7583 .type = HDA_FIXUP_FUNC,
7584 .v.func = alc_fixup_disable_mic_vref,
7585 .chained = true,
7586 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7587 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007588 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7589 .type = HDA_FIXUP_VERBS,
7590 .v.verbs = (const struct hda_verb[]) {
7591 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7592 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7593 { }
7594 },
7595 .chained = true,
7596 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7597 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08007598 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7599 .type = HDA_FIXUP_PINS,
7600 .v.pins = (const struct hda_pintbl[]) {
7601 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7602 { }
7603 },
7604 .chained = true,
7605 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7606 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08007607 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7608 .type = HDA_FIXUP_PINS,
7609 .v.pins = (const struct hda_pintbl[]) {
7610 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7611 { }
7612 },
7613 .chained = true,
7614 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7615 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007616 [ALC299_FIXUP_PREDATOR_SPK] = {
7617 .type = HDA_FIXUP_PINS,
7618 .v.pins = (const struct hda_pintbl[]) {
7619 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7620 { }
7621 }
7622 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02007623 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7624 .type = HDA_FIXUP_PINS,
7625 .v.pins = (const struct hda_pintbl[]) {
7626 { 0x19, 0x04a11040 },
7627 { 0x21, 0x04211020 },
7628 { }
7629 },
7630 .chained = true,
7631 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7632 },
Kailang Yange79c2262019-12-19 14:12:15 +08007633 [ALC289_FIXUP_DELL_SPK2] = {
7634 .type = HDA_FIXUP_PINS,
7635 .v.pins = (const struct hda_pintbl[]) {
7636 { 0x17, 0x90170130 }, /* bass spk */
7637 { }
7638 },
7639 .chained = true,
7640 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7641 },
7642 [ALC289_FIXUP_DUAL_SPK] = {
7643 .type = HDA_FIXUP_FUNC,
7644 .v.func = alc285_fixup_speaker2_to_dac1,
7645 .chained = true,
7646 .chain_id = ALC289_FIXUP_DELL_SPK2
7647 },
Chris Chiu48e01502019-12-30 11:11:18 +08007648 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7649 .type = HDA_FIXUP_FUNC,
7650 .v.func = alc285_fixup_speaker2_to_dac1,
7651 .chained = true,
7652 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7653 },
7654 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007655 .type = HDA_FIXUP_FUNC,
7656 /* The GPIO must be pulled to initialize the AMP */
7657 .v.func = alc_fixup_gpio4,
7658 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08007659 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007660 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007661 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7662 .type = HDA_FIXUP_FUNC,
7663 .v.func = alc285_fixup_thinkpad_x1_gen7,
7664 .chained = true,
7665 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7666 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08007667 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7668 .type = HDA_FIXUP_FUNC,
7669 .v.func = alc_fixup_headset_jack,
7670 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007671 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08007672 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007673 [ALC294_FIXUP_ASUS_HPE] = {
7674 .type = HDA_FIXUP_VERBS,
7675 .v.verbs = (const struct hda_verb[]) {
7676 /* Set EAPD high */
7677 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7678 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7679 { }
7680 },
7681 .chained = true,
7682 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7683 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007684 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7685 .type = HDA_FIXUP_PINS,
7686 .v.pins = (const struct hda_pintbl[]) {
7687 { 0x19, 0x03a11050 }, /* front HP mic */
7688 { 0x1a, 0x01a11830 }, /* rear external mic */
7689 { 0x21, 0x03211020 }, /* front HP out */
7690 { }
7691 },
7692 .chained = true,
7693 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7694 },
7695 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7696 .type = HDA_FIXUP_VERBS,
7697 .v.verbs = (const struct hda_verb[]) {
7698 /* set 0x15 to HP-OUT ctrl */
7699 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7700 /* unmute the 0x15 amp */
7701 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7702 { }
7703 },
7704 .chained = true,
7705 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7706 },
7707 [ALC294_FIXUP_ASUS_GX502_HP] = {
7708 .type = HDA_FIXUP_FUNC,
7709 .v.func = alc294_fixup_gx502_hp,
7710 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02007711 [ALC294_FIXUP_ASUS_COEF_1B] = {
7712 .type = HDA_FIXUP_VERBS,
7713 .v.verbs = (const struct hda_verb[]) {
7714 /* Set bit 10 to correct noisy output after reboot from
7715 * Windows 10 (due to pop noise reduction?)
7716 */
7717 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7718 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7719 { }
7720 },
7721 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08007722 [ALC285_FIXUP_HP_GPIO_LED] = {
7723 .type = HDA_FIXUP_FUNC,
7724 .v.func = alc285_fixup_hp_gpio_led,
7725 },
Kailang Yang431e76c2020-04-07 14:40:20 +08007726 [ALC285_FIXUP_HP_MUTE_LED] = {
7727 .type = HDA_FIXUP_FUNC,
7728 .v.func = alc285_fixup_hp_mute_led,
7729 },
Jeremy Szue7d66cf2021-03-16 15:46:24 +08007730 [ALC236_FIXUP_HP_GPIO_LED] = {
7731 .type = HDA_FIXUP_FUNC,
7732 .v.func = alc236_fixup_hp_gpio_led,
7733 },
Kailang Yang24164f42020-04-07 14:52:42 +08007734 [ALC236_FIXUP_HP_MUTE_LED] = {
7735 .type = HDA_FIXUP_FUNC,
7736 .v.func = alc236_fixup_hp_mute_led,
7737 },
Jonas Witschel75b62ab2021-04-16 12:58:54 +02007738 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
7739 .type = HDA_FIXUP_FUNC,
7740 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
7741 },
Mike Pozulp14425f12020-05-09 20:28:37 -07007742 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7743 .type = HDA_FIXUP_VERBS,
7744 .v.verbs = (const struct hda_verb[]) {
7745 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7746 { }
7747 },
7748 },
Chris Chiu9e433422020-05-12 14:15:24 +08007749 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7750 .type = HDA_FIXUP_PINS,
7751 .v.pins = (const struct hda_pintbl[]) {
7752 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7753 { }
7754 },
7755 .chained = true,
7756 .chain_id = ALC269_FIXUP_HEADSET_MODE
7757 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007758 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7759 .type = HDA_FIXUP_PINS,
7760 .v.pins = (const struct hda_pintbl[]) {
7761 { 0x14, 0x90100120 }, /* use as internal speaker */
7762 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7763 { 0x1a, 0x01011020 }, /* use as line out */
7764 { },
7765 },
7766 .chained = true,
7767 .chain_id = ALC269_FIXUP_HEADSET_MIC
7768 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007769 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7770 .type = HDA_FIXUP_PINS,
7771 .v.pins = (const struct hda_pintbl[]) {
7772 { 0x18, 0x02a11030 }, /* use as headset mic */
7773 { }
7774 },
7775 .chained = true,
7776 .chain_id = ALC269_FIXUP_HEADSET_MIC
7777 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007778 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7779 .type = HDA_FIXUP_PINS,
7780 .v.pins = (const struct hda_pintbl[]) {
7781 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7782 { }
7783 },
7784 .chained = true,
7785 .chain_id = ALC269_FIXUP_HEADSET_MIC
7786 },
Armas Spann293a92c2020-07-24 16:08:37 +02007787 [ALC289_FIXUP_ASUS_GA401] = {
Takashi Iwaic84bfed2020-11-27 15:11:04 +01007788 .type = HDA_FIXUP_FUNC,
7789 .v.func = alc289_fixup_asus_ga401,
7790 .chained = true,
7791 .chain_id = ALC289_FIXUP_ASUS_GA502,
Armas Spannff536642020-07-11 13:05:57 +02007792 },
Armas Spann4b43d052020-07-24 16:06:16 +02007793 [ALC289_FIXUP_ASUS_GA502] = {
7794 .type = HDA_FIXUP_PINS,
7795 .v.pins = (const struct hda_pintbl[]) {
7796 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7797 { }
7798 },
7799 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007800 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7801 .type = HDA_FIXUP_PINS,
7802 .v.pins = (const struct hda_pintbl[]) {
7803 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7804 { }
7805 },
7806 .chained = true,
7807 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7808 },
Kailang Yang56496252020-07-29 15:09:27 +08007809 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7810 .type = HDA_FIXUP_FUNC,
7811 .v.func = alc285_fixup_hp_gpio_amp_init,
7812 .chained = true,
7813 .chain_id = ALC285_FIXUP_HP_GPIO_LED
7814 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08007815 [ALC269_FIXUP_CZC_B20] = {
7816 .type = HDA_FIXUP_PINS,
7817 .v.pins = (const struct hda_pintbl[]) {
7818 { 0x12, 0x411111f0 },
7819 { 0x14, 0x90170110 }, /* speaker */
7820 { 0x15, 0x032f1020 }, /* HP out */
7821 { 0x17, 0x411111f0 },
7822 { 0x18, 0x03ab1040 }, /* mic */
7823 { 0x19, 0xb7a7013f },
7824 { 0x1a, 0x0181305f },
7825 { 0x1b, 0x411111f0 },
7826 { 0x1d, 0x411111f0 },
7827 { 0x1e, 0x411111f0 },
7828 { }
7829 },
7830 .chain_id = ALC269_FIXUP_DMIC,
7831 },
7832 [ALC269_FIXUP_CZC_TMI] = {
7833 .type = HDA_FIXUP_PINS,
7834 .v.pins = (const struct hda_pintbl[]) {
7835 { 0x12, 0x4000c000 },
7836 { 0x14, 0x90170110 }, /* speaker */
7837 { 0x15, 0x0421401f }, /* HP out */
7838 { 0x17, 0x411111f0 },
7839 { 0x18, 0x04a19020 }, /* mic */
7840 { 0x19, 0x411111f0 },
7841 { 0x1a, 0x411111f0 },
7842 { 0x1b, 0x411111f0 },
7843 { 0x1d, 0x40448505 },
7844 { 0x1e, 0x411111f0 },
7845 { 0x20, 0x8000ffff },
7846 { }
7847 },
7848 .chain_id = ALC269_FIXUP_DMIC,
7849 },
7850 [ALC269_FIXUP_CZC_L101] = {
7851 .type = HDA_FIXUP_PINS,
7852 .v.pins = (const struct hda_pintbl[]) {
7853 { 0x12, 0x40000000 },
7854 { 0x14, 0x01014010 }, /* speaker */
7855 { 0x15, 0x411111f0 }, /* HP out */
7856 { 0x16, 0x411111f0 },
7857 { 0x18, 0x01a19020 }, /* mic */
7858 { 0x19, 0x02a19021 },
7859 { 0x1a, 0x0181302f },
7860 { 0x1b, 0x0221401f },
7861 { 0x1c, 0x411111f0 },
7862 { 0x1d, 0x4044c601 },
7863 { 0x1e, 0x411111f0 },
7864 { }
7865 },
7866 .chain_id = ALC269_FIXUP_DMIC,
7867 },
7868 [ALC269_FIXUP_LEMOTE_A1802] = {
7869 .type = HDA_FIXUP_PINS,
7870 .v.pins = (const struct hda_pintbl[]) {
7871 { 0x12, 0x40000000 },
7872 { 0x14, 0x90170110 }, /* speaker */
7873 { 0x17, 0x411111f0 },
7874 { 0x18, 0x03a19040 }, /* mic1 */
7875 { 0x19, 0x90a70130 }, /* mic2 */
7876 { 0x1a, 0x411111f0 },
7877 { 0x1b, 0x411111f0 },
7878 { 0x1d, 0x40489d2d },
7879 { 0x1e, 0x411111f0 },
7880 { 0x20, 0x0003ffff },
7881 { 0x21, 0x03214020 },
7882 { }
7883 },
7884 .chain_id = ALC269_FIXUP_DMIC,
7885 },
7886 [ALC269_FIXUP_LEMOTE_A190X] = {
7887 .type = HDA_FIXUP_PINS,
7888 .v.pins = (const struct hda_pintbl[]) {
7889 { 0x14, 0x99130110 }, /* speaker */
7890 { 0x15, 0x0121401f }, /* HP out */
7891 { 0x18, 0x01a19c20 }, /* rear mic */
7892 { 0x19, 0x99a3092f }, /* front mic */
7893 { 0x1b, 0x0201401f }, /* front lineout */
7894 { }
7895 },
7896 .chain_id = ALC269_FIXUP_DMIC,
7897 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08007898 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
7899 .type = HDA_FIXUP_PINS,
7900 .v.pins = (const struct hda_pintbl[]) {
7901 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7902 { }
7903 },
7904 .chained = true,
7905 .chain_id = ALC269_FIXUP_HEADSET_MODE
7906 },
Werner Sembach73e71612021-03-02 19:04:14 +01007907 [ALC256_FIXUP_INTEL_NUC10] = {
7908 .type = HDA_FIXUP_PINS,
7909 .v.pins = (const struct hda_pintbl[]) {
7910 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7911 { }
7912 },
7913 .chained = true,
7914 .chain_id = ALC269_FIXUP_HEADSET_MODE
7915 },
Hui Wangfc19d552020-09-09 10:00:41 +08007916 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
7917 .type = HDA_FIXUP_VERBS,
7918 .v.verbs = (const struct hda_verb[]) {
7919 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7920 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7921 { }
7922 },
7923 .chained = true,
Takashi Iwaic84bfed2020-11-27 15:11:04 +01007924 .chain_id = ALC289_FIXUP_ASUS_GA502
Hui Wangfc19d552020-09-09 10:00:41 +08007925 },
Hui Wang13468bf2020-09-28 16:01:17 +08007926 [ALC274_FIXUP_HP_MIC] = {
7927 .type = HDA_FIXUP_VERBS,
7928 .v.verbs = (const struct hda_verb[]) {
7929 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7930 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7931 { }
7932 },
7933 },
Kailang Yang8a8de09c2020-10-27 16:46:38 +08007934 [ALC274_FIXUP_HP_HEADSET_MIC] = {
7935 .type = HDA_FIXUP_FUNC,
7936 .v.func = alc274_fixup_hp_headset_mic,
7937 .chained = true,
7938 .chain_id = ALC274_FIXUP_HP_MIC
7939 },
Takashi Iwai622464c2021-05-04 11:18:02 +02007940 [ALC274_FIXUP_HP_ENVY_GPIO] = {
7941 .type = HDA_FIXUP_FUNC,
7942 .v.func = alc274_fixup_hp_envy_gpio,
7943 },
Kailang Yangef9ce662020-11-03 15:40:35 +08007944 [ALC256_FIXUP_ASUS_HPE] = {
7945 .type = HDA_FIXUP_VERBS,
7946 .v.verbs = (const struct hda_verb[]) {
7947 /* Set EAPD high */
7948 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7949 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
7950 { }
7951 },
7952 .chained = true,
7953 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7954 },
Kailang Yang446b8182020-11-02 15:00:12 +08007955 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
7956 .type = HDA_FIXUP_FUNC,
7957 .v.func = alc_fixup_headset_jack,
7958 .chained = true,
7959 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7960 },
Kailang Yanga0ccbc52020-11-06 15:20:38 +08007961 [ALC287_FIXUP_HP_GPIO_LED] = {
7962 .type = HDA_FIXUP_FUNC,
7963 .v.func = alc287_fixup_hp_gpio_led,
7964 },
Kailang Yang9e885772020-11-03 15:30:51 +08007965 [ALC256_FIXUP_HP_HEADSET_MIC] = {
7966 .type = HDA_FIXUP_FUNC,
7967 .v.func = alc274_fixup_hp_headset_mic,
7968 },
Kailang Yang92666d42020-11-19 17:04:21 +08007969 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
7970 .type = HDA_FIXUP_FUNC,
7971 .v.func = alc_fixup_no_int_mic,
7972 .chained = true,
7973 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7974 },
Chris Chiu34cdf402020-12-16 20:52:00 +08007975 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
7976 .type = HDA_FIXUP_PINS,
7977 .v.pins = (const struct hda_pintbl[]) {
7978 { 0x1b, 0x411111f0 },
7979 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7980 { },
7981 },
7982 .chained = true,
7983 .chain_id = ALC269_FIXUP_HEADSET_MODE
7984 },
Chris Chiu495dc762021-01-14 16:27:28 +08007985 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
7986 .type = HDA_FIXUP_FUNC,
7987 .v.func = alc269_fixup_limit_int_mic_boost,
7988 .chained = true,
7989 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7990 },
Chris Chiud0e18562021-02-26 09:04:40 +08007991 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
7992 .type = HDA_FIXUP_PINS,
7993 .v.pins = (const struct hda_pintbl[]) {
7994 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
7995 { 0x1a, 0x90a1092f }, /* use as internal mic */
7996 { }
7997 },
7998 .chained = true,
7999 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8000 },
Takashi Iwai26928ca2021-04-16 10:12:11 +02008001 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8002 .type = HDA_FIXUP_FUNC,
8003 .v.func = alc285_fixup_ideapad_s740_coef,
8004 .chained = true,
8005 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8006 },
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008007 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8008 .type = HDA_FIXUP_FUNC,
8009 .v.func = alc269_fixup_limit_int_mic_boost,
8010 .chained = true,
8011 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8012 },
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008013 [ALC295_FIXUP_ASUS_DACS] = {
8014 .type = HDA_FIXUP_FUNC,
8015 .v.func = alc295_fixup_asus_dacs,
8016 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02008017};
8018
8019static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01008020 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02008021 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8022 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008023 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02008024 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008025 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8026 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05008027 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01008028 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02008029 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Takashi Iwai433f8942021-04-28 13:26:56 +02008030 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
Takashi Iwaic8426b22021-04-07 11:57:30 +02008031 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
Chris Chiu13be30f2020-12-22 23:04:59 +08008032 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
Chris Chiu705b65f2018-12-05 14:48:54 +08008033 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008034 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01008035 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiu495dc762021-01-14 16:27:28 +08008036 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
Chris Chiuc7531e32019-03-21 17:17:31 +08008037 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8038 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiu13be30f2020-12-22 23:04:59 +08008039 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8040 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008041 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008042 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008043 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiud0e18562021-02-26 09:04:40 +08008044 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08008045 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8046 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8047 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Chris Chiud0e18562021-02-26 09:04:40 +08008048 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08008049 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08008050 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08008051 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008052 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
David Henningssonaaedfb42013-08-16 14:09:02 +02008053 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08008054 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01008055 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01008056 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02008057 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8058 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008059 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02008060 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8061 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8062 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01008063 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8064 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01008065 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02008066 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008067 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08008068 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8069 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08008070 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02008071 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02008072 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08008073 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08008074 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8075 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01008076 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8077 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8078 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8079 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8080 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08008081 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08008082 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01008083 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08008084 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08008085 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwai493de342017-02-28 17:27:57 +01008086 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008087 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Kailang Yang5f364132017-07-25 16:28:16 +08008088 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08008089 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8090 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08008091 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8092 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08008093 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08008094 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08008095 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08008096 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08008097 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008098 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08008099 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8100 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yang92666d42020-11-19 17:04:21 +08008101 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8102 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
Kailang Yangc1e89522020-12-23 15:34:57 +08008103 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yanga22aa262014-04-23 17:34:28 +08008104 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8105 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01008106 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008107 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01008108 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
Hui Wang7976eb42015-02-13 11:14:41 +08008109 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008110 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008111 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008112 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8113 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8114 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8115 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008116 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8117 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8118 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8119 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008120 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008121 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8122 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8123 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8124 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8125 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008126 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008127 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008128 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08008129 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008130 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8131 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8132 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008133 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8134 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8135 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8136 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8137 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008138 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008139 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008140 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008141 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008142 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08008143 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008144 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008145 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008146 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008147 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8148 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8149 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8150 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8151 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008152 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008153 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8154 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008155 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8156 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8157 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8158 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang8a02b162014-06-13 17:16:31 +08008159 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8160 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8161 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8162 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008163 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8164 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Kailang Yang1c9d9df2021-04-20 14:17:34 +08008165 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8166 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
Takashi Iwai563785e2018-11-12 09:43:12 +01008167 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08008168 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01008169 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Takashi Iwaiaeedad22020-11-28 10:00:15 +01008170 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008171 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8172 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05008173 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02008174 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Sam Bazleyd33cd422019-09-01 03:31:30 +01008175 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008176 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Takashi Iwai622464c2021-05-04 11:18:02 +02008177 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
Kai-Heng Fenga5980982020-12-30 20:56:35 +08008178 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008179 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008180 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Kailang Yang56496252020-07-29 15:09:27 +08008181 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Qiu Wenbo08befca2020-10-02 20:44:54 +08008182 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08008183 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08008184 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Jeremy Szu91bc1562021-01-06 21:05:46 +08008185 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8186 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8187 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8188 ALC285_FIXUP_HP_GPIO_AMP_INIT),
Manuel Jiménez48422952020-12-29 15:38:56 +01008189 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008190 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szu417eadf2021-03-30 19:44:27 +08008191 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008192 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8193 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008194 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Jeremy Szu53b861b2021-03-16 17:42:35 +08008195 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuca688332021-03-16 14:54:50 +08008196 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008197 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008198 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02008199 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02008200 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01008201 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008202 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008203 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02008204 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008205 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008206 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiu5cfca592020-12-07 15:27:55 +08008207 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008208 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8209 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008210 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008211 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008212 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01008213 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01008214 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02008215 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008216 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
Chris Chiu48e01502019-12-30 11:11:18 +08008217 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008218 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Daniel Drake8c8967a2019-10-17 16:15:01 +08008219 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08008220 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08008221 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan5de3b942021-01-22 13:47:06 +08008222 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08008223 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08008224 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02008225 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06008226 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02008227 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02008228 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06008229 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008230 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008231 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Kailang Yangef9ce662020-11-03 15:40:35 +08008232 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
Armas Spann4b43d052020-07-24 16:06:16 +02008233 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Luke D Jones76fae612021-04-19 15:04:11 +12008234 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
Armas Spann293a92c2020-07-24 16:08:37 +02008235 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Chris Chiueeed4cd2017-02-28 14:17:15 -06008236 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02008237 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8238 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8239 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8240 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02008241 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008242 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8243 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8244 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02008245 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwaicab561f2021-04-28 13:26:59 +02008246 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8247 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai24519912011-08-16 15:08:49 +02008248 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02008249 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02008250 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01008251 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
Takashi Iwaic656f742021-04-28 13:27:01 +02008252 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
David Henningsson2041d562014-06-13 11:15:44 +02008253 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08008254 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
Takashi Iwaic656f742021-04-28 13:27:01 +02008255 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02008256 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
PeiSen Houce2e79b2020-12-31 11:57:28 +01008257 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8258 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09008259 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02008260 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07008261 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8262 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07008263 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09008264 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01008265 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09008266 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Takashi Iwaic656f742021-04-28 13:27:01 +02008267 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02008268 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8269 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01008270 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Chris Chiu6ca653e2020-12-22 23:04:58 +08008271 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008272 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller89e3a562019-01-30 16:12:31 -07008273 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008274 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8275 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8276 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8277 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8278 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8279 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8280 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8281 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8282 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8283 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8284 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8285 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8286 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8287 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8288 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8289 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8290 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8291 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8292 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8293 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8294 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8295 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8296 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8297 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8298 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8299 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8300 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller80a50522019-05-07 17:11:08 -04008301 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller891afcf2019-05-10 10:15:07 -04008302 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8303 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
8304 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
Eckhart Mohr48698c92021-03-02 17:25:22 +01008305 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008306 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8307 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8308 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8309 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8310 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8311 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8312 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8313 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8314 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8315 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008316 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Hui Wangef0b3202020-04-27 11:00:39 +08008317 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008318 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8319 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8320 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8321 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8322 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaif552ff52021-04-28 13:27:00 +02008323 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwaib590b382020-05-14 18:05:33 +02008324 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02008325 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02008326 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02008327 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02008328 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01008329 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02008330 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02008331 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05008332 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02008333 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01008334 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02008335 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01008336 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07008337 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02008338 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008339 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8340 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02008341 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02008342 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008343 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8344 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8345 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01008346 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008347 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8348 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8349 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01008350 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09008351 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02008352 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang Yang446b8182020-11-02 15:00:12 +08008353 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8354 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Kailang3694cb22015-12-28 11:35:24 +08008355 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08008356 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08008357 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02008358 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08008359 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08008360 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08008361 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08008362 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08008363 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8364 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Kailang Yangf86de9b2020-10-23 14:46:47 +08008365 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
Takashi Iwai26928ca2021-04-16 10:12:11 +02008366 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
David Henningsson56f27012016-01-11 09:33:14 +01008367 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01008368 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02008369 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaif552ff52021-04-28 13:27:00 +02008370 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
David Henningssona4a9e082013-08-16 14:09:01 +02008371 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02008372 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02008373 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008374 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02008375 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01008376 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02008377 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02008378 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08008379 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008380 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02008381 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008382 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008383 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8384 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8385 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008386 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008387 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8388 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008389 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008390 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008391 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8392 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8393 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02008394 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaic656f742021-04-28 13:27:01 +02008395 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8396 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Hui Wangfc19d552020-09-09 10:00:41 +08008397 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Xiaoliang Yub95bc122021-03-16 00:49:00 +08008398 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang695d1ec2019-11-21 10:54:27 +08008399 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Xiaoliang Yue1c86212021-03-13 07:54:53 +08008400 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Phil Calvind1ee66c2021-04-15 18:01:29 -04008401 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008402 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Werner Sembach73e71612021-03-02 19:04:14 +01008403 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008404
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01008405#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02008406 /* Below is a quirk table taken from the old code.
8407 * Basically the device should work as is without the fixup table.
8408 * If BIOS doesn't give a proper info, enable the corresponding
8409 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008410 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02008411 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8412 ALC269_FIXUP_AMIC),
8413 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008414 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8415 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8416 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8417 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8418 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8419 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8420 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8421 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8422 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8423 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8424 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8425 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8426 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8427 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8428 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8429 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8430 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8431 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8432 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8433 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8434 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8435 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8436 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8437 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8438 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8439 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8440 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8441 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8442 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8443 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8444 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8445 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8446 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8447 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8448 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8449 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8450 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8451 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8452#endif
8453 {}
8454};
8455
David Henningsson214eef72014-07-22 14:09:35 +02008456static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8457 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8458 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8459 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8460 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008461 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02008462 {}
8463};
8464
Takashi Iwai1727a772013-01-10 09:52:52 +01008465static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02008466 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8467 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008468 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8469 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8470 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02008471 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02008472 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8473 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02008474 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02008475 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008476 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008477 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02008478 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8479 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008480 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8481 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08008482 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08008483 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02008484 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01008485 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02008486 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02008487 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008488 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008489 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02008490 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008491 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8492 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8493 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8494 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8495 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8496 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8497 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8498 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8499 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8500 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8501 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8502 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8503 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8504 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8505 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8506 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8507 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8508 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8509 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8510 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8511 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8512 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8513 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8514 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8515 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8516 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8517 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8518 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8519 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8520 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8521 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8522 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8523 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8524 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8525 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8526 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8527 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8528 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8529 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8530 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01008531 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008532 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
Takashi Iwaic8426b22021-04-07 11:57:30 +02008533 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008534 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8535 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8536 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8537 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8538 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8539 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8540 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8541 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8542 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8543 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8544 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8545 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8546 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8547 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008548 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8549 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8550 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08008551 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008552 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01008553 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008554 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8555 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8556 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8557 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8558 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8559 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8560 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8561 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8562 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8563 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8564 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8565 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8566 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8567 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8568 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8569 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8570 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08008571 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8572 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008573 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02008574 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008575 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07008576 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08008577 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08008578 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008579 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02008580 {}
8581};
Kailang Yangcfc5a842016-02-03 15:20:39 +08008582#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08008583 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02008584
Hui Wange8191a82015-04-24 13:39:59 +08008585#define ALC256_STANDARD_PINS \
8586 {0x12, 0x90a60140}, \
8587 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08008588 {0x21, 0x02211020}
8589
David Henningssonfea185e2014-09-03 10:23:04 +02008590#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008591 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08008592
David Henningssonfea185e2014-09-03 10:23:04 +02008593#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008594 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02008595
8596#define ALC292_STANDARD_PINS \
8597 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08008598 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08008599
Hui Wang3f6409702016-09-11 11:26:16 +08008600#define ALC295_STANDARD_PINS \
8601 {0x12, 0xb7a60130}, \
8602 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08008603 {0x21, 0x04211020}
8604
Woodrow Shen703867e2015-08-05 12:34:12 +08008605#define ALC298_STANDARD_PINS \
8606 {0x12, 0x90a60130}, \
8607 {0x21, 0x03211020}
8608
Hui Wange1918932014-05-26 16:22:44 +08008609static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08008610 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
8611 {0x14, 0x01014020},
8612 {0x17, 0x90170110},
8613 {0x18, 0x02a11030},
8614 {0x19, 0x0181303F},
8615 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06008616 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8617 {0x12, 0x90a601c0},
8618 {0x14, 0x90171120},
8619 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06008620 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8621 {0x14, 0x90170110},
8622 {0x1b, 0x90a70130},
8623 {0x21, 0x03211020}),
8624 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8625 {0x1a, 0x90a70130},
8626 {0x1b, 0x90170110},
8627 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01008628 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008629 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008630 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008631 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01008632 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008633 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008634 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008635 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08008636 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8637 ALC225_STANDARD_PINS,
8638 {0x12, 0xb7a60150},
8639 {0x14, 0x901701a0}),
8640 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8641 ALC225_STANDARD_PINS,
8642 {0x12, 0xb7a60150},
8643 {0x14, 0x901701b0}),
8644 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8645 ALC225_STANDARD_PINS,
8646 {0x12, 0xb7a60130},
8647 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05008648 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8649 {0x1b, 0x01111010},
8650 {0x1e, 0x01451130},
8651 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08008652 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
8653 {0x12, 0x90a60140},
8654 {0x14, 0x90170110},
8655 {0x19, 0x02a11030},
8656 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08008657 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8658 {0x14, 0x90170110},
8659 {0x19, 0x02a11030},
8660 {0x1a, 0x02a11040},
8661 {0x1b, 0x01014020},
8662 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08008663 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8664 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08008665 {0x19, 0x02a11030},
8666 {0x1a, 0x02a11040},
8667 {0x1b, 0x01011020},
8668 {0x21, 0x0221101f}),
8669 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8670 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08008671 {0x19, 0x02a11020},
8672 {0x1a, 0x02a11030},
8673 {0x21, 0x0221101f}),
Kailang Yang92666d42020-11-19 17:04:21 +08008674 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
8675 {0x21, 0x02211010}),
Kailang Yang9e885772020-11-03 15:30:51 +08008676 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8677 {0x14, 0x90170110},
8678 {0x19, 0x02a11020},
8679 {0x21, 0x02211030}),
Hui Wangc77900e2014-09-03 11:31:07 +08008680 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08008681 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08008682 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02008683 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08008684 {0x14, 0x90170130},
8685 {0x21, 0x02211040}),
8686 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008687 {0x12, 0x90a60140},
8688 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02008689 {0x21, 0x02211020}),
8690 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8691 {0x12, 0x90a60160},
8692 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008693 {0x21, 0x02211030}),
8694 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08008695 {0x14, 0x90170110},
8696 {0x1b, 0x02011020},
8697 {0x21, 0x0221101f}),
8698 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08008699 {0x14, 0x90170110},
8700 {0x1b, 0x01011020},
8701 {0x21, 0x0221101f}),
8702 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02008703 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02008704 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02008705 {0x21, 0x0221103f}),
8706 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08008707 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08008708 {0x1b, 0x01011020},
8709 {0x21, 0x0221103f}),
8710 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8711 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08008712 {0x1b, 0x02011020},
8713 {0x21, 0x0221103f}),
8714 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008715 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008716 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008717 {0x21, 0x0221105f}),
8718 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008719 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008720 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008721 {0x21, 0x0221101f}),
8722 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008723 {0x12, 0x90a60160},
8724 {0x14, 0x90170120},
8725 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008726 {0x21, 0x0321102f}),
8727 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8728 {0x12, 0x90a60160},
8729 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008730 {0x21, 0x02211040}),
8731 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8732 {0x12, 0x90a60160},
8733 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008734 {0x21, 0x02211050}),
8735 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8736 {0x12, 0x90a60170},
8737 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008738 {0x21, 0x02211030}),
8739 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8740 {0x12, 0x90a60170},
8741 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008742 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08008743 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08008744 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08008745 {0x14, 0x90171130},
8746 {0x21, 0x02211040}),
8747 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8748 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08008749 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08008750 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02008751 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02008752 {0x12, 0x90a60180},
8753 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02008754 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08008755 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8756 {0x12, 0x90a60180},
8757 {0x14, 0x90170120},
8758 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08008759 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8760 {0x1b, 0x01011020},
8761 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008762 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8763 {0x14, 0x90170110},
8764 {0x1b, 0x90a70130},
8765 {0x21, 0x04211020}),
8766 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8767 {0x14, 0x90170110},
8768 {0x1b, 0x90a70130},
8769 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08008770 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08008771 {0x12, 0x90a60130},
8772 {0x14, 0x90170110},
8773 {0x21, 0x03211020}),
8774 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08008775 {0x12, 0x90a60130},
8776 {0x14, 0x90170110},
8777 {0x21, 0x04211020}),
8778 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08008779 {0x1a, 0x90a70130},
8780 {0x1b, 0x90170110},
8781 {0x21, 0x03211020}),
Kailang Yang9e885772020-11-03 15:30:51 +08008782 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8783 {0x14, 0x90170110},
8784 {0x19, 0x02a11020},
8785 {0x21, 0x0221101f}),
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008786 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
8787 {0x17, 0x90170110},
8788 {0x19, 0x03a11030},
8789 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01008790 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
8791 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01008792 {0x14, 0x90170110},
8793 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008794 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08008795 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
8796 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08008797 {0x14, 0x90170110},
8798 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08008799 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08008800 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08008801 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02008802 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008803 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02008804 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02008805 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02008806 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08008807 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008808 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008809 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008810 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008811 {0x21, 0x03211040}),
8812 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008813 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008814 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008815 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08008816 {0x21, 0x03211020}),
8817 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008818 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008819 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008820 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008821 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08008822 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02008823 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08008824 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08008825 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08008826 {0x21, 0x04211020}),
Chris Chiu34cdf402020-12-16 20:52:00 +08008827 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
8828 ALC282_STANDARD_PINS,
8829 {0x12, 0x90a609c0},
8830 {0x18, 0x03a11830},
8831 {0x19, 0x04a19831},
8832 {0x1a, 0x0481303f},
8833 {0x1b, 0x04211020},
8834 {0x21, 0x0321101f}),
8835 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
8836 ALC282_STANDARD_PINS,
8837 {0x12, 0x90a60940},
8838 {0x18, 0x03a11830},
8839 {0x19, 0x04a19831},
8840 {0x1a, 0x0481303f},
8841 {0x1b, 0x04211020},
8842 {0x21, 0x0321101f}),
David Henningsson76c21322014-06-24 14:46:54 +02008843 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008844 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02008845 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02008846 {0x21, 0x0321101f}),
8847 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8848 {0x12, 0x90a60160},
8849 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008850 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08008851 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008852 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08008853 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08008854 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08008855 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08008856 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Sami Loone266fd992021-05-01 12:07:53 +02008857 {0x12, 0x90a60130},
8858 {0x14, 0x90170110},
8859 {0x19, 0x04a11040},
8860 {0x21, 0x04211020}),
8861 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
8862 {0x14, 0x90170110},
8863 {0x19, 0x04a11040},
8864 {0x1d, 0x40600001},
8865 {0x21, 0x04211020}),
8866 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Hui Wangc4cfcf62018-11-26 14:17:16 +08008867 {0x14, 0x90170110},
8868 {0x19, 0x04a11040},
8869 {0x21, 0x04211020}),
Hui Wangc72b9bf2020-12-05 13:11:30 +08008870 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8871 {0x14, 0x90170110},
8872 {0x17, 0x90170111},
8873 {0x19, 0x03a11030},
8874 {0x21, 0x03211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08008875 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
8876 {0x12, 0x90a60130},
8877 {0x17, 0x90170110},
8878 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02008879 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08008880 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08008881 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08008882 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08008883 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008884 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008885 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08008886 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08008887 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008888 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008889 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008890 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08008891 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008892 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008893 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008894 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008895 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008896 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008897 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008898 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008899 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008900 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08008901 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008902 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008903 {0x14, 0x90170110},
8904 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008905 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08008906 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008907 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008908 {0x14, 0x90170110},
8909 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008910 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008911 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008912 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008913 {0x14, 0x90170110},
8914 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008915 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08008916 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008917 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08008918 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08008919 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08008920 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08008921 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008922 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08008923 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08008924 {0x16, 0x01014020},
8925 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08008926 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02008927 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008928 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08008929 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02008930 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008931 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02008932 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02008933 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08008934 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02008935 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008936 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08008937 {0x13, 0x90a60140}),
Jian-Hong Paneeacd802020-11-24 17:20:25 +08008938 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
8939 {0x17, 0x90170110},
8940 {0x21, 0x04211020}),
Chris Chiud8ae4582018-12-07 17:17:11 +08008941 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
8942 {0x14, 0x90170110},
8943 {0x1b, 0x90a70130},
8944 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08008945 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8946 {0x12, 0x90a60130},
8947 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08008948 {0x21, 0x03211020}),
8949 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8950 {0x12, 0x90a60130},
8951 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08008952 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02008953 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8954 {0x12, 0x90a60130},
8955 {0x17, 0x90170110},
8956 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08008957 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08008958 {0x12, 0x90a60120},
8959 {0x17, 0x90170110},
8960 {0x21, 0x04211030}),
8961 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08008962 {0x12, 0x90a60130},
8963 {0x17, 0x90170110},
8964 {0x21, 0x03211020}),
8965 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8966 {0x12, 0x90a60130},
8967 {0x17, 0x90170110},
8968 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08008969 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08008970 {0x14, 0x90170110},
8971 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08008972 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8973 {0x14, 0x90170110},
8974 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08008975 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08008976 ALC295_STANDARD_PINS,
8977 {0x17, 0x21014020},
8978 {0x18, 0x21a19030}),
8979 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8980 ALC295_STANDARD_PINS,
8981 {0x17, 0x21014040},
8982 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08008983 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8984 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08008985 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08008986 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02008987 {0x17, 0x90170110}),
8988 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8989 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08008990 {0x17, 0x90170140}),
8991 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8992 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02008993 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08008994 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
8995 {0x12, 0xb7a60140},
8996 {0x13, 0xb7a60150},
8997 {0x17, 0x90170110},
8998 {0x1a, 0x03011020},
8999 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00009000 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9001 {0x12, 0xb7a60140},
9002 {0x17, 0x90170110},
9003 {0x1a, 0x03a11030},
9004 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08009005 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9006 ALC225_STANDARD_PINS,
9007 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08009008 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08009009 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9010 {0x14, 0x01014010},
9011 {0x17, 0x90170120},
9012 {0x18, 0x02a11030},
9013 {0x19, 0x02a1103f},
9014 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08009015 {}
9016};
Takashi Iwai1d045db2011-07-07 18:23:21 +02009017
Hui Wang7c0a6932019-08-16 14:27:40 +08009018/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9019 * more machines, don't need to match all valid pins, just need to match
9020 * all the pins defined in the tbl. Just because of this reason, it is possible
9021 * that a single machine matches multiple tbls, so there is one limitation:
9022 * at most one tbl is allowed to define for the same vendor and same codec
9023 */
9024static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9025 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9026 {0x19, 0x40000000},
9027 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08009028 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9029 {0x19, 0x40000000},
9030 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08009031 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9032 {0x19, 0x40000000},
9033 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08009034 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9035 {0x19, 0x40000000},
9036 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08009037 {}
9038};
9039
Takashi Iwai546bb672012-03-07 08:37:19 +01009040static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02009041{
Kailang Yang526af6e2012-03-07 08:25:20 +01009042 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009043 int val;
9044
Kailang Yang526af6e2012-03-07 08:25:20 +01009045 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01009046 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01009047
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009048 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009049 alc_write_coef_idx(codec, 0xf, 0x960b);
9050 alc_write_coef_idx(codec, 0xe, 0x8817);
9051 }
9052
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009053 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009054 alc_write_coef_idx(codec, 0xf, 0x960b);
9055 alc_write_coef_idx(codec, 0xe, 0x8814);
9056 }
9057
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009058 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009059 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02009060 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009061 }
9062
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009063 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009064 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009065 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009066 /* Capless ramp up clock control */
9067 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9068 }
9069 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009070 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009071 /* Class D power on reset */
9072 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9073 }
9074 }
9075
Takashi Iwai98b24882014-08-18 13:47:50 +02009076 /* HP */
9077 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009078}
9079
9080/*
9081 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009082static int patch_alc269(struct hda_codec *codec)
9083{
9084 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02009085 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009086
Takashi Iwai3de95172012-05-07 18:03:15 +02009087 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009088 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02009089 return err;
9090
9091 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01009092 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08009093 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009094
Takashi Iwai225068a2015-05-29 10:42:14 +02009095#ifdef CONFIG_PM
9096 codec->patch_ops.suspend = alc269_suspend;
9097 codec->patch_ops.resume = alc269_resume;
9098#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08009099 spec->shutup = alc_default_shutup;
9100 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02009101
Takashi Iwai7639a062015-03-03 10:07:24 +01009102 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01009103 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009104 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009105 switch (alc_get_coef0(codec) & 0x00f0) {
9106 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009107 if (codec->bus->pci &&
9108 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009109 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009110 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009111 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009112 break;
9113 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009114 if (codec->bus->pci &&
9115 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009116 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009117 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009118 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009119 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02009120 case 0x0030:
9121 spec->codec_variant = ALC269_TYPE_ALC269VD;
9122 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009123 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009124 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009125 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009126 if (err < 0)
9127 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08009128 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01009129 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009130 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01009131 break;
9132
9133 case 0x10ec0280:
9134 case 0x10ec0290:
9135 spec->codec_variant = ALC269_TYPE_ALC280;
9136 break;
9137 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01009138 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08009139 spec->shutup = alc282_shutup;
9140 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01009141 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02009142 case 0x10ec0233:
9143 case 0x10ec0283:
9144 spec->codec_variant = ALC269_TYPE_ALC283;
9145 spec->shutup = alc283_shutup;
9146 spec->init_hook = alc283_init;
9147 break;
Kailang Yang065380f2013-01-10 10:25:48 +01009148 case 0x10ec0284:
9149 case 0x10ec0292:
9150 spec->codec_variant = ALC269_TYPE_ALC284;
9151 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02009152 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08009153 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02009154 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02009155 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08009156 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02009157 spec->codec_variant = ALC269_TYPE_ALC286;
9158 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08009159 case 0x10ec0298:
9160 spec->codec_variant = ALC269_TYPE_ALC298;
9161 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08009162 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009163 case 0x10ec0255:
9164 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08009165 spec->shutup = alc256_shutup;
9166 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009167 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08009168 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08009169 case 0x10ec0256:
9170 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08009171 spec->shutup = alc256_shutup;
9172 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02009173 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08009174 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009175 case 0x10ec0257:
9176 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08009177 spec->shutup = alc256_shutup;
9178 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009179 spec->gen.mixer_nid = 0;
9180 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009181 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +08009182 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009183 case 0x10ec0285:
Kailang Yang630e3612020-05-27 14:10:26 +08009184 case 0x10ec0287:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009185 case 0x10ec0289:
9186 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08009187 spec->shutup = alc225_shutup;
9188 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009189 spec->gen.mixer_nid = 0;
9190 break;
Kailang Yang42314302016-02-03 15:03:50 +08009191 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08009192 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08009193 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08009194 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08009195 spec->shutup = alc225_shutup;
9196 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01009197 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08009198 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009199 case 0x10ec0234:
9200 case 0x10ec0274:
9201 case 0x10ec0294:
9202 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08009203 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08009204 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08009205 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009206 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08009207 case 0x10ec0300:
9208 spec->codec_variant = ALC269_TYPE_ALC300;
9209 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009210 break;
Kailang Yangf0778872019-10-24 15:13:32 +08009211 case 0x10ec0623:
9212 spec->codec_variant = ALC269_TYPE_ALC623;
9213 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08009214 case 0x10ec0700:
9215 case 0x10ec0701:
9216 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +08009217 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +08009218 spec->codec_variant = ALC269_TYPE_ALC700;
9219 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08009220 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08009221 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08009222 break;
9223
Takashi Iwai1d045db2011-07-07 18:23:21 +02009224 }
9225
Kailang Yangad60d502013-06-28 12:03:01 +02009226 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05009227 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02009228 spec->init_hook = alc5505_dsp_init;
9229 }
9230
Takashi Iwaic9af7532019-05-10 11:01:43 +02009231 alc_pre_init(codec);
9232
Takashi Iwaiefe55732018-06-15 11:55:02 +02009233 snd_hda_pick_fixup(codec, alc269_fixup_models,
9234 alc269_fixup_tbl, alc269_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +08009235 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +08009236 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +02009237 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9238 alc269_fixups);
9239 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9240
9241 alc_auto_parse_customize_define(codec);
9242
9243 if (has_cdefine_beep(codec))
9244 spec->gen.beep_nid = 0x01;
9245
Takashi Iwaia4297b52011-08-23 18:40:12 +02009246 /* automatic parse from the BIOS config */
9247 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009248 if (err < 0)
9249 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009250
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009251 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9252 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9253 if (err < 0)
9254 goto error;
9255 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009256
Takashi Iwai1727a772013-01-10 09:52:52 +01009257 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009258
Takashi Iwai1d045db2011-07-07 18:23:21 +02009259 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009260
9261 error:
9262 alc_free(codec);
9263 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009264}
9265
9266/*
9267 * ALC861
9268 */
9269
Takashi Iwai1d045db2011-07-07 18:23:21 +02009270static int alc861_parse_auto_config(struct hda_codec *codec)
9271{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009272 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009273 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9274 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009275}
9276
Takashi Iwai1d045db2011-07-07 18:23:21 +02009277/* Pin config fixes */
9278enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009279 ALC861_FIXUP_FSC_AMILO_PI1505,
9280 ALC861_FIXUP_AMP_VREF_0F,
9281 ALC861_FIXUP_NO_JACK_DETECT,
9282 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009283 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009284};
9285
Takashi Iwai31150f22012-01-30 10:54:08 +01009286/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9287static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009288 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01009289{
9290 struct alc_spec *spec = codec->spec;
9291 unsigned int val;
9292
Takashi Iwai1727a772013-01-10 09:52:52 +01009293 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01009294 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01009295 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01009296 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9297 val |= AC_PINCTL_IN_EN;
9298 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02009299 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01009300 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01009301}
9302
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009303/* suppress the jack-detection */
9304static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009305 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009306{
Takashi Iwai1727a772013-01-10 09:52:52 +01009307 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009308 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009309}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009310
Takashi Iwai1727a772013-01-10 09:52:52 +01009311static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009312 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009313 .type = HDA_FIXUP_PINS,
9314 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009315 { 0x0b, 0x0221101f }, /* HP */
9316 { 0x0f, 0x90170310 }, /* speaker */
9317 { }
9318 }
9319 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009320 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009321 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01009322 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01009323 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009324 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009325 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009326 .v.func = alc_fixup_no_jack_detect,
9327 },
9328 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009329 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009330 .v.func = alc861_fixup_asus_amp_vref_0f,
9331 .chained = true,
9332 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009333 },
9334 [ALC660_FIXUP_ASUS_W7J] = {
9335 .type = HDA_FIXUP_VERBS,
9336 .v.verbs = (const struct hda_verb[]) {
9337 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9338 * for enabling outputs
9339 */
9340 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9341 { }
9342 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009343 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009344};
9345
9346static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009347 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01009348 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009349 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9350 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9351 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
Takashi Iwaidefce242021-04-28 13:27:03 +02009352 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009353 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009354 {}
9355};
9356
9357/*
9358 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009359static int patch_alc861(struct hda_codec *codec)
9360{
9361 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009362 int err;
9363
Takashi Iwai3de95172012-05-07 18:03:15 +02009364 err = alc_alloc_spec(codec, 0x15);
9365 if (err < 0)
9366 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009367
Takashi Iwai3de95172012-05-07 18:03:15 +02009368 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009369 if (has_cdefine_beep(codec))
9370 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009371
Takashi Iwai225068a2015-05-29 10:42:14 +02009372#ifdef CONFIG_PM
9373 spec->power_hook = alc_power_eapd;
9374#endif
9375
Takashi Iwaic9af7532019-05-10 11:01:43 +02009376 alc_pre_init(codec);
9377
Takashi Iwai1727a772013-01-10 09:52:52 +01009378 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9379 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009380
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009381 /* automatic parse from the BIOS config */
9382 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009383 if (err < 0)
9384 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009385
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009386 if (!spec->gen.no_analog) {
9387 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9388 if (err < 0)
9389 goto error;
9390 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009391
Takashi Iwai1727a772013-01-10 09:52:52 +01009392 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009393
Takashi Iwai1d045db2011-07-07 18:23:21 +02009394 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009395
9396 error:
9397 alc_free(codec);
9398 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009399}
9400
9401/*
9402 * ALC861-VD support
9403 *
9404 * Based on ALC882
9405 *
9406 * In addition, an independent DAC
9407 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009408static int alc861vd_parse_auto_config(struct hda_codec *codec)
9409{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009410 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009411 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9412 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009413}
9414
Takashi Iwai1d045db2011-07-07 18:23:21 +02009415enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009416 ALC660VD_FIX_ASUS_GPIO1,
9417 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009418};
9419
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009420/* exclude VREF80 */
9421static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009422 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009423{
Takashi Iwai1727a772013-01-10 09:52:52 +01009424 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01009425 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9426 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009427 }
9428}
9429
Takashi Iwaidf73d832018-06-19 23:05:47 +02009430/* reset GPIO1 */
9431static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9432 const struct hda_fixup *fix, int action)
9433{
9434 struct alc_spec *spec = codec->spec;
9435
9436 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9437 spec->gpio_mask |= 0x02;
9438 alc_fixup_gpio(codec, action, 0x01);
9439}
9440
Takashi Iwai1727a772013-01-10 09:52:52 +01009441static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009442 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +02009443 .type = HDA_FIXUP_FUNC,
9444 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009445 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009446 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009447 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009448 .v.func = alc861vd_fixup_dallas,
9449 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02009450};
9451
9452static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009453 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009454 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009455 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009456 {}
9457};
9458
Takashi Iwai1d045db2011-07-07 18:23:21 +02009459/*
9460 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009461static int patch_alc861vd(struct hda_codec *codec)
9462{
9463 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009464 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009465
Takashi Iwai3de95172012-05-07 18:03:15 +02009466 err = alc_alloc_spec(codec, 0x0b);
9467 if (err < 0)
9468 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009469
Takashi Iwai3de95172012-05-07 18:03:15 +02009470 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009471 if (has_cdefine_beep(codec))
9472 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009473
Takashi Iwai225068a2015-05-29 10:42:14 +02009474 spec->shutup = alc_eapd_shutup;
9475
Takashi Iwaic9af7532019-05-10 11:01:43 +02009476 alc_pre_init(codec);
9477
Takashi Iwai1727a772013-01-10 09:52:52 +01009478 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
9479 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009480
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009481 /* automatic parse from the BIOS config */
9482 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009483 if (err < 0)
9484 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009485
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009486 if (!spec->gen.no_analog) {
9487 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9488 if (err < 0)
9489 goto error;
9490 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009491
Takashi Iwai1727a772013-01-10 09:52:52 +01009492 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009493
Takashi Iwai1d045db2011-07-07 18:23:21 +02009494 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009495
9496 error:
9497 alc_free(codec);
9498 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009499}
9500
9501/*
9502 * ALC662 support
9503 *
9504 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9505 * configuration. Each pin widget can choose any input DACs and a mixer.
9506 * Each ADC is connected from a mixer of all inputs. This makes possible
9507 * 6-channel independent captures.
9508 *
9509 * In addition, an independent DAC for the multi-playback (not used in this
9510 * driver yet).
9511 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009512
9513/*
9514 * BIOS auto configuration
9515 */
9516
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009517static int alc662_parse_auto_config(struct hda_codec *codec)
9518{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02009519 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009520 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9521 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9522 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02009523
Takashi Iwai7639a062015-03-03 10:07:24 +01009524 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9525 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9526 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009527 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01009528 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009529 ssids = alc662_ssids;
9530 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009531}
9532
Todd Broch6be79482010-12-07 16:51:05 -08009533static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009534 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009535{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01009536 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009537 return;
Todd Broch6be79482010-12-07 16:51:05 -08009538 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9539 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9540 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9541 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9542 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01009543 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08009544}
9545
Takashi Iwai8e383952013-10-30 17:41:12 +01009546static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9547 { .channels = 2,
9548 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9549 { .channels = 4,
9550 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9551 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9552 { }
9553};
9554
9555/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009556static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01009557 const struct hda_fixup *fix, int action)
9558{
9559 if (action == HDA_FIXUP_ACT_BUILD) {
9560 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01009561 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01009562 }
9563}
9564
Takashi Iwaibf686652014-01-13 16:18:25 +01009565/* avoid D3 for keeping GPIO up */
9566static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9567 hda_nid_t nid,
9568 unsigned int power_state)
9569{
9570 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02009571 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01009572 return AC_PWRST_D0;
9573 return power_state;
9574}
9575
Takashi Iwai3e887f32014-01-10 17:50:58 +01009576static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9577 const struct hda_fixup *fix, int action)
9578{
9579 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009580
Takashi Iwai01e4a272018-06-19 22:47:30 +02009581 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01009582 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01009583 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01009584 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009585 }
9586}
9587
Kailang Yangc6790c82016-11-25 16:15:17 +08009588static void alc662_usi_automute_hook(struct hda_codec *codec,
9589 struct hda_jack_callback *jack)
9590{
9591 struct alc_spec *spec = codec->spec;
9592 int vref;
9593 msleep(200);
9594 snd_hda_gen_hp_automute(codec, jack);
9595
9596 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
9597 msleep(100);
9598 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9599 vref);
9600}
9601
9602static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
9603 const struct hda_fixup *fix, int action)
9604{
9605 struct alc_spec *spec = codec->spec;
9606 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9607 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9608 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
9609 }
9610}
9611
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009612static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
9613 struct hda_jack_callback *cb)
9614{
9615 /* surround speakers at 0x1b already get muted automatically when
9616 * headphones are plugged in, but we have to mute/unmute the remaining
9617 * channels manually:
9618 * 0x15 - front left/front right
9619 * 0x18 - front center/ LFE
9620 */
9621 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
9622 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
9623 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
9624 } else {
9625 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
9626 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
9627 }
9628}
9629
9630static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
9631 const struct hda_fixup *fix, int action)
9632{
9633 /* Pin 0x1b: shared headphones jack and surround speakers */
9634 if (!is_jack_detectable(codec, 0x1b))
9635 return;
9636
9637 switch (action) {
9638 case HDA_FIXUP_ACT_PRE_PROBE:
9639 snd_hda_jack_detect_enable_callback(codec, 0x1b,
9640 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +01009641 /* subwoofer needs an extra GPIO setting to become audible */
9642 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009643 break;
9644 case HDA_FIXUP_ACT_INIT:
9645 /* Make sure to start in a correct state, i.e. if
9646 * headphones have been plugged in before powering up the system
9647 */
9648 alc662_aspire_ethos_mute_speakers(codec, NULL);
9649 break;
9650 }
9651}
9652
Kailang Yang5af290282020-01-17 14:04:01 +08009653static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
9654 const struct hda_fixup *fix, int action)
9655{
9656 struct alc_spec *spec = codec->spec;
9657
9658 static const struct hda_pintbl pincfgs[] = {
9659 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
9660 { 0x1b, 0x0181304f },
9661 { }
9662 };
9663
9664 switch (action) {
9665 case HDA_FIXUP_ACT_PRE_PROBE:
9666 spec->gen.mixer_nid = 0;
9667 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9668 snd_hda_apply_pincfgs(codec, pincfgs);
9669 break;
9670 case HDA_FIXUP_ACT_INIT:
9671 alc_write_coef_idx(codec, 0x19, 0xa054);
9672 break;
9673 }
9674}
9675
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01009676static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +08009677 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
9678 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
9679 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
9680 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
9681 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
9682 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
9683 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
9684 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
9685 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
9686 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
9687 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
9688 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
9689 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
9690 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
9691 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
9692 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
9693 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
9694 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
9695 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
9696 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
9697 {}
9698};
9699
9700static void alc668_restore_default_value(struct hda_codec *codec)
9701{
9702 alc_process_coef_fw(codec, alc668_coefs);
9703}
9704
David Henningsson6cb3b702010-09-09 08:51:44 +02009705enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04009706 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01009707 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009708 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08009709 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009710 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009711 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02009712 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009713 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02009714 ALC662_FIXUP_ASUS_MODE1,
9715 ALC662_FIXUP_ASUS_MODE2,
9716 ALC662_FIXUP_ASUS_MODE3,
9717 ALC662_FIXUP_ASUS_MODE4,
9718 ALC662_FIXUP_ASUS_MODE5,
9719 ALC662_FIXUP_ASUS_MODE6,
9720 ALC662_FIXUP_ASUS_MODE7,
9721 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009722 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02009723 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02009724 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009725 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02009726 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009727 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02009728 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009729 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01009730 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009731 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009732 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08009733 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009734 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009735 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009736 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009737 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009738 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009739 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +02009740 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009741 ALC891_FIXUP_HEADSET_MODE,
9742 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009743 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009744 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08009745 ALC662_FIXUP_USI_FUNC,
9746 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08009747 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009748 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009749 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +08009750 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +08009751 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +08009752 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
David Henningsson6cb3b702010-09-09 08:51:44 +02009753};
9754
Takashi Iwai1727a772013-01-10 09:52:52 +01009755static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04009756 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009757 .type = HDA_FIXUP_PINS,
9758 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04009759 { 0x15, 0x99130112 }, /* subwoofer */
9760 { }
9761 }
9762 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01009763 [ALC662_FIXUP_LED_GPIO1] = {
9764 .type = HDA_FIXUP_FUNC,
9765 .v.func = alc662_fixup_led_gpio1,
9766 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009767 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009768 .type = HDA_FIXUP_PINS,
9769 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02009770 { 0x17, 0x99130112 }, /* subwoofer */
9771 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01009772 },
9773 .chained = true,
9774 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009775 },
Todd Broch6be79482010-12-07 16:51:05 -08009776 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009777 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01009778 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009779 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009780 [ALC662_FIXUP_CZC_ET26] = {
9781 .type = HDA_FIXUP_PINS,
9782 .v.pins = (const struct hda_pintbl[]) {
9783 {0x12, 0x403cc000},
9784 {0x14, 0x90170110}, /* speaker */
9785 {0x15, 0x411111f0},
9786 {0x16, 0x411111f0},
9787 {0x18, 0x01a19030}, /* mic */
9788 {0x19, 0x90a7013f}, /* int-mic */
9789 {0x1a, 0x01014020},
9790 {0x1b, 0x0121401f},
9791 {0x1c, 0x411111f0},
9792 {0x1d, 0x411111f0},
9793 {0x1e, 0x40478e35},
9794 {}
9795 },
9796 .chained = true,
9797 .chain_id = ALC662_FIXUP_SKU_IGNORE
9798 },
Anisse Astierd2ebd472011-01-20 12:36:21 +01009799 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009800 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009801 .v.verbs = (const struct hda_verb[]) {
9802 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
9803 {}
9804 }
9805 },
David Henningsson94024cd2011-04-29 14:10:55 +02009806 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009807 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02009808 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02009809 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009810 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009811 .type = HDA_FIXUP_PINS,
9812 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009813 { 0x14, 0x0221201f }, /* HP out */
9814 { }
9815 },
9816 .chained = true,
9817 .chain_id = ALC662_FIXUP_SKU_IGNORE
9818 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009819 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009820 .type = HDA_FIXUP_PINS,
9821 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009822 { 0x14, 0x99130110 }, /* speaker */
9823 { 0x18, 0x01a19c20 }, /* mic */
9824 { 0x19, 0x99a3092f }, /* int-mic */
9825 { 0x21, 0x0121401f }, /* HP out */
9826 { }
9827 },
9828 .chained = true,
9829 .chain_id = ALC662_FIXUP_SKU_IGNORE
9830 },
9831 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009832 .type = HDA_FIXUP_PINS,
9833 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009834 { 0x14, 0x99130110 }, /* speaker */
9835 { 0x18, 0x01a19820 }, /* mic */
9836 { 0x19, 0x99a3092f }, /* int-mic */
9837 { 0x1b, 0x0121401f }, /* HP out */
9838 { }
9839 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009840 .chained = true,
9841 .chain_id = ALC662_FIXUP_SKU_IGNORE
9842 },
9843 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009844 .type = HDA_FIXUP_PINS,
9845 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009846 { 0x14, 0x99130110 }, /* speaker */
9847 { 0x15, 0x0121441f }, /* HP */
9848 { 0x18, 0x01a19840 }, /* mic */
9849 { 0x19, 0x99a3094f }, /* int-mic */
9850 { 0x21, 0x01211420 }, /* HP2 */
9851 { }
9852 },
9853 .chained = true,
9854 .chain_id = ALC662_FIXUP_SKU_IGNORE
9855 },
9856 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009857 .type = HDA_FIXUP_PINS,
9858 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009859 { 0x14, 0x99130110 }, /* speaker */
9860 { 0x16, 0x99130111 }, /* speaker */
9861 { 0x18, 0x01a19840 }, /* mic */
9862 { 0x19, 0x99a3094f }, /* int-mic */
9863 { 0x21, 0x0121441f }, /* HP */
9864 { }
9865 },
9866 .chained = true,
9867 .chain_id = ALC662_FIXUP_SKU_IGNORE
9868 },
9869 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009870 .type = HDA_FIXUP_PINS,
9871 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009872 { 0x14, 0x99130110 }, /* speaker */
9873 { 0x15, 0x0121441f }, /* HP */
9874 { 0x16, 0x99130111 }, /* speaker */
9875 { 0x18, 0x01a19840 }, /* mic */
9876 { 0x19, 0x99a3094f }, /* int-mic */
9877 { }
9878 },
9879 .chained = true,
9880 .chain_id = ALC662_FIXUP_SKU_IGNORE
9881 },
9882 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009883 .type = HDA_FIXUP_PINS,
9884 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009885 { 0x14, 0x99130110 }, /* speaker */
9886 { 0x15, 0x01211420 }, /* HP2 */
9887 { 0x18, 0x01a19840 }, /* mic */
9888 { 0x19, 0x99a3094f }, /* int-mic */
9889 { 0x1b, 0x0121441f }, /* HP */
9890 { }
9891 },
9892 .chained = true,
9893 .chain_id = ALC662_FIXUP_SKU_IGNORE
9894 },
9895 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009896 .type = HDA_FIXUP_PINS,
9897 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009898 { 0x14, 0x99130110 }, /* speaker */
9899 { 0x17, 0x99130111 }, /* speaker */
9900 { 0x18, 0x01a19840 }, /* mic */
9901 { 0x19, 0x99a3094f }, /* int-mic */
9902 { 0x1b, 0x01214020 }, /* HP */
9903 { 0x21, 0x0121401f }, /* HP */
9904 { }
9905 },
9906 .chained = true,
9907 .chain_id = ALC662_FIXUP_SKU_IGNORE
9908 },
9909 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009910 .type = HDA_FIXUP_PINS,
9911 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009912 { 0x14, 0x99130110 }, /* speaker */
9913 { 0x12, 0x99a30970 }, /* int-mic */
9914 { 0x15, 0x01214020 }, /* HP */
9915 { 0x17, 0x99130111 }, /* speaker */
9916 { 0x18, 0x01a19840 }, /* mic */
9917 { 0x21, 0x0121401f }, /* HP */
9918 { }
9919 },
9920 .chained = true,
9921 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009922 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01009923 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009924 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009925 .v.func = alc_fixup_no_jack_detect,
9926 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02009927 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009928 .type = HDA_FIXUP_PINS,
9929 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02009930 { 0x1b, 0x02214020 }, /* Front HP */
9931 { }
9932 }
9933 },
Takashi Iwai125821a2012-06-22 14:30:29 +02009934 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009935 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02009936 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02009937 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009938 [ALC668_FIXUP_DELL_XPS13] = {
9939 .type = HDA_FIXUP_FUNC,
9940 .v.func = alc_fixup_dell_xps13,
9941 .chained = true,
9942 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
9943 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009944 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
9945 .type = HDA_FIXUP_FUNC,
9946 .v.func = alc_fixup_disable_aamix,
9947 .chained = true,
9948 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9949 },
Hui Wang493a52a2014-01-14 14:07:36 +08009950 [ALC668_FIXUP_AUTO_MUTE] = {
9951 .type = HDA_FIXUP_FUNC,
9952 .v.func = alc_fixup_auto_mute_via_amp,
9953 .chained = true,
9954 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9955 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02009956 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
9957 .type = HDA_FIXUP_PINS,
9958 .v.pins = (const struct hda_pintbl[]) {
9959 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9960 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
9961 { }
9962 },
9963 .chained = true,
9964 .chain_id = ALC662_FIXUP_HEADSET_MODE
9965 },
9966 [ALC662_FIXUP_HEADSET_MODE] = {
9967 .type = HDA_FIXUP_FUNC,
9968 .v.func = alc_fixup_headset_mode_alc662,
9969 },
David Henningsson73bdd592013-04-15 15:44:14 +02009970 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
9971 .type = HDA_FIXUP_PINS,
9972 .v.pins = (const struct hda_pintbl[]) {
9973 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9974 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9975 { }
9976 },
9977 .chained = true,
9978 .chain_id = ALC668_FIXUP_HEADSET_MODE
9979 },
9980 [ALC668_FIXUP_HEADSET_MODE] = {
9981 .type = HDA_FIXUP_FUNC,
9982 .v.func = alc_fixup_headset_mode_alc668,
9983 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009984 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01009985 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009986 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01009987 .chained = true,
9988 .chain_id = ALC662_FIXUP_ASUS_MODE4
9989 },
David Henningsson61a75f12014-02-07 09:31:08 +01009990 [ALC662_FIXUP_BASS_16] = {
9991 .type = HDA_FIXUP_PINS,
9992 .v.pins = (const struct hda_pintbl[]) {
9993 {0x16, 0x80106111}, /* bass speaker */
9994 {}
9995 },
9996 .chained = true,
9997 .chain_id = ALC662_FIXUP_BASS_CHMAP,
9998 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009999 [ALC662_FIXUP_BASS_1A] = {
10000 .type = HDA_FIXUP_PINS,
10001 .v.pins = (const struct hda_pintbl[]) {
10002 {0x1a, 0x80106111}, /* bass speaker */
10003 {}
10004 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010005 .chained = true,
10006 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010007 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010008 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010009 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010010 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010011 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010012 [ALC662_FIXUP_ASUS_Nx50] = {
10013 .type = HDA_FIXUP_FUNC,
10014 .v.func = alc_fixup_auto_mute_via_amp,
10015 .chained = true,
10016 .chain_id = ALC662_FIXUP_BASS_1A
10017 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010018 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10019 .type = HDA_FIXUP_FUNC,
10020 .v.func = alc_fixup_headset_mode_alc668,
10021 .chain_id = ALC662_FIXUP_BASS_CHMAP
10022 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010023 [ALC668_FIXUP_ASUS_Nx51] = {
10024 .type = HDA_FIXUP_PINS,
10025 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010026 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10027 { 0x1a, 0x90170151 }, /* bass speaker */
10028 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010029 {}
10030 },
10031 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010032 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010033 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010034 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +020010035 .type = HDA_FIXUP_VERBS,
10036 .v.verbs = (const struct hda_verb[]) {
10037 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10038 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10039 {}
10040 },
10041 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010042 [ALC668_FIXUP_ASUS_G751] = {
10043 .type = HDA_FIXUP_PINS,
10044 .v.pins = (const struct hda_pintbl[]) {
10045 { 0x16, 0x0421101f }, /* HP */
10046 {}
10047 },
10048 .chained = true,
10049 .chain_id = ALC668_FIXUP_MIC_COEF
10050 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010051 [ALC891_FIXUP_HEADSET_MODE] = {
10052 .type = HDA_FIXUP_FUNC,
10053 .v.func = alc_fixup_headset_mode,
10054 },
10055 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10056 .type = HDA_FIXUP_PINS,
10057 .v.pins = (const struct hda_pintbl[]) {
10058 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10059 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10060 { }
10061 },
10062 .chained = true,
10063 .chain_id = ALC891_FIXUP_HEADSET_MODE
10064 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010065 [ALC662_FIXUP_ACER_VERITON] = {
10066 .type = HDA_FIXUP_PINS,
10067 .v.pins = (const struct hda_pintbl[]) {
10068 { 0x15, 0x50170120 }, /* no internal speaker */
10069 { }
10070 }
10071 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010072 [ALC892_FIXUP_ASROCK_MOBO] = {
10073 .type = HDA_FIXUP_PINS,
10074 .v.pins = (const struct hda_pintbl[]) {
10075 { 0x15, 0x40f000f0 }, /* disabled */
10076 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010077 { }
10078 }
10079 },
Kailang Yangc6790c82016-11-25 16:15:17 +080010080 [ALC662_FIXUP_USI_FUNC] = {
10081 .type = HDA_FIXUP_FUNC,
10082 .v.func = alc662_fixup_usi_headset_mic,
10083 },
10084 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10085 .type = HDA_FIXUP_PINS,
10086 .v.pins = (const struct hda_pintbl[]) {
10087 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10088 { 0x18, 0x01a1903d },
10089 { }
10090 },
10091 .chained = true,
10092 .chain_id = ALC662_FIXUP_USI_FUNC
10093 },
Kailang Yangca169cc2017-04-25 16:17:40 +080010094 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10095 .type = HDA_FIXUP_FUNC,
10096 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10097 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010098 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10099 .type = HDA_FIXUP_FUNC,
10100 .v.func = alc662_fixup_aspire_ethos_hp,
10101 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010102 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10103 .type = HDA_FIXUP_PINS,
10104 .v.pins = (const struct hda_pintbl[]) {
10105 { 0x15, 0x92130110 }, /* front speakers */
10106 { 0x18, 0x99130111 }, /* center/subwoofer */
10107 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10108 { }
10109 },
10110 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +010010111 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010112 },
Kailang Yang5af290282020-01-17 14:04:01 +080010113 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10114 .type = HDA_FIXUP_FUNC,
10115 .v.func = alc671_fixup_hp_headset_mic2,
10116 },
Jian-Hong Pand858c702020-03-17 16:28:07 +080010117 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10118 .type = HDA_FIXUP_PINS,
10119 .v.pins = (const struct hda_pintbl[]) {
10120 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10121 { }
10122 },
10123 .chained = true,
10124 .chain_id = ALC662_FIXUP_USI_FUNC
10125 },
Jian-Hong Pana1244582020-03-17 16:28:09 +080010126 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10127 .type = HDA_FIXUP_PINS,
10128 .v.pins = (const struct hda_pintbl[]) {
10129 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10130 { 0x1b, 0x0221144f },
10131 { }
10132 },
10133 .chained = true,
10134 .chain_id = ALC662_FIXUP_USI_FUNC
10135 },
David Henningsson6cb3b702010-09-09 08:51:44 +020010136};
10137
Takashi Iwaia9111322011-05-02 11:30:18 +020010138static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010139 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +020010140 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +010010141 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +010010142 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +020010143 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +020010144 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +020010145 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -040010146 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Takashi Iwai9edeb112021-04-28 13:27:02 +020010147 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Jian-Hong Pana1244582020-03-17 16:28:09 +080010148 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +080010149 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +020010150 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10151 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +020010152 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010153 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +020010154 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +010010155 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +010010156 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +080010157 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10158 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +080010159 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010160 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Jeremy Szu148ebf542020-10-08 18:56:44 +080010161 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Kaho Ng2da2dc92016-05-09 00:27:49 +080010162 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +020010163 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010164 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +020010165 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
Takashi Iwai9edeb112021-04-28 13:27:02 +020010166 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010167 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +010010168 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010169 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10170 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +010010171 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +010010172 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010173 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +010010174 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010175 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -050010176 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +080010177 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +080010178 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +060010179 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +020010180 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010181 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +020010182 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010183 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010184 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +010010185 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010186
10187#if 0
10188 /* Below is a quirk table taken from the old code.
10189 * Basically the device should work as is without the fixup table.
10190 * If BIOS doesn't give a proper info, enable the corresponding
10191 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +020010192 */
Takashi Iwai53c334a2011-08-23 18:27:14 +020010193 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10194 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10195 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10196 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10197 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10198 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10199 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10200 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10201 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10202 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10203 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10204 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10205 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10206 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10207 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10208 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10209 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10210 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10211 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10212 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10213 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10214 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10215 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10216 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10217 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10218 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10219 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10220 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10221 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10222 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10223 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10224 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10225 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10226 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10227 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10228 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10229 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10230 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10231 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10232 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10233 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10234 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10235 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10236 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10237 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10238 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10239 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10240 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10241 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10242 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10243#endif
David Henningsson6cb3b702010-09-09 08:51:44 +020010244 {}
10245};
10246
Takashi Iwai1727a772013-01-10 09:52:52 +010010247static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010248 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10249 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -080010250 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010251 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +020010252 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10253 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10254 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10255 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10256 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10257 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10258 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10259 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010260 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +020010261 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010262 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +020010263 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010264 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10265 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10266 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10267 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10268 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10269 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10270 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10271 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +020010272 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010273 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10274 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10275 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10276 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10277 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +020010278 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010279 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -080010280 {}
10281};
David Henningsson6cb3b702010-09-09 08:51:44 +020010282
Hui Wang532895c2014-05-29 15:59:19 +080010283static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010284 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10285 {0x17, 0x02211010},
10286 {0x18, 0x01a19030},
10287 {0x1a, 0x01813040},
10288 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +080010289 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10290 {0x16, 0x01813030},
10291 {0x17, 0x02211010},
10292 {0x18, 0x01a19040},
10293 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +020010294 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010295 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010296 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010297 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +080010298 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +020010299 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10300 {0x12, 0x99a30130},
10301 {0x14, 0x90170110},
10302 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010303 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010304 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10305 {0x12, 0x99a30140},
10306 {0x14, 0x90170110},
10307 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010308 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010309 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10310 {0x12, 0x99a30150},
10311 {0x14, 0x90170110},
10312 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010313 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010314 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +020010315 {0x14, 0x90170110},
10316 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010317 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010318 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10319 {0x12, 0x90a60130},
10320 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +080010321 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +080010322 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10323 {0x14, 0x01014010},
10324 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +080010325 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +080010326 {0x1b, 0x01813030},
10327 {0x21, 0x02211020}),
10328 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10329 {0x14, 0x01014010},
10330 {0x18, 0x01a19040},
10331 {0x1b, 0x01813030},
10332 {0x21, 0x02211020}),
10333 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10334 {0x14, 0x01014020},
10335 {0x17, 0x90170110},
10336 {0x18, 0x01a19050},
10337 {0x1b, 0x01813040},
10338 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +080010339 {}
10340};
10341
Takashi Iwai1d045db2011-07-07 18:23:21 +020010342/*
10343 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010344static int patch_alc662(struct hda_codec *codec)
10345{
10346 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +020010347 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010348
Takashi Iwai3de95172012-05-07 18:03:15 +020010349 err = alc_alloc_spec(codec, 0x0b);
10350 if (err < 0)
10351 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010352
Takashi Iwai3de95172012-05-07 18:03:15 +020010353 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010354
Takashi Iwai225068a2015-05-29 10:42:14 +020010355 spec->shutup = alc_eapd_shutup;
10356
Takashi Iwai53c334a2011-08-23 18:27:14 +020010357 /* handle multiple HPs as is */
10358 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10359
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +020010360 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10361
Takashi Iwai7639a062015-03-03 10:07:24 +010010362 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +080010363 case 0x10ec0668:
10364 spec->init_hook = alc668_restore_default_value;
10365 break;
Kailang Yangf3f91852014-10-24 15:43:46 +080010366 }
Kailang Yang8663ff72012-06-29 09:35:52 +020010367
Takashi Iwaic9af7532019-05-10 11:01:43 +020010368 alc_pre_init(codec);
10369
Takashi Iwai1727a772013-01-10 09:52:52 +010010370 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010371 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +080010372 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +010010373 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010374
10375 alc_auto_parse_customize_define(codec);
10376
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010377 if (has_cdefine_beep(codec))
10378 spec->gen.beep_nid = 0x01;
10379
Takashi Iwai1bb7e432011-10-17 16:50:59 +020010380 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +010010381 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010382 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +080010383 err = alc_codec_rename(codec, "ALC272X");
10384 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010385 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +020010386 }
Kailang Yang274693f2009-12-03 10:07:50 +010010387
Takashi Iwaib9c51062011-08-24 18:08:07 +020010388 /* automatic parse from the BIOS config */
10389 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010390 if (err < 0)
10391 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010392
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010393 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +010010394 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +010010395 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010396 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010397 break;
10398 case 0x10ec0272:
10399 case 0x10ec0663:
10400 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +080010401 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010402 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010403 break;
10404 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010405 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010406 break;
10407 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010408 if (err < 0)
10409 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +010010410 }
Takashi Iwai2134ea42008-01-10 16:53:55 +010010411
Takashi Iwai1727a772013-01-10 09:52:52 +010010412 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010413
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010414 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010415
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010416 error:
10417 alc_free(codec);
10418 return err;
Kailang Yangb478b992011-05-18 11:51:15 +020010419}
10420
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010421/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010422 * ALC680 support
10423 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010424
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010425static int alc680_parse_auto_config(struct hda_codec *codec)
10426{
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010427 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010428}
10429
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010430/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010431 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010432static int patch_alc680(struct hda_codec *codec)
10433{
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010434 int err;
10435
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010436 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +020010437 err = alc_alloc_spec(codec, 0);
10438 if (err < 0)
10439 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010440
Takashi Iwai1ebec5f2011-08-15 13:21:48 +020010441 /* automatic parse from the BIOS config */
10442 err = alc680_parse_auto_config(codec);
10443 if (err < 0) {
10444 alc_free(codec);
10445 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010446 }
10447
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010448 return 0;
10449}
10450
10451/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070010452 * patch entries
10453 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010454static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +080010455 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010456 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +080010457 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +080010458 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010459 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
10460 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010461 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010462 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +080010463 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +080010464 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010465 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
10466 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +080010467 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010468 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
10469 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
10470 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
10471 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
10472 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
10473 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
10474 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010475 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010476 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
10477 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
10478 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
10479 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
10480 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
10481 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010482 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010483 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080010484 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010485 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010486 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010487 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10488 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10489 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010490 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080010491 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010492 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080010493 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080010494 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080010495 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010496 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10497 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10498 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10499 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10500 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10501 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10502 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10503 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10504 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10505 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10506 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10507 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10508 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10509 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080010510 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10511 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10512 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080010513 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010514 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010515 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10516 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10517 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10518 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10519 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10520 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10521 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10522 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10523 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10524 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10525 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
Kailang Yange5782a52020-11-27 14:39:23 +080010526 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010527 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10528 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080010529 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080010530 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080010531 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070010532 {} /* terminator */
10533};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010534MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010535
10536MODULE_LICENSE("GPL");
10537MODULE_DESCRIPTION("Realtek HD-audio codec");
10538
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010539static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010540 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010541};
10542
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010543module_hda_codec_driver(realtek_driver);