blob: f76b701324788cf43e85758425961a6a9ff6a5a6 [file] [log] [blame]
Thomas Gleixnerd0fa1172019-05-20 19:07:57 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
Takashi Iwai1d045db2011-07-07 18:23:21 +02005 * HD audio interface patch for Realtek ALC codecs
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
Kailang Yangdf694da2005-12-05 19:42:22 +01007 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * Takashi Iwai <tiwai@suse.de>
Jonathan Woithe409a3e92012-03-27 13:01:01 +103010 * Jonathan Woithe <jwoithe@just42.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
Takashi Iwai08fb0d02013-01-10 17:33:58 +010017#include <linux/dmi.h>
Paul Gortmakerda155d52011-07-15 12:38:28 -040018#include <linux/module.h>
David Henningsson33f4acd2015-01-07 15:50:13 +010019#include <linux/input.h>
Kai-Heng Feng87dc3642020-04-30 21:52:07 +080020#include <linux/leds.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <sound/core.h>
Kailang Yang9ad0e492010-09-14 23:22:00 +020022#include <sound/jack.h>
Pierre-Louis Bossartbe57bff2018-08-22 15:24:57 -050023#include <sound/hda_codec.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include "hda_local.h"
Takashi Iwai23d30f22012-05-07 17:17:32 +020025#include "hda_auto_parser.h"
Takashi Iwai1835a0f2011-10-27 22:12:46 +020026#include "hda_jack.h"
Takashi Iwai08c189f2012-12-19 15:22:24 +010027#include "hda_generic.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Takashi Iwaicd63a5f2013-07-05 12:13:59 +020029/* keep halting ALC5505 DSP, for power saving */
30#define HALT_REALTEK_ALC5505
31
Takashi Iwai4a79ba32009-04-22 16:31:35 +020032/* extra amp-initialization sequence types */
33enum {
Takashi Iwai1c76aa52018-06-21 16:37:54 +020034 ALC_INIT_UNDEFINED,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020035 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020037};
38
David Henningsson73bdd592013-04-15 15:44:14 +020039enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45};
46
47enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51};
52
Hui Wangc7b60a82015-12-28 11:35:25 +080053enum {
54 ALC_KEY_MICMUTE_INDEX,
55};
56
Kailang Yangda00c242010-03-19 11:23:45 +010057struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
David Henningsson90622912010-10-14 14:50:18 +020067 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010068};
69
Takashi Iwai766538a2020-06-18 13:08:41 +020070struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75};
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010078 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020079
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 /* codec parameterization */
Kailang Yangda00c242010-03-19 11:23:45 +010081 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010082 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
83
Takashi Iwai5579cd62018-06-19 22:22:41 +020084 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
Takashi Iwai215c8502018-06-19 22:34:26 +020088 bool gpio_write_delay; /* add a delay before writing gpio_data */
Takashi Iwai5579cd62018-06-19 22:22:41 +020089
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +020090 /* mute LED for HP laptops, see vref_mute_led_set() */
Takashi Iwai08fb0d02013-01-10 17:33:58 +010091 int mute_led_polarity;
Kai-Heng Fengdbd13172020-04-30 16:32:51 +080092 int micmute_led_polarity;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010093 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +080094 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010095
Takashi Iwai0f32fd192014-11-19 12:16:14 +010096 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
Takashi Iwai766538a2020-06-18 13:08:41 +020098 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100100
David Henningsson73bdd592013-04-15 15:44:14 +0200101 hda_nid_t headset_mic_pin;
102 hda_nid_t headphone_mic_pin;
103 int current_headset_mode;
104 int current_headset_type;
105
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100106 /* hooks */
107 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200108#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500109 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100110#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200111 void (*shutup)(struct hda_codec *codec);
Takashi Iwai70a09762015-12-15 14:59:58 +0100112 void (*reboot_notify)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200113
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200114 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200115 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
Kailang Yang693abe12019-01-29 15:38:21 +0800118 unsigned int done_hp_init:1;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100119 unsigned int no_shutup_pins:1;
Kailang Yangd3ba58b2019-05-06 15:09:42 +0800120 unsigned int ultra_low_power:1;
Hui Wang476c02e2020-03-29 16:20:18 +0800121 unsigned int has_hs_key:1;
Kailang Yang92666d42020-11-19 17:04:21 +0800122 unsigned int no_internal_mic_pin:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100123
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200124 /* for PLL fix */
125 hda_nid_t pll_nid;
126 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200127 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100128 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800129 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100130};
131
Takashi Iwai23f0c042009-02-26 13:03:58 +0100132/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200133 * COEF access helper functions
134 */
135
136static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
137 unsigned int coef_idx)
138{
139 unsigned int val;
140
141 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
142 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
143 return val;
144}
145
146#define alc_read_coef_idx(codec, coef_idx) \
147 alc_read_coefex_idx(codec, 0x20, coef_idx)
148
149static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
150 unsigned int coef_idx, unsigned int coef_val)
151{
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
154}
155
156#define alc_write_coef_idx(codec, coef_idx, coef_val) \
157 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
158
Takashi Iwai98b24882014-08-18 13:47:50 +0200159static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 unsigned int coef_idx, unsigned int mask,
161 unsigned int bits_set)
162{
163 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
164
165 if (val != -1)
166 alc_write_coefex_idx(codec, nid, coef_idx,
167 (val & ~mask) | bits_set);
168}
169
170#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
171 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
172
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200173/* a special bypass for COEF 0; read the cached value at the second time */
174static unsigned int alc_get_coef0(struct hda_codec *codec)
175{
176 struct alc_spec *spec = codec->spec;
177
178 if (!spec->coef0)
179 spec->coef0 = alc_read_coef_idx(codec, 0);
180 return spec->coef0;
181}
182
Takashi Iwai54db6c32014-08-18 15:11:19 +0200183/* coef writes/updates batch */
184struct coef_fw {
185 unsigned char nid;
186 unsigned char idx;
187 unsigned short mask;
188 unsigned short val;
189};
190
191#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
192 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
193#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
194#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
195#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
196
197static void alc_process_coef_fw(struct hda_codec *codec,
198 const struct coef_fw *fw)
199{
200 for (; fw->nid; fw++) {
201 if (fw->mask == (unsigned short)-1)
202 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
203 else
204 alc_update_coefex_idx(codec, fw->nid, fw->idx,
205 fw->mask, fw->val);
206 }
207}
208
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200209/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200210 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100211 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200212
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200213/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200214static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
215{
216 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200217
Takashi Iwai5579cd62018-06-19 22:22:41 +0200218 spec->gpio_mask |= mask;
219 spec->gpio_dir |= mask;
220 spec->gpio_data |= mask;
221}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200222
Takashi Iwai5579cd62018-06-19 22:22:41 +0200223static void alc_write_gpio_data(struct hda_codec *codec)
224{
225 struct alc_spec *spec = codec->spec;
226
227 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
228 spec->gpio_data);
229}
230
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200231static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
232 bool on)
233{
234 struct alc_spec *spec = codec->spec;
235 unsigned int oldval = spec->gpio_data;
236
237 if (on)
238 spec->gpio_data |= mask;
239 else
240 spec->gpio_data &= ~mask;
241 if (oldval != spec->gpio_data)
242 alc_write_gpio_data(codec);
243}
244
Takashi Iwai5579cd62018-06-19 22:22:41 +0200245static void alc_write_gpio(struct hda_codec *codec)
246{
247 struct alc_spec *spec = codec->spec;
248
249 if (!spec->gpio_mask)
250 return;
251
252 snd_hda_codec_write(codec, codec->core.afg, 0,
253 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
254 snd_hda_codec_write(codec, codec->core.afg, 0,
255 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200256 if (spec->gpio_write_delay)
257 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200258 alc_write_gpio_data(codec);
259}
260
261static void alc_fixup_gpio(struct hda_codec *codec, int action,
262 unsigned int mask)
263{
264 if (action == HDA_FIXUP_ACT_PRE_PROBE)
265 alc_setup_gpio(codec, mask);
266}
267
268static void alc_fixup_gpio1(struct hda_codec *codec,
269 const struct hda_fixup *fix, int action)
270{
271 alc_fixup_gpio(codec, action, 0x01);
272}
273
274static void alc_fixup_gpio2(struct hda_codec *codec,
275 const struct hda_fixup *fix, int action)
276{
277 alc_fixup_gpio(codec, action, 0x02);
278}
279
280static void alc_fixup_gpio3(struct hda_codec *codec,
281 const struct hda_fixup *fix, int action)
282{
283 alc_fixup_gpio(codec, action, 0x03);
284}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200285
Takashi Iwaiae065f12018-06-19 23:00:03 +0200286static void alc_fixup_gpio4(struct hda_codec *codec,
287 const struct hda_fixup *fix, int action)
288{
289 alc_fixup_gpio(codec, action, 0x04);
290}
291
Takashi Iwai8a503552020-06-18 13:08:32 +0200292static void alc_fixup_micmute_led(struct hda_codec *codec,
293 const struct hda_fixup *fix, int action)
294{
295 if (action == HDA_FIXUP_ACT_PROBE)
296 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
297}
298
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200299/*
300 * Fix hardware PLL issue
301 * On some codecs, the analog PLL gating control must be off while
302 * the default value is 1.
303 */
304static void alc_fix_pll(struct hda_codec *codec)
305{
306 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200307
Takashi Iwai98b24882014-08-18 13:47:50 +0200308 if (spec->pll_nid)
309 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
310 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200311}
312
313static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
314 unsigned int coef_idx, unsigned int coef_bit)
315{
316 struct alc_spec *spec = codec->spec;
317 spec->pll_nid = nid;
318 spec->pll_coef_idx = coef_idx;
319 spec->pll_coef_bit = coef_bit;
320 alc_fix_pll(codec);
321}
322
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100323/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200324static void alc_update_knob_master(struct hda_codec *codec,
325 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100326{
327 unsigned int val;
328 struct snd_kcontrol *kctl;
329 struct snd_ctl_elem_value *uctl;
330
331 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
332 if (!kctl)
333 return;
334 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
335 if (!uctl)
336 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100337 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100338 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
339 val &= HDA_AMP_VOLMASK;
340 uctl->value.integer.value[0] = val;
341 uctl->value.integer.value[1] = val;
342 kctl->put(kctl, uctl);
343 kfree(uctl);
344}
345
David Henningsson29adc4b2012-09-25 11:31:00 +0200346static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100347{
David Henningsson29adc4b2012-09-25 11:31:00 +0200348 /* For some reason, the res given from ALC880 is broken.
349 Here we adjust it properly. */
350 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100351}
352
Kailang Yang394c97f2014-11-12 17:38:08 +0800353/* Change EAPD to verb control */
354static void alc_fill_eapd_coef(struct hda_codec *codec)
355{
356 int coef;
357
358 coef = alc_get_coef0(codec);
359
Takashi Iwai7639a062015-03-03 10:07:24 +0100360 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800361 case 0x10ec0262:
362 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
363 break;
364 case 0x10ec0267:
365 case 0x10ec0268:
366 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
367 break;
368 case 0x10ec0269:
369 if ((coef & 0x00f0) == 0x0010)
370 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
371 if ((coef & 0x00f0) == 0x0020)
372 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
373 if ((coef & 0x00f0) == 0x0030)
374 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
375 break;
376 case 0x10ec0280:
377 case 0x10ec0284:
378 case 0x10ec0290:
379 case 0x10ec0292:
380 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
381 break;
Kailang Yang42314302016-02-03 15:03:50 +0800382 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100383 case 0x10ec0295:
384 case 0x10ec0299:
385 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -0500386 fallthrough;
Takashi Iwai44be77c2017-12-27 08:53:59 +0100387 case 0x10ec0215:
Kailang Yang394c97f2014-11-12 17:38:08 +0800388 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800389 case 0x10ec0235:
Thomas Hebbc4473742020-03-30 12:09:38 -0400390 case 0x10ec0236:
Kailang Yang7fbdcd82020-04-23 14:18:31 +0800391 case 0x10ec0245:
Kailang Yang394c97f2014-11-12 17:38:08 +0800392 case 0x10ec0255:
Thomas Hebbc4473742020-03-30 12:09:38 -0400393 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800394 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800395 case 0x10ec0282:
396 case 0x10ec0283:
397 case 0x10ec0286:
Kailang Yang630e3612020-05-27 14:10:26 +0800398 case 0x10ec0287:
Kailang Yang394c97f2014-11-12 17:38:08 +0800399 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800400 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800401 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800402 case 0x10ec0289:
Kailang Yang1078bef2018-11-08 16:36:15 +0800403 case 0x10ec0300:
Kailang Yang394c97f2014-11-12 17:38:08 +0800404 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
405 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800406 case 0x10ec0275:
407 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
408 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800409 case 0x10ec0293:
410 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
411 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800412 case 0x10ec0234:
413 case 0x10ec0274:
414 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800415 case 0x10ec0700:
416 case 0x10ec0701:
417 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +0800418 case 0x10ec0711:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800419 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
420 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800421 case 0x10ec0662:
422 if ((coef & 0x00f0) == 0x0030)
423 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
424 break;
425 case 0x10ec0272:
426 case 0x10ec0273:
427 case 0x10ec0663:
428 case 0x10ec0665:
429 case 0x10ec0670:
430 case 0x10ec0671:
431 case 0x10ec0672:
432 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
433 break;
Kailang Yang9194a1e2020-01-07 17:22:19 +0800434 case 0x10ec0222:
Kailang Yangf0778872019-10-24 15:13:32 +0800435 case 0x10ec0623:
436 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
437 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800438 case 0x10ec0668:
439 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
440 break;
441 case 0x10ec0867:
442 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
443 break;
444 case 0x10ec0888:
445 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
446 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
447 break;
448 case 0x10ec0892:
Kailang Yange5782a52020-11-27 14:39:23 +0800449 case 0x10ec0897:
Kailang Yang394c97f2014-11-12 17:38:08 +0800450 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
451 break;
452 case 0x10ec0899:
453 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +0800454 case 0x10ec0b00:
Kailang Yang65553b12017-07-11 15:15:47 +0800455 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800456 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800457 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
458 break;
459 }
460}
461
Kailang Yangf9423e72008-05-27 12:32:25 +0200462/* additional initialization for ALC888 variants */
463static void alc888_coef_init(struct hda_codec *codec)
464{
Kailang Yang1df88742014-10-29 16:10:13 +0800465 switch (alc_get_coef0(codec) & 0x00f0) {
466 /* alc888-VA */
467 case 0x00:
468 /* alc888-VB */
469 case 0x10:
470 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
471 break;
472 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200473}
474
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100475/* turn on/off EAPD control (only if available) */
476static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
477{
478 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
479 return;
480 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
481 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
482 on ? 2 : 0);
483}
484
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200485/* turn on/off EAPD controls of the codec */
486static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
487{
488 /* We currently only handle front, HP */
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100489 static const hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800490 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200491 };
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100492 const hda_nid_t *p;
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200493 for (p = pins; *p; p++)
494 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200495}
496
Kailang Yangdad31972019-05-10 16:28:57 +0800497static int find_ext_mic_pin(struct hda_codec *codec);
498
499static void alc_headset_mic_no_shutup(struct hda_codec *codec)
500{
501 const struct hda_pincfg *pin;
502 int mic_pin = find_ext_mic_pin(codec);
503 int i;
504
505 /* don't shut up pins when unloading the driver; otherwise it breaks
506 * the default pin setup at the next load of the driver
507 */
508 if (codec->bus->shutdown)
509 return;
510
511 snd_array_for_each(&codec->init_pins, i, pin) {
512 /* use read here for syncing after issuing each verb */
513 if (pin->nid != mic_pin)
514 snd_hda_codec_read(codec, pin->nid, 0,
515 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
516 }
517
518 codec->pins_shutup = 1;
519}
520
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100521static void alc_shutup_pins(struct hda_codec *codec)
522{
523 struct alc_spec *spec = codec->spec;
524
Kailang Yangdad31972019-05-10 16:28:57 +0800525 switch (codec->core.vendor_id) {
Kailang Yang66c5d712019-12-09 15:56:15 +0800526 case 0x10ec0283:
Kailang Yangdad31972019-05-10 16:28:57 +0800527 case 0x10ec0286:
528 case 0x10ec0288:
529 case 0x10ec0298:
530 alc_headset_mic_no_shutup(codec);
531 break;
532 default:
533 if (!spec->no_shutup_pins)
534 snd_hda_shutup_pins(codec);
535 break;
536 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100537}
538
Takashi Iwai1c7161532011-04-07 10:37:16 +0200539/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100540 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200541 */
542static void alc_eapd_shutup(struct hda_codec *codec)
543{
Kailang Yang97a26572013-11-29 00:35:26 -0500544 struct alc_spec *spec = codec->spec;
545
Takashi Iwai1c7161532011-04-07 10:37:16 +0200546 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500547 if (!spec->no_depop_delay)
548 msleep(200);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100549 alc_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200550}
551
Takashi Iwai1d045db2011-07-07 18:23:21 +0200552/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200553static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200554{
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200555 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200556 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200557 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200558 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100559 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200560 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200561 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200562 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200563 case 0x10ec0880:
564 case 0x10ec0882:
565 case 0x10ec0883:
566 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800567 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200568 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200569 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200570 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200571 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200572 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200573 break;
574 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200575}
Kailang Yangea1fb292008-08-26 12:58:38 +0200576
Takashi Iwai35a39f92019-02-01 11:19:50 +0100577/* get a primary headphone pin if available */
578static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
579{
580 if (spec->gen.autocfg.hp_pins[0])
581 return spec->gen.autocfg.hp_pins[0];
582 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
583 return spec->gen.autocfg.line_out_pins[0];
584 return 0;
585}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200586
587/*
588 * Realtek SSID verification
589 */
590
David Henningsson90622912010-10-14 14:50:18 +0200591/* Could be any non-zero and even value. When used as fixup, tells
592 * the driver to ignore any present sku defines.
593 */
594#define ALC_FIXUP_SKU_IGNORE (2)
595
Takashi Iwai23d30f22012-05-07 17:17:32 +0200596static void alc_fixup_sku_ignore(struct hda_codec *codec,
597 const struct hda_fixup *fix, int action)
598{
599 struct alc_spec *spec = codec->spec;
600 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
601 spec->cdefine.fixup = 1;
602 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
603 }
604}
605
Mengdong Linb5c66112013-11-29 00:35:35 -0500606static void alc_fixup_no_depop_delay(struct hda_codec *codec,
607 const struct hda_fixup *fix, int action)
608{
609 struct alc_spec *spec = codec->spec;
610
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500611 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500612 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500613 codec->depop_delay = 0;
614 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500615}
616
Kailang Yangda00c242010-03-19 11:23:45 +0100617static int alc_auto_parse_customize_define(struct hda_codec *codec)
618{
619 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100620 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100621 struct alc_spec *spec = codec->spec;
622
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200623 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
624
David Henningsson90622912010-10-14 14:50:18 +0200625 if (spec->cdefine.fixup) {
626 ass = spec->cdefine.sku_cfg;
627 if (ass == ALC_FIXUP_SKU_IGNORE)
628 return -1;
629 goto do_sku;
630 }
631
Takashi Iwai5100cd02014-02-15 10:03:19 +0100632 if (!codec->bus->pci)
633 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100634 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200635 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100636 goto do_sku;
637
638 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100639 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100640 nid = 0x17;
641 ass = snd_hda_codec_get_pincfg(codec, nid);
642
643 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100644 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100645 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100646 return -1;
647 }
648
649 /* check sum */
650 tmp = 0;
651 for (i = 1; i < 16; i++) {
652 if ((ass >> i) & 1)
653 tmp++;
654 }
655 if (((ass >> 16) & 0xf) != tmp)
656 return -1;
657
658 spec->cdefine.port_connectivity = ass >> 30;
659 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
660 spec->cdefine.check_sum = (ass >> 16) & 0xf;
661 spec->cdefine.customization = ass >> 8;
662do_sku:
663 spec->cdefine.sku_cfg = ass;
664 spec->cdefine.external_amp = (ass & 0x38) >> 3;
665 spec->cdefine.platform_type = (ass & 0x4) >> 2;
666 spec->cdefine.swap = (ass & 0x2) >> 1;
667 spec->cdefine.override = ass & 0x1;
668
Takashi Iwai4e76a882014-02-25 12:21:03 +0100669 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100670 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100671 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100672 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100673 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
674 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
675 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
676 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
677 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
678 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
679 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100680
681 return 0;
682}
683
Takashi Iwai08c189f2012-12-19 15:22:24 +0100684/* return the position of NID in the list, or -1 if not found */
685static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
686{
687 int i;
688 for (i = 0; i < nums; i++)
689 if (list[i] == nid)
690 return i;
691 return -1;
692}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200693/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200694static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
695{
Takashi Iwai21268962011-07-07 15:01:13 +0200696 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200697}
698
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200699/* check subsystem ID and set up device-specific initialization;
700 * return 1 if initialized, 0 if invalid SSID
701 */
702/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
703 * 31 ~ 16 : Manufacture ID
704 * 15 ~ 8 : SKU ID
705 * 7 ~ 0 : Assembly ID
706 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
707 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100708static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200709{
710 unsigned int ass, tmp, i;
711 unsigned nid;
712 struct alc_spec *spec = codec->spec;
713
David Henningsson90622912010-10-14 14:50:18 +0200714 if (spec->cdefine.fixup) {
715 ass = spec->cdefine.sku_cfg;
716 if (ass == ALC_FIXUP_SKU_IGNORE)
717 return 0;
718 goto do_sku;
719 }
720
Takashi Iwai7639a062015-03-03 10:07:24 +0100721 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100722 if (codec->bus->pci &&
723 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200724 goto do_sku;
725
726 /* invalid SSID, check the special NID pin defcfg instead */
727 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400728 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200729 * 29~21 : reserve
730 * 20 : PCBEEP input
731 * 19~16 : Check sum (15:1)
732 * 15~1 : Custom
733 * 0 : override
734 */
735 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100736 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200737 nid = 0x17;
738 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100739 codec_dbg(codec,
740 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200741 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100742 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200743 return 0;
744 if ((ass >> 30) != 1) /* no physical connection */
745 return 0;
746
747 /* check sum */
748 tmp = 0;
749 for (i = 1; i < 16; i++) {
750 if ((ass >> i) & 1)
751 tmp++;
752 }
753 if (((ass >> 16) & 0xf) != tmp)
754 return 0;
755do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100756 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100757 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200758 /*
759 * 0 : override
760 * 1 : Swap Jack
761 * 2 : 0 --> Desktop, 1 --> Laptop
762 * 3~5 : External Amplifier control
763 * 7~6 : Reserved
764 */
765 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200766 if (spec->init_amp == ALC_INIT_UNDEFINED) {
767 switch (tmp) {
768 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200769 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200770 break;
771 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200772 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200773 break;
774 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200775 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200776 break;
777 case 5:
778 default:
779 spec->init_amp = ALC_INIT_DEFAULT;
780 break;
781 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200782 }
783
784 /* is laptop or Desktop and enable the function "Mute internal speaker
785 * when the external headphone out jack is plugged"
786 */
787 if (!(ass & 0x8000))
788 return 1;
789 /*
790 * 10~8 : Jack location
791 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
792 * 14~13: Resvered
793 * 15 : 1 --> enable the function "Mute internal speaker
794 * when the external headphone out jack is plugged"
795 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100796 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200797 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200798 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100799 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100800 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
801 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200802 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100803 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200804 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200805 return 1;
806}
Kailang Yangea1fb292008-08-26 12:58:38 +0200807
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200808/* Check the validity of ALC subsystem-id
809 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
810static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200811{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100812 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200813 struct alc_spec *spec = codec->spec;
Takashi Iwai67791202020-04-18 21:06:39 +0200814 if (spec->init_amp == ALC_INIT_UNDEFINED) {
815 codec_dbg(codec,
816 "realtek: Enable default setup for auto mode as fallback\n");
817 spec->init_amp = ALC_INIT_DEFAULT;
818 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200819 }
Takashi Iwai21268962011-07-07 15:01:13 +0200820}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200821
Takashi Iwai41e41f12005-06-08 14:48:49 +0200822/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200823 */
824
David Henningsson9d36a7d2014-10-07 10:18:42 +0200825static void alc_fixup_inv_dmic(struct hda_codec *codec,
826 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200827{
828 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100829
David Henningsson9d36a7d2014-10-07 10:18:42 +0200830 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200831}
832
Takashi Iwai603c4012008-07-30 15:01:44 +0200833
Takashi Iwai2eab6942012-12-18 15:30:41 +0100834static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200836 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837
Takashi Iwai08c189f2012-12-19 15:22:24 +0100838 err = snd_hda_gen_build_controls(codec);
839 if (err < 0)
840 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841
Takashi Iwai1727a772013-01-10 09:52:52 +0100842 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100843 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844}
845
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200846
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100848 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200849 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200850
Takashi Iwaic9af7532019-05-10 11:01:43 +0200851static void alc_pre_init(struct hda_codec *codec)
852{
853 alc_fill_eapd_coef(codec);
854}
855
Kailang Yangaeac1a02019-05-16 16:10:44 +0800856#define is_s3_resume(codec) \
857 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
Takashi Iwaic9af7532019-05-10 11:01:43 +0200858#define is_s4_resume(codec) \
859 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
860
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861static int alc_init(struct hda_codec *codec)
862{
863 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200864
Takashi Iwaic9af7532019-05-10 11:01:43 +0200865 /* hibernation resume needs the full chip initialization */
866 if (is_s4_resume(codec))
867 alc_pre_init(codec);
868
Takashi Iwai546bb672012-03-07 08:37:19 +0100869 if (spec->init_hook)
870 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100871
Takashi Iwai89781d02019-08-30 12:03:38 +0200872 spec->gen.skip_verbs = 1; /* applied in below */
Kailang Yang607ca3b2019-04-26 16:35:41 +0800873 snd_hda_gen_init(codec);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200874 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200875 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai89781d02019-08-30 12:03:38 +0200876 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200877
Takashi Iwai1727a772013-01-10 09:52:52 +0100878 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200879
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880 return 0;
881}
882
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100883static inline void alc_shutup(struct hda_codec *codec)
884{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200885 struct alc_spec *spec = codec->spec;
886
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200887 if (!snd_hda_get_bool_hint(codec, "shutup"))
888 return; /* disabled explicitly by hints */
889
Takashi Iwai1c7161532011-04-07 10:37:16 +0200890 if (spec && spec->shutup)
891 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200892 else
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100893 alc_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100894}
895
Takashi Iwai70a09762015-12-15 14:59:58 +0100896static void alc_reboot_notify(struct hda_codec *codec)
897{
898 struct alc_spec *spec = codec->spec;
899
900 if (spec && spec->reboot_notify)
901 spec->reboot_notify(codec);
902 else
903 alc_shutup(codec);
904}
905
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100906#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700907
Takashi Iwai83012a72012-08-24 18:38:08 +0200908#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500909static void alc_power_eapd(struct hda_codec *codec)
910{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200911 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500912}
913
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200914static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100915{
916 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100917 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100918 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500919 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100920 return 0;
921}
922#endif
923
Takashi Iwai2a439522011-07-26 09:52:50 +0200924#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100925static int alc_resume(struct hda_codec *codec)
926{
Kailang Yang97a26572013-11-29 00:35:26 -0500927 struct alc_spec *spec = codec->spec;
928
929 if (!spec->no_depop_delay)
930 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100931 codec->patch_ops.init(codec);
Takashi Iwai1a462be2020-01-09 10:01:04 +0100932 snd_hda_regmap_sync(codec);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200933 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100934 return 0;
935}
Takashi Iwaie044c392008-10-27 16:56:24 +0100936#endif
937
Linus Torvalds1da177e2005-04-16 15:20:36 -0700938/*
939 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200940static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700941 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100942 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700943 .init = alc_init,
944 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200945 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200946#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100947 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100948 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100949 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200950#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100951 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700952};
953
David Henningsson29adc4b2012-09-25 11:31:00 +0200954
Takashi Iwaided255b2015-10-01 17:59:43 +0200955#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100956
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200957/*
Kailang Yang4b016932013-11-28 11:55:09 +0100958 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200959 */
960struct alc_codec_rename_table {
961 unsigned int vendor_id;
962 unsigned short coef_mask;
963 unsigned short coef_bits;
964 const char *name;
965};
966
Kailang Yang4b016932013-11-28 11:55:09 +0100967struct alc_codec_rename_pci_table {
968 unsigned int codec_vendor_id;
969 unsigned short pci_subvendor;
970 unsigned short pci_subdevice;
971 const char *name;
972};
973
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100974static const struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800975 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200976 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
977 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
978 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
979 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
980 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
981 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
982 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200983 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800984 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200985 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
986 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
987 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
988 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
989 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
990 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
991 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
992 { } /* terminator */
993};
994
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100995static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
Kailang Yang4b016932013-11-28 11:55:09 +0100996 { 0x10ec0280, 0x1028, 0, "ALC3220" },
997 { 0x10ec0282, 0x1028, 0, "ALC3221" },
998 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800999 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +01001000 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +08001001 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +01001002 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1003 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001004 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1005 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +08001006 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +08001007 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +08001008 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +08001009 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +08001010 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +08001011 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001012 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1013 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1014 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1015 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1016 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1017 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1018 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1019 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1020 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1021 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1022 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +01001023 { } /* terminator */
1024};
1025
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001026static int alc_codec_rename_from_preset(struct hda_codec *codec)
1027{
1028 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +01001029 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001030
1031 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001032 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001033 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02001034 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001035 return alc_codec_rename(codec, p->name);
1036 }
Kailang Yang4b016932013-11-28 11:55:09 +01001037
Takashi Iwai5100cd02014-02-15 10:03:19 +01001038 if (!codec->bus->pci)
1039 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +01001040 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001041 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +01001042 continue;
1043 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1044 continue;
1045 if (!q->pci_subdevice ||
1046 q->pci_subdevice == codec->bus->pci->subsystem_device)
1047 return alc_codec_rename(codec, q->name);
1048 }
1049
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001050 return 0;
1051}
1052
Takashi Iwaie4770622011-07-08 11:11:35 +02001053
1054/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001055 * Digital-beep handlers
1056 */
1057#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001058
1059/* additional beep mixers; private_value will be overwritten */
1060static const struct snd_kcontrol_new alc_beep_mixer[] = {
1061 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1062 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1063};
1064
1065/* set up and create beep controls */
1066static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1067 int idx, int dir)
1068{
1069 struct snd_kcontrol_new *knew;
1070 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1071 int i;
1072
1073 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1074 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1075 &alc_beep_mixer[i]);
1076 if (!knew)
1077 return -ENOMEM;
1078 knew->private_value = beep_amp;
1079 }
1080 return 0;
1081}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001082
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001083static const struct snd_pci_quirk beep_allow_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001084 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001085 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001086 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001087 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001088 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1089 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1090 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001091 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001092 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001093 /* denylist -- no beep available */
Takashi Iwai051c78a2019-08-22 09:58:07 +02001094 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1095 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001096 {}
1097};
1098
1099static inline int has_cdefine_beep(struct hda_codec *codec)
1100{
1101 struct alc_spec *spec = codec->spec;
1102 const struct snd_pci_quirk *q;
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001103 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001104 if (q)
1105 return q->value;
1106 return spec->cdefine.enable_pcbeep;
1107}
1108#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001109#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001110#define has_cdefine_beep(codec) 0
1111#endif
1112
1113/* parse the BIOS configuration and set up the alc_spec */
1114/* return 1 if successful, 0 if the proper config is not found,
1115 * or a negative error code
1116 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001117static int alc_parse_auto_config(struct hda_codec *codec,
1118 const hda_nid_t *ignore_nids,
1119 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001120{
1121 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001122 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001123 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001124
Takashi Iwai53c334a2011-08-23 18:27:14 +02001125 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1126 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001127 if (err < 0)
1128 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001129
1130 if (ssid_nids)
1131 alc_ssid_check(codec, ssid_nids);
1132
Takashi Iwai08c189f2012-12-19 15:22:24 +01001133 err = snd_hda_gen_parse_auto_config(codec, cfg);
1134 if (err < 0)
1135 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001136
Takashi Iwai1d045db2011-07-07 18:23:21 +02001137 return 1;
1138}
1139
Takashi Iwai3de95172012-05-07 18:03:15 +02001140/* common preparation job for alc_spec */
1141static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1142{
1143 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1144 int err;
1145
1146 if (!spec)
1147 return -ENOMEM;
1148 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001149 snd_hda_gen_spec_init(&spec->gen);
1150 spec->gen.mixer_nid = mixer_nid;
1151 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001152 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001153 /* FIXME: do we need this for all Realtek codec models? */
1154 codec->spdif_status_reset = 1;
Kai Vehmanena6e7d0a2020-10-12 13:27:04 +03001155 codec->forced_resume = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001156 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001157
1158 err = alc_codec_rename_from_preset(codec);
1159 if (err < 0) {
1160 kfree(spec);
1161 return err;
1162 }
1163 return 0;
1164}
1165
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001166static int alc880_parse_auto_config(struct hda_codec *codec)
1167{
1168 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001169 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001170 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1171}
1172
Takashi Iwai1d045db2011-07-07 18:23:21 +02001173/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001174 * ALC880 fix-ups
1175 */
1176enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001177 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001178 ALC880_FIXUP_GPIO2,
1179 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001180 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001181 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001182 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001183 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001184 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001185 ALC880_FIXUP_VOL_KNOB,
1186 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001187 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001188 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001189 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001190 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001191 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001192 ALC880_FIXUP_3ST_BASE,
1193 ALC880_FIXUP_3ST,
1194 ALC880_FIXUP_3ST_DIG,
1195 ALC880_FIXUP_5ST_BASE,
1196 ALC880_FIXUP_5ST,
1197 ALC880_FIXUP_5ST_DIG,
1198 ALC880_FIXUP_6ST_BASE,
1199 ALC880_FIXUP_6ST,
1200 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001201 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001202};
1203
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001204/* enable the volume-knob widget support on NID 0x21 */
1205static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001206 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001207{
Takashi Iwai1727a772013-01-10 09:52:52 +01001208 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001209 snd_hda_jack_detect_enable_callback(codec, 0x21,
1210 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001211}
1212
Takashi Iwai1727a772013-01-10 09:52:52 +01001213static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001214 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001215 .type = HDA_FIXUP_FUNC,
1216 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001217 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001218 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001219 .type = HDA_FIXUP_FUNC,
1220 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001221 },
1222 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001223 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001224 .v.verbs = (const struct hda_verb[]) {
1225 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1226 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1227 { }
1228 },
1229 .chained = true,
1230 .chain_id = ALC880_FIXUP_GPIO2,
1231 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001232 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001233 .type = HDA_FIXUP_PINS,
1234 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001235 /* disable bogus unused pins */
1236 { 0x16, 0x411111f0 },
1237 { 0x18, 0x411111f0 },
1238 { 0x1a, 0x411111f0 },
1239 { }
1240 }
1241 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001242 [ALC880_FIXUP_LG_LW25] = {
1243 .type = HDA_FIXUP_PINS,
1244 .v.pins = (const struct hda_pintbl[]) {
1245 { 0x1a, 0x0181344f }, /* line-in */
1246 { 0x1b, 0x0321403f }, /* headphone */
1247 { }
1248 }
1249 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001250 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001251 .type = HDA_FIXUP_PINS,
1252 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001253 /* disable bogus unused pins */
1254 { 0x17, 0x411111f0 },
1255 { }
1256 },
1257 .chained = true,
1258 .chain_id = ALC880_FIXUP_GPIO2,
1259 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001260 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001261 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001262 .v.verbs = (const struct hda_verb[]) {
1263 /* change to EAPD mode */
1264 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1265 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1266 {}
1267 },
1268 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001269 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001270 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001271 .v.verbs = (const struct hda_verb[]) {
1272 /* change to EAPD mode */
1273 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1274 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1275 {}
1276 },
1277 .chained = true,
1278 .chain_id = ALC880_FIXUP_GPIO2,
1279 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001280 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001281 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001282 .v.func = alc880_fixup_vol_knob,
1283 },
1284 [ALC880_FIXUP_FUJITSU] = {
1285 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001286 .type = HDA_FIXUP_PINS,
1287 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001288 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001289 { 0x15, 0x99030120 }, /* speaker */
1290 { 0x16, 0x99030130 }, /* bass speaker */
1291 { 0x17, 0x411111f0 }, /* N/A */
1292 { 0x18, 0x411111f0 }, /* N/A */
1293 { 0x19, 0x01a19950 }, /* mic-in */
1294 { 0x1a, 0x411111f0 }, /* N/A */
1295 { 0x1b, 0x411111f0 }, /* N/A */
1296 { 0x1c, 0x411111f0 }, /* N/A */
1297 { 0x1d, 0x411111f0 }, /* N/A */
1298 { 0x1e, 0x01454140 }, /* SPDIF out */
1299 { }
1300 },
1301 .chained = true,
1302 .chain_id = ALC880_FIXUP_VOL_KNOB,
1303 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001304 [ALC880_FIXUP_F1734] = {
1305 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001306 .type = HDA_FIXUP_PINS,
1307 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001308 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001309 { 0x15, 0x99030120 }, /* speaker */
1310 { 0x16, 0x411111f0 }, /* N/A */
1311 { 0x17, 0x411111f0 }, /* N/A */
1312 { 0x18, 0x411111f0 }, /* N/A */
1313 { 0x19, 0x01a19950 }, /* mic-in */
1314 { 0x1a, 0x411111f0 }, /* N/A */
1315 { 0x1b, 0x411111f0 }, /* N/A */
1316 { 0x1c, 0x411111f0 }, /* N/A */
1317 { 0x1d, 0x411111f0 }, /* N/A */
1318 { 0x1e, 0x411111f0 }, /* N/A */
1319 { }
1320 },
1321 .chained = true,
1322 .chain_id = ALC880_FIXUP_VOL_KNOB,
1323 },
Takashi Iwai817de922012-02-20 17:20:48 +01001324 [ALC880_FIXUP_UNIWILL] = {
1325 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001326 .type = HDA_FIXUP_PINS,
1327 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001328 { 0x14, 0x0121411f }, /* HP */
1329 { 0x15, 0x99030120 }, /* speaker */
1330 { 0x16, 0x99030130 }, /* bass speaker */
1331 { }
1332 },
1333 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001334 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001335 .type = HDA_FIXUP_PINS,
1336 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001337 /* disable bogus unused pins */
1338 { 0x17, 0x411111f0 },
1339 { 0x19, 0x411111f0 },
1340 { 0x1b, 0x411111f0 },
1341 { 0x1f, 0x411111f0 },
1342 { }
1343 }
1344 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001345 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001346 .type = HDA_FIXUP_PINS,
1347 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001348 /* set up the whole pins as BIOS is utterly broken */
1349 { 0x14, 0x99030120 }, /* speaker */
1350 { 0x15, 0x0121411f }, /* HP */
1351 { 0x16, 0x411111f0 }, /* N/A */
1352 { 0x17, 0x411111f0 }, /* N/A */
1353 { 0x18, 0x01a19950 }, /* mic-in */
1354 { 0x19, 0x411111f0 }, /* N/A */
1355 { 0x1a, 0x01813031 }, /* line-in */
1356 { 0x1b, 0x411111f0 }, /* N/A */
1357 { 0x1c, 0x411111f0 }, /* N/A */
1358 { 0x1d, 0x411111f0 }, /* N/A */
1359 { 0x1e, 0x0144111e }, /* SPDIF */
1360 { }
1361 }
1362 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001363 [ALC880_FIXUP_ASUS_W5A] = {
1364 .type = HDA_FIXUP_PINS,
1365 .v.pins = (const struct hda_pintbl[]) {
1366 /* set up the whole pins as BIOS is utterly broken */
1367 { 0x14, 0x0121411f }, /* HP */
1368 { 0x15, 0x411111f0 }, /* N/A */
1369 { 0x16, 0x411111f0 }, /* N/A */
1370 { 0x17, 0x411111f0 }, /* N/A */
1371 { 0x18, 0x90a60160 }, /* mic */
1372 { 0x19, 0x411111f0 }, /* N/A */
1373 { 0x1a, 0x411111f0 }, /* N/A */
1374 { 0x1b, 0x411111f0 }, /* N/A */
1375 { 0x1c, 0x411111f0 }, /* N/A */
1376 { 0x1d, 0x411111f0 }, /* N/A */
1377 { 0x1e, 0xb743111e }, /* SPDIF out */
1378 { }
1379 },
1380 .chained = true,
1381 .chain_id = ALC880_FIXUP_GPIO1,
1382 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001383 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001384 .type = HDA_FIXUP_PINS,
1385 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001386 { 0x14, 0x01014010 }, /* line-out */
1387 { 0x15, 0x411111f0 }, /* N/A */
1388 { 0x16, 0x411111f0 }, /* N/A */
1389 { 0x17, 0x411111f0 }, /* N/A */
1390 { 0x18, 0x01a19c30 }, /* mic-in */
1391 { 0x19, 0x0121411f }, /* HP */
1392 { 0x1a, 0x01813031 }, /* line-in */
1393 { 0x1b, 0x02a19c40 }, /* front-mic */
1394 { 0x1c, 0x411111f0 }, /* N/A */
1395 { 0x1d, 0x411111f0 }, /* N/A */
1396 /* 0x1e is filled in below */
1397 { 0x1f, 0x411111f0 }, /* N/A */
1398 { }
1399 }
1400 },
1401 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001402 .type = HDA_FIXUP_PINS,
1403 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001404 { 0x1e, 0x411111f0 }, /* N/A */
1405 { }
1406 },
1407 .chained = true,
1408 .chain_id = ALC880_FIXUP_3ST_BASE,
1409 },
1410 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001411 .type = HDA_FIXUP_PINS,
1412 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001413 { 0x1e, 0x0144111e }, /* SPDIF */
1414 { }
1415 },
1416 .chained = true,
1417 .chain_id = ALC880_FIXUP_3ST_BASE,
1418 },
1419 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001420 .type = HDA_FIXUP_PINS,
1421 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001422 { 0x14, 0x01014010 }, /* front */
1423 { 0x15, 0x411111f0 }, /* N/A */
1424 { 0x16, 0x01011411 }, /* CLFE */
1425 { 0x17, 0x01016412 }, /* surr */
1426 { 0x18, 0x01a19c30 }, /* mic-in */
1427 { 0x19, 0x0121411f }, /* HP */
1428 { 0x1a, 0x01813031 }, /* line-in */
1429 { 0x1b, 0x02a19c40 }, /* front-mic */
1430 { 0x1c, 0x411111f0 }, /* N/A */
1431 { 0x1d, 0x411111f0 }, /* N/A */
1432 /* 0x1e is filled in below */
1433 { 0x1f, 0x411111f0 }, /* N/A */
1434 { }
1435 }
1436 },
1437 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001438 .type = HDA_FIXUP_PINS,
1439 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001440 { 0x1e, 0x411111f0 }, /* N/A */
1441 { }
1442 },
1443 .chained = true,
1444 .chain_id = ALC880_FIXUP_5ST_BASE,
1445 },
1446 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001447 .type = HDA_FIXUP_PINS,
1448 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001449 { 0x1e, 0x0144111e }, /* SPDIF */
1450 { }
1451 },
1452 .chained = true,
1453 .chain_id = ALC880_FIXUP_5ST_BASE,
1454 },
1455 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001456 .type = HDA_FIXUP_PINS,
1457 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001458 { 0x14, 0x01014010 }, /* front */
1459 { 0x15, 0x01016412 }, /* surr */
1460 { 0x16, 0x01011411 }, /* CLFE */
1461 { 0x17, 0x01012414 }, /* side */
1462 { 0x18, 0x01a19c30 }, /* mic-in */
1463 { 0x19, 0x02a19c40 }, /* front-mic */
1464 { 0x1a, 0x01813031 }, /* line-in */
1465 { 0x1b, 0x0121411f }, /* HP */
1466 { 0x1c, 0x411111f0 }, /* N/A */
1467 { 0x1d, 0x411111f0 }, /* N/A */
1468 /* 0x1e is filled in below */
1469 { 0x1f, 0x411111f0 }, /* N/A */
1470 { }
1471 }
1472 },
1473 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001474 .type = HDA_FIXUP_PINS,
1475 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001476 { 0x1e, 0x411111f0 }, /* N/A */
1477 { }
1478 },
1479 .chained = true,
1480 .chain_id = ALC880_FIXUP_6ST_BASE,
1481 },
1482 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001483 .type = HDA_FIXUP_PINS,
1484 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001485 { 0x1e, 0x0144111e }, /* SPDIF */
1486 { }
1487 },
1488 .chained = true,
1489 .chain_id = ALC880_FIXUP_6ST_BASE,
1490 },
Takashi Iwai53971452013-01-23 18:21:37 +01001491 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1492 .type = HDA_FIXUP_PINS,
1493 .v.pins = (const struct hda_pintbl[]) {
1494 { 0x1b, 0x0121401f }, /* HP with jack detect */
1495 { }
1496 },
1497 .chained_before = true,
1498 .chain_id = ALC880_FIXUP_6ST_BASE,
1499 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001500};
1501
1502static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001503 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001504 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001505 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001506 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001507 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001508 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001509 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001510 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001511 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001512 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001513 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001514 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001515 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001516 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001517 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001518 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001519 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001520 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001521 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1522 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1523 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001524 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001525 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001526
1527 /* Below is the copied entries from alc880_quirks.c.
1528 * It's not quite sure whether BIOS sets the correct pin-config table
1529 * on these machines, thus they are kept to be compatible with
1530 * the old static quirks. Once when it's confirmed to work without
1531 * these overrides, it'd be better to remove.
1532 */
1533 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1534 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1535 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1536 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1537 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1538 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1539 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1540 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1541 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1542 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1543 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1544 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1545 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1546 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1547 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1548 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1549 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1550 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1551 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1552 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1553 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1554 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1555 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1556 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1557 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1558 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1560 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1561 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1563 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1564 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1565 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1566 /* default Intel */
1567 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1568 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1569 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1570 {}
1571};
1572
Takashi Iwai1727a772013-01-10 09:52:52 +01001573static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001574 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1575 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1576 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1577 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1578 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1579 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001580 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001581 {}
1582};
1583
1584
1585/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001586 * OK, here we have finally the patch for ALC880
1587 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001588static int patch_alc880(struct hda_codec *codec)
1589{
1590 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001591 int err;
1592
Takashi Iwai3de95172012-05-07 18:03:15 +02001593 err = alc_alloc_spec(codec, 0x0b);
1594 if (err < 0)
1595 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001596
Takashi Iwai3de95172012-05-07 18:03:15 +02001597 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001598 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001599 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001600
Takashi Iwai225068a2015-05-29 10:42:14 +02001601 codec->patch_ops.unsol_event = alc880_unsol_event;
1602
Takashi Iwaic9af7532019-05-10 11:01:43 +02001603 alc_pre_init(codec);
1604
Takashi Iwai1727a772013-01-10 09:52:52 +01001605 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001606 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001607 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001608
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001609 /* automatic parse from the BIOS config */
1610 err = alc880_parse_auto_config(codec);
1611 if (err < 0)
1612 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001613
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001614 if (!spec->gen.no_analog) {
1615 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1616 if (err < 0)
1617 goto error;
1618 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001619
Takashi Iwai1727a772013-01-10 09:52:52 +01001620 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001621
Takashi Iwai1d045db2011-07-07 18:23:21 +02001622 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001623
1624 error:
1625 alc_free(codec);
1626 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001627}
1628
1629
1630/*
1631 * ALC260 support
1632 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001633static int alc260_parse_auto_config(struct hda_codec *codec)
1634{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001635 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001636 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1637 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001638}
1639
Takashi Iwai1d045db2011-07-07 18:23:21 +02001640/*
1641 * Pin config fixes
1642 */
1643enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001644 ALC260_FIXUP_HP_DC5750,
1645 ALC260_FIXUP_HP_PIN_0F,
1646 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001647 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001648 ALC260_FIXUP_GPIO1_TOGGLE,
1649 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001650 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001651 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001652 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001653 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001654 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001655};
1656
Takashi Iwai20f7d922012-02-16 12:35:16 +01001657static void alc260_gpio1_automute(struct hda_codec *codec)
1658{
1659 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001660
1661 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001662}
1663
1664static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001665 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001666{
1667 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001668 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001669 /* although the machine has only one output pin, we need to
1670 * toggle GPIO1 according to the jack state
1671 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001672 spec->gen.automute_hook = alc260_gpio1_automute;
1673 spec->gen.detect_hp = 1;
1674 spec->gen.automute_speaker = 1;
1675 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001676 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001677 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001678 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001679 }
1680}
1681
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001682static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001683 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001684{
1685 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001686 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001687 { 0x0f, 0x02214000 }, /* HP/speaker */
1688 { 0x12, 0x90a60160 }, /* int mic */
1689 { 0x13, 0x02a19000 }, /* ext mic */
1690 { 0x18, 0x01446000 }, /* SPDIF out */
1691 /* disable bogus I/O pins */
1692 { 0x10, 0x411111f0 },
1693 { 0x11, 0x411111f0 },
1694 { 0x14, 0x411111f0 },
1695 { 0x15, 0x411111f0 },
1696 { 0x16, 0x411111f0 },
1697 { 0x17, 0x411111f0 },
1698 { 0x19, 0x411111f0 },
1699 { }
1700 };
1701
1702 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001703 case HDA_FIXUP_ACT_PRE_PROBE:
1704 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001705 spec->init_amp = ALC_INIT_NONE;
1706 break;
1707 }
1708}
1709
Takashi Iwai39aedee2013-01-10 17:10:40 +01001710static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1711 const struct hda_fixup *fix, int action)
1712{
1713 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001714 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001715 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001716}
1717
1718static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1719 const struct hda_fixup *fix, int action)
1720{
1721 struct alc_spec *spec = codec->spec;
1722 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001723 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001724 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001725 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001726}
1727
Takashi Iwai1727a772013-01-10 09:52:52 +01001728static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001729 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001730 .type = HDA_FIXUP_PINS,
1731 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001732 { 0x11, 0x90130110 }, /* speaker */
1733 { }
1734 }
1735 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001736 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001737 .type = HDA_FIXUP_PINS,
1738 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001739 { 0x0f, 0x01214000 }, /* HP */
1740 { }
1741 }
1742 },
1743 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001744 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001745 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001746 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1747 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001748 { }
1749 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001750 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001751 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001752 .type = HDA_FIXUP_FUNC,
1753 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001754 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001755 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001756 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001757 .v.func = alc260_fixup_gpio1_toggle,
1758 .chained = true,
1759 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1760 },
1761 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001762 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001763 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001764 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1765 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001766 { }
1767 },
1768 .chained = true,
1769 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1770 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001771 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001772 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001773 .v.func = alc260_fixup_gpio1_toggle,
1774 .chained = true,
1775 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001776 },
1777 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001778 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001779 .v.func = alc260_fixup_kn1,
1780 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001781 [ALC260_FIXUP_FSC_S7020] = {
1782 .type = HDA_FIXUP_FUNC,
1783 .v.func = alc260_fixup_fsc_s7020,
1784 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001785 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1786 .type = HDA_FIXUP_FUNC,
1787 .v.func = alc260_fixup_fsc_s7020_jwse,
1788 .chained = true,
1789 .chain_id = ALC260_FIXUP_FSC_S7020,
1790 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001791 [ALC260_FIXUP_VAIO_PINS] = {
1792 .type = HDA_FIXUP_PINS,
1793 .v.pins = (const struct hda_pintbl[]) {
1794 /* Pin configs are missing completely on some VAIOs */
1795 { 0x0f, 0x01211020 },
1796 { 0x10, 0x0001003f },
1797 { 0x11, 0x411111f0 },
1798 { 0x12, 0x01a15930 },
1799 { 0x13, 0x411111f0 },
1800 { 0x14, 0x411111f0 },
1801 { 0x15, 0x411111f0 },
1802 { 0x16, 0x411111f0 },
1803 { 0x17, 0x411111f0 },
1804 { 0x18, 0x411111f0 },
1805 { 0x19, 0x411111f0 },
1806 { }
1807 }
1808 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001809};
1810
1811static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001812 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001813 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001814 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001815 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001816 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001817 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001818 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001819 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001820 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001821 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001822 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001823 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001824 {}
1825};
1826
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001827static const struct hda_model_fixup alc260_fixup_models[] = {
1828 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1829 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1830 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1831 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1832 {}
1833};
1834
Takashi Iwai1d045db2011-07-07 18:23:21 +02001835/*
1836 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001837static int patch_alc260(struct hda_codec *codec)
1838{
1839 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001840 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001841
Takashi Iwai3de95172012-05-07 18:03:15 +02001842 err = alc_alloc_spec(codec, 0x07);
1843 if (err < 0)
1844 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001845
Takashi Iwai3de95172012-05-07 18:03:15 +02001846 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001847 /* as quite a few machines require HP amp for speaker outputs,
1848 * it's easier to enable it unconditionally; even if it's unneeded,
1849 * it's almost harmless.
1850 */
1851 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001852 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001853
Takashi Iwai225068a2015-05-29 10:42:14 +02001854 spec->shutup = alc_eapd_shutup;
1855
Takashi Iwaic9af7532019-05-10 11:01:43 +02001856 alc_pre_init(codec);
1857
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001858 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1859 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001860 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001861
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001862 /* automatic parse from the BIOS config */
1863 err = alc260_parse_auto_config(codec);
1864 if (err < 0)
1865 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001866
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001867 if (!spec->gen.no_analog) {
1868 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1869 if (err < 0)
1870 goto error;
1871 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001872
Takashi Iwai1727a772013-01-10 09:52:52 +01001873 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001874
Takashi Iwai1d045db2011-07-07 18:23:21 +02001875 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001876
1877 error:
1878 alc_free(codec);
1879 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001880}
1881
1882
1883/*
1884 * ALC882/883/885/888/889 support
1885 *
1886 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1887 * configuration. Each pin widget can choose any input DACs and a mixer.
1888 * Each ADC is connected from a mixer of all inputs. This makes possible
1889 * 6-channel independent captures.
1890 *
1891 * In addition, an independent DAC for the multi-playback (not used in this
1892 * driver yet).
1893 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001894
1895/*
1896 * Pin config fixes
1897 */
1898enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001899 ALC882_FIXUP_ABIT_AW9D_MAX,
1900 ALC882_FIXUP_LENOVO_Y530,
1901 ALC882_FIXUP_PB_M5210,
1902 ALC882_FIXUP_ACER_ASPIRE_7736,
1903 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001904 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001905 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001906 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001907 ALC888_FIXUP_EEE1601,
Takashi Iwai177943a32011-11-09 12:55:18 +01001908 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001909 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001910 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001911 ALC882_FIXUP_GPIO1,
1912 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001913 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001914 ALC889_FIXUP_COEF,
1915 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001916 ALC882_FIXUP_ACER_ASPIRE_4930G,
1917 ALC882_FIXUP_ACER_ASPIRE_8930G,
1918 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001919 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001920 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001921 ALC889_FIXUP_MBP_VREF,
1922 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001923 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001924 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001925 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001926 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001927 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001928 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001929 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001930 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001931 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001932 ALC1220_FIXUP_CLEVO_P950,
Richard Sailer80690a22019-04-02 15:52:04 +02001933 ALC1220_FIXUP_CLEVO_PB51ED,
1934 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Jian-Hong Panca184352020-10-07 13:22:25 +08001935 ALC887_FIXUP_ASUS_AUDIO,
1936 ALC887_FIXUP_ASUS_HMIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001937};
1938
Takashi Iwai68ef0562011-11-09 18:24:44 +01001939static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001940 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001941{
Takashi Iwai1727a772013-01-10 09:52:52 +01001942 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001943 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001944 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001945}
1946
Takashi Iwai56710872011-11-14 17:42:11 +01001947/* set up GPIO at initialization */
1948static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001949 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001950{
Takashi Iwai215c8502018-06-19 22:34:26 +02001951 struct alc_spec *spec = codec->spec;
1952
1953 spec->gpio_write_delay = true;
1954 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001955}
1956
Takashi Iwai02a237b2012-02-13 15:25:07 +01001957/* Fix the connection of some pins for ALC889:
1958 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1959 * work correctly (bko#42740)
1960 */
1961static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001962 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001963{
Takashi Iwai1727a772013-01-10 09:52:52 +01001964 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001965 /* fake the connections during parsing the tree */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001966 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1967 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1968 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1969 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1970 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1971 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001972 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001973 /* restore the connections */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001974 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1975 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1976 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1977 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1978 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001979 }
1980}
1981
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001982/* Set VREF on HP pin */
1983static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001984 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001985{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001986 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001987 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001988 int i;
1989
Takashi Iwai1727a772013-01-10 09:52:52 +01001990 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001991 return;
1992 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1993 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1994 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1995 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001996 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001997 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001998 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001999 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002000 break;
2001 }
2002}
2003
Takashi Iwai0756f092013-12-04 13:59:45 +01002004static void alc889_fixup_mac_pins(struct hda_codec *codec,
2005 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002006{
2007 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002008 int i;
2009
Takashi Iwai0756f092013-12-04 13:59:45 +01002010 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002011 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002012 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002013 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002014 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002015 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01002016 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002017}
2018
Takashi Iwai0756f092013-12-04 13:59:45 +01002019/* Set VREF on speaker pins on imac91 */
2020static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2021 const struct hda_fixup *fix, int action)
2022{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002023 static const hda_nid_t nids[] = { 0x18, 0x1a };
Takashi Iwai0756f092013-12-04 13:59:45 +01002024
2025 if (action == HDA_FIXUP_ACT_INIT)
2026 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2027}
2028
Adrien Vergée7729a42014-01-24 14:56:14 -05002029/* Set VREF on speaker pins on mba11 */
2030static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2031 const struct hda_fixup *fix, int action)
2032{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002033 static const hda_nid_t nids[] = { 0x18 };
Adrien Vergée7729a42014-01-24 14:56:14 -05002034
2035 if (action == HDA_FIXUP_ACT_INIT)
2036 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2037}
2038
Takashi Iwai0756f092013-12-04 13:59:45 +01002039/* Set VREF on speaker pins on mba21 */
2040static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2041 const struct hda_fixup *fix, int action)
2042{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002043 static const hda_nid_t nids[] = { 0x18, 0x19 };
Takashi Iwai0756f092013-12-04 13:59:45 +01002044
2045 if (action == HDA_FIXUP_ACT_INIT)
2046 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2047}
2048
Takashi Iwaie427c232012-07-29 10:04:08 +02002049/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09002050 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2051 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02002052 */
2053static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002054 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02002055{
2056 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002057 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002058 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002059 spec->gen.no_multi_io = 1;
2060 }
Takashi Iwaie427c232012-07-29 10:04:08 +02002061}
2062
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002063static void alc_fixup_bass_chmap(struct hda_codec *codec,
2064 const struct hda_fixup *fix, int action);
2065
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002066/* For dual-codec configuration, we need to disable some features to avoid
2067 * conflicts of kctls and PCM streams
2068 */
2069static void alc_fixup_dual_codecs(struct hda_codec *codec,
2070 const struct hda_fixup *fix, int action)
2071{
2072 struct alc_spec *spec = codec->spec;
2073
2074 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2075 return;
2076 /* disable vmaster */
2077 spec->gen.suppress_vmaster = 1;
2078 /* auto-mute and auto-mic switch don't work with multiple codecs */
2079 spec->gen.suppress_auto_mute = 1;
2080 spec->gen.suppress_auto_mic = 1;
2081 /* disable aamix as well */
2082 spec->gen.mixer_nid = 0;
2083 /* add location prefix to avoid conflicts */
2084 codec->force_pin_prefix = 1;
2085}
2086
2087static void rename_ctl(struct hda_codec *codec, const char *oldname,
2088 const char *newname)
2089{
2090 struct snd_kcontrol *kctl;
2091
2092 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2093 if (kctl)
2094 strcpy(kctl->id.name, newname);
2095}
2096
2097static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2098 const struct hda_fixup *fix,
2099 int action)
2100{
2101 alc_fixup_dual_codecs(codec, fix, action);
2102 switch (action) {
2103 case HDA_FIXUP_ACT_PRE_PROBE:
2104 /* override card longname to provide a unique UCM profile */
2105 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2106 break;
2107 case HDA_FIXUP_ACT_BUILD:
2108 /* rename Capture controls depending on the codec */
2109 rename_ctl(codec, "Capture Volume",
2110 codec->addr == 0 ?
2111 "Rear-Panel Capture Volume" :
2112 "Front-Panel Capture Volume");
2113 rename_ctl(codec, "Capture Switch",
2114 codec->addr == 0 ?
2115 "Rear-Panel Capture Switch" :
2116 "Front-Panel Capture Switch");
2117 break;
2118 }
2119}
2120
Peisen0202f5c2017-10-26 10:35:36 +08002121static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2122 const struct hda_fixup *fix,
2123 int action)
2124{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002125 static const hda_nid_t conn1[] = { 0x0c };
Peisen0202f5c2017-10-26 10:35:36 +08002126
2127 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2128 return;
2129
2130 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2131 /* We therefore want to make sure 0x14 (front headphone) and
2132 * 0x1b (speakers) use the stereo DAC 0x02
2133 */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002134 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2135 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Peisen0202f5c2017-10-26 10:35:36 +08002136}
2137
Jeremy Soller7f665b12019-02-13 10:56:19 -07002138static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2139 const struct hda_fixup *fix, int action);
2140
Richard Sailer80690a22019-04-02 15:52:04 +02002141static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002142 const struct hda_fixup *fix,
2143 int action)
2144{
2145 alc1220_fixup_clevo_p950(codec, fix, action);
2146 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2147}
2148
Jian-Hong Panca184352020-10-07 13:22:25 +08002149static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2150 struct hda_jack_callback *jack)
2151{
2152 struct alc_spec *spec = codec->spec;
2153 unsigned int vref;
2154
2155 snd_hda_gen_hp_automute(codec, jack);
2156
2157 if (spec->gen.hp_jack_present)
2158 vref = AC_PINCTL_VREF_80;
2159 else
2160 vref = AC_PINCTL_VREF_HIZ;
2161 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2162}
2163
2164static void alc887_fixup_asus_jack(struct hda_codec *codec,
2165 const struct hda_fixup *fix, int action)
2166{
2167 struct alc_spec *spec = codec->spec;
2168 if (action != HDA_FIXUP_ACT_PROBE)
2169 return;
2170 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2171 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2172}
2173
Takashi Iwai1727a772013-01-10 09:52:52 +01002174static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002175 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002176 .type = HDA_FIXUP_PINS,
2177 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002178 { 0x15, 0x01080104 }, /* side */
2179 { 0x16, 0x01011012 }, /* rear */
2180 { 0x17, 0x01016011 }, /* clfe */
2181 { }
2182 }
2183 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002184 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002185 .type = HDA_FIXUP_PINS,
2186 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002187 { 0x15, 0x99130112 }, /* rear int speakers */
2188 { 0x16, 0x99130111 }, /* subwoofer */
2189 { }
2190 }
2191 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002192 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002193 .type = HDA_FIXUP_PINCTLS,
2194 .v.pins = (const struct hda_pintbl[]) {
2195 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002196 {}
2197 }
2198 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002199 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002200 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002201 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002202 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002203 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002204 .type = HDA_FIXUP_PINS,
2205 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002206 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2207 { }
2208 }
2209 },
Marton Balint8f239212012-03-05 21:33:23 +01002210 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002211 .type = HDA_FIXUP_PINS,
2212 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002213 { 0x1c, 0x993301f0 }, /* CD */
2214 { }
2215 }
2216 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002217 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2218 .type = HDA_FIXUP_PINS,
2219 .v.pins = (const struct hda_pintbl[]) {
2220 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2221 { }
2222 },
2223 .chained = true,
2224 .chain_id = ALC889_FIXUP_CD,
2225 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002226 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002227 .type = HDA_FIXUP_PINS,
2228 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002229 { 0x17, 0x90170111 }, /* hidden surround speaker */
2230 { }
2231 }
2232 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002233 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002234 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002235 .v.verbs = (const struct hda_verb[]) {
2236 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2237 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2238 { }
2239 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002240 },
2241 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002242 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002243 .v.verbs = (const struct hda_verb[]) {
2244 /* change to EAPD mode */
2245 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2246 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2247 { }
2248 }
2249 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002250 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002251 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002252 .v.verbs = (const struct hda_verb[]) {
2253 /* change to EAPD mode */
2254 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2255 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2256 { }
2257 }
2258 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002259 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002260 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002261 .v.verbs = (const struct hda_verb[]) {
2262 /* eanable EAPD on Acer laptops */
2263 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2264 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2265 { }
2266 }
2267 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002268 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002269 .type = HDA_FIXUP_FUNC,
2270 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002271 },
2272 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002273 .type = HDA_FIXUP_FUNC,
2274 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002275 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002276 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002277 .type = HDA_FIXUP_FUNC,
2278 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002279 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002280 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002281 .type = HDA_FIXUP_FUNC,
2282 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002283 .chained = true,
2284 .chain_id = ALC882_FIXUP_EAPD,
2285 },
2286 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002287 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002288 .v.func = alc889_fixup_coef,
2289 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002290 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002291 .type = HDA_FIXUP_PINS,
2292 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002293 { 0x16, 0x99130111 }, /* CLFE speaker */
2294 { 0x17, 0x99130112 }, /* surround speaker */
2295 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002296 },
2297 .chained = true,
2298 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002299 },
2300 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002301 .type = HDA_FIXUP_PINS,
2302 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002303 { 0x16, 0x99130111 }, /* CLFE speaker */
2304 { 0x1b, 0x99130112 }, /* surround speaker */
2305 { }
2306 },
2307 .chained = true,
2308 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2309 },
2310 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2311 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002312 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002313 .v.verbs = (const struct hda_verb[]) {
2314 /* Enable all DACs */
2315 /* DAC DISABLE/MUTE 1? */
2316 /* setting bits 1-5 disables DAC nids 0x02-0x06
2317 * apparently. Init=0x38 */
2318 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2319 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2320 /* DAC DISABLE/MUTE 2? */
2321 /* some bit here disables the other DACs.
2322 * Init=0x4900 */
2323 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2324 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2325 /* DMIC fix
2326 * This laptop has a stereo digital microphone.
2327 * The mics are only 1cm apart which makes the stereo
2328 * useless. However, either the mic or the ALC889
2329 * makes the signal become a difference/sum signal
2330 * instead of standard stereo, which is annoying.
2331 * So instead we flip this bit which makes the
2332 * codec replicate the sum signal to both channels,
2333 * turning it into a normal mono mic.
2334 */
2335 /* DMIC_CONTROL? Init value = 0x0001 */
2336 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2337 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2338 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2339 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2340 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002341 },
2342 .chained = true,
2343 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002344 },
Takashi Iwai56710872011-11-14 17:42:11 +01002345 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002346 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002347 .v.func = alc885_fixup_macpro_gpio,
2348 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002349 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002350 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002351 .v.func = alc889_fixup_dac_route,
2352 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002353 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002354 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002355 .v.func = alc889_fixup_mbp_vref,
2356 .chained = true,
2357 .chain_id = ALC882_FIXUP_GPIO1,
2358 },
2359 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002360 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002361 .v.func = alc889_fixup_imac91_vref,
2362 .chained = true,
2363 .chain_id = ALC882_FIXUP_GPIO1,
2364 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002365 [ALC889_FIXUP_MBA11_VREF] = {
2366 .type = HDA_FIXUP_FUNC,
2367 .v.func = alc889_fixup_mba11_vref,
2368 .chained = true,
2369 .chain_id = ALC889_FIXUP_MBP_VREF,
2370 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002371 [ALC889_FIXUP_MBA21_VREF] = {
2372 .type = HDA_FIXUP_FUNC,
2373 .v.func = alc889_fixup_mba21_vref,
2374 .chained = true,
2375 .chain_id = ALC889_FIXUP_MBP_VREF,
2376 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002377 [ALC889_FIXUP_MP11_VREF] = {
2378 .type = HDA_FIXUP_FUNC,
2379 .v.func = alc889_fixup_mba11_vref,
2380 .chained = true,
2381 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2382 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002383 [ALC889_FIXUP_MP41_VREF] = {
2384 .type = HDA_FIXUP_FUNC,
2385 .v.func = alc889_fixup_mbp_vref,
2386 .chained = true,
2387 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2388 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002389 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002390 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002391 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002392 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002393 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002394 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002395 .v.func = alc882_fixup_no_primary_hp,
2396 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002397 [ALC887_FIXUP_ASUS_BASS] = {
2398 .type = HDA_FIXUP_PINS,
2399 .v.pins = (const struct hda_pintbl[]) {
2400 {0x16, 0x99130130}, /* bass speaker */
2401 {}
2402 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002403 .chained = true,
2404 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2405 },
2406 [ALC887_FIXUP_BASS_CHMAP] = {
2407 .type = HDA_FIXUP_FUNC,
2408 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002409 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002410 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2411 .type = HDA_FIXUP_FUNC,
2412 .v.func = alc1220_fixup_gb_dual_codecs,
2413 },
Peisen0202f5c2017-10-26 10:35:36 +08002414 [ALC1220_FIXUP_CLEVO_P950] = {
2415 .type = HDA_FIXUP_FUNC,
2416 .v.func = alc1220_fixup_clevo_p950,
2417 },
Richard Sailer80690a22019-04-02 15:52:04 +02002418 [ALC1220_FIXUP_CLEVO_PB51ED] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002419 .type = HDA_FIXUP_FUNC,
Richard Sailer80690a22019-04-02 15:52:04 +02002420 .v.func = alc1220_fixup_clevo_pb51ed,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002421 },
Richard Sailer80690a22019-04-02 15:52:04 +02002422 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002423 .type = HDA_FIXUP_PINS,
2424 .v.pins = (const struct hda_pintbl[]) {
2425 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2426 {}
2427 },
2428 .chained = true,
Richard Sailer80690a22019-04-02 15:52:04 +02002429 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002430 },
Jian-Hong Panca184352020-10-07 13:22:25 +08002431 [ALC887_FIXUP_ASUS_AUDIO] = {
2432 .type = HDA_FIXUP_PINS,
2433 .v.pins = (const struct hda_pintbl[]) {
2434 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2435 { 0x19, 0x22219420 },
2436 {}
2437 },
2438 },
2439 [ALC887_FIXUP_ASUS_HMIC] = {
2440 .type = HDA_FIXUP_FUNC,
2441 .v.func = alc887_fixup_asus_jack,
2442 .chained = true,
2443 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2444 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002445};
2446
2447static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002448 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2449 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002450 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002451 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2452 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2453 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2454 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002455 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2456 ALC882_FIXUP_ACER_ASPIRE_4930G),
2457 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2458 ALC882_FIXUP_ACER_ASPIRE_4930G),
2459 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2460 ALC882_FIXUP_ACER_ASPIRE_8930G),
2461 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2462 ALC882_FIXUP_ACER_ASPIRE_8930G),
2463 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2464 ALC882_FIXUP_ACER_ASPIRE_4930G),
2465 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2466 ALC882_FIXUP_ACER_ASPIRE_4930G),
2467 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2468 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002469 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002470 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2471 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002472 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002473 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002474 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002475 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002476 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002477 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Jian-Hong Panca184352020-10-07 13:22:25 +08002478 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002479 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002480 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002481 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002482 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002483 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002484 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Fernando Luis Vázquez Cao12e31a72013-02-12 16:47:44 +09002485 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaic44d9b12016-02-07 09:38:26 +01002486 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002487
2488 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002489 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2490 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2491 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002492 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002493 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2494 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002495 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2496 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002497 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002498 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002499 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002500 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2501 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002502 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002503 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2504 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2505 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002506 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002507 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002508 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2509 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002510 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002511
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002512 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002513 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002514 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Christian Lachner0d45e862020-02-23 10:24:16 +01002515 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
Christian Lachnerd9e8fe02020-05-18 07:38:44 +02002516 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia0b03952020-06-16 15:21:50 +02002517 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia655e2b2020-02-17 16:19:47 +01002518 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai1d3aa4a2020-04-08 15:56:45 +02002519 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7dafba32020-02-12 09:10:47 +01002520 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaicc5049a2020-02-18 09:09:15 +01002521 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002522 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai63691582017-05-22 16:32:46 +02002523 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002524 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002525 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Peisen0202f5c2017-10-26 10:35:36 +08002526 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002527 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2528 SND_PCI_QUIRK(0x1558, 0x950A, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaif3d737b2018-07-17 17:08:32 +02002529 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller2f0d5202018-05-07 09:28:45 -06002530 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002531 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2532 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2533 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2534 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
Richard Sailer503d90b2019-06-19 13:33:11 +02002535 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2536 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002537 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
PeiSen Hou259eb822020-05-19 08:50:12 +02002538 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002539 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2540 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2541 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2542 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2543 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002544 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2545 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002546 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2547 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002548 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002549 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002550 {}
2551};
2552
Takashi Iwai1727a772013-01-10 09:52:52 +01002553static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002554 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2555 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2556 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2557 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2558 {.id = ALC889_FIXUP_CD, .name = "cd"},
2559 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2560 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2561 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2562 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2563 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2564 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2565 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2566 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2567 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2568 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002569 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2570 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2571 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002572 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2573 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2574 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2575 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2576 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2577 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2578 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2579 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002580 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002581 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002582 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002583 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002584 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002585 {}
2586};
2587
Takashi Iwai1d045db2011-07-07 18:23:21 +02002588/*
2589 * BIOS auto configuration
2590 */
2591/* almost identical with ALC880 parser... */
2592static int alc882_parse_auto_config(struct hda_codec *codec)
2593{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002594 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002595 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2596 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002597}
2598
Takashi Iwai1d045db2011-07-07 18:23:21 +02002599/*
2600 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002601static int patch_alc882(struct hda_codec *codec)
2602{
2603 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002604 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002605
Takashi Iwai3de95172012-05-07 18:03:15 +02002606 err = alc_alloc_spec(codec, 0x0b);
2607 if (err < 0)
2608 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002609
Takashi Iwai3de95172012-05-07 18:03:15 +02002610 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002611
Takashi Iwai7639a062015-03-03 10:07:24 +01002612 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002613 case 0x10ec0882:
2614 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002615 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002616 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002617 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002618 break;
2619 default:
2620 /* ALC883 and variants */
2621 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2622 break;
2623 }
2624
Takashi Iwaic9af7532019-05-10 11:01:43 +02002625 alc_pre_init(codec);
2626
Takashi Iwai1727a772013-01-10 09:52:52 +01002627 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002628 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002629 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002630
2631 alc_auto_parse_customize_define(codec);
2632
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002633 if (has_cdefine_beep(codec))
2634 spec->gen.beep_nid = 0x01;
2635
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002636 /* automatic parse from the BIOS config */
2637 err = alc882_parse_auto_config(codec);
2638 if (err < 0)
2639 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002640
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002641 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2642 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2643 if (err < 0)
2644 goto error;
2645 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002646
Takashi Iwai1727a772013-01-10 09:52:52 +01002647 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002648
Takashi Iwai1d045db2011-07-07 18:23:21 +02002649 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002650
2651 error:
2652 alc_free(codec);
2653 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002654}
2655
2656
2657/*
2658 * ALC262 support
2659 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002660static int alc262_parse_auto_config(struct hda_codec *codec)
2661{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002662 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002663 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2664 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002665}
2666
2667/*
2668 * Pin config fixes
2669 */
2670enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002671 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002672 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002673 ALC262_FIXUP_HP_Z200,
2674 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002675 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002676 ALC262_FIXUP_BENQ,
2677 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002678 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002679 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002680};
2681
Takashi Iwai1727a772013-01-10 09:52:52 +01002682static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002683 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002684 .type = HDA_FIXUP_PINS,
2685 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002686 { 0x14, 0x99130110 }, /* speaker */
2687 { 0x15, 0x0221142f }, /* front HP */
2688 { 0x1b, 0x0121141f }, /* rear HP */
2689 { }
2690 }
2691 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002692 [ALC262_FIXUP_FSC_S7110] = {
2693 .type = HDA_FIXUP_PINS,
2694 .v.pins = (const struct hda_pintbl[]) {
2695 { 0x15, 0x90170110 }, /* speaker */
2696 { }
2697 },
2698 .chained = true,
2699 .chain_id = ALC262_FIXUP_BENQ,
2700 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002701 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002702 .type = HDA_FIXUP_PINS,
2703 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002704 { 0x16, 0x99130120 }, /* internal speaker */
2705 { }
2706 }
2707 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002708 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002709 .type = HDA_FIXUP_PINS,
2710 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002711 { 0x14, 0x1993e1f0 }, /* int AUX */
2712 { }
2713 }
2714 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002715 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002716 .type = HDA_FIXUP_PINCTLS,
2717 .v.pins = (const struct hda_pintbl[]) {
2718 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002719 {}
2720 },
2721 .chained = true,
2722 .chain_id = ALC262_FIXUP_BENQ,
2723 },
2724 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002725 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002726 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002727 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2728 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2729 {}
2730 }
2731 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002732 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002733 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002734 .v.verbs = (const struct hda_verb[]) {
2735 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2736 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2737 {}
2738 }
2739 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002740 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002741 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002742 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002743 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002744 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2745 .type = HDA_FIXUP_FUNC,
2746 .v.func = alc_fixup_no_depop_delay,
2747 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002748};
2749
2750static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002751 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002752 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002753 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002754 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002755 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002756 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002757 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002758 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2759 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002760 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002761 {}
2762};
2763
Takashi Iwai1727a772013-01-10 09:52:52 +01002764static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002765 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002766 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2767 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2768 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2769 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2770 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2771 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2772 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2773 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002774 {}
2775};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002776
Takashi Iwai1d045db2011-07-07 18:23:21 +02002777/*
2778 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002779static int patch_alc262(struct hda_codec *codec)
2780{
2781 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002782 int err;
2783
Takashi Iwai3de95172012-05-07 18:03:15 +02002784 err = alc_alloc_spec(codec, 0x0b);
2785 if (err < 0)
2786 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002787
Takashi Iwai3de95172012-05-07 18:03:15 +02002788 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002789 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002790
Takashi Iwai225068a2015-05-29 10:42:14 +02002791 spec->shutup = alc_eapd_shutup;
2792
Takashi Iwai1d045db2011-07-07 18:23:21 +02002793#if 0
2794 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2795 * under-run
2796 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002797 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002798#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002799 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2800
Takashi Iwaic9af7532019-05-10 11:01:43 +02002801 alc_pre_init(codec);
2802
Takashi Iwai1727a772013-01-10 09:52:52 +01002803 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002804 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002805 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002806
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002807 alc_auto_parse_customize_define(codec);
2808
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002809 if (has_cdefine_beep(codec))
2810 spec->gen.beep_nid = 0x01;
2811
Takashi Iwai42399f72011-11-07 17:18:44 +01002812 /* automatic parse from the BIOS config */
2813 err = alc262_parse_auto_config(codec);
2814 if (err < 0)
2815 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002816
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002817 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2818 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2819 if (err < 0)
2820 goto error;
2821 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002822
Takashi Iwai1727a772013-01-10 09:52:52 +01002823 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002824
Takashi Iwai1d045db2011-07-07 18:23:21 +02002825 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002826
2827 error:
2828 alc_free(codec);
2829 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002830}
2831
2832/*
2833 * ALC268
2834 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002835/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002836static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2837 struct snd_ctl_elem_value *ucontrol)
2838{
2839 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2840 unsigned long pval;
2841 int err;
2842
2843 mutex_lock(&codec->control_mutex);
2844 pval = kcontrol->private_value;
2845 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2846 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2847 if (err >= 0) {
2848 kcontrol->private_value = (pval & ~0xff) | 0x10;
2849 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2850 }
2851 kcontrol->private_value = pval;
2852 mutex_unlock(&codec->control_mutex);
2853 return err;
2854}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002855
2856static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2857 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002858 {
2859 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2860 .name = "Beep Playback Switch",
2861 .subdevice = HDA_SUBDEV_AMP_FLAG,
2862 .info = snd_hda_mixer_amp_switch_info,
2863 .get = snd_hda_mixer_amp_switch_get,
2864 .put = alc268_beep_switch_put,
2865 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2866 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002867};
2868
2869/* set PCBEEP vol = 0, mute connections */
2870static const struct hda_verb alc268_beep_init_verbs[] = {
2871 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2872 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2873 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2874 { }
2875};
2876
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002877enum {
2878 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002879 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002880 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002881};
2882
Takashi Iwai1727a772013-01-10 09:52:52 +01002883static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002884 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002885 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002886 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002887 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002888 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002889 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002890 .v.verbs = (const struct hda_verb[]) {
2891 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2892 {}
2893 }
2894 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002895 [ALC268_FIXUP_SPDIF] = {
2896 .type = HDA_FIXUP_PINS,
2897 .v.pins = (const struct hda_pintbl[]) {
2898 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2899 {}
2900 }
2901 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002902};
2903
Takashi Iwai1727a772013-01-10 09:52:52 +01002904static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002905 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002906 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002907 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002908 {}
2909};
2910
2911static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002912 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002913 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002914 /* below is codec SSID since multiple Toshiba laptops have the
2915 * same PCI SSID 1179:ff00
2916 */
2917 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002918 {}
2919};
2920
Takashi Iwai1d045db2011-07-07 18:23:21 +02002921/*
2922 * BIOS auto configuration
2923 */
2924static int alc268_parse_auto_config(struct hda_codec *codec)
2925{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002926 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002927 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002928}
2929
Takashi Iwai1d045db2011-07-07 18:23:21 +02002930/*
2931 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002932static int patch_alc268(struct hda_codec *codec)
2933{
2934 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002935 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002936
Takashi Iwai1d045db2011-07-07 18:23:21 +02002937 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002938 err = alc_alloc_spec(codec, 0);
2939 if (err < 0)
2940 return err;
2941
2942 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02002943 if (has_cdefine_beep(codec))
2944 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002945
Takashi Iwai225068a2015-05-29 10:42:14 +02002946 spec->shutup = alc_eapd_shutup;
2947
Takashi Iwaic9af7532019-05-10 11:01:43 +02002948 alc_pre_init(codec);
2949
Takashi Iwai1727a772013-01-10 09:52:52 +01002950 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2951 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002952
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002953 /* automatic parse from the BIOS config */
2954 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002955 if (err < 0)
2956 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002957
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002958 if (err > 0 && !spec->gen.no_analog &&
2959 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002960 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2961 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2962 &alc268_beep_mixer[i])) {
2963 err = -ENOMEM;
2964 goto error;
2965 }
2966 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002967 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002968 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2969 /* override the amp caps for beep generator */
2970 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2971 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2972 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2973 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2974 (0 << AC_AMPCAP_MUTE_SHIFT));
2975 }
2976
Takashi Iwai1727a772013-01-10 09:52:52 +01002977 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002978
Takashi Iwai1d045db2011-07-07 18:23:21 +02002979 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002980
2981 error:
2982 alc_free(codec);
2983 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002984}
2985
2986/*
2987 * ALC269
2988 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01002989
Takashi Iwai1d045db2011-07-07 18:23:21 +02002990static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002991 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002992};
2993
2994static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002995 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002996};
2997
Takashi Iwai1d045db2011-07-07 18:23:21 +02002998/* different alc269-variants */
2999enum {
3000 ALC269_TYPE_ALC269VA,
3001 ALC269_TYPE_ALC269VB,
3002 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02003003 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01003004 ALC269_TYPE_ALC280,
3005 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02003006 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01003007 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08003008 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02003009 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08003010 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003011 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08003012 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003013 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003014 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003015 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003016 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003017 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003018 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003019 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003020};
3021
3022/*
3023 * BIOS auto configuration
3024 */
3025static int alc269_parse_auto_config(struct hda_codec *codec)
3026{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003027 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003028 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3029 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3030 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003031 const hda_nid_t *ssids;
3032
3033 switch (spec->codec_variant) {
3034 case ALC269_TYPE_ALC269VA:
3035 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003036 case ALC269_TYPE_ALC280:
3037 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003038 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003039 ssids = alc269va_ssids;
3040 break;
3041 case ALC269_TYPE_ALC269VB:
3042 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003043 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003044 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003045 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003046 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003047 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003048 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003049 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003050 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003051 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003052 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003053 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003054 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003055 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003056 ssids = alc269_ssids;
3057 break;
3058 default:
3059 ssids = alc269_ssids;
3060 break;
3061 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003062
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003063 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003064}
3065
Hui Wang476c02e2020-03-29 16:20:18 +08003066static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3067 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3068 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3069 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3070 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3071 {}
3072};
3073
3074static void alc_headset_btn_callback(struct hda_codec *codec,
3075 struct hda_jack_callback *jack)
3076{
3077 int report = 0;
3078
3079 if (jack->unsol_res & (7 << 13))
3080 report |= SND_JACK_BTN_0;
3081
3082 if (jack->unsol_res & (1 << 16 | 3 << 8))
3083 report |= SND_JACK_BTN_1;
3084
3085 /* Volume up key */
3086 if (jack->unsol_res & (7 << 23))
3087 report |= SND_JACK_BTN_2;
3088
3089 /* Volume down key */
3090 if (jack->unsol_res & (7 << 10))
3091 report |= SND_JACK_BTN_3;
3092
3093 jack->jack->button_state = report;
3094}
3095
3096static void alc_disable_headset_jack_key(struct hda_codec *codec)
3097{
3098 struct alc_spec *spec = codec->spec;
3099
3100 if (!spec->has_hs_key)
3101 return;
3102
3103 switch (codec->core.vendor_id) {
3104 case 0x10ec0215:
3105 case 0x10ec0225:
3106 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003107 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003108 case 0x10ec0295:
3109 case 0x10ec0289:
3110 case 0x10ec0299:
3111 alc_write_coef_idx(codec, 0x48, 0x0);
3112 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3113 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3114 break;
3115 case 0x10ec0236:
3116 case 0x10ec0256:
3117 alc_write_coef_idx(codec, 0x48, 0x0);
3118 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3119 break;
3120 }
3121}
3122
3123static void alc_enable_headset_jack_key(struct hda_codec *codec)
3124{
3125 struct alc_spec *spec = codec->spec;
3126
3127 if (!spec->has_hs_key)
3128 return;
3129
3130 switch (codec->core.vendor_id) {
3131 case 0x10ec0215:
3132 case 0x10ec0225:
3133 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003134 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003135 case 0x10ec0295:
3136 case 0x10ec0289:
3137 case 0x10ec0299:
3138 alc_write_coef_idx(codec, 0x48, 0xd011);
3139 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3140 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3141 break;
3142 case 0x10ec0236:
3143 case 0x10ec0256:
3144 alc_write_coef_idx(codec, 0x48, 0xd011);
3145 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3146 break;
3147 }
3148}
3149
3150static void alc_fixup_headset_jack(struct hda_codec *codec,
3151 const struct hda_fixup *fix, int action)
3152{
3153 struct alc_spec *spec = codec->spec;
3154
3155 switch (action) {
3156 case HDA_FIXUP_ACT_PRE_PROBE:
3157 spec->has_hs_key = 1;
3158 snd_hda_jack_detect_enable_callback(codec, 0x55,
3159 alc_headset_btn_callback);
3160 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3161 SND_JACK_HEADSET, alc_headset_btn_keymap);
3162 break;
3163 case HDA_FIXUP_ACT_INIT:
3164 alc_enable_headset_jack_key(codec);
3165 break;
3166 }
3167}
3168
Kailang Yang1387e2d2012-11-08 10:23:18 +01003169static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003170{
Takashi Iwai98b24882014-08-18 13:47:50 +02003171 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003172}
3173
3174static void alc269_shutup(struct hda_codec *codec)
3175{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003176 struct alc_spec *spec = codec->spec;
3177
Kailang Yang1387e2d2012-11-08 10:23:18 +01003178 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3179 alc269vb_toggle_power_output(codec, 0);
3180 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3181 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003182 msleep(150);
3183 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003184 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003185}
3186
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003187static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003188 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003189 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003190 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3191 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3192 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3193 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3194 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3195 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3196 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3197 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3198 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3199 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3200 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3201 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3202 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3203 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3204 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3205 WRITE_COEF(0x63, 0x2902), /* PLL */
3206 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3207 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3208 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3209 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3210 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3211 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3212 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3213 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3214 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3215 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3216 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3217 {}
3218};
3219
Kailang Yangcb149cb2014-03-18 16:45:32 +08003220static void alc282_restore_default_value(struct hda_codec *codec)
3221{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003222 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003223}
3224
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003225static void alc282_init(struct hda_codec *codec)
3226{
3227 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003228 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003229 bool hp_pin_sense;
3230 int coef78;
3231
Kailang Yangcb149cb2014-03-18 16:45:32 +08003232 alc282_restore_default_value(codec);
3233
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003234 if (!hp_pin)
3235 return;
3236 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3237 coef78 = alc_read_coef_idx(codec, 0x78);
3238
3239 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3240 /* Headphone capless set to high power mode */
3241 alc_write_coef_idx(codec, 0x78, 0x9004);
3242
3243 if (hp_pin_sense)
3244 msleep(2);
3245
3246 snd_hda_codec_write(codec, hp_pin, 0,
3247 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3248
3249 if (hp_pin_sense)
3250 msleep(85);
3251
3252 snd_hda_codec_write(codec, hp_pin, 0,
3253 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3254
3255 if (hp_pin_sense)
3256 msleep(100);
3257
3258 /* Headphone capless set to normal mode */
3259 alc_write_coef_idx(codec, 0x78, coef78);
3260}
3261
3262static void alc282_shutup(struct hda_codec *codec)
3263{
3264 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003265 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003266 bool hp_pin_sense;
3267 int coef78;
3268
3269 if (!hp_pin) {
3270 alc269_shutup(codec);
3271 return;
3272 }
3273
3274 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3275 coef78 = alc_read_coef_idx(codec, 0x78);
3276 alc_write_coef_idx(codec, 0x78, 0x9004);
3277
3278 if (hp_pin_sense)
3279 msleep(2);
3280
3281 snd_hda_codec_write(codec, hp_pin, 0,
3282 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3283
3284 if (hp_pin_sense)
3285 msleep(85);
3286
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003287 if (!spec->no_shutup_pins)
3288 snd_hda_codec_write(codec, hp_pin, 0,
3289 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003290
3291 if (hp_pin_sense)
3292 msleep(100);
3293
3294 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003295 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003296 alc_write_coef_idx(codec, 0x78, coef78);
3297}
3298
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003299static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003300 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003301 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003302 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3303 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3304 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3305 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3306 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3307 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3308 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3309 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3310 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3311 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3312 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3313 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3314 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3315 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3316 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3317 WRITE_COEF(0x2e, 0x2902), /* PLL */
3318 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3319 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3320 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3321 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3322 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3323 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3324 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3325 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3326 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3327 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3328 WRITE_COEF(0x49, 0x0), /* test mode */
3329 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3330 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3331 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003332 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003333 {}
3334};
3335
Kailang Yang6bd55b02014-03-17 13:51:27 +08003336static void alc283_restore_default_value(struct hda_codec *codec)
3337{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003338 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003339}
3340
Kailang Yang2af02be2013-08-22 10:03:50 +02003341static void alc283_init(struct hda_codec *codec)
3342{
3343 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003344 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003345 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003346
Kailang Yang6bd55b02014-03-17 13:51:27 +08003347 alc283_restore_default_value(codec);
3348
Kailang Yang2af02be2013-08-22 10:03:50 +02003349 if (!hp_pin)
3350 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003351
3352 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003353 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3354
3355 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3356 /* Headphone capless set to high power mode */
3357 alc_write_coef_idx(codec, 0x43, 0x9004);
3358
3359 snd_hda_codec_write(codec, hp_pin, 0,
3360 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3361
3362 if (hp_pin_sense)
3363 msleep(85);
3364
3365 snd_hda_codec_write(codec, hp_pin, 0,
3366 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3367
3368 if (hp_pin_sense)
3369 msleep(85);
3370 /* Index 0x46 Combo jack auto switch control 2 */
3371 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003372 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003373 /* Headphone capless set to normal mode */
3374 alc_write_coef_idx(codec, 0x43, 0x9614);
3375}
3376
3377static void alc283_shutup(struct hda_codec *codec)
3378{
3379 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003380 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003381 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003382
3383 if (!hp_pin) {
3384 alc269_shutup(codec);
3385 return;
3386 }
3387
3388 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3389
3390 alc_write_coef_idx(codec, 0x43, 0x9004);
3391
Harsha Priyab450b172014-10-09 11:04:56 +00003392 /*depop hp during suspend*/
3393 alc_write_coef_idx(codec, 0x06, 0x2100);
3394
Kailang Yang2af02be2013-08-22 10:03:50 +02003395 snd_hda_codec_write(codec, hp_pin, 0,
3396 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3397
3398 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003399 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003400
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003401 if (!spec->no_shutup_pins)
3402 snd_hda_codec_write(codec, hp_pin, 0,
3403 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003404
Takashi Iwai98b24882014-08-18 13:47:50 +02003405 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003406
3407 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003408 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003409 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003410 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003411 alc_write_coef_idx(codec, 0x43, 0x9614);
3412}
3413
Kailang Yang4a219ef2017-06-16 16:54:35 +08003414static void alc256_init(struct hda_codec *codec)
3415{
3416 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003417 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003418 bool hp_pin_sense;
3419
3420 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003421 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003422
3423 msleep(30);
3424
3425 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3426
3427 if (hp_pin_sense)
3428 msleep(2);
3429
3430 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003431 if (spec->ultra_low_power) {
3432 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3433 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3434 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3435 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3436 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3437 msleep(30);
3438 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003439
3440 snd_hda_codec_write(codec, hp_pin, 0,
3441 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3442
Kailang Yang6447c962019-05-08 16:27:03 +08003443 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003444 msleep(85);
3445
3446 snd_hda_codec_write(codec, hp_pin, 0,
3447 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3448
Kailang Yang6447c962019-05-08 16:27:03 +08003449 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003450 msleep(100);
3451
3452 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3453 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003454 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3455 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003456 /*
3457 * Expose headphone mic (or possibly Line In on some machines) instead
3458 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3459 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3460 * this register.
3461 */
3462 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003463}
3464
3465static void alc256_shutup(struct hda_codec *codec)
3466{
3467 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003468 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003469 bool hp_pin_sense;
3470
Kailang Yang6447c962019-05-08 16:27:03 +08003471 if (!hp_pin)
3472 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003473
3474 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3475
3476 if (hp_pin_sense)
3477 msleep(2);
3478
3479 snd_hda_codec_write(codec, hp_pin, 0,
3480 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3481
Kailang Yang6447c962019-05-08 16:27:03 +08003482 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003483 msleep(85);
3484
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003485 /* 3k pull low control for Headset jack. */
3486 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003487 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3488 * when booting with headset plugged. So skip setting it for the codec alc257
3489 */
3490 if (codec->core.vendor_id != 0x10ec0257)
3491 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003492
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003493 if (!spec->no_shutup_pins)
3494 snd_hda_codec_write(codec, hp_pin, 0,
3495 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003496
Kailang Yang6447c962019-05-08 16:27:03 +08003497 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003498 msleep(100);
3499
3500 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003501 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003502 if (spec->ultra_low_power) {
3503 msleep(50);
3504 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3505 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3506 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3507 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3508 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3509 msleep(30);
3510 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003511}
3512
Kailang Yangda911b12018-01-05 16:50:08 +08003513static void alc225_init(struct hda_codec *codec)
3514{
3515 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003516 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003517 bool hp1_pin_sense, hp2_pin_sense;
3518
3519 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003520 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003521 msleep(30);
3522
3523 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3524 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3525
3526 if (hp1_pin_sense || hp2_pin_sense)
3527 msleep(2);
3528
3529 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003530 if (spec->ultra_low_power) {
3531 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3532 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3533 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3534 msleep(30);
3535 }
Kailang Yangda911b12018-01-05 16:50:08 +08003536
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003537 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003538 snd_hda_codec_write(codec, hp_pin, 0,
3539 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3540 if (hp2_pin_sense)
3541 snd_hda_codec_write(codec, 0x16, 0,
3542 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3543
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003544 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003545 msleep(85);
3546
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003547 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003548 snd_hda_codec_write(codec, hp_pin, 0,
3549 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3550 if (hp2_pin_sense)
3551 snd_hda_codec_write(codec, 0x16, 0,
3552 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3553
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003554 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003555 msleep(100);
3556
3557 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3558 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3559}
3560
3561static void alc225_shutup(struct hda_codec *codec)
3562{
3563 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003564 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003565 bool hp1_pin_sense, hp2_pin_sense;
3566
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003567 if (!hp_pin)
3568 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003569
3570 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003571 /* 3k pull low control for Headset jack. */
3572 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3573
3574 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3575 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3576
3577 if (hp1_pin_sense || hp2_pin_sense)
3578 msleep(2);
3579
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003580 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003581 snd_hda_codec_write(codec, hp_pin, 0,
3582 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3583 if (hp2_pin_sense)
3584 snd_hda_codec_write(codec, 0x16, 0,
3585 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3586
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003587 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003588 msleep(85);
3589
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003590 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003591 snd_hda_codec_write(codec, hp_pin, 0,
3592 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3593 if (hp2_pin_sense)
3594 snd_hda_codec_write(codec, 0x16, 0,
3595 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3596
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003597 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003598 msleep(100);
3599
3600 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003601 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003602 if (spec->ultra_low_power) {
3603 msleep(50);
3604 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3605 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3606 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3607 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3608 msleep(30);
3609 }
Hui Wang476c02e2020-03-29 16:20:18 +08003610
3611 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3612 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003613}
3614
Kailang Yangc2d6af52017-06-21 14:50:54 +08003615static void alc_default_init(struct hda_codec *codec)
3616{
3617 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003618 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003619 bool hp_pin_sense;
3620
3621 if (!hp_pin)
3622 return;
3623
3624 msleep(30);
3625
3626 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3627
3628 if (hp_pin_sense)
3629 msleep(2);
3630
3631 snd_hda_codec_write(codec, hp_pin, 0,
3632 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3633
3634 if (hp_pin_sense)
3635 msleep(85);
3636
3637 snd_hda_codec_write(codec, hp_pin, 0,
3638 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3639
3640 if (hp_pin_sense)
3641 msleep(100);
3642}
3643
3644static void alc_default_shutup(struct hda_codec *codec)
3645{
3646 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003647 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003648 bool hp_pin_sense;
3649
3650 if (!hp_pin) {
3651 alc269_shutup(codec);
3652 return;
3653 }
3654
3655 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3656
3657 if (hp_pin_sense)
3658 msleep(2);
3659
3660 snd_hda_codec_write(codec, hp_pin, 0,
3661 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3662
3663 if (hp_pin_sense)
3664 msleep(85);
3665
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003666 if (!spec->no_shutup_pins)
3667 snd_hda_codec_write(codec, hp_pin, 0,
3668 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003669
3670 if (hp_pin_sense)
3671 msleep(100);
3672
3673 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003674 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003675}
3676
Kailang Yang693abe12019-01-29 15:38:21 +08003677static void alc294_hp_init(struct hda_codec *codec)
3678{
3679 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003680 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003681 int i, val;
3682
3683 if (!hp_pin)
3684 return;
3685
3686 snd_hda_codec_write(codec, hp_pin, 0,
3687 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3688
3689 msleep(100);
3690
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003691 if (!spec->no_shutup_pins)
3692 snd_hda_codec_write(codec, hp_pin, 0,
3693 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003694
3695 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3696 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3697
3698 /* Wait for depop procedure finish */
3699 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3700 for (i = 0; i < 20 && val & 0x0080; i++) {
3701 msleep(50);
3702 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3703 }
3704 /* Set HP depop to auto mode */
3705 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3706 msleep(50);
3707}
3708
3709static void alc294_init(struct hda_codec *codec)
3710{
3711 struct alc_spec *spec = codec->spec;
3712
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003713 /* required only at boot or S4 resume time */
3714 if (!spec->done_hp_init ||
3715 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003716 alc294_hp_init(codec);
3717 spec->done_hp_init = true;
3718 }
3719 alc_default_init(codec);
3720}
3721
Kailang Yangad60d502013-06-28 12:03:01 +02003722static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3723 unsigned int val)
3724{
3725 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3726 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3727 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3728}
3729
3730static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3731{
3732 unsigned int val;
3733
3734 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3735 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3736 & 0xffff;
3737 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3738 << 16;
3739 return val;
3740}
3741
3742static void alc5505_dsp_halt(struct hda_codec *codec)
3743{
3744 unsigned int val;
3745
3746 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3747 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3748 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3749 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3750 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3751 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3752 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3753 val = alc5505_coef_get(codec, 0x6220);
3754 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3755}
3756
3757static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3758{
3759 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3760 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3761 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3762 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3763 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3764 alc5505_coef_set(codec, 0x880c, 0x00000004);
3765}
3766
3767static void alc5505_dsp_init(struct hda_codec *codec)
3768{
3769 unsigned int val;
3770
3771 alc5505_dsp_halt(codec);
3772 alc5505_dsp_back_from_halt(codec);
3773 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3774 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3775 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3776 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3777 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3778 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3779 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3780 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3781 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3782 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3783 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3784 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3785 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3786
3787 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3788 if (val <= 3)
3789 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3790 else
3791 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3792
3793 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3794 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3795 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3796 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3797 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3798 alc5505_coef_set(codec, 0x880c, 0x00000003);
3799 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003800
3801#ifdef HALT_REALTEK_ALC5505
3802 alc5505_dsp_halt(codec);
3803#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003804}
3805
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003806#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003807#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3808#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003809#else
3810#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3811#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3812#endif
3813
Takashi Iwai2a439522011-07-26 09:52:50 +02003814#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003815static int alc269_suspend(struct hda_codec *codec)
3816{
3817 struct alc_spec *spec = codec->spec;
3818
3819 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003820 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003821 return alc_suspend(codec);
3822}
3823
Takashi Iwai1d045db2011-07-07 18:23:21 +02003824static int alc269_resume(struct hda_codec *codec)
3825{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003826 struct alc_spec *spec = codec->spec;
3827
Kailang Yang1387e2d2012-11-08 10:23:18 +01003828 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3829 alc269vb_toggle_power_output(codec, 0);
3830 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003831 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003832 msleep(150);
3833 }
3834
3835 codec->patch_ops.init(codec);
3836
Kailang Yang1387e2d2012-11-08 10:23:18 +01003837 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3838 alc269vb_toggle_power_output(codec, 1);
3839 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003840 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003841 msleep(200);
3842 }
3843
Takashi Iwai1a462be2020-01-09 10:01:04 +01003844 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003845 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003846
3847 /* on some machine, the BIOS will clear the codec gpio data when enter
3848 * suspend, and won't restore the data after resume, so we restore it
3849 * in the driver.
3850 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003851 if (spec->gpio_data)
3852 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003853
Kailang Yangad60d502013-06-28 12:03:01 +02003854 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003855 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003856
Takashi Iwai1d045db2011-07-07 18:23:21 +02003857 return 0;
3858}
Takashi Iwai2a439522011-07-26 09:52:50 +02003859#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003860
David Henningsson108cc102012-07-20 10:37:25 +02003861static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003862 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003863{
3864 struct alc_spec *spec = codec->spec;
3865
Takashi Iwai1727a772013-01-10 09:52:52 +01003866 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003867 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3868}
3869
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003870static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3871 const struct hda_fixup *fix,
3872 int action)
3873{
3874 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3875 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3876
3877 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3878 snd_hda_codec_set_pincfg(codec, 0x19,
3879 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3880 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3881}
3882
Takashi Iwai1d045db2011-07-07 18:23:21 +02003883static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003884 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003885{
Takashi Iwai98b24882014-08-18 13:47:50 +02003886 if (action == HDA_FIXUP_ACT_INIT)
3887 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003888}
3889
David Henningsson7c478f02013-10-11 10:18:46 +02003890static void alc269_fixup_headset_mic(struct hda_codec *codec,
3891 const struct hda_fixup *fix, int action)
3892{
3893 struct alc_spec *spec = codec->spec;
3894
3895 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3896 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3897}
3898
Takashi Iwai1d045db2011-07-07 18:23:21 +02003899static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003900 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003901{
3902 static const struct hda_verb verbs[] = {
3903 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3904 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3905 {}
3906 };
3907 unsigned int cfg;
3908
Takashi Iwai7639a062015-03-03 10:07:24 +01003909 if (strcmp(codec->core.chip_name, "ALC271X") &&
3910 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003911 return;
3912 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3913 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3914 snd_hda_sequence_write(codec, verbs);
3915}
3916
Takashi Iwai017f2a12011-07-09 14:42:25 +02003917static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003918 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003919{
3920 struct alc_spec *spec = codec->spec;
3921
Takashi Iwai1727a772013-01-10 09:52:52 +01003922 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003923 return;
3924
3925 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3926 * fix the sample rate of analog I/O to 44.1kHz
3927 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003928 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3929 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003930}
3931
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003932static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003933 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003934{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003935 /* The digital-mic unit sends PDM (differential signal) instead of
3936 * the standard PCM, thus you can't record a valid mono stream as is.
3937 * Below is a workaround specific to ALC269 to control the dmic
3938 * signal source as mono.
3939 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003940 if (action == HDA_FIXUP_ACT_INIT)
3941 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003942}
3943
Takashi Iwai24519912011-08-16 15:08:49 +02003944static void alc269_quanta_automute(struct hda_codec *codec)
3945{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003946 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003947
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003948 alc_write_coef_idx(codec, 0x0c, 0x680);
3949 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003950}
3951
3952static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003953 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003954{
3955 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003956 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003957 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003958 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003959}
3960
David Henningssond240d1d2013-04-15 12:50:02 +02003961static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003962 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003963{
3964 struct alc_spec *spec = codec->spec;
3965 int vref;
3966 msleep(200);
3967 snd_hda_gen_hp_automute(codec, jack);
3968
3969 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3970 msleep(100);
3971 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3972 vref);
3973 msleep(500);
3974 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3975 vref);
3976}
3977
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02003978/*
3979 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
3980 */
3981struct hda_alc298_mbxinit {
3982 unsigned char value_0x23;
3983 unsigned char value_0x25;
3984};
3985
3986static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
3987 const struct hda_alc298_mbxinit *initval,
3988 bool first)
3989{
3990 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
3991 alc_write_coef_idx(codec, 0x26, 0xb000);
3992
3993 if (first)
3994 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
3995
3996 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
3997 alc_write_coef_idx(codec, 0x26, 0xf000);
3998 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
3999
4000 if (initval->value_0x23 != 0x1e)
4001 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4002
4003 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4004 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4005}
4006
4007static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4008 const struct hda_fixup *fix,
4009 int action)
4010{
4011 /* Initialization magic */
4012 static const struct hda_alc298_mbxinit dac_init[] = {
4013 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4014 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4015 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4016 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4017 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4018 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4019 {0x2f, 0x00},
4020 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4021 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4022 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4023 {}
4024 };
4025 const struct hda_alc298_mbxinit *seq;
4026
4027 if (action != HDA_FIXUP_ACT_INIT)
4028 return;
4029
4030 /* Start */
4031 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4032 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4033 alc_write_coef_idx(codec, 0x26, 0xf000);
4034 alc_write_coef_idx(codec, 0x22, 0x31);
4035 alc_write_coef_idx(codec, 0x23, 0x0b);
4036 alc_write_coef_idx(codec, 0x25, 0x00);
4037 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4038 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4039
4040 for (seq = dac_init; seq->value_0x23; seq++)
4041 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4042}
4043
David Henningssond240d1d2013-04-15 12:50:02 +02004044static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4045 const struct hda_fixup *fix, int action)
4046{
4047 struct alc_spec *spec = codec->spec;
4048 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4049 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4050 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4051 }
4052}
4053
Takashi Iwai766538a2020-06-18 13:08:41 +02004054static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4055 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004056{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004057 unsigned int pinval;
4058
Takashi Iwai766538a2020-06-18 13:08:41 +02004059 if (!pin)
4060 return;
4061 if (polarity)
4062 on = !on;
4063 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004064 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004065 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4066 /* temporarily power up/down for setting VREF */
4067 snd_hda_power_up_pm(codec);
4068 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4069 snd_hda_power_down_pm(codec);
4070}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004071
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004072/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004073static int vref_mute_led_set(struct led_classdev *led_cdev,
4074 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004075{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004076 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004077 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004078
Takashi Iwai766538a2020-06-18 13:08:41 +02004079 alc_update_vref_led(codec, spec->mute_led_nid,
4080 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004081 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004082}
4083
David Henningssond5b6b652013-11-06 10:50:44 +01004084/* Make sure the led works even in runtime suspend */
4085static unsigned int led_power_filter(struct hda_codec *codec,
4086 hda_nid_t nid,
4087 unsigned int power_state)
4088{
4089 struct alc_spec *spec = codec->spec;
4090
Hui Wang50dd9052014-07-08 17:56:15 +08004091 if (power_state != AC_PWRST_D3 || nid == 0 ||
4092 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004093 return power_state;
4094
4095 /* Set pin ctl again, it might have just been set to 0 */
4096 snd_hda_set_pin_ctl(codec, nid,
4097 snd_hda_codec_get_pin_target(codec, nid));
4098
Takashi Iwaicffd3962015-04-09 10:30:25 +02004099 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004100}
4101
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004102static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4103 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004104{
4105 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004106 const struct dmi_device *dev = NULL;
4107
4108 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4109 return;
4110
4111 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4112 int pol, pin;
4113 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4114 continue;
4115 if (pin < 0x0a || pin >= 0x10)
4116 break;
4117 spec->mute_led_polarity = pol;
4118 spec->mute_led_nid = pin - 0x0a + 0x18;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004119 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004120 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004121 codec_dbg(codec,
4122 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004123 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004124 break;
4125 }
4126}
4127
Takashi Iwai85c467d2018-05-29 11:38:38 +02004128static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4129 const struct hda_fixup *fix,
4130 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004131{
4132 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004133
David Henningssond06ac142013-02-18 11:41:55 +01004134 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4135 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004136 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004137 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004138 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004139 }
4140}
4141
Takashi Iwai85c467d2018-05-29 11:38:38 +02004142static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4143 const struct hda_fixup *fix, int action)
4144{
4145 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4146}
4147
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004148static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4149 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004150{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004151 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004152}
4153
Tom Briden7f783bd2017-03-25 10:12:01 +00004154static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4155 const struct hda_fixup *fix, int action)
4156{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004157 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004158}
4159
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004160/* update LED status via GPIO */
4161static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004162 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004163{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004164 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004165 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004166 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004167}
4168
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004169/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004170static int gpio_mute_led_set(struct led_classdev *led_cdev,
4171 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004172{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004173 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004174 struct alc_spec *spec = codec->spec;
4175
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004176 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004177 spec->mute_led_polarity, !brightness);
4178 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004179}
4180
4181/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004182static int micmute_led_set(struct led_classdev *led_cdev,
4183 enum led_brightness brightness)
4184{
4185 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4186 struct alc_spec *spec = codec->spec;
4187
4188 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004189 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004190 return 0;
4191}
4192
Takashi Iwai01e4a272018-06-19 22:47:30 +02004193/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4194static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4195 int action,
4196 unsigned int mute_mask,
4197 unsigned int micmute_mask)
4198{
4199 struct alc_spec *spec = codec->spec;
4200
4201 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4202
4203 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4204 return;
4205 if (mute_mask) {
4206 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004207 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004208 }
4209 if (micmute_mask) {
4210 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004211 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004212 }
4213}
4214
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004215static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4216 const struct hda_fixup *fix, int action)
4217{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004218 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004219}
4220
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004221static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4222 const struct hda_fixup *fix, int action)
4223{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004224 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004225}
4226
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004227static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4228 const struct hda_fixup *fix, int action)
4229{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004230 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004231}
4232
Kailang Yanga0ccbc52020-11-06 15:20:38 +08004233static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4234 const struct hda_fixup *fix, int action)
4235{
4236 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4237}
4238
Takashi Iwai8a503552020-06-18 13:08:32 +02004239/* turn on/off mic-mute LED per capture hook via VREF change */
4240static int vref_micmute_led_set(struct led_classdev *led_cdev,
4241 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004242{
Takashi Iwai8a503552020-06-18 13:08:32 +02004243 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004244 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004245
Takashi Iwai766538a2020-06-18 13:08:41 +02004246 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4247 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004248 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004249}
4250
4251static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4252 const struct hda_fixup *fix, int action)
4253{
4254 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004255
Takashi Iwai01e4a272018-06-19 22:47:30 +02004256 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004257 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004258 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4259 * enable headphone amp
4260 */
4261 spec->gpio_mask |= 0x10;
4262 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004263 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004264 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004265 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004266 }
4267}
4268
David Henningsson7a5255f2014-10-30 08:26:01 +01004269static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4270 const struct hda_fixup *fix, int action)
4271{
David Henningsson7a5255f2014-10-30 08:26:01 +01004272 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004273
Takashi Iwai01e4a272018-06-19 22:47:30 +02004274 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004275 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004276 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004277 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004278 codec->power_filter = led_power_filter;
4279 }
4280}
4281
Takashi Iwai766538a2020-06-18 13:08:41 +02004282static void alc_update_coef_led(struct hda_codec *codec,
4283 struct alc_coef_led *led,
4284 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004285{
Takashi Iwai766538a2020-06-18 13:08:41 +02004286 if (polarity)
4287 on = !on;
4288 /* temporarily power up/down for setting COEF bit */
4289 alc_update_coef_idx(codec, led->idx, led->mask,
4290 on ? led->on : led->off);
4291}
4292
Kailang Yang431e76c2020-04-07 14:40:20 +08004293/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004294static int coef_mute_led_set(struct led_classdev *led_cdev,
4295 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004296{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004297 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004298 struct alc_spec *spec = codec->spec;
4299
Takashi Iwai766538a2020-06-18 13:08:41 +02004300 alc_update_coef_led(codec, &spec->mute_led_coef,
4301 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004302 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004303}
4304
4305static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4306 const struct hda_fixup *fix,
4307 int action)
4308{
4309 struct alc_spec *spec = codec->spec;
4310
4311 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4312 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004313 spec->mute_led_coef.idx = 0x0b;
4314 spec->mute_led_coef.mask = 1 << 3;
4315 spec->mute_led_coef.on = 1 << 3;
4316 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004317 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004318 }
4319}
4320
Kailang Yang24164f42020-04-07 14:52:42 +08004321static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4322 const struct hda_fixup *fix,
4323 int action)
4324{
4325 struct alc_spec *spec = codec->spec;
4326
4327 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4328 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004329 spec->mute_led_coef.idx = 0x34;
4330 spec->mute_led_coef.mask = 1 << 5;
4331 spec->mute_led_coef.on = 0;
4332 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004333 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004334 }
4335}
4336
Kailang Yang431e76c2020-04-07 14:40:20 +08004337/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004338static int coef_micmute_led_set(struct led_classdev *led_cdev,
4339 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004340{
Takashi Iwai8a503552020-06-18 13:08:32 +02004341 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004342 struct alc_spec *spec = codec->spec;
4343
Takashi Iwai766538a2020-06-18 13:08:41 +02004344 alc_update_coef_led(codec, &spec->mic_led_coef,
4345 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004346 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004347}
4348
4349static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4350 const struct hda_fixup *fix, int action)
4351{
4352 struct alc_spec *spec = codec->spec;
4353
4354 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004355 spec->mic_led_coef.idx = 0x19;
4356 spec->mic_led_coef.mask = 1 << 13;
4357 spec->mic_led_coef.on = 1 << 13;
4358 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004359 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004360 }
4361}
4362
Kailang Yang24164f42020-04-07 14:52:42 +08004363static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4364 const struct hda_fixup *fix, int action)
4365{
4366 struct alc_spec *spec = codec->spec;
4367
4368 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004369 spec->mic_led_coef.idx = 0x35;
4370 spec->mic_led_coef.mask = 3 << 2;
4371 spec->mic_led_coef.on = 2 << 2;
4372 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004373 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004374 }
4375}
4376
Kailang Yang431e76c2020-04-07 14:40:20 +08004377static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4378 const struct hda_fixup *fix, int action)
4379{
4380 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4381 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4382}
4383
Kailang Yang24164f42020-04-07 14:52:42 +08004384static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4385 const struct hda_fixup *fix, int action)
4386{
4387 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4388 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4389}
4390
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004391#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004392static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4393 struct hda_jack_callback *event)
4394{
4395 struct alc_spec *spec = codec->spec;
4396
4397 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4398 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004399 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004400 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004401 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004402 input_sync(spec->kb_dev);
4403}
David Henningsson33f4acd2015-01-07 15:50:13 +01004404
Kailang3694cb22015-12-28 11:35:24 +08004405static int alc_register_micmute_input_device(struct hda_codec *codec)
4406{
4407 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004408 int i;
Kailang3694cb22015-12-28 11:35:24 +08004409
4410 spec->kb_dev = input_allocate_device();
4411 if (!spec->kb_dev) {
4412 codec_err(codec, "Out of memory (input_allocate_device)\n");
4413 return -ENOMEM;
4414 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004415
4416 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4417
Kailang3694cb22015-12-28 11:35:24 +08004418 spec->kb_dev->name = "Microphone Mute Button";
4419 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004420 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4421 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4422 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4423 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4424 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004425
4426 if (input_register_device(spec->kb_dev)) {
4427 codec_err(codec, "input_register_device failed\n");
4428 input_free_device(spec->kb_dev);
4429 spec->kb_dev = NULL;
4430 return -ENOMEM;
4431 }
4432
4433 return 0;
4434}
4435
Takashi Iwai01e4a272018-06-19 22:47:30 +02004436/* GPIO1 = set according to SKU external amp
4437 * GPIO2 = mic mute hotkey
4438 * GPIO3 = mute LED
4439 * GPIO4 = mic mute LED
4440 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004441static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4442 const struct hda_fixup *fix, int action)
4443{
David Henningsson33f4acd2015-01-07 15:50:13 +01004444 struct alc_spec *spec = codec->spec;
4445
Takashi Iwai01e4a272018-06-19 22:47:30 +02004446 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004447 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004448 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004449 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004450 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004451
Takashi Iwai01e4a272018-06-19 22:47:30 +02004452 spec->gpio_mask |= 0x06;
4453 spec->gpio_dir |= 0x02;
4454 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004455 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004456 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004457 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004458 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004459 return;
4460 }
4461
4462 if (!spec->kb_dev)
4463 return;
4464
4465 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004466 case HDA_FIXUP_ACT_FREE:
4467 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004468 spec->kb_dev = NULL;
4469 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004470}
4471
Takashi Iwai01e4a272018-06-19 22:47:30 +02004472/* Line2 = mic mute hotkey
4473 * GPIO2 = mic mute LED
4474 */
Kailang3694cb22015-12-28 11:35:24 +08004475static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4476 const struct hda_fixup *fix, int action)
4477{
Kailang3694cb22015-12-28 11:35:24 +08004478 struct alc_spec *spec = codec->spec;
4479
Takashi Iwai01e4a272018-06-19 22:47:30 +02004480 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004481 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004482 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004483 if (alc_register_micmute_input_device(codec) != 0)
4484 return;
4485
Kailang3694cb22015-12-28 11:35:24 +08004486 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4487 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004488 return;
4489 }
4490
4491 if (!spec->kb_dev)
4492 return;
4493
4494 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004495 case HDA_FIXUP_ACT_FREE:
4496 input_unregister_device(spec->kb_dev);
4497 spec->kb_dev = NULL;
4498 }
4499}
Takashi Iwaic4696522018-01-15 10:44:35 +01004500#else /* INPUT */
4501#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4502#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4503#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004504
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004505static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4506 const struct hda_fixup *fix, int action)
4507{
4508 struct alc_spec *spec = codec->spec;
4509
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004510 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004511 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004512 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004513 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004514 }
4515}
4516
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004517static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004518 UPDATE_COEF(0x4a, 1<<8, 0),
4519 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4520 UPDATE_COEF(0x63, 3<<14, 3<<14),
4521 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4522 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4523 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4524 UPDATE_COEF(0x4a, 3<<10, 0),
4525 {}
4526};
4527
David Henningsson73bdd592013-04-15 15:44:14 +02004528static void alc_headset_mode_unplugged(struct hda_codec *codec)
4529{
Kailang Yang92666d42020-11-19 17:04:21 +08004530 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004531 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004532 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004533 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4534 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4535 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4536 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4537 {}
4538 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004539 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004540 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004541 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4542 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4543 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4544 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004545 {}
4546 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004547 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004548 WRITE_COEF(0x1b, 0x0c0b),
4549 WRITE_COEF(0x45, 0xc429),
4550 UPDATE_COEF(0x35, 0x4000, 0),
4551 WRITE_COEF(0x06, 0x2104),
4552 WRITE_COEF(0x1a, 0x0001),
4553 WRITE_COEF(0x26, 0x0004),
4554 WRITE_COEF(0x32, 0x42a3),
4555 {}
4556 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004557 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004558 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4559 UPDATE_COEF(0x50, 0x2000, 0x2000),
4560 UPDATE_COEF(0x56, 0x0006, 0x0006),
4561 UPDATE_COEF(0x66, 0x0008, 0),
4562 UPDATE_COEF(0x67, 0x2000, 0),
4563 {}
4564 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004565 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004566 UPDATE_COEF(0x19, 0x1300, 0x0300),
4567 {}
4568 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004569 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004570 WRITE_COEF(0x76, 0x000e),
4571 WRITE_COEF(0x6c, 0x2400),
4572 WRITE_COEF(0x18, 0x7308),
4573 WRITE_COEF(0x6b, 0xc429),
4574 {}
4575 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004576 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004577 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4578 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4579 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4580 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4581 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4582 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4583 {}
4584 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004585 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004586 WRITE_COEF(0x15, 0x0d40),
4587 WRITE_COEF(0xb7, 0x802b),
4588 {}
4589 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004590 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004591 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004592 {}
4593 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004594 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004595 UPDATE_COEF(0x4a, 0x0100, 0),
4596 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4597 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4598 UPDATE_COEF(0x4a, 0x0010, 0),
4599 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4600 WRITE_COEF(0x45, 0x5289),
4601 UPDATE_COEF(0x4a, 0x0c00, 0),
4602 {}
4603 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004604
Kailang Yang92666d42020-11-19 17:04:21 +08004605 if (spec->no_internal_mic_pin) {
4606 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4607 return;
4608 }
4609
Takashi Iwai7639a062015-03-03 10:07:24 +01004610 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004611 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004612 alc_process_coef_fw(codec, coef0255);
4613 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004614 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004615 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004616 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004617 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004618 case 0x10ec0234:
4619 case 0x10ec0274:
4620 case 0x10ec0294:
4621 alc_process_coef_fw(codec, coef0274);
4622 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004623 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004624 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004625 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004626 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004627 case 0x10ec0286:
4628 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004629 alc_process_coef_fw(codec, coef0288);
4630 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004631 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004632 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004633 alc_process_coef_fw(codec, coef0288);
4634 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004635 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004636 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004637 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004638 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004639 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004640 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004641 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004642 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004643 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004644 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004645 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004646 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004647 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004648 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004649 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004650 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004651 alc_process_coef_fw(codec, coef0225);
4652 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004653 case 0x10ec0867:
4654 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4655 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004656 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004657 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004658}
4659
4660
4661static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4662 hda_nid_t mic_pin)
4663{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004664 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004665 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4666 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4667 {}
4668 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004669 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004670 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4671 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4672 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4673 {}
4674 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004675 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004676 UPDATE_COEF(0x35, 0, 1<<14),
4677 WRITE_COEF(0x06, 0x2100),
4678 WRITE_COEF(0x1a, 0x0021),
4679 WRITE_COEF(0x26, 0x008c),
4680 {}
4681 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004682 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004683 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004684 UPDATE_COEF(0x50, 0x2000, 0),
4685 UPDATE_COEF(0x56, 0x0006, 0),
4686 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4687 UPDATE_COEF(0x66, 0x0008, 0x0008),
4688 UPDATE_COEF(0x67, 0x2000, 0x2000),
4689 {}
4690 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004691 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004692 WRITE_COEF(0x19, 0xa208),
4693 WRITE_COEF(0x2e, 0xacf0),
4694 {}
4695 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004696 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004697 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4698 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4699 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4700 {}
4701 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004702 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004703 WRITE_COEF(0xb7, 0x802b),
4704 WRITE_COEF(0xb5, 0x1040),
4705 UPDATE_COEF(0xc3, 0, 1<<12),
4706 {}
4707 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004708 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004709 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4710 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4711 UPDATE_COEF(0x63, 3<<14, 0),
4712 {}
4713 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004714 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004715 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4716 UPDATE_COEF(0x4a, 0x0010, 0),
4717 UPDATE_COEF(0x6b, 0xf000, 0),
4718 {}
4719 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004720
Takashi Iwai7639a062015-03-03 10:07:24 +01004721 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004722 case 0x10ec0255:
4723 alc_write_coef_idx(codec, 0x45, 0xc489);
4724 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004725 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004726 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4727 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004728 case 0x10ec0236:
4729 case 0x10ec0256:
4730 alc_write_coef_idx(codec, 0x45, 0xc489);
4731 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4732 alc_process_coef_fw(codec, coef0256);
4733 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4734 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004735 case 0x10ec0234:
4736 case 0x10ec0274:
4737 case 0x10ec0294:
4738 alc_write_coef_idx(codec, 0x45, 0x4689);
4739 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4740 alc_process_coef_fw(codec, coef0274);
4741 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4742 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004743 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004744 case 0x10ec0283:
4745 alc_write_coef_idx(codec, 0x45, 0xc429);
4746 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004747 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004748 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4749 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004750 case 0x10ec0286:
4751 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004752 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004753 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4754 alc_process_coef_fw(codec, coef0288);
4755 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4756 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004757 case 0x10ec0292:
4758 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004759 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004760 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004761 case 0x10ec0293:
4762 /* Set to TRS mode */
4763 alc_write_coef_idx(codec, 0x45, 0xc429);
4764 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004765 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004766 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4767 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004768 case 0x10ec0867:
4769 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05004770 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004771 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004772 case 0x10ec0662:
4773 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4774 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4775 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004776 case 0x10ec0668:
4777 alc_write_coef_idx(codec, 0x11, 0x0001);
4778 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004779 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004780 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4781 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004782 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004783 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004784 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004785 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004786 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004787 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004788 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004789 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4790 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4791 alc_process_coef_fw(codec, coef0225);
4792 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4793 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004794 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004795 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004796}
4797
4798static void alc_headset_mode_default(struct hda_codec *codec)
4799{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004800 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004801 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4802 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4803 UPDATE_COEF(0x49, 3<<8, 0<<8),
4804 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4805 UPDATE_COEF(0x63, 3<<14, 0),
4806 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004807 {}
4808 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004809 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004810 WRITE_COEF(0x45, 0xc089),
4811 WRITE_COEF(0x45, 0xc489),
4812 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4813 WRITE_COEF(0x49, 0x0049),
4814 {}
4815 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004816 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004817 WRITE_COEF(0x45, 0xc489),
4818 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4819 WRITE_COEF(0x49, 0x0049),
4820 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4821 WRITE_COEF(0x06, 0x6100),
4822 {}
4823 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004824 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004825 WRITE_COEF(0x06, 0x2100),
4826 WRITE_COEF(0x32, 0x4ea3),
4827 {}
4828 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004829 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004830 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4831 UPDATE_COEF(0x50, 0x2000, 0x2000),
4832 UPDATE_COEF(0x56, 0x0006, 0x0006),
4833 UPDATE_COEF(0x66, 0x0008, 0),
4834 UPDATE_COEF(0x67, 0x2000, 0),
4835 {}
4836 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004837 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004838 WRITE_COEF(0x76, 0x000e),
4839 WRITE_COEF(0x6c, 0x2400),
4840 WRITE_COEF(0x6b, 0xc429),
4841 WRITE_COEF(0x18, 0x7308),
4842 {}
4843 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004844 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004845 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4846 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4847 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4848 {}
4849 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004850 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004851 WRITE_COEF(0x11, 0x0041),
4852 WRITE_COEF(0x15, 0x0d40),
4853 WRITE_COEF(0xb7, 0x802b),
4854 {}
4855 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004856 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004857 WRITE_COEF(0x45, 0x4289),
4858 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4859 UPDATE_COEF(0x6b, 0x0f00, 0),
4860 UPDATE_COEF(0x49, 0x0300, 0x0300),
4861 {}
4862 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004863
Takashi Iwai7639a062015-03-03 10:07:24 +01004864 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004865 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004866 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004867 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004868 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004869 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004870 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004871 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004872 alc_process_coef_fw(codec, coef0225);
4873 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004874 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004875 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004876 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004877 case 0x10ec0236:
4878 case 0x10ec0256:
4879 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4880 alc_write_coef_idx(codec, 0x45, 0xc089);
4881 msleep(50);
4882 alc_process_coef_fw(codec, coef0256);
4883 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004884 case 0x10ec0234:
4885 case 0x10ec0274:
4886 case 0x10ec0294:
4887 alc_process_coef_fw(codec, coef0274);
4888 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004889 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004890 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004891 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004892 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004893 case 0x10ec0286:
4894 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004895 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004896 alc_process_coef_fw(codec, coef0288);
4897 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004898 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004899 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004900 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004901 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004902 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004903 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004904 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004905 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004906 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004907 case 0x10ec0867:
4908 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4909 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004910 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004911 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004912}
4913
4914/* Iphone type */
4915static void alc_headset_mode_ctia(struct hda_codec *codec)
4916{
Kailang Yang89542932017-07-17 15:03:43 +08004917 int val;
4918
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004919 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004920 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4921 WRITE_COEF(0x1b, 0x0c2b),
4922 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4923 {}
4924 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004925 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004926 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08004927 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08004928 {}
4929 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004930 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004931 WRITE_COEF(0x45, 0xd429),
4932 WRITE_COEF(0x1b, 0x0c2b),
4933 WRITE_COEF(0x32, 0x4ea3),
4934 {}
4935 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004936 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004937 UPDATE_COEF(0x50, 0x2000, 0x2000),
4938 UPDATE_COEF(0x56, 0x0006, 0x0006),
4939 UPDATE_COEF(0x66, 0x0008, 0),
4940 UPDATE_COEF(0x67, 0x2000, 0),
4941 {}
4942 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004943 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004944 WRITE_COEF(0x6b, 0xd429),
4945 WRITE_COEF(0x76, 0x0008),
4946 WRITE_COEF(0x18, 0x7388),
4947 {}
4948 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004949 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004950 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4951 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4952 {}
4953 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004954 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004955 WRITE_COEF(0x11, 0x0001),
4956 WRITE_COEF(0x15, 0x0d60),
4957 WRITE_COEF(0xc3, 0x0000),
4958 {}
4959 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004960 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004961 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004962 UPDATE_COEF(0x63, 3<<14, 2<<14),
4963 {}
4964 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004965 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004966 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4967 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004968 {}
4969 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004970
Takashi Iwai7639a062015-03-03 10:07:24 +01004971 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004972 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004973 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004974 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004975 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004976 case 0x10ec0256:
4977 alc_process_coef_fw(codec, coef0256);
4978 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004979 case 0x10ec0234:
4980 case 0x10ec0274:
4981 case 0x10ec0294:
4982 alc_write_coef_idx(codec, 0x45, 0xd689);
4983 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004984 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004985 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004986 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004987 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004988 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004989 val = alc_read_coef_idx(codec, 0x50);
4990 if (val & (1 << 12)) {
4991 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4992 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4993 msleep(300);
4994 } else {
4995 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4996 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4997 msleep(300);
4998 }
4999 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005000 case 0x10ec0286:
5001 case 0x10ec0288:
5002 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5003 msleep(300);
5004 alc_process_coef_fw(codec, coef0288);
5005 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005006 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005007 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005008 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005009 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005010 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005011 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005012 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005013 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005014 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005015 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005016 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005017 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005018 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005019 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005020 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005021 val = alc_read_coef_idx(codec, 0x45);
5022 if (val & (1 << 9))
5023 alc_process_coef_fw(codec, coef0225_2);
5024 else
5025 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005026 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005027 case 0x10ec0867:
5028 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5029 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005030 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005031 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005032}
5033
5034/* Nokia type */
5035static void alc_headset_mode_omtp(struct hda_codec *codec)
5036{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005037 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005038 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5039 WRITE_COEF(0x1b, 0x0c2b),
5040 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5041 {}
5042 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005043 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005044 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005045 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005046 {}
5047 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005048 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005049 WRITE_COEF(0x45, 0xe429),
5050 WRITE_COEF(0x1b, 0x0c2b),
5051 WRITE_COEF(0x32, 0x4ea3),
5052 {}
5053 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005054 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005055 UPDATE_COEF(0x50, 0x2000, 0x2000),
5056 UPDATE_COEF(0x56, 0x0006, 0x0006),
5057 UPDATE_COEF(0x66, 0x0008, 0),
5058 UPDATE_COEF(0x67, 0x2000, 0),
5059 {}
5060 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005061 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005062 WRITE_COEF(0x6b, 0xe429),
5063 WRITE_COEF(0x76, 0x0008),
5064 WRITE_COEF(0x18, 0x7388),
5065 {}
5066 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005067 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005068 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5069 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5070 {}
5071 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005072 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005073 WRITE_COEF(0x11, 0x0001),
5074 WRITE_COEF(0x15, 0x0d50),
5075 WRITE_COEF(0xc3, 0x0000),
5076 {}
5077 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005078 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005079 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005080 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005081 {}
5082 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005083
Takashi Iwai7639a062015-03-03 10:07:24 +01005084 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005085 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005086 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005087 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005088 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005089 case 0x10ec0256:
5090 alc_process_coef_fw(codec, coef0256);
5091 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005092 case 0x10ec0234:
5093 case 0x10ec0274:
5094 case 0x10ec0294:
5095 alc_write_coef_idx(codec, 0x45, 0xe689);
5096 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005097 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005098 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005099 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005100 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005101 case 0x10ec0298:
5102 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005103 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5104 msleep(300);
5105 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005106 case 0x10ec0286:
5107 case 0x10ec0288:
5108 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5109 msleep(300);
5110 alc_process_coef_fw(codec, coef0288);
5111 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005112 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005113 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005114 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005115 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005116 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005117 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005118 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005119 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005120 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005121 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005122 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005123 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005124 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005125 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005126 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005127 alc_process_coef_fw(codec, coef0225);
5128 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005129 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005130 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005131}
5132
5133static void alc_determine_headset_type(struct hda_codec *codec)
5134{
5135 int val;
5136 bool is_ctia = false;
5137 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005138 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005139 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5140 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5141 conteol) */
5142 {}
5143 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005144 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005145 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5146 {}
5147 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005148 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005149 UPDATE_COEF(0x50, 0x2000, 0x2000),
5150 UPDATE_COEF(0x56, 0x0006, 0x0006),
5151 UPDATE_COEF(0x66, 0x0008, 0),
5152 UPDATE_COEF(0x67, 0x2000, 0),
5153 UPDATE_COEF(0x19, 0x1300, 0x1300),
5154 {}
5155 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005156 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005157 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5158 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5159 {}
5160 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005161 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005162 WRITE_COEF(0x11, 0x0001),
5163 WRITE_COEF(0xb7, 0x802b),
5164 WRITE_COEF(0x15, 0x0d60),
5165 WRITE_COEF(0xc3, 0x0c00),
5166 {}
5167 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005168 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005169 UPDATE_COEF(0x4a, 0x0010, 0),
5170 UPDATE_COEF(0x4a, 0x8000, 0),
5171 WRITE_COEF(0x45, 0xd289),
5172 UPDATE_COEF(0x49, 0x0300, 0x0300),
5173 {}
5174 };
David Henningsson73bdd592013-04-15 15:44:14 +02005175
Kailang Yang92666d42020-11-19 17:04:21 +08005176 if (spec->no_internal_mic_pin) {
5177 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5178 return;
5179 }
5180
Takashi Iwai7639a062015-03-03 10:07:24 +01005181 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005182 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005183 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005184 msleep(300);
5185 val = alc_read_coef_idx(codec, 0x46);
5186 is_ctia = (val & 0x0070) == 0x0070;
5187 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08005188 case 0x10ec0236:
5189 case 0x10ec0256:
5190 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5191 alc_write_coef_idx(codec, 0x06, 0x6104);
5192 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5193
5194 snd_hda_codec_write(codec, 0x21, 0,
5195 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5196 msleep(80);
5197 snd_hda_codec_write(codec, 0x21, 0,
5198 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5199
5200 alc_process_coef_fw(codec, coef0255);
5201 msleep(300);
5202 val = alc_read_coef_idx(codec, 0x46);
5203 is_ctia = (val & 0x0070) == 0x0070;
5204
5205 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5206 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5207
5208 snd_hda_codec_write(codec, 0x21, 0,
5209 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5210 msleep(80);
5211 snd_hda_codec_write(codec, 0x21, 0,
5212 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5213 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005214 case 0x10ec0234:
5215 case 0x10ec0274:
5216 case 0x10ec0294:
5217 alc_process_coef_fw(codec, coef0274);
5218 msleep(80);
5219 val = alc_read_coef_idx(codec, 0x46);
5220 is_ctia = (val & 0x00f0) == 0x00f0;
5221 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005222 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005223 case 0x10ec0283:
5224 alc_write_coef_idx(codec, 0x45, 0xd029);
5225 msleep(300);
5226 val = alc_read_coef_idx(codec, 0x46);
5227 is_ctia = (val & 0x0070) == 0x0070;
5228 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005229 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005230 snd_hda_codec_write(codec, 0x21, 0,
5231 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5232 msleep(100);
5233 snd_hda_codec_write(codec, 0x21, 0,
5234 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5235 msleep(200);
5236
5237 val = alc_read_coef_idx(codec, 0x50);
5238 if (val & (1 << 12)) {
5239 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5240 alc_process_coef_fw(codec, coef0288);
5241 msleep(350);
5242 val = alc_read_coef_idx(codec, 0x50);
5243 is_ctia = (val & 0x0070) == 0x0070;
5244 } else {
5245 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5246 alc_process_coef_fw(codec, coef0288);
5247 msleep(350);
5248 val = alc_read_coef_idx(codec, 0x50);
5249 is_ctia = (val & 0x0070) == 0x0070;
5250 }
5251 alc_process_coef_fw(codec, coef0298);
5252 snd_hda_codec_write(codec, 0x21, 0,
5253 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5254 msleep(75);
5255 snd_hda_codec_write(codec, 0x21, 0,
5256 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5257 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005258 case 0x10ec0286:
5259 case 0x10ec0288:
5260 alc_process_coef_fw(codec, coef0288);
5261 msleep(350);
5262 val = alc_read_coef_idx(codec, 0x50);
5263 is_ctia = (val & 0x0070) == 0x0070;
5264 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005265 case 0x10ec0292:
5266 alc_write_coef_idx(codec, 0x6b, 0xd429);
5267 msleep(300);
5268 val = alc_read_coef_idx(codec, 0x6c);
5269 is_ctia = (val & 0x001c) == 0x001c;
5270 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005271 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005272 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005273 msleep(300);
5274 val = alc_read_coef_idx(codec, 0x46);
5275 is_ctia = (val & 0x0070) == 0x0070;
5276 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005277 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005278 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005279 msleep(300);
5280 val = alc_read_coef_idx(codec, 0xbe);
5281 is_ctia = (val & 0x1c02) == 0x1c02;
5282 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005283 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005284 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005285 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005286 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005287 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005288 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005289 snd_hda_codec_write(codec, 0x21, 0,
5290 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5291 msleep(80);
5292 snd_hda_codec_write(codec, 0x21, 0,
5293 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5294
Kailang Yang5a367672017-07-21 15:23:53 +08005295 alc_process_coef_fw(codec, alc225_pre_hsmode);
5296 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5297 val = alc_read_coef_idx(codec, 0x45);
5298 if (val & (1 << 9)) {
5299 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5300 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5301 msleep(800);
5302 val = alc_read_coef_idx(codec, 0x46);
5303 is_ctia = (val & 0x00f0) == 0x00f0;
5304 } else {
5305 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5306 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5307 msleep(800);
5308 val = alc_read_coef_idx(codec, 0x46);
5309 is_ctia = (val & 0x00f0) == 0x00f0;
5310 }
5311 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5312 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5313 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005314
5315 snd_hda_codec_write(codec, 0x21, 0,
5316 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5317 msleep(80);
5318 snd_hda_codec_write(codec, 0x21, 0,
5319 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005320 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005321 case 0x10ec0867:
5322 is_ctia = true;
5323 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005324 }
5325
Takashi Iwai4e76a882014-02-25 12:21:03 +01005326 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005327 is_ctia ? "yes" : "no");
5328 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5329}
5330
5331static void alc_update_headset_mode(struct hda_codec *codec)
5332{
5333 struct alc_spec *spec = codec->spec;
5334
5335 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005336 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005337
5338 int new_headset_mode;
5339
5340 if (!snd_hda_jack_detect(codec, hp_pin))
5341 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5342 else if (mux_pin == spec->headset_mic_pin)
5343 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5344 else if (mux_pin == spec->headphone_mic_pin)
5345 new_headset_mode = ALC_HEADSET_MODE_MIC;
5346 else
5347 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5348
David Henningsson5959a6b2013-11-12 11:10:57 +01005349 if (new_headset_mode == spec->current_headset_mode) {
5350 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005351 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005352 }
David Henningsson73bdd592013-04-15 15:44:14 +02005353
5354 switch (new_headset_mode) {
5355 case ALC_HEADSET_MODE_UNPLUGGED:
5356 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005357 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5358 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005359 spec->gen.hp_jack_present = false;
5360 break;
5361 case ALC_HEADSET_MODE_HEADSET:
5362 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5363 alc_determine_headset_type(codec);
5364 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5365 alc_headset_mode_ctia(codec);
5366 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5367 alc_headset_mode_omtp(codec);
5368 spec->gen.hp_jack_present = true;
5369 break;
5370 case ALC_HEADSET_MODE_MIC:
5371 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5372 spec->gen.hp_jack_present = false;
5373 break;
5374 case ALC_HEADSET_MODE_HEADPHONE:
5375 alc_headset_mode_default(codec);
5376 spec->gen.hp_jack_present = true;
5377 break;
5378 }
5379 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5380 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5381 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005382 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005383 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5384 PIN_VREFHIZ);
5385 }
5386 spec->current_headset_mode = new_headset_mode;
5387
5388 snd_hda_gen_update_outputs(codec);
5389}
5390
5391static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005392 struct snd_kcontrol *kcontrol,
5393 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005394{
5395 alc_update_headset_mode(codec);
5396}
5397
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005398static void alc_update_headset_jack_cb(struct hda_codec *codec,
5399 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005400{
David Henningsson73bdd592013-04-15 15:44:14 +02005401 snd_hda_gen_hp_automute(codec, jack);
5402}
5403
5404static void alc_probe_headset_mode(struct hda_codec *codec)
5405{
5406 int i;
5407 struct alc_spec *spec = codec->spec;
5408 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5409
5410 /* Find mic pins */
5411 for (i = 0; i < cfg->num_inputs; i++) {
5412 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5413 spec->headset_mic_pin = cfg->inputs[i].pin;
5414 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5415 spec->headphone_mic_pin = cfg->inputs[i].pin;
5416 }
5417
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005418 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005419 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5420 spec->gen.automute_hook = alc_update_headset_mode;
5421 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5422}
5423
5424static void alc_fixup_headset_mode(struct hda_codec *codec,
5425 const struct hda_fixup *fix, int action)
5426{
5427 struct alc_spec *spec = codec->spec;
5428
5429 switch (action) {
5430 case HDA_FIXUP_ACT_PRE_PROBE:
5431 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5432 break;
5433 case HDA_FIXUP_ACT_PROBE:
5434 alc_probe_headset_mode(codec);
5435 break;
5436 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005437 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5438 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5439 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5440 }
David Henningsson73bdd592013-04-15 15:44:14 +02005441 alc_update_headset_mode(codec);
5442 break;
5443 }
5444}
5445
5446static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5447 const struct hda_fixup *fix, int action)
5448{
5449 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5450 struct alc_spec *spec = codec->spec;
5451 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5452 }
5453 else
5454 alc_fixup_headset_mode(codec, fix, action);
5455}
5456
Kailang Yang31278992014-03-03 15:27:22 +08005457static void alc255_set_default_jack_type(struct hda_codec *codec)
5458{
5459 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005460 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005461 WRITE_COEF(0x1b, 0x880b),
5462 WRITE_COEF(0x45, 0xd089),
5463 WRITE_COEF(0x1b, 0x080b),
5464 WRITE_COEF(0x46, 0x0004),
5465 WRITE_COEF(0x1b, 0x0c0b),
5466 {}
5467 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005468 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005469 WRITE_COEF(0x1b, 0x884b),
5470 WRITE_COEF(0x45, 0xd089),
5471 WRITE_COEF(0x1b, 0x084b),
5472 WRITE_COEF(0x46, 0x0004),
5473 WRITE_COEF(0x1b, 0x0c4b),
5474 {}
5475 };
5476 switch (codec->core.vendor_id) {
5477 case 0x10ec0255:
5478 alc_process_coef_fw(codec, alc255fw);
5479 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005480 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005481 case 0x10ec0256:
5482 alc_process_coef_fw(codec, alc256fw);
5483 break;
5484 }
Kailang Yang31278992014-03-03 15:27:22 +08005485 msleep(30);
5486}
5487
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005488static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5489 const struct hda_fixup *fix, int action)
5490{
5491 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005492 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005493 }
5494 alc_fixup_headset_mode(codec, fix, action);
5495}
5496
Kailang Yang31278992014-03-03 15:27:22 +08005497static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5498 const struct hda_fixup *fix, int action)
5499{
5500 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5501 struct alc_spec *spec = codec->spec;
5502 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5503 alc255_set_default_jack_type(codec);
5504 }
5505 else
5506 alc_fixup_headset_mode(codec, fix, action);
5507}
5508
Kailang Yange1e62b92015-04-08 16:01:22 +08005509static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5510 struct hda_jack_callback *jack)
5511{
5512 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005513
5514 alc_update_headset_jack_cb(codec, jack);
5515 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005516 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005517}
5518
5519static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5520 const struct hda_fixup *fix, int action)
5521{
5522 alc_fixup_headset_mode(codec, fix, action);
5523 if (action == HDA_FIXUP_ACT_PROBE) {
5524 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005525 /* toggled via hp_automute_hook */
5526 spec->gpio_mask |= 0x40;
5527 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005528 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5529 }
5530}
5531
Hui Wang493a52a2014-01-14 14:07:36 +08005532static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5533 const struct hda_fixup *fix, int action)
5534{
5535 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5536 struct alc_spec *spec = codec->spec;
5537 spec->gen.auto_mute_via_amp = 1;
5538 }
5539}
5540
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005541static void alc_fixup_no_shutup(struct hda_codec *codec,
5542 const struct hda_fixup *fix, int action)
5543{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005544 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005545 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005546 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005547 }
5548}
5549
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005550static void alc_fixup_disable_aamix(struct hda_codec *codec,
5551 const struct hda_fixup *fix, int action)
5552{
5553 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5554 struct alc_spec *spec = codec->spec;
5555 /* Disable AA-loopback as it causes white noise */
5556 spec->gen.mixer_nid = 0;
5557 }
5558}
5559
Takashi Iwai7f57d802015-09-24 17:36:51 +02005560/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5561static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5562 const struct hda_fixup *fix, int action)
5563{
5564 static const struct hda_pintbl pincfgs[] = {
5565 { 0x16, 0x21211010 }, /* dock headphone */
5566 { 0x19, 0x21a11010 }, /* dock mic */
5567 { }
5568 };
5569 struct alc_spec *spec = codec->spec;
5570
5571 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Hui Wang871b9062019-08-14 12:09:08 +08005572 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02005573 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5574 codec->power_save_node = 0; /* avoid click noises */
5575 snd_hda_apply_pincfgs(codec, pincfgs);
5576 }
5577}
5578
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005579static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5580 const struct hda_fixup *fix, int action)
5581{
5582 static const struct hda_pintbl pincfgs[] = {
5583 { 0x17, 0x21211010 }, /* dock headphone */
5584 { 0x19, 0x21a11010 }, /* dock mic */
5585 { }
5586 };
5587 struct alc_spec *spec = codec->spec;
5588
5589 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5590 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005591 snd_hda_apply_pincfgs(codec, pincfgs);
5592 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005593 /* Enable DOCK device */
5594 snd_hda_codec_write(codec, 0x17, 0,
5595 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5596 /* Enable DOCK device */
5597 snd_hda_codec_write(codec, 0x19, 0,
5598 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005599 }
5600}
5601
Takashi Iwai399c01a2020-05-26 08:24:06 +02005602static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5603 const struct hda_fixup *fix, int action)
5604{
5605 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5606 * the speaker output becomes too low by some reason on Thinkpads with
5607 * ALC298 codec
5608 */
5609 static const hda_nid_t preferred_pairs[] = {
5610 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5611 0
5612 };
5613 struct alc_spec *spec = codec->spec;
5614
5615 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5616 spec->gen.preferred_dacs = preferred_pairs;
5617}
5618
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005619static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005620{
5621 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005622 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005623
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005624 /* Prevent pop noises when headphones are plugged in */
5625 snd_hda_codec_write(codec, hp_pin, 0,
5626 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5627 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005628}
5629
5630static void alc_fixup_dell_xps13(struct hda_codec *codec,
5631 const struct hda_fixup *fix, int action)
5632{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005633 struct alc_spec *spec = codec->spec;
5634 struct hda_input_mux *imux = &spec->gen.input_mux;
5635 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005636
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005637 switch (action) {
5638 case HDA_FIXUP_ACT_PRE_PROBE:
5639 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5640 * it causes a click noise at start up
5641 */
5642 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005643 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005644 break;
5645 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005646 /* Make the internal mic the default input source. */
5647 for (i = 0; i < imux->num_items; i++) {
5648 if (spec->gen.imux_pins[i] == 0x12) {
5649 spec->gen.cur_mux[0] = i;
5650 break;
5651 }
5652 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005653 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005654 }
5655}
5656
David Henningsson1f8b46c2015-05-12 14:38:15 +02005657static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5658 const struct hda_fixup *fix, int action)
5659{
5660 struct alc_spec *spec = codec->spec;
5661
5662 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5663 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5664 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005665
5666 /* Disable boost for mic-in permanently. (This code is only called
5667 from quirks that guarantee that the headphone is at NID 0x1b.) */
5668 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5669 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005670 } else
5671 alc_fixup_headset_mode(codec, fix, action);
5672}
5673
David Henningsson73bdd592013-04-15 15:44:14 +02005674static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5675 const struct hda_fixup *fix, int action)
5676{
5677 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005678 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005679 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005680 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5681 }
5682 alc_fixup_headset_mode(codec, fix, action);
5683}
5684
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005685/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5686static int find_ext_mic_pin(struct hda_codec *codec)
5687{
5688 struct alc_spec *spec = codec->spec;
5689 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5690 hda_nid_t nid;
5691 unsigned int defcfg;
5692 int i;
5693
5694 for (i = 0; i < cfg->num_inputs; i++) {
5695 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5696 continue;
5697 nid = cfg->inputs[i].pin;
5698 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5699 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5700 continue;
5701 return nid;
5702 }
5703
5704 return 0;
5705}
5706
Dylan Reid08a978d2012-11-18 22:56:40 -08005707static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005708 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005709 int action)
5710{
5711 struct alc_spec *spec = codec->spec;
5712
Takashi Iwai0db75792013-01-23 13:57:20 +01005713 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005714 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005715 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005716
5717 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005718 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005719 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005720 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005721}
David Henningsson693b6132012-06-22 19:12:10 +02005722
David Henningsson3e0d6112013-04-22 14:30:14 +02005723static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5724 const struct hda_fixup *fix,
5725 int action)
5726{
5727 struct alc_spec *spec = codec->spec;
5728 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5729 int i;
5730
5731 /* The mic boosts on level 2 and 3 are too noisy
5732 on the internal mic input.
5733 Therefore limit the boost to 0 or 1. */
5734
5735 if (action != HDA_FIXUP_ACT_PROBE)
5736 return;
5737
5738 for (i = 0; i < cfg->num_inputs; i++) {
5739 hda_nid_t nid = cfg->inputs[i].pin;
5740 unsigned int defcfg;
5741 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5742 continue;
5743 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5744 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5745 continue;
5746
5747 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5748 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5749 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5750 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5751 (0 << AC_AMPCAP_MUTE_SHIFT));
5752 }
5753}
5754
Kailang Yangcd217a62013-08-22 10:15:24 +02005755static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005756 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005757{
5758 struct alc_spec *spec = codec->spec;
5759 int vref;
5760
5761 msleep(200);
5762 snd_hda_gen_hp_automute(codec, jack);
5763
5764 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5765
5766 msleep(600);
5767 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5768 vref);
5769}
5770
Kailang Yangcd217a62013-08-22 10:15:24 +02005771static void alc283_fixup_chromebook(struct hda_codec *codec,
5772 const struct hda_fixup *fix, int action)
5773{
5774 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005775
5776 switch (action) {
5777 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005778 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005779 /* Disable AA-loopback as it causes white noise */
5780 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005781 break;
5782 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005783 /* MIC2-VREF control */
5784 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005785 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005786 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005787 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005788 break;
5789 }
5790}
5791
5792static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5793 const struct hda_fixup *fix, int action)
5794{
5795 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005796
5797 switch (action) {
5798 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005799 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5800 break;
5801 case HDA_FIXUP_ACT_INIT:
5802 /* MIC2-VREF control */
5803 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005804 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005805 break;
5806 }
5807}
5808
Takashi Iwai7bba2152013-09-06 15:45:38 +02005809/* mute tablet speaker pin (0x14) via dock plugging in addition */
5810static void asus_tx300_automute(struct hda_codec *codec)
5811{
5812 struct alc_spec *spec = codec->spec;
5813 snd_hda_gen_update_outputs(codec);
5814 if (snd_hda_jack_detect(codec, 0x1b))
5815 spec->gen.mute_bits |= (1ULL << 0x14);
5816}
5817
5818static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5819 const struct hda_fixup *fix, int action)
5820{
5821 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005822 static const struct hda_pintbl dock_pins[] = {
5823 { 0x1b, 0x21114000 }, /* dock speaker pin */
5824 {}
5825 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005826
5827 switch (action) {
5828 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005829 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02005830 /* TX300 needs to set up GPIO2 for the speaker amp */
5831 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02005832 snd_hda_apply_pincfgs(codec, dock_pins);
5833 spec->gen.auto_mute_via_amp = 1;
5834 spec->gen.automute_hook = asus_tx300_automute;
5835 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005836 snd_hda_gen_hp_automute);
5837 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005838 case HDA_FIXUP_ACT_PROBE:
5839 spec->init_amp = ALC_INIT_DEFAULT;
5840 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005841 case HDA_FIXUP_ACT_BUILD:
5842 /* this is a bit tricky; give more sane names for the main
5843 * (tablet) speaker and the dock speaker, respectively
5844 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005845 rename_ctl(codec, "Speaker Playback Switch",
5846 "Dock Speaker Playback Switch");
5847 rename_ctl(codec, "Bass Speaker Playback Switch",
5848 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005849 break;
5850 }
5851}
5852
David Henningsson338cae52013-10-07 10:39:59 +02005853static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5854 const struct hda_fixup *fix, int action)
5855{
David Henningsson0f4881d2013-12-20 16:08:13 +01005856 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5857 /* DAC node 0x03 is giving mono output. We therefore want to
5858 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5859 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005860 static const hda_nid_t conn1[] = { 0x0c };
5861 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
5862 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01005863 }
David Henningsson338cae52013-10-07 10:39:59 +02005864}
5865
Hui Wangdd9aa332016-08-01 10:20:32 +08005866static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5867 const struct hda_fixup *fix, int action)
5868{
5869 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5870 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5871 we can't adjust the speaker's volume since this node does not has
5872 Amp-out capability. we change the speaker's route to:
5873 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5874 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5875 speaker's volume now. */
5876
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005877 static const hda_nid_t conn1[] = { 0x0c };
5878 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08005879 }
5880}
5881
Takashi Iwaie312a862018-03-06 12:14:17 +01005882/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5883static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5884 const struct hda_fixup *fix, int action)
5885{
5886 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005887 static const hda_nid_t conn[] = { 0x02, 0x03 };
5888 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01005889 }
5890}
5891
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01005892/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
5893static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
5894 const struct hda_fixup *fix, int action)
5895{
5896 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01005897 static const hda_nid_t conn[] = { 0x02 };
5898 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01005899 }
5900}
5901
Keith Packard98973f22015-07-15 12:14:39 -07005902/* Hook to update amp GPIO4 for automute */
5903static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5904 struct hda_jack_callback *jack)
5905{
5906 struct alc_spec *spec = codec->spec;
5907
5908 snd_hda_gen_hp_automute(codec, jack);
5909 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08005910 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
5911 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07005912}
5913
5914/* Manage GPIOs for HP EliteBook Folio 9480m.
5915 *
5916 * GPIO4 is the headphone amplifier power control
5917 * GPIO3 is the audio output mute indicator LED
5918 */
5919
5920static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5921 const struct hda_fixup *fix,
5922 int action)
5923{
5924 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07005925
Takashi Iwai01e4a272018-06-19 22:47:30 +02005926 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07005927 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02005928 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5929 spec->gpio_mask |= 0x10;
5930 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07005931 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07005932 }
5933}
5934
Takashi Iwaiae065f12018-06-19 23:00:03 +02005935static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5936 const struct hda_fixup *fix,
5937 int action)
5938{
5939 struct alc_spec *spec = codec->spec;
5940
5941 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5942 spec->gpio_mask |= 0x04;
5943 spec->gpio_dir |= 0x04;
5944 /* set data bit low */
5945 }
5946}
5947
Takashi Iwai6a6660d2020-09-03 10:33:00 +02005948/* Quirk for Thinkpad X1 7th and 8th Gen
5949 * The following fixed routing needed
5950 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
5951 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
5952 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
5953 */
5954static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
5955 const struct hda_fixup *fix, int action)
5956{
5957 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
5958 static const hda_nid_t preferred_pairs[] = {
5959 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
5960 };
5961 struct alc_spec *spec = codec->spec;
5962
5963 switch (action) {
5964 case HDA_FIXUP_ACT_PRE_PROBE:
5965 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
5966 spec->gen.preferred_dacs = preferred_pairs;
5967 break;
5968 case HDA_FIXUP_ACT_BUILD:
5969 /* The generic parser creates somewhat unintuitive volume ctls
5970 * with the fixed routing above, and the shared DAC2 may be
5971 * confusing for PA.
5972 * Rename those to unique names so that PA doesn't touch them
5973 * and use only Master volume.
5974 */
5975 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
5976 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
5977 break;
5978 }
5979}
5980
Kailang Yangca169cc2017-04-25 16:17:40 +08005981static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5982 const struct hda_fixup *fix,
5983 int action)
5984{
5985 alc_fixup_dual_codecs(codec, fix, action);
5986 switch (action) {
5987 case HDA_FIXUP_ACT_PRE_PROBE:
5988 /* override card longname to provide a unique UCM profile */
5989 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5990 break;
5991 case HDA_FIXUP_ACT_BUILD:
5992 /* rename Capture controls depending on the codec */
5993 rename_ctl(codec, "Capture Volume",
5994 codec->addr == 0 ?
5995 "Rear-Panel Capture Volume" :
5996 "Front-Panel Capture Volume");
5997 rename_ctl(codec, "Capture Switch",
5998 codec->addr == 0 ?
5999 "Rear-Panel Capture Switch" :
6000 "Front-Panel Capture Switch");
6001 break;
6002 }
6003}
6004
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006005static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6006 const struct hda_fixup *fix, int action)
6007{
6008 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6009 return;
6010
6011 codec->power_save_node = 1;
6012}
6013
Kailang Yang92266652017-12-14 15:28:58 +08006014/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6015static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6016 const struct hda_fixup *fix, int action)
6017{
6018 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006019 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08006020 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6021 0
6022 };
6023
6024 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6025 return;
6026
6027 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08006028 spec->gen.auto_mute_via_amp = 1;
6029 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08006030}
6031
Takashi Iwaic84bfed2020-11-27 15:11:04 +01006032/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6033static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6034 const struct hda_fixup *fix, int action)
6035{
6036 static const hda_nid_t preferred_pairs[] = {
6037 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6038 };
6039 struct alc_spec *spec = codec->spec;
6040
6041 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6042 spec->gen.preferred_dacs = preferred_pairs;
6043 spec->gen.obey_preferred_dacs = 1;
6044 }
6045}
6046
Hui Wangc4cfcf62018-11-26 14:17:16 +08006047/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6048static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6049 const struct hda_fixup *fix, int action)
6050{
6051 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6052 return;
6053
6054 snd_hda_override_wcaps(codec, 0x03, 0);
6055}
6056
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006057static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6058{
6059 switch (codec->core.vendor_id) {
6060 case 0x10ec0274:
6061 case 0x10ec0294:
6062 case 0x10ec0225:
6063 case 0x10ec0295:
6064 case 0x10ec0299:
6065 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6066 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6067 break;
6068 case 0x10ec0235:
6069 case 0x10ec0236:
6070 case 0x10ec0255:
6071 case 0x10ec0256:
6072 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6073 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6074 break;
6075 }
6076}
6077
Kailang Yang8983eb62019-04-03 15:31:49 +08006078static void alc295_fixup_chromebook(struct hda_codec *codec,
6079 const struct hda_fixup *fix, int action)
6080{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006081 struct alc_spec *spec = codec->spec;
6082
Kailang Yang8983eb62019-04-03 15:31:49 +08006083 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006084 case HDA_FIXUP_ACT_PRE_PROBE:
6085 spec->ultra_low_power = true;
6086 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006087 case HDA_FIXUP_ACT_INIT:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006088 alc_combo_jack_hp_jd_restart(codec);
Kailang Yang8983eb62019-04-03 15:31:49 +08006089 break;
6090 }
6091}
6092
Kailang Yangd1dd4212019-01-09 17:05:24 +08006093static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6094 const struct hda_fixup *fix, int action)
6095{
6096 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6097 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6098}
6099
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006100
6101static void alc294_gx502_toggle_output(struct hda_codec *codec,
6102 struct hda_jack_callback *cb)
6103{
6104 /* The Windows driver sets the codec up in a very different way where
6105 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6106 */
6107 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6108 alc_write_coef_idx(codec, 0x10, 0x8a20);
6109 else
6110 alc_write_coef_idx(codec, 0x10, 0x0a20);
6111}
6112
6113static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6114 const struct hda_fixup *fix, int action)
6115{
6116 /* Pin 0x21: headphones/headset mic */
6117 if (!is_jack_detectable(codec, 0x21))
6118 return;
6119
6120 switch (action) {
6121 case HDA_FIXUP_ACT_PRE_PROBE:
6122 snd_hda_jack_detect_enable_callback(codec, 0x21,
6123 alc294_gx502_toggle_output);
6124 break;
6125 case HDA_FIXUP_ACT_INIT:
6126 /* Make sure to start in a correct state, i.e. if
6127 * headphones have been plugged in before powering up the system
6128 */
6129 alc294_gx502_toggle_output(codec, NULL);
6130 break;
6131 }
6132}
6133
Kailang Yang56496252020-07-29 15:09:27 +08006134static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6135 const struct hda_fixup *fix, int action)
6136{
6137 if (action != HDA_FIXUP_ACT_INIT)
6138 return;
6139
6140 msleep(100);
6141 alc_write_coef_idx(codec, 0x65, 0x0);
6142}
6143
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006144static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6145 const struct hda_fixup *fix, int action)
6146{
6147 switch (action) {
6148 case HDA_FIXUP_ACT_INIT:
6149 alc_combo_jack_hp_jd_restart(codec);
6150 break;
6151 }
6152}
6153
Kailang Yang92666d42020-11-19 17:04:21 +08006154static void alc_fixup_no_int_mic(struct hda_codec *codec,
6155 const struct hda_fixup *fix, int action)
6156{
6157 struct alc_spec *spec = codec->spec;
6158
6159 switch (action) {
6160 case HDA_FIXUP_ACT_PRE_PROBE:
6161 /* Mic RING SLEEVE swap for combo jack */
6162 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6163 spec->no_internal_mic_pin = true;
6164 break;
6165 case HDA_FIXUP_ACT_INIT:
6166 alc_combo_jack_hp_jd_restart(codec);
6167 break;
6168 }
6169}
6170
Takashi Iwaib317b032014-01-08 11:44:21 +01006171/* for hda_fixup_thinkpad_acpi() */
6172#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006173
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006174static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6175 const struct hda_fixup *fix, int action)
6176{
6177 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6178 hda_fixup_thinkpad_acpi(codec, fix, action);
6179}
6180
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006181/* for alc295_fixup_hp_top_speakers */
6182#include "hp_x360_helper.c"
6183
Takashi Iwai1d045db2011-07-07 18:23:21 +02006184enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006185 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006186 ALC269_FIXUP_SONY_VAIO,
6187 ALC275_FIXUP_SONY_VAIO_GPIO2,
6188 ALC269_FIXUP_DELL_M101Z,
6189 ALC269_FIXUP_SKU_IGNORE,
6190 ALC269_FIXUP_ASUS_G73JW,
6191 ALC269_FIXUP_LENOVO_EAPD,
6192 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006193 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006194 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006195 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006196 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006197 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006198 ALC269_FIXUP_QUANTA_MUTE,
6199 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006200 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006201 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006202 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006203 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006204 ALC269_FIXUP_AMIC,
6205 ALC269_FIXUP_DMIC,
6206 ALC269VB_FIXUP_AMIC,
6207 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006208 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006209 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006210 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006211 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006212 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006213 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6214 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006215 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006216 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006217 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006218 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006219 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006220 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006221 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6222 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006223 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006224 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006225 ALC269_FIXUP_HEADSET_MODE,
6226 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006227 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006228 ALC269_FIXUP_ASUS_X101_FUNC,
6229 ALC269_FIXUP_ASUS_X101_VERB,
6230 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006231 ALC271_FIXUP_AMIC_MIC2,
6232 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006233 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006234 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006235 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006236 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006237 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006238 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006239 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006240 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006241 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006242 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006243 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006244 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006245 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6246 ALC290_FIXUP_SUBWOOFER,
6247 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006248 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006249 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006250 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006251 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006252 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006253 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006254 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006255 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006256 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006257 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006258 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006259 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006260 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006261 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01006262 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006263 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006264 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006265 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006266 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006267 ALC280_FIXUP_HP_9480M,
Kailang Yange1e62b92015-04-08 16:01:22 +08006268 ALC288_FIXUP_DELL_HEADSET_MODE,
6269 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006270 ALC288_FIXUP_DELL_XPS_13,
6271 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006272 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006273 ALC292_FIXUP_DELL_E7X,
6274 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006275 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006276 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006277 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006278 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006279 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006280 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006281 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006282 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006283 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006284 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006285 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006286 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006287 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006288 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006289 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006290 ALC298_FIXUP_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006291 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006292 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006293 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006294 ALC256_FIXUP_ASUS_HEADSET_MODE,
6295 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006296 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006297 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6298 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006299 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006300 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006301 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006302 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006303 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006304 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006305 ALC274_FIXUP_DELL_BIND_DACS,
6306 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006307 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006308 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006309 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006310 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006311 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006312 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006313 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006314 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006315 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006316 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006317 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006318 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006319 ALC294_FIXUP_ASUS_HEADSET_MIC,
6320 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006321 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006322 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006323 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006324 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006325 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006326 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6327 ALC225_FIXUP_WYSE_AUTO_MUTE,
6328 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006329 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006330 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006331 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006332 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006333 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006334 ALC289_FIXUP_DELL_SPK2,
6335 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006336 ALC294_FIXUP_SPK2_TO_DAC1,
6337 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006338 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006339 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006340 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006341 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006342 ALC294_FIXUP_ASUS_GX502_HP,
6343 ALC294_FIXUP_ASUS_GX502_PINS,
6344 ALC294_FIXUP_ASUS_GX502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006345 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006346 ALC285_FIXUP_HP_MUTE_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006347 ALC236_FIXUP_HP_MUTE_LED,
Mike Pozulp14425f12020-05-09 20:28:37 -07006348 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006349 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006350 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006351 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006352 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006353 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006354 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006355 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006356 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006357 ALC269_FIXUP_CZC_B20,
6358 ALC269_FIXUP_CZC_TMI,
6359 ALC269_FIXUP_CZC_L101,
6360 ALC269_FIXUP_LEMOTE_A1802,
6361 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006362 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Hui Wangfc19d552020-09-09 10:00:41 +08006363 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006364 ALC274_FIXUP_HP_MIC,
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006365 ALC274_FIXUP_HP_HEADSET_MIC,
Kailang Yangef9ce662020-11-03 15:40:35 +08006366 ALC256_FIXUP_ASUS_HPE,
Kailang Yang446b8182020-11-02 15:00:12 +08006367 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Kailang Yanga0ccbc52020-11-06 15:20:38 +08006368 ALC287_FIXUP_HP_GPIO_LED,
Kailang Yang9e885772020-11-03 15:30:51 +08006369 ALC256_FIXUP_HP_HEADSET_MIC,
Kailang Yang92666d42020-11-19 17:04:21 +08006370 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006371};
6372
Takashi Iwai1727a772013-01-10 09:52:52 +01006373static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006374 [ALC269_FIXUP_GPIO2] = {
6375 .type = HDA_FIXUP_FUNC,
6376 .v.func = alc_fixup_gpio2,
6377 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006378 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01006379 .type = HDA_FIXUP_PINCTLS,
6380 .v.pins = (const struct hda_pintbl[]) {
6381 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006382 {}
6383 }
6384 },
6385 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006386 .type = HDA_FIXUP_FUNC,
6387 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006388 .chained = true,
6389 .chain_id = ALC269_FIXUP_SONY_VAIO
6390 },
6391 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006392 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006393 .v.verbs = (const struct hda_verb[]) {
6394 /* Enables internal speaker */
6395 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6396 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6397 {}
6398 }
6399 },
6400 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006401 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02006402 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006403 },
6404 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006405 .type = HDA_FIXUP_PINS,
6406 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02006407 { 0x17, 0x99130111 }, /* subwoofer */
6408 { }
6409 }
6410 },
6411 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006412 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006413 .v.verbs = (const struct hda_verb[]) {
6414 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6415 {}
6416 }
6417 },
6418 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006419 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006420 .v.func = alc269_fixup_hweq,
6421 .chained = true,
6422 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6423 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006424 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6425 .type = HDA_FIXUP_FUNC,
6426 .v.func = alc_fixup_disable_aamix,
6427 .chained = true,
6428 .chain_id = ALC269_FIXUP_SONY_VAIO
6429 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006430 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006431 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006432 .v.func = alc271_fixup_dmic,
6433 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02006434 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006435 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006436 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02006437 .chained = true,
6438 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02006439 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006440 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006441 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006442 .v.func = alc269_fixup_stereo_dmic,
6443 },
David Henningsson7c478f02013-10-11 10:18:46 +02006444 [ALC269_FIXUP_HEADSET_MIC] = {
6445 .type = HDA_FIXUP_FUNC,
6446 .v.func = alc269_fixup_headset_mic,
6447 },
Takashi Iwai24519912011-08-16 15:08:49 +02006448 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006449 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02006450 .v.func = alc269_fixup_quanta_mute,
6451 },
6452 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006453 .type = HDA_FIXUP_PINS,
6454 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02006455 { 0x1a, 0x2101103f }, /* dock line-out */
6456 { 0x1b, 0x23a11040 }, /* dock mic-in */
6457 { }
6458 },
6459 .chained = true,
6460 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6461 },
David Henningsson2041d562014-06-13 11:15:44 +02006462 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6463 .type = HDA_FIXUP_PINS,
6464 .v.pins = (const struct hda_pintbl[]) {
6465 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6466 { }
6467 },
6468 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006469 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6470 .type = HDA_FIXUP_PINS,
6471 .v.pins = (const struct hda_pintbl[]) {
6472 { 0x21, 0x0221102f }, /* HP out */
6473 { }
6474 },
6475 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006476 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6477 .type = HDA_FIXUP_FUNC,
6478 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6479 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006480 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6481 .type = HDA_FIXUP_FUNC,
6482 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6483 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02006484 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006485 .type = HDA_FIXUP_PINS,
6486 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006487 { 0x14, 0x99130110 }, /* speaker */
6488 { 0x15, 0x0121401f }, /* HP out */
6489 { 0x18, 0x01a19c20 }, /* mic */
6490 { 0x19, 0x99a3092f }, /* int-mic */
6491 { }
6492 },
6493 },
6494 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006495 .type = HDA_FIXUP_PINS,
6496 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006497 { 0x12, 0x99a3092f }, /* int-mic */
6498 { 0x14, 0x99130110 }, /* speaker */
6499 { 0x15, 0x0121401f }, /* HP out */
6500 { 0x18, 0x01a19c20 }, /* mic */
6501 { }
6502 },
6503 },
6504 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006505 .type = HDA_FIXUP_PINS,
6506 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006507 { 0x14, 0x99130110 }, /* speaker */
6508 { 0x18, 0x01a19c20 }, /* mic */
6509 { 0x19, 0x99a3092f }, /* int-mic */
6510 { 0x21, 0x0121401f }, /* HP out */
6511 { }
6512 },
6513 },
David Henningsson2267ea92012-01-03 08:45:56 +01006514 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006515 .type = HDA_FIXUP_PINS,
6516 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006517 { 0x12, 0x99a3092f }, /* int-mic */
6518 { 0x14, 0x99130110 }, /* speaker */
6519 { 0x18, 0x01a19c20 }, /* mic */
6520 { 0x21, 0x0121401f }, /* HP out */
6521 { }
6522 },
6523 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006524 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006525 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006526 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01006527 },
David Henningssond06ac142013-02-18 11:41:55 +01006528 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6529 .type = HDA_FIXUP_FUNC,
6530 .v.func = alc269_fixup_hp_mute_led_mic1,
6531 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006532 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006533 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006534 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01006535 },
Tom Briden7f783bd2017-03-25 10:12:01 +00006536 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6537 .type = HDA_FIXUP_FUNC,
6538 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006539 .chained = true,
6540 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00006541 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006542 [ALC269_FIXUP_HP_GPIO_LED] = {
6543 .type = HDA_FIXUP_FUNC,
6544 .v.func = alc269_fixup_hp_gpio_led,
6545 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006546 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6547 .type = HDA_FIXUP_FUNC,
6548 .v.func = alc269_fixup_hp_gpio_mic1_led,
6549 },
6550 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6551 .type = HDA_FIXUP_FUNC,
6552 .v.func = alc269_fixup_hp_line1_mic1_led,
6553 },
David Henningsson693b6132012-06-22 19:12:10 +02006554 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006555 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02006556 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02006557 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006558 [ALC269_FIXUP_NO_SHUTUP] = {
6559 .type = HDA_FIXUP_FUNC,
6560 .v.func = alc_fixup_no_shutup,
6561 },
David Henningsson108cc102012-07-20 10:37:25 +02006562 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006563 .type = HDA_FIXUP_PINS,
6564 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02006565 { 0x19, 0x23a11040 }, /* dock mic */
6566 { 0x1b, 0x2121103f }, /* dock headphone */
6567 { }
6568 },
6569 .chained = true,
6570 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6571 },
Takashi Iwaib590b382020-05-14 18:05:33 +02006572 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6573 .type = HDA_FIXUP_FUNC,
6574 .v.func = alc269_fixup_limit_int_mic_boost,
6575 .chained = true,
6576 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6577 },
David Henningsson108cc102012-07-20 10:37:25 +02006578 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006579 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02006580 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01006581 .chained = true,
6582 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02006583 },
David Henningsson73bdd592013-04-15 15:44:14 +02006584 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6585 .type = HDA_FIXUP_PINS,
6586 .v.pins = (const struct hda_pintbl[]) {
6587 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6588 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6589 { }
6590 },
6591 .chained = true,
6592 .chain_id = ALC269_FIXUP_HEADSET_MODE
6593 },
6594 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6595 .type = HDA_FIXUP_PINS,
6596 .v.pins = (const struct hda_pintbl[]) {
6597 { 0x16, 0x21014020 }, /* dock line out */
6598 { 0x19, 0x21a19030 }, /* dock mic */
6599 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6600 { }
6601 },
6602 .chained = true,
6603 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6604 },
David Henningsson338cae52013-10-07 10:39:59 +02006605 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6606 .type = HDA_FIXUP_PINS,
6607 .v.pins = (const struct hda_pintbl[]) {
6608 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6609 { }
6610 },
6611 .chained = true,
6612 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6613 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08006614 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6615 .type = HDA_FIXUP_PINS,
6616 .v.pins = (const struct hda_pintbl[]) {
6617 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6618 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6619 { }
6620 },
6621 .chained = true,
6622 .chain_id = ALC269_FIXUP_HEADSET_MODE
6623 },
David Henningsson73bdd592013-04-15 15:44:14 +02006624 [ALC269_FIXUP_HEADSET_MODE] = {
6625 .type = HDA_FIXUP_FUNC,
6626 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08006627 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006628 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02006629 },
6630 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6631 .type = HDA_FIXUP_FUNC,
6632 .v.func = alc_fixup_headset_mode_no_hp_mic,
6633 },
Takashi Iwai78197172015-06-27 10:21:13 +02006634 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6635 .type = HDA_FIXUP_PINS,
6636 .v.pins = (const struct hda_pintbl[]) {
6637 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6638 { }
6639 },
6640 .chained = true,
6641 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6642 },
David Henningsson88cfcf82013-10-11 10:18:45 +02006643 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6644 .type = HDA_FIXUP_PINS,
6645 .v.pins = (const struct hda_pintbl[]) {
6646 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6647 { }
6648 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02006649 .chained = true,
6650 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02006651 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006652 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006653 .type = HDA_FIXUP_PINS,
6654 .v.pins = (const struct hda_pintbl[]) {
6655 {0x12, 0x90a60130},
6656 {0x13, 0x40000000},
6657 {0x14, 0x90170110},
6658 {0x18, 0x411111f0},
6659 {0x19, 0x04a11040},
6660 {0x1a, 0x411111f0},
6661 {0x1b, 0x90170112},
6662 {0x1d, 0x40759a05},
6663 {0x1e, 0x411111f0},
6664 {0x21, 0x04211020},
6665 { }
6666 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05006667 .chained = true,
6668 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006669 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006670 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6671 .type = HDA_FIXUP_FUNC,
6672 .v.func = alc298_fixup_huawei_mbx_stereo,
6673 .chained = true,
6674 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6675 },
David Henningssond240d1d2013-04-15 12:50:02 +02006676 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6677 .type = HDA_FIXUP_FUNC,
6678 .v.func = alc269_fixup_x101_headset_mic,
6679 },
6680 [ALC269_FIXUP_ASUS_X101_VERB] = {
6681 .type = HDA_FIXUP_VERBS,
6682 .v.verbs = (const struct hda_verb[]) {
6683 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6684 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6685 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6686 { }
6687 },
6688 .chained = true,
6689 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6690 },
6691 [ALC269_FIXUP_ASUS_X101] = {
6692 .type = HDA_FIXUP_PINS,
6693 .v.pins = (const struct hda_pintbl[]) {
6694 { 0x18, 0x04a1182c }, /* Headset mic */
6695 { }
6696 },
6697 .chained = true,
6698 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6699 },
Dylan Reid08a978d2012-11-18 22:56:40 -08006700 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006701 .type = HDA_FIXUP_PINS,
6702 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08006703 { 0x14, 0x99130110 }, /* speaker */
6704 { 0x19, 0x01a19c20 }, /* mic */
6705 { 0x1b, 0x99a7012f }, /* int-mic */
6706 { 0x21, 0x0121401f }, /* HP out */
6707 { }
6708 },
6709 },
6710 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006711 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08006712 .v.func = alc271_hp_gate_mic_jack,
6713 .chained = true,
6714 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6715 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006716 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6717 .type = HDA_FIXUP_FUNC,
6718 .v.func = alc269_fixup_limit_int_mic_boost,
6719 .chained = true,
6720 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6721 },
Dylan Reid42397002013-04-05 14:58:22 -07006722 [ALC269_FIXUP_ACER_AC700] = {
6723 .type = HDA_FIXUP_PINS,
6724 .v.pins = (const struct hda_pintbl[]) {
6725 { 0x12, 0x99a3092f }, /* int-mic */
6726 { 0x14, 0x99130110 }, /* speaker */
6727 { 0x18, 0x03a11c20 }, /* mic */
6728 { 0x1e, 0x0346101e }, /* SPDIF1 */
6729 { 0x21, 0x0321101f }, /* HP out */
6730 { }
6731 },
6732 .chained = true,
6733 .chain_id = ALC271_FIXUP_DMIC,
6734 },
David Henningsson3e0d6112013-04-22 14:30:14 +02006735 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6736 .type = HDA_FIXUP_FUNC,
6737 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01006738 .chained = true,
6739 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02006740 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01006741 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6742 .type = HDA_FIXUP_FUNC,
6743 .v.func = alc269_fixup_limit_int_mic_boost,
6744 .chained = true,
6745 .chain_id = ALC269VB_FIXUP_DMIC,
6746 },
Takashi Iwai23870832013-11-29 14:13:12 +01006747 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6748 .type = HDA_FIXUP_VERBS,
6749 .v.verbs = (const struct hda_verb[]) {
6750 /* class-D output amp +5dB */
6751 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6752 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6753 {}
6754 },
6755 .chained = true,
6756 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6757 },
David Henningsson8e35cd42013-11-06 11:20:01 +01006758 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6759 .type = HDA_FIXUP_FUNC,
6760 .v.func = alc269_fixup_limit_int_mic_boost,
6761 .chained = true,
6762 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6763 },
Anisse Astier02b504d2013-06-03 11:53:10 +02006764 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6765 .type = HDA_FIXUP_PINS,
6766 .v.pins = (const struct hda_pintbl[]) {
6767 { 0x12, 0x99a3092f }, /* int-mic */
6768 { 0x18, 0x03a11d20 }, /* mic */
6769 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6770 { }
6771 },
6772 },
Kailang Yangcd217a62013-08-22 10:15:24 +02006773 [ALC283_FIXUP_CHROME_BOOK] = {
6774 .type = HDA_FIXUP_FUNC,
6775 .v.func = alc283_fixup_chromebook,
6776 },
Kailang Yang0202e992013-12-02 15:20:15 +08006777 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6778 .type = HDA_FIXUP_FUNC,
6779 .v.func = alc283_fixup_sense_combo_jack,
6780 .chained = true,
6781 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6782 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02006783 [ALC282_FIXUP_ASUS_TX300] = {
6784 .type = HDA_FIXUP_FUNC,
6785 .v.func = alc282_fixup_asus_tx300,
6786 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02006787 [ALC283_FIXUP_INT_MIC] = {
6788 .type = HDA_FIXUP_VERBS,
6789 .v.verbs = (const struct hda_verb[]) {
6790 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6791 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6792 { }
6793 },
6794 .chained = true,
6795 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6796 },
David Henningsson0f4881d2013-12-20 16:08:13 +01006797 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6798 .type = HDA_FIXUP_PINS,
6799 .v.pins = (const struct hda_pintbl[]) {
6800 { 0x17, 0x90170112 }, /* subwoofer */
6801 { }
6802 },
6803 .chained = true,
6804 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6805 },
6806 [ALC290_FIXUP_SUBWOOFER] = {
6807 .type = HDA_FIXUP_PINS,
6808 .v.pins = (const struct hda_pintbl[]) {
6809 { 0x17, 0x90170112 }, /* subwoofer */
6810 { }
6811 },
6812 .chained = true,
6813 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6814 },
David Henningsson338cae52013-10-07 10:39:59 +02006815 [ALC290_FIXUP_MONO_SPEAKERS] = {
6816 .type = HDA_FIXUP_FUNC,
6817 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01006818 },
6819 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6820 .type = HDA_FIXUP_FUNC,
6821 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02006822 .chained = true,
6823 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6824 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01006825 [ALC269_FIXUP_THINKPAD_ACPI] = {
6826 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006827 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02006828 .chained = true,
6829 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006830 },
David Henningsson56f27012016-01-11 09:33:14 +01006831 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6832 .type = HDA_FIXUP_FUNC,
6833 .v.func = alc_fixup_inv_dmic,
6834 .chained = true,
6835 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6836 },
Chris Chiu5824ce82017-02-28 14:17:11 -06006837 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08006838 .type = HDA_FIXUP_PINS,
6839 .v.pins = (const struct hda_pintbl[]) {
6840 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6841 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06006842 },
6843 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08006844 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06006845 },
Chris Chiu615966a2017-02-28 14:17:12 -06006846 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6847 .type = HDA_FIXUP_PINS,
6848 .v.pins = (const struct hda_pintbl[]) {
6849 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6850 { }
6851 },
6852 .chained = true,
6853 .chain_id = ALC255_FIXUP_HEADSET_MODE
6854 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006855 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6856 .type = HDA_FIXUP_PINS,
6857 .v.pins = (const struct hda_pintbl[]) {
6858 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6859 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6860 { }
6861 },
6862 .chained = true,
6863 .chain_id = ALC255_FIXUP_HEADSET_MODE
6864 },
Kailang Yang31278992014-03-03 15:27:22 +08006865 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6866 .type = HDA_FIXUP_PINS,
6867 .v.pins = (const struct hda_pintbl[]) {
6868 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6869 { }
6870 },
6871 .chained = true,
6872 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6873 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006874 [ALC255_FIXUP_HEADSET_MODE] = {
6875 .type = HDA_FIXUP_FUNC,
6876 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08006877 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006878 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006879 },
Kailang Yang31278992014-03-03 15:27:22 +08006880 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6881 .type = HDA_FIXUP_FUNC,
6882 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6883 },
Kailang Yanga22aa262014-04-23 17:34:28 +08006884 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6885 .type = HDA_FIXUP_PINS,
6886 .v.pins = (const struct hda_pintbl[]) {
6887 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6888 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6889 { }
6890 },
6891 .chained = true,
6892 .chain_id = ALC269_FIXUP_HEADSET_MODE
6893 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02006894 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02006895 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02006896 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006897 .chained = true,
6898 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6899 },
Takashi Iwai9a811232015-12-09 15:17:43 +01006900 [ALC292_FIXUP_TPT440] = {
6901 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01006902 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01006903 .chained = true,
6904 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6905 },
Anisse Astierabaa22742016-08-24 09:14:13 +02006906 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01006907 .type = HDA_FIXUP_PINS,
6908 .v.pins = (const struct hda_pintbl[]) {
6909 { 0x19, 0x04a110f0 },
6910 { },
6911 },
6912 },
Takashi Iwaib3802782018-11-26 17:47:46 +01006913 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08006914 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02006915 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08006916 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006917 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6918 .type = HDA_FIXUP_PINS,
6919 .v.pins = (const struct hda_pintbl[]) {
6920 { 0x12, 0x90a60130 },
6921 { 0x14, 0x90170110 },
6922 { 0x17, 0x40000008 },
6923 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02006924 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006925 { 0x1a, 0x411111f0 },
6926 { 0x1b, 0x411111f0 },
6927 { 0x1d, 0x40f89b2d },
6928 { 0x1e, 0x411111f0 },
6929 { 0x21, 0x0321101f },
6930 { },
6931 },
6932 },
David Henningsson7a5255f2014-10-30 08:26:01 +01006933 [ALC280_FIXUP_HP_GPIO4] = {
6934 .type = HDA_FIXUP_FUNC,
6935 .v.func = alc280_fixup_hp_gpio4,
6936 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006937 [ALC286_FIXUP_HP_GPIO_LED] = {
6938 .type = HDA_FIXUP_FUNC,
6939 .v.func = alc286_fixup_hp_gpio_led,
6940 },
David Henningsson33f4acd2015-01-07 15:50:13 +01006941 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6942 .type = HDA_FIXUP_FUNC,
6943 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6944 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01006945 [ALC280_FIXUP_HP_DOCK_PINS] = {
6946 .type = HDA_FIXUP_PINS,
6947 .v.pins = (const struct hda_pintbl[]) {
6948 { 0x1b, 0x21011020 }, /* line-out */
6949 { 0x1a, 0x01a1903c }, /* headset mic */
6950 { 0x18, 0x2181103f }, /* line-in */
6951 { },
6952 },
6953 .chained = true,
6954 .chain_id = ALC280_FIXUP_HP_GPIO4
6955 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006956 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6957 .type = HDA_FIXUP_PINS,
6958 .v.pins = (const struct hda_pintbl[]) {
6959 { 0x1b, 0x21011020 }, /* line-out */
6960 { 0x18, 0x2181103f }, /* line-in */
6961 { },
6962 },
6963 .chained = true,
6964 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6965 },
Keith Packard98973f22015-07-15 12:14:39 -07006966 [ALC280_FIXUP_HP_9480M] = {
6967 .type = HDA_FIXUP_FUNC,
6968 .v.func = alc280_fixup_hp_9480m,
6969 },
Kailang Yange1e62b92015-04-08 16:01:22 +08006970 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6971 .type = HDA_FIXUP_FUNC,
6972 .v.func = alc_fixup_headset_mode_dell_alc288,
6973 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006974 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08006975 },
6976 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6977 .type = HDA_FIXUP_PINS,
6978 .v.pins = (const struct hda_pintbl[]) {
6979 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6980 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6981 { }
6982 },
6983 .chained = true,
6984 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6985 },
Hui Wang831bfdf92015-06-26 12:35:17 +08006986 [ALC288_FIXUP_DISABLE_AAMIX] = {
6987 .type = HDA_FIXUP_FUNC,
6988 .v.func = alc_fixup_disable_aamix,
6989 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02006990 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08006991 },
6992 [ALC288_FIXUP_DELL_XPS_13] = {
6993 .type = HDA_FIXUP_FUNC,
6994 .v.func = alc_fixup_dell_xps13,
6995 .chained = true,
6996 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6997 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006998 [ALC292_FIXUP_DISABLE_AAMIX] = {
6999 .type = HDA_FIXUP_FUNC,
7000 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08007001 .chained = true,
7002 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007003 },
David Henningssonc04017e2015-12-15 14:44:03 +01007004 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7005 .type = HDA_FIXUP_FUNC,
7006 .v.func = alc_fixup_disable_aamix,
7007 .chained = true,
7008 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7009 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007010 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007011 .type = HDA_FIXUP_FUNC,
7012 .v.func = alc_fixup_dell_xps13,
7013 .chained = true,
7014 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7015 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007016 [ALC292_FIXUP_DELL_E7X] = {
7017 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007018 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01007019 /* micmute fixup must be applied at last */
7020 .chained_before = true,
7021 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7022 },
James McDonnell54324222019-09-16 14:53:38 +00007023 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7024 .type = HDA_FIXUP_PINS,
7025 .v.pins = (const struct hda_pintbl[]) {
7026 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7027 { }
7028 },
7029 .chained_before = true,
7030 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7031 },
Kailang Yang977e6272015-05-18 15:31:20 +08007032 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7033 .type = HDA_FIXUP_PINS,
7034 .v.pins = (const struct hda_pintbl[]) {
7035 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7036 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7037 { }
7038 },
7039 .chained = true,
7040 .chain_id = ALC269_FIXUP_HEADSET_MODE
7041 },
Hui Wang2f726ae2017-03-31 10:31:40 +08007042 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7043 .type = HDA_FIXUP_PINS,
7044 .v.pins = (const struct hda_pintbl[]) {
7045 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7046 { }
7047 },
7048 .chained = true,
7049 .chain_id = ALC269_FIXUP_HEADSET_MODE
7050 },
Kailang Yang6ed11312015-10-26 15:37:39 +08007051 [ALC275_FIXUP_DELL_XPS] = {
7052 .type = HDA_FIXUP_VERBS,
7053 .v.verbs = (const struct hda_verb[]) {
7054 /* Enables internal speaker */
7055 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7056 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7057 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7058 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7059 {}
7060 }
7061 },
Hui Wang23adc192015-12-08 12:27:18 +08007062 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7063 .type = HDA_FIXUP_FUNC,
7064 .v.func = alc_fixup_disable_aamix,
7065 .chained = true,
7066 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7067 },
Kailang3694cb22015-12-28 11:35:24 +08007068 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7069 .type = HDA_FIXUP_FUNC,
7070 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7071 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007072 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7073 .type = HDA_FIXUP_FUNC,
7074 .v.func = alc_fixup_disable_aamix,
7075 .chained = true,
7076 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7077 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08007078 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7079 .type = HDA_FIXUP_FUNC,
7080 .v.func = alc_fixup_disable_mic_vref,
7081 .chained = true,
7082 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7083 },
David Henningsson2ae95572016-02-25 09:37:05 +01007084 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7085 .type = HDA_FIXUP_VERBS,
7086 .v.verbs = (const struct hda_verb[]) {
7087 /* Disable pass-through path for FRONT 14h */
7088 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7089 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7090 {}
7091 },
7092 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007093 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007094 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007095 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7096 .type = HDA_FIXUP_FUNC,
7097 .v.func = alc_fixup_disable_aamix,
7098 .chained = true,
7099 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7100 },
Hui Wange549d192016-04-01 11:00:15 +08007101 [ALC221_FIXUP_HP_FRONT_MIC] = {
7102 .type = HDA_FIXUP_PINS,
7103 .v.pins = (const struct hda_pintbl[]) {
7104 { 0x19, 0x02a19020 }, /* Front Mic */
7105 { }
7106 },
7107 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007108 [ALC292_FIXUP_TPT460] = {
7109 .type = HDA_FIXUP_FUNC,
7110 .v.func = alc_fixup_tpt440_dock,
7111 .chained = true,
7112 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7113 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007114 [ALC298_FIXUP_SPK_VOLUME] = {
7115 .type = HDA_FIXUP_FUNC,
7116 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007117 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007118 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007119 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007120 [ALC295_FIXUP_DISABLE_DAC3] = {
7121 .type = HDA_FIXUP_FUNC,
7122 .v.func = alc295_fixup_disable_dac3,
7123 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007124 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7125 .type = HDA_FIXUP_FUNC,
7126 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007127 .chained = true,
7128 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007129 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007130 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7131 .type = HDA_FIXUP_PINS,
7132 .v.pins = (const struct hda_pintbl[]) {
7133 { 0x1b, 0x90170151 },
7134 { }
7135 },
7136 .chained = true,
7137 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7138 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007139 [ALC269_FIXUP_ATIV_BOOK_8] = {
7140 .type = HDA_FIXUP_FUNC,
7141 .v.func = alc_fixup_auto_mute_via_amp,
7142 .chained = true,
7143 .chain_id = ALC269_FIXUP_NO_SHUTUP
7144 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007145 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7146 .type = HDA_FIXUP_PINS,
7147 .v.pins = (const struct hda_pintbl[]) {
7148 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7149 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7150 { }
7151 },
7152 .chained = true,
7153 .chain_id = ALC269_FIXUP_HEADSET_MODE
7154 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007155 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7156 .type = HDA_FIXUP_FUNC,
7157 .v.func = alc_fixup_headset_mode,
7158 },
7159 [ALC256_FIXUP_ASUS_MIC] = {
7160 .type = HDA_FIXUP_PINS,
7161 .v.pins = (const struct hda_pintbl[]) {
7162 { 0x13, 0x90a60160 }, /* use as internal mic */
7163 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7164 { }
7165 },
7166 .chained = true,
7167 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7168 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007169 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007170 .type = HDA_FIXUP_FUNC,
7171 /* Set up GPIO2 for the speaker amp */
7172 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007173 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007174 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7175 .type = HDA_FIXUP_PINS,
7176 .v.pins = (const struct hda_pintbl[]) {
7177 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7178 { }
7179 },
7180 .chained = true,
7181 .chain_id = ALC269_FIXUP_HEADSET_MIC
7182 },
7183 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7184 .type = HDA_FIXUP_VERBS,
7185 .v.verbs = (const struct hda_verb[]) {
7186 /* Enables internal speaker */
7187 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7188 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7189 {}
7190 },
7191 .chained = true,
7192 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7193 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007194 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7195 .type = HDA_FIXUP_FUNC,
7196 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007197 .chained = true,
7198 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007199 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007200 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7201 .type = HDA_FIXUP_VERBS,
7202 .v.verbs = (const struct hda_verb[]) {
7203 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7204 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7205 { }
7206 },
7207 .chained = true,
7208 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7209 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007210 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7211 .type = HDA_FIXUP_PINS,
7212 .v.pins = (const struct hda_pintbl[]) {
7213 /* Change the mic location from front to right, otherwise there are
7214 two front mics with the same name, pulseaudio can't handle them.
7215 This is just a temporary workaround, after applying this fixup,
7216 there will be one "Front Mic" and one "Mic" in this machine.
7217 */
7218 { 0x1a, 0x04a19040 },
7219 { }
7220 },
7221 },
Kailang Yang5f364132017-07-25 16:28:16 +08007222 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7223 .type = HDA_FIXUP_PINS,
7224 .v.pins = (const struct hda_pintbl[]) {
7225 { 0x16, 0x0101102f }, /* Rear Headset HP */
7226 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7227 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7228 { 0x1b, 0x02011020 },
7229 { }
7230 },
7231 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007232 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7233 },
7234 [ALC225_FIXUP_S3_POP_NOISE] = {
7235 .type = HDA_FIXUP_FUNC,
7236 .v.func = alc225_fixup_s3_pop_noise,
7237 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007238 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7239 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007240 [ALC700_FIXUP_INTEL_REFERENCE] = {
7241 .type = HDA_FIXUP_VERBS,
7242 .v.verbs = (const struct hda_verb[]) {
7243 /* Enables internal speaker */
7244 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7245 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7246 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7247 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7248 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7249 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7250 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7251 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7252 {}
7253 }
7254 },
Kailang Yang92266652017-12-14 15:28:58 +08007255 [ALC274_FIXUP_DELL_BIND_DACS] = {
7256 .type = HDA_FIXUP_FUNC,
7257 .v.func = alc274_fixup_bind_dacs,
7258 .chained = true,
7259 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7260 },
7261 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7262 .type = HDA_FIXUP_PINS,
7263 .v.pins = (const struct hda_pintbl[]) {
7264 { 0x1b, 0x0401102f },
7265 { }
7266 },
7267 .chained = true,
7268 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7269 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007270 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007271 .type = HDA_FIXUP_FUNC,
7272 .v.func = alc_fixup_tpt470_dock,
7273 .chained = true,
7274 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7275 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007276 [ALC298_FIXUP_TPT470_DOCK] = {
7277 .type = HDA_FIXUP_FUNC,
7278 .v.func = alc_fixup_tpt470_dacs,
7279 .chained = true,
7280 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7281 },
Kailang Yangae104a22018-02-05 16:07:20 +08007282 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7283 .type = HDA_FIXUP_PINS,
7284 .v.pins = (const struct hda_pintbl[]) {
7285 { 0x14, 0x0201101f },
7286 { }
7287 },
7288 .chained = true,
7289 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7290 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007291 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7292 .type = HDA_FIXUP_PINS,
7293 .v.pins = (const struct hda_pintbl[]) {
7294 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7295 { }
7296 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007297 .chained = true,
7298 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007299 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007300 [ALC295_FIXUP_HP_X360] = {
7301 .type = HDA_FIXUP_FUNC,
7302 .v.func = alc295_fixup_hp_top_speakers,
7303 .chained = true,
7304 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007305 },
7306 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7307 .type = HDA_FIXUP_PINS,
7308 .v.pins = (const struct hda_pintbl[]) {
7309 { 0x19, 0x0181313f},
7310 { }
7311 },
7312 .chained = true,
7313 .chain_id = ALC269_FIXUP_HEADSET_MIC
7314 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007315 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7316 .type = HDA_FIXUP_FUNC,
7317 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007318 .chained = true,
7319 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007320 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007321 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7322 .type = HDA_FIXUP_FUNC,
7323 .v.func = alc_fixup_auto_mute_via_amp,
7324 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007325 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7326 .type = HDA_FIXUP_PINS,
7327 .v.pins = (const struct hda_pintbl[]) {
7328 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7329 { }
7330 },
7331 .chained = true,
7332 .chain_id = ALC269_FIXUP_HEADSET_MIC
7333 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007334 [ALC294_FIXUP_ASUS_MIC] = {
7335 .type = HDA_FIXUP_PINS,
7336 .v.pins = (const struct hda_pintbl[]) {
7337 { 0x13, 0x90a60160 }, /* use as internal mic */
7338 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7339 { }
7340 },
7341 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007342 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007343 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007344 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7345 .type = HDA_FIXUP_PINS,
7346 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007347 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007348 { }
7349 },
7350 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007351 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007352 },
7353 [ALC294_FIXUP_ASUS_SPK] = {
7354 .type = HDA_FIXUP_VERBS,
7355 .v.verbs = (const struct hda_verb[]) {
7356 /* Set EAPD high */
7357 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7358 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08007359 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7360 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007361 { }
7362 },
7363 .chained = true,
7364 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7365 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007366 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08007367 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007368 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08007369 .chained = true,
7370 .chain_id = ALC225_FIXUP_HEADSET_JACK
7371 },
7372 [ALC225_FIXUP_HEADSET_JACK] = {
7373 .type = HDA_FIXUP_FUNC,
7374 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08007375 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07007376 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7377 .type = HDA_FIXUP_PINS,
7378 .v.pins = (const struct hda_pintbl[]) {
7379 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7380 { }
7381 },
7382 .chained = true,
7383 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7384 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08007385 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7386 .type = HDA_FIXUP_VERBS,
7387 .v.verbs = (const struct hda_verb[]) {
7388 /* Disable PCBEEP-IN passthrough */
7389 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7390 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7391 { }
7392 },
7393 .chained = true,
7394 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7395 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007396 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7397 .type = HDA_FIXUP_PINS,
7398 .v.pins = (const struct hda_pintbl[]) {
7399 { 0x19, 0x03a11130 },
7400 { 0x1a, 0x90a60140 }, /* use as internal mic */
7401 { }
7402 },
7403 .chained = true,
7404 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7405 },
Kailang Yang136824e2019-03-14 16:22:45 +08007406 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7407 .type = HDA_FIXUP_PINS,
7408 .v.pins = (const struct hda_pintbl[]) {
7409 { 0x16, 0x01011020 }, /* Rear Line out */
7410 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7411 { }
7412 },
7413 .chained = true,
7414 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7415 },
7416 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7417 .type = HDA_FIXUP_FUNC,
7418 .v.func = alc_fixup_auto_mute_via_amp,
7419 .chained = true,
7420 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7421 },
7422 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7423 .type = HDA_FIXUP_FUNC,
7424 .v.func = alc_fixup_disable_mic_vref,
7425 .chained = true,
7426 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7427 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007428 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7429 .type = HDA_FIXUP_VERBS,
7430 .v.verbs = (const struct hda_verb[]) {
7431 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7432 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7433 { }
7434 },
7435 .chained = true,
7436 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7437 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08007438 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7439 .type = HDA_FIXUP_PINS,
7440 .v.pins = (const struct hda_pintbl[]) {
7441 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7442 { }
7443 },
7444 .chained = true,
7445 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7446 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08007447 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7448 .type = HDA_FIXUP_PINS,
7449 .v.pins = (const struct hda_pintbl[]) {
7450 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7451 { }
7452 },
7453 .chained = true,
7454 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7455 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007456 [ALC299_FIXUP_PREDATOR_SPK] = {
7457 .type = HDA_FIXUP_PINS,
7458 .v.pins = (const struct hda_pintbl[]) {
7459 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7460 { }
7461 }
7462 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02007463 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7464 .type = HDA_FIXUP_PINS,
7465 .v.pins = (const struct hda_pintbl[]) {
7466 { 0x19, 0x04a11040 },
7467 { 0x21, 0x04211020 },
7468 { }
7469 },
7470 .chained = true,
7471 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7472 },
Kailang Yange79c2262019-12-19 14:12:15 +08007473 [ALC289_FIXUP_DELL_SPK2] = {
7474 .type = HDA_FIXUP_PINS,
7475 .v.pins = (const struct hda_pintbl[]) {
7476 { 0x17, 0x90170130 }, /* bass spk */
7477 { }
7478 },
7479 .chained = true,
7480 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7481 },
7482 [ALC289_FIXUP_DUAL_SPK] = {
7483 .type = HDA_FIXUP_FUNC,
7484 .v.func = alc285_fixup_speaker2_to_dac1,
7485 .chained = true,
7486 .chain_id = ALC289_FIXUP_DELL_SPK2
7487 },
Chris Chiu48e01502019-12-30 11:11:18 +08007488 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7489 .type = HDA_FIXUP_FUNC,
7490 .v.func = alc285_fixup_speaker2_to_dac1,
7491 .chained = true,
7492 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7493 },
7494 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007495 .type = HDA_FIXUP_FUNC,
7496 /* The GPIO must be pulled to initialize the AMP */
7497 .v.func = alc_fixup_gpio4,
7498 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08007499 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007500 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007501 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7502 .type = HDA_FIXUP_FUNC,
7503 .v.func = alc285_fixup_thinkpad_x1_gen7,
7504 .chained = true,
7505 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7506 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08007507 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7508 .type = HDA_FIXUP_FUNC,
7509 .v.func = alc_fixup_headset_jack,
7510 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007511 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08007512 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007513 [ALC294_FIXUP_ASUS_HPE] = {
7514 .type = HDA_FIXUP_VERBS,
7515 .v.verbs = (const struct hda_verb[]) {
7516 /* Set EAPD high */
7517 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7518 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7519 { }
7520 },
7521 .chained = true,
7522 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7523 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007524 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7525 .type = HDA_FIXUP_PINS,
7526 .v.pins = (const struct hda_pintbl[]) {
7527 { 0x19, 0x03a11050 }, /* front HP mic */
7528 { 0x1a, 0x01a11830 }, /* rear external mic */
7529 { 0x21, 0x03211020 }, /* front HP out */
7530 { }
7531 },
7532 .chained = true,
7533 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7534 },
7535 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7536 .type = HDA_FIXUP_VERBS,
7537 .v.verbs = (const struct hda_verb[]) {
7538 /* set 0x15 to HP-OUT ctrl */
7539 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7540 /* unmute the 0x15 amp */
7541 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7542 { }
7543 },
7544 .chained = true,
7545 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7546 },
7547 [ALC294_FIXUP_ASUS_GX502_HP] = {
7548 .type = HDA_FIXUP_FUNC,
7549 .v.func = alc294_fixup_gx502_hp,
7550 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02007551 [ALC294_FIXUP_ASUS_COEF_1B] = {
7552 .type = HDA_FIXUP_VERBS,
7553 .v.verbs = (const struct hda_verb[]) {
7554 /* Set bit 10 to correct noisy output after reboot from
7555 * Windows 10 (due to pop noise reduction?)
7556 */
7557 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7558 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7559 { }
7560 },
7561 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08007562 [ALC285_FIXUP_HP_GPIO_LED] = {
7563 .type = HDA_FIXUP_FUNC,
7564 .v.func = alc285_fixup_hp_gpio_led,
7565 },
Kailang Yang431e76c2020-04-07 14:40:20 +08007566 [ALC285_FIXUP_HP_MUTE_LED] = {
7567 .type = HDA_FIXUP_FUNC,
7568 .v.func = alc285_fixup_hp_mute_led,
7569 },
Kailang Yang24164f42020-04-07 14:52:42 +08007570 [ALC236_FIXUP_HP_MUTE_LED] = {
7571 .type = HDA_FIXUP_FUNC,
7572 .v.func = alc236_fixup_hp_mute_led,
7573 },
Mike Pozulp14425f12020-05-09 20:28:37 -07007574 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7575 .type = HDA_FIXUP_VERBS,
7576 .v.verbs = (const struct hda_verb[]) {
7577 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7578 { }
7579 },
7580 },
Chris Chiu9e433422020-05-12 14:15:24 +08007581 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7582 .type = HDA_FIXUP_PINS,
7583 .v.pins = (const struct hda_pintbl[]) {
7584 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7585 { }
7586 },
7587 .chained = true,
7588 .chain_id = ALC269_FIXUP_HEADSET_MODE
7589 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007590 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7591 .type = HDA_FIXUP_PINS,
7592 .v.pins = (const struct hda_pintbl[]) {
7593 { 0x14, 0x90100120 }, /* use as internal speaker */
7594 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7595 { 0x1a, 0x01011020 }, /* use as line out */
7596 { },
7597 },
7598 .chained = true,
7599 .chain_id = ALC269_FIXUP_HEADSET_MIC
7600 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007601 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7602 .type = HDA_FIXUP_PINS,
7603 .v.pins = (const struct hda_pintbl[]) {
7604 { 0x18, 0x02a11030 }, /* use as headset mic */
7605 { }
7606 },
7607 .chained = true,
7608 .chain_id = ALC269_FIXUP_HEADSET_MIC
7609 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007610 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7611 .type = HDA_FIXUP_PINS,
7612 .v.pins = (const struct hda_pintbl[]) {
7613 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7614 { }
7615 },
7616 .chained = true,
7617 .chain_id = ALC269_FIXUP_HEADSET_MIC
7618 },
Armas Spann293a92c2020-07-24 16:08:37 +02007619 [ALC289_FIXUP_ASUS_GA401] = {
Takashi Iwaic84bfed2020-11-27 15:11:04 +01007620 .type = HDA_FIXUP_FUNC,
7621 .v.func = alc289_fixup_asus_ga401,
7622 .chained = true,
7623 .chain_id = ALC289_FIXUP_ASUS_GA502,
Armas Spannff536642020-07-11 13:05:57 +02007624 },
Armas Spann4b43d052020-07-24 16:06:16 +02007625 [ALC289_FIXUP_ASUS_GA502] = {
7626 .type = HDA_FIXUP_PINS,
7627 .v.pins = (const struct hda_pintbl[]) {
7628 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7629 { }
7630 },
7631 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007632 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7633 .type = HDA_FIXUP_PINS,
7634 .v.pins = (const struct hda_pintbl[]) {
7635 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7636 { }
7637 },
7638 .chained = true,
7639 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7640 },
Kailang Yang56496252020-07-29 15:09:27 +08007641 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7642 .type = HDA_FIXUP_FUNC,
7643 .v.func = alc285_fixup_hp_gpio_amp_init,
7644 .chained = true,
7645 .chain_id = ALC285_FIXUP_HP_GPIO_LED
7646 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08007647 [ALC269_FIXUP_CZC_B20] = {
7648 .type = HDA_FIXUP_PINS,
7649 .v.pins = (const struct hda_pintbl[]) {
7650 { 0x12, 0x411111f0 },
7651 { 0x14, 0x90170110 }, /* speaker */
7652 { 0x15, 0x032f1020 }, /* HP out */
7653 { 0x17, 0x411111f0 },
7654 { 0x18, 0x03ab1040 }, /* mic */
7655 { 0x19, 0xb7a7013f },
7656 { 0x1a, 0x0181305f },
7657 { 0x1b, 0x411111f0 },
7658 { 0x1d, 0x411111f0 },
7659 { 0x1e, 0x411111f0 },
7660 { }
7661 },
7662 .chain_id = ALC269_FIXUP_DMIC,
7663 },
7664 [ALC269_FIXUP_CZC_TMI] = {
7665 .type = HDA_FIXUP_PINS,
7666 .v.pins = (const struct hda_pintbl[]) {
7667 { 0x12, 0x4000c000 },
7668 { 0x14, 0x90170110 }, /* speaker */
7669 { 0x15, 0x0421401f }, /* HP out */
7670 { 0x17, 0x411111f0 },
7671 { 0x18, 0x04a19020 }, /* mic */
7672 { 0x19, 0x411111f0 },
7673 { 0x1a, 0x411111f0 },
7674 { 0x1b, 0x411111f0 },
7675 { 0x1d, 0x40448505 },
7676 { 0x1e, 0x411111f0 },
7677 { 0x20, 0x8000ffff },
7678 { }
7679 },
7680 .chain_id = ALC269_FIXUP_DMIC,
7681 },
7682 [ALC269_FIXUP_CZC_L101] = {
7683 .type = HDA_FIXUP_PINS,
7684 .v.pins = (const struct hda_pintbl[]) {
7685 { 0x12, 0x40000000 },
7686 { 0x14, 0x01014010 }, /* speaker */
7687 { 0x15, 0x411111f0 }, /* HP out */
7688 { 0x16, 0x411111f0 },
7689 { 0x18, 0x01a19020 }, /* mic */
7690 { 0x19, 0x02a19021 },
7691 { 0x1a, 0x0181302f },
7692 { 0x1b, 0x0221401f },
7693 { 0x1c, 0x411111f0 },
7694 { 0x1d, 0x4044c601 },
7695 { 0x1e, 0x411111f0 },
7696 { }
7697 },
7698 .chain_id = ALC269_FIXUP_DMIC,
7699 },
7700 [ALC269_FIXUP_LEMOTE_A1802] = {
7701 .type = HDA_FIXUP_PINS,
7702 .v.pins = (const struct hda_pintbl[]) {
7703 { 0x12, 0x40000000 },
7704 { 0x14, 0x90170110 }, /* speaker */
7705 { 0x17, 0x411111f0 },
7706 { 0x18, 0x03a19040 }, /* mic1 */
7707 { 0x19, 0x90a70130 }, /* mic2 */
7708 { 0x1a, 0x411111f0 },
7709 { 0x1b, 0x411111f0 },
7710 { 0x1d, 0x40489d2d },
7711 { 0x1e, 0x411111f0 },
7712 { 0x20, 0x0003ffff },
7713 { 0x21, 0x03214020 },
7714 { }
7715 },
7716 .chain_id = ALC269_FIXUP_DMIC,
7717 },
7718 [ALC269_FIXUP_LEMOTE_A190X] = {
7719 .type = HDA_FIXUP_PINS,
7720 .v.pins = (const struct hda_pintbl[]) {
7721 { 0x14, 0x99130110 }, /* speaker */
7722 { 0x15, 0x0121401f }, /* HP out */
7723 { 0x18, 0x01a19c20 }, /* rear mic */
7724 { 0x19, 0x99a3092f }, /* front mic */
7725 { 0x1b, 0x0201401f }, /* front lineout */
7726 { }
7727 },
7728 .chain_id = ALC269_FIXUP_DMIC,
7729 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08007730 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
7731 .type = HDA_FIXUP_PINS,
7732 .v.pins = (const struct hda_pintbl[]) {
7733 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7734 { }
7735 },
7736 .chained = true,
7737 .chain_id = ALC269_FIXUP_HEADSET_MODE
7738 },
Hui Wangfc19d552020-09-09 10:00:41 +08007739 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
7740 .type = HDA_FIXUP_VERBS,
7741 .v.verbs = (const struct hda_verb[]) {
7742 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7743 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7744 { }
7745 },
7746 .chained = true,
Takashi Iwaic84bfed2020-11-27 15:11:04 +01007747 .chain_id = ALC289_FIXUP_ASUS_GA502
Hui Wangfc19d552020-09-09 10:00:41 +08007748 },
Hui Wang13468bf2020-09-28 16:01:17 +08007749 [ALC274_FIXUP_HP_MIC] = {
7750 .type = HDA_FIXUP_VERBS,
7751 .v.verbs = (const struct hda_verb[]) {
7752 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7753 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7754 { }
7755 },
7756 },
Kailang Yang8a8de09c2020-10-27 16:46:38 +08007757 [ALC274_FIXUP_HP_HEADSET_MIC] = {
7758 .type = HDA_FIXUP_FUNC,
7759 .v.func = alc274_fixup_hp_headset_mic,
7760 .chained = true,
7761 .chain_id = ALC274_FIXUP_HP_MIC
7762 },
Kailang Yangef9ce662020-11-03 15:40:35 +08007763 [ALC256_FIXUP_ASUS_HPE] = {
7764 .type = HDA_FIXUP_VERBS,
7765 .v.verbs = (const struct hda_verb[]) {
7766 /* Set EAPD high */
7767 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7768 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
7769 { }
7770 },
7771 .chained = true,
7772 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7773 },
Kailang Yang446b8182020-11-02 15:00:12 +08007774 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
7775 .type = HDA_FIXUP_FUNC,
7776 .v.func = alc_fixup_headset_jack,
7777 .chained = true,
7778 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7779 },
Kailang Yanga0ccbc52020-11-06 15:20:38 +08007780 [ALC287_FIXUP_HP_GPIO_LED] = {
7781 .type = HDA_FIXUP_FUNC,
7782 .v.func = alc287_fixup_hp_gpio_led,
7783 },
Kailang Yang9e885772020-11-03 15:30:51 +08007784 [ALC256_FIXUP_HP_HEADSET_MIC] = {
7785 .type = HDA_FIXUP_FUNC,
7786 .v.func = alc274_fixup_hp_headset_mic,
7787 },
Kailang Yang92666d42020-11-19 17:04:21 +08007788 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
7789 .type = HDA_FIXUP_FUNC,
7790 .v.func = alc_fixup_no_int_mic,
7791 .chained = true,
7792 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7793 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007794};
7795
7796static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01007797 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02007798 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
7799 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02007800 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02007801 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
7802 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02007803 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
7804 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05007805 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01007806 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02007807 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Chris Chiu705b65f2018-12-05 14:48:54 +08007808 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007809 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01007810 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiuc7531e32019-03-21 17:17:31 +08007811 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
7812 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007813 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007814 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007815 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007816 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7817 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
7818 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08007819 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007820 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007821 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007822 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
David Henningssonaaedfb42013-08-16 14:09:02 +02007823 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08007824 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01007825 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01007826 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007827 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
7828 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01007829 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02007830 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7831 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
7832 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01007833 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
7834 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01007835 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02007836 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01007837 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08007838 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7839 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08007840 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02007841 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02007842 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08007843 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08007844 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7845 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01007846 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7847 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7848 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7849 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7850 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007851 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007852 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01007853 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08007854 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08007855 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwaie312a862018-03-06 12:14:17 +01007856 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Takashi Iwai493de342017-02-28 17:27:57 +01007857 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kailang Yang5f364132017-07-25 16:28:16 +08007858 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08007859 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
7860 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007861 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
7862 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08007863 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08007864 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08007865 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08007866 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08007867 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
7868 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08007869 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
7870 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yang92666d42020-11-19 17:04:21 +08007871 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
7872 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
Kailang Yanga22aa262014-04-23 17:34:28 +08007873 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
7874 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007875 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01007876 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01007877 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
David Henningsson33f4acd2015-01-07 15:50:13 +01007878 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08007879 /* ALC282 */
Hui Wang7976eb42015-02-13 11:14:41 +08007880 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007881 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007882 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007883 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7884 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7885 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
7886 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007887 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007888 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007889 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7890 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007891 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007892 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
TienFu Chenb4b33f92015-01-20 15:06:21 +01007893 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
TienFu Chen3271cb22015-02-10 09:09:41 +01007894 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yangc60666b2014-02-21 16:23:35 +08007895 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007896 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7897 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7898 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007899 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Keith Packard98973f22015-07-15 12:14:39 -07007900 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007901 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7902 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007903 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007904 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007905 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007906 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007907 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7908 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7909 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7910 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7911 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007912 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007913 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007914 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007915 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7916 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7917 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007918 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
7919 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007920 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08007921 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007922 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007923 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007924 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7925 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007926 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7927 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08007928 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08007929 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7930 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7931 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
7932 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwaif8839822016-02-25 14:31:59 +01007933 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01007934 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7935 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Takashi Iwai563785e2018-11-12 09:43:12 +01007936 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08007937 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007938 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Takashi Iwaiaeedad22020-11-28 10:00:15 +01007939 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01007940 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
7941 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05007942 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02007943 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Sam Bazleyd33cd422019-09-01 03:31:30 +01007944 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08007945 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
7946 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Kailang Yang56496252020-07-29 15:09:27 +08007947 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Qiu Wenbo08befca2020-10-02 20:44:54 +08007948 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08007949 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08007950 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Kailang Yanga0ccbc52020-11-06 15:20:38 +08007951 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
7952 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007953 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02007954 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02007955 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01007956 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007957 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02007958 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02007959 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02007960 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiu5cfca592020-12-07 15:27:55 +08007961 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02007962 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
7963 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007964 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
7965 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
7966 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01007967 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01007968 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02007969 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Chris Chiu48e01502019-12-30 11:11:18 +08007970 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Daniel Drake8c8967a2019-10-17 16:15:01 +08007971 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08007972 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08007973 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007974 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08007975 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02007976 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06007977 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02007978 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02007979 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06007980 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02007981 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiu7e413522020-12-09 12:57:30 +08007982 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007983 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Kailang Yangef9ce662020-11-03 15:40:35 +08007984 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
Armas Spann4b43d052020-07-24 16:06:16 +02007985 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Armas Spann293a92c2020-07-24 16:08:37 +02007986 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007987 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Chris Chiueeed4cd2017-02-28 14:17:15 -06007988 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02007989 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
7990 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
7991 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
7992 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02007993 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01007994 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02007995 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007996 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
7997 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
7998 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02007999 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02008000 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02008001 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02008002 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Takashi Iwai88776f32015-05-01 09:20:34 +02008003 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01008004 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
David Henningsson2041d562014-06-13 11:15:44 +02008005 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08008006 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02008007 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09008008 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02008009 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07008010 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8011 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07008012 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09008013 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8014 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01008015 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09008016 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02008017 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8018 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01008019 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008020 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller89e3a562019-01-30 16:12:31 -07008021 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008022 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8023 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8024 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8025 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8026 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8027 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8028 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8029 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8030 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8031 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8032 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8033 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8034 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8035 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8036 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8037 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8038 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8039 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8040 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8041 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8042 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8043 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8044 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8045 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8046 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8047 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8048 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller80a50522019-05-07 17:11:08 -04008049 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller891afcf2019-05-10 10:15:07 -04008050 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8051 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
8052 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008053 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8054 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8055 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8056 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8057 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8058 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8059 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8060 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8061 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8062 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008063 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Hui Wangef0b3202020-04-27 11:00:39 +08008064 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008065 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8066 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8067 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8068 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8069 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaib590b382020-05-14 18:05:33 +02008070 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02008071 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02008072 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02008073 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02008074 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02008075 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01008076 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02008077 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02008078 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05008079 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02008080 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01008081 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02008082 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01008083 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07008084 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02008085 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008086 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8087 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02008088 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02008089 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008090 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8091 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8092 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01008093 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008094 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8095 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8096 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01008097 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09008098 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02008099 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang Yang446b8182020-11-02 15:00:12 +08008100 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8101 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Kailang3694cb22015-12-28 11:35:24 +08008102 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08008103 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08008104 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02008105 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08008106 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08008107 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08008108 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08008109 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08008110 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8111 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
David Henningsson56f27012016-01-11 09:33:14 +01008112 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01008113 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02008114 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
David Henningssona4a9e082013-08-16 14:09:01 +02008115 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02008116 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02008117 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008118 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02008119 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01008120 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02008121 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02008122 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08008123 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008124 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02008125 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008126 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008127 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8128 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8129 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008130 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008131 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8132 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningsson012e7eb2012-08-08 08:43:37 +02008133 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008134 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008135 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008136 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8137 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8138 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02008139 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Hui Wangfc19d552020-09-09 10:00:41 +08008140 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Hui Wang695d1ec2019-11-21 10:54:27 +08008141 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008142 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008143 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8144 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008145 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008146
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01008147#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02008148 /* Below is a quirk table taken from the old code.
8149 * Basically the device should work as is without the fixup table.
8150 * If BIOS doesn't give a proper info, enable the corresponding
8151 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008152 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02008153 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8154 ALC269_FIXUP_AMIC),
8155 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008156 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8157 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8158 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8159 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8160 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8161 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8162 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8163 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8164 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8165 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8166 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8167 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8168 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8169 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8170 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8171 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8172 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8173 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8174 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8175 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8176 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8177 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8178 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8179 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8180 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8181 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8182 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8183 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8184 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8185 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8186 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8187 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8188 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8189 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8190 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8191 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8192 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8193 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8194#endif
8195 {}
8196};
8197
David Henningsson214eef72014-07-22 14:09:35 +02008198static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8199 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8200 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8201 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8202 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008203 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02008204 {}
8205};
8206
Takashi Iwai1727a772013-01-10 09:52:52 +01008207static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02008208 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8209 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008210 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8211 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8212 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02008213 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02008214 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8215 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02008216 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02008217 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008218 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008219 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02008220 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8221 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008222 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8223 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08008224 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08008225 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02008226 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01008227 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02008228 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02008229 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008230 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008231 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02008232 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008233 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8234 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8235 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8236 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8237 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8238 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8239 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8240 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8241 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8242 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8243 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8244 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8245 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8246 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8247 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8248 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8249 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8250 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8251 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8252 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8253 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8254 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8255 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8256 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8257 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8258 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8259 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8260 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8261 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8262 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8263 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8264 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8265 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8266 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8267 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8268 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8269 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8270 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8271 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8272 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01008273 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008274 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
8275 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8276 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8277 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8278 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8279 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8280 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8281 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8282 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8283 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8284 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8285 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8286 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8287 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8288 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008289 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8290 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8291 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08008292 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008293 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01008294 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008295 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8296 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8297 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8298 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8299 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8300 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8301 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8302 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8303 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8304 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8305 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8306 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8307 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8308 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8309 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8310 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8311 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08008312 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8313 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008314 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02008315 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008316 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07008317 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08008318 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08008319 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02008320 {}
8321};
Kailang Yangcfc5a842016-02-03 15:20:39 +08008322#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08008323 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02008324
Hui Wange8191a82015-04-24 13:39:59 +08008325#define ALC256_STANDARD_PINS \
8326 {0x12, 0x90a60140}, \
8327 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08008328 {0x21, 0x02211020}
8329
David Henningssonfea185e2014-09-03 10:23:04 +02008330#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008331 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08008332
David Henningssonfea185e2014-09-03 10:23:04 +02008333#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008334 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02008335
8336#define ALC292_STANDARD_PINS \
8337 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08008338 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08008339
Hui Wang3f6409702016-09-11 11:26:16 +08008340#define ALC295_STANDARD_PINS \
8341 {0x12, 0xb7a60130}, \
8342 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08008343 {0x21, 0x04211020}
8344
Woodrow Shen703867e2015-08-05 12:34:12 +08008345#define ALC298_STANDARD_PINS \
8346 {0x12, 0x90a60130}, \
8347 {0x21, 0x03211020}
8348
Hui Wange1918932014-05-26 16:22:44 +08008349static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08008350 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
8351 {0x14, 0x01014020},
8352 {0x17, 0x90170110},
8353 {0x18, 0x02a11030},
8354 {0x19, 0x0181303F},
8355 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06008356 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8357 {0x12, 0x90a601c0},
8358 {0x14, 0x90171120},
8359 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06008360 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8361 {0x14, 0x90170110},
8362 {0x1b, 0x90a70130},
8363 {0x21, 0x03211020}),
8364 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8365 {0x1a, 0x90a70130},
8366 {0x1b, 0x90170110},
8367 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01008368 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008369 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008370 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008371 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01008372 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008373 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008374 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008375 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08008376 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8377 ALC225_STANDARD_PINS,
8378 {0x12, 0xb7a60150},
8379 {0x14, 0x901701a0}),
8380 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8381 ALC225_STANDARD_PINS,
8382 {0x12, 0xb7a60150},
8383 {0x14, 0x901701b0}),
8384 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8385 ALC225_STANDARD_PINS,
8386 {0x12, 0xb7a60130},
8387 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05008388 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8389 {0x1b, 0x01111010},
8390 {0x1e, 0x01451130},
8391 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08008392 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
8393 {0x12, 0x90a60140},
8394 {0x14, 0x90170110},
8395 {0x19, 0x02a11030},
8396 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08008397 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8398 {0x14, 0x90170110},
8399 {0x19, 0x02a11030},
8400 {0x1a, 0x02a11040},
8401 {0x1b, 0x01014020},
8402 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08008403 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8404 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08008405 {0x19, 0x02a11030},
8406 {0x1a, 0x02a11040},
8407 {0x1b, 0x01011020},
8408 {0x21, 0x0221101f}),
8409 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8410 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08008411 {0x19, 0x02a11020},
8412 {0x1a, 0x02a11030},
8413 {0x21, 0x0221101f}),
Kailang Yang92666d42020-11-19 17:04:21 +08008414 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
8415 {0x21, 0x02211010}),
Kailang Yang9e885772020-11-03 15:30:51 +08008416 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8417 {0x14, 0x90170110},
8418 {0x19, 0x02a11020},
8419 {0x21, 0x02211030}),
Hui Wangc77900e2014-09-03 11:31:07 +08008420 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08008421 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08008422 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02008423 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08008424 {0x14, 0x90170130},
8425 {0x21, 0x02211040}),
8426 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008427 {0x12, 0x90a60140},
8428 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02008429 {0x21, 0x02211020}),
8430 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8431 {0x12, 0x90a60160},
8432 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008433 {0x21, 0x02211030}),
8434 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08008435 {0x14, 0x90170110},
8436 {0x1b, 0x02011020},
8437 {0x21, 0x0221101f}),
8438 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08008439 {0x14, 0x90170110},
8440 {0x1b, 0x01011020},
8441 {0x21, 0x0221101f}),
8442 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02008443 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02008444 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02008445 {0x21, 0x0221103f}),
8446 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08008447 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08008448 {0x1b, 0x01011020},
8449 {0x21, 0x0221103f}),
8450 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8451 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08008452 {0x1b, 0x02011020},
8453 {0x21, 0x0221103f}),
8454 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008455 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008456 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008457 {0x21, 0x0221105f}),
8458 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008459 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008460 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008461 {0x21, 0x0221101f}),
8462 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008463 {0x12, 0x90a60160},
8464 {0x14, 0x90170120},
8465 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008466 {0x21, 0x0321102f}),
8467 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8468 {0x12, 0x90a60160},
8469 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008470 {0x21, 0x02211040}),
8471 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8472 {0x12, 0x90a60160},
8473 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008474 {0x21, 0x02211050}),
8475 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8476 {0x12, 0x90a60170},
8477 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008478 {0x21, 0x02211030}),
8479 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8480 {0x12, 0x90a60170},
8481 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008482 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08008483 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08008484 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08008485 {0x14, 0x90171130},
8486 {0x21, 0x02211040}),
8487 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8488 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08008489 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08008490 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02008491 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02008492 {0x12, 0x90a60180},
8493 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02008494 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08008495 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8496 {0x12, 0x90a60180},
8497 {0x14, 0x90170120},
8498 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08008499 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8500 {0x1b, 0x01011020},
8501 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008502 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8503 {0x14, 0x90170110},
8504 {0x1b, 0x90a70130},
8505 {0x21, 0x04211020}),
8506 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8507 {0x14, 0x90170110},
8508 {0x1b, 0x90a70130},
8509 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08008510 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08008511 {0x12, 0x90a60130},
8512 {0x14, 0x90170110},
8513 {0x21, 0x03211020}),
8514 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08008515 {0x12, 0x90a60130},
8516 {0x14, 0x90170110},
8517 {0x21, 0x04211020}),
8518 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08008519 {0x1a, 0x90a70130},
8520 {0x1b, 0x90170110},
8521 {0x21, 0x03211020}),
Kailang Yang9e885772020-11-03 15:30:51 +08008522 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8523 {0x14, 0x90170110},
8524 {0x19, 0x02a11020},
8525 {0x21, 0x0221101f}),
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008526 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
8527 {0x17, 0x90170110},
8528 {0x19, 0x03a11030},
8529 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01008530 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
8531 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01008532 {0x14, 0x90170110},
8533 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008534 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08008535 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
8536 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08008537 {0x14, 0x90170110},
8538 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08008539 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08008540 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08008541 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02008542 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008543 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02008544 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02008545 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02008546 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08008547 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008548 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008549 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008550 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008551 {0x21, 0x03211040}),
8552 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008553 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008554 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008555 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08008556 {0x21, 0x03211020}),
8557 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008558 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008559 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008560 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008561 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08008562 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02008563 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08008564 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08008565 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08008566 {0x21, 0x04211020}),
David Henningsson76c21322014-06-24 14:46:54 +02008567 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008568 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02008569 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02008570 {0x21, 0x0321101f}),
8571 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8572 {0x12, 0x90a60160},
8573 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008574 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08008575 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008576 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08008577 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08008578 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08008579 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08008580 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Hui Wangc4cfcf62018-11-26 14:17:16 +08008581 {0x12, 0x90a60130},
8582 {0x14, 0x90170110},
8583 {0x19, 0x04a11040},
8584 {0x21, 0x04211020}),
Hui Wangc72b9bf2020-12-05 13:11:30 +08008585 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8586 {0x14, 0x90170110},
8587 {0x17, 0x90170111},
8588 {0x19, 0x03a11030},
8589 {0x21, 0x03211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08008590 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
8591 {0x12, 0x90a60130},
8592 {0x17, 0x90170110},
8593 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02008594 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08008595 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08008596 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08008597 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08008598 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008599 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008600 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08008601 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08008602 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008603 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008604 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008605 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08008606 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008607 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008608 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008609 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008610 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008611 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008612 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008613 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008614 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008615 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08008616 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008617 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008618 {0x14, 0x90170110},
8619 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008620 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08008621 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008622 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008623 {0x14, 0x90170110},
8624 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08008625 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08008626 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008627 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08008628 {0x14, 0x90170110},
8629 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008630 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08008631 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008632 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08008633 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08008634 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08008635 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08008636 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008637 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08008638 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08008639 {0x16, 0x01014020},
8640 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08008641 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02008642 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008643 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08008644 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02008645 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008646 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02008647 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02008648 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08008649 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02008650 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008651 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08008652 {0x13, 0x90a60140}),
Jian-Hong Paneeacd802020-11-24 17:20:25 +08008653 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
8654 {0x17, 0x90170110},
8655 {0x21, 0x04211020}),
Chris Chiud8ae4582018-12-07 17:17:11 +08008656 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
8657 {0x14, 0x90170110},
8658 {0x1b, 0x90a70130},
8659 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08008660 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8661 {0x12, 0x90a60130},
8662 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08008663 {0x21, 0x03211020}),
8664 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8665 {0x12, 0x90a60130},
8666 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08008667 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02008668 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
8669 {0x12, 0x90a60130},
8670 {0x17, 0x90170110},
8671 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08008672 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08008673 {0x12, 0x90a60120},
8674 {0x17, 0x90170110},
8675 {0x21, 0x04211030}),
8676 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08008677 {0x12, 0x90a60130},
8678 {0x17, 0x90170110},
8679 {0x21, 0x03211020}),
8680 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
8681 {0x12, 0x90a60130},
8682 {0x17, 0x90170110},
8683 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08008684 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08008685 {0x14, 0x90170110},
8686 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08008687 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8688 {0x14, 0x90170110},
8689 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08008690 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08008691 ALC295_STANDARD_PINS,
8692 {0x17, 0x21014020},
8693 {0x18, 0x21a19030}),
8694 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8695 ALC295_STANDARD_PINS,
8696 {0x17, 0x21014040},
8697 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08008698 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8699 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08008700 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08008701 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02008702 {0x17, 0x90170110}),
8703 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8704 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08008705 {0x17, 0x90170140}),
8706 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
8707 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02008708 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08008709 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
8710 {0x12, 0xb7a60140},
8711 {0x13, 0xb7a60150},
8712 {0x17, 0x90170110},
8713 {0x1a, 0x03011020},
8714 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00008715 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
8716 {0x12, 0xb7a60140},
8717 {0x17, 0x90170110},
8718 {0x1a, 0x03a11030},
8719 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08008720 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8721 ALC225_STANDARD_PINS,
8722 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08008723 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08008724 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
8725 {0x14, 0x01014010},
8726 {0x17, 0x90170120},
8727 {0x18, 0x02a11030},
8728 {0x19, 0x02a1103f},
8729 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08008730 {}
8731};
Takashi Iwai1d045db2011-07-07 18:23:21 +02008732
Hui Wang7c0a6932019-08-16 14:27:40 +08008733/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
8734 * more machines, don't need to match all valid pins, just need to match
8735 * all the pins defined in the tbl. Just because of this reason, it is possible
8736 * that a single machine matches multiple tbls, so there is one limitation:
8737 * at most one tbl is allowed to define for the same vendor and same codec
8738 */
8739static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
8740 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
8741 {0x19, 0x40000000},
8742 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08008743 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8744 {0x19, 0x40000000},
8745 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08008746 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8747 {0x19, 0x40000000},
8748 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08008749 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
8750 {0x19, 0x40000000},
8751 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08008752 {}
8753};
8754
Takashi Iwai546bb672012-03-07 08:37:19 +01008755static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02008756{
Kailang Yang526af6e2012-03-07 08:25:20 +01008757 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008758 int val;
8759
Kailang Yang526af6e2012-03-07 08:25:20 +01008760 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01008761 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01008762
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008763 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008764 alc_write_coef_idx(codec, 0xf, 0x960b);
8765 alc_write_coef_idx(codec, 0xe, 0x8817);
8766 }
8767
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008768 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008769 alc_write_coef_idx(codec, 0xf, 0x960b);
8770 alc_write_coef_idx(codec, 0xe, 0x8814);
8771 }
8772
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008773 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008774 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02008775 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008776 }
8777
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008778 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008779 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02008780 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008781 /* Capless ramp up clock control */
8782 alc_write_coef_idx(codec, 0xd, val | (1<<10));
8783 }
8784 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02008785 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02008786 /* Class D power on reset */
8787 alc_write_coef_idx(codec, 0x17, val | (1<<7));
8788 }
8789 }
8790
Takashi Iwai98b24882014-08-18 13:47:50 +02008791 /* HP */
8792 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008793}
8794
8795/*
8796 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008797static int patch_alc269(struct hda_codec *codec)
8798{
8799 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02008800 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008801
Takashi Iwai3de95172012-05-07 18:03:15 +02008802 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008803 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02008804 return err;
8805
8806 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01008807 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08008808 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008809
Takashi Iwai225068a2015-05-29 10:42:14 +02008810#ifdef CONFIG_PM
8811 codec->patch_ops.suspend = alc269_suspend;
8812 codec->patch_ops.resume = alc269_resume;
8813#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08008814 spec->shutup = alc_default_shutup;
8815 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02008816
Takashi Iwai7639a062015-03-03 10:07:24 +01008817 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01008818 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02008819 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008820 switch (alc_get_coef0(codec) & 0x00f0) {
8821 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01008822 if (codec->bus->pci &&
8823 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008824 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008825 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02008826 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008827 break;
8828 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01008829 if (codec->bus->pci &&
8830 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008831 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008832 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02008833 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008834 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02008835 case 0x0030:
8836 spec->codec_variant = ALC269_TYPE_ALC269VD;
8837 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008838 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02008839 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008840 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008841 if (err < 0)
8842 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08008843 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01008844 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008845 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01008846 break;
8847
8848 case 0x10ec0280:
8849 case 0x10ec0290:
8850 spec->codec_variant = ALC269_TYPE_ALC280;
8851 break;
8852 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01008853 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08008854 spec->shutup = alc282_shutup;
8855 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01008856 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02008857 case 0x10ec0233:
8858 case 0x10ec0283:
8859 spec->codec_variant = ALC269_TYPE_ALC283;
8860 spec->shutup = alc283_shutup;
8861 spec->init_hook = alc283_init;
8862 break;
Kailang Yang065380f2013-01-10 10:25:48 +01008863 case 0x10ec0284:
8864 case 0x10ec0292:
8865 spec->codec_variant = ALC269_TYPE_ALC284;
8866 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02008867 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08008868 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02008869 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02008870 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08008871 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02008872 spec->codec_variant = ALC269_TYPE_ALC286;
8873 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08008874 case 0x10ec0298:
8875 spec->codec_variant = ALC269_TYPE_ALC298;
8876 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08008877 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02008878 case 0x10ec0255:
8879 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08008880 spec->shutup = alc256_shutup;
8881 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02008882 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08008883 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08008884 case 0x10ec0256:
8885 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08008886 spec->shutup = alc256_shutup;
8887 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02008888 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08008889 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08008890 case 0x10ec0257:
8891 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08008892 spec->shutup = alc256_shutup;
8893 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08008894 spec->gen.mixer_nid = 0;
8895 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08008896 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +08008897 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +08008898 case 0x10ec0285:
Kailang Yang630e3612020-05-27 14:10:26 +08008899 case 0x10ec0287:
Kailang Yang0a6f0602017-06-30 16:00:48 +08008900 case 0x10ec0289:
8901 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08008902 spec->shutup = alc225_shutup;
8903 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08008904 spec->gen.mixer_nid = 0;
8905 break;
Kailang Yang42314302016-02-03 15:03:50 +08008906 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08008907 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08008908 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08008909 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08008910 spec->shutup = alc225_shutup;
8911 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01008912 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08008913 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008914 case 0x10ec0234:
8915 case 0x10ec0274:
8916 case 0x10ec0294:
8917 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08008918 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08008919 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08008920 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008921 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08008922 case 0x10ec0300:
8923 spec->codec_variant = ALC269_TYPE_ALC300;
8924 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008925 break;
Kailang Yangf0778872019-10-24 15:13:32 +08008926 case 0x10ec0623:
8927 spec->codec_variant = ALC269_TYPE_ALC623;
8928 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08008929 case 0x10ec0700:
8930 case 0x10ec0701:
8931 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +08008932 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +08008933 spec->codec_variant = ALC269_TYPE_ALC700;
8934 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08008935 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08008936 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08008937 break;
8938
Takashi Iwai1d045db2011-07-07 18:23:21 +02008939 }
8940
Kailang Yangad60d502013-06-28 12:03:01 +02008941 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05008942 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02008943 spec->init_hook = alc5505_dsp_init;
8944 }
8945
Takashi Iwaic9af7532019-05-10 11:01:43 +02008946 alc_pre_init(codec);
8947
Takashi Iwaiefe55732018-06-15 11:55:02 +02008948 snd_hda_pick_fixup(codec, alc269_fixup_models,
8949 alc269_fixup_tbl, alc269_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +08008950 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +08008951 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +02008952 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
8953 alc269_fixups);
8954 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8955
8956 alc_auto_parse_customize_define(codec);
8957
8958 if (has_cdefine_beep(codec))
8959 spec->gen.beep_nid = 0x01;
8960
Takashi Iwaia4297b52011-08-23 18:40:12 +02008961 /* automatic parse from the BIOS config */
8962 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008963 if (err < 0)
8964 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008965
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008966 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
8967 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
8968 if (err < 0)
8969 goto error;
8970 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02008971
Takashi Iwai1727a772013-01-10 09:52:52 +01008972 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01008973
Takashi Iwai1d045db2011-07-07 18:23:21 +02008974 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008975
8976 error:
8977 alc_free(codec);
8978 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02008979}
8980
8981/*
8982 * ALC861
8983 */
8984
Takashi Iwai1d045db2011-07-07 18:23:21 +02008985static int alc861_parse_auto_config(struct hda_codec *codec)
8986{
Takashi Iwai1d045db2011-07-07 18:23:21 +02008987 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008988 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
8989 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02008990}
8991
Takashi Iwai1d045db2011-07-07 18:23:21 +02008992/* Pin config fixes */
8993enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01008994 ALC861_FIXUP_FSC_AMILO_PI1505,
8995 ALC861_FIXUP_AMP_VREF_0F,
8996 ALC861_FIXUP_NO_JACK_DETECT,
8997 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01008998 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02008999};
9000
Takashi Iwai31150f22012-01-30 10:54:08 +01009001/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9002static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009003 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01009004{
9005 struct alc_spec *spec = codec->spec;
9006 unsigned int val;
9007
Takashi Iwai1727a772013-01-10 09:52:52 +01009008 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01009009 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01009010 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01009011 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9012 val |= AC_PINCTL_IN_EN;
9013 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02009014 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01009015 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01009016}
9017
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009018/* suppress the jack-detection */
9019static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009020 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009021{
Takashi Iwai1727a772013-01-10 09:52:52 +01009022 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009023 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009024}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009025
Takashi Iwai1727a772013-01-10 09:52:52 +01009026static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009027 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009028 .type = HDA_FIXUP_PINS,
9029 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009030 { 0x0b, 0x0221101f }, /* HP */
9031 { 0x0f, 0x90170310 }, /* speaker */
9032 { }
9033 }
9034 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009035 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009036 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01009037 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01009038 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009039 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009040 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009041 .v.func = alc_fixup_no_jack_detect,
9042 },
9043 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009044 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009045 .v.func = alc861_fixup_asus_amp_vref_0f,
9046 .chained = true,
9047 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009048 },
9049 [ALC660_FIXUP_ASUS_W7J] = {
9050 .type = HDA_FIXUP_VERBS,
9051 .v.verbs = (const struct hda_verb[]) {
9052 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9053 * for enabling outputs
9054 */
9055 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9056 { }
9057 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009058 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009059};
9060
9061static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009062 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01009063 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009064 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9065 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9066 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
9067 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
9068 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
9069 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009070 {}
9071};
9072
9073/*
9074 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009075static int patch_alc861(struct hda_codec *codec)
9076{
9077 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009078 int err;
9079
Takashi Iwai3de95172012-05-07 18:03:15 +02009080 err = alc_alloc_spec(codec, 0x15);
9081 if (err < 0)
9082 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009083
Takashi Iwai3de95172012-05-07 18:03:15 +02009084 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009085 if (has_cdefine_beep(codec))
9086 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009087
Takashi Iwai225068a2015-05-29 10:42:14 +02009088#ifdef CONFIG_PM
9089 spec->power_hook = alc_power_eapd;
9090#endif
9091
Takashi Iwaic9af7532019-05-10 11:01:43 +02009092 alc_pre_init(codec);
9093
Takashi Iwai1727a772013-01-10 09:52:52 +01009094 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9095 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009096
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009097 /* automatic parse from the BIOS config */
9098 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009099 if (err < 0)
9100 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009101
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009102 if (!spec->gen.no_analog) {
9103 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9104 if (err < 0)
9105 goto error;
9106 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009107
Takashi Iwai1727a772013-01-10 09:52:52 +01009108 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009109
Takashi Iwai1d045db2011-07-07 18:23:21 +02009110 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009111
9112 error:
9113 alc_free(codec);
9114 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009115}
9116
9117/*
9118 * ALC861-VD support
9119 *
9120 * Based on ALC882
9121 *
9122 * In addition, an independent DAC
9123 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009124static int alc861vd_parse_auto_config(struct hda_codec *codec)
9125{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009126 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009127 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9128 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009129}
9130
Takashi Iwai1d045db2011-07-07 18:23:21 +02009131enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009132 ALC660VD_FIX_ASUS_GPIO1,
9133 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009134};
9135
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009136/* exclude VREF80 */
9137static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009138 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009139{
Takashi Iwai1727a772013-01-10 09:52:52 +01009140 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01009141 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9142 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009143 }
9144}
9145
Takashi Iwaidf73d832018-06-19 23:05:47 +02009146/* reset GPIO1 */
9147static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9148 const struct hda_fixup *fix, int action)
9149{
9150 struct alc_spec *spec = codec->spec;
9151
9152 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9153 spec->gpio_mask |= 0x02;
9154 alc_fixup_gpio(codec, action, 0x01);
9155}
9156
Takashi Iwai1727a772013-01-10 09:52:52 +01009157static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009158 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +02009159 .type = HDA_FIXUP_FUNC,
9160 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009161 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009162 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009163 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009164 .v.func = alc861vd_fixup_dallas,
9165 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02009166};
9167
9168static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009169 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009170 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009171 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009172 {}
9173};
9174
Takashi Iwai1d045db2011-07-07 18:23:21 +02009175/*
9176 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009177static int patch_alc861vd(struct hda_codec *codec)
9178{
9179 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009180 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009181
Takashi Iwai3de95172012-05-07 18:03:15 +02009182 err = alc_alloc_spec(codec, 0x0b);
9183 if (err < 0)
9184 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009185
Takashi Iwai3de95172012-05-07 18:03:15 +02009186 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009187 if (has_cdefine_beep(codec))
9188 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009189
Takashi Iwai225068a2015-05-29 10:42:14 +02009190 spec->shutup = alc_eapd_shutup;
9191
Takashi Iwaic9af7532019-05-10 11:01:43 +02009192 alc_pre_init(codec);
9193
Takashi Iwai1727a772013-01-10 09:52:52 +01009194 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
9195 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009196
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009197 /* automatic parse from the BIOS config */
9198 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009199 if (err < 0)
9200 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009201
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009202 if (!spec->gen.no_analog) {
9203 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9204 if (err < 0)
9205 goto error;
9206 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009207
Takashi Iwai1727a772013-01-10 09:52:52 +01009208 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009209
Takashi Iwai1d045db2011-07-07 18:23:21 +02009210 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009211
9212 error:
9213 alc_free(codec);
9214 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009215}
9216
9217/*
9218 * ALC662 support
9219 *
9220 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9221 * configuration. Each pin widget can choose any input DACs and a mixer.
9222 * Each ADC is connected from a mixer of all inputs. This makes possible
9223 * 6-channel independent captures.
9224 *
9225 * In addition, an independent DAC for the multi-playback (not used in this
9226 * driver yet).
9227 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009228
9229/*
9230 * BIOS auto configuration
9231 */
9232
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009233static int alc662_parse_auto_config(struct hda_codec *codec)
9234{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02009235 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009236 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9237 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9238 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02009239
Takashi Iwai7639a062015-03-03 10:07:24 +01009240 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9241 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9242 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009243 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01009244 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009245 ssids = alc662_ssids;
9246 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009247}
9248
Todd Broch6be79482010-12-07 16:51:05 -08009249static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009250 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009251{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01009252 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009253 return;
Todd Broch6be79482010-12-07 16:51:05 -08009254 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9255 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9256 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9257 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9258 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01009259 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08009260}
9261
Takashi Iwai8e383952013-10-30 17:41:12 +01009262static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9263 { .channels = 2,
9264 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9265 { .channels = 4,
9266 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9267 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9268 { }
9269};
9270
9271/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009272static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01009273 const struct hda_fixup *fix, int action)
9274{
9275 if (action == HDA_FIXUP_ACT_BUILD) {
9276 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01009277 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01009278 }
9279}
9280
Takashi Iwaibf686652014-01-13 16:18:25 +01009281/* avoid D3 for keeping GPIO up */
9282static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9283 hda_nid_t nid,
9284 unsigned int power_state)
9285{
9286 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02009287 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01009288 return AC_PWRST_D0;
9289 return power_state;
9290}
9291
Takashi Iwai3e887f32014-01-10 17:50:58 +01009292static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9293 const struct hda_fixup *fix, int action)
9294{
9295 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009296
Takashi Iwai01e4a272018-06-19 22:47:30 +02009297 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01009298 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01009299 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01009300 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009301 }
9302}
9303
Kailang Yangc6790c82016-11-25 16:15:17 +08009304static void alc662_usi_automute_hook(struct hda_codec *codec,
9305 struct hda_jack_callback *jack)
9306{
9307 struct alc_spec *spec = codec->spec;
9308 int vref;
9309 msleep(200);
9310 snd_hda_gen_hp_automute(codec, jack);
9311
9312 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
9313 msleep(100);
9314 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9315 vref);
9316}
9317
9318static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
9319 const struct hda_fixup *fix, int action)
9320{
9321 struct alc_spec *spec = codec->spec;
9322 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9323 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9324 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
9325 }
9326}
9327
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009328static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
9329 struct hda_jack_callback *cb)
9330{
9331 /* surround speakers at 0x1b already get muted automatically when
9332 * headphones are plugged in, but we have to mute/unmute the remaining
9333 * channels manually:
9334 * 0x15 - front left/front right
9335 * 0x18 - front center/ LFE
9336 */
9337 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
9338 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
9339 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
9340 } else {
9341 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
9342 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
9343 }
9344}
9345
9346static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
9347 const struct hda_fixup *fix, int action)
9348{
9349 /* Pin 0x1b: shared headphones jack and surround speakers */
9350 if (!is_jack_detectable(codec, 0x1b))
9351 return;
9352
9353 switch (action) {
9354 case HDA_FIXUP_ACT_PRE_PROBE:
9355 snd_hda_jack_detect_enable_callback(codec, 0x1b,
9356 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +01009357 /* subwoofer needs an extra GPIO setting to become audible */
9358 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009359 break;
9360 case HDA_FIXUP_ACT_INIT:
9361 /* Make sure to start in a correct state, i.e. if
9362 * headphones have been plugged in before powering up the system
9363 */
9364 alc662_aspire_ethos_mute_speakers(codec, NULL);
9365 break;
9366 }
9367}
9368
Kailang Yang5af290282020-01-17 14:04:01 +08009369static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
9370 const struct hda_fixup *fix, int action)
9371{
9372 struct alc_spec *spec = codec->spec;
9373
9374 static const struct hda_pintbl pincfgs[] = {
9375 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
9376 { 0x1b, 0x0181304f },
9377 { }
9378 };
9379
9380 switch (action) {
9381 case HDA_FIXUP_ACT_PRE_PROBE:
9382 spec->gen.mixer_nid = 0;
9383 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9384 snd_hda_apply_pincfgs(codec, pincfgs);
9385 break;
9386 case HDA_FIXUP_ACT_INIT:
9387 alc_write_coef_idx(codec, 0x19, 0xa054);
9388 break;
9389 }
9390}
9391
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01009392static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +08009393 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
9394 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
9395 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
9396 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
9397 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
9398 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
9399 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
9400 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
9401 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
9402 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
9403 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
9404 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
9405 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
9406 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
9407 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
9408 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
9409 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
9410 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
9411 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
9412 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
9413 {}
9414};
9415
9416static void alc668_restore_default_value(struct hda_codec *codec)
9417{
9418 alc_process_coef_fw(codec, alc668_coefs);
9419}
9420
David Henningsson6cb3b702010-09-09 08:51:44 +02009421enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04009422 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01009423 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009424 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08009425 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009426 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009427 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02009428 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009429 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02009430 ALC662_FIXUP_ASUS_MODE1,
9431 ALC662_FIXUP_ASUS_MODE2,
9432 ALC662_FIXUP_ASUS_MODE3,
9433 ALC662_FIXUP_ASUS_MODE4,
9434 ALC662_FIXUP_ASUS_MODE5,
9435 ALC662_FIXUP_ASUS_MODE6,
9436 ALC662_FIXUP_ASUS_MODE7,
9437 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009438 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02009439 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02009440 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009441 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02009442 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009443 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02009444 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009445 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01009446 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009447 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009448 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08009449 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009450 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009451 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009452 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009453 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009454 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009455 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +02009456 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009457 ALC891_FIXUP_HEADSET_MODE,
9458 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009459 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009460 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08009461 ALC662_FIXUP_USI_FUNC,
9462 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08009463 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009464 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009465 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +08009466 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +08009467 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +08009468 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
David Henningsson6cb3b702010-09-09 08:51:44 +02009469};
9470
Takashi Iwai1727a772013-01-10 09:52:52 +01009471static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04009472 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009473 .type = HDA_FIXUP_PINS,
9474 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04009475 { 0x15, 0x99130112 }, /* subwoofer */
9476 { }
9477 }
9478 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01009479 [ALC662_FIXUP_LED_GPIO1] = {
9480 .type = HDA_FIXUP_FUNC,
9481 .v.func = alc662_fixup_led_gpio1,
9482 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009483 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009484 .type = HDA_FIXUP_PINS,
9485 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02009486 { 0x17, 0x99130112 }, /* subwoofer */
9487 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01009488 },
9489 .chained = true,
9490 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009491 },
Todd Broch6be79482010-12-07 16:51:05 -08009492 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009493 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01009494 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009495 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009496 [ALC662_FIXUP_CZC_ET26] = {
9497 .type = HDA_FIXUP_PINS,
9498 .v.pins = (const struct hda_pintbl[]) {
9499 {0x12, 0x403cc000},
9500 {0x14, 0x90170110}, /* speaker */
9501 {0x15, 0x411111f0},
9502 {0x16, 0x411111f0},
9503 {0x18, 0x01a19030}, /* mic */
9504 {0x19, 0x90a7013f}, /* int-mic */
9505 {0x1a, 0x01014020},
9506 {0x1b, 0x0121401f},
9507 {0x1c, 0x411111f0},
9508 {0x1d, 0x411111f0},
9509 {0x1e, 0x40478e35},
9510 {}
9511 },
9512 .chained = true,
9513 .chain_id = ALC662_FIXUP_SKU_IGNORE
9514 },
Anisse Astierd2ebd472011-01-20 12:36:21 +01009515 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009516 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009517 .v.verbs = (const struct hda_verb[]) {
9518 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
9519 {}
9520 }
9521 },
David Henningsson94024cd2011-04-29 14:10:55 +02009522 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009523 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02009524 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02009525 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009526 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009527 .type = HDA_FIXUP_PINS,
9528 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009529 { 0x14, 0x0221201f }, /* HP out */
9530 { }
9531 },
9532 .chained = true,
9533 .chain_id = ALC662_FIXUP_SKU_IGNORE
9534 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009535 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009536 .type = HDA_FIXUP_PINS,
9537 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009538 { 0x14, 0x99130110 }, /* speaker */
9539 { 0x18, 0x01a19c20 }, /* mic */
9540 { 0x19, 0x99a3092f }, /* int-mic */
9541 { 0x21, 0x0121401f }, /* HP out */
9542 { }
9543 },
9544 .chained = true,
9545 .chain_id = ALC662_FIXUP_SKU_IGNORE
9546 },
9547 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009548 .type = HDA_FIXUP_PINS,
9549 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009550 { 0x14, 0x99130110 }, /* speaker */
9551 { 0x18, 0x01a19820 }, /* mic */
9552 { 0x19, 0x99a3092f }, /* int-mic */
9553 { 0x1b, 0x0121401f }, /* HP out */
9554 { }
9555 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009556 .chained = true,
9557 .chain_id = ALC662_FIXUP_SKU_IGNORE
9558 },
9559 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009560 .type = HDA_FIXUP_PINS,
9561 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009562 { 0x14, 0x99130110 }, /* speaker */
9563 { 0x15, 0x0121441f }, /* HP */
9564 { 0x18, 0x01a19840 }, /* mic */
9565 { 0x19, 0x99a3094f }, /* int-mic */
9566 { 0x21, 0x01211420 }, /* HP2 */
9567 { }
9568 },
9569 .chained = true,
9570 .chain_id = ALC662_FIXUP_SKU_IGNORE
9571 },
9572 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009573 .type = HDA_FIXUP_PINS,
9574 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009575 { 0x14, 0x99130110 }, /* speaker */
9576 { 0x16, 0x99130111 }, /* speaker */
9577 { 0x18, 0x01a19840 }, /* mic */
9578 { 0x19, 0x99a3094f }, /* int-mic */
9579 { 0x21, 0x0121441f }, /* HP */
9580 { }
9581 },
9582 .chained = true,
9583 .chain_id = ALC662_FIXUP_SKU_IGNORE
9584 },
9585 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009586 .type = HDA_FIXUP_PINS,
9587 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009588 { 0x14, 0x99130110 }, /* speaker */
9589 { 0x15, 0x0121441f }, /* HP */
9590 { 0x16, 0x99130111 }, /* speaker */
9591 { 0x18, 0x01a19840 }, /* mic */
9592 { 0x19, 0x99a3094f }, /* int-mic */
9593 { }
9594 },
9595 .chained = true,
9596 .chain_id = ALC662_FIXUP_SKU_IGNORE
9597 },
9598 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009599 .type = HDA_FIXUP_PINS,
9600 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009601 { 0x14, 0x99130110 }, /* speaker */
9602 { 0x15, 0x01211420 }, /* HP2 */
9603 { 0x18, 0x01a19840 }, /* mic */
9604 { 0x19, 0x99a3094f }, /* int-mic */
9605 { 0x1b, 0x0121441f }, /* HP */
9606 { }
9607 },
9608 .chained = true,
9609 .chain_id = ALC662_FIXUP_SKU_IGNORE
9610 },
9611 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009612 .type = HDA_FIXUP_PINS,
9613 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009614 { 0x14, 0x99130110 }, /* speaker */
9615 { 0x17, 0x99130111 }, /* speaker */
9616 { 0x18, 0x01a19840 }, /* mic */
9617 { 0x19, 0x99a3094f }, /* int-mic */
9618 { 0x1b, 0x01214020 }, /* HP */
9619 { 0x21, 0x0121401f }, /* HP */
9620 { }
9621 },
9622 .chained = true,
9623 .chain_id = ALC662_FIXUP_SKU_IGNORE
9624 },
9625 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009626 .type = HDA_FIXUP_PINS,
9627 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009628 { 0x14, 0x99130110 }, /* speaker */
9629 { 0x12, 0x99a30970 }, /* int-mic */
9630 { 0x15, 0x01214020 }, /* HP */
9631 { 0x17, 0x99130111 }, /* speaker */
9632 { 0x18, 0x01a19840 }, /* mic */
9633 { 0x21, 0x0121401f }, /* HP */
9634 { }
9635 },
9636 .chained = true,
9637 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009638 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01009639 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009640 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009641 .v.func = alc_fixup_no_jack_detect,
9642 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02009643 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009644 .type = HDA_FIXUP_PINS,
9645 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02009646 { 0x1b, 0x02214020 }, /* Front HP */
9647 { }
9648 }
9649 },
Takashi Iwai125821a2012-06-22 14:30:29 +02009650 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009651 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02009652 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02009653 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009654 [ALC668_FIXUP_DELL_XPS13] = {
9655 .type = HDA_FIXUP_FUNC,
9656 .v.func = alc_fixup_dell_xps13,
9657 .chained = true,
9658 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
9659 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009660 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
9661 .type = HDA_FIXUP_FUNC,
9662 .v.func = alc_fixup_disable_aamix,
9663 .chained = true,
9664 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9665 },
Hui Wang493a52a2014-01-14 14:07:36 +08009666 [ALC668_FIXUP_AUTO_MUTE] = {
9667 .type = HDA_FIXUP_FUNC,
9668 .v.func = alc_fixup_auto_mute_via_amp,
9669 .chained = true,
9670 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
9671 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02009672 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
9673 .type = HDA_FIXUP_PINS,
9674 .v.pins = (const struct hda_pintbl[]) {
9675 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9676 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
9677 { }
9678 },
9679 .chained = true,
9680 .chain_id = ALC662_FIXUP_HEADSET_MODE
9681 },
9682 [ALC662_FIXUP_HEADSET_MODE] = {
9683 .type = HDA_FIXUP_FUNC,
9684 .v.func = alc_fixup_headset_mode_alc662,
9685 },
David Henningsson73bdd592013-04-15 15:44:14 +02009686 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
9687 .type = HDA_FIXUP_PINS,
9688 .v.pins = (const struct hda_pintbl[]) {
9689 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9690 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9691 { }
9692 },
9693 .chained = true,
9694 .chain_id = ALC668_FIXUP_HEADSET_MODE
9695 },
9696 [ALC668_FIXUP_HEADSET_MODE] = {
9697 .type = HDA_FIXUP_FUNC,
9698 .v.func = alc_fixup_headset_mode_alc668,
9699 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009700 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01009701 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009702 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01009703 .chained = true,
9704 .chain_id = ALC662_FIXUP_ASUS_MODE4
9705 },
David Henningsson61a75f12014-02-07 09:31:08 +01009706 [ALC662_FIXUP_BASS_16] = {
9707 .type = HDA_FIXUP_PINS,
9708 .v.pins = (const struct hda_pintbl[]) {
9709 {0x16, 0x80106111}, /* bass speaker */
9710 {}
9711 },
9712 .chained = true,
9713 .chain_id = ALC662_FIXUP_BASS_CHMAP,
9714 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009715 [ALC662_FIXUP_BASS_1A] = {
9716 .type = HDA_FIXUP_PINS,
9717 .v.pins = (const struct hda_pintbl[]) {
9718 {0x1a, 0x80106111}, /* bass speaker */
9719 {}
9720 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009721 .chained = true,
9722 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009723 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01009724 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009725 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009726 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009727 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009728 [ALC662_FIXUP_ASUS_Nx50] = {
9729 .type = HDA_FIXUP_FUNC,
9730 .v.func = alc_fixup_auto_mute_via_amp,
9731 .chained = true,
9732 .chain_id = ALC662_FIXUP_BASS_1A
9733 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009734 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
9735 .type = HDA_FIXUP_FUNC,
9736 .v.func = alc_fixup_headset_mode_alc668,
9737 .chain_id = ALC662_FIXUP_BASS_CHMAP
9738 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009739 [ALC668_FIXUP_ASUS_Nx51] = {
9740 .type = HDA_FIXUP_PINS,
9741 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009742 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9743 { 0x1a, 0x90170151 }, /* bass speaker */
9744 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009745 {}
9746 },
9747 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009748 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009749 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009750 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +02009751 .type = HDA_FIXUP_VERBS,
9752 .v.verbs = (const struct hda_verb[]) {
9753 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
9754 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
9755 {}
9756 },
9757 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009758 [ALC668_FIXUP_ASUS_G751] = {
9759 .type = HDA_FIXUP_PINS,
9760 .v.pins = (const struct hda_pintbl[]) {
9761 { 0x16, 0x0421101f }, /* HP */
9762 {}
9763 },
9764 .chained = true,
9765 .chain_id = ALC668_FIXUP_MIC_COEF
9766 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009767 [ALC891_FIXUP_HEADSET_MODE] = {
9768 .type = HDA_FIXUP_FUNC,
9769 .v.func = alc_fixup_headset_mode,
9770 },
9771 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
9772 .type = HDA_FIXUP_PINS,
9773 .v.pins = (const struct hda_pintbl[]) {
9774 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
9775 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
9776 { }
9777 },
9778 .chained = true,
9779 .chain_id = ALC891_FIXUP_HEADSET_MODE
9780 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009781 [ALC662_FIXUP_ACER_VERITON] = {
9782 .type = HDA_FIXUP_PINS,
9783 .v.pins = (const struct hda_pintbl[]) {
9784 { 0x15, 0x50170120 }, /* no internal speaker */
9785 { }
9786 }
9787 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009788 [ALC892_FIXUP_ASROCK_MOBO] = {
9789 .type = HDA_FIXUP_PINS,
9790 .v.pins = (const struct hda_pintbl[]) {
9791 { 0x15, 0x40f000f0 }, /* disabled */
9792 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009793 { }
9794 }
9795 },
Kailang Yangc6790c82016-11-25 16:15:17 +08009796 [ALC662_FIXUP_USI_FUNC] = {
9797 .type = HDA_FIXUP_FUNC,
9798 .v.func = alc662_fixup_usi_headset_mic,
9799 },
9800 [ALC662_FIXUP_USI_HEADSET_MODE] = {
9801 .type = HDA_FIXUP_PINS,
9802 .v.pins = (const struct hda_pintbl[]) {
9803 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
9804 { 0x18, 0x01a1903d },
9805 { }
9806 },
9807 .chained = true,
9808 .chain_id = ALC662_FIXUP_USI_FUNC
9809 },
Kailang Yangca169cc2017-04-25 16:17:40 +08009810 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
9811 .type = HDA_FIXUP_FUNC,
9812 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
9813 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009814 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
9815 .type = HDA_FIXUP_FUNC,
9816 .v.func = alc662_fixup_aspire_ethos_hp,
9817 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009818 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
9819 .type = HDA_FIXUP_PINS,
9820 .v.pins = (const struct hda_pintbl[]) {
9821 { 0x15, 0x92130110 }, /* front speakers */
9822 { 0x18, 0x99130111 }, /* center/subwoofer */
9823 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
9824 { }
9825 },
9826 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +01009827 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009828 },
Kailang Yang5af290282020-01-17 14:04:01 +08009829 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
9830 .type = HDA_FIXUP_FUNC,
9831 .v.func = alc671_fixup_hp_headset_mic2,
9832 },
Jian-Hong Pand858c702020-03-17 16:28:07 +08009833 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
9834 .type = HDA_FIXUP_PINS,
9835 .v.pins = (const struct hda_pintbl[]) {
9836 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9837 { }
9838 },
9839 .chained = true,
9840 .chain_id = ALC662_FIXUP_USI_FUNC
9841 },
Jian-Hong Pana1244582020-03-17 16:28:09 +08009842 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
9843 .type = HDA_FIXUP_PINS,
9844 .v.pins = (const struct hda_pintbl[]) {
9845 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
9846 { 0x1b, 0x0221144f },
9847 { }
9848 },
9849 .chained = true,
9850 .chain_id = ALC662_FIXUP_USI_FUNC
9851 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009852};
9853
Takashi Iwaia9111322011-05-02 11:30:18 +02009854static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009855 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +02009856 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +01009857 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +01009858 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +02009859 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +02009860 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +02009861 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -04009862 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Jian-Hong Pana1244582020-03-17 16:28:09 +08009863 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +08009864 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +02009865 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9866 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +02009867 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009868 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +02009869 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +01009870 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +01009871 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +08009872 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
9873 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +08009874 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009875 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Jeremy Szu148ebf542020-10-08 18:56:44 +08009876 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Kaho Ng2da2dc92016-05-09 00:27:49 +08009877 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +02009878 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwaidb8948e2016-01-18 09:17:30 +01009879 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009880 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +02009881 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
David Henningsson8e54b4a2014-02-07 09:31:07 +01009882 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +01009883 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009884 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
9885 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +01009886 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +01009887 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +01009888 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +01009889 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +02009890 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -05009891 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +08009892 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +08009893 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +06009894 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +02009895 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009896 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +02009897 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009898 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009899 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +01009900 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009901 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Takashi Iwai53c334a2011-08-23 18:27:14 +02009902
9903#if 0
9904 /* Below is a quirk table taken from the old code.
9905 * Basically the device should work as is without the fixup table.
9906 * If BIOS doesn't give a proper info, enable the corresponding
9907 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009908 */
Takashi Iwai53c334a2011-08-23 18:27:14 +02009909 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
9910 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
9911 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
9912 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
9913 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9914 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9915 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9916 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
9917 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
9918 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9919 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
9920 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
9921 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
9922 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
9923 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
9924 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9925 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
9926 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
9927 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9928 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9929 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9930 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9931 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
9932 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
9933 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
9934 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9935 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
9936 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
9937 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9938 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
9939 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9940 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9941 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
9942 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
9943 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
9944 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
9945 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
9946 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
9947 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
9948 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
9949 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
9950 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
9951 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9952 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
9953 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
9954 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
9955 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
9956 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
9957 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
9958 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
9959#endif
David Henningsson6cb3b702010-09-09 08:51:44 +02009960 {}
9961};
9962
Takashi Iwai1727a772013-01-10 09:52:52 +01009963static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009964 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
9965 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -08009966 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009967 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +02009968 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
9969 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
9970 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
9971 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
9972 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
9973 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
9974 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
9975 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009976 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02009977 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009978 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +02009979 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009980 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
9981 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
9982 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
9983 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
9984 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
9985 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
9986 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
9987 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +02009988 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02009989 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
9990 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
9991 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
9992 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
9993 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02009994 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009995 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -08009996 {}
9997};
David Henningsson6cb3b702010-09-09 08:51:44 +02009998
Hui Wang532895c2014-05-29 15:59:19 +08009999static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010000 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10001 {0x17, 0x02211010},
10002 {0x18, 0x01a19030},
10003 {0x1a, 0x01813040},
10004 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +080010005 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10006 {0x16, 0x01813030},
10007 {0x17, 0x02211010},
10008 {0x18, 0x01a19040},
10009 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +020010010 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010011 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010012 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010013 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +080010014 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +020010015 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10016 {0x12, 0x99a30130},
10017 {0x14, 0x90170110},
10018 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010019 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010020 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10021 {0x12, 0x99a30140},
10022 {0x14, 0x90170110},
10023 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010024 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010025 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10026 {0x12, 0x99a30150},
10027 {0x14, 0x90170110},
10028 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010029 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010030 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +020010031 {0x14, 0x90170110},
10032 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010033 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010034 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10035 {0x12, 0x90a60130},
10036 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +080010037 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +080010038 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10039 {0x14, 0x01014010},
10040 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +080010041 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +080010042 {0x1b, 0x01813030},
10043 {0x21, 0x02211020}),
10044 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10045 {0x14, 0x01014010},
10046 {0x18, 0x01a19040},
10047 {0x1b, 0x01813030},
10048 {0x21, 0x02211020}),
10049 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10050 {0x14, 0x01014020},
10051 {0x17, 0x90170110},
10052 {0x18, 0x01a19050},
10053 {0x1b, 0x01813040},
10054 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +080010055 {}
10056};
10057
Takashi Iwai1d045db2011-07-07 18:23:21 +020010058/*
10059 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010060static int patch_alc662(struct hda_codec *codec)
10061{
10062 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +020010063 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010064
Takashi Iwai3de95172012-05-07 18:03:15 +020010065 err = alc_alloc_spec(codec, 0x0b);
10066 if (err < 0)
10067 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010068
Takashi Iwai3de95172012-05-07 18:03:15 +020010069 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010070
Takashi Iwai225068a2015-05-29 10:42:14 +020010071 spec->shutup = alc_eapd_shutup;
10072
Takashi Iwai53c334a2011-08-23 18:27:14 +020010073 /* handle multiple HPs as is */
10074 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10075
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +020010076 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10077
Takashi Iwai7639a062015-03-03 10:07:24 +010010078 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +080010079 case 0x10ec0668:
10080 spec->init_hook = alc668_restore_default_value;
10081 break;
Kailang Yangf3f91852014-10-24 15:43:46 +080010082 }
Kailang Yang8663ff72012-06-29 09:35:52 +020010083
Takashi Iwaic9af7532019-05-10 11:01:43 +020010084 alc_pre_init(codec);
10085
Takashi Iwai1727a772013-01-10 09:52:52 +010010086 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010087 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +080010088 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +010010089 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010090
10091 alc_auto_parse_customize_define(codec);
10092
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010093 if (has_cdefine_beep(codec))
10094 spec->gen.beep_nid = 0x01;
10095
Takashi Iwai1bb7e432011-10-17 16:50:59 +020010096 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +010010097 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010098 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +080010099 err = alc_codec_rename(codec, "ALC272X");
10100 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010101 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +020010102 }
Kailang Yang274693f2009-12-03 10:07:50 +010010103
Takashi Iwaib9c51062011-08-24 18:08:07 +020010104 /* automatic parse from the BIOS config */
10105 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010106 if (err < 0)
10107 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010108
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010109 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +010010110 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +010010111 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010112 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010113 break;
10114 case 0x10ec0272:
10115 case 0x10ec0663:
10116 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +080010117 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010118 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010119 break;
10120 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010121 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010122 break;
10123 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010124 if (err < 0)
10125 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +010010126 }
Takashi Iwai2134ea42008-01-10 16:53:55 +010010127
Takashi Iwai1727a772013-01-10 09:52:52 +010010128 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010129
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010130 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010131
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010132 error:
10133 alc_free(codec);
10134 return err;
Kailang Yangb478b992011-05-18 11:51:15 +020010135}
10136
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010137/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010138 * ALC680 support
10139 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010140
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010141static int alc680_parse_auto_config(struct hda_codec *codec)
10142{
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010143 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010144}
10145
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010146/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010147 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010148static int patch_alc680(struct hda_codec *codec)
10149{
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010150 int err;
10151
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010152 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +020010153 err = alc_alloc_spec(codec, 0);
10154 if (err < 0)
10155 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010156
Takashi Iwai1ebec5f2011-08-15 13:21:48 +020010157 /* automatic parse from the BIOS config */
10158 err = alc680_parse_auto_config(codec);
10159 if (err < 0) {
10160 alc_free(codec);
10161 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010162 }
10163
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010164 return 0;
10165}
10166
10167/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070010168 * patch entries
10169 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010170static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +080010171 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010172 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +080010173 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +080010174 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010175 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
10176 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010177 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010178 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +080010179 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +080010180 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010181 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
10182 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +080010183 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010184 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
10185 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
10186 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
10187 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
10188 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
10189 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
10190 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010191 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010192 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
10193 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
10194 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
10195 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
10196 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
10197 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010198 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010199 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080010200 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010201 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010202 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010203 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10204 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10205 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010206 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080010207 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010208 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080010209 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080010210 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080010211 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010212 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10213 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10214 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10215 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10216 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10217 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10218 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10219 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10220 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10221 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10222 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10223 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10224 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10225 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080010226 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10227 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10228 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080010229 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010230 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010231 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10232 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10233 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10234 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10235 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10236 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10237 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10238 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10239 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10240 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10241 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
Kailang Yange5782a52020-11-27 14:39:23 +080010242 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010243 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10244 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080010245 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080010246 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080010247 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070010248 {} /* terminator */
10249};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010250MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010251
10252MODULE_LICENSE("GPL");
10253MODULE_DESCRIPTION("Realtek HD-audio codec");
10254
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010255static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010256 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010257};
10258
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010259module_hda_codec_driver(realtek_driver);