blob: b90cd4c65b5862c46deb4217783b805d375689c7 [file] [log] [blame]
Thomas Gleixnerd0fa1172019-05-20 19:07:57 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
Takashi Iwai1d045db2011-07-07 18:23:21 +02005 * HD audio interface patch for Realtek ALC codecs
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
Kailang Yangdf694da2005-12-05 19:42:22 +01007 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * Takashi Iwai <tiwai@suse.de>
Jonathan Woithe409a3e92012-03-27 13:01:01 +103010 * Jonathan Woithe <jwoithe@just42.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
Takashi Iwai08fb0d02013-01-10 17:33:58 +010017#include <linux/dmi.h>
Paul Gortmakerda155d52011-07-15 12:38:28 -040018#include <linux/module.h>
David Henningsson33f4acd2015-01-07 15:50:13 +010019#include <linux/input.h>
Kai-Heng Feng87dc3642020-04-30 21:52:07 +080020#include <linux/leds.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <sound/core.h>
Kailang Yang9ad0e492010-09-14 23:22:00 +020022#include <sound/jack.h>
Pierre-Louis Bossartbe57bff2018-08-22 15:24:57 -050023#include <sound/hda_codec.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include "hda_local.h"
Takashi Iwai23d30f22012-05-07 17:17:32 +020025#include "hda_auto_parser.h"
Takashi Iwai1835a0f2011-10-27 22:12:46 +020026#include "hda_jack.h"
Takashi Iwai08c189f2012-12-19 15:22:24 +010027#include "hda_generic.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Takashi Iwaicd63a5f2013-07-05 12:13:59 +020029/* keep halting ALC5505 DSP, for power saving */
30#define HALT_REALTEK_ALC5505
31
Takashi Iwai4a79ba32009-04-22 16:31:35 +020032/* extra amp-initialization sequence types */
33enum {
Takashi Iwai1c76aa52018-06-21 16:37:54 +020034 ALC_INIT_UNDEFINED,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020035 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020037};
38
David Henningsson73bdd592013-04-15 15:44:14 +020039enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45};
46
47enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51};
52
Hui Wangc7b60a82015-12-28 11:35:25 +080053enum {
54 ALC_KEY_MICMUTE_INDEX,
55};
56
Kailang Yangda00c242010-03-19 11:23:45 +010057struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
David Henningsson90622912010-10-14 14:50:18 +020067 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010068};
69
Takashi Iwai766538a2020-06-18 13:08:41 +020070struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75};
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010078 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020079
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 /* codec parameterization */
Kailang Yangda00c242010-03-19 11:23:45 +010081 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010082 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
83
Takashi Iwai5579cd62018-06-19 22:22:41 +020084 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
Takashi Iwai215c8502018-06-19 22:34:26 +020088 bool gpio_write_delay; /* add a delay before writing gpio_data */
Takashi Iwai5579cd62018-06-19 22:22:41 +020089
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +020090 /* mute LED for HP laptops, see vref_mute_led_set() */
Takashi Iwai08fb0d02013-01-10 17:33:58 +010091 int mute_led_polarity;
Kai-Heng Fengdbd13172020-04-30 16:32:51 +080092 int micmute_led_polarity;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010093 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +080094 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010095
Takashi Iwai0f32fd192014-11-19 12:16:14 +010096 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
Takashi Iwai766538a2020-06-18 13:08:41 +020098 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100100
David Henningsson73bdd592013-04-15 15:44:14 +0200101 hda_nid_t headset_mic_pin;
102 hda_nid_t headphone_mic_pin;
103 int current_headset_mode;
104 int current_headset_type;
105
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100106 /* hooks */
107 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200108#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500109 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100110#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200111 void (*shutup)(struct hda_codec *codec);
Takashi Iwai70a09762015-12-15 14:59:58 +0100112 void (*reboot_notify)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200113
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200114 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200115 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
Kailang Yang693abe12019-01-29 15:38:21 +0800118 unsigned int done_hp_init:1;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100119 unsigned int no_shutup_pins:1;
Kailang Yangd3ba58b2019-05-06 15:09:42 +0800120 unsigned int ultra_low_power:1;
Hui Wang476c02e2020-03-29 16:20:18 +0800121 unsigned int has_hs_key:1;
Kailang Yang92666d42020-11-19 17:04:21 +0800122 unsigned int no_internal_mic_pin:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100123
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200124 /* for PLL fix */
125 hda_nid_t pll_nid;
126 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200127 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100128 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800129 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100130};
131
Takashi Iwai23f0c042009-02-26 13:03:58 +0100132/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200133 * COEF access helper functions
134 */
135
136static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
137 unsigned int coef_idx)
138{
139 unsigned int val;
140
141 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
142 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
143 return val;
144}
145
146#define alc_read_coef_idx(codec, coef_idx) \
147 alc_read_coefex_idx(codec, 0x20, coef_idx)
148
149static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
150 unsigned int coef_idx, unsigned int coef_val)
151{
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
154}
155
156#define alc_write_coef_idx(codec, coef_idx, coef_val) \
157 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
158
Takashi Iwai98b24882014-08-18 13:47:50 +0200159static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 unsigned int coef_idx, unsigned int mask,
161 unsigned int bits_set)
162{
163 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
164
165 if (val != -1)
166 alc_write_coefex_idx(codec, nid, coef_idx,
167 (val & ~mask) | bits_set);
168}
169
170#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
171 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
172
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200173/* a special bypass for COEF 0; read the cached value at the second time */
174static unsigned int alc_get_coef0(struct hda_codec *codec)
175{
176 struct alc_spec *spec = codec->spec;
177
178 if (!spec->coef0)
179 spec->coef0 = alc_read_coef_idx(codec, 0);
180 return spec->coef0;
181}
182
Takashi Iwai54db6c32014-08-18 15:11:19 +0200183/* coef writes/updates batch */
184struct coef_fw {
185 unsigned char nid;
186 unsigned char idx;
187 unsigned short mask;
188 unsigned short val;
189};
190
191#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
192 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
193#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
194#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
195#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
196
197static void alc_process_coef_fw(struct hda_codec *codec,
198 const struct coef_fw *fw)
199{
200 for (; fw->nid; fw++) {
201 if (fw->mask == (unsigned short)-1)
202 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
203 else
204 alc_update_coefex_idx(codec, fw->nid, fw->idx,
205 fw->mask, fw->val);
206 }
207}
208
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200209/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200210 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100211 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200212
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200213/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200214static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
215{
216 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200217
Takashi Iwai5579cd62018-06-19 22:22:41 +0200218 spec->gpio_mask |= mask;
219 spec->gpio_dir |= mask;
220 spec->gpio_data |= mask;
221}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200222
Takashi Iwai5579cd62018-06-19 22:22:41 +0200223static void alc_write_gpio_data(struct hda_codec *codec)
224{
225 struct alc_spec *spec = codec->spec;
226
227 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
228 spec->gpio_data);
229}
230
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200231static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
232 bool on)
233{
234 struct alc_spec *spec = codec->spec;
235 unsigned int oldval = spec->gpio_data;
236
237 if (on)
238 spec->gpio_data |= mask;
239 else
240 spec->gpio_data &= ~mask;
241 if (oldval != spec->gpio_data)
242 alc_write_gpio_data(codec);
243}
244
Takashi Iwai5579cd62018-06-19 22:22:41 +0200245static void alc_write_gpio(struct hda_codec *codec)
246{
247 struct alc_spec *spec = codec->spec;
248
249 if (!spec->gpio_mask)
250 return;
251
252 snd_hda_codec_write(codec, codec->core.afg, 0,
253 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
254 snd_hda_codec_write(codec, codec->core.afg, 0,
255 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200256 if (spec->gpio_write_delay)
257 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200258 alc_write_gpio_data(codec);
259}
260
261static void alc_fixup_gpio(struct hda_codec *codec, int action,
262 unsigned int mask)
263{
264 if (action == HDA_FIXUP_ACT_PRE_PROBE)
265 alc_setup_gpio(codec, mask);
266}
267
268static void alc_fixup_gpio1(struct hda_codec *codec,
269 const struct hda_fixup *fix, int action)
270{
271 alc_fixup_gpio(codec, action, 0x01);
272}
273
274static void alc_fixup_gpio2(struct hda_codec *codec,
275 const struct hda_fixup *fix, int action)
276{
277 alc_fixup_gpio(codec, action, 0x02);
278}
279
280static void alc_fixup_gpio3(struct hda_codec *codec,
281 const struct hda_fixup *fix, int action)
282{
283 alc_fixup_gpio(codec, action, 0x03);
284}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200285
Takashi Iwaiae065f12018-06-19 23:00:03 +0200286static void alc_fixup_gpio4(struct hda_codec *codec,
287 const struct hda_fixup *fix, int action)
288{
289 alc_fixup_gpio(codec, action, 0x04);
290}
291
Takashi Iwai8a503552020-06-18 13:08:32 +0200292static void alc_fixup_micmute_led(struct hda_codec *codec,
293 const struct hda_fixup *fix, int action)
294{
295 if (action == HDA_FIXUP_ACT_PROBE)
296 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
297}
298
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200299/*
300 * Fix hardware PLL issue
301 * On some codecs, the analog PLL gating control must be off while
302 * the default value is 1.
303 */
304static void alc_fix_pll(struct hda_codec *codec)
305{
306 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200307
Takashi Iwai98b24882014-08-18 13:47:50 +0200308 if (spec->pll_nid)
309 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
310 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200311}
312
313static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
314 unsigned int coef_idx, unsigned int coef_bit)
315{
316 struct alc_spec *spec = codec->spec;
317 spec->pll_nid = nid;
318 spec->pll_coef_idx = coef_idx;
319 spec->pll_coef_bit = coef_bit;
320 alc_fix_pll(codec);
321}
322
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100323/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200324static void alc_update_knob_master(struct hda_codec *codec,
325 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100326{
327 unsigned int val;
328 struct snd_kcontrol *kctl;
329 struct snd_ctl_elem_value *uctl;
330
331 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
332 if (!kctl)
333 return;
334 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
335 if (!uctl)
336 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100337 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100338 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
339 val &= HDA_AMP_VOLMASK;
340 uctl->value.integer.value[0] = val;
341 uctl->value.integer.value[1] = val;
342 kctl->put(kctl, uctl);
343 kfree(uctl);
344}
345
David Henningsson29adc4b2012-09-25 11:31:00 +0200346static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100347{
David Henningsson29adc4b2012-09-25 11:31:00 +0200348 /* For some reason, the res given from ALC880 is broken.
349 Here we adjust it properly. */
350 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100351}
352
Kailang Yang394c97f2014-11-12 17:38:08 +0800353/* Change EAPD to verb control */
354static void alc_fill_eapd_coef(struct hda_codec *codec)
355{
356 int coef;
357
358 coef = alc_get_coef0(codec);
359
Takashi Iwai7639a062015-03-03 10:07:24 +0100360 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800361 case 0x10ec0262:
362 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
363 break;
364 case 0x10ec0267:
365 case 0x10ec0268:
366 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
367 break;
368 case 0x10ec0269:
369 if ((coef & 0x00f0) == 0x0010)
370 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
371 if ((coef & 0x00f0) == 0x0020)
372 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
373 if ((coef & 0x00f0) == 0x0030)
374 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
375 break;
376 case 0x10ec0280:
377 case 0x10ec0284:
378 case 0x10ec0290:
379 case 0x10ec0292:
380 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
381 break;
Kailang Yang42314302016-02-03 15:03:50 +0800382 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100383 case 0x10ec0295:
384 case 0x10ec0299:
385 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -0500386 fallthrough;
Takashi Iwai44be77c2017-12-27 08:53:59 +0100387 case 0x10ec0215:
Kailang Yang394c97f2014-11-12 17:38:08 +0800388 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800389 case 0x10ec0235:
Thomas Hebbc4473742020-03-30 12:09:38 -0400390 case 0x10ec0236:
Kailang Yang7fbdcd82020-04-23 14:18:31 +0800391 case 0x10ec0245:
Kailang Yang394c97f2014-11-12 17:38:08 +0800392 case 0x10ec0255:
Thomas Hebbc4473742020-03-30 12:09:38 -0400393 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800394 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800395 case 0x10ec0282:
396 case 0x10ec0283:
397 case 0x10ec0286:
Kailang Yang630e3612020-05-27 14:10:26 +0800398 case 0x10ec0287:
Kailang Yang394c97f2014-11-12 17:38:08 +0800399 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800400 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800401 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800402 case 0x10ec0289:
Kailang Yang1078bef2018-11-08 16:36:15 +0800403 case 0x10ec0300:
Kailang Yang394c97f2014-11-12 17:38:08 +0800404 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
405 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800406 case 0x10ec0275:
407 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
408 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800409 case 0x10ec0293:
410 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
411 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800412 case 0x10ec0234:
413 case 0x10ec0274:
414 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800415 case 0x10ec0700:
416 case 0x10ec0701:
417 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +0800418 case 0x10ec0711:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800419 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
420 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800421 case 0x10ec0662:
422 if ((coef & 0x00f0) == 0x0030)
423 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
424 break;
425 case 0x10ec0272:
426 case 0x10ec0273:
427 case 0x10ec0663:
428 case 0x10ec0665:
429 case 0x10ec0670:
430 case 0x10ec0671:
431 case 0x10ec0672:
432 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
433 break;
Kailang Yang9194a1e2020-01-07 17:22:19 +0800434 case 0x10ec0222:
Kailang Yangf0778872019-10-24 15:13:32 +0800435 case 0x10ec0623:
436 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
437 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800438 case 0x10ec0668:
439 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
440 break;
441 case 0x10ec0867:
442 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
443 break;
444 case 0x10ec0888:
445 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
446 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
447 break;
448 case 0x10ec0892:
449 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
450 break;
451 case 0x10ec0899:
452 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +0800453 case 0x10ec0b00:
Kailang Yang65553b12017-07-11 15:15:47 +0800454 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800455 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800456 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
457 break;
458 }
459}
460
Kailang Yangf9423e72008-05-27 12:32:25 +0200461/* additional initialization for ALC888 variants */
462static void alc888_coef_init(struct hda_codec *codec)
463{
Kailang Yang1df88742014-10-29 16:10:13 +0800464 switch (alc_get_coef0(codec) & 0x00f0) {
465 /* alc888-VA */
466 case 0x00:
467 /* alc888-VB */
468 case 0x10:
469 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
470 break;
471 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200472}
473
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100474/* turn on/off EAPD control (only if available) */
475static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
476{
477 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
478 return;
479 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
480 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
481 on ? 2 : 0);
482}
483
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200484/* turn on/off EAPD controls of the codec */
485static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
486{
487 /* We currently only handle front, HP */
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100488 static const hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800489 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200490 };
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100491 const hda_nid_t *p;
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200492 for (p = pins; *p; p++)
493 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200494}
495
Kailang Yangdad31972019-05-10 16:28:57 +0800496static int find_ext_mic_pin(struct hda_codec *codec);
497
498static void alc_headset_mic_no_shutup(struct hda_codec *codec)
499{
500 const struct hda_pincfg *pin;
501 int mic_pin = find_ext_mic_pin(codec);
502 int i;
503
504 /* don't shut up pins when unloading the driver; otherwise it breaks
505 * the default pin setup at the next load of the driver
506 */
507 if (codec->bus->shutdown)
508 return;
509
510 snd_array_for_each(&codec->init_pins, i, pin) {
511 /* use read here for syncing after issuing each verb */
512 if (pin->nid != mic_pin)
513 snd_hda_codec_read(codec, pin->nid, 0,
514 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
515 }
516
517 codec->pins_shutup = 1;
518}
519
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100520static void alc_shutup_pins(struct hda_codec *codec)
521{
522 struct alc_spec *spec = codec->spec;
523
Kailang Yangdad31972019-05-10 16:28:57 +0800524 switch (codec->core.vendor_id) {
Kailang Yang66c5d712019-12-09 15:56:15 +0800525 case 0x10ec0283:
Kailang Yangdad31972019-05-10 16:28:57 +0800526 case 0x10ec0286:
527 case 0x10ec0288:
528 case 0x10ec0298:
529 alc_headset_mic_no_shutup(codec);
530 break;
531 default:
532 if (!spec->no_shutup_pins)
533 snd_hda_shutup_pins(codec);
534 break;
535 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100536}
537
Takashi Iwai1c7161532011-04-07 10:37:16 +0200538/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100539 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200540 */
541static void alc_eapd_shutup(struct hda_codec *codec)
542{
Kailang Yang97a26572013-11-29 00:35:26 -0500543 struct alc_spec *spec = codec->spec;
544
Takashi Iwai1c7161532011-04-07 10:37:16 +0200545 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500546 if (!spec->no_depop_delay)
547 msleep(200);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100548 alc_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200549}
550
Takashi Iwai1d045db2011-07-07 18:23:21 +0200551/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200552static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200553{
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200554 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200555 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200556 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200557 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100558 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200559 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200560 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200561 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200562 case 0x10ec0880:
563 case 0x10ec0882:
564 case 0x10ec0883:
565 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800566 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200567 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200568 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200569 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200570 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200571 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200572 break;
573 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200574}
Kailang Yangea1fb292008-08-26 12:58:38 +0200575
Takashi Iwai35a39f92019-02-01 11:19:50 +0100576/* get a primary headphone pin if available */
577static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
578{
579 if (spec->gen.autocfg.hp_pins[0])
580 return spec->gen.autocfg.hp_pins[0];
581 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
582 return spec->gen.autocfg.line_out_pins[0];
583 return 0;
584}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200585
586/*
587 * Realtek SSID verification
588 */
589
David Henningsson90622912010-10-14 14:50:18 +0200590/* Could be any non-zero and even value. When used as fixup, tells
591 * the driver to ignore any present sku defines.
592 */
593#define ALC_FIXUP_SKU_IGNORE (2)
594
Takashi Iwai23d30f22012-05-07 17:17:32 +0200595static void alc_fixup_sku_ignore(struct hda_codec *codec,
596 const struct hda_fixup *fix, int action)
597{
598 struct alc_spec *spec = codec->spec;
599 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
600 spec->cdefine.fixup = 1;
601 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
602 }
603}
604
Mengdong Linb5c66112013-11-29 00:35:35 -0500605static void alc_fixup_no_depop_delay(struct hda_codec *codec,
606 const struct hda_fixup *fix, int action)
607{
608 struct alc_spec *spec = codec->spec;
609
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500610 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500611 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500612 codec->depop_delay = 0;
613 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500614}
615
Kailang Yangda00c242010-03-19 11:23:45 +0100616static int alc_auto_parse_customize_define(struct hda_codec *codec)
617{
618 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100619 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100620 struct alc_spec *spec = codec->spec;
621
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200622 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
623
David Henningsson90622912010-10-14 14:50:18 +0200624 if (spec->cdefine.fixup) {
625 ass = spec->cdefine.sku_cfg;
626 if (ass == ALC_FIXUP_SKU_IGNORE)
627 return -1;
628 goto do_sku;
629 }
630
Takashi Iwai5100cd02014-02-15 10:03:19 +0100631 if (!codec->bus->pci)
632 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100633 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200634 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100635 goto do_sku;
636
637 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100638 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100639 nid = 0x17;
640 ass = snd_hda_codec_get_pincfg(codec, nid);
641
642 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100643 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100644 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100645 return -1;
646 }
647
648 /* check sum */
649 tmp = 0;
650 for (i = 1; i < 16; i++) {
651 if ((ass >> i) & 1)
652 tmp++;
653 }
654 if (((ass >> 16) & 0xf) != tmp)
655 return -1;
656
657 spec->cdefine.port_connectivity = ass >> 30;
658 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
659 spec->cdefine.check_sum = (ass >> 16) & 0xf;
660 spec->cdefine.customization = ass >> 8;
661do_sku:
662 spec->cdefine.sku_cfg = ass;
663 spec->cdefine.external_amp = (ass & 0x38) >> 3;
664 spec->cdefine.platform_type = (ass & 0x4) >> 2;
665 spec->cdefine.swap = (ass & 0x2) >> 1;
666 spec->cdefine.override = ass & 0x1;
667
Takashi Iwai4e76a882014-02-25 12:21:03 +0100668 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100669 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100670 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100671 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100672 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
673 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
674 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
675 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
676 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
677 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
678 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100679
680 return 0;
681}
682
Takashi Iwai08c189f2012-12-19 15:22:24 +0100683/* return the position of NID in the list, or -1 if not found */
684static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
685{
686 int i;
687 for (i = 0; i < nums; i++)
688 if (list[i] == nid)
689 return i;
690 return -1;
691}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200692/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200693static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
694{
Takashi Iwai21268962011-07-07 15:01:13 +0200695 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200696}
697
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200698/* check subsystem ID and set up device-specific initialization;
699 * return 1 if initialized, 0 if invalid SSID
700 */
701/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
702 * 31 ~ 16 : Manufacture ID
703 * 15 ~ 8 : SKU ID
704 * 7 ~ 0 : Assembly ID
705 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
706 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100707static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200708{
709 unsigned int ass, tmp, i;
710 unsigned nid;
711 struct alc_spec *spec = codec->spec;
712
David Henningsson90622912010-10-14 14:50:18 +0200713 if (spec->cdefine.fixup) {
714 ass = spec->cdefine.sku_cfg;
715 if (ass == ALC_FIXUP_SKU_IGNORE)
716 return 0;
717 goto do_sku;
718 }
719
Takashi Iwai7639a062015-03-03 10:07:24 +0100720 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100721 if (codec->bus->pci &&
722 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200723 goto do_sku;
724
725 /* invalid SSID, check the special NID pin defcfg instead */
726 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400727 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200728 * 29~21 : reserve
729 * 20 : PCBEEP input
730 * 19~16 : Check sum (15:1)
731 * 15~1 : Custom
732 * 0 : override
733 */
734 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100735 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200736 nid = 0x17;
737 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100738 codec_dbg(codec,
739 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200740 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100741 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200742 return 0;
743 if ((ass >> 30) != 1) /* no physical connection */
744 return 0;
745
746 /* check sum */
747 tmp = 0;
748 for (i = 1; i < 16; i++) {
749 if ((ass >> i) & 1)
750 tmp++;
751 }
752 if (((ass >> 16) & 0xf) != tmp)
753 return 0;
754do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100755 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100756 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200757 /*
758 * 0 : override
759 * 1 : Swap Jack
760 * 2 : 0 --> Desktop, 1 --> Laptop
761 * 3~5 : External Amplifier control
762 * 7~6 : Reserved
763 */
764 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200765 if (spec->init_amp == ALC_INIT_UNDEFINED) {
766 switch (tmp) {
767 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200768 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200769 break;
770 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200771 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200772 break;
773 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200774 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200775 break;
776 case 5:
777 default:
778 spec->init_amp = ALC_INIT_DEFAULT;
779 break;
780 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200781 }
782
783 /* is laptop or Desktop and enable the function "Mute internal speaker
784 * when the external headphone out jack is plugged"
785 */
786 if (!(ass & 0x8000))
787 return 1;
788 /*
789 * 10~8 : Jack location
790 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
791 * 14~13: Resvered
792 * 15 : 1 --> enable the function "Mute internal speaker
793 * when the external headphone out jack is plugged"
794 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100795 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200796 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200797 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100798 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100799 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
800 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200801 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100802 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200803 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200804 return 1;
805}
Kailang Yangea1fb292008-08-26 12:58:38 +0200806
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200807/* Check the validity of ALC subsystem-id
808 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
809static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200810{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100811 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200812 struct alc_spec *spec = codec->spec;
Takashi Iwai67791202020-04-18 21:06:39 +0200813 if (spec->init_amp == ALC_INIT_UNDEFINED) {
814 codec_dbg(codec,
815 "realtek: Enable default setup for auto mode as fallback\n");
816 spec->init_amp = ALC_INIT_DEFAULT;
817 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200818 }
Takashi Iwai21268962011-07-07 15:01:13 +0200819}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200820
Takashi Iwai41e41f12005-06-08 14:48:49 +0200821/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200822 */
823
David Henningsson9d36a7d2014-10-07 10:18:42 +0200824static void alc_fixup_inv_dmic(struct hda_codec *codec,
825 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200826{
827 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100828
David Henningsson9d36a7d2014-10-07 10:18:42 +0200829 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200830}
831
Takashi Iwai603c4012008-07-30 15:01:44 +0200832
Takashi Iwai2eab6942012-12-18 15:30:41 +0100833static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200835 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836
Takashi Iwai08c189f2012-12-19 15:22:24 +0100837 err = snd_hda_gen_build_controls(codec);
838 if (err < 0)
839 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840
Takashi Iwai1727a772013-01-10 09:52:52 +0100841 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100842 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700843}
844
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200845
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100847 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200848 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200849
Takashi Iwaic9af7532019-05-10 11:01:43 +0200850static void alc_pre_init(struct hda_codec *codec)
851{
852 alc_fill_eapd_coef(codec);
853}
854
Kailang Yangaeac1a02019-05-16 16:10:44 +0800855#define is_s3_resume(codec) \
856 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
Takashi Iwaic9af7532019-05-10 11:01:43 +0200857#define is_s4_resume(codec) \
858 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
859
Linus Torvalds1da177e2005-04-16 15:20:36 -0700860static int alc_init(struct hda_codec *codec)
861{
862 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200863
Takashi Iwaic9af7532019-05-10 11:01:43 +0200864 /* hibernation resume needs the full chip initialization */
865 if (is_s4_resume(codec))
866 alc_pre_init(codec);
867
Takashi Iwai546bb672012-03-07 08:37:19 +0100868 if (spec->init_hook)
869 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100870
Takashi Iwai89781d02019-08-30 12:03:38 +0200871 spec->gen.skip_verbs = 1; /* applied in below */
Kailang Yang607ca3b2019-04-26 16:35:41 +0800872 snd_hda_gen_init(codec);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200873 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200874 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai89781d02019-08-30 12:03:38 +0200875 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200876
Takashi Iwai1727a772013-01-10 09:52:52 +0100877 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200878
Linus Torvalds1da177e2005-04-16 15:20:36 -0700879 return 0;
880}
881
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100882static inline void alc_shutup(struct hda_codec *codec)
883{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200884 struct alc_spec *spec = codec->spec;
885
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200886 if (!snd_hda_get_bool_hint(codec, "shutup"))
887 return; /* disabled explicitly by hints */
888
Takashi Iwai1c7161532011-04-07 10:37:16 +0200889 if (spec && spec->shutup)
890 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200891 else
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100892 alc_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100893}
894
Takashi Iwai70a09762015-12-15 14:59:58 +0100895static void alc_reboot_notify(struct hda_codec *codec)
896{
897 struct alc_spec *spec = codec->spec;
898
899 if (spec && spec->reboot_notify)
900 spec->reboot_notify(codec);
901 else
902 alc_shutup(codec);
903}
904
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100905#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700906
Takashi Iwai83012a72012-08-24 18:38:08 +0200907#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500908static void alc_power_eapd(struct hda_codec *codec)
909{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200910 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500911}
912
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200913static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100914{
915 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100916 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100917 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500918 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100919 return 0;
920}
921#endif
922
Takashi Iwai2a439522011-07-26 09:52:50 +0200923#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100924static int alc_resume(struct hda_codec *codec)
925{
Kailang Yang97a26572013-11-29 00:35:26 -0500926 struct alc_spec *spec = codec->spec;
927
928 if (!spec->no_depop_delay)
929 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100930 codec->patch_ops.init(codec);
Takashi Iwai1a462be2020-01-09 10:01:04 +0100931 snd_hda_regmap_sync(codec);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200932 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100933 return 0;
934}
Takashi Iwaie044c392008-10-27 16:56:24 +0100935#endif
936
Linus Torvalds1da177e2005-04-16 15:20:36 -0700937/*
938 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200939static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700940 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100941 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700942 .init = alc_init,
943 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200944 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200945#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100946 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100947 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100948 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200949#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100950 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700951};
952
David Henningsson29adc4b2012-09-25 11:31:00 +0200953
Takashi Iwaided255b2015-10-01 17:59:43 +0200954#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100955
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200956/*
Kailang Yang4b016932013-11-28 11:55:09 +0100957 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200958 */
959struct alc_codec_rename_table {
960 unsigned int vendor_id;
961 unsigned short coef_mask;
962 unsigned short coef_bits;
963 const char *name;
964};
965
Kailang Yang4b016932013-11-28 11:55:09 +0100966struct alc_codec_rename_pci_table {
967 unsigned int codec_vendor_id;
968 unsigned short pci_subvendor;
969 unsigned short pci_subdevice;
970 const char *name;
971};
972
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100973static const struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800974 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200975 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
976 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
977 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
978 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
979 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
980 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
981 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200982 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800983 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200984 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
985 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
986 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
987 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
988 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
989 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
990 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
991 { } /* terminator */
992};
993
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100994static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
Kailang Yang4b016932013-11-28 11:55:09 +0100995 { 0x10ec0280, 0x1028, 0, "ALC3220" },
996 { 0x10ec0282, 0x1028, 0, "ALC3221" },
997 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800998 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +0100999 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +08001000 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +01001001 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1002 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001003 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1004 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +08001005 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +08001006 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +08001007 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +08001008 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +08001009 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +08001010 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001011 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1012 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1013 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1014 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1015 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1016 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1017 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1018 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1019 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1020 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1021 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +01001022 { } /* terminator */
1023};
1024
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001025static int alc_codec_rename_from_preset(struct hda_codec *codec)
1026{
1027 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +01001028 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001029
1030 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001031 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001032 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02001033 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001034 return alc_codec_rename(codec, p->name);
1035 }
Kailang Yang4b016932013-11-28 11:55:09 +01001036
Takashi Iwai5100cd02014-02-15 10:03:19 +01001037 if (!codec->bus->pci)
1038 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +01001039 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001040 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +01001041 continue;
1042 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1043 continue;
1044 if (!q->pci_subdevice ||
1045 q->pci_subdevice == codec->bus->pci->subsystem_device)
1046 return alc_codec_rename(codec, q->name);
1047 }
1048
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001049 return 0;
1050}
1051
Takashi Iwaie4770622011-07-08 11:11:35 +02001052
1053/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001054 * Digital-beep handlers
1055 */
1056#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001057
1058/* additional beep mixers; private_value will be overwritten */
1059static const struct snd_kcontrol_new alc_beep_mixer[] = {
1060 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1061 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1062};
1063
1064/* set up and create beep controls */
1065static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1066 int idx, int dir)
1067{
1068 struct snd_kcontrol_new *knew;
1069 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1070 int i;
1071
1072 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1073 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1074 &alc_beep_mixer[i]);
1075 if (!knew)
1076 return -ENOMEM;
1077 knew->private_value = beep_amp;
1078 }
1079 return 0;
1080}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001081
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001082static const struct snd_pci_quirk beep_allow_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001083 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001084 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001085 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001086 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001087 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1088 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1089 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001090 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001091 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001092 /* denylist -- no beep available */
Takashi Iwai051c78a2019-08-22 09:58:07 +02001093 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1094 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001095 {}
1096};
1097
1098static inline int has_cdefine_beep(struct hda_codec *codec)
1099{
1100 struct alc_spec *spec = codec->spec;
1101 const struct snd_pci_quirk *q;
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001102 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001103 if (q)
1104 return q->value;
1105 return spec->cdefine.enable_pcbeep;
1106}
1107#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001108#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001109#define has_cdefine_beep(codec) 0
1110#endif
1111
1112/* parse the BIOS configuration and set up the alc_spec */
1113/* return 1 if successful, 0 if the proper config is not found,
1114 * or a negative error code
1115 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001116static int alc_parse_auto_config(struct hda_codec *codec,
1117 const hda_nid_t *ignore_nids,
1118 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001119{
1120 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001121 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001122 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001123
Takashi Iwai53c334a2011-08-23 18:27:14 +02001124 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1125 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001126 if (err < 0)
1127 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001128
1129 if (ssid_nids)
1130 alc_ssid_check(codec, ssid_nids);
1131
Takashi Iwai08c189f2012-12-19 15:22:24 +01001132 err = snd_hda_gen_parse_auto_config(codec, cfg);
1133 if (err < 0)
1134 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001135
Takashi Iwai1d045db2011-07-07 18:23:21 +02001136 return 1;
1137}
1138
Takashi Iwai3de95172012-05-07 18:03:15 +02001139/* common preparation job for alc_spec */
1140static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1141{
1142 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1143 int err;
1144
1145 if (!spec)
1146 return -ENOMEM;
1147 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001148 snd_hda_gen_spec_init(&spec->gen);
1149 spec->gen.mixer_nid = mixer_nid;
1150 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001151 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001152 /* FIXME: do we need this for all Realtek codec models? */
1153 codec->spdif_status_reset = 1;
Kai Vehmanena6e7d0a2020-10-12 13:27:04 +03001154 codec->forced_resume = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001155 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001156
1157 err = alc_codec_rename_from_preset(codec);
1158 if (err < 0) {
1159 kfree(spec);
1160 return err;
1161 }
1162 return 0;
1163}
1164
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001165static int alc880_parse_auto_config(struct hda_codec *codec)
1166{
1167 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001168 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001169 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1170}
1171
Takashi Iwai1d045db2011-07-07 18:23:21 +02001172/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001173 * ALC880 fix-ups
1174 */
1175enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001176 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001177 ALC880_FIXUP_GPIO2,
1178 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001179 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001180 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001181 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001182 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001183 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001184 ALC880_FIXUP_VOL_KNOB,
1185 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001186 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001187 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001188 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001189 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001190 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001191 ALC880_FIXUP_3ST_BASE,
1192 ALC880_FIXUP_3ST,
1193 ALC880_FIXUP_3ST_DIG,
1194 ALC880_FIXUP_5ST_BASE,
1195 ALC880_FIXUP_5ST,
1196 ALC880_FIXUP_5ST_DIG,
1197 ALC880_FIXUP_6ST_BASE,
1198 ALC880_FIXUP_6ST,
1199 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001200 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001201};
1202
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001203/* enable the volume-knob widget support on NID 0x21 */
1204static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001205 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001206{
Takashi Iwai1727a772013-01-10 09:52:52 +01001207 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001208 snd_hda_jack_detect_enable_callback(codec, 0x21,
1209 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001210}
1211
Takashi Iwai1727a772013-01-10 09:52:52 +01001212static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001213 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001214 .type = HDA_FIXUP_FUNC,
1215 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001216 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001217 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001218 .type = HDA_FIXUP_FUNC,
1219 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001220 },
1221 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001222 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001223 .v.verbs = (const struct hda_verb[]) {
1224 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1225 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1226 { }
1227 },
1228 .chained = true,
1229 .chain_id = ALC880_FIXUP_GPIO2,
1230 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001231 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001232 .type = HDA_FIXUP_PINS,
1233 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001234 /* disable bogus unused pins */
1235 { 0x16, 0x411111f0 },
1236 { 0x18, 0x411111f0 },
1237 { 0x1a, 0x411111f0 },
1238 { }
1239 }
1240 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001241 [ALC880_FIXUP_LG_LW25] = {
1242 .type = HDA_FIXUP_PINS,
1243 .v.pins = (const struct hda_pintbl[]) {
1244 { 0x1a, 0x0181344f }, /* line-in */
1245 { 0x1b, 0x0321403f }, /* headphone */
1246 { }
1247 }
1248 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001249 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001250 .type = HDA_FIXUP_PINS,
1251 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001252 /* disable bogus unused pins */
1253 { 0x17, 0x411111f0 },
1254 { }
1255 },
1256 .chained = true,
1257 .chain_id = ALC880_FIXUP_GPIO2,
1258 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001259 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001260 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001261 .v.verbs = (const struct hda_verb[]) {
1262 /* change to EAPD mode */
1263 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1264 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1265 {}
1266 },
1267 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001268 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001269 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001270 .v.verbs = (const struct hda_verb[]) {
1271 /* change to EAPD mode */
1272 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1273 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1274 {}
1275 },
1276 .chained = true,
1277 .chain_id = ALC880_FIXUP_GPIO2,
1278 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001279 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001280 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001281 .v.func = alc880_fixup_vol_knob,
1282 },
1283 [ALC880_FIXUP_FUJITSU] = {
1284 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001285 .type = HDA_FIXUP_PINS,
1286 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001287 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001288 { 0x15, 0x99030120 }, /* speaker */
1289 { 0x16, 0x99030130 }, /* bass speaker */
1290 { 0x17, 0x411111f0 }, /* N/A */
1291 { 0x18, 0x411111f0 }, /* N/A */
1292 { 0x19, 0x01a19950 }, /* mic-in */
1293 { 0x1a, 0x411111f0 }, /* N/A */
1294 { 0x1b, 0x411111f0 }, /* N/A */
1295 { 0x1c, 0x411111f0 }, /* N/A */
1296 { 0x1d, 0x411111f0 }, /* N/A */
1297 { 0x1e, 0x01454140 }, /* SPDIF out */
1298 { }
1299 },
1300 .chained = true,
1301 .chain_id = ALC880_FIXUP_VOL_KNOB,
1302 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001303 [ALC880_FIXUP_F1734] = {
1304 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001305 .type = HDA_FIXUP_PINS,
1306 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001307 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001308 { 0x15, 0x99030120 }, /* speaker */
1309 { 0x16, 0x411111f0 }, /* N/A */
1310 { 0x17, 0x411111f0 }, /* N/A */
1311 { 0x18, 0x411111f0 }, /* N/A */
1312 { 0x19, 0x01a19950 }, /* mic-in */
1313 { 0x1a, 0x411111f0 }, /* N/A */
1314 { 0x1b, 0x411111f0 }, /* N/A */
1315 { 0x1c, 0x411111f0 }, /* N/A */
1316 { 0x1d, 0x411111f0 }, /* N/A */
1317 { 0x1e, 0x411111f0 }, /* N/A */
1318 { }
1319 },
1320 .chained = true,
1321 .chain_id = ALC880_FIXUP_VOL_KNOB,
1322 },
Takashi Iwai817de922012-02-20 17:20:48 +01001323 [ALC880_FIXUP_UNIWILL] = {
1324 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001325 .type = HDA_FIXUP_PINS,
1326 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001327 { 0x14, 0x0121411f }, /* HP */
1328 { 0x15, 0x99030120 }, /* speaker */
1329 { 0x16, 0x99030130 }, /* bass speaker */
1330 { }
1331 },
1332 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001333 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001334 .type = HDA_FIXUP_PINS,
1335 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001336 /* disable bogus unused pins */
1337 { 0x17, 0x411111f0 },
1338 { 0x19, 0x411111f0 },
1339 { 0x1b, 0x411111f0 },
1340 { 0x1f, 0x411111f0 },
1341 { }
1342 }
1343 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001344 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001345 .type = HDA_FIXUP_PINS,
1346 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001347 /* set up the whole pins as BIOS is utterly broken */
1348 { 0x14, 0x99030120 }, /* speaker */
1349 { 0x15, 0x0121411f }, /* HP */
1350 { 0x16, 0x411111f0 }, /* N/A */
1351 { 0x17, 0x411111f0 }, /* N/A */
1352 { 0x18, 0x01a19950 }, /* mic-in */
1353 { 0x19, 0x411111f0 }, /* N/A */
1354 { 0x1a, 0x01813031 }, /* line-in */
1355 { 0x1b, 0x411111f0 }, /* N/A */
1356 { 0x1c, 0x411111f0 }, /* N/A */
1357 { 0x1d, 0x411111f0 }, /* N/A */
1358 { 0x1e, 0x0144111e }, /* SPDIF */
1359 { }
1360 }
1361 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001362 [ALC880_FIXUP_ASUS_W5A] = {
1363 .type = HDA_FIXUP_PINS,
1364 .v.pins = (const struct hda_pintbl[]) {
1365 /* set up the whole pins as BIOS is utterly broken */
1366 { 0x14, 0x0121411f }, /* HP */
1367 { 0x15, 0x411111f0 }, /* N/A */
1368 { 0x16, 0x411111f0 }, /* N/A */
1369 { 0x17, 0x411111f0 }, /* N/A */
1370 { 0x18, 0x90a60160 }, /* mic */
1371 { 0x19, 0x411111f0 }, /* N/A */
1372 { 0x1a, 0x411111f0 }, /* N/A */
1373 { 0x1b, 0x411111f0 }, /* N/A */
1374 { 0x1c, 0x411111f0 }, /* N/A */
1375 { 0x1d, 0x411111f0 }, /* N/A */
1376 { 0x1e, 0xb743111e }, /* SPDIF out */
1377 { }
1378 },
1379 .chained = true,
1380 .chain_id = ALC880_FIXUP_GPIO1,
1381 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001382 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001383 .type = HDA_FIXUP_PINS,
1384 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001385 { 0x14, 0x01014010 }, /* line-out */
1386 { 0x15, 0x411111f0 }, /* N/A */
1387 { 0x16, 0x411111f0 }, /* N/A */
1388 { 0x17, 0x411111f0 }, /* N/A */
1389 { 0x18, 0x01a19c30 }, /* mic-in */
1390 { 0x19, 0x0121411f }, /* HP */
1391 { 0x1a, 0x01813031 }, /* line-in */
1392 { 0x1b, 0x02a19c40 }, /* front-mic */
1393 { 0x1c, 0x411111f0 }, /* N/A */
1394 { 0x1d, 0x411111f0 }, /* N/A */
1395 /* 0x1e is filled in below */
1396 { 0x1f, 0x411111f0 }, /* N/A */
1397 { }
1398 }
1399 },
1400 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001401 .type = HDA_FIXUP_PINS,
1402 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001403 { 0x1e, 0x411111f0 }, /* N/A */
1404 { }
1405 },
1406 .chained = true,
1407 .chain_id = ALC880_FIXUP_3ST_BASE,
1408 },
1409 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001410 .type = HDA_FIXUP_PINS,
1411 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001412 { 0x1e, 0x0144111e }, /* SPDIF */
1413 { }
1414 },
1415 .chained = true,
1416 .chain_id = ALC880_FIXUP_3ST_BASE,
1417 },
1418 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001419 .type = HDA_FIXUP_PINS,
1420 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001421 { 0x14, 0x01014010 }, /* front */
1422 { 0x15, 0x411111f0 }, /* N/A */
1423 { 0x16, 0x01011411 }, /* CLFE */
1424 { 0x17, 0x01016412 }, /* surr */
1425 { 0x18, 0x01a19c30 }, /* mic-in */
1426 { 0x19, 0x0121411f }, /* HP */
1427 { 0x1a, 0x01813031 }, /* line-in */
1428 { 0x1b, 0x02a19c40 }, /* front-mic */
1429 { 0x1c, 0x411111f0 }, /* N/A */
1430 { 0x1d, 0x411111f0 }, /* N/A */
1431 /* 0x1e is filled in below */
1432 { 0x1f, 0x411111f0 }, /* N/A */
1433 { }
1434 }
1435 },
1436 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001437 .type = HDA_FIXUP_PINS,
1438 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001439 { 0x1e, 0x411111f0 }, /* N/A */
1440 { }
1441 },
1442 .chained = true,
1443 .chain_id = ALC880_FIXUP_5ST_BASE,
1444 },
1445 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001446 .type = HDA_FIXUP_PINS,
1447 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001448 { 0x1e, 0x0144111e }, /* SPDIF */
1449 { }
1450 },
1451 .chained = true,
1452 .chain_id = ALC880_FIXUP_5ST_BASE,
1453 },
1454 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001455 .type = HDA_FIXUP_PINS,
1456 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001457 { 0x14, 0x01014010 }, /* front */
1458 { 0x15, 0x01016412 }, /* surr */
1459 { 0x16, 0x01011411 }, /* CLFE */
1460 { 0x17, 0x01012414 }, /* side */
1461 { 0x18, 0x01a19c30 }, /* mic-in */
1462 { 0x19, 0x02a19c40 }, /* front-mic */
1463 { 0x1a, 0x01813031 }, /* line-in */
1464 { 0x1b, 0x0121411f }, /* HP */
1465 { 0x1c, 0x411111f0 }, /* N/A */
1466 { 0x1d, 0x411111f0 }, /* N/A */
1467 /* 0x1e is filled in below */
1468 { 0x1f, 0x411111f0 }, /* N/A */
1469 { }
1470 }
1471 },
1472 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001473 .type = HDA_FIXUP_PINS,
1474 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001475 { 0x1e, 0x411111f0 }, /* N/A */
1476 { }
1477 },
1478 .chained = true,
1479 .chain_id = ALC880_FIXUP_6ST_BASE,
1480 },
1481 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001482 .type = HDA_FIXUP_PINS,
1483 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001484 { 0x1e, 0x0144111e }, /* SPDIF */
1485 { }
1486 },
1487 .chained = true,
1488 .chain_id = ALC880_FIXUP_6ST_BASE,
1489 },
Takashi Iwai53971452013-01-23 18:21:37 +01001490 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1491 .type = HDA_FIXUP_PINS,
1492 .v.pins = (const struct hda_pintbl[]) {
1493 { 0x1b, 0x0121401f }, /* HP with jack detect */
1494 { }
1495 },
1496 .chained_before = true,
1497 .chain_id = ALC880_FIXUP_6ST_BASE,
1498 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001499};
1500
1501static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001502 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001503 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001504 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001505 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001506 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001507 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001508 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001509 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001510 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001511 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001512 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001513 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001514 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001515 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001516 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001517 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001518 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001519 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001520 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1521 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1522 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001523 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001524 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001525
1526 /* Below is the copied entries from alc880_quirks.c.
1527 * It's not quite sure whether BIOS sets the correct pin-config table
1528 * on these machines, thus they are kept to be compatible with
1529 * the old static quirks. Once when it's confirmed to work without
1530 * these overrides, it'd be better to remove.
1531 */
1532 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1533 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1534 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1535 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1536 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1537 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1538 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1539 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1540 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1541 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1542 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1543 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1544 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1545 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1546 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1547 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1548 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1549 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1550 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1551 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1552 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1553 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1554 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1555 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1556 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1557 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1558 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1560 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1561 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1563 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1564 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1565 /* default Intel */
1566 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1567 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1568 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1569 {}
1570};
1571
Takashi Iwai1727a772013-01-10 09:52:52 +01001572static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001573 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1574 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1575 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1576 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1577 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1578 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001579 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001580 {}
1581};
1582
1583
1584/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001585 * OK, here we have finally the patch for ALC880
1586 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001587static int patch_alc880(struct hda_codec *codec)
1588{
1589 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001590 int err;
1591
Takashi Iwai3de95172012-05-07 18:03:15 +02001592 err = alc_alloc_spec(codec, 0x0b);
1593 if (err < 0)
1594 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001595
Takashi Iwai3de95172012-05-07 18:03:15 +02001596 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001597 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001598 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001599
Takashi Iwai225068a2015-05-29 10:42:14 +02001600 codec->patch_ops.unsol_event = alc880_unsol_event;
1601
Takashi Iwaic9af7532019-05-10 11:01:43 +02001602 alc_pre_init(codec);
1603
Takashi Iwai1727a772013-01-10 09:52:52 +01001604 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001605 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001606 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001607
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001608 /* automatic parse from the BIOS config */
1609 err = alc880_parse_auto_config(codec);
1610 if (err < 0)
1611 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001612
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001613 if (!spec->gen.no_analog) {
1614 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1615 if (err < 0)
1616 goto error;
1617 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001618
Takashi Iwai1727a772013-01-10 09:52:52 +01001619 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001620
Takashi Iwai1d045db2011-07-07 18:23:21 +02001621 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001622
1623 error:
1624 alc_free(codec);
1625 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001626}
1627
1628
1629/*
1630 * ALC260 support
1631 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001632static int alc260_parse_auto_config(struct hda_codec *codec)
1633{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001634 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001635 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1636 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001637}
1638
Takashi Iwai1d045db2011-07-07 18:23:21 +02001639/*
1640 * Pin config fixes
1641 */
1642enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001643 ALC260_FIXUP_HP_DC5750,
1644 ALC260_FIXUP_HP_PIN_0F,
1645 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001646 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001647 ALC260_FIXUP_GPIO1_TOGGLE,
1648 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001649 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001650 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001651 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001652 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001653 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001654};
1655
Takashi Iwai20f7d922012-02-16 12:35:16 +01001656static void alc260_gpio1_automute(struct hda_codec *codec)
1657{
1658 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001659
1660 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001661}
1662
1663static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001664 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001665{
1666 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001667 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001668 /* although the machine has only one output pin, we need to
1669 * toggle GPIO1 according to the jack state
1670 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001671 spec->gen.automute_hook = alc260_gpio1_automute;
1672 spec->gen.detect_hp = 1;
1673 spec->gen.automute_speaker = 1;
1674 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001675 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001676 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001677 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001678 }
1679}
1680
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001681static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001682 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001683{
1684 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001685 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001686 { 0x0f, 0x02214000 }, /* HP/speaker */
1687 { 0x12, 0x90a60160 }, /* int mic */
1688 { 0x13, 0x02a19000 }, /* ext mic */
1689 { 0x18, 0x01446000 }, /* SPDIF out */
1690 /* disable bogus I/O pins */
1691 { 0x10, 0x411111f0 },
1692 { 0x11, 0x411111f0 },
1693 { 0x14, 0x411111f0 },
1694 { 0x15, 0x411111f0 },
1695 { 0x16, 0x411111f0 },
1696 { 0x17, 0x411111f0 },
1697 { 0x19, 0x411111f0 },
1698 { }
1699 };
1700
1701 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001702 case HDA_FIXUP_ACT_PRE_PROBE:
1703 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001704 spec->init_amp = ALC_INIT_NONE;
1705 break;
1706 }
1707}
1708
Takashi Iwai39aedee2013-01-10 17:10:40 +01001709static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1710 const struct hda_fixup *fix, int action)
1711{
1712 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001713 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001714 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001715}
1716
1717static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1718 const struct hda_fixup *fix, int action)
1719{
1720 struct alc_spec *spec = codec->spec;
1721 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001722 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001723 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001724 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001725}
1726
Takashi Iwai1727a772013-01-10 09:52:52 +01001727static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001728 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001729 .type = HDA_FIXUP_PINS,
1730 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001731 { 0x11, 0x90130110 }, /* speaker */
1732 { }
1733 }
1734 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001735 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001736 .type = HDA_FIXUP_PINS,
1737 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001738 { 0x0f, 0x01214000 }, /* HP */
1739 { }
1740 }
1741 },
1742 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001743 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001744 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001745 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1746 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001747 { }
1748 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001749 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001750 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001751 .type = HDA_FIXUP_FUNC,
1752 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001753 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001754 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001755 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001756 .v.func = alc260_fixup_gpio1_toggle,
1757 .chained = true,
1758 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1759 },
1760 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001761 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001762 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001763 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1764 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001765 { }
1766 },
1767 .chained = true,
1768 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1769 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001770 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001771 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001772 .v.func = alc260_fixup_gpio1_toggle,
1773 .chained = true,
1774 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001775 },
1776 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001777 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001778 .v.func = alc260_fixup_kn1,
1779 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001780 [ALC260_FIXUP_FSC_S7020] = {
1781 .type = HDA_FIXUP_FUNC,
1782 .v.func = alc260_fixup_fsc_s7020,
1783 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001784 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1785 .type = HDA_FIXUP_FUNC,
1786 .v.func = alc260_fixup_fsc_s7020_jwse,
1787 .chained = true,
1788 .chain_id = ALC260_FIXUP_FSC_S7020,
1789 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001790 [ALC260_FIXUP_VAIO_PINS] = {
1791 .type = HDA_FIXUP_PINS,
1792 .v.pins = (const struct hda_pintbl[]) {
1793 /* Pin configs are missing completely on some VAIOs */
1794 { 0x0f, 0x01211020 },
1795 { 0x10, 0x0001003f },
1796 { 0x11, 0x411111f0 },
1797 { 0x12, 0x01a15930 },
1798 { 0x13, 0x411111f0 },
1799 { 0x14, 0x411111f0 },
1800 { 0x15, 0x411111f0 },
1801 { 0x16, 0x411111f0 },
1802 { 0x17, 0x411111f0 },
1803 { 0x18, 0x411111f0 },
1804 { 0x19, 0x411111f0 },
1805 { }
1806 }
1807 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001808};
1809
1810static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001811 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001812 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001813 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001814 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001815 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001816 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001817 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001818 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001819 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001820 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001821 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001822 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001823 {}
1824};
1825
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001826static const struct hda_model_fixup alc260_fixup_models[] = {
1827 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1828 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1829 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1830 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1831 {}
1832};
1833
Takashi Iwai1d045db2011-07-07 18:23:21 +02001834/*
1835 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001836static int patch_alc260(struct hda_codec *codec)
1837{
1838 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001839 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001840
Takashi Iwai3de95172012-05-07 18:03:15 +02001841 err = alc_alloc_spec(codec, 0x07);
1842 if (err < 0)
1843 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001844
Takashi Iwai3de95172012-05-07 18:03:15 +02001845 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001846 /* as quite a few machines require HP amp for speaker outputs,
1847 * it's easier to enable it unconditionally; even if it's unneeded,
1848 * it's almost harmless.
1849 */
1850 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001851 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001852
Takashi Iwai225068a2015-05-29 10:42:14 +02001853 spec->shutup = alc_eapd_shutup;
1854
Takashi Iwaic9af7532019-05-10 11:01:43 +02001855 alc_pre_init(codec);
1856
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001857 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1858 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001859 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001860
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001861 /* automatic parse from the BIOS config */
1862 err = alc260_parse_auto_config(codec);
1863 if (err < 0)
1864 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001865
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001866 if (!spec->gen.no_analog) {
1867 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1868 if (err < 0)
1869 goto error;
1870 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001871
Takashi Iwai1727a772013-01-10 09:52:52 +01001872 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001873
Takashi Iwai1d045db2011-07-07 18:23:21 +02001874 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001875
1876 error:
1877 alc_free(codec);
1878 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001879}
1880
1881
1882/*
1883 * ALC882/883/885/888/889 support
1884 *
1885 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1886 * configuration. Each pin widget can choose any input DACs and a mixer.
1887 * Each ADC is connected from a mixer of all inputs. This makes possible
1888 * 6-channel independent captures.
1889 *
1890 * In addition, an independent DAC for the multi-playback (not used in this
1891 * driver yet).
1892 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001893
1894/*
1895 * Pin config fixes
1896 */
1897enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001898 ALC882_FIXUP_ABIT_AW9D_MAX,
1899 ALC882_FIXUP_LENOVO_Y530,
1900 ALC882_FIXUP_PB_M5210,
1901 ALC882_FIXUP_ACER_ASPIRE_7736,
1902 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001903 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001904 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001905 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001906 ALC888_FIXUP_EEE1601,
Takashi Iwai177943a32011-11-09 12:55:18 +01001907 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001908 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001909 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001910 ALC882_FIXUP_GPIO1,
1911 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001912 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001913 ALC889_FIXUP_COEF,
1914 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001915 ALC882_FIXUP_ACER_ASPIRE_4930G,
1916 ALC882_FIXUP_ACER_ASPIRE_8930G,
1917 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001918 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001919 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001920 ALC889_FIXUP_MBP_VREF,
1921 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001922 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001923 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001924 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001925 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001926 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001927 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001928 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001929 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001930 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001931 ALC1220_FIXUP_CLEVO_P950,
Richard Sailer80690a22019-04-02 15:52:04 +02001932 ALC1220_FIXUP_CLEVO_PB51ED,
1933 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Jian-Hong Panca184352020-10-07 13:22:25 +08001934 ALC887_FIXUP_ASUS_AUDIO,
1935 ALC887_FIXUP_ASUS_HMIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001936};
1937
Takashi Iwai68ef0562011-11-09 18:24:44 +01001938static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001939 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001940{
Takashi Iwai1727a772013-01-10 09:52:52 +01001941 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001942 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001943 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001944}
1945
Takashi Iwai56710872011-11-14 17:42:11 +01001946/* set up GPIO at initialization */
1947static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001948 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001949{
Takashi Iwai215c8502018-06-19 22:34:26 +02001950 struct alc_spec *spec = codec->spec;
1951
1952 spec->gpio_write_delay = true;
1953 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001954}
1955
Takashi Iwai02a237b2012-02-13 15:25:07 +01001956/* Fix the connection of some pins for ALC889:
1957 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1958 * work correctly (bko#42740)
1959 */
1960static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001961 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001962{
Takashi Iwai1727a772013-01-10 09:52:52 +01001963 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001964 /* fake the connections during parsing the tree */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001965 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1966 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1967 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1968 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1969 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1970 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001971 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001972 /* restore the connections */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001973 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1974 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1975 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1976 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1977 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001978 }
1979}
1980
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001981/* Set VREF on HP pin */
1982static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001983 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001984{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001985 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001986 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001987 int i;
1988
Takashi Iwai1727a772013-01-10 09:52:52 +01001989 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001990 return;
1991 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1992 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1993 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1994 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001995 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001996 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001997 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001998 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001999 break;
2000 }
2001}
2002
Takashi Iwai0756f092013-12-04 13:59:45 +01002003static void alc889_fixup_mac_pins(struct hda_codec *codec,
2004 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002005{
2006 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002007 int i;
2008
Takashi Iwai0756f092013-12-04 13:59:45 +01002009 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002010 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002011 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002012 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002013 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002014 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01002015 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002016}
2017
Takashi Iwai0756f092013-12-04 13:59:45 +01002018/* Set VREF on speaker pins on imac91 */
2019static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2020 const struct hda_fixup *fix, int action)
2021{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002022 static const hda_nid_t nids[] = { 0x18, 0x1a };
Takashi Iwai0756f092013-12-04 13:59:45 +01002023
2024 if (action == HDA_FIXUP_ACT_INIT)
2025 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2026}
2027
Adrien Vergée7729a42014-01-24 14:56:14 -05002028/* Set VREF on speaker pins on mba11 */
2029static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2030 const struct hda_fixup *fix, int action)
2031{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002032 static const hda_nid_t nids[] = { 0x18 };
Adrien Vergée7729a42014-01-24 14:56:14 -05002033
2034 if (action == HDA_FIXUP_ACT_INIT)
2035 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2036}
2037
Takashi Iwai0756f092013-12-04 13:59:45 +01002038/* Set VREF on speaker pins on mba21 */
2039static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2040 const struct hda_fixup *fix, int action)
2041{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002042 static const hda_nid_t nids[] = { 0x18, 0x19 };
Takashi Iwai0756f092013-12-04 13:59:45 +01002043
2044 if (action == HDA_FIXUP_ACT_INIT)
2045 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2046}
2047
Takashi Iwaie427c232012-07-29 10:04:08 +02002048/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09002049 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2050 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02002051 */
2052static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002053 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02002054{
2055 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002056 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002057 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002058 spec->gen.no_multi_io = 1;
2059 }
Takashi Iwaie427c232012-07-29 10:04:08 +02002060}
2061
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002062static void alc_fixup_bass_chmap(struct hda_codec *codec,
2063 const struct hda_fixup *fix, int action);
2064
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002065/* For dual-codec configuration, we need to disable some features to avoid
2066 * conflicts of kctls and PCM streams
2067 */
2068static void alc_fixup_dual_codecs(struct hda_codec *codec,
2069 const struct hda_fixup *fix, int action)
2070{
2071 struct alc_spec *spec = codec->spec;
2072
2073 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2074 return;
2075 /* disable vmaster */
2076 spec->gen.suppress_vmaster = 1;
2077 /* auto-mute and auto-mic switch don't work with multiple codecs */
2078 spec->gen.suppress_auto_mute = 1;
2079 spec->gen.suppress_auto_mic = 1;
2080 /* disable aamix as well */
2081 spec->gen.mixer_nid = 0;
2082 /* add location prefix to avoid conflicts */
2083 codec->force_pin_prefix = 1;
2084}
2085
2086static void rename_ctl(struct hda_codec *codec, const char *oldname,
2087 const char *newname)
2088{
2089 struct snd_kcontrol *kctl;
2090
2091 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2092 if (kctl)
2093 strcpy(kctl->id.name, newname);
2094}
2095
2096static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2097 const struct hda_fixup *fix,
2098 int action)
2099{
2100 alc_fixup_dual_codecs(codec, fix, action);
2101 switch (action) {
2102 case HDA_FIXUP_ACT_PRE_PROBE:
2103 /* override card longname to provide a unique UCM profile */
2104 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2105 break;
2106 case HDA_FIXUP_ACT_BUILD:
2107 /* rename Capture controls depending on the codec */
2108 rename_ctl(codec, "Capture Volume",
2109 codec->addr == 0 ?
2110 "Rear-Panel Capture Volume" :
2111 "Front-Panel Capture Volume");
2112 rename_ctl(codec, "Capture Switch",
2113 codec->addr == 0 ?
2114 "Rear-Panel Capture Switch" :
2115 "Front-Panel Capture Switch");
2116 break;
2117 }
2118}
2119
Peisen0202f5c2017-10-26 10:35:36 +08002120static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2121 const struct hda_fixup *fix,
2122 int action)
2123{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002124 static const hda_nid_t conn1[] = { 0x0c };
Peisen0202f5c2017-10-26 10:35:36 +08002125
2126 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2127 return;
2128
2129 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2130 /* We therefore want to make sure 0x14 (front headphone) and
2131 * 0x1b (speakers) use the stereo DAC 0x02
2132 */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002133 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2134 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Peisen0202f5c2017-10-26 10:35:36 +08002135}
2136
Jeremy Soller7f665b12019-02-13 10:56:19 -07002137static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2138 const struct hda_fixup *fix, int action);
2139
Richard Sailer80690a22019-04-02 15:52:04 +02002140static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002141 const struct hda_fixup *fix,
2142 int action)
2143{
2144 alc1220_fixup_clevo_p950(codec, fix, action);
2145 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2146}
2147
Jian-Hong Panca184352020-10-07 13:22:25 +08002148static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2149 struct hda_jack_callback *jack)
2150{
2151 struct alc_spec *spec = codec->spec;
2152 unsigned int vref;
2153
2154 snd_hda_gen_hp_automute(codec, jack);
2155
2156 if (spec->gen.hp_jack_present)
2157 vref = AC_PINCTL_VREF_80;
2158 else
2159 vref = AC_PINCTL_VREF_HIZ;
2160 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2161}
2162
2163static void alc887_fixup_asus_jack(struct hda_codec *codec,
2164 const struct hda_fixup *fix, int action)
2165{
2166 struct alc_spec *spec = codec->spec;
2167 if (action != HDA_FIXUP_ACT_PROBE)
2168 return;
2169 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2170 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2171}
2172
Takashi Iwai1727a772013-01-10 09:52:52 +01002173static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002174 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002175 .type = HDA_FIXUP_PINS,
2176 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002177 { 0x15, 0x01080104 }, /* side */
2178 { 0x16, 0x01011012 }, /* rear */
2179 { 0x17, 0x01016011 }, /* clfe */
2180 { }
2181 }
2182 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002183 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002184 .type = HDA_FIXUP_PINS,
2185 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002186 { 0x15, 0x99130112 }, /* rear int speakers */
2187 { 0x16, 0x99130111 }, /* subwoofer */
2188 { }
2189 }
2190 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002191 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002192 .type = HDA_FIXUP_PINCTLS,
2193 .v.pins = (const struct hda_pintbl[]) {
2194 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002195 {}
2196 }
2197 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002198 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002199 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002200 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002201 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002202 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002203 .type = HDA_FIXUP_PINS,
2204 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002205 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2206 { }
2207 }
2208 },
Marton Balint8f239212012-03-05 21:33:23 +01002209 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002210 .type = HDA_FIXUP_PINS,
2211 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002212 { 0x1c, 0x993301f0 }, /* CD */
2213 { }
2214 }
2215 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002216 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2217 .type = HDA_FIXUP_PINS,
2218 .v.pins = (const struct hda_pintbl[]) {
2219 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2220 { }
2221 },
2222 .chained = true,
2223 .chain_id = ALC889_FIXUP_CD,
2224 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002225 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002226 .type = HDA_FIXUP_PINS,
2227 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002228 { 0x17, 0x90170111 }, /* hidden surround speaker */
2229 { }
2230 }
2231 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002232 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002233 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002234 .v.verbs = (const struct hda_verb[]) {
2235 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2236 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2237 { }
2238 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002239 },
2240 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002241 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002242 .v.verbs = (const struct hda_verb[]) {
2243 /* change to EAPD mode */
2244 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2245 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2246 { }
2247 }
2248 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002249 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002250 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002251 .v.verbs = (const struct hda_verb[]) {
2252 /* change to EAPD mode */
2253 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2254 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2255 { }
2256 }
2257 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002258 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002259 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002260 .v.verbs = (const struct hda_verb[]) {
2261 /* eanable EAPD on Acer laptops */
2262 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2263 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2264 { }
2265 }
2266 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002267 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002268 .type = HDA_FIXUP_FUNC,
2269 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002270 },
2271 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002272 .type = HDA_FIXUP_FUNC,
2273 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002274 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002275 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002276 .type = HDA_FIXUP_FUNC,
2277 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002278 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002279 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002280 .type = HDA_FIXUP_FUNC,
2281 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002282 .chained = true,
2283 .chain_id = ALC882_FIXUP_EAPD,
2284 },
2285 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002286 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002287 .v.func = alc889_fixup_coef,
2288 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002289 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002290 .type = HDA_FIXUP_PINS,
2291 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002292 { 0x16, 0x99130111 }, /* CLFE speaker */
2293 { 0x17, 0x99130112 }, /* surround speaker */
2294 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002295 },
2296 .chained = true,
2297 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002298 },
2299 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002300 .type = HDA_FIXUP_PINS,
2301 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002302 { 0x16, 0x99130111 }, /* CLFE speaker */
2303 { 0x1b, 0x99130112 }, /* surround speaker */
2304 { }
2305 },
2306 .chained = true,
2307 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2308 },
2309 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2310 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002311 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002312 .v.verbs = (const struct hda_verb[]) {
2313 /* Enable all DACs */
2314 /* DAC DISABLE/MUTE 1? */
2315 /* setting bits 1-5 disables DAC nids 0x02-0x06
2316 * apparently. Init=0x38 */
2317 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2318 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2319 /* DAC DISABLE/MUTE 2? */
2320 /* some bit here disables the other DACs.
2321 * Init=0x4900 */
2322 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2323 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2324 /* DMIC fix
2325 * This laptop has a stereo digital microphone.
2326 * The mics are only 1cm apart which makes the stereo
2327 * useless. However, either the mic or the ALC889
2328 * makes the signal become a difference/sum signal
2329 * instead of standard stereo, which is annoying.
2330 * So instead we flip this bit which makes the
2331 * codec replicate the sum signal to both channels,
2332 * turning it into a normal mono mic.
2333 */
2334 /* DMIC_CONTROL? Init value = 0x0001 */
2335 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2336 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2337 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2338 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2339 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002340 },
2341 .chained = true,
2342 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002343 },
Takashi Iwai56710872011-11-14 17:42:11 +01002344 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002345 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002346 .v.func = alc885_fixup_macpro_gpio,
2347 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002348 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002349 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002350 .v.func = alc889_fixup_dac_route,
2351 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002352 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002353 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002354 .v.func = alc889_fixup_mbp_vref,
2355 .chained = true,
2356 .chain_id = ALC882_FIXUP_GPIO1,
2357 },
2358 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002359 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002360 .v.func = alc889_fixup_imac91_vref,
2361 .chained = true,
2362 .chain_id = ALC882_FIXUP_GPIO1,
2363 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002364 [ALC889_FIXUP_MBA11_VREF] = {
2365 .type = HDA_FIXUP_FUNC,
2366 .v.func = alc889_fixup_mba11_vref,
2367 .chained = true,
2368 .chain_id = ALC889_FIXUP_MBP_VREF,
2369 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002370 [ALC889_FIXUP_MBA21_VREF] = {
2371 .type = HDA_FIXUP_FUNC,
2372 .v.func = alc889_fixup_mba21_vref,
2373 .chained = true,
2374 .chain_id = ALC889_FIXUP_MBP_VREF,
2375 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002376 [ALC889_FIXUP_MP11_VREF] = {
2377 .type = HDA_FIXUP_FUNC,
2378 .v.func = alc889_fixup_mba11_vref,
2379 .chained = true,
2380 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2381 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002382 [ALC889_FIXUP_MP41_VREF] = {
2383 .type = HDA_FIXUP_FUNC,
2384 .v.func = alc889_fixup_mbp_vref,
2385 .chained = true,
2386 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2387 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002388 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002389 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002390 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002391 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002392 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002393 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002394 .v.func = alc882_fixup_no_primary_hp,
2395 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002396 [ALC887_FIXUP_ASUS_BASS] = {
2397 .type = HDA_FIXUP_PINS,
2398 .v.pins = (const struct hda_pintbl[]) {
2399 {0x16, 0x99130130}, /* bass speaker */
2400 {}
2401 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002402 .chained = true,
2403 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2404 },
2405 [ALC887_FIXUP_BASS_CHMAP] = {
2406 .type = HDA_FIXUP_FUNC,
2407 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002408 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002409 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2410 .type = HDA_FIXUP_FUNC,
2411 .v.func = alc1220_fixup_gb_dual_codecs,
2412 },
Peisen0202f5c2017-10-26 10:35:36 +08002413 [ALC1220_FIXUP_CLEVO_P950] = {
2414 .type = HDA_FIXUP_FUNC,
2415 .v.func = alc1220_fixup_clevo_p950,
2416 },
Richard Sailer80690a22019-04-02 15:52:04 +02002417 [ALC1220_FIXUP_CLEVO_PB51ED] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002418 .type = HDA_FIXUP_FUNC,
Richard Sailer80690a22019-04-02 15:52:04 +02002419 .v.func = alc1220_fixup_clevo_pb51ed,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002420 },
Richard Sailer80690a22019-04-02 15:52:04 +02002421 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002422 .type = HDA_FIXUP_PINS,
2423 .v.pins = (const struct hda_pintbl[]) {
2424 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2425 {}
2426 },
2427 .chained = true,
Richard Sailer80690a22019-04-02 15:52:04 +02002428 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002429 },
Jian-Hong Panca184352020-10-07 13:22:25 +08002430 [ALC887_FIXUP_ASUS_AUDIO] = {
2431 .type = HDA_FIXUP_PINS,
2432 .v.pins = (const struct hda_pintbl[]) {
2433 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2434 { 0x19, 0x22219420 },
2435 {}
2436 },
2437 },
2438 [ALC887_FIXUP_ASUS_HMIC] = {
2439 .type = HDA_FIXUP_FUNC,
2440 .v.func = alc887_fixup_asus_jack,
2441 .chained = true,
2442 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2443 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002444};
2445
2446static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002447 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2448 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002449 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002450 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2451 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2452 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2453 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002454 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2455 ALC882_FIXUP_ACER_ASPIRE_4930G),
2456 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2457 ALC882_FIXUP_ACER_ASPIRE_4930G),
2458 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2459 ALC882_FIXUP_ACER_ASPIRE_8930G),
2460 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2461 ALC882_FIXUP_ACER_ASPIRE_8930G),
2462 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2463 ALC882_FIXUP_ACER_ASPIRE_4930G),
2464 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2465 ALC882_FIXUP_ACER_ASPIRE_4930G),
2466 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2467 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002468 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002469 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2470 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002471 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002472 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002473 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002474 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002475 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002476 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Jian-Hong Panca184352020-10-07 13:22:25 +08002477 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002478 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002479 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002480 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002481 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002482 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002483 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Fernando Luis Vázquez Cao12e31a72013-02-12 16:47:44 +09002484 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaic44d9b12016-02-07 09:38:26 +01002485 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002486
2487 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002488 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2489 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2490 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002491 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002492 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2493 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002494 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2495 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002496 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002497 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002498 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002499 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2500 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002501 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002502 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2503 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2504 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002505 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002506 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002507 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2508 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002509 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002510
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002511 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002512 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002513 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Christian Lachner0d45e862020-02-23 10:24:16 +01002514 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
Christian Lachnerd9e8fe02020-05-18 07:38:44 +02002515 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia0b03952020-06-16 15:21:50 +02002516 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia655e2b2020-02-17 16:19:47 +01002517 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai1d3aa4a2020-04-08 15:56:45 +02002518 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7dafba32020-02-12 09:10:47 +01002519 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaicc5049a2020-02-18 09:09:15 +01002520 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002521 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai63691582017-05-22 16:32:46 +02002522 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002523 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002524 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Peisen0202f5c2017-10-26 10:35:36 +08002525 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002526 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2527 SND_PCI_QUIRK(0x1558, 0x950A, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaif3d737b2018-07-17 17:08:32 +02002528 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller2f0d5202018-05-07 09:28:45 -06002529 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002530 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2531 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2532 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2533 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
Richard Sailer503d90b2019-06-19 13:33:11 +02002534 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2535 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002536 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
PeiSen Hou259eb822020-05-19 08:50:12 +02002537 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002538 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2539 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2540 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2541 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2542 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002543 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2544 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002545 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2546 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002547 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002548 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002549 {}
2550};
2551
Takashi Iwai1727a772013-01-10 09:52:52 +01002552static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002553 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2554 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2555 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2556 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2557 {.id = ALC889_FIXUP_CD, .name = "cd"},
2558 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2559 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2560 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2561 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2562 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2563 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2564 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2565 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2566 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2567 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002568 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2569 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2570 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002571 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2572 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2573 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2574 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2575 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2576 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2577 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2578 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002579 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002580 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002581 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002582 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002583 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002584 {}
2585};
2586
Takashi Iwai1d045db2011-07-07 18:23:21 +02002587/*
2588 * BIOS auto configuration
2589 */
2590/* almost identical with ALC880 parser... */
2591static int alc882_parse_auto_config(struct hda_codec *codec)
2592{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002593 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002594 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2595 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002596}
2597
Takashi Iwai1d045db2011-07-07 18:23:21 +02002598/*
2599 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002600static int patch_alc882(struct hda_codec *codec)
2601{
2602 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002603 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002604
Takashi Iwai3de95172012-05-07 18:03:15 +02002605 err = alc_alloc_spec(codec, 0x0b);
2606 if (err < 0)
2607 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002608
Takashi Iwai3de95172012-05-07 18:03:15 +02002609 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002610
Takashi Iwai7639a062015-03-03 10:07:24 +01002611 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002612 case 0x10ec0882:
2613 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002614 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002615 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002616 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002617 break;
2618 default:
2619 /* ALC883 and variants */
2620 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2621 break;
2622 }
2623
Takashi Iwaic9af7532019-05-10 11:01:43 +02002624 alc_pre_init(codec);
2625
Takashi Iwai1727a772013-01-10 09:52:52 +01002626 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002627 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002628 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002629
2630 alc_auto_parse_customize_define(codec);
2631
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002632 if (has_cdefine_beep(codec))
2633 spec->gen.beep_nid = 0x01;
2634
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002635 /* automatic parse from the BIOS config */
2636 err = alc882_parse_auto_config(codec);
2637 if (err < 0)
2638 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002639
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002640 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2641 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2642 if (err < 0)
2643 goto error;
2644 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002645
Takashi Iwai1727a772013-01-10 09:52:52 +01002646 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002647
Takashi Iwai1d045db2011-07-07 18:23:21 +02002648 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002649
2650 error:
2651 alc_free(codec);
2652 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002653}
2654
2655
2656/*
2657 * ALC262 support
2658 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002659static int alc262_parse_auto_config(struct hda_codec *codec)
2660{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002661 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002662 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2663 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002664}
2665
2666/*
2667 * Pin config fixes
2668 */
2669enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002670 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002671 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002672 ALC262_FIXUP_HP_Z200,
2673 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002674 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002675 ALC262_FIXUP_BENQ,
2676 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002677 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002678 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002679};
2680
Takashi Iwai1727a772013-01-10 09:52:52 +01002681static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002682 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002683 .type = HDA_FIXUP_PINS,
2684 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002685 { 0x14, 0x99130110 }, /* speaker */
2686 { 0x15, 0x0221142f }, /* front HP */
2687 { 0x1b, 0x0121141f }, /* rear HP */
2688 { }
2689 }
2690 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002691 [ALC262_FIXUP_FSC_S7110] = {
2692 .type = HDA_FIXUP_PINS,
2693 .v.pins = (const struct hda_pintbl[]) {
2694 { 0x15, 0x90170110 }, /* speaker */
2695 { }
2696 },
2697 .chained = true,
2698 .chain_id = ALC262_FIXUP_BENQ,
2699 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002700 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002701 .type = HDA_FIXUP_PINS,
2702 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002703 { 0x16, 0x99130120 }, /* internal speaker */
2704 { }
2705 }
2706 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002707 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002708 .type = HDA_FIXUP_PINS,
2709 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002710 { 0x14, 0x1993e1f0 }, /* int AUX */
2711 { }
2712 }
2713 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002714 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002715 .type = HDA_FIXUP_PINCTLS,
2716 .v.pins = (const struct hda_pintbl[]) {
2717 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002718 {}
2719 },
2720 .chained = true,
2721 .chain_id = ALC262_FIXUP_BENQ,
2722 },
2723 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002724 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002725 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002726 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2727 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2728 {}
2729 }
2730 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002731 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002732 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002733 .v.verbs = (const struct hda_verb[]) {
2734 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2735 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2736 {}
2737 }
2738 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002739 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002740 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002741 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002742 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002743 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2744 .type = HDA_FIXUP_FUNC,
2745 .v.func = alc_fixup_no_depop_delay,
2746 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002747};
2748
2749static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002750 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002751 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002752 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002753 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002754 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002755 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002756 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002757 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2758 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002759 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002760 {}
2761};
2762
Takashi Iwai1727a772013-01-10 09:52:52 +01002763static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002764 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002765 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2766 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2767 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2768 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2769 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2770 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2771 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2772 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002773 {}
2774};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002775
Takashi Iwai1d045db2011-07-07 18:23:21 +02002776/*
2777 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002778static int patch_alc262(struct hda_codec *codec)
2779{
2780 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002781 int err;
2782
Takashi Iwai3de95172012-05-07 18:03:15 +02002783 err = alc_alloc_spec(codec, 0x0b);
2784 if (err < 0)
2785 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002786
Takashi Iwai3de95172012-05-07 18:03:15 +02002787 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002788 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002789
Takashi Iwai225068a2015-05-29 10:42:14 +02002790 spec->shutup = alc_eapd_shutup;
2791
Takashi Iwai1d045db2011-07-07 18:23:21 +02002792#if 0
2793 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2794 * under-run
2795 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002796 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002797#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002798 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2799
Takashi Iwaic9af7532019-05-10 11:01:43 +02002800 alc_pre_init(codec);
2801
Takashi Iwai1727a772013-01-10 09:52:52 +01002802 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002803 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002804 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002805
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002806 alc_auto_parse_customize_define(codec);
2807
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002808 if (has_cdefine_beep(codec))
2809 spec->gen.beep_nid = 0x01;
2810
Takashi Iwai42399f72011-11-07 17:18:44 +01002811 /* automatic parse from the BIOS config */
2812 err = alc262_parse_auto_config(codec);
2813 if (err < 0)
2814 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002815
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002816 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2817 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2818 if (err < 0)
2819 goto error;
2820 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002821
Takashi Iwai1727a772013-01-10 09:52:52 +01002822 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002823
Takashi Iwai1d045db2011-07-07 18:23:21 +02002824 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002825
2826 error:
2827 alc_free(codec);
2828 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002829}
2830
2831/*
2832 * ALC268
2833 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002834/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002835static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2836 struct snd_ctl_elem_value *ucontrol)
2837{
2838 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2839 unsigned long pval;
2840 int err;
2841
2842 mutex_lock(&codec->control_mutex);
2843 pval = kcontrol->private_value;
2844 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2845 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2846 if (err >= 0) {
2847 kcontrol->private_value = (pval & ~0xff) | 0x10;
2848 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2849 }
2850 kcontrol->private_value = pval;
2851 mutex_unlock(&codec->control_mutex);
2852 return err;
2853}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002854
2855static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2856 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002857 {
2858 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2859 .name = "Beep Playback Switch",
2860 .subdevice = HDA_SUBDEV_AMP_FLAG,
2861 .info = snd_hda_mixer_amp_switch_info,
2862 .get = snd_hda_mixer_amp_switch_get,
2863 .put = alc268_beep_switch_put,
2864 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2865 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002866};
2867
2868/* set PCBEEP vol = 0, mute connections */
2869static const struct hda_verb alc268_beep_init_verbs[] = {
2870 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2871 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2872 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2873 { }
2874};
2875
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002876enum {
2877 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002878 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002879 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002880};
2881
Takashi Iwai1727a772013-01-10 09:52:52 +01002882static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002883 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002884 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002885 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002886 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002887 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002888 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002889 .v.verbs = (const struct hda_verb[]) {
2890 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2891 {}
2892 }
2893 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002894 [ALC268_FIXUP_SPDIF] = {
2895 .type = HDA_FIXUP_PINS,
2896 .v.pins = (const struct hda_pintbl[]) {
2897 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2898 {}
2899 }
2900 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002901};
2902
Takashi Iwai1727a772013-01-10 09:52:52 +01002903static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002904 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002905 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002906 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002907 {}
2908};
2909
2910static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002911 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002912 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002913 /* below is codec SSID since multiple Toshiba laptops have the
2914 * same PCI SSID 1179:ff00
2915 */
2916 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002917 {}
2918};
2919
Takashi Iwai1d045db2011-07-07 18:23:21 +02002920/*
2921 * BIOS auto configuration
2922 */
2923static int alc268_parse_auto_config(struct hda_codec *codec)
2924{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002925 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002926 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002927}
2928
Takashi Iwai1d045db2011-07-07 18:23:21 +02002929/*
2930 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002931static int patch_alc268(struct hda_codec *codec)
2932{
2933 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002934 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002935
Takashi Iwai1d045db2011-07-07 18:23:21 +02002936 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002937 err = alc_alloc_spec(codec, 0);
2938 if (err < 0)
2939 return err;
2940
2941 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02002942 if (has_cdefine_beep(codec))
2943 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002944
Takashi Iwai225068a2015-05-29 10:42:14 +02002945 spec->shutup = alc_eapd_shutup;
2946
Takashi Iwaic9af7532019-05-10 11:01:43 +02002947 alc_pre_init(codec);
2948
Takashi Iwai1727a772013-01-10 09:52:52 +01002949 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2950 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002951
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002952 /* automatic parse from the BIOS config */
2953 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002954 if (err < 0)
2955 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002956
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002957 if (err > 0 && !spec->gen.no_analog &&
2958 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002959 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2960 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2961 &alc268_beep_mixer[i])) {
2962 err = -ENOMEM;
2963 goto error;
2964 }
2965 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002966 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002967 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2968 /* override the amp caps for beep generator */
2969 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2970 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2971 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2972 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2973 (0 << AC_AMPCAP_MUTE_SHIFT));
2974 }
2975
Takashi Iwai1727a772013-01-10 09:52:52 +01002976 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002977
Takashi Iwai1d045db2011-07-07 18:23:21 +02002978 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002979
2980 error:
2981 alc_free(codec);
2982 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002983}
2984
2985/*
2986 * ALC269
2987 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01002988
Takashi Iwai1d045db2011-07-07 18:23:21 +02002989static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002990 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002991};
2992
2993static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002994 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002995};
2996
Takashi Iwai1d045db2011-07-07 18:23:21 +02002997/* different alc269-variants */
2998enum {
2999 ALC269_TYPE_ALC269VA,
3000 ALC269_TYPE_ALC269VB,
3001 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02003002 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01003003 ALC269_TYPE_ALC280,
3004 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02003005 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01003006 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08003007 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02003008 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08003009 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003010 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08003011 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003012 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003013 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003014 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003015 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003016 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003017 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003018 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003019};
3020
3021/*
3022 * BIOS auto configuration
3023 */
3024static int alc269_parse_auto_config(struct hda_codec *codec)
3025{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003026 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003027 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3028 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3029 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003030 const hda_nid_t *ssids;
3031
3032 switch (spec->codec_variant) {
3033 case ALC269_TYPE_ALC269VA:
3034 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003035 case ALC269_TYPE_ALC280:
3036 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003037 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003038 ssids = alc269va_ssids;
3039 break;
3040 case ALC269_TYPE_ALC269VB:
3041 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003042 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003043 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003044 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003045 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003046 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003047 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003048 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003049 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003050 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003051 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003052 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003053 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003054 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003055 ssids = alc269_ssids;
3056 break;
3057 default:
3058 ssids = alc269_ssids;
3059 break;
3060 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003061
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003062 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003063}
3064
Hui Wang476c02e2020-03-29 16:20:18 +08003065static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3066 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3067 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3068 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3069 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3070 {}
3071};
3072
3073static void alc_headset_btn_callback(struct hda_codec *codec,
3074 struct hda_jack_callback *jack)
3075{
3076 int report = 0;
3077
3078 if (jack->unsol_res & (7 << 13))
3079 report |= SND_JACK_BTN_0;
3080
3081 if (jack->unsol_res & (1 << 16 | 3 << 8))
3082 report |= SND_JACK_BTN_1;
3083
3084 /* Volume up key */
3085 if (jack->unsol_res & (7 << 23))
3086 report |= SND_JACK_BTN_2;
3087
3088 /* Volume down key */
3089 if (jack->unsol_res & (7 << 10))
3090 report |= SND_JACK_BTN_3;
3091
3092 jack->jack->button_state = report;
3093}
3094
3095static void alc_disable_headset_jack_key(struct hda_codec *codec)
3096{
3097 struct alc_spec *spec = codec->spec;
3098
3099 if (!spec->has_hs_key)
3100 return;
3101
3102 switch (codec->core.vendor_id) {
3103 case 0x10ec0215:
3104 case 0x10ec0225:
3105 case 0x10ec0285:
3106 case 0x10ec0295:
3107 case 0x10ec0289:
3108 case 0x10ec0299:
3109 alc_write_coef_idx(codec, 0x48, 0x0);
3110 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3111 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3112 break;
3113 case 0x10ec0236:
3114 case 0x10ec0256:
3115 alc_write_coef_idx(codec, 0x48, 0x0);
3116 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3117 break;
3118 }
3119}
3120
3121static void alc_enable_headset_jack_key(struct hda_codec *codec)
3122{
3123 struct alc_spec *spec = codec->spec;
3124
3125 if (!spec->has_hs_key)
3126 return;
3127
3128 switch (codec->core.vendor_id) {
3129 case 0x10ec0215:
3130 case 0x10ec0225:
3131 case 0x10ec0285:
3132 case 0x10ec0295:
3133 case 0x10ec0289:
3134 case 0x10ec0299:
3135 alc_write_coef_idx(codec, 0x48, 0xd011);
3136 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3137 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3138 break;
3139 case 0x10ec0236:
3140 case 0x10ec0256:
3141 alc_write_coef_idx(codec, 0x48, 0xd011);
3142 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3143 break;
3144 }
3145}
3146
3147static void alc_fixup_headset_jack(struct hda_codec *codec,
3148 const struct hda_fixup *fix, int action)
3149{
3150 struct alc_spec *spec = codec->spec;
3151
3152 switch (action) {
3153 case HDA_FIXUP_ACT_PRE_PROBE:
3154 spec->has_hs_key = 1;
3155 snd_hda_jack_detect_enable_callback(codec, 0x55,
3156 alc_headset_btn_callback);
3157 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3158 SND_JACK_HEADSET, alc_headset_btn_keymap);
3159 break;
3160 case HDA_FIXUP_ACT_INIT:
3161 alc_enable_headset_jack_key(codec);
3162 break;
3163 }
3164}
3165
Kailang Yang1387e2d2012-11-08 10:23:18 +01003166static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003167{
Takashi Iwai98b24882014-08-18 13:47:50 +02003168 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003169}
3170
3171static void alc269_shutup(struct hda_codec *codec)
3172{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003173 struct alc_spec *spec = codec->spec;
3174
Kailang Yang1387e2d2012-11-08 10:23:18 +01003175 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3176 alc269vb_toggle_power_output(codec, 0);
3177 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3178 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003179 msleep(150);
3180 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003181 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003182}
3183
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003184static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003185 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003186 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003187 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3188 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3189 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3190 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3191 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3192 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3193 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3194 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3195 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3196 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3197 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3198 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3199 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3200 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3201 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3202 WRITE_COEF(0x63, 0x2902), /* PLL */
3203 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3204 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3205 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3206 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3207 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3208 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3209 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3210 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3211 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3212 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3213 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3214 {}
3215};
3216
Kailang Yangcb149cb2014-03-18 16:45:32 +08003217static void alc282_restore_default_value(struct hda_codec *codec)
3218{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003219 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003220}
3221
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003222static void alc282_init(struct hda_codec *codec)
3223{
3224 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003225 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003226 bool hp_pin_sense;
3227 int coef78;
3228
Kailang Yangcb149cb2014-03-18 16:45:32 +08003229 alc282_restore_default_value(codec);
3230
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003231 if (!hp_pin)
3232 return;
3233 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3234 coef78 = alc_read_coef_idx(codec, 0x78);
3235
3236 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3237 /* Headphone capless set to high power mode */
3238 alc_write_coef_idx(codec, 0x78, 0x9004);
3239
3240 if (hp_pin_sense)
3241 msleep(2);
3242
3243 snd_hda_codec_write(codec, hp_pin, 0,
3244 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3245
3246 if (hp_pin_sense)
3247 msleep(85);
3248
3249 snd_hda_codec_write(codec, hp_pin, 0,
3250 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3251
3252 if (hp_pin_sense)
3253 msleep(100);
3254
3255 /* Headphone capless set to normal mode */
3256 alc_write_coef_idx(codec, 0x78, coef78);
3257}
3258
3259static void alc282_shutup(struct hda_codec *codec)
3260{
3261 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003262 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003263 bool hp_pin_sense;
3264 int coef78;
3265
3266 if (!hp_pin) {
3267 alc269_shutup(codec);
3268 return;
3269 }
3270
3271 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3272 coef78 = alc_read_coef_idx(codec, 0x78);
3273 alc_write_coef_idx(codec, 0x78, 0x9004);
3274
3275 if (hp_pin_sense)
3276 msleep(2);
3277
3278 snd_hda_codec_write(codec, hp_pin, 0,
3279 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3280
3281 if (hp_pin_sense)
3282 msleep(85);
3283
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003284 if (!spec->no_shutup_pins)
3285 snd_hda_codec_write(codec, hp_pin, 0,
3286 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003287
3288 if (hp_pin_sense)
3289 msleep(100);
3290
3291 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003292 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003293 alc_write_coef_idx(codec, 0x78, coef78);
3294}
3295
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003296static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003297 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003298 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003299 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3300 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3301 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3302 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3303 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3304 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3305 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3306 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3307 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3308 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3309 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3310 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3311 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3312 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3313 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3314 WRITE_COEF(0x2e, 0x2902), /* PLL */
3315 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3316 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3317 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3318 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3319 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3320 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3321 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3322 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3323 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3324 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3325 WRITE_COEF(0x49, 0x0), /* test mode */
3326 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3327 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3328 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003329 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003330 {}
3331};
3332
Kailang Yang6bd55b02014-03-17 13:51:27 +08003333static void alc283_restore_default_value(struct hda_codec *codec)
3334{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003335 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003336}
3337
Kailang Yang2af02be2013-08-22 10:03:50 +02003338static void alc283_init(struct hda_codec *codec)
3339{
3340 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003341 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003342 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003343
Kailang Yang6bd55b02014-03-17 13:51:27 +08003344 alc283_restore_default_value(codec);
3345
Kailang Yang2af02be2013-08-22 10:03:50 +02003346 if (!hp_pin)
3347 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003348
3349 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003350 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3351
3352 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3353 /* Headphone capless set to high power mode */
3354 alc_write_coef_idx(codec, 0x43, 0x9004);
3355
3356 snd_hda_codec_write(codec, hp_pin, 0,
3357 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3358
3359 if (hp_pin_sense)
3360 msleep(85);
3361
3362 snd_hda_codec_write(codec, hp_pin, 0,
3363 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3364
3365 if (hp_pin_sense)
3366 msleep(85);
3367 /* Index 0x46 Combo jack auto switch control 2 */
3368 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003369 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003370 /* Headphone capless set to normal mode */
3371 alc_write_coef_idx(codec, 0x43, 0x9614);
3372}
3373
3374static void alc283_shutup(struct hda_codec *codec)
3375{
3376 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003377 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003378 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003379
3380 if (!hp_pin) {
3381 alc269_shutup(codec);
3382 return;
3383 }
3384
3385 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3386
3387 alc_write_coef_idx(codec, 0x43, 0x9004);
3388
Harsha Priyab450b172014-10-09 11:04:56 +00003389 /*depop hp during suspend*/
3390 alc_write_coef_idx(codec, 0x06, 0x2100);
3391
Kailang Yang2af02be2013-08-22 10:03:50 +02003392 snd_hda_codec_write(codec, hp_pin, 0,
3393 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3394
3395 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003396 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003397
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003398 if (!spec->no_shutup_pins)
3399 snd_hda_codec_write(codec, hp_pin, 0,
3400 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003401
Takashi Iwai98b24882014-08-18 13:47:50 +02003402 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003403
3404 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003405 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003406 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003407 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003408 alc_write_coef_idx(codec, 0x43, 0x9614);
3409}
3410
Kailang Yang4a219ef2017-06-16 16:54:35 +08003411static void alc256_init(struct hda_codec *codec)
3412{
3413 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003414 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003415 bool hp_pin_sense;
3416
3417 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003418 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003419
3420 msleep(30);
3421
3422 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3423
3424 if (hp_pin_sense)
3425 msleep(2);
3426
3427 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003428 if (spec->ultra_low_power) {
3429 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3430 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3431 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3432 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3433 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3434 msleep(30);
3435 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003436
3437 snd_hda_codec_write(codec, hp_pin, 0,
3438 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3439
Kailang Yang6447c962019-05-08 16:27:03 +08003440 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003441 msleep(85);
3442
3443 snd_hda_codec_write(codec, hp_pin, 0,
3444 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3445
Kailang Yang6447c962019-05-08 16:27:03 +08003446 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003447 msleep(100);
3448
3449 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3450 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003451 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3452 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003453 /*
3454 * Expose headphone mic (or possibly Line In on some machines) instead
3455 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3456 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3457 * this register.
3458 */
3459 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003460}
3461
3462static void alc256_shutup(struct hda_codec *codec)
3463{
3464 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003465 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003466 bool hp_pin_sense;
3467
Kailang Yang6447c962019-05-08 16:27:03 +08003468 if (!hp_pin)
3469 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003470
3471 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3472
3473 if (hp_pin_sense)
3474 msleep(2);
3475
3476 snd_hda_codec_write(codec, hp_pin, 0,
3477 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3478
Kailang Yang6447c962019-05-08 16:27:03 +08003479 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003480 msleep(85);
3481
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003482 /* 3k pull low control for Headset jack. */
3483 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003484 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3485 * when booting with headset plugged. So skip setting it for the codec alc257
3486 */
3487 if (codec->core.vendor_id != 0x10ec0257)
3488 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003489
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003490 if (!spec->no_shutup_pins)
3491 snd_hda_codec_write(codec, hp_pin, 0,
3492 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003493
Kailang Yang6447c962019-05-08 16:27:03 +08003494 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003495 msleep(100);
3496
3497 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003498 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003499 if (spec->ultra_low_power) {
3500 msleep(50);
3501 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3502 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3503 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3504 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3505 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3506 msleep(30);
3507 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003508}
3509
Kailang Yangda911b12018-01-05 16:50:08 +08003510static void alc225_init(struct hda_codec *codec)
3511{
3512 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003513 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003514 bool hp1_pin_sense, hp2_pin_sense;
3515
3516 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003517 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003518 msleep(30);
3519
3520 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3521 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3522
3523 if (hp1_pin_sense || hp2_pin_sense)
3524 msleep(2);
3525
3526 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003527 if (spec->ultra_low_power) {
3528 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3529 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3530 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3531 msleep(30);
3532 }
Kailang Yangda911b12018-01-05 16:50:08 +08003533
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003534 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003535 snd_hda_codec_write(codec, hp_pin, 0,
3536 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3537 if (hp2_pin_sense)
3538 snd_hda_codec_write(codec, 0x16, 0,
3539 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3540
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003541 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003542 msleep(85);
3543
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003544 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003545 snd_hda_codec_write(codec, hp_pin, 0,
3546 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3547 if (hp2_pin_sense)
3548 snd_hda_codec_write(codec, 0x16, 0,
3549 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3550
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003551 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003552 msleep(100);
3553
3554 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3555 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3556}
3557
3558static void alc225_shutup(struct hda_codec *codec)
3559{
3560 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003561 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003562 bool hp1_pin_sense, hp2_pin_sense;
3563
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003564 if (!hp_pin)
3565 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003566
3567 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003568 /* 3k pull low control for Headset jack. */
3569 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3570
3571 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3572 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3573
3574 if (hp1_pin_sense || hp2_pin_sense)
3575 msleep(2);
3576
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003577 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003578 snd_hda_codec_write(codec, hp_pin, 0,
3579 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3580 if (hp2_pin_sense)
3581 snd_hda_codec_write(codec, 0x16, 0,
3582 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3583
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003584 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003585 msleep(85);
3586
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003587 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003588 snd_hda_codec_write(codec, hp_pin, 0,
3589 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3590 if (hp2_pin_sense)
3591 snd_hda_codec_write(codec, 0x16, 0,
3592 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3593
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003594 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003595 msleep(100);
3596
3597 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003598 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003599 if (spec->ultra_low_power) {
3600 msleep(50);
3601 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3602 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3603 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3604 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3605 msleep(30);
3606 }
Hui Wang476c02e2020-03-29 16:20:18 +08003607
3608 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3609 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003610}
3611
Kailang Yangc2d6af52017-06-21 14:50:54 +08003612static void alc_default_init(struct hda_codec *codec)
3613{
3614 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003615 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003616 bool hp_pin_sense;
3617
3618 if (!hp_pin)
3619 return;
3620
3621 msleep(30);
3622
3623 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3624
3625 if (hp_pin_sense)
3626 msleep(2);
3627
3628 snd_hda_codec_write(codec, hp_pin, 0,
3629 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3630
3631 if (hp_pin_sense)
3632 msleep(85);
3633
3634 snd_hda_codec_write(codec, hp_pin, 0,
3635 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3636
3637 if (hp_pin_sense)
3638 msleep(100);
3639}
3640
3641static void alc_default_shutup(struct hda_codec *codec)
3642{
3643 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003644 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003645 bool hp_pin_sense;
3646
3647 if (!hp_pin) {
3648 alc269_shutup(codec);
3649 return;
3650 }
3651
3652 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3653
3654 if (hp_pin_sense)
3655 msleep(2);
3656
3657 snd_hda_codec_write(codec, hp_pin, 0,
3658 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3659
3660 if (hp_pin_sense)
3661 msleep(85);
3662
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003663 if (!spec->no_shutup_pins)
3664 snd_hda_codec_write(codec, hp_pin, 0,
3665 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003666
3667 if (hp_pin_sense)
3668 msleep(100);
3669
3670 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003671 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003672}
3673
Kailang Yang693abe12019-01-29 15:38:21 +08003674static void alc294_hp_init(struct hda_codec *codec)
3675{
3676 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003677 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003678 int i, val;
3679
3680 if (!hp_pin)
3681 return;
3682
3683 snd_hda_codec_write(codec, hp_pin, 0,
3684 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3685
3686 msleep(100);
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 Yang693abe12019-01-29 15:38:21 +08003691
3692 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3693 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3694
3695 /* Wait for depop procedure finish */
3696 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3697 for (i = 0; i < 20 && val & 0x0080; i++) {
3698 msleep(50);
3699 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3700 }
3701 /* Set HP depop to auto mode */
3702 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3703 msleep(50);
3704}
3705
3706static void alc294_init(struct hda_codec *codec)
3707{
3708 struct alc_spec *spec = codec->spec;
3709
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003710 /* required only at boot or S4 resume time */
3711 if (!spec->done_hp_init ||
3712 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003713 alc294_hp_init(codec);
3714 spec->done_hp_init = true;
3715 }
3716 alc_default_init(codec);
3717}
3718
Kailang Yangad60d502013-06-28 12:03:01 +02003719static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3720 unsigned int val)
3721{
3722 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3723 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3724 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3725}
3726
3727static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3728{
3729 unsigned int val;
3730
3731 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3732 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3733 & 0xffff;
3734 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3735 << 16;
3736 return val;
3737}
3738
3739static void alc5505_dsp_halt(struct hda_codec *codec)
3740{
3741 unsigned int val;
3742
3743 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3744 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3745 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3746 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3747 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3748 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3749 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3750 val = alc5505_coef_get(codec, 0x6220);
3751 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3752}
3753
3754static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3755{
3756 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3757 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3758 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3759 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3760 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3761 alc5505_coef_set(codec, 0x880c, 0x00000004);
3762}
3763
3764static void alc5505_dsp_init(struct hda_codec *codec)
3765{
3766 unsigned int val;
3767
3768 alc5505_dsp_halt(codec);
3769 alc5505_dsp_back_from_halt(codec);
3770 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3771 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3772 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3773 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3774 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3775 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3776 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3777 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3778 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3779 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3780 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3781 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3782 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3783
3784 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3785 if (val <= 3)
3786 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3787 else
3788 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3789
3790 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3791 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3792 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3793 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3794 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3795 alc5505_coef_set(codec, 0x880c, 0x00000003);
3796 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003797
3798#ifdef HALT_REALTEK_ALC5505
3799 alc5505_dsp_halt(codec);
3800#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003801}
3802
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003803#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003804#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3805#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003806#else
3807#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3808#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3809#endif
3810
Takashi Iwai2a439522011-07-26 09:52:50 +02003811#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003812static int alc269_suspend(struct hda_codec *codec)
3813{
3814 struct alc_spec *spec = codec->spec;
3815
3816 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003817 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003818 return alc_suspend(codec);
3819}
3820
Takashi Iwai1d045db2011-07-07 18:23:21 +02003821static int alc269_resume(struct hda_codec *codec)
3822{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003823 struct alc_spec *spec = codec->spec;
3824
Kailang Yang1387e2d2012-11-08 10:23:18 +01003825 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3826 alc269vb_toggle_power_output(codec, 0);
3827 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003828 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003829 msleep(150);
3830 }
3831
3832 codec->patch_ops.init(codec);
3833
Kailang Yang1387e2d2012-11-08 10:23:18 +01003834 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3835 alc269vb_toggle_power_output(codec, 1);
3836 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003837 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003838 msleep(200);
3839 }
3840
Takashi Iwai1a462be2020-01-09 10:01:04 +01003841 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003842 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003843
3844 /* on some machine, the BIOS will clear the codec gpio data when enter
3845 * suspend, and won't restore the data after resume, so we restore it
3846 * in the driver.
3847 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003848 if (spec->gpio_data)
3849 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003850
Kailang Yangad60d502013-06-28 12:03:01 +02003851 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003852 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003853
Takashi Iwai1d045db2011-07-07 18:23:21 +02003854 return 0;
3855}
Takashi Iwai2a439522011-07-26 09:52:50 +02003856#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003857
David Henningsson108cc102012-07-20 10:37:25 +02003858static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003859 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003860{
3861 struct alc_spec *spec = codec->spec;
3862
Takashi Iwai1727a772013-01-10 09:52:52 +01003863 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003864 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3865}
3866
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003867static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3868 const struct hda_fixup *fix,
3869 int action)
3870{
3871 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3872 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3873
3874 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3875 snd_hda_codec_set_pincfg(codec, 0x19,
3876 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3877 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3878}
3879
Takashi Iwai1d045db2011-07-07 18:23:21 +02003880static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003881 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003882{
Takashi Iwai98b24882014-08-18 13:47:50 +02003883 if (action == HDA_FIXUP_ACT_INIT)
3884 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003885}
3886
David Henningsson7c478f02013-10-11 10:18:46 +02003887static void alc269_fixup_headset_mic(struct hda_codec *codec,
3888 const struct hda_fixup *fix, int action)
3889{
3890 struct alc_spec *spec = codec->spec;
3891
3892 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3893 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3894}
3895
Takashi Iwai1d045db2011-07-07 18:23:21 +02003896static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003897 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003898{
3899 static const struct hda_verb verbs[] = {
3900 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3901 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3902 {}
3903 };
3904 unsigned int cfg;
3905
Takashi Iwai7639a062015-03-03 10:07:24 +01003906 if (strcmp(codec->core.chip_name, "ALC271X") &&
3907 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003908 return;
3909 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3910 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3911 snd_hda_sequence_write(codec, verbs);
3912}
3913
Takashi Iwai017f2a12011-07-09 14:42:25 +02003914static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003915 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003916{
3917 struct alc_spec *spec = codec->spec;
3918
Takashi Iwai1727a772013-01-10 09:52:52 +01003919 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003920 return;
3921
3922 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3923 * fix the sample rate of analog I/O to 44.1kHz
3924 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003925 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3926 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003927}
3928
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003929static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003930 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003931{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003932 /* The digital-mic unit sends PDM (differential signal) instead of
3933 * the standard PCM, thus you can't record a valid mono stream as is.
3934 * Below is a workaround specific to ALC269 to control the dmic
3935 * signal source as mono.
3936 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003937 if (action == HDA_FIXUP_ACT_INIT)
3938 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003939}
3940
Takashi Iwai24519912011-08-16 15:08:49 +02003941static void alc269_quanta_automute(struct hda_codec *codec)
3942{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003943 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003944
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003945 alc_write_coef_idx(codec, 0x0c, 0x680);
3946 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003947}
3948
3949static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003950 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003951{
3952 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003953 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003954 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003955 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003956}
3957
David Henningssond240d1d2013-04-15 12:50:02 +02003958static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003959 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003960{
3961 struct alc_spec *spec = codec->spec;
3962 int vref;
3963 msleep(200);
3964 snd_hda_gen_hp_automute(codec, jack);
3965
3966 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3967 msleep(100);
3968 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3969 vref);
3970 msleep(500);
3971 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3972 vref);
3973}
3974
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02003975/*
3976 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
3977 */
3978struct hda_alc298_mbxinit {
3979 unsigned char value_0x23;
3980 unsigned char value_0x25;
3981};
3982
3983static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
3984 const struct hda_alc298_mbxinit *initval,
3985 bool first)
3986{
3987 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
3988 alc_write_coef_idx(codec, 0x26, 0xb000);
3989
3990 if (first)
3991 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
3992
3993 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
3994 alc_write_coef_idx(codec, 0x26, 0xf000);
3995 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
3996
3997 if (initval->value_0x23 != 0x1e)
3998 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
3999
4000 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4001 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4002}
4003
4004static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4005 const struct hda_fixup *fix,
4006 int action)
4007{
4008 /* Initialization magic */
4009 static const struct hda_alc298_mbxinit dac_init[] = {
4010 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4011 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4012 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4013 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4014 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4015 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4016 {0x2f, 0x00},
4017 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4018 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4019 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4020 {}
4021 };
4022 const struct hda_alc298_mbxinit *seq;
4023
4024 if (action != HDA_FIXUP_ACT_INIT)
4025 return;
4026
4027 /* Start */
4028 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4029 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4030 alc_write_coef_idx(codec, 0x26, 0xf000);
4031 alc_write_coef_idx(codec, 0x22, 0x31);
4032 alc_write_coef_idx(codec, 0x23, 0x0b);
4033 alc_write_coef_idx(codec, 0x25, 0x00);
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 for (seq = dac_init; seq->value_0x23; seq++)
4038 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4039}
4040
David Henningssond240d1d2013-04-15 12:50:02 +02004041static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4042 const struct hda_fixup *fix, int action)
4043{
4044 struct alc_spec *spec = codec->spec;
4045 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4046 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4047 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4048 }
4049}
4050
Takashi Iwai766538a2020-06-18 13:08:41 +02004051static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4052 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004053{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004054 unsigned int pinval;
4055
Takashi Iwai766538a2020-06-18 13:08:41 +02004056 if (!pin)
4057 return;
4058 if (polarity)
4059 on = !on;
4060 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004061 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004062 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4063 /* temporarily power up/down for setting VREF */
4064 snd_hda_power_up_pm(codec);
4065 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4066 snd_hda_power_down_pm(codec);
4067}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004068
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004069/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004070static int vref_mute_led_set(struct led_classdev *led_cdev,
4071 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004072{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004073 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004074 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004075
Takashi Iwai766538a2020-06-18 13:08:41 +02004076 alc_update_vref_led(codec, spec->mute_led_nid,
4077 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004078 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004079}
4080
David Henningssond5b6b652013-11-06 10:50:44 +01004081/* Make sure the led works even in runtime suspend */
4082static unsigned int led_power_filter(struct hda_codec *codec,
4083 hda_nid_t nid,
4084 unsigned int power_state)
4085{
4086 struct alc_spec *spec = codec->spec;
4087
Hui Wang50dd9052014-07-08 17:56:15 +08004088 if (power_state != AC_PWRST_D3 || nid == 0 ||
4089 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004090 return power_state;
4091
4092 /* Set pin ctl again, it might have just been set to 0 */
4093 snd_hda_set_pin_ctl(codec, nid,
4094 snd_hda_codec_get_pin_target(codec, nid));
4095
Takashi Iwaicffd3962015-04-09 10:30:25 +02004096 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004097}
4098
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004099static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4100 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004101{
4102 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004103 const struct dmi_device *dev = NULL;
4104
4105 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4106 return;
4107
4108 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4109 int pol, pin;
4110 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4111 continue;
4112 if (pin < 0x0a || pin >= 0x10)
4113 break;
4114 spec->mute_led_polarity = pol;
4115 spec->mute_led_nid = pin - 0x0a + 0x18;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004116 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004117 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004118 codec_dbg(codec,
4119 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004120 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004121 break;
4122 }
4123}
4124
Takashi Iwai85c467d2018-05-29 11:38:38 +02004125static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4126 const struct hda_fixup *fix,
4127 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004128{
4129 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004130
David Henningssond06ac142013-02-18 11:41:55 +01004131 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4132 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004133 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004134 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004135 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004136 }
4137}
4138
Takashi Iwai85c467d2018-05-29 11:38:38 +02004139static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4140 const struct hda_fixup *fix, int action)
4141{
4142 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4143}
4144
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004145static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4146 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004147{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004148 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004149}
4150
Tom Briden7f783bd2017-03-25 10:12:01 +00004151static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4152 const struct hda_fixup *fix, int action)
4153{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004154 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004155}
4156
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004157/* update LED status via GPIO */
4158static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004159 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004160{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004161 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004162 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004163 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004164}
4165
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004166/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004167static int gpio_mute_led_set(struct led_classdev *led_cdev,
4168 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004169{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004170 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004171 struct alc_spec *spec = codec->spec;
4172
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004173 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004174 spec->mute_led_polarity, !brightness);
4175 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004176}
4177
4178/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004179static int micmute_led_set(struct led_classdev *led_cdev,
4180 enum led_brightness brightness)
4181{
4182 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4183 struct alc_spec *spec = codec->spec;
4184
4185 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004186 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004187 return 0;
4188}
4189
Takashi Iwai01e4a272018-06-19 22:47:30 +02004190/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4191static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4192 int action,
4193 unsigned int mute_mask,
4194 unsigned int micmute_mask)
4195{
4196 struct alc_spec *spec = codec->spec;
4197
4198 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4199
4200 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4201 return;
4202 if (mute_mask) {
4203 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004204 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004205 }
4206 if (micmute_mask) {
4207 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004208 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004209 }
4210}
4211
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004212static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4213 const struct hda_fixup *fix, int action)
4214{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004215 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004216}
4217
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004218static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4219 const struct hda_fixup *fix, int action)
4220{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004221 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004222}
4223
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004224static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4225 const struct hda_fixup *fix, int action)
4226{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004227 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004228}
4229
Kailang Yanga0ccbc52020-11-06 15:20:38 +08004230static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4231 const struct hda_fixup *fix, int action)
4232{
4233 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4234}
4235
Takashi Iwai8a503552020-06-18 13:08:32 +02004236/* turn on/off mic-mute LED per capture hook via VREF change */
4237static int vref_micmute_led_set(struct led_classdev *led_cdev,
4238 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004239{
Takashi Iwai8a503552020-06-18 13:08:32 +02004240 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004241 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004242
Takashi Iwai766538a2020-06-18 13:08:41 +02004243 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4244 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004245 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004246}
4247
4248static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4249 const struct hda_fixup *fix, int action)
4250{
4251 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004252
Takashi Iwai01e4a272018-06-19 22:47:30 +02004253 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004254 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004255 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4256 * enable headphone amp
4257 */
4258 spec->gpio_mask |= 0x10;
4259 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004260 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004261 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004262 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004263 }
4264}
4265
David Henningsson7a5255f2014-10-30 08:26:01 +01004266static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4267 const struct hda_fixup *fix, int action)
4268{
David Henningsson7a5255f2014-10-30 08:26:01 +01004269 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004270
Takashi Iwai01e4a272018-06-19 22:47:30 +02004271 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004272 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004273 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004274 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004275 codec->power_filter = led_power_filter;
4276 }
4277}
4278
Takashi Iwai766538a2020-06-18 13:08:41 +02004279static void alc_update_coef_led(struct hda_codec *codec,
4280 struct alc_coef_led *led,
4281 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004282{
Takashi Iwai766538a2020-06-18 13:08:41 +02004283 if (polarity)
4284 on = !on;
4285 /* temporarily power up/down for setting COEF bit */
4286 alc_update_coef_idx(codec, led->idx, led->mask,
4287 on ? led->on : led->off);
4288}
4289
Kailang Yang431e76c2020-04-07 14:40:20 +08004290/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004291static int coef_mute_led_set(struct led_classdev *led_cdev,
4292 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004293{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004294 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004295 struct alc_spec *spec = codec->spec;
4296
Takashi Iwai766538a2020-06-18 13:08:41 +02004297 alc_update_coef_led(codec, &spec->mute_led_coef,
4298 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004299 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004300}
4301
4302static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4303 const struct hda_fixup *fix,
4304 int action)
4305{
4306 struct alc_spec *spec = codec->spec;
4307
4308 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4309 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004310 spec->mute_led_coef.idx = 0x0b;
4311 spec->mute_led_coef.mask = 1 << 3;
4312 spec->mute_led_coef.on = 1 << 3;
4313 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004314 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004315 }
4316}
4317
Kailang Yang24164f42020-04-07 14:52:42 +08004318static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4319 const struct hda_fixup *fix,
4320 int action)
4321{
4322 struct alc_spec *spec = codec->spec;
4323
4324 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4325 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004326 spec->mute_led_coef.idx = 0x34;
4327 spec->mute_led_coef.mask = 1 << 5;
4328 spec->mute_led_coef.on = 0;
4329 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004330 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004331 }
4332}
4333
Kailang Yang431e76c2020-04-07 14:40:20 +08004334/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004335static int coef_micmute_led_set(struct led_classdev *led_cdev,
4336 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004337{
Takashi Iwai8a503552020-06-18 13:08:32 +02004338 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004339 struct alc_spec *spec = codec->spec;
4340
Takashi Iwai766538a2020-06-18 13:08:41 +02004341 alc_update_coef_led(codec, &spec->mic_led_coef,
4342 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004343 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004344}
4345
4346static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4347 const struct hda_fixup *fix, int action)
4348{
4349 struct alc_spec *spec = codec->spec;
4350
4351 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004352 spec->mic_led_coef.idx = 0x19;
4353 spec->mic_led_coef.mask = 1 << 13;
4354 spec->mic_led_coef.on = 1 << 13;
4355 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004356 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004357 }
4358}
4359
Kailang Yang24164f42020-04-07 14:52:42 +08004360static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4361 const struct hda_fixup *fix, int action)
4362{
4363 struct alc_spec *spec = codec->spec;
4364
4365 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004366 spec->mic_led_coef.idx = 0x35;
4367 spec->mic_led_coef.mask = 3 << 2;
4368 spec->mic_led_coef.on = 2 << 2;
4369 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004370 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004371 }
4372}
4373
Kailang Yang431e76c2020-04-07 14:40:20 +08004374static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4375 const struct hda_fixup *fix, int action)
4376{
4377 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4378 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4379}
4380
Kailang Yang24164f42020-04-07 14:52:42 +08004381static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4382 const struct hda_fixup *fix, int action)
4383{
4384 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4385 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4386}
4387
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004388#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004389static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4390 struct hda_jack_callback *event)
4391{
4392 struct alc_spec *spec = codec->spec;
4393
4394 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4395 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004396 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004397 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004398 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004399 input_sync(spec->kb_dev);
4400}
David Henningsson33f4acd2015-01-07 15:50:13 +01004401
Kailang3694cb22015-12-28 11:35:24 +08004402static int alc_register_micmute_input_device(struct hda_codec *codec)
4403{
4404 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004405 int i;
Kailang3694cb22015-12-28 11:35:24 +08004406
4407 spec->kb_dev = input_allocate_device();
4408 if (!spec->kb_dev) {
4409 codec_err(codec, "Out of memory (input_allocate_device)\n");
4410 return -ENOMEM;
4411 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004412
4413 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4414
Kailang3694cb22015-12-28 11:35:24 +08004415 spec->kb_dev->name = "Microphone Mute Button";
4416 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004417 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4418 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4419 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4420 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4421 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004422
4423 if (input_register_device(spec->kb_dev)) {
4424 codec_err(codec, "input_register_device failed\n");
4425 input_free_device(spec->kb_dev);
4426 spec->kb_dev = NULL;
4427 return -ENOMEM;
4428 }
4429
4430 return 0;
4431}
4432
Takashi Iwai01e4a272018-06-19 22:47:30 +02004433/* GPIO1 = set according to SKU external amp
4434 * GPIO2 = mic mute hotkey
4435 * GPIO3 = mute LED
4436 * GPIO4 = mic mute LED
4437 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004438static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4439 const struct hda_fixup *fix, int action)
4440{
David Henningsson33f4acd2015-01-07 15:50:13 +01004441 struct alc_spec *spec = codec->spec;
4442
Takashi Iwai01e4a272018-06-19 22:47:30 +02004443 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004444 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004445 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004446 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004447 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004448
Takashi Iwai01e4a272018-06-19 22:47:30 +02004449 spec->gpio_mask |= 0x06;
4450 spec->gpio_dir |= 0x02;
4451 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004452 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004453 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004454 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004455 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004456 return;
4457 }
4458
4459 if (!spec->kb_dev)
4460 return;
4461
4462 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004463 case HDA_FIXUP_ACT_FREE:
4464 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004465 spec->kb_dev = NULL;
4466 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004467}
4468
Takashi Iwai01e4a272018-06-19 22:47:30 +02004469/* Line2 = mic mute hotkey
4470 * GPIO2 = mic mute LED
4471 */
Kailang3694cb22015-12-28 11:35:24 +08004472static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4473 const struct hda_fixup *fix, int action)
4474{
Kailang3694cb22015-12-28 11:35:24 +08004475 struct alc_spec *spec = codec->spec;
4476
Takashi Iwai01e4a272018-06-19 22:47:30 +02004477 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004478 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004479 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004480 if (alc_register_micmute_input_device(codec) != 0)
4481 return;
4482
Kailang3694cb22015-12-28 11:35:24 +08004483 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4484 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004485 return;
4486 }
4487
4488 if (!spec->kb_dev)
4489 return;
4490
4491 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004492 case HDA_FIXUP_ACT_FREE:
4493 input_unregister_device(spec->kb_dev);
4494 spec->kb_dev = NULL;
4495 }
4496}
Takashi Iwaic4696522018-01-15 10:44:35 +01004497#else /* INPUT */
4498#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4499#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4500#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004501
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004502static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4503 const struct hda_fixup *fix, int action)
4504{
4505 struct alc_spec *spec = codec->spec;
4506
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004507 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004508 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004509 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004510 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004511 }
4512}
4513
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004514static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004515 UPDATE_COEF(0x4a, 1<<8, 0),
4516 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4517 UPDATE_COEF(0x63, 3<<14, 3<<14),
4518 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4519 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4520 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4521 UPDATE_COEF(0x4a, 3<<10, 0),
4522 {}
4523};
4524
David Henningsson73bdd592013-04-15 15:44:14 +02004525static void alc_headset_mode_unplugged(struct hda_codec *codec)
4526{
Kailang Yang92666d42020-11-19 17:04:21 +08004527 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004528 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004529 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004530 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4531 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4532 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4533 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4534 {}
4535 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004536 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004537 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004538 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4539 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4540 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4541 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004542 {}
4543 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004544 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004545 WRITE_COEF(0x1b, 0x0c0b),
4546 WRITE_COEF(0x45, 0xc429),
4547 UPDATE_COEF(0x35, 0x4000, 0),
4548 WRITE_COEF(0x06, 0x2104),
4549 WRITE_COEF(0x1a, 0x0001),
4550 WRITE_COEF(0x26, 0x0004),
4551 WRITE_COEF(0x32, 0x42a3),
4552 {}
4553 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004554 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004555 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4556 UPDATE_COEF(0x50, 0x2000, 0x2000),
4557 UPDATE_COEF(0x56, 0x0006, 0x0006),
4558 UPDATE_COEF(0x66, 0x0008, 0),
4559 UPDATE_COEF(0x67, 0x2000, 0),
4560 {}
4561 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004562 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004563 UPDATE_COEF(0x19, 0x1300, 0x0300),
4564 {}
4565 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004566 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004567 WRITE_COEF(0x76, 0x000e),
4568 WRITE_COEF(0x6c, 0x2400),
4569 WRITE_COEF(0x18, 0x7308),
4570 WRITE_COEF(0x6b, 0xc429),
4571 {}
4572 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004573 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004574 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4575 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4576 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4577 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4578 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4579 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4580 {}
4581 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004582 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004583 WRITE_COEF(0x15, 0x0d40),
4584 WRITE_COEF(0xb7, 0x802b),
4585 {}
4586 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004587 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004588 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004589 {}
4590 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004591 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004592 UPDATE_COEF(0x4a, 0x0100, 0),
4593 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4594 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4595 UPDATE_COEF(0x4a, 0x0010, 0),
4596 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4597 WRITE_COEF(0x45, 0x5289),
4598 UPDATE_COEF(0x4a, 0x0c00, 0),
4599 {}
4600 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004601
Kailang Yang92666d42020-11-19 17:04:21 +08004602 if (spec->no_internal_mic_pin) {
4603 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4604 return;
4605 }
4606
Takashi Iwai7639a062015-03-03 10:07:24 +01004607 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004608 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004609 alc_process_coef_fw(codec, coef0255);
4610 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004611 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004612 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004613 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004614 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004615 case 0x10ec0234:
4616 case 0x10ec0274:
4617 case 0x10ec0294:
4618 alc_process_coef_fw(codec, coef0274);
4619 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004620 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004621 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004622 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004623 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004624 case 0x10ec0286:
4625 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004626 alc_process_coef_fw(codec, coef0288);
4627 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004628 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004629 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004630 alc_process_coef_fw(codec, coef0288);
4631 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004632 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004633 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004634 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004635 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004636 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004637 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004638 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004639 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004640 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004641 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004642 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004643 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004644 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004645 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004646 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004647 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004648 alc_process_coef_fw(codec, coef0225);
4649 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004650 case 0x10ec0867:
4651 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4652 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004653 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004654 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004655}
4656
4657
4658static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4659 hda_nid_t mic_pin)
4660{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004661 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004662 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4663 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4664 {}
4665 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004666 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004667 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4668 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4669 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4670 {}
4671 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004672 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004673 UPDATE_COEF(0x35, 0, 1<<14),
4674 WRITE_COEF(0x06, 0x2100),
4675 WRITE_COEF(0x1a, 0x0021),
4676 WRITE_COEF(0x26, 0x008c),
4677 {}
4678 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004679 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004680 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004681 UPDATE_COEF(0x50, 0x2000, 0),
4682 UPDATE_COEF(0x56, 0x0006, 0),
4683 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4684 UPDATE_COEF(0x66, 0x0008, 0x0008),
4685 UPDATE_COEF(0x67, 0x2000, 0x2000),
4686 {}
4687 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004688 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004689 WRITE_COEF(0x19, 0xa208),
4690 WRITE_COEF(0x2e, 0xacf0),
4691 {}
4692 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004693 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004694 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4695 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4696 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4697 {}
4698 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004699 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004700 WRITE_COEF(0xb7, 0x802b),
4701 WRITE_COEF(0xb5, 0x1040),
4702 UPDATE_COEF(0xc3, 0, 1<<12),
4703 {}
4704 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004705 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004706 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4707 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4708 UPDATE_COEF(0x63, 3<<14, 0),
4709 {}
4710 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004711 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004712 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4713 UPDATE_COEF(0x4a, 0x0010, 0),
4714 UPDATE_COEF(0x6b, 0xf000, 0),
4715 {}
4716 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004717
Takashi Iwai7639a062015-03-03 10:07:24 +01004718 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004719 case 0x10ec0255:
4720 alc_write_coef_idx(codec, 0x45, 0xc489);
4721 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004722 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004723 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4724 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004725 case 0x10ec0236:
4726 case 0x10ec0256:
4727 alc_write_coef_idx(codec, 0x45, 0xc489);
4728 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4729 alc_process_coef_fw(codec, coef0256);
4730 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4731 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004732 case 0x10ec0234:
4733 case 0x10ec0274:
4734 case 0x10ec0294:
4735 alc_write_coef_idx(codec, 0x45, 0x4689);
4736 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4737 alc_process_coef_fw(codec, coef0274);
4738 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4739 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004740 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004741 case 0x10ec0283:
4742 alc_write_coef_idx(codec, 0x45, 0xc429);
4743 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004744 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004745 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4746 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004747 case 0x10ec0286:
4748 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004749 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004750 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4751 alc_process_coef_fw(codec, coef0288);
4752 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4753 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004754 case 0x10ec0292:
4755 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004756 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004757 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004758 case 0x10ec0293:
4759 /* Set to TRS mode */
4760 alc_write_coef_idx(codec, 0x45, 0xc429);
4761 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004762 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004763 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4764 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004765 case 0x10ec0867:
4766 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05004767 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004768 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004769 case 0x10ec0662:
4770 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4771 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4772 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004773 case 0x10ec0668:
4774 alc_write_coef_idx(codec, 0x11, 0x0001);
4775 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004776 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004777 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4778 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004779 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004780 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004781 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004782 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004783 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004784 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004785 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004786 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4787 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4788 alc_process_coef_fw(codec, coef0225);
4789 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4790 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004791 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004792 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004793}
4794
4795static void alc_headset_mode_default(struct hda_codec *codec)
4796{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004797 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004798 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4799 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4800 UPDATE_COEF(0x49, 3<<8, 0<<8),
4801 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4802 UPDATE_COEF(0x63, 3<<14, 0),
4803 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004804 {}
4805 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004806 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004807 WRITE_COEF(0x45, 0xc089),
4808 WRITE_COEF(0x45, 0xc489),
4809 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4810 WRITE_COEF(0x49, 0x0049),
4811 {}
4812 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004813 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004814 WRITE_COEF(0x45, 0xc489),
4815 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4816 WRITE_COEF(0x49, 0x0049),
4817 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4818 WRITE_COEF(0x06, 0x6100),
4819 {}
4820 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004821 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004822 WRITE_COEF(0x06, 0x2100),
4823 WRITE_COEF(0x32, 0x4ea3),
4824 {}
4825 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004826 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004827 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4828 UPDATE_COEF(0x50, 0x2000, 0x2000),
4829 UPDATE_COEF(0x56, 0x0006, 0x0006),
4830 UPDATE_COEF(0x66, 0x0008, 0),
4831 UPDATE_COEF(0x67, 0x2000, 0),
4832 {}
4833 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004834 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004835 WRITE_COEF(0x76, 0x000e),
4836 WRITE_COEF(0x6c, 0x2400),
4837 WRITE_COEF(0x6b, 0xc429),
4838 WRITE_COEF(0x18, 0x7308),
4839 {}
4840 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004841 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004842 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4843 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4844 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4845 {}
4846 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004847 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004848 WRITE_COEF(0x11, 0x0041),
4849 WRITE_COEF(0x15, 0x0d40),
4850 WRITE_COEF(0xb7, 0x802b),
4851 {}
4852 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004853 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004854 WRITE_COEF(0x45, 0x4289),
4855 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4856 UPDATE_COEF(0x6b, 0x0f00, 0),
4857 UPDATE_COEF(0x49, 0x0300, 0x0300),
4858 {}
4859 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004860
Takashi Iwai7639a062015-03-03 10:07:24 +01004861 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004862 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004863 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004864 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004865 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004866 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004867 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004868 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004869 alc_process_coef_fw(codec, coef0225);
4870 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004871 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004872 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004873 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004874 case 0x10ec0236:
4875 case 0x10ec0256:
4876 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4877 alc_write_coef_idx(codec, 0x45, 0xc089);
4878 msleep(50);
4879 alc_process_coef_fw(codec, coef0256);
4880 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004881 case 0x10ec0234:
4882 case 0x10ec0274:
4883 case 0x10ec0294:
4884 alc_process_coef_fw(codec, coef0274);
4885 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004886 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004887 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004888 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004889 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004890 case 0x10ec0286:
4891 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004892 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004893 alc_process_coef_fw(codec, coef0288);
4894 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004895 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004896 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004897 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004898 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004899 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004900 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004901 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004902 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004903 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004904 case 0x10ec0867:
4905 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4906 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004907 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004908 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004909}
4910
4911/* Iphone type */
4912static void alc_headset_mode_ctia(struct hda_codec *codec)
4913{
Kailang Yang89542932017-07-17 15:03:43 +08004914 int val;
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, 0xd489), /* Set to CTIA type */
4918 WRITE_COEF(0x1b, 0x0c2b),
4919 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4920 {}
4921 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004922 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004923 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08004924 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08004925 {}
4926 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004927 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004928 WRITE_COEF(0x45, 0xd429),
4929 WRITE_COEF(0x1b, 0x0c2b),
4930 WRITE_COEF(0x32, 0x4ea3),
4931 {}
4932 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004933 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004934 UPDATE_COEF(0x50, 0x2000, 0x2000),
4935 UPDATE_COEF(0x56, 0x0006, 0x0006),
4936 UPDATE_COEF(0x66, 0x0008, 0),
4937 UPDATE_COEF(0x67, 0x2000, 0),
4938 {}
4939 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004940 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004941 WRITE_COEF(0x6b, 0xd429),
4942 WRITE_COEF(0x76, 0x0008),
4943 WRITE_COEF(0x18, 0x7388),
4944 {}
4945 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004946 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004947 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4948 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4949 {}
4950 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004951 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004952 WRITE_COEF(0x11, 0x0001),
4953 WRITE_COEF(0x15, 0x0d60),
4954 WRITE_COEF(0xc3, 0x0000),
4955 {}
4956 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004957 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004958 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004959 UPDATE_COEF(0x63, 3<<14, 2<<14),
4960 {}
4961 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004962 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004963 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4964 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004965 {}
4966 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004967
Takashi Iwai7639a062015-03-03 10:07:24 +01004968 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004969 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004970 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004971 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004972 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004973 case 0x10ec0256:
4974 alc_process_coef_fw(codec, coef0256);
4975 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004976 case 0x10ec0234:
4977 case 0x10ec0274:
4978 case 0x10ec0294:
4979 alc_write_coef_idx(codec, 0x45, 0xd689);
4980 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004981 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004982 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004983 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004984 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004985 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004986 val = alc_read_coef_idx(codec, 0x50);
4987 if (val & (1 << 12)) {
4988 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4989 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4990 msleep(300);
4991 } else {
4992 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4993 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4994 msleep(300);
4995 }
4996 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004997 case 0x10ec0286:
4998 case 0x10ec0288:
4999 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5000 msleep(300);
5001 alc_process_coef_fw(codec, coef0288);
5002 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005003 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005004 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005005 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005006 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005007 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005008 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005009 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005010 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005011 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005012 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005013 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005014 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005015 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005016 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005017 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005018 val = alc_read_coef_idx(codec, 0x45);
5019 if (val & (1 << 9))
5020 alc_process_coef_fw(codec, coef0225_2);
5021 else
5022 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005023 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005024 case 0x10ec0867:
5025 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5026 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005027 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005028 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005029}
5030
5031/* Nokia type */
5032static void alc_headset_mode_omtp(struct hda_codec *codec)
5033{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005034 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005035 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5036 WRITE_COEF(0x1b, 0x0c2b),
5037 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5038 {}
5039 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005040 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005041 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005042 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005043 {}
5044 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005045 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005046 WRITE_COEF(0x45, 0xe429),
5047 WRITE_COEF(0x1b, 0x0c2b),
5048 WRITE_COEF(0x32, 0x4ea3),
5049 {}
5050 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005051 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005052 UPDATE_COEF(0x50, 0x2000, 0x2000),
5053 UPDATE_COEF(0x56, 0x0006, 0x0006),
5054 UPDATE_COEF(0x66, 0x0008, 0),
5055 UPDATE_COEF(0x67, 0x2000, 0),
5056 {}
5057 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005058 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005059 WRITE_COEF(0x6b, 0xe429),
5060 WRITE_COEF(0x76, 0x0008),
5061 WRITE_COEF(0x18, 0x7388),
5062 {}
5063 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005064 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005065 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5066 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5067 {}
5068 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005069 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005070 WRITE_COEF(0x11, 0x0001),
5071 WRITE_COEF(0x15, 0x0d50),
5072 WRITE_COEF(0xc3, 0x0000),
5073 {}
5074 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005075 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005076 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005077 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005078 {}
5079 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005080
Takashi Iwai7639a062015-03-03 10:07:24 +01005081 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005082 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005083 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005084 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005085 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005086 case 0x10ec0256:
5087 alc_process_coef_fw(codec, coef0256);
5088 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005089 case 0x10ec0234:
5090 case 0x10ec0274:
5091 case 0x10ec0294:
5092 alc_write_coef_idx(codec, 0x45, 0xe689);
5093 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005094 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005095 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005096 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005097 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005098 case 0x10ec0298:
5099 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005100 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5101 msleep(300);
5102 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005103 case 0x10ec0286:
5104 case 0x10ec0288:
5105 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5106 msleep(300);
5107 alc_process_coef_fw(codec, coef0288);
5108 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005109 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005110 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005111 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005112 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005113 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005114 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005115 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005116 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005117 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005118 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005119 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005120 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005121 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005122 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005123 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005124 alc_process_coef_fw(codec, coef0225);
5125 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005126 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005127 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005128}
5129
5130static void alc_determine_headset_type(struct hda_codec *codec)
5131{
5132 int val;
5133 bool is_ctia = false;
5134 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005135 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005136 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5137 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5138 conteol) */
5139 {}
5140 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005141 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005142 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5143 {}
5144 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005145 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005146 UPDATE_COEF(0x50, 0x2000, 0x2000),
5147 UPDATE_COEF(0x56, 0x0006, 0x0006),
5148 UPDATE_COEF(0x66, 0x0008, 0),
5149 UPDATE_COEF(0x67, 0x2000, 0),
5150 UPDATE_COEF(0x19, 0x1300, 0x1300),
5151 {}
5152 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005153 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005154 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5155 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5156 {}
5157 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005158 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005159 WRITE_COEF(0x11, 0x0001),
5160 WRITE_COEF(0xb7, 0x802b),
5161 WRITE_COEF(0x15, 0x0d60),
5162 WRITE_COEF(0xc3, 0x0c00),
5163 {}
5164 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005165 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005166 UPDATE_COEF(0x4a, 0x0010, 0),
5167 UPDATE_COEF(0x4a, 0x8000, 0),
5168 WRITE_COEF(0x45, 0xd289),
5169 UPDATE_COEF(0x49, 0x0300, 0x0300),
5170 {}
5171 };
David Henningsson73bdd592013-04-15 15:44:14 +02005172
Kailang Yang92666d42020-11-19 17:04:21 +08005173 if (spec->no_internal_mic_pin) {
5174 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5175 return;
5176 }
5177
Takashi Iwai7639a062015-03-03 10:07:24 +01005178 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005179 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005180 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005181 msleep(300);
5182 val = alc_read_coef_idx(codec, 0x46);
5183 is_ctia = (val & 0x0070) == 0x0070;
5184 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08005185 case 0x10ec0236:
5186 case 0x10ec0256:
5187 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5188 alc_write_coef_idx(codec, 0x06, 0x6104);
5189 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5190
5191 snd_hda_codec_write(codec, 0x21, 0,
5192 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5193 msleep(80);
5194 snd_hda_codec_write(codec, 0x21, 0,
5195 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5196
5197 alc_process_coef_fw(codec, coef0255);
5198 msleep(300);
5199 val = alc_read_coef_idx(codec, 0x46);
5200 is_ctia = (val & 0x0070) == 0x0070;
5201
5202 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5203 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5204
5205 snd_hda_codec_write(codec, 0x21, 0,
5206 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5207 msleep(80);
5208 snd_hda_codec_write(codec, 0x21, 0,
5209 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5210 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005211 case 0x10ec0234:
5212 case 0x10ec0274:
5213 case 0x10ec0294:
5214 alc_process_coef_fw(codec, coef0274);
5215 msleep(80);
5216 val = alc_read_coef_idx(codec, 0x46);
5217 is_ctia = (val & 0x00f0) == 0x00f0;
5218 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005219 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005220 case 0x10ec0283:
5221 alc_write_coef_idx(codec, 0x45, 0xd029);
5222 msleep(300);
5223 val = alc_read_coef_idx(codec, 0x46);
5224 is_ctia = (val & 0x0070) == 0x0070;
5225 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005226 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005227 snd_hda_codec_write(codec, 0x21, 0,
5228 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5229 msleep(100);
5230 snd_hda_codec_write(codec, 0x21, 0,
5231 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5232 msleep(200);
5233
5234 val = alc_read_coef_idx(codec, 0x50);
5235 if (val & (1 << 12)) {
5236 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5237 alc_process_coef_fw(codec, coef0288);
5238 msleep(350);
5239 val = alc_read_coef_idx(codec, 0x50);
5240 is_ctia = (val & 0x0070) == 0x0070;
5241 } else {
5242 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5243 alc_process_coef_fw(codec, coef0288);
5244 msleep(350);
5245 val = alc_read_coef_idx(codec, 0x50);
5246 is_ctia = (val & 0x0070) == 0x0070;
5247 }
5248 alc_process_coef_fw(codec, coef0298);
5249 snd_hda_codec_write(codec, 0x21, 0,
5250 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5251 msleep(75);
5252 snd_hda_codec_write(codec, 0x21, 0,
5253 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5254 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005255 case 0x10ec0286:
5256 case 0x10ec0288:
5257 alc_process_coef_fw(codec, coef0288);
5258 msleep(350);
5259 val = alc_read_coef_idx(codec, 0x50);
5260 is_ctia = (val & 0x0070) == 0x0070;
5261 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005262 case 0x10ec0292:
5263 alc_write_coef_idx(codec, 0x6b, 0xd429);
5264 msleep(300);
5265 val = alc_read_coef_idx(codec, 0x6c);
5266 is_ctia = (val & 0x001c) == 0x001c;
5267 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005268 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005269 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005270 msleep(300);
5271 val = alc_read_coef_idx(codec, 0x46);
5272 is_ctia = (val & 0x0070) == 0x0070;
5273 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005274 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005275 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005276 msleep(300);
5277 val = alc_read_coef_idx(codec, 0xbe);
5278 is_ctia = (val & 0x1c02) == 0x1c02;
5279 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005280 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005281 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005282 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005283 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005284 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005285 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005286 snd_hda_codec_write(codec, 0x21, 0,
5287 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5288 msleep(80);
5289 snd_hda_codec_write(codec, 0x21, 0,
5290 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5291
Kailang Yang5a367672017-07-21 15:23:53 +08005292 alc_process_coef_fw(codec, alc225_pre_hsmode);
5293 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5294 val = alc_read_coef_idx(codec, 0x45);
5295 if (val & (1 << 9)) {
5296 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5297 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5298 msleep(800);
5299 val = alc_read_coef_idx(codec, 0x46);
5300 is_ctia = (val & 0x00f0) == 0x00f0;
5301 } else {
5302 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5303 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5304 msleep(800);
5305 val = alc_read_coef_idx(codec, 0x46);
5306 is_ctia = (val & 0x00f0) == 0x00f0;
5307 }
5308 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5309 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5310 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005311
5312 snd_hda_codec_write(codec, 0x21, 0,
5313 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5314 msleep(80);
5315 snd_hda_codec_write(codec, 0x21, 0,
5316 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005317 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005318 case 0x10ec0867:
5319 is_ctia = true;
5320 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005321 }
5322
Takashi Iwai4e76a882014-02-25 12:21:03 +01005323 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005324 is_ctia ? "yes" : "no");
5325 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5326}
5327
5328static void alc_update_headset_mode(struct hda_codec *codec)
5329{
5330 struct alc_spec *spec = codec->spec;
5331
5332 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005333 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005334
5335 int new_headset_mode;
5336
5337 if (!snd_hda_jack_detect(codec, hp_pin))
5338 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5339 else if (mux_pin == spec->headset_mic_pin)
5340 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5341 else if (mux_pin == spec->headphone_mic_pin)
5342 new_headset_mode = ALC_HEADSET_MODE_MIC;
5343 else
5344 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5345
David Henningsson5959a6b2013-11-12 11:10:57 +01005346 if (new_headset_mode == spec->current_headset_mode) {
5347 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005348 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005349 }
David Henningsson73bdd592013-04-15 15:44:14 +02005350
5351 switch (new_headset_mode) {
5352 case ALC_HEADSET_MODE_UNPLUGGED:
5353 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005354 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5355 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005356 spec->gen.hp_jack_present = false;
5357 break;
5358 case ALC_HEADSET_MODE_HEADSET:
5359 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5360 alc_determine_headset_type(codec);
5361 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5362 alc_headset_mode_ctia(codec);
5363 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5364 alc_headset_mode_omtp(codec);
5365 spec->gen.hp_jack_present = true;
5366 break;
5367 case ALC_HEADSET_MODE_MIC:
5368 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5369 spec->gen.hp_jack_present = false;
5370 break;
5371 case ALC_HEADSET_MODE_HEADPHONE:
5372 alc_headset_mode_default(codec);
5373 spec->gen.hp_jack_present = true;
5374 break;
5375 }
5376 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5377 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5378 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005379 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005380 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5381 PIN_VREFHIZ);
5382 }
5383 spec->current_headset_mode = new_headset_mode;
5384
5385 snd_hda_gen_update_outputs(codec);
5386}
5387
5388static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005389 struct snd_kcontrol *kcontrol,
5390 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005391{
5392 alc_update_headset_mode(codec);
5393}
5394
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005395static void alc_update_headset_jack_cb(struct hda_codec *codec,
5396 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005397{
David Henningsson73bdd592013-04-15 15:44:14 +02005398 snd_hda_gen_hp_automute(codec, jack);
5399}
5400
5401static void alc_probe_headset_mode(struct hda_codec *codec)
5402{
5403 int i;
5404 struct alc_spec *spec = codec->spec;
5405 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5406
5407 /* Find mic pins */
5408 for (i = 0; i < cfg->num_inputs; i++) {
5409 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5410 spec->headset_mic_pin = cfg->inputs[i].pin;
5411 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5412 spec->headphone_mic_pin = cfg->inputs[i].pin;
5413 }
5414
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005415 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005416 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5417 spec->gen.automute_hook = alc_update_headset_mode;
5418 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5419}
5420
5421static void alc_fixup_headset_mode(struct hda_codec *codec,
5422 const struct hda_fixup *fix, int action)
5423{
5424 struct alc_spec *spec = codec->spec;
5425
5426 switch (action) {
5427 case HDA_FIXUP_ACT_PRE_PROBE:
5428 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5429 break;
5430 case HDA_FIXUP_ACT_PROBE:
5431 alc_probe_headset_mode(codec);
5432 break;
5433 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005434 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5435 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5436 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5437 }
David Henningsson73bdd592013-04-15 15:44:14 +02005438 alc_update_headset_mode(codec);
5439 break;
5440 }
5441}
5442
5443static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5444 const struct hda_fixup *fix, int action)
5445{
5446 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5447 struct alc_spec *spec = codec->spec;
5448 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5449 }
5450 else
5451 alc_fixup_headset_mode(codec, fix, action);
5452}
5453
Kailang Yang31278992014-03-03 15:27:22 +08005454static void alc255_set_default_jack_type(struct hda_codec *codec)
5455{
5456 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005457 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005458 WRITE_COEF(0x1b, 0x880b),
5459 WRITE_COEF(0x45, 0xd089),
5460 WRITE_COEF(0x1b, 0x080b),
5461 WRITE_COEF(0x46, 0x0004),
5462 WRITE_COEF(0x1b, 0x0c0b),
5463 {}
5464 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005465 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005466 WRITE_COEF(0x1b, 0x884b),
5467 WRITE_COEF(0x45, 0xd089),
5468 WRITE_COEF(0x1b, 0x084b),
5469 WRITE_COEF(0x46, 0x0004),
5470 WRITE_COEF(0x1b, 0x0c4b),
5471 {}
5472 };
5473 switch (codec->core.vendor_id) {
5474 case 0x10ec0255:
5475 alc_process_coef_fw(codec, alc255fw);
5476 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005477 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005478 case 0x10ec0256:
5479 alc_process_coef_fw(codec, alc256fw);
5480 break;
5481 }
Kailang Yang31278992014-03-03 15:27:22 +08005482 msleep(30);
5483}
5484
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005485static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5486 const struct hda_fixup *fix, int action)
5487{
5488 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005489 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005490 }
5491 alc_fixup_headset_mode(codec, fix, action);
5492}
5493
Kailang Yang31278992014-03-03 15:27:22 +08005494static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5495 const struct hda_fixup *fix, int action)
5496{
5497 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5498 struct alc_spec *spec = codec->spec;
5499 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5500 alc255_set_default_jack_type(codec);
5501 }
5502 else
5503 alc_fixup_headset_mode(codec, fix, action);
5504}
5505
Kailang Yange1e62b92015-04-08 16:01:22 +08005506static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5507 struct hda_jack_callback *jack)
5508{
5509 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005510
5511 alc_update_headset_jack_cb(codec, jack);
5512 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005513 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005514}
5515
5516static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5517 const struct hda_fixup *fix, int action)
5518{
5519 alc_fixup_headset_mode(codec, fix, action);
5520 if (action == HDA_FIXUP_ACT_PROBE) {
5521 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005522 /* toggled via hp_automute_hook */
5523 spec->gpio_mask |= 0x40;
5524 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005525 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5526 }
5527}
5528
Hui Wang493a52a2014-01-14 14:07:36 +08005529static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5530 const struct hda_fixup *fix, int action)
5531{
5532 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5533 struct alc_spec *spec = codec->spec;
5534 spec->gen.auto_mute_via_amp = 1;
5535 }
5536}
5537
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005538static void alc_fixup_no_shutup(struct hda_codec *codec,
5539 const struct hda_fixup *fix, int action)
5540{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005541 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005542 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005543 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005544 }
5545}
5546
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005547static void alc_fixup_disable_aamix(struct hda_codec *codec,
5548 const struct hda_fixup *fix, int action)
5549{
5550 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5551 struct alc_spec *spec = codec->spec;
5552 /* Disable AA-loopback as it causes white noise */
5553 spec->gen.mixer_nid = 0;
5554 }
5555}
5556
Takashi Iwai7f57d802015-09-24 17:36:51 +02005557/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5558static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5559 const struct hda_fixup *fix, int action)
5560{
5561 static const struct hda_pintbl pincfgs[] = {
5562 { 0x16, 0x21211010 }, /* dock headphone */
5563 { 0x19, 0x21a11010 }, /* dock mic */
5564 { }
5565 };
5566 struct alc_spec *spec = codec->spec;
5567
5568 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Hui Wang871b9062019-08-14 12:09:08 +08005569 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02005570 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5571 codec->power_save_node = 0; /* avoid click noises */
5572 snd_hda_apply_pincfgs(codec, pincfgs);
5573 }
5574}
5575
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005576static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5577 const struct hda_fixup *fix, int action)
5578{
5579 static const struct hda_pintbl pincfgs[] = {
5580 { 0x17, 0x21211010 }, /* dock headphone */
5581 { 0x19, 0x21a11010 }, /* dock mic */
5582 { }
5583 };
5584 struct alc_spec *spec = codec->spec;
5585
5586 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5587 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005588 snd_hda_apply_pincfgs(codec, pincfgs);
5589 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005590 /* Enable DOCK device */
5591 snd_hda_codec_write(codec, 0x17, 0,
5592 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5593 /* Enable DOCK device */
5594 snd_hda_codec_write(codec, 0x19, 0,
5595 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005596 }
5597}
5598
Takashi Iwai399c01a2020-05-26 08:24:06 +02005599static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5600 const struct hda_fixup *fix, int action)
5601{
5602 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5603 * the speaker output becomes too low by some reason on Thinkpads with
5604 * ALC298 codec
5605 */
5606 static const hda_nid_t preferred_pairs[] = {
5607 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5608 0
5609 };
5610 struct alc_spec *spec = codec->spec;
5611
5612 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5613 spec->gen.preferred_dacs = preferred_pairs;
5614}
5615
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005616static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005617{
5618 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005619 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005620
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005621 /* Prevent pop noises when headphones are plugged in */
5622 snd_hda_codec_write(codec, hp_pin, 0,
5623 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5624 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005625}
5626
5627static void alc_fixup_dell_xps13(struct hda_codec *codec,
5628 const struct hda_fixup *fix, int action)
5629{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005630 struct alc_spec *spec = codec->spec;
5631 struct hda_input_mux *imux = &spec->gen.input_mux;
5632 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005633
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005634 switch (action) {
5635 case HDA_FIXUP_ACT_PRE_PROBE:
5636 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5637 * it causes a click noise at start up
5638 */
5639 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005640 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005641 break;
5642 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005643 /* Make the internal mic the default input source. */
5644 for (i = 0; i < imux->num_items; i++) {
5645 if (spec->gen.imux_pins[i] == 0x12) {
5646 spec->gen.cur_mux[0] = i;
5647 break;
5648 }
5649 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005650 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005651 }
5652}
5653
David Henningsson1f8b46c2015-05-12 14:38:15 +02005654static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5655 const struct hda_fixup *fix, int action)
5656{
5657 struct alc_spec *spec = codec->spec;
5658
5659 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5660 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5661 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005662
5663 /* Disable boost for mic-in permanently. (This code is only called
5664 from quirks that guarantee that the headphone is at NID 0x1b.) */
5665 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5666 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005667 } else
5668 alc_fixup_headset_mode(codec, fix, action);
5669}
5670
David Henningsson73bdd592013-04-15 15:44:14 +02005671static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5672 const struct hda_fixup *fix, int action)
5673{
5674 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005675 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005676 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005677 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5678 }
5679 alc_fixup_headset_mode(codec, fix, action);
5680}
5681
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005682/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5683static int find_ext_mic_pin(struct hda_codec *codec)
5684{
5685 struct alc_spec *spec = codec->spec;
5686 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5687 hda_nid_t nid;
5688 unsigned int defcfg;
5689 int i;
5690
5691 for (i = 0; i < cfg->num_inputs; i++) {
5692 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5693 continue;
5694 nid = cfg->inputs[i].pin;
5695 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5696 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5697 continue;
5698 return nid;
5699 }
5700
5701 return 0;
5702}
5703
Dylan Reid08a978d2012-11-18 22:56:40 -08005704static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005705 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005706 int action)
5707{
5708 struct alc_spec *spec = codec->spec;
5709
Takashi Iwai0db75792013-01-23 13:57:20 +01005710 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005711 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005712 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005713
5714 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005715 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005716 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005717 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005718}
David Henningsson693b6132012-06-22 19:12:10 +02005719
David Henningsson3e0d6112013-04-22 14:30:14 +02005720static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5721 const struct hda_fixup *fix,
5722 int action)
5723{
5724 struct alc_spec *spec = codec->spec;
5725 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5726 int i;
5727
5728 /* The mic boosts on level 2 and 3 are too noisy
5729 on the internal mic input.
5730 Therefore limit the boost to 0 or 1. */
5731
5732 if (action != HDA_FIXUP_ACT_PROBE)
5733 return;
5734
5735 for (i = 0; i < cfg->num_inputs; i++) {
5736 hda_nid_t nid = cfg->inputs[i].pin;
5737 unsigned int defcfg;
5738 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5739 continue;
5740 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5741 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5742 continue;
5743
5744 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5745 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5746 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5747 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5748 (0 << AC_AMPCAP_MUTE_SHIFT));
5749 }
5750}
5751
Kailang Yangcd217a62013-08-22 10:15:24 +02005752static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005753 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005754{
5755 struct alc_spec *spec = codec->spec;
5756 int vref;
5757
5758 msleep(200);
5759 snd_hda_gen_hp_automute(codec, jack);
5760
5761 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5762
5763 msleep(600);
5764 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5765 vref);
5766}
5767
Kailang Yangcd217a62013-08-22 10:15:24 +02005768static void alc283_fixup_chromebook(struct hda_codec *codec,
5769 const struct hda_fixup *fix, int action)
5770{
5771 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005772
5773 switch (action) {
5774 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005775 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005776 /* Disable AA-loopback as it causes white noise */
5777 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005778 break;
5779 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005780 /* MIC2-VREF control */
5781 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005782 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005783 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005784 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005785 break;
5786 }
5787}
5788
5789static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5790 const struct hda_fixup *fix, int action)
5791{
5792 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005793
5794 switch (action) {
5795 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005796 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5797 break;
5798 case HDA_FIXUP_ACT_INIT:
5799 /* MIC2-VREF control */
5800 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005801 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005802 break;
5803 }
5804}
5805
Takashi Iwai7bba2152013-09-06 15:45:38 +02005806/* mute tablet speaker pin (0x14) via dock plugging in addition */
5807static void asus_tx300_automute(struct hda_codec *codec)
5808{
5809 struct alc_spec *spec = codec->spec;
5810 snd_hda_gen_update_outputs(codec);
5811 if (snd_hda_jack_detect(codec, 0x1b))
5812 spec->gen.mute_bits |= (1ULL << 0x14);
5813}
5814
5815static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5816 const struct hda_fixup *fix, int action)
5817{
5818 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005819 static const struct hda_pintbl dock_pins[] = {
5820 { 0x1b, 0x21114000 }, /* dock speaker pin */
5821 {}
5822 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005823
5824 switch (action) {
5825 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005826 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02005827 /* TX300 needs to set up GPIO2 for the speaker amp */
5828 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02005829 snd_hda_apply_pincfgs(codec, dock_pins);
5830 spec->gen.auto_mute_via_amp = 1;
5831 spec->gen.automute_hook = asus_tx300_automute;
5832 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005833 snd_hda_gen_hp_automute);
5834 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005835 case HDA_FIXUP_ACT_PROBE:
5836 spec->init_amp = ALC_INIT_DEFAULT;
5837 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005838 case HDA_FIXUP_ACT_BUILD:
5839 /* this is a bit tricky; give more sane names for the main
5840 * (tablet) speaker and the dock speaker, respectively
5841 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005842 rename_ctl(codec, "Speaker Playback Switch",
5843 "Dock Speaker Playback Switch");
5844 rename_ctl(codec, "Bass Speaker Playback Switch",
5845 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005846 break;
5847 }
5848}
5849
David Henningsson338cae52013-10-07 10:39:59 +02005850static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5851 const struct hda_fixup *fix, int action)
5852{
David Henningsson0f4881d2013-12-20 16:08:13 +01005853 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5854 /* DAC node 0x03 is giving mono output. We therefore want to
5855 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5856 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005857 static const hda_nid_t conn1[] = { 0x0c };
5858 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
5859 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01005860 }
David Henningsson338cae52013-10-07 10:39:59 +02005861}
5862
Hui Wangdd9aa332016-08-01 10:20:32 +08005863static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5864 const struct hda_fixup *fix, int action)
5865{
5866 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5867 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5868 we can't adjust the speaker's volume since this node does not has
5869 Amp-out capability. we change the speaker's route to:
5870 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5871 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5872 speaker's volume now. */
5873
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005874 static const hda_nid_t conn1[] = { 0x0c };
5875 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08005876 }
5877}
5878
Takashi Iwaie312a862018-03-06 12:14:17 +01005879/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5880static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5881 const struct hda_fixup *fix, int action)
5882{
5883 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005884 static const hda_nid_t conn[] = { 0x02, 0x03 };
5885 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01005886 }
5887}
5888
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01005889/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
5890static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
5891 const struct hda_fixup *fix, int action)
5892{
5893 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005894 static const hda_nid_t conn[] = { 0x02 };
5895 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01005896 }
5897}
5898
Keith Packard98973f22015-07-15 12:14:39 -07005899/* Hook to update amp GPIO4 for automute */
5900static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5901 struct hda_jack_callback *jack)
5902{
5903 struct alc_spec *spec = codec->spec;
5904
5905 snd_hda_gen_hp_automute(codec, jack);
5906 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08005907 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
5908 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07005909}
5910
5911/* Manage GPIOs for HP EliteBook Folio 9480m.
5912 *
5913 * GPIO4 is the headphone amplifier power control
5914 * GPIO3 is the audio output mute indicator LED
5915 */
5916
5917static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5918 const struct hda_fixup *fix,
5919 int action)
5920{
5921 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07005922
Takashi Iwai01e4a272018-06-19 22:47:30 +02005923 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07005924 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02005925 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5926 spec->gpio_mask |= 0x10;
5927 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07005928 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07005929 }
5930}
5931
Takashi Iwaiae065f12018-06-19 23:00:03 +02005932static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5933 const struct hda_fixup *fix,
5934 int action)
5935{
5936 struct alc_spec *spec = codec->spec;
5937
5938 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5939 spec->gpio_mask |= 0x04;
5940 spec->gpio_dir |= 0x04;
5941 /* set data bit low */
5942 }
5943}
5944
Takashi Iwai6a6660d2020-09-03 10:33:00 +02005945/* Quirk for Thinkpad X1 7th and 8th Gen
5946 * The following fixed routing needed
5947 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
5948 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
5949 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
5950 */
5951static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
5952 const struct hda_fixup *fix, int action)
5953{
5954 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
5955 static const hda_nid_t preferred_pairs[] = {
5956 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
5957 };
5958 struct alc_spec *spec = codec->spec;
5959
5960 switch (action) {
5961 case HDA_FIXUP_ACT_PRE_PROBE:
5962 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
5963 spec->gen.preferred_dacs = preferred_pairs;
5964 break;
5965 case HDA_FIXUP_ACT_BUILD:
5966 /* The generic parser creates somewhat unintuitive volume ctls
5967 * with the fixed routing above, and the shared DAC2 may be
5968 * confusing for PA.
5969 * Rename those to unique names so that PA doesn't touch them
5970 * and use only Master volume.
5971 */
5972 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
5973 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
5974 break;
5975 }
5976}
5977
Kailang Yangca169cc2017-04-25 16:17:40 +08005978static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5979 const struct hda_fixup *fix,
5980 int action)
5981{
5982 alc_fixup_dual_codecs(codec, fix, action);
5983 switch (action) {
5984 case HDA_FIXUP_ACT_PRE_PROBE:
5985 /* override card longname to provide a unique UCM profile */
5986 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5987 break;
5988 case HDA_FIXUP_ACT_BUILD:
5989 /* rename Capture controls depending on the codec */
5990 rename_ctl(codec, "Capture Volume",
5991 codec->addr == 0 ?
5992 "Rear-Panel Capture Volume" :
5993 "Front-Panel Capture Volume");
5994 rename_ctl(codec, "Capture Switch",
5995 codec->addr == 0 ?
5996 "Rear-Panel Capture Switch" :
5997 "Front-Panel Capture Switch");
5998 break;
5999 }
6000}
6001
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006002static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6003 const struct hda_fixup *fix, int action)
6004{
6005 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6006 return;
6007
6008 codec->power_save_node = 1;
6009}
6010
Kailang Yang92266652017-12-14 15:28:58 +08006011/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6012static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6013 const struct hda_fixup *fix, int action)
6014{
6015 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006016 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08006017 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6018 0
6019 };
6020
6021 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6022 return;
6023
6024 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08006025 spec->gen.auto_mute_via_amp = 1;
6026 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08006027}
6028
Hui Wangc4cfcf62018-11-26 14:17:16 +08006029/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6030static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6031 const struct hda_fixup *fix, int action)
6032{
6033 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6034 return;
6035
6036 snd_hda_override_wcaps(codec, 0x03, 0);
6037}
6038
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006039static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6040{
6041 switch (codec->core.vendor_id) {
6042 case 0x10ec0274:
6043 case 0x10ec0294:
6044 case 0x10ec0225:
6045 case 0x10ec0295:
6046 case 0x10ec0299:
6047 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6048 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6049 break;
6050 case 0x10ec0235:
6051 case 0x10ec0236:
6052 case 0x10ec0255:
6053 case 0x10ec0256:
6054 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6055 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6056 break;
6057 }
6058}
6059
Kailang Yang8983eb62019-04-03 15:31:49 +08006060static void alc295_fixup_chromebook(struct hda_codec *codec,
6061 const struct hda_fixup *fix, int action)
6062{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006063 struct alc_spec *spec = codec->spec;
6064
Kailang Yang8983eb62019-04-03 15:31:49 +08006065 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006066 case HDA_FIXUP_ACT_PRE_PROBE:
6067 spec->ultra_low_power = true;
6068 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006069 case HDA_FIXUP_ACT_INIT:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006070 alc_combo_jack_hp_jd_restart(codec);
Kailang Yang8983eb62019-04-03 15:31:49 +08006071 break;
6072 }
6073}
6074
Kailang Yangd1dd4212019-01-09 17:05:24 +08006075static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6076 const struct hda_fixup *fix, int action)
6077{
6078 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6079 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6080}
6081
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006082
6083static void alc294_gx502_toggle_output(struct hda_codec *codec,
6084 struct hda_jack_callback *cb)
6085{
6086 /* The Windows driver sets the codec up in a very different way where
6087 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6088 */
6089 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6090 alc_write_coef_idx(codec, 0x10, 0x8a20);
6091 else
6092 alc_write_coef_idx(codec, 0x10, 0x0a20);
6093}
6094
6095static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6096 const struct hda_fixup *fix, int action)
6097{
6098 /* Pin 0x21: headphones/headset mic */
6099 if (!is_jack_detectable(codec, 0x21))
6100 return;
6101
6102 switch (action) {
6103 case HDA_FIXUP_ACT_PRE_PROBE:
6104 snd_hda_jack_detect_enable_callback(codec, 0x21,
6105 alc294_gx502_toggle_output);
6106 break;
6107 case HDA_FIXUP_ACT_INIT:
6108 /* Make sure to start in a correct state, i.e. if
6109 * headphones have been plugged in before powering up the system
6110 */
6111 alc294_gx502_toggle_output(codec, NULL);
6112 break;
6113 }
6114}
6115
Kailang Yang56496252020-07-29 15:09:27 +08006116static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6117 const struct hda_fixup *fix, int action)
6118{
6119 if (action != HDA_FIXUP_ACT_INIT)
6120 return;
6121
6122 msleep(100);
6123 alc_write_coef_idx(codec, 0x65, 0x0);
6124}
6125
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006126static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6127 const struct hda_fixup *fix, int action)
6128{
6129 switch (action) {
6130 case HDA_FIXUP_ACT_INIT:
6131 alc_combo_jack_hp_jd_restart(codec);
6132 break;
6133 }
6134}
6135
Kailang Yang92666d42020-11-19 17:04:21 +08006136static void alc_fixup_no_int_mic(struct hda_codec *codec,
6137 const struct hda_fixup *fix, int action)
6138{
6139 struct alc_spec *spec = codec->spec;
6140
6141 switch (action) {
6142 case HDA_FIXUP_ACT_PRE_PROBE:
6143 /* Mic RING SLEEVE swap for combo jack */
6144 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6145 spec->no_internal_mic_pin = true;
6146 break;
6147 case HDA_FIXUP_ACT_INIT:
6148 alc_combo_jack_hp_jd_restart(codec);
6149 break;
6150 }
6151}
6152
Takashi Iwaib317b032014-01-08 11:44:21 +01006153/* for hda_fixup_thinkpad_acpi() */
6154#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006155
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006156static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6157 const struct hda_fixup *fix, int action)
6158{
6159 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6160 hda_fixup_thinkpad_acpi(codec, fix, action);
6161}
6162
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006163/* for alc295_fixup_hp_top_speakers */
6164#include "hp_x360_helper.c"
6165
Takashi Iwai1d045db2011-07-07 18:23:21 +02006166enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006167 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006168 ALC269_FIXUP_SONY_VAIO,
6169 ALC275_FIXUP_SONY_VAIO_GPIO2,
6170 ALC269_FIXUP_DELL_M101Z,
6171 ALC269_FIXUP_SKU_IGNORE,
6172 ALC269_FIXUP_ASUS_G73JW,
6173 ALC269_FIXUP_LENOVO_EAPD,
6174 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006175 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006176 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006177 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006178 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006179 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006180 ALC269_FIXUP_QUANTA_MUTE,
6181 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006182 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006183 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006184 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006185 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006186 ALC269_FIXUP_AMIC,
6187 ALC269_FIXUP_DMIC,
6188 ALC269VB_FIXUP_AMIC,
6189 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006190 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006191 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006192 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006193 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006194 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006195 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6196 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006197 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006198 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006199 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006200 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006201 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006202 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006203 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6204 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006205 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006206 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006207 ALC269_FIXUP_HEADSET_MODE,
6208 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006209 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006210 ALC269_FIXUP_ASUS_X101_FUNC,
6211 ALC269_FIXUP_ASUS_X101_VERB,
6212 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006213 ALC271_FIXUP_AMIC_MIC2,
6214 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006215 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006216 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006217 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006218 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006219 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006220 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006221 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006222 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006223 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006224 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006225 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006226 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006227 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6228 ALC290_FIXUP_SUBWOOFER,
6229 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006230 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006231 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006232 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006233 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006234 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006235 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006236 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006237 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006238 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006239 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006240 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006241 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006242 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006243 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01006244 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006245 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006246 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006247 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006248 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006249 ALC280_FIXUP_HP_9480M,
Kailang Yange1e62b92015-04-08 16:01:22 +08006250 ALC288_FIXUP_DELL_HEADSET_MODE,
6251 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006252 ALC288_FIXUP_DELL_XPS_13,
6253 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006254 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006255 ALC292_FIXUP_DELL_E7X,
6256 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006257 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006258 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006259 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006260 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006261 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006262 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006263 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006264 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006265 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006266 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006267 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006268 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006269 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006270 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006271 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006272 ALC298_FIXUP_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006273 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006274 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006275 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006276 ALC256_FIXUP_ASUS_HEADSET_MODE,
6277 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006278 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006279 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6280 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006281 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006282 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006283 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006284 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006285 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006286 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006287 ALC274_FIXUP_DELL_BIND_DACS,
6288 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006289 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006290 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006291 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006292 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006293 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006294 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006295 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006296 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006297 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006298 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006299 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006300 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006301 ALC294_FIXUP_ASUS_HEADSET_MIC,
6302 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006303 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006304 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006305 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006306 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006307 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006308 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6309 ALC225_FIXUP_WYSE_AUTO_MUTE,
6310 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006311 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006312 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006313 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006314 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006315 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006316 ALC289_FIXUP_DELL_SPK2,
6317 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006318 ALC294_FIXUP_SPK2_TO_DAC1,
6319 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006320 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006321 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006322 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006323 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006324 ALC294_FIXUP_ASUS_GX502_HP,
6325 ALC294_FIXUP_ASUS_GX502_PINS,
6326 ALC294_FIXUP_ASUS_GX502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006327 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006328 ALC285_FIXUP_HP_MUTE_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006329 ALC236_FIXUP_HP_MUTE_LED,
Mike Pozulp14425f12020-05-09 20:28:37 -07006330 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006331 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006332 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006333 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006334 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006335 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006336 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006337 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006338 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006339 ALC269_FIXUP_CZC_B20,
6340 ALC269_FIXUP_CZC_TMI,
6341 ALC269_FIXUP_CZC_L101,
6342 ALC269_FIXUP_LEMOTE_A1802,
6343 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006344 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Hui Wangfc19d552020-09-09 10:00:41 +08006345 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006346 ALC274_FIXUP_HP_MIC,
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006347 ALC274_FIXUP_HP_HEADSET_MIC,
Kailang Yangef9ce662020-11-03 15:40:35 +08006348 ALC256_FIXUP_ASUS_HPE,
Kailang Yang446b8182020-11-02 15:00:12 +08006349 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Kailang Yanga0ccbc52020-11-06 15:20:38 +08006350 ALC287_FIXUP_HP_GPIO_LED,
Kailang Yang9e885772020-11-03 15:30:51 +08006351 ALC256_FIXUP_HP_HEADSET_MIC,
Kailang Yang92666d42020-11-19 17:04:21 +08006352 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006353};
6354
Takashi Iwai1727a772013-01-10 09:52:52 +01006355static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006356 [ALC269_FIXUP_GPIO2] = {
6357 .type = HDA_FIXUP_FUNC,
6358 .v.func = alc_fixup_gpio2,
6359 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006360 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01006361 .type = HDA_FIXUP_PINCTLS,
6362 .v.pins = (const struct hda_pintbl[]) {
6363 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006364 {}
6365 }
6366 },
6367 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006368 .type = HDA_FIXUP_FUNC,
6369 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006370 .chained = true,
6371 .chain_id = ALC269_FIXUP_SONY_VAIO
6372 },
6373 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006374 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006375 .v.verbs = (const struct hda_verb[]) {
6376 /* Enables internal speaker */
6377 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6378 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6379 {}
6380 }
6381 },
6382 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006383 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02006384 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006385 },
6386 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006387 .type = HDA_FIXUP_PINS,
6388 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02006389 { 0x17, 0x99130111 }, /* subwoofer */
6390 { }
6391 }
6392 },
6393 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006394 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006395 .v.verbs = (const struct hda_verb[]) {
6396 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6397 {}
6398 }
6399 },
6400 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006401 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006402 .v.func = alc269_fixup_hweq,
6403 .chained = true,
6404 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6405 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006406 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6407 .type = HDA_FIXUP_FUNC,
6408 .v.func = alc_fixup_disable_aamix,
6409 .chained = true,
6410 .chain_id = ALC269_FIXUP_SONY_VAIO
6411 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006412 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006413 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006414 .v.func = alc271_fixup_dmic,
6415 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02006416 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006417 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006418 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02006419 .chained = true,
6420 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02006421 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006422 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006423 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006424 .v.func = alc269_fixup_stereo_dmic,
6425 },
David Henningsson7c478f02013-10-11 10:18:46 +02006426 [ALC269_FIXUP_HEADSET_MIC] = {
6427 .type = HDA_FIXUP_FUNC,
6428 .v.func = alc269_fixup_headset_mic,
6429 },
Takashi Iwai24519912011-08-16 15:08:49 +02006430 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006431 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02006432 .v.func = alc269_fixup_quanta_mute,
6433 },
6434 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006435 .type = HDA_FIXUP_PINS,
6436 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02006437 { 0x1a, 0x2101103f }, /* dock line-out */
6438 { 0x1b, 0x23a11040 }, /* dock mic-in */
6439 { }
6440 },
6441 .chained = true,
6442 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6443 },
David Henningsson2041d562014-06-13 11:15:44 +02006444 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6445 .type = HDA_FIXUP_PINS,
6446 .v.pins = (const struct hda_pintbl[]) {
6447 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6448 { }
6449 },
6450 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006451 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6452 .type = HDA_FIXUP_PINS,
6453 .v.pins = (const struct hda_pintbl[]) {
6454 { 0x21, 0x0221102f }, /* HP out */
6455 { }
6456 },
6457 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006458 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6459 .type = HDA_FIXUP_FUNC,
6460 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6461 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006462 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6463 .type = HDA_FIXUP_FUNC,
6464 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6465 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02006466 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006467 .type = HDA_FIXUP_PINS,
6468 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006469 { 0x14, 0x99130110 }, /* speaker */
6470 { 0x15, 0x0121401f }, /* HP out */
6471 { 0x18, 0x01a19c20 }, /* mic */
6472 { 0x19, 0x99a3092f }, /* int-mic */
6473 { }
6474 },
6475 },
6476 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006477 .type = HDA_FIXUP_PINS,
6478 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006479 { 0x12, 0x99a3092f }, /* int-mic */
6480 { 0x14, 0x99130110 }, /* speaker */
6481 { 0x15, 0x0121401f }, /* HP out */
6482 { 0x18, 0x01a19c20 }, /* mic */
6483 { }
6484 },
6485 },
6486 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006487 .type = HDA_FIXUP_PINS,
6488 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006489 { 0x14, 0x99130110 }, /* speaker */
6490 { 0x18, 0x01a19c20 }, /* mic */
6491 { 0x19, 0x99a3092f }, /* int-mic */
6492 { 0x21, 0x0121401f }, /* HP out */
6493 { }
6494 },
6495 },
David Henningsson2267ea92012-01-03 08:45:56 +01006496 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006497 .type = HDA_FIXUP_PINS,
6498 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006499 { 0x12, 0x99a3092f }, /* int-mic */
6500 { 0x14, 0x99130110 }, /* speaker */
6501 { 0x18, 0x01a19c20 }, /* mic */
6502 { 0x21, 0x0121401f }, /* HP out */
6503 { }
6504 },
6505 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006506 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006507 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006508 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01006509 },
David Henningssond06ac142013-02-18 11:41:55 +01006510 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6511 .type = HDA_FIXUP_FUNC,
6512 .v.func = alc269_fixup_hp_mute_led_mic1,
6513 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006514 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006515 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006516 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01006517 },
Tom Briden7f783bd2017-03-25 10:12:01 +00006518 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6519 .type = HDA_FIXUP_FUNC,
6520 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006521 .chained = true,
6522 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00006523 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006524 [ALC269_FIXUP_HP_GPIO_LED] = {
6525 .type = HDA_FIXUP_FUNC,
6526 .v.func = alc269_fixup_hp_gpio_led,
6527 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006528 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6529 .type = HDA_FIXUP_FUNC,
6530 .v.func = alc269_fixup_hp_gpio_mic1_led,
6531 },
6532 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6533 .type = HDA_FIXUP_FUNC,
6534 .v.func = alc269_fixup_hp_line1_mic1_led,
6535 },
David Henningsson693b6132012-06-22 19:12:10 +02006536 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006537 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02006538 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02006539 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006540 [ALC269_FIXUP_NO_SHUTUP] = {
6541 .type = HDA_FIXUP_FUNC,
6542 .v.func = alc_fixup_no_shutup,
6543 },
David Henningsson108cc102012-07-20 10:37:25 +02006544 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006545 .type = HDA_FIXUP_PINS,
6546 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02006547 { 0x19, 0x23a11040 }, /* dock mic */
6548 { 0x1b, 0x2121103f }, /* dock headphone */
6549 { }
6550 },
6551 .chained = true,
6552 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6553 },
Takashi Iwaib590b382020-05-14 18:05:33 +02006554 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6555 .type = HDA_FIXUP_FUNC,
6556 .v.func = alc269_fixup_limit_int_mic_boost,
6557 .chained = true,
6558 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6559 },
David Henningsson108cc102012-07-20 10:37:25 +02006560 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006561 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02006562 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01006563 .chained = true,
6564 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02006565 },
David Henningsson73bdd592013-04-15 15:44:14 +02006566 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6567 .type = HDA_FIXUP_PINS,
6568 .v.pins = (const struct hda_pintbl[]) {
6569 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6570 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6571 { }
6572 },
6573 .chained = true,
6574 .chain_id = ALC269_FIXUP_HEADSET_MODE
6575 },
6576 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6577 .type = HDA_FIXUP_PINS,
6578 .v.pins = (const struct hda_pintbl[]) {
6579 { 0x16, 0x21014020 }, /* dock line out */
6580 { 0x19, 0x21a19030 }, /* dock mic */
6581 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6582 { }
6583 },
6584 .chained = true,
6585 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6586 },
David Henningsson338cae52013-10-07 10:39:59 +02006587 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6588 .type = HDA_FIXUP_PINS,
6589 .v.pins = (const struct hda_pintbl[]) {
6590 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6591 { }
6592 },
6593 .chained = true,
6594 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6595 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08006596 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6597 .type = HDA_FIXUP_PINS,
6598 .v.pins = (const struct hda_pintbl[]) {
6599 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6600 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6601 { }
6602 },
6603 .chained = true,
6604 .chain_id = ALC269_FIXUP_HEADSET_MODE
6605 },
David Henningsson73bdd592013-04-15 15:44:14 +02006606 [ALC269_FIXUP_HEADSET_MODE] = {
6607 .type = HDA_FIXUP_FUNC,
6608 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08006609 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006610 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02006611 },
6612 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6613 .type = HDA_FIXUP_FUNC,
6614 .v.func = alc_fixup_headset_mode_no_hp_mic,
6615 },
Takashi Iwai78197172015-06-27 10:21:13 +02006616 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6617 .type = HDA_FIXUP_PINS,
6618 .v.pins = (const struct hda_pintbl[]) {
6619 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6620 { }
6621 },
6622 .chained = true,
6623 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6624 },
David Henningsson88cfcf82013-10-11 10:18:45 +02006625 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6626 .type = HDA_FIXUP_PINS,
6627 .v.pins = (const struct hda_pintbl[]) {
6628 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6629 { }
6630 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02006631 .chained = true,
6632 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02006633 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006634 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006635 .type = HDA_FIXUP_PINS,
6636 .v.pins = (const struct hda_pintbl[]) {
6637 {0x12, 0x90a60130},
6638 {0x13, 0x40000000},
6639 {0x14, 0x90170110},
6640 {0x18, 0x411111f0},
6641 {0x19, 0x04a11040},
6642 {0x1a, 0x411111f0},
6643 {0x1b, 0x90170112},
6644 {0x1d, 0x40759a05},
6645 {0x1e, 0x411111f0},
6646 {0x21, 0x04211020},
6647 { }
6648 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05006649 .chained = true,
6650 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006651 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006652 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6653 .type = HDA_FIXUP_FUNC,
6654 .v.func = alc298_fixup_huawei_mbx_stereo,
6655 .chained = true,
6656 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6657 },
David Henningssond240d1d2013-04-15 12:50:02 +02006658 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6659 .type = HDA_FIXUP_FUNC,
6660 .v.func = alc269_fixup_x101_headset_mic,
6661 },
6662 [ALC269_FIXUP_ASUS_X101_VERB] = {
6663 .type = HDA_FIXUP_VERBS,
6664 .v.verbs = (const struct hda_verb[]) {
6665 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6666 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6667 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6668 { }
6669 },
6670 .chained = true,
6671 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6672 },
6673 [ALC269_FIXUP_ASUS_X101] = {
6674 .type = HDA_FIXUP_PINS,
6675 .v.pins = (const struct hda_pintbl[]) {
6676 { 0x18, 0x04a1182c }, /* Headset mic */
6677 { }
6678 },
6679 .chained = true,
6680 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6681 },
Dylan Reid08a978d2012-11-18 22:56:40 -08006682 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006683 .type = HDA_FIXUP_PINS,
6684 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08006685 { 0x14, 0x99130110 }, /* speaker */
6686 { 0x19, 0x01a19c20 }, /* mic */
6687 { 0x1b, 0x99a7012f }, /* int-mic */
6688 { 0x21, 0x0121401f }, /* HP out */
6689 { }
6690 },
6691 },
6692 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006693 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08006694 .v.func = alc271_hp_gate_mic_jack,
6695 .chained = true,
6696 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6697 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006698 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6699 .type = HDA_FIXUP_FUNC,
6700 .v.func = alc269_fixup_limit_int_mic_boost,
6701 .chained = true,
6702 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6703 },
Dylan Reid42397002013-04-05 14:58:22 -07006704 [ALC269_FIXUP_ACER_AC700] = {
6705 .type = HDA_FIXUP_PINS,
6706 .v.pins = (const struct hda_pintbl[]) {
6707 { 0x12, 0x99a3092f }, /* int-mic */
6708 { 0x14, 0x99130110 }, /* speaker */
6709 { 0x18, 0x03a11c20 }, /* mic */
6710 { 0x1e, 0x0346101e }, /* SPDIF1 */
6711 { 0x21, 0x0321101f }, /* HP out */
6712 { }
6713 },
6714 .chained = true,
6715 .chain_id = ALC271_FIXUP_DMIC,
6716 },
David Henningsson3e0d6112013-04-22 14:30:14 +02006717 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6718 .type = HDA_FIXUP_FUNC,
6719 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01006720 .chained = true,
6721 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02006722 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01006723 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6724 .type = HDA_FIXUP_FUNC,
6725 .v.func = alc269_fixup_limit_int_mic_boost,
6726 .chained = true,
6727 .chain_id = ALC269VB_FIXUP_DMIC,
6728 },
Takashi Iwai23870832013-11-29 14:13:12 +01006729 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6730 .type = HDA_FIXUP_VERBS,
6731 .v.verbs = (const struct hda_verb[]) {
6732 /* class-D output amp +5dB */
6733 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6734 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6735 {}
6736 },
6737 .chained = true,
6738 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6739 },
David Henningsson8e35cd42013-11-06 11:20:01 +01006740 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6741 .type = HDA_FIXUP_FUNC,
6742 .v.func = alc269_fixup_limit_int_mic_boost,
6743 .chained = true,
6744 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6745 },
Anisse Astier02b504d2013-06-03 11:53:10 +02006746 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6747 .type = HDA_FIXUP_PINS,
6748 .v.pins = (const struct hda_pintbl[]) {
6749 { 0x12, 0x99a3092f }, /* int-mic */
6750 { 0x18, 0x03a11d20 }, /* mic */
6751 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6752 { }
6753 },
6754 },
Kailang Yangcd217a62013-08-22 10:15:24 +02006755 [ALC283_FIXUP_CHROME_BOOK] = {
6756 .type = HDA_FIXUP_FUNC,
6757 .v.func = alc283_fixup_chromebook,
6758 },
Kailang Yang0202e992013-12-02 15:20:15 +08006759 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6760 .type = HDA_FIXUP_FUNC,
6761 .v.func = alc283_fixup_sense_combo_jack,
6762 .chained = true,
6763 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6764 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02006765 [ALC282_FIXUP_ASUS_TX300] = {
6766 .type = HDA_FIXUP_FUNC,
6767 .v.func = alc282_fixup_asus_tx300,
6768 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02006769 [ALC283_FIXUP_INT_MIC] = {
6770 .type = HDA_FIXUP_VERBS,
6771 .v.verbs = (const struct hda_verb[]) {
6772 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6773 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6774 { }
6775 },
6776 .chained = true,
6777 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6778 },
David Henningsson0f4881d2013-12-20 16:08:13 +01006779 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6780 .type = HDA_FIXUP_PINS,
6781 .v.pins = (const struct hda_pintbl[]) {
6782 { 0x17, 0x90170112 }, /* subwoofer */
6783 { }
6784 },
6785 .chained = true,
6786 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6787 },
6788 [ALC290_FIXUP_SUBWOOFER] = {
6789 .type = HDA_FIXUP_PINS,
6790 .v.pins = (const struct hda_pintbl[]) {
6791 { 0x17, 0x90170112 }, /* subwoofer */
6792 { }
6793 },
6794 .chained = true,
6795 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6796 },
David Henningsson338cae52013-10-07 10:39:59 +02006797 [ALC290_FIXUP_MONO_SPEAKERS] = {
6798 .type = HDA_FIXUP_FUNC,
6799 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01006800 },
6801 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6802 .type = HDA_FIXUP_FUNC,
6803 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02006804 .chained = true,
6805 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6806 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01006807 [ALC269_FIXUP_THINKPAD_ACPI] = {
6808 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006809 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02006810 .chained = true,
6811 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006812 },
David Henningsson56f27012016-01-11 09:33:14 +01006813 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6814 .type = HDA_FIXUP_FUNC,
6815 .v.func = alc_fixup_inv_dmic,
6816 .chained = true,
6817 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6818 },
Chris Chiu5824ce82017-02-28 14:17:11 -06006819 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08006820 .type = HDA_FIXUP_PINS,
6821 .v.pins = (const struct hda_pintbl[]) {
6822 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6823 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06006824 },
6825 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08006826 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06006827 },
Chris Chiu615966a2017-02-28 14:17:12 -06006828 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6829 .type = HDA_FIXUP_PINS,
6830 .v.pins = (const struct hda_pintbl[]) {
6831 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6832 { }
6833 },
6834 .chained = true,
6835 .chain_id = ALC255_FIXUP_HEADSET_MODE
6836 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006837 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6838 .type = HDA_FIXUP_PINS,
6839 .v.pins = (const struct hda_pintbl[]) {
6840 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6841 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6842 { }
6843 },
6844 .chained = true,
6845 .chain_id = ALC255_FIXUP_HEADSET_MODE
6846 },
Kailang Yang31278992014-03-03 15:27:22 +08006847 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6848 .type = HDA_FIXUP_PINS,
6849 .v.pins = (const struct hda_pintbl[]) {
6850 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6851 { }
6852 },
6853 .chained = true,
6854 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6855 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006856 [ALC255_FIXUP_HEADSET_MODE] = {
6857 .type = HDA_FIXUP_FUNC,
6858 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08006859 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006860 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006861 },
Kailang Yang31278992014-03-03 15:27:22 +08006862 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6863 .type = HDA_FIXUP_FUNC,
6864 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6865 },
Kailang Yanga22aa262014-04-23 17:34:28 +08006866 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6867 .type = HDA_FIXUP_PINS,
6868 .v.pins = (const struct hda_pintbl[]) {
6869 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6870 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6871 { }
6872 },
6873 .chained = true,
6874 .chain_id = ALC269_FIXUP_HEADSET_MODE
6875 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02006876 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02006877 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02006878 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006879 .chained = true,
6880 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6881 },
Takashi Iwai9a811232015-12-09 15:17:43 +01006882 [ALC292_FIXUP_TPT440] = {
6883 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01006884 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01006885 .chained = true,
6886 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6887 },
Anisse Astierabaa22742016-08-24 09:14:13 +02006888 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01006889 .type = HDA_FIXUP_PINS,
6890 .v.pins = (const struct hda_pintbl[]) {
6891 { 0x19, 0x04a110f0 },
6892 { },
6893 },
6894 },
Takashi Iwaib3802782018-11-26 17:47:46 +01006895 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08006896 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02006897 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08006898 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006899 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6900 .type = HDA_FIXUP_PINS,
6901 .v.pins = (const struct hda_pintbl[]) {
6902 { 0x12, 0x90a60130 },
6903 { 0x14, 0x90170110 },
6904 { 0x17, 0x40000008 },
6905 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02006906 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006907 { 0x1a, 0x411111f0 },
6908 { 0x1b, 0x411111f0 },
6909 { 0x1d, 0x40f89b2d },
6910 { 0x1e, 0x411111f0 },
6911 { 0x21, 0x0321101f },
6912 { },
6913 },
6914 },
David Henningsson7a5255f2014-10-30 08:26:01 +01006915 [ALC280_FIXUP_HP_GPIO4] = {
6916 .type = HDA_FIXUP_FUNC,
6917 .v.func = alc280_fixup_hp_gpio4,
6918 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006919 [ALC286_FIXUP_HP_GPIO_LED] = {
6920 .type = HDA_FIXUP_FUNC,
6921 .v.func = alc286_fixup_hp_gpio_led,
6922 },
David Henningsson33f4acd2015-01-07 15:50:13 +01006923 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6924 .type = HDA_FIXUP_FUNC,
6925 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6926 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01006927 [ALC280_FIXUP_HP_DOCK_PINS] = {
6928 .type = HDA_FIXUP_PINS,
6929 .v.pins = (const struct hda_pintbl[]) {
6930 { 0x1b, 0x21011020 }, /* line-out */
6931 { 0x1a, 0x01a1903c }, /* headset mic */
6932 { 0x18, 0x2181103f }, /* line-in */
6933 { },
6934 },
6935 .chained = true,
6936 .chain_id = ALC280_FIXUP_HP_GPIO4
6937 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006938 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6939 .type = HDA_FIXUP_PINS,
6940 .v.pins = (const struct hda_pintbl[]) {
6941 { 0x1b, 0x21011020 }, /* line-out */
6942 { 0x18, 0x2181103f }, /* line-in */
6943 { },
6944 },
6945 .chained = true,
6946 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6947 },
Keith Packard98973f22015-07-15 12:14:39 -07006948 [ALC280_FIXUP_HP_9480M] = {
6949 .type = HDA_FIXUP_FUNC,
6950 .v.func = alc280_fixup_hp_9480m,
6951 },
Kailang Yange1e62b92015-04-08 16:01:22 +08006952 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6953 .type = HDA_FIXUP_FUNC,
6954 .v.func = alc_fixup_headset_mode_dell_alc288,
6955 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006956 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08006957 },
6958 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6959 .type = HDA_FIXUP_PINS,
6960 .v.pins = (const struct hda_pintbl[]) {
6961 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6962 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6963 { }
6964 },
6965 .chained = true,
6966 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6967 },
Hui Wang831bfdf92015-06-26 12:35:17 +08006968 [ALC288_FIXUP_DISABLE_AAMIX] = {
6969 .type = HDA_FIXUP_FUNC,
6970 .v.func = alc_fixup_disable_aamix,
6971 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02006972 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08006973 },
6974 [ALC288_FIXUP_DELL_XPS_13] = {
6975 .type = HDA_FIXUP_FUNC,
6976 .v.func = alc_fixup_dell_xps13,
6977 .chained = true,
6978 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6979 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006980 [ALC292_FIXUP_DISABLE_AAMIX] = {
6981 .type = HDA_FIXUP_FUNC,
6982 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08006983 .chained = true,
6984 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006985 },
David Henningssonc04017e2015-12-15 14:44:03 +01006986 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6987 .type = HDA_FIXUP_FUNC,
6988 .v.func = alc_fixup_disable_aamix,
6989 .chained = true,
6990 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6991 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01006992 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006993 .type = HDA_FIXUP_FUNC,
6994 .v.func = alc_fixup_dell_xps13,
6995 .chained = true,
6996 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6997 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01006998 [ALC292_FIXUP_DELL_E7X] = {
6999 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007000 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01007001 /* micmute fixup must be applied at last */
7002 .chained_before = true,
7003 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7004 },
James McDonnell54324222019-09-16 14:53:38 +00007005 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7006 .type = HDA_FIXUP_PINS,
7007 .v.pins = (const struct hda_pintbl[]) {
7008 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7009 { }
7010 },
7011 .chained_before = true,
7012 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7013 },
Kailang Yang977e6272015-05-18 15:31:20 +08007014 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7015 .type = HDA_FIXUP_PINS,
7016 .v.pins = (const struct hda_pintbl[]) {
7017 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7018 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7019 { }
7020 },
7021 .chained = true,
7022 .chain_id = ALC269_FIXUP_HEADSET_MODE
7023 },
Hui Wang2f726ae2017-03-31 10:31:40 +08007024 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7025 .type = HDA_FIXUP_PINS,
7026 .v.pins = (const struct hda_pintbl[]) {
7027 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7028 { }
7029 },
7030 .chained = true,
7031 .chain_id = ALC269_FIXUP_HEADSET_MODE
7032 },
Kailang Yang6ed11312015-10-26 15:37:39 +08007033 [ALC275_FIXUP_DELL_XPS] = {
7034 .type = HDA_FIXUP_VERBS,
7035 .v.verbs = (const struct hda_verb[]) {
7036 /* Enables internal speaker */
7037 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7038 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7039 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7040 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7041 {}
7042 }
7043 },
Hui Wang23adc192015-12-08 12:27:18 +08007044 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7045 .type = HDA_FIXUP_FUNC,
7046 .v.func = alc_fixup_disable_aamix,
7047 .chained = true,
7048 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7049 },
Kailang3694cb22015-12-28 11:35:24 +08007050 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7051 .type = HDA_FIXUP_FUNC,
7052 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7053 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007054 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7055 .type = HDA_FIXUP_FUNC,
7056 .v.func = alc_fixup_disable_aamix,
7057 .chained = true,
7058 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7059 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08007060 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7061 .type = HDA_FIXUP_FUNC,
7062 .v.func = alc_fixup_disable_mic_vref,
7063 .chained = true,
7064 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7065 },
David Henningsson2ae95572016-02-25 09:37:05 +01007066 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7067 .type = HDA_FIXUP_VERBS,
7068 .v.verbs = (const struct hda_verb[]) {
7069 /* Disable pass-through path for FRONT 14h */
7070 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7071 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7072 {}
7073 },
7074 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007075 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007076 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007077 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7078 .type = HDA_FIXUP_FUNC,
7079 .v.func = alc_fixup_disable_aamix,
7080 .chained = true,
7081 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7082 },
Hui Wange549d192016-04-01 11:00:15 +08007083 [ALC221_FIXUP_HP_FRONT_MIC] = {
7084 .type = HDA_FIXUP_PINS,
7085 .v.pins = (const struct hda_pintbl[]) {
7086 { 0x19, 0x02a19020 }, /* Front Mic */
7087 { }
7088 },
7089 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007090 [ALC292_FIXUP_TPT460] = {
7091 .type = HDA_FIXUP_FUNC,
7092 .v.func = alc_fixup_tpt440_dock,
7093 .chained = true,
7094 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7095 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007096 [ALC298_FIXUP_SPK_VOLUME] = {
7097 .type = HDA_FIXUP_FUNC,
7098 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007099 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007100 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007101 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007102 [ALC295_FIXUP_DISABLE_DAC3] = {
7103 .type = HDA_FIXUP_FUNC,
7104 .v.func = alc295_fixup_disable_dac3,
7105 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007106 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7107 .type = HDA_FIXUP_FUNC,
7108 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007109 .chained = true,
7110 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007111 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007112 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7113 .type = HDA_FIXUP_PINS,
7114 .v.pins = (const struct hda_pintbl[]) {
7115 { 0x1b, 0x90170151 },
7116 { }
7117 },
7118 .chained = true,
7119 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7120 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007121 [ALC269_FIXUP_ATIV_BOOK_8] = {
7122 .type = HDA_FIXUP_FUNC,
7123 .v.func = alc_fixup_auto_mute_via_amp,
7124 .chained = true,
7125 .chain_id = ALC269_FIXUP_NO_SHUTUP
7126 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007127 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7128 .type = HDA_FIXUP_PINS,
7129 .v.pins = (const struct hda_pintbl[]) {
7130 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7131 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7132 { }
7133 },
7134 .chained = true,
7135 .chain_id = ALC269_FIXUP_HEADSET_MODE
7136 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007137 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7138 .type = HDA_FIXUP_FUNC,
7139 .v.func = alc_fixup_headset_mode,
7140 },
7141 [ALC256_FIXUP_ASUS_MIC] = {
7142 .type = HDA_FIXUP_PINS,
7143 .v.pins = (const struct hda_pintbl[]) {
7144 { 0x13, 0x90a60160 }, /* use as internal mic */
7145 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7146 { }
7147 },
7148 .chained = true,
7149 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7150 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007151 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007152 .type = HDA_FIXUP_FUNC,
7153 /* Set up GPIO2 for the speaker amp */
7154 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007155 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007156 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7157 .type = HDA_FIXUP_PINS,
7158 .v.pins = (const struct hda_pintbl[]) {
7159 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7160 { }
7161 },
7162 .chained = true,
7163 .chain_id = ALC269_FIXUP_HEADSET_MIC
7164 },
7165 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7166 .type = HDA_FIXUP_VERBS,
7167 .v.verbs = (const struct hda_verb[]) {
7168 /* Enables internal speaker */
7169 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7170 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7171 {}
7172 },
7173 .chained = true,
7174 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7175 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007176 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7177 .type = HDA_FIXUP_FUNC,
7178 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007179 .chained = true,
7180 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007181 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007182 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7183 .type = HDA_FIXUP_VERBS,
7184 .v.verbs = (const struct hda_verb[]) {
7185 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7186 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7187 { }
7188 },
7189 .chained = true,
7190 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7191 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007192 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7193 .type = HDA_FIXUP_PINS,
7194 .v.pins = (const struct hda_pintbl[]) {
7195 /* Change the mic location from front to right, otherwise there are
7196 two front mics with the same name, pulseaudio can't handle them.
7197 This is just a temporary workaround, after applying this fixup,
7198 there will be one "Front Mic" and one "Mic" in this machine.
7199 */
7200 { 0x1a, 0x04a19040 },
7201 { }
7202 },
7203 },
Kailang Yang5f364132017-07-25 16:28:16 +08007204 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7205 .type = HDA_FIXUP_PINS,
7206 .v.pins = (const struct hda_pintbl[]) {
7207 { 0x16, 0x0101102f }, /* Rear Headset HP */
7208 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7209 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7210 { 0x1b, 0x02011020 },
7211 { }
7212 },
7213 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007214 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7215 },
7216 [ALC225_FIXUP_S3_POP_NOISE] = {
7217 .type = HDA_FIXUP_FUNC,
7218 .v.func = alc225_fixup_s3_pop_noise,
7219 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007220 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7221 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007222 [ALC700_FIXUP_INTEL_REFERENCE] = {
7223 .type = HDA_FIXUP_VERBS,
7224 .v.verbs = (const struct hda_verb[]) {
7225 /* Enables internal speaker */
7226 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7227 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7228 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7229 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7230 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7231 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7232 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7233 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7234 {}
7235 }
7236 },
Kailang Yang92266652017-12-14 15:28:58 +08007237 [ALC274_FIXUP_DELL_BIND_DACS] = {
7238 .type = HDA_FIXUP_FUNC,
7239 .v.func = alc274_fixup_bind_dacs,
7240 .chained = true,
7241 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7242 },
7243 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7244 .type = HDA_FIXUP_PINS,
7245 .v.pins = (const struct hda_pintbl[]) {
7246 { 0x1b, 0x0401102f },
7247 { }
7248 },
7249 .chained = true,
7250 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7251 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007252 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007253 .type = HDA_FIXUP_FUNC,
7254 .v.func = alc_fixup_tpt470_dock,
7255 .chained = true,
7256 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7257 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007258 [ALC298_FIXUP_TPT470_DOCK] = {
7259 .type = HDA_FIXUP_FUNC,
7260 .v.func = alc_fixup_tpt470_dacs,
7261 .chained = true,
7262 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7263 },
Kailang Yangae104a22018-02-05 16:07:20 +08007264 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7265 .type = HDA_FIXUP_PINS,
7266 .v.pins = (const struct hda_pintbl[]) {
7267 { 0x14, 0x0201101f },
7268 { }
7269 },
7270 .chained = true,
7271 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7272 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007273 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7274 .type = HDA_FIXUP_PINS,
7275 .v.pins = (const struct hda_pintbl[]) {
7276 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7277 { }
7278 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007279 .chained = true,
7280 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007281 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007282 [ALC295_FIXUP_HP_X360] = {
7283 .type = HDA_FIXUP_FUNC,
7284 .v.func = alc295_fixup_hp_top_speakers,
7285 .chained = true,
7286 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007287 },
7288 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7289 .type = HDA_FIXUP_PINS,
7290 .v.pins = (const struct hda_pintbl[]) {
7291 { 0x19, 0x0181313f},
7292 { }
7293 },
7294 .chained = true,
7295 .chain_id = ALC269_FIXUP_HEADSET_MIC
7296 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007297 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7298 .type = HDA_FIXUP_FUNC,
7299 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007300 .chained = true,
7301 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007302 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007303 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7304 .type = HDA_FIXUP_FUNC,
7305 .v.func = alc_fixup_auto_mute_via_amp,
7306 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007307 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7308 .type = HDA_FIXUP_PINS,
7309 .v.pins = (const struct hda_pintbl[]) {
7310 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7311 { }
7312 },
7313 .chained = true,
7314 .chain_id = ALC269_FIXUP_HEADSET_MIC
7315 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007316 [ALC294_FIXUP_ASUS_MIC] = {
7317 .type = HDA_FIXUP_PINS,
7318 .v.pins = (const struct hda_pintbl[]) {
7319 { 0x13, 0x90a60160 }, /* use as internal mic */
7320 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7321 { }
7322 },
7323 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007324 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007325 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007326 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7327 .type = HDA_FIXUP_PINS,
7328 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007329 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007330 { }
7331 },
7332 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007333 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007334 },
7335 [ALC294_FIXUP_ASUS_SPK] = {
7336 .type = HDA_FIXUP_VERBS,
7337 .v.verbs = (const struct hda_verb[]) {
7338 /* Set EAPD high */
7339 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7340 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08007341 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7342 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007343 { }
7344 },
7345 .chained = true,
7346 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7347 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007348 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08007349 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007350 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08007351 .chained = true,
7352 .chain_id = ALC225_FIXUP_HEADSET_JACK
7353 },
7354 [ALC225_FIXUP_HEADSET_JACK] = {
7355 .type = HDA_FIXUP_FUNC,
7356 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08007357 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07007358 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7359 .type = HDA_FIXUP_PINS,
7360 .v.pins = (const struct hda_pintbl[]) {
7361 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7362 { }
7363 },
7364 .chained = true,
7365 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7366 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08007367 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7368 .type = HDA_FIXUP_VERBS,
7369 .v.verbs = (const struct hda_verb[]) {
7370 /* Disable PCBEEP-IN passthrough */
7371 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7372 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7373 { }
7374 },
7375 .chained = true,
7376 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7377 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007378 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7379 .type = HDA_FIXUP_PINS,
7380 .v.pins = (const struct hda_pintbl[]) {
7381 { 0x19, 0x03a11130 },
7382 { 0x1a, 0x90a60140 }, /* use as internal mic */
7383 { }
7384 },
7385 .chained = true,
7386 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7387 },
Kailang Yang136824e2019-03-14 16:22:45 +08007388 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7389 .type = HDA_FIXUP_PINS,
7390 .v.pins = (const struct hda_pintbl[]) {
7391 { 0x16, 0x01011020 }, /* Rear Line out */
7392 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7393 { }
7394 },
7395 .chained = true,
7396 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7397 },
7398 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7399 .type = HDA_FIXUP_FUNC,
7400 .v.func = alc_fixup_auto_mute_via_amp,
7401 .chained = true,
7402 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7403 },
7404 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7405 .type = HDA_FIXUP_FUNC,
7406 .v.func = alc_fixup_disable_mic_vref,
7407 .chained = true,
7408 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7409 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007410 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7411 .type = HDA_FIXUP_VERBS,
7412 .v.verbs = (const struct hda_verb[]) {
7413 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7414 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7415 { }
7416 },
7417 .chained = true,
7418 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7419 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08007420 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7421 .type = HDA_FIXUP_PINS,
7422 .v.pins = (const struct hda_pintbl[]) {
7423 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7424 { }
7425 },
7426 .chained = true,
7427 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7428 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08007429 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7430 .type = HDA_FIXUP_PINS,
7431 .v.pins = (const struct hda_pintbl[]) {
7432 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7433 { }
7434 },
7435 .chained = true,
7436 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7437 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007438 [ALC299_FIXUP_PREDATOR_SPK] = {
7439 .type = HDA_FIXUP_PINS,
7440 .v.pins = (const struct hda_pintbl[]) {
7441 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7442 { }
7443 }
7444 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02007445 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7446 .type = HDA_FIXUP_PINS,
7447 .v.pins = (const struct hda_pintbl[]) {
7448 { 0x19, 0x04a11040 },
7449 { 0x21, 0x04211020 },
7450 { }
7451 },
7452 .chained = true,
7453 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7454 },
Kailang Yange79c2262019-12-19 14:12:15 +08007455 [ALC289_FIXUP_DELL_SPK2] = {
7456 .type = HDA_FIXUP_PINS,
7457 .v.pins = (const struct hda_pintbl[]) {
7458 { 0x17, 0x90170130 }, /* bass spk */
7459 { }
7460 },
7461 .chained = true,
7462 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7463 },
7464 [ALC289_FIXUP_DUAL_SPK] = {
7465 .type = HDA_FIXUP_FUNC,
7466 .v.func = alc285_fixup_speaker2_to_dac1,
7467 .chained = true,
7468 .chain_id = ALC289_FIXUP_DELL_SPK2
7469 },
Chris Chiu48e01502019-12-30 11:11:18 +08007470 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7471 .type = HDA_FIXUP_FUNC,
7472 .v.func = alc285_fixup_speaker2_to_dac1,
7473 .chained = true,
7474 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7475 },
7476 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007477 .type = HDA_FIXUP_FUNC,
7478 /* The GPIO must be pulled to initialize the AMP */
7479 .v.func = alc_fixup_gpio4,
7480 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08007481 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007482 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007483 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7484 .type = HDA_FIXUP_FUNC,
7485 .v.func = alc285_fixup_thinkpad_x1_gen7,
7486 .chained = true,
7487 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7488 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08007489 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7490 .type = HDA_FIXUP_FUNC,
7491 .v.func = alc_fixup_headset_jack,
7492 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007493 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08007494 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007495 [ALC294_FIXUP_ASUS_HPE] = {
7496 .type = HDA_FIXUP_VERBS,
7497 .v.verbs = (const struct hda_verb[]) {
7498 /* Set EAPD high */
7499 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7500 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7501 { }
7502 },
7503 .chained = true,
7504 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7505 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007506 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7507 .type = HDA_FIXUP_PINS,
7508 .v.pins = (const struct hda_pintbl[]) {
7509 { 0x19, 0x03a11050 }, /* front HP mic */
7510 { 0x1a, 0x01a11830 }, /* rear external mic */
7511 { 0x21, 0x03211020 }, /* front HP out */
7512 { }
7513 },
7514 .chained = true,
7515 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7516 },
7517 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7518 .type = HDA_FIXUP_VERBS,
7519 .v.verbs = (const struct hda_verb[]) {
7520 /* set 0x15 to HP-OUT ctrl */
7521 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7522 /* unmute the 0x15 amp */
7523 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7524 { }
7525 },
7526 .chained = true,
7527 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7528 },
7529 [ALC294_FIXUP_ASUS_GX502_HP] = {
7530 .type = HDA_FIXUP_FUNC,
7531 .v.func = alc294_fixup_gx502_hp,
7532 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02007533 [ALC294_FIXUP_ASUS_COEF_1B] = {
7534 .type = HDA_FIXUP_VERBS,
7535 .v.verbs = (const struct hda_verb[]) {
7536 /* Set bit 10 to correct noisy output after reboot from
7537 * Windows 10 (due to pop noise reduction?)
7538 */
7539 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7540 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7541 { }
7542 },
7543 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08007544 [ALC285_FIXUP_HP_GPIO_LED] = {
7545 .type = HDA_FIXUP_FUNC,
7546 .v.func = alc285_fixup_hp_gpio_led,
7547 },
Kailang Yang431e76c2020-04-07 14:40:20 +08007548 [ALC285_FIXUP_HP_MUTE_LED] = {
7549 .type = HDA_FIXUP_FUNC,
7550 .v.func = alc285_fixup_hp_mute_led,
7551 },
Kailang Yang24164f42020-04-07 14:52:42 +08007552 [ALC236_FIXUP_HP_MUTE_LED] = {
7553 .type = HDA_FIXUP_FUNC,
7554 .v.func = alc236_fixup_hp_mute_led,
7555 },
Mike Pozulp14425f12020-05-09 20:28:37 -07007556 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7557 .type = HDA_FIXUP_VERBS,
7558 .v.verbs = (const struct hda_verb[]) {
7559 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7560 { }
7561 },
7562 },
Chris Chiu9e433422020-05-12 14:15:24 +08007563 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7564 .type = HDA_FIXUP_PINS,
7565 .v.pins = (const struct hda_pintbl[]) {
7566 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7567 { }
7568 },
7569 .chained = true,
7570 .chain_id = ALC269_FIXUP_HEADSET_MODE
7571 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007572 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7573 .type = HDA_FIXUP_PINS,
7574 .v.pins = (const struct hda_pintbl[]) {
7575 { 0x14, 0x90100120 }, /* use as internal speaker */
7576 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7577 { 0x1a, 0x01011020 }, /* use as line out */
7578 { },
7579 },
7580 .chained = true,
7581 .chain_id = ALC269_FIXUP_HEADSET_MIC
7582 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007583 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7584 .type = HDA_FIXUP_PINS,
7585 .v.pins = (const struct hda_pintbl[]) {
7586 { 0x18, 0x02a11030 }, /* use as headset mic */
7587 { }
7588 },
7589 .chained = true,
7590 .chain_id = ALC269_FIXUP_HEADSET_MIC
7591 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007592 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7593 .type = HDA_FIXUP_PINS,
7594 .v.pins = (const struct hda_pintbl[]) {
7595 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7596 { }
7597 },
7598 .chained = true,
7599 .chain_id = ALC269_FIXUP_HEADSET_MIC
7600 },
Armas Spann293a92c2020-07-24 16:08:37 +02007601 [ALC289_FIXUP_ASUS_GA401] = {
Armas Spannff536642020-07-11 13:05:57 +02007602 .type = HDA_FIXUP_PINS,
7603 .v.pins = (const struct hda_pintbl[]) {
7604 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7605 { }
7606 },
7607 },
Armas Spann4b43d052020-07-24 16:06:16 +02007608 [ALC289_FIXUP_ASUS_GA502] = {
7609 .type = HDA_FIXUP_PINS,
7610 .v.pins = (const struct hda_pintbl[]) {
7611 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7612 { }
7613 },
7614 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007615 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7616 .type = HDA_FIXUP_PINS,
7617 .v.pins = (const struct hda_pintbl[]) {
7618 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7619 { }
7620 },
7621 .chained = true,
7622 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7623 },
Kailang Yang56496252020-07-29 15:09:27 +08007624 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7625 .type = HDA_FIXUP_FUNC,
7626 .v.func = alc285_fixup_hp_gpio_amp_init,
7627 .chained = true,
7628 .chain_id = ALC285_FIXUP_HP_GPIO_LED
7629 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08007630 [ALC269_FIXUP_CZC_B20] = {
7631 .type = HDA_FIXUP_PINS,
7632 .v.pins = (const struct hda_pintbl[]) {
7633 { 0x12, 0x411111f0 },
7634 { 0x14, 0x90170110 }, /* speaker */
7635 { 0x15, 0x032f1020 }, /* HP out */
7636 { 0x17, 0x411111f0 },
7637 { 0x18, 0x03ab1040 }, /* mic */
7638 { 0x19, 0xb7a7013f },
7639 { 0x1a, 0x0181305f },
7640 { 0x1b, 0x411111f0 },
7641 { 0x1d, 0x411111f0 },
7642 { 0x1e, 0x411111f0 },
7643 { }
7644 },
7645 .chain_id = ALC269_FIXUP_DMIC,
7646 },
7647 [ALC269_FIXUP_CZC_TMI] = {
7648 .type = HDA_FIXUP_PINS,
7649 .v.pins = (const struct hda_pintbl[]) {
7650 { 0x12, 0x4000c000 },
7651 { 0x14, 0x90170110 }, /* speaker */
7652 { 0x15, 0x0421401f }, /* HP out */
7653 { 0x17, 0x411111f0 },
7654 { 0x18, 0x04a19020 }, /* mic */
7655 { 0x19, 0x411111f0 },
7656 { 0x1a, 0x411111f0 },
7657 { 0x1b, 0x411111f0 },
7658 { 0x1d, 0x40448505 },
7659 { 0x1e, 0x411111f0 },
7660 { 0x20, 0x8000ffff },
7661 { }
7662 },
7663 .chain_id = ALC269_FIXUP_DMIC,
7664 },
7665 [ALC269_FIXUP_CZC_L101] = {
7666 .type = HDA_FIXUP_PINS,
7667 .v.pins = (const struct hda_pintbl[]) {
7668 { 0x12, 0x40000000 },
7669 { 0x14, 0x01014010 }, /* speaker */
7670 { 0x15, 0x411111f0 }, /* HP out */
7671 { 0x16, 0x411111f0 },
7672 { 0x18, 0x01a19020 }, /* mic */
7673 { 0x19, 0x02a19021 },
7674 { 0x1a, 0x0181302f },
7675 { 0x1b, 0x0221401f },
7676 { 0x1c, 0x411111f0 },
7677 { 0x1d, 0x4044c601 },
7678 { 0x1e, 0x411111f0 },
7679 { }
7680 },
7681 .chain_id = ALC269_FIXUP_DMIC,
7682 },
7683 [ALC269_FIXUP_LEMOTE_A1802] = {
7684 .type = HDA_FIXUP_PINS,
7685 .v.pins = (const struct hda_pintbl[]) {
7686 { 0x12, 0x40000000 },
7687 { 0x14, 0x90170110 }, /* speaker */
7688 { 0x17, 0x411111f0 },
7689 { 0x18, 0x03a19040 }, /* mic1 */
7690 { 0x19, 0x90a70130 }, /* mic2 */
7691 { 0x1a, 0x411111f0 },
7692 { 0x1b, 0x411111f0 },
7693 { 0x1d, 0x40489d2d },
7694 { 0x1e, 0x411111f0 },
7695 { 0x20, 0x0003ffff },
7696 { 0x21, 0x03214020 },
7697 { }
7698 },
7699 .chain_id = ALC269_FIXUP_DMIC,
7700 },
7701 [ALC269_FIXUP_LEMOTE_A190X] = {
7702 .type = HDA_FIXUP_PINS,
7703 .v.pins = (const struct hda_pintbl[]) {
7704 { 0x14, 0x99130110 }, /* speaker */
7705 { 0x15, 0x0121401f }, /* HP out */
7706 { 0x18, 0x01a19c20 }, /* rear mic */
7707 { 0x19, 0x99a3092f }, /* front mic */
7708 { 0x1b, 0x0201401f }, /* front lineout */
7709 { }
7710 },
7711 .chain_id = ALC269_FIXUP_DMIC,
7712 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08007713 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
7714 .type = HDA_FIXUP_PINS,
7715 .v.pins = (const struct hda_pintbl[]) {
7716 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7717 { }
7718 },
7719 .chained = true,
7720 .chain_id = ALC269_FIXUP_HEADSET_MODE
7721 },
Hui Wangfc19d552020-09-09 10:00:41 +08007722 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
7723 .type = HDA_FIXUP_VERBS,
7724 .v.verbs = (const struct hda_verb[]) {
7725 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7726 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7727 { }
7728 },
7729 .chained = true,
7730 .chain_id = ALC289_FIXUP_ASUS_GA401
7731 },
Hui Wang13468bf2020-09-28 16:01:17 +08007732 [ALC274_FIXUP_HP_MIC] = {
7733 .type = HDA_FIXUP_VERBS,
7734 .v.verbs = (const struct hda_verb[]) {
7735 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7736 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7737 { }
7738 },
7739 },
Kailang Yang8a8de09c2020-10-27 16:46:38 +08007740 [ALC274_FIXUP_HP_HEADSET_MIC] = {
7741 .type = HDA_FIXUP_FUNC,
7742 .v.func = alc274_fixup_hp_headset_mic,
7743 .chained = true,
7744 .chain_id = ALC274_FIXUP_HP_MIC
7745 },
Kailang Yangef9ce662020-11-03 15:40:35 +08007746 [ALC256_FIXUP_ASUS_HPE] = {
7747 .type = HDA_FIXUP_VERBS,
7748 .v.verbs = (const struct hda_verb[]) {
7749 /* Set EAPD high */
7750 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7751 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
7752 { }
7753 },
7754 .chained = true,
7755 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7756 },
Kailang Yang446b8182020-11-02 15:00:12 +08007757 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
7758 .type = HDA_FIXUP_FUNC,
7759 .v.func = alc_fixup_headset_jack,
7760 .chained = true,
7761 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7762 },
Kailang Yanga0ccbc52020-11-06 15:20:38 +08007763 [ALC287_FIXUP_HP_GPIO_LED] = {
7764 .type = HDA_FIXUP_FUNC,
7765 .v.func = alc287_fixup_hp_gpio_led,
7766 },
Kailang Yang9e885772020-11-03 15:30:51 +08007767 [ALC256_FIXUP_HP_HEADSET_MIC] = {
7768 .type = HDA_FIXUP_FUNC,
7769 .v.func = alc274_fixup_hp_headset_mic,
7770 },
Kailang Yang92666d42020-11-19 17:04:21 +08007771 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
7772 .type = HDA_FIXUP_FUNC,
7773 .v.func = alc_fixup_no_int_mic,
7774 .chained = true,
7775 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7776 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007777};
7778
7779static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01007780 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02007781 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
7782 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02007783 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02007784 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
7785 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02007786 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
7787 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05007788 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01007789 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02007790 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Chris Chiu705b65f2018-12-05 14:48:54 +08007791 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007792 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01007793 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiuc7531e32019-03-21 17:17:31 +08007794 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
7795 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007796 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007797 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007798 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007799 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7800 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7801 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08007802 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007803 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007804 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007805 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
David Henningssonaaedfb42013-08-16 14:09:02 +02007806 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08007807 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01007808 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01007809 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007810 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
7811 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01007812 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02007813 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7814 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7815 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01007816 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
7817 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01007818 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02007819 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01007820 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08007821 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7822 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08007823 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02007824 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02007825 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08007826 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08007827 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7828 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01007829 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7830 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7831 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7832 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7833 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007834 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007835 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01007836 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08007837 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08007838 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwaie312a862018-03-06 12:14:17 +01007839 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Takashi Iwai493de342017-02-28 17:27:57 +01007840 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kailang Yang5f364132017-07-25 16:28:16 +08007841 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08007842 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7843 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007844 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
7845 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08007846 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08007847 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08007848 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08007849 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08007850 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7851 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08007852 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
7853 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yang92666d42020-11-19 17:04:21 +08007854 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
7855 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
Kailang Yanga22aa262014-04-23 17:34:28 +08007856 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7857 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007858 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01007859 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01007860 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
David Henningsson33f4acd2015-01-07 15:50:13 +01007861 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08007862 /* ALC282 */
Hui Wang7976eb42015-02-13 11:14:41 +08007863 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007864 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007865 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007866 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7867 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7868 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7869 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007870 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007871 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007872 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7873 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007874 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007875 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
TienFu Chenb4b33f92015-01-20 15:06:21 +01007876 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
TienFu Chen3271cb22015-02-10 09:09:41 +01007877 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yangc60666b2014-02-21 16:23:35 +08007878 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007879 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7880 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7881 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007882 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Keith Packard98973f22015-07-15 12:14:39 -07007883 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007884 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7885 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007886 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007887 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007888 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007889 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007890 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7891 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7892 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7893 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7894 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007895 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007896 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007897 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007898 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7899 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7900 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007901 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7902 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007903 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007904 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007905 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007906 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007907 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7908 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007909 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7910 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007911 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007912 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7913 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7914 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7915 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwaif8839822016-02-25 14:31:59 +01007916 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01007917 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7918 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Takashi Iwai563785e2018-11-12 09:43:12 +01007919 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08007920 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007921 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01007922 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7923 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05007924 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02007925 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Sam Bazleyd33cd422019-09-01 03:31:30 +01007926 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08007927 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
7928 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Kailang Yang56496252020-07-29 15:09:27 +08007929 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Qiu Wenbo08befca2020-10-02 20:44:54 +08007930 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08007931 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08007932 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Kailang Yanga0ccbc52020-11-06 15:20:38 +08007933 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
7934 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007935 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02007936 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02007937 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01007938 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007939 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02007940 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02007941 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02007942 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
7943 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
7944 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007945 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
7946 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
7947 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01007948 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01007949 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02007950 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Chris Chiu48e01502019-12-30 11:11:18 +08007951 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Daniel Drake8c8967a2019-10-17 16:15:01 +08007952 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08007953 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08007954 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007955 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08007956 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02007957 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06007958 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02007959 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02007960 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06007961 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02007962 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007963 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Kailang Yangef9ce662020-11-03 15:40:35 +08007964 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
Armas Spann4b43d052020-07-24 16:06:16 +02007965 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Armas Spann293a92c2020-07-24 16:08:37 +02007966 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007967 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Chris Chiueeed4cd2017-02-28 14:17:15 -06007968 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02007969 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
7970 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
7971 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7972 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02007973 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01007974 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02007975 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007976 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
7977 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7978 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02007979 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02007980 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02007981 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02007982 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Takashi Iwai88776f32015-05-01 09:20:34 +02007983 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01007984 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
David Henningsson2041d562014-06-13 11:15:44 +02007985 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08007986 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02007987 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09007988 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02007989 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07007990 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7991 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07007992 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09007993 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7994 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007995 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09007996 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02007997 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
7998 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01007999 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008000 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller89e3a562019-01-30 16:12:31 -07008001 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008002 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8003 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8004 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8005 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8006 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8007 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8008 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8009 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8010 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8011 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8012 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8013 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8014 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8015 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8016 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8017 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8018 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8019 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8020 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8021 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8022 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8023 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8024 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8025 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8026 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8027 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8028 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller80a50522019-05-07 17:11:08 -04008029 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller891afcf2019-05-10 10:15:07 -04008030 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8031 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
8032 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008033 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8034 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8035 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8036 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8037 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8038 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8039 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8040 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8041 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8042 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008043 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Hui Wangef0b3202020-04-27 11:00:39 +08008044 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008045 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8046 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8047 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8048 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8049 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaib590b382020-05-14 18:05:33 +02008050 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02008051 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02008052 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02008053 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02008054 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02008055 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01008056 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02008057 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02008058 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05008059 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02008060 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01008061 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02008062 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01008063 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07008064 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02008065 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008066 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8067 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02008068 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02008069 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008070 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8071 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8072 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01008073 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008074 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8075 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8076 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01008077 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09008078 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02008079 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang Yang446b8182020-11-02 15:00:12 +08008080 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8081 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Kailang3694cb22015-12-28 11:35:24 +08008082 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08008083 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08008084 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02008085 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08008086 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08008087 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08008088 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08008089 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08008090 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8091 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
David Henningsson56f27012016-01-11 09:33:14 +01008092 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01008093 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02008094 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
David Henningssona4a9e082013-08-16 14:09:01 +02008095 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02008096 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02008097 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008098 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02008099 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01008100 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02008101 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02008102 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08008103 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008104 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02008105 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008106 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008107 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8108 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8109 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008110 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008111 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8112 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningsson012e7eb2012-08-08 08:43:37 +02008113 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008114 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008115 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008116 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8117 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8118 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02008119 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Hui Wangfc19d552020-09-09 10:00:41 +08008120 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Hui Wang695d1ec2019-11-21 10:54:27 +08008121 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008122 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008123 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8124 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008125 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008126
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01008127#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02008128 /* Below is a quirk table taken from the old code.
8129 * Basically the device should work as is without the fixup table.
8130 * If BIOS doesn't give a proper info, enable the corresponding
8131 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008132 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02008133 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8134 ALC269_FIXUP_AMIC),
8135 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008136 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8137 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8138 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8139 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8140 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8141 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8142 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8143 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8144 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8145 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8146 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8147 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8148 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8149 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8150 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8151 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8152 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8153 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8154 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8155 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8156 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8157 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8158 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8159 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8160 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8161 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8162 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8163 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8164 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8165 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8166 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8167 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8168 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8169 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8170 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8171 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8172 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8173 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8174#endif
8175 {}
8176};
8177
David Henningsson214eef72014-07-22 14:09:35 +02008178static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8179 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8180 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8181 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8182 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008183 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02008184 {}
8185};
8186
Takashi Iwai1727a772013-01-10 09:52:52 +01008187static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02008188 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8189 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008190 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8191 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8192 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02008193 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02008194 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8195 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02008196 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02008197 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008198 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008199 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02008200 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8201 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008202 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8203 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08008204 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08008205 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02008206 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01008207 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02008208 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02008209 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008210 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008211 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02008212 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008213 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8214 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8215 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8216 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8217 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8218 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8219 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8220 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8221 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8222 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8223 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8224 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8225 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8226 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8227 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8228 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8229 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8230 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8231 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8232 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8233 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8234 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8235 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8236 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8237 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8238 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8239 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8240 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8241 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8242 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8243 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8244 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8245 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8246 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8247 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8248 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8249 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8250 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8251 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8252 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01008253 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008254 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
8255 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8256 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8257 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8258 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8259 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8260 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8261 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8262 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8263 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8264 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8265 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8266 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8267 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8268 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008269 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8270 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8271 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08008272 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008273 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01008274 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008275 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8276 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8277 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8278 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8279 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8280 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8281 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8282 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8283 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8284 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8285 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8286 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8287 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8288 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8289 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8290 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8291 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08008292 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8293 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008294 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02008295 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008296 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07008297 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08008298 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08008299 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02008300 {}
8301};
Kailang Yangcfc5a842016-02-03 15:20:39 +08008302#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08008303 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02008304
Hui Wange8191a82015-04-24 13:39:59 +08008305#define ALC256_STANDARD_PINS \
8306 {0x12, 0x90a60140}, \
8307 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08008308 {0x21, 0x02211020}
8309
David Henningssonfea185e2014-09-03 10:23:04 +02008310#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008311 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08008312
David Henningssonfea185e2014-09-03 10:23:04 +02008313#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008314 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02008315
8316#define ALC292_STANDARD_PINS \
8317 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08008318 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08008319
Hui Wang3f6409702016-09-11 11:26:16 +08008320#define ALC295_STANDARD_PINS \
8321 {0x12, 0xb7a60130}, \
8322 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08008323 {0x21, 0x04211020}
8324
Woodrow Shen703867e2015-08-05 12:34:12 +08008325#define ALC298_STANDARD_PINS \
8326 {0x12, 0x90a60130}, \
8327 {0x21, 0x03211020}
8328
Hui Wange1918932014-05-26 16:22:44 +08008329static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08008330 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
8331 {0x14, 0x01014020},
8332 {0x17, 0x90170110},
8333 {0x18, 0x02a11030},
8334 {0x19, 0x0181303F},
8335 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06008336 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8337 {0x12, 0x90a601c0},
8338 {0x14, 0x90171120},
8339 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06008340 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8341 {0x14, 0x90170110},
8342 {0x1b, 0x90a70130},
8343 {0x21, 0x03211020}),
8344 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8345 {0x1a, 0x90a70130},
8346 {0x1b, 0x90170110},
8347 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01008348 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008349 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008350 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008351 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01008352 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008353 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008354 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008355 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08008356 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8357 ALC225_STANDARD_PINS,
8358 {0x12, 0xb7a60150},
8359 {0x14, 0x901701a0}),
8360 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8361 ALC225_STANDARD_PINS,
8362 {0x12, 0xb7a60150},
8363 {0x14, 0x901701b0}),
8364 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8365 ALC225_STANDARD_PINS,
8366 {0x12, 0xb7a60130},
8367 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05008368 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8369 {0x1b, 0x01111010},
8370 {0x1e, 0x01451130},
8371 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08008372 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
8373 {0x12, 0x90a60140},
8374 {0x14, 0x90170110},
8375 {0x19, 0x02a11030},
8376 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08008377 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8378 {0x14, 0x90170110},
8379 {0x19, 0x02a11030},
8380 {0x1a, 0x02a11040},
8381 {0x1b, 0x01014020},
8382 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08008383 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8384 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08008385 {0x19, 0x02a11030},
8386 {0x1a, 0x02a11040},
8387 {0x1b, 0x01011020},
8388 {0x21, 0x0221101f}),
8389 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8390 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08008391 {0x19, 0x02a11020},
8392 {0x1a, 0x02a11030},
8393 {0x21, 0x0221101f}),
Kailang Yang92666d42020-11-19 17:04:21 +08008394 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
8395 {0x21, 0x02211010}),
Kailang Yang9e885772020-11-03 15:30:51 +08008396 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8397 {0x14, 0x90170110},
8398 {0x19, 0x02a11020},
8399 {0x21, 0x02211030}),
Hui Wangc77900e2014-09-03 11:31:07 +08008400 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08008401 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08008402 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02008403 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08008404 {0x14, 0x90170130},
8405 {0x21, 0x02211040}),
8406 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008407 {0x12, 0x90a60140},
8408 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02008409 {0x21, 0x02211020}),
8410 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8411 {0x12, 0x90a60160},
8412 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008413 {0x21, 0x02211030}),
8414 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08008415 {0x14, 0x90170110},
8416 {0x1b, 0x02011020},
8417 {0x21, 0x0221101f}),
8418 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08008419 {0x14, 0x90170110},
8420 {0x1b, 0x01011020},
8421 {0x21, 0x0221101f}),
8422 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02008423 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02008424 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02008425 {0x21, 0x0221103f}),
8426 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08008427 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08008428 {0x1b, 0x01011020},
8429 {0x21, 0x0221103f}),
8430 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8431 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08008432 {0x1b, 0x02011020},
8433 {0x21, 0x0221103f}),
8434 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008435 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008436 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008437 {0x21, 0x0221105f}),
8438 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008439 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008440 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008441 {0x21, 0x0221101f}),
8442 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008443 {0x12, 0x90a60160},
8444 {0x14, 0x90170120},
8445 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008446 {0x21, 0x0321102f}),
8447 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8448 {0x12, 0x90a60160},
8449 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008450 {0x21, 0x02211040}),
8451 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8452 {0x12, 0x90a60160},
8453 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008454 {0x21, 0x02211050}),
8455 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8456 {0x12, 0x90a60170},
8457 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008458 {0x21, 0x02211030}),
8459 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8460 {0x12, 0x90a60170},
8461 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008462 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08008463 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08008464 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08008465 {0x14, 0x90171130},
8466 {0x21, 0x02211040}),
8467 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8468 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08008469 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08008470 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02008471 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02008472 {0x12, 0x90a60180},
8473 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02008474 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08008475 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8476 {0x12, 0x90a60180},
8477 {0x14, 0x90170120},
8478 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08008479 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8480 {0x1b, 0x01011020},
8481 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008482 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8483 {0x14, 0x90170110},
8484 {0x1b, 0x90a70130},
8485 {0x21, 0x04211020}),
8486 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8487 {0x14, 0x90170110},
8488 {0x1b, 0x90a70130},
8489 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08008490 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08008491 {0x12, 0x90a60130},
8492 {0x14, 0x90170110},
8493 {0x21, 0x03211020}),
8494 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08008495 {0x12, 0x90a60130},
8496 {0x14, 0x90170110},
8497 {0x21, 0x04211020}),
8498 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08008499 {0x1a, 0x90a70130},
8500 {0x1b, 0x90170110},
8501 {0x21, 0x03211020}),
Kailang Yang9e885772020-11-03 15:30:51 +08008502 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8503 {0x14, 0x90170110},
8504 {0x19, 0x02a11020},
8505 {0x21, 0x0221101f}),
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008506 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
8507 {0x17, 0x90170110},
8508 {0x19, 0x03a11030},
8509 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01008510 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
8511 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01008512 {0x14, 0x90170110},
8513 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008514 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08008515 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
8516 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08008517 {0x14, 0x90170110},
8518 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08008519 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08008520 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08008521 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02008522 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008523 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02008524 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02008525 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02008526 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08008527 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008528 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008529 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008530 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008531 {0x21, 0x03211040}),
8532 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008533 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008534 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008535 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08008536 {0x21, 0x03211020}),
8537 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008538 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008539 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008540 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008541 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08008542 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02008543 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08008544 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08008545 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08008546 {0x21, 0x04211020}),
David Henningsson76c21322014-06-24 14:46:54 +02008547 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008548 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02008549 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02008550 {0x21, 0x0321101f}),
8551 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8552 {0x12, 0x90a60160},
8553 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008554 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08008555 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008556 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08008557 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08008558 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08008559 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08008560 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Hui Wangc4cfcf62018-11-26 14:17:16 +08008561 {0x12, 0x90a60130},
8562 {0x14, 0x90170110},
8563 {0x19, 0x04a11040},
8564 {0x21, 0x04211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08008565 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
8566 {0x12, 0x90a60130},
8567 {0x17, 0x90170110},
8568 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02008569 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08008570 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08008571 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08008572 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08008573 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008574 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008575 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08008576 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08008577 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008578 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008579 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008580 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08008581 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008582 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008583 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008584 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008585 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008586 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008587 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008588 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008589 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008590 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08008591 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008592 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008593 {0x14, 0x90170110},
8594 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008595 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08008596 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008597 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008598 {0x14, 0x90170110},
8599 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008600 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008601 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008602 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008603 {0x14, 0x90170110},
8604 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008605 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08008606 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008607 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08008608 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08008609 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08008610 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08008611 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008612 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08008613 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08008614 {0x16, 0x01014020},
8615 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08008616 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02008617 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008618 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08008619 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02008620 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008621 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02008622 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02008623 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08008624 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02008625 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008626 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08008627 {0x13, 0x90a60140}),
Chris Chiud8ae4582018-12-07 17:17:11 +08008628 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
8629 {0x14, 0x90170110},
8630 {0x1b, 0x90a70130},
8631 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08008632 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8633 {0x12, 0x90a60130},
8634 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08008635 {0x21, 0x03211020}),
8636 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8637 {0x12, 0x90a60130},
8638 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08008639 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02008640 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8641 {0x12, 0x90a60130},
8642 {0x17, 0x90170110},
8643 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08008644 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08008645 {0x12, 0x90a60120},
8646 {0x17, 0x90170110},
8647 {0x21, 0x04211030}),
8648 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08008649 {0x12, 0x90a60130},
8650 {0x17, 0x90170110},
8651 {0x21, 0x03211020}),
8652 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8653 {0x12, 0x90a60130},
8654 {0x17, 0x90170110},
8655 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08008656 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08008657 {0x14, 0x90170110},
8658 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08008659 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8660 {0x14, 0x90170110},
8661 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08008662 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08008663 ALC295_STANDARD_PINS,
8664 {0x17, 0x21014020},
8665 {0x18, 0x21a19030}),
8666 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8667 ALC295_STANDARD_PINS,
8668 {0x17, 0x21014040},
8669 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08008670 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8671 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08008672 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08008673 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02008674 {0x17, 0x90170110}),
8675 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8676 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08008677 {0x17, 0x90170140}),
8678 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8679 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02008680 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08008681 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
8682 {0x12, 0xb7a60140},
8683 {0x13, 0xb7a60150},
8684 {0x17, 0x90170110},
8685 {0x1a, 0x03011020},
8686 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00008687 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
8688 {0x12, 0xb7a60140},
8689 {0x17, 0x90170110},
8690 {0x1a, 0x03a11030},
8691 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08008692 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8693 ALC225_STANDARD_PINS,
8694 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08008695 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08008696 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
8697 {0x14, 0x01014010},
8698 {0x17, 0x90170120},
8699 {0x18, 0x02a11030},
8700 {0x19, 0x02a1103f},
8701 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08008702 {}
8703};
Takashi Iwai1d045db2011-07-07 18:23:21 +02008704
Hui Wang7c0a6932019-08-16 14:27:40 +08008705/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
8706 * more machines, don't need to match all valid pins, just need to match
8707 * all the pins defined in the tbl. Just because of this reason, it is possible
8708 * that a single machine matches multiple tbls, so there is one limitation:
8709 * at most one tbl is allowed to define for the same vendor and same codec
8710 */
8711static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
8712 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8713 {0x19, 0x40000000},
8714 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08008715 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8716 {0x19, 0x40000000},
8717 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08008718 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8719 {0x19, 0x40000000},
8720 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08008721 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
8722 {0x19, 0x40000000},
8723 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08008724 {}
8725};
8726
Takashi Iwai546bb672012-03-07 08:37:19 +01008727static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02008728{
Kailang Yang526af6e2012-03-07 08:25:20 +01008729 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008730 int val;
8731
Kailang Yang526af6e2012-03-07 08:25:20 +01008732 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01008733 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01008734
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008735 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008736 alc_write_coef_idx(codec, 0xf, 0x960b);
8737 alc_write_coef_idx(codec, 0xe, 0x8817);
8738 }
8739
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008740 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008741 alc_write_coef_idx(codec, 0xf, 0x960b);
8742 alc_write_coef_idx(codec, 0xe, 0x8814);
8743 }
8744
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008745 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008746 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02008747 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008748 }
8749
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008750 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008751 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02008752 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008753 /* Capless ramp up clock control */
8754 alc_write_coef_idx(codec, 0xd, val | (1<<10));
8755 }
8756 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02008757 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008758 /* Class D power on reset */
8759 alc_write_coef_idx(codec, 0x17, val | (1<<7));
8760 }
8761 }
8762
Takashi Iwai98b24882014-08-18 13:47:50 +02008763 /* HP */
8764 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008765}
8766
8767/*
8768 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008769static int patch_alc269(struct hda_codec *codec)
8770{
8771 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02008772 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008773
Takashi Iwai3de95172012-05-07 18:03:15 +02008774 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008775 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02008776 return err;
8777
8778 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01008779 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08008780 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008781
Takashi Iwai225068a2015-05-29 10:42:14 +02008782#ifdef CONFIG_PM
8783 codec->patch_ops.suspend = alc269_suspend;
8784 codec->patch_ops.resume = alc269_resume;
8785#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08008786 spec->shutup = alc_default_shutup;
8787 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02008788
Takashi Iwai7639a062015-03-03 10:07:24 +01008789 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01008790 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02008791 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008792 switch (alc_get_coef0(codec) & 0x00f0) {
8793 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01008794 if (codec->bus->pci &&
8795 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008796 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008797 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02008798 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008799 break;
8800 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01008801 if (codec->bus->pci &&
8802 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008803 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008804 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02008805 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008806 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02008807 case 0x0030:
8808 spec->codec_variant = ALC269_TYPE_ALC269VD;
8809 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008810 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02008811 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008812 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008813 if (err < 0)
8814 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08008815 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01008816 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008817 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01008818 break;
8819
8820 case 0x10ec0280:
8821 case 0x10ec0290:
8822 spec->codec_variant = ALC269_TYPE_ALC280;
8823 break;
8824 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01008825 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08008826 spec->shutup = alc282_shutup;
8827 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01008828 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02008829 case 0x10ec0233:
8830 case 0x10ec0283:
8831 spec->codec_variant = ALC269_TYPE_ALC283;
8832 spec->shutup = alc283_shutup;
8833 spec->init_hook = alc283_init;
8834 break;
Kailang Yang065380f2013-01-10 10:25:48 +01008835 case 0x10ec0284:
8836 case 0x10ec0292:
8837 spec->codec_variant = ALC269_TYPE_ALC284;
8838 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02008839 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08008840 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02008841 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02008842 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08008843 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02008844 spec->codec_variant = ALC269_TYPE_ALC286;
8845 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08008846 case 0x10ec0298:
8847 spec->codec_variant = ALC269_TYPE_ALC298;
8848 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08008849 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02008850 case 0x10ec0255:
8851 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08008852 spec->shutup = alc256_shutup;
8853 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02008854 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08008855 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08008856 case 0x10ec0256:
8857 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08008858 spec->shutup = alc256_shutup;
8859 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02008860 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08008861 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08008862 case 0x10ec0257:
8863 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08008864 spec->shutup = alc256_shutup;
8865 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08008866 spec->gen.mixer_nid = 0;
8867 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08008868 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +08008869 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +08008870 case 0x10ec0285:
Kailang Yang630e3612020-05-27 14:10:26 +08008871 case 0x10ec0287:
Kailang Yang0a6f0602017-06-30 16:00:48 +08008872 case 0x10ec0289:
8873 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08008874 spec->shutup = alc225_shutup;
8875 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08008876 spec->gen.mixer_nid = 0;
8877 break;
Kailang Yang42314302016-02-03 15:03:50 +08008878 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08008879 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08008880 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08008881 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08008882 spec->shutup = alc225_shutup;
8883 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01008884 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08008885 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008886 case 0x10ec0234:
8887 case 0x10ec0274:
8888 case 0x10ec0294:
8889 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08008890 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08008891 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08008892 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008893 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08008894 case 0x10ec0300:
8895 spec->codec_variant = ALC269_TYPE_ALC300;
8896 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008897 break;
Kailang Yangf0778872019-10-24 15:13:32 +08008898 case 0x10ec0623:
8899 spec->codec_variant = ALC269_TYPE_ALC623;
8900 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08008901 case 0x10ec0700:
8902 case 0x10ec0701:
8903 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +08008904 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +08008905 spec->codec_variant = ALC269_TYPE_ALC700;
8906 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08008907 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08008908 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08008909 break;
8910
Takashi Iwai1d045db2011-07-07 18:23:21 +02008911 }
8912
Kailang Yangad60d502013-06-28 12:03:01 +02008913 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05008914 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02008915 spec->init_hook = alc5505_dsp_init;
8916 }
8917
Takashi Iwaic9af7532019-05-10 11:01:43 +02008918 alc_pre_init(codec);
8919
Takashi Iwaiefe55732018-06-15 11:55:02 +02008920 snd_hda_pick_fixup(codec, alc269_fixup_models,
8921 alc269_fixup_tbl, alc269_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +08008922 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +08008923 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +02008924 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
8925 alc269_fixups);
8926 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8927
8928 alc_auto_parse_customize_define(codec);
8929
8930 if (has_cdefine_beep(codec))
8931 spec->gen.beep_nid = 0x01;
8932
Takashi Iwaia4297b52011-08-23 18:40:12 +02008933 /* automatic parse from the BIOS config */
8934 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008935 if (err < 0)
8936 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008937
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008938 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
8939 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
8940 if (err < 0)
8941 goto error;
8942 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02008943
Takashi Iwai1727a772013-01-10 09:52:52 +01008944 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01008945
Takashi Iwai1d045db2011-07-07 18:23:21 +02008946 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008947
8948 error:
8949 alc_free(codec);
8950 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008951}
8952
8953/*
8954 * ALC861
8955 */
8956
Takashi Iwai1d045db2011-07-07 18:23:21 +02008957static int alc861_parse_auto_config(struct hda_codec *codec)
8958{
Takashi Iwai1d045db2011-07-07 18:23:21 +02008959 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008960 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
8961 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008962}
8963
Takashi Iwai1d045db2011-07-07 18:23:21 +02008964/* Pin config fixes */
8965enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008966 ALC861_FIXUP_FSC_AMILO_PI1505,
8967 ALC861_FIXUP_AMP_VREF_0F,
8968 ALC861_FIXUP_NO_JACK_DETECT,
8969 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01008970 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02008971};
8972
Takashi Iwai31150f22012-01-30 10:54:08 +01008973/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
8974static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01008975 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01008976{
8977 struct alc_spec *spec = codec->spec;
8978 unsigned int val;
8979
Takashi Iwai1727a772013-01-10 09:52:52 +01008980 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01008981 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01008982 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01008983 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
8984 val |= AC_PINCTL_IN_EN;
8985 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02008986 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01008987 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01008988}
8989
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008990/* suppress the jack-detection */
8991static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01008992 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008993{
Takashi Iwai1727a772013-01-10 09:52:52 +01008994 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008995 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008996}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008997
Takashi Iwai1727a772013-01-10 09:52:52 +01008998static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008999 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009000 .type = HDA_FIXUP_PINS,
9001 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009002 { 0x0b, 0x0221101f }, /* HP */
9003 { 0x0f, 0x90170310 }, /* speaker */
9004 { }
9005 }
9006 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009007 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009008 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01009009 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01009010 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009011 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009012 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009013 .v.func = alc_fixup_no_jack_detect,
9014 },
9015 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009016 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009017 .v.func = alc861_fixup_asus_amp_vref_0f,
9018 .chained = true,
9019 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009020 },
9021 [ALC660_FIXUP_ASUS_W7J] = {
9022 .type = HDA_FIXUP_VERBS,
9023 .v.verbs = (const struct hda_verb[]) {
9024 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9025 * for enabling outputs
9026 */
9027 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9028 { }
9029 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009030 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009031};
9032
9033static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009034 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01009035 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009036 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9037 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9038 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
9039 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
9040 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
9041 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009042 {}
9043};
9044
9045/*
9046 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009047static int patch_alc861(struct hda_codec *codec)
9048{
9049 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009050 int err;
9051
Takashi Iwai3de95172012-05-07 18:03:15 +02009052 err = alc_alloc_spec(codec, 0x15);
9053 if (err < 0)
9054 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009055
Takashi Iwai3de95172012-05-07 18:03:15 +02009056 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009057 if (has_cdefine_beep(codec))
9058 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009059
Takashi Iwai225068a2015-05-29 10:42:14 +02009060#ifdef CONFIG_PM
9061 spec->power_hook = alc_power_eapd;
9062#endif
9063
Takashi Iwaic9af7532019-05-10 11:01:43 +02009064 alc_pre_init(codec);
9065
Takashi Iwai1727a772013-01-10 09:52:52 +01009066 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9067 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009068
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009069 /* automatic parse from the BIOS config */
9070 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009071 if (err < 0)
9072 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009073
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009074 if (!spec->gen.no_analog) {
9075 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9076 if (err < 0)
9077 goto error;
9078 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009079
Takashi Iwai1727a772013-01-10 09:52:52 +01009080 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009081
Takashi Iwai1d045db2011-07-07 18:23:21 +02009082 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009083
9084 error:
9085 alc_free(codec);
9086 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009087}
9088
9089/*
9090 * ALC861-VD support
9091 *
9092 * Based on ALC882
9093 *
9094 * In addition, an independent DAC
9095 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009096static int alc861vd_parse_auto_config(struct hda_codec *codec)
9097{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009098 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009099 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9100 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009101}
9102
Takashi Iwai1d045db2011-07-07 18:23:21 +02009103enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009104 ALC660VD_FIX_ASUS_GPIO1,
9105 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009106};
9107
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009108/* exclude VREF80 */
9109static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009110 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009111{
Takashi Iwai1727a772013-01-10 09:52:52 +01009112 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01009113 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9114 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009115 }
9116}
9117
Takashi Iwaidf73d832018-06-19 23:05:47 +02009118/* reset GPIO1 */
9119static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9120 const struct hda_fixup *fix, int action)
9121{
9122 struct alc_spec *spec = codec->spec;
9123
9124 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9125 spec->gpio_mask |= 0x02;
9126 alc_fixup_gpio(codec, action, 0x01);
9127}
9128
Takashi Iwai1727a772013-01-10 09:52:52 +01009129static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009130 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +02009131 .type = HDA_FIXUP_FUNC,
9132 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009133 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009134 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009135 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009136 .v.func = alc861vd_fixup_dallas,
9137 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02009138};
9139
9140static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009141 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009142 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009143 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009144 {}
9145};
9146
Takashi Iwai1d045db2011-07-07 18:23:21 +02009147/*
9148 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009149static int patch_alc861vd(struct hda_codec *codec)
9150{
9151 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009152 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009153
Takashi Iwai3de95172012-05-07 18:03:15 +02009154 err = alc_alloc_spec(codec, 0x0b);
9155 if (err < 0)
9156 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009157
Takashi Iwai3de95172012-05-07 18:03:15 +02009158 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009159 if (has_cdefine_beep(codec))
9160 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009161
Takashi Iwai225068a2015-05-29 10:42:14 +02009162 spec->shutup = alc_eapd_shutup;
9163
Takashi Iwaic9af7532019-05-10 11:01:43 +02009164 alc_pre_init(codec);
9165
Takashi Iwai1727a772013-01-10 09:52:52 +01009166 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
9167 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009168
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009169 /* automatic parse from the BIOS config */
9170 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009171 if (err < 0)
9172 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009173
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009174 if (!spec->gen.no_analog) {
9175 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9176 if (err < 0)
9177 goto error;
9178 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009179
Takashi Iwai1727a772013-01-10 09:52:52 +01009180 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009181
Takashi Iwai1d045db2011-07-07 18:23:21 +02009182 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009183
9184 error:
9185 alc_free(codec);
9186 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009187}
9188
9189/*
9190 * ALC662 support
9191 *
9192 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9193 * configuration. Each pin widget can choose any input DACs and a mixer.
9194 * Each ADC is connected from a mixer of all inputs. This makes possible
9195 * 6-channel independent captures.
9196 *
9197 * In addition, an independent DAC for the multi-playback (not used in this
9198 * driver yet).
9199 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009200
9201/*
9202 * BIOS auto configuration
9203 */
9204
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009205static int alc662_parse_auto_config(struct hda_codec *codec)
9206{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02009207 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009208 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9209 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9210 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02009211
Takashi Iwai7639a062015-03-03 10:07:24 +01009212 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9213 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9214 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009215 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01009216 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009217 ssids = alc662_ssids;
9218 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009219}
9220
Todd Broch6be79482010-12-07 16:51:05 -08009221static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009222 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009223{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01009224 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009225 return;
Todd Broch6be79482010-12-07 16:51:05 -08009226 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9227 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9228 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9229 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9230 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01009231 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08009232}
9233
Takashi Iwai8e383952013-10-30 17:41:12 +01009234static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9235 { .channels = 2,
9236 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9237 { .channels = 4,
9238 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9239 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9240 { }
9241};
9242
9243/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009244static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01009245 const struct hda_fixup *fix, int action)
9246{
9247 if (action == HDA_FIXUP_ACT_BUILD) {
9248 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01009249 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01009250 }
9251}
9252
Takashi Iwaibf686652014-01-13 16:18:25 +01009253/* avoid D3 for keeping GPIO up */
9254static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9255 hda_nid_t nid,
9256 unsigned int power_state)
9257{
9258 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02009259 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01009260 return AC_PWRST_D0;
9261 return power_state;
9262}
9263
Takashi Iwai3e887f32014-01-10 17:50:58 +01009264static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9265 const struct hda_fixup *fix, int action)
9266{
9267 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009268
Takashi Iwai01e4a272018-06-19 22:47:30 +02009269 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01009270 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01009271 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01009272 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009273 }
9274}
9275
Kailang Yangc6790c82016-11-25 16:15:17 +08009276static void alc662_usi_automute_hook(struct hda_codec *codec,
9277 struct hda_jack_callback *jack)
9278{
9279 struct alc_spec *spec = codec->spec;
9280 int vref;
9281 msleep(200);
9282 snd_hda_gen_hp_automute(codec, jack);
9283
9284 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
9285 msleep(100);
9286 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9287 vref);
9288}
9289
9290static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
9291 const struct hda_fixup *fix, int action)
9292{
9293 struct alc_spec *spec = codec->spec;
9294 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9295 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9296 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
9297 }
9298}
9299
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009300static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
9301 struct hda_jack_callback *cb)
9302{
9303 /* surround speakers at 0x1b already get muted automatically when
9304 * headphones are plugged in, but we have to mute/unmute the remaining
9305 * channels manually:
9306 * 0x15 - front left/front right
9307 * 0x18 - front center/ LFE
9308 */
9309 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
9310 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
9311 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
9312 } else {
9313 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
9314 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
9315 }
9316}
9317
9318static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
9319 const struct hda_fixup *fix, int action)
9320{
9321 /* Pin 0x1b: shared headphones jack and surround speakers */
9322 if (!is_jack_detectable(codec, 0x1b))
9323 return;
9324
9325 switch (action) {
9326 case HDA_FIXUP_ACT_PRE_PROBE:
9327 snd_hda_jack_detect_enable_callback(codec, 0x1b,
9328 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +01009329 /* subwoofer needs an extra GPIO setting to become audible */
9330 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009331 break;
9332 case HDA_FIXUP_ACT_INIT:
9333 /* Make sure to start in a correct state, i.e. if
9334 * headphones have been plugged in before powering up the system
9335 */
9336 alc662_aspire_ethos_mute_speakers(codec, NULL);
9337 break;
9338 }
9339}
9340
Kailang Yang5af290282020-01-17 14:04:01 +08009341static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
9342 const struct hda_fixup *fix, int action)
9343{
9344 struct alc_spec *spec = codec->spec;
9345
9346 static const struct hda_pintbl pincfgs[] = {
9347 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
9348 { 0x1b, 0x0181304f },
9349 { }
9350 };
9351
9352 switch (action) {
9353 case HDA_FIXUP_ACT_PRE_PROBE:
9354 spec->gen.mixer_nid = 0;
9355 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9356 snd_hda_apply_pincfgs(codec, pincfgs);
9357 break;
9358 case HDA_FIXUP_ACT_INIT:
9359 alc_write_coef_idx(codec, 0x19, 0xa054);
9360 break;
9361 }
9362}
9363
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01009364static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +08009365 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
9366 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
9367 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
9368 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
9369 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
9370 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
9371 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
9372 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
9373 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
9374 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
9375 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
9376 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
9377 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
9378 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
9379 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
9380 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
9381 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
9382 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
9383 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
9384 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
9385 {}
9386};
9387
9388static void alc668_restore_default_value(struct hda_codec *codec)
9389{
9390 alc_process_coef_fw(codec, alc668_coefs);
9391}
9392
David Henningsson6cb3b702010-09-09 08:51:44 +02009393enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04009394 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01009395 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009396 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08009397 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009398 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009399 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02009400 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009401 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02009402 ALC662_FIXUP_ASUS_MODE1,
9403 ALC662_FIXUP_ASUS_MODE2,
9404 ALC662_FIXUP_ASUS_MODE3,
9405 ALC662_FIXUP_ASUS_MODE4,
9406 ALC662_FIXUP_ASUS_MODE5,
9407 ALC662_FIXUP_ASUS_MODE6,
9408 ALC662_FIXUP_ASUS_MODE7,
9409 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009410 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02009411 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02009412 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009413 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02009414 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009415 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02009416 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009417 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01009418 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009419 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009420 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08009421 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009422 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009423 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009424 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009425 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009426 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009427 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +02009428 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009429 ALC891_FIXUP_HEADSET_MODE,
9430 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009431 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009432 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08009433 ALC662_FIXUP_USI_FUNC,
9434 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08009435 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009436 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009437 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +08009438 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +08009439 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +08009440 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
David Henningsson6cb3b702010-09-09 08:51:44 +02009441};
9442
Takashi Iwai1727a772013-01-10 09:52:52 +01009443static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04009444 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009445 .type = HDA_FIXUP_PINS,
9446 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04009447 { 0x15, 0x99130112 }, /* subwoofer */
9448 { }
9449 }
9450 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01009451 [ALC662_FIXUP_LED_GPIO1] = {
9452 .type = HDA_FIXUP_FUNC,
9453 .v.func = alc662_fixup_led_gpio1,
9454 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009455 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009456 .type = HDA_FIXUP_PINS,
9457 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02009458 { 0x17, 0x99130112 }, /* subwoofer */
9459 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01009460 },
9461 .chained = true,
9462 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009463 },
Todd Broch6be79482010-12-07 16:51:05 -08009464 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009465 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01009466 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009467 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009468 [ALC662_FIXUP_CZC_ET26] = {
9469 .type = HDA_FIXUP_PINS,
9470 .v.pins = (const struct hda_pintbl[]) {
9471 {0x12, 0x403cc000},
9472 {0x14, 0x90170110}, /* speaker */
9473 {0x15, 0x411111f0},
9474 {0x16, 0x411111f0},
9475 {0x18, 0x01a19030}, /* mic */
9476 {0x19, 0x90a7013f}, /* int-mic */
9477 {0x1a, 0x01014020},
9478 {0x1b, 0x0121401f},
9479 {0x1c, 0x411111f0},
9480 {0x1d, 0x411111f0},
9481 {0x1e, 0x40478e35},
9482 {}
9483 },
9484 .chained = true,
9485 .chain_id = ALC662_FIXUP_SKU_IGNORE
9486 },
Anisse Astierd2ebd472011-01-20 12:36:21 +01009487 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009488 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009489 .v.verbs = (const struct hda_verb[]) {
9490 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
9491 {}
9492 }
9493 },
David Henningsson94024cd2011-04-29 14:10:55 +02009494 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009495 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02009496 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02009497 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009498 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009499 .type = HDA_FIXUP_PINS,
9500 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009501 { 0x14, 0x0221201f }, /* HP out */
9502 { }
9503 },
9504 .chained = true,
9505 .chain_id = ALC662_FIXUP_SKU_IGNORE
9506 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009507 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009508 .type = HDA_FIXUP_PINS,
9509 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009510 { 0x14, 0x99130110 }, /* speaker */
9511 { 0x18, 0x01a19c20 }, /* mic */
9512 { 0x19, 0x99a3092f }, /* int-mic */
9513 { 0x21, 0x0121401f }, /* HP out */
9514 { }
9515 },
9516 .chained = true,
9517 .chain_id = ALC662_FIXUP_SKU_IGNORE
9518 },
9519 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009520 .type = HDA_FIXUP_PINS,
9521 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009522 { 0x14, 0x99130110 }, /* speaker */
9523 { 0x18, 0x01a19820 }, /* mic */
9524 { 0x19, 0x99a3092f }, /* int-mic */
9525 { 0x1b, 0x0121401f }, /* HP out */
9526 { }
9527 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009528 .chained = true,
9529 .chain_id = ALC662_FIXUP_SKU_IGNORE
9530 },
9531 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009532 .type = HDA_FIXUP_PINS,
9533 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009534 { 0x14, 0x99130110 }, /* speaker */
9535 { 0x15, 0x0121441f }, /* HP */
9536 { 0x18, 0x01a19840 }, /* mic */
9537 { 0x19, 0x99a3094f }, /* int-mic */
9538 { 0x21, 0x01211420 }, /* HP2 */
9539 { }
9540 },
9541 .chained = true,
9542 .chain_id = ALC662_FIXUP_SKU_IGNORE
9543 },
9544 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009545 .type = HDA_FIXUP_PINS,
9546 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009547 { 0x14, 0x99130110 }, /* speaker */
9548 { 0x16, 0x99130111 }, /* speaker */
9549 { 0x18, 0x01a19840 }, /* mic */
9550 { 0x19, 0x99a3094f }, /* int-mic */
9551 { 0x21, 0x0121441f }, /* HP */
9552 { }
9553 },
9554 .chained = true,
9555 .chain_id = ALC662_FIXUP_SKU_IGNORE
9556 },
9557 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009558 .type = HDA_FIXUP_PINS,
9559 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009560 { 0x14, 0x99130110 }, /* speaker */
9561 { 0x15, 0x0121441f }, /* HP */
9562 { 0x16, 0x99130111 }, /* speaker */
9563 { 0x18, 0x01a19840 }, /* mic */
9564 { 0x19, 0x99a3094f }, /* int-mic */
9565 { }
9566 },
9567 .chained = true,
9568 .chain_id = ALC662_FIXUP_SKU_IGNORE
9569 },
9570 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009571 .type = HDA_FIXUP_PINS,
9572 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009573 { 0x14, 0x99130110 }, /* speaker */
9574 { 0x15, 0x01211420 }, /* HP2 */
9575 { 0x18, 0x01a19840 }, /* mic */
9576 { 0x19, 0x99a3094f }, /* int-mic */
9577 { 0x1b, 0x0121441f }, /* HP */
9578 { }
9579 },
9580 .chained = true,
9581 .chain_id = ALC662_FIXUP_SKU_IGNORE
9582 },
9583 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009584 .type = HDA_FIXUP_PINS,
9585 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009586 { 0x14, 0x99130110 }, /* speaker */
9587 { 0x17, 0x99130111 }, /* speaker */
9588 { 0x18, 0x01a19840 }, /* mic */
9589 { 0x19, 0x99a3094f }, /* int-mic */
9590 { 0x1b, 0x01214020 }, /* HP */
9591 { 0x21, 0x0121401f }, /* HP */
9592 { }
9593 },
9594 .chained = true,
9595 .chain_id = ALC662_FIXUP_SKU_IGNORE
9596 },
9597 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009598 .type = HDA_FIXUP_PINS,
9599 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009600 { 0x14, 0x99130110 }, /* speaker */
9601 { 0x12, 0x99a30970 }, /* int-mic */
9602 { 0x15, 0x01214020 }, /* HP */
9603 { 0x17, 0x99130111 }, /* speaker */
9604 { 0x18, 0x01a19840 }, /* mic */
9605 { 0x21, 0x0121401f }, /* HP */
9606 { }
9607 },
9608 .chained = true,
9609 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009610 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01009611 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009612 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009613 .v.func = alc_fixup_no_jack_detect,
9614 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02009615 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009616 .type = HDA_FIXUP_PINS,
9617 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02009618 { 0x1b, 0x02214020 }, /* Front HP */
9619 { }
9620 }
9621 },
Takashi Iwai125821a2012-06-22 14:30:29 +02009622 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009623 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02009624 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02009625 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009626 [ALC668_FIXUP_DELL_XPS13] = {
9627 .type = HDA_FIXUP_FUNC,
9628 .v.func = alc_fixup_dell_xps13,
9629 .chained = true,
9630 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
9631 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009632 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
9633 .type = HDA_FIXUP_FUNC,
9634 .v.func = alc_fixup_disable_aamix,
9635 .chained = true,
9636 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9637 },
Hui Wang493a52a2014-01-14 14:07:36 +08009638 [ALC668_FIXUP_AUTO_MUTE] = {
9639 .type = HDA_FIXUP_FUNC,
9640 .v.func = alc_fixup_auto_mute_via_amp,
9641 .chained = true,
9642 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9643 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02009644 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
9645 .type = HDA_FIXUP_PINS,
9646 .v.pins = (const struct hda_pintbl[]) {
9647 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9648 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
9649 { }
9650 },
9651 .chained = true,
9652 .chain_id = ALC662_FIXUP_HEADSET_MODE
9653 },
9654 [ALC662_FIXUP_HEADSET_MODE] = {
9655 .type = HDA_FIXUP_FUNC,
9656 .v.func = alc_fixup_headset_mode_alc662,
9657 },
David Henningsson73bdd592013-04-15 15:44:14 +02009658 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
9659 .type = HDA_FIXUP_PINS,
9660 .v.pins = (const struct hda_pintbl[]) {
9661 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9662 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9663 { }
9664 },
9665 .chained = true,
9666 .chain_id = ALC668_FIXUP_HEADSET_MODE
9667 },
9668 [ALC668_FIXUP_HEADSET_MODE] = {
9669 .type = HDA_FIXUP_FUNC,
9670 .v.func = alc_fixup_headset_mode_alc668,
9671 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009672 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01009673 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009674 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01009675 .chained = true,
9676 .chain_id = ALC662_FIXUP_ASUS_MODE4
9677 },
David Henningsson61a75f12014-02-07 09:31:08 +01009678 [ALC662_FIXUP_BASS_16] = {
9679 .type = HDA_FIXUP_PINS,
9680 .v.pins = (const struct hda_pintbl[]) {
9681 {0x16, 0x80106111}, /* bass speaker */
9682 {}
9683 },
9684 .chained = true,
9685 .chain_id = ALC662_FIXUP_BASS_CHMAP,
9686 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009687 [ALC662_FIXUP_BASS_1A] = {
9688 .type = HDA_FIXUP_PINS,
9689 .v.pins = (const struct hda_pintbl[]) {
9690 {0x1a, 0x80106111}, /* bass speaker */
9691 {}
9692 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009693 .chained = true,
9694 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009695 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009696 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009697 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009698 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009699 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009700 [ALC662_FIXUP_ASUS_Nx50] = {
9701 .type = HDA_FIXUP_FUNC,
9702 .v.func = alc_fixup_auto_mute_via_amp,
9703 .chained = true,
9704 .chain_id = ALC662_FIXUP_BASS_1A
9705 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009706 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
9707 .type = HDA_FIXUP_FUNC,
9708 .v.func = alc_fixup_headset_mode_alc668,
9709 .chain_id = ALC662_FIXUP_BASS_CHMAP
9710 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009711 [ALC668_FIXUP_ASUS_Nx51] = {
9712 .type = HDA_FIXUP_PINS,
9713 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009714 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9715 { 0x1a, 0x90170151 }, /* bass speaker */
9716 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009717 {}
9718 },
9719 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009720 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009721 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009722 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +02009723 .type = HDA_FIXUP_VERBS,
9724 .v.verbs = (const struct hda_verb[]) {
9725 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
9726 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
9727 {}
9728 },
9729 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009730 [ALC668_FIXUP_ASUS_G751] = {
9731 .type = HDA_FIXUP_PINS,
9732 .v.pins = (const struct hda_pintbl[]) {
9733 { 0x16, 0x0421101f }, /* HP */
9734 {}
9735 },
9736 .chained = true,
9737 .chain_id = ALC668_FIXUP_MIC_COEF
9738 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009739 [ALC891_FIXUP_HEADSET_MODE] = {
9740 .type = HDA_FIXUP_FUNC,
9741 .v.func = alc_fixup_headset_mode,
9742 },
9743 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
9744 .type = HDA_FIXUP_PINS,
9745 .v.pins = (const struct hda_pintbl[]) {
9746 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9747 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9748 { }
9749 },
9750 .chained = true,
9751 .chain_id = ALC891_FIXUP_HEADSET_MODE
9752 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009753 [ALC662_FIXUP_ACER_VERITON] = {
9754 .type = HDA_FIXUP_PINS,
9755 .v.pins = (const struct hda_pintbl[]) {
9756 { 0x15, 0x50170120 }, /* no internal speaker */
9757 { }
9758 }
9759 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009760 [ALC892_FIXUP_ASROCK_MOBO] = {
9761 .type = HDA_FIXUP_PINS,
9762 .v.pins = (const struct hda_pintbl[]) {
9763 { 0x15, 0x40f000f0 }, /* disabled */
9764 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009765 { }
9766 }
9767 },
Kailang Yangc6790c82016-11-25 16:15:17 +08009768 [ALC662_FIXUP_USI_FUNC] = {
9769 .type = HDA_FIXUP_FUNC,
9770 .v.func = alc662_fixup_usi_headset_mic,
9771 },
9772 [ALC662_FIXUP_USI_HEADSET_MODE] = {
9773 .type = HDA_FIXUP_PINS,
9774 .v.pins = (const struct hda_pintbl[]) {
9775 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
9776 { 0x18, 0x01a1903d },
9777 { }
9778 },
9779 .chained = true,
9780 .chain_id = ALC662_FIXUP_USI_FUNC
9781 },
Kailang Yangca169cc2017-04-25 16:17:40 +08009782 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
9783 .type = HDA_FIXUP_FUNC,
9784 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
9785 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009786 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
9787 .type = HDA_FIXUP_FUNC,
9788 .v.func = alc662_fixup_aspire_ethos_hp,
9789 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009790 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
9791 .type = HDA_FIXUP_PINS,
9792 .v.pins = (const struct hda_pintbl[]) {
9793 { 0x15, 0x92130110 }, /* front speakers */
9794 { 0x18, 0x99130111 }, /* center/subwoofer */
9795 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
9796 { }
9797 },
9798 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +01009799 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009800 },
Kailang Yang5af290282020-01-17 14:04:01 +08009801 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
9802 .type = HDA_FIXUP_FUNC,
9803 .v.func = alc671_fixup_hp_headset_mic2,
9804 },
Jian-Hong Pand858c702020-03-17 16:28:07 +08009805 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
9806 .type = HDA_FIXUP_PINS,
9807 .v.pins = (const struct hda_pintbl[]) {
9808 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9809 { }
9810 },
9811 .chained = true,
9812 .chain_id = ALC662_FIXUP_USI_FUNC
9813 },
Jian-Hong Pana1244582020-03-17 16:28:09 +08009814 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
9815 .type = HDA_FIXUP_PINS,
9816 .v.pins = (const struct hda_pintbl[]) {
9817 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
9818 { 0x1b, 0x0221144f },
9819 { }
9820 },
9821 .chained = true,
9822 .chain_id = ALC662_FIXUP_USI_FUNC
9823 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009824};
9825
Takashi Iwaia9111322011-05-02 11:30:18 +02009826static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009827 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +02009828 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +01009829 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +01009830 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +02009831 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +02009832 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +02009833 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -04009834 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Jian-Hong Pana1244582020-03-17 16:28:09 +08009835 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +08009836 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +02009837 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9838 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +02009839 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009840 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +02009841 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +01009842 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +01009843 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +08009844 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9845 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +08009846 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009847 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Jeremy Szu148ebf542020-10-08 18:56:44 +08009848 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Kaho Ng2da2dc92016-05-09 00:27:49 +08009849 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +02009850 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwaidb8948e2016-01-18 09:17:30 +01009851 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009852 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +02009853 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
David Henningsson8e54b4a2014-02-07 09:31:07 +01009854 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +01009855 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009856 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
9857 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +01009858 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +01009859 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +01009860 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +01009861 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +02009862 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -05009863 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +08009864 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +08009865 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +06009866 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +02009867 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009868 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +02009869 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009870 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009871 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +01009872 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009873 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Takashi Iwai53c334a2011-08-23 18:27:14 +02009874
9875#if 0
9876 /* Below is a quirk table taken from the old code.
9877 * Basically the device should work as is without the fixup table.
9878 * If BIOS doesn't give a proper info, enable the corresponding
9879 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009880 */
Takashi Iwai53c334a2011-08-23 18:27:14 +02009881 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
9882 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
9883 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
9884 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
9885 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9886 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9887 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9888 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
9889 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
9890 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9891 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
9892 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
9893 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
9894 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
9895 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
9896 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9897 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
9898 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
9899 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9900 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9901 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9902 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9903 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
9904 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
9905 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
9906 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9907 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
9908 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9909 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9910 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
9911 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9912 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9913 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
9914 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
9915 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
9916 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
9917 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
9918 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
9919 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
9920 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9921 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
9922 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
9923 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9924 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
9925 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
9926 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
9927 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
9928 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
9929 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9930 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
9931#endif
David Henningsson6cb3b702010-09-09 08:51:44 +02009932 {}
9933};
9934
Takashi Iwai1727a772013-01-10 09:52:52 +01009935static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009936 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
9937 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -08009938 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009939 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +02009940 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
9941 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
9942 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
9943 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
9944 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
9945 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
9946 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
9947 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009948 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02009949 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009950 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +02009951 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009952 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
9953 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
9954 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
9955 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
9956 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
9957 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
9958 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
9959 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +02009960 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009961 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
9962 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
9963 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
9964 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
9965 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02009966 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009967 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -08009968 {}
9969};
David Henningsson6cb3b702010-09-09 08:51:44 +02009970
Hui Wang532895c2014-05-29 15:59:19 +08009971static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009972 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9973 {0x17, 0x02211010},
9974 {0x18, 0x01a19030},
9975 {0x1a, 0x01813040},
9976 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +08009977 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9978 {0x16, 0x01813030},
9979 {0x17, 0x02211010},
9980 {0x18, 0x01a19040},
9981 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +02009982 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009983 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +02009984 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +02009985 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +08009986 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +02009987 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9988 {0x12, 0x99a30130},
9989 {0x14, 0x90170110},
9990 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08009991 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02009992 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9993 {0x12, 0x99a30140},
9994 {0x14, 0x90170110},
9995 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08009996 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02009997 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
9998 {0x12, 0x99a30150},
9999 {0x14, 0x90170110},
10000 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010001 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010002 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +020010003 {0x14, 0x90170110},
10004 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010005 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010006 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10007 {0x12, 0x90a60130},
10008 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +080010009 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +080010010 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10011 {0x14, 0x01014010},
10012 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +080010013 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +080010014 {0x1b, 0x01813030},
10015 {0x21, 0x02211020}),
10016 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10017 {0x14, 0x01014010},
10018 {0x18, 0x01a19040},
10019 {0x1b, 0x01813030},
10020 {0x21, 0x02211020}),
10021 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10022 {0x14, 0x01014020},
10023 {0x17, 0x90170110},
10024 {0x18, 0x01a19050},
10025 {0x1b, 0x01813040},
10026 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +080010027 {}
10028};
10029
Takashi Iwai1d045db2011-07-07 18:23:21 +020010030/*
10031 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010032static int patch_alc662(struct hda_codec *codec)
10033{
10034 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +020010035 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010036
Takashi Iwai3de95172012-05-07 18:03:15 +020010037 err = alc_alloc_spec(codec, 0x0b);
10038 if (err < 0)
10039 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010040
Takashi Iwai3de95172012-05-07 18:03:15 +020010041 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010042
Takashi Iwai225068a2015-05-29 10:42:14 +020010043 spec->shutup = alc_eapd_shutup;
10044
Takashi Iwai53c334a2011-08-23 18:27:14 +020010045 /* handle multiple HPs as is */
10046 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10047
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +020010048 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10049
Takashi Iwai7639a062015-03-03 10:07:24 +010010050 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +080010051 case 0x10ec0668:
10052 spec->init_hook = alc668_restore_default_value;
10053 break;
Kailang Yangf3f91852014-10-24 15:43:46 +080010054 }
Kailang Yang8663ff72012-06-29 09:35:52 +020010055
Takashi Iwaic9af7532019-05-10 11:01:43 +020010056 alc_pre_init(codec);
10057
Takashi Iwai1727a772013-01-10 09:52:52 +010010058 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010059 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +080010060 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +010010061 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010062
10063 alc_auto_parse_customize_define(codec);
10064
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010065 if (has_cdefine_beep(codec))
10066 spec->gen.beep_nid = 0x01;
10067
Takashi Iwai1bb7e432011-10-17 16:50:59 +020010068 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +010010069 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010070 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +080010071 err = alc_codec_rename(codec, "ALC272X");
10072 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010073 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +020010074 }
Kailang Yang274693f2009-12-03 10:07:50 +010010075
Takashi Iwaib9c51062011-08-24 18:08:07 +020010076 /* automatic parse from the BIOS config */
10077 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010078 if (err < 0)
10079 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010080
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010081 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +010010082 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +010010083 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010084 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010085 break;
10086 case 0x10ec0272:
10087 case 0x10ec0663:
10088 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +080010089 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010090 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010091 break;
10092 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010093 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010094 break;
10095 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010096 if (err < 0)
10097 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +010010098 }
Takashi Iwai2134ea42008-01-10 16:53:55 +010010099
Takashi Iwai1727a772013-01-10 09:52:52 +010010100 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010101
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010102 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010103
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010104 error:
10105 alc_free(codec);
10106 return err;
Kailang Yangb478b992011-05-18 11:51:15 +020010107}
10108
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010109/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010110 * ALC680 support
10111 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010112
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010113static int alc680_parse_auto_config(struct hda_codec *codec)
10114{
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010115 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010116}
10117
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010118/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010119 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010120static int patch_alc680(struct hda_codec *codec)
10121{
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010122 int err;
10123
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010124 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +020010125 err = alc_alloc_spec(codec, 0);
10126 if (err < 0)
10127 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010128
Takashi Iwai1ebec5f2011-08-15 13:21:48 +020010129 /* automatic parse from the BIOS config */
10130 err = alc680_parse_auto_config(codec);
10131 if (err < 0) {
10132 alc_free(codec);
10133 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010134 }
10135
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010136 return 0;
10137}
10138
10139/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070010140 * patch entries
10141 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010142static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +080010143 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010144 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +080010145 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +080010146 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010147 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
10148 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010149 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010150 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +080010151 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +080010152 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010153 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
10154 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +080010155 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010156 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
10157 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
10158 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
10159 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
10160 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
10161 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
10162 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010163 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010164 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
10165 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
10166 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
10167 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
10168 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
10169 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010170 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010171 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080010172 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010173 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010174 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010175 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10176 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10177 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010178 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080010179 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010180 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080010181 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080010182 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080010183 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010184 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10185 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10186 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10187 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10188 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10189 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10190 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10191 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10192 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10193 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10194 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10195 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10196 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10197 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080010198 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10199 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10200 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080010201 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010202 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010203 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10204 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10205 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10206 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10207 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10208 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10209 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10210 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10211 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10212 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10213 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
10214 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10215 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080010216 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080010217 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080010218 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070010219 {} /* terminator */
10220};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010221MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010222
10223MODULE_LICENSE("GPL");
10224MODULE_DESCRIPTION("Realtek HD-audio codec");
10225
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010226static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010227 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010228};
10229
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010230module_hda_codec_driver(realtek_driver);